[Libreoffice-commits] core.git: 2 commits - chart2/qa oox/source

2013-12-11 Thread Pallavi Jadhav
 chart2/qa/extras/chart2export.cxx  |   22 ++
 chart2/qa/extras/data/docx/testStockChart.docx |binary
 oox/source/export/chartexport.cxx  |6 --
 oox/source/export/shapes.cxx   |   25 +++--
 4 files changed, 41 insertions(+), 12 deletions(-)

New commits:
commit e516f8be79ddc9d845d8141075f7d558c25c1636
Author: Pallavi Jadhav 
Date:   Wed Dec 4 15:03:00 2013 +0530

fdo#72226: Fix for Stock chart Invalid RT

  Issue :
In chart1.xml,
   

 
there are four types of series as Open,Low,High
and Close.

For Open series,
  
   
   
an attribute "val" should be 1 and not 0.
i.e. index should start from 1 and not from 0.

  Implementation :
- In ChartExport::exportCandleStickSeries(),
  Using idx variable, we are writing index value
  which should be greater than 0. So for idx=0,
  we are adding value 1 while writing index value.
- Added Unit tese case for chart export

Conflicts:
chart2/qa/extras/chart2export.cxx

Change-Id: I4d5ffefbc8fcf62b50c13ca1b3ed80290962fc4e
Reviewed-on: https://gerrit.libreoffice.org/6925
Tested-by: Norbert Thiebaud 
Reviewed-by: Norbert Thiebaud 

diff --git a/chart2/qa/extras/chart2export.cxx 
b/chart2/qa/extras/chart2export.cxx
index fa4d619..77a823a 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -23,10 +23,13 @@ public:
 void testErrorBarXLSX();
 void testTrendline();
 
+void testStockChart();
+
 CPPUNIT_TEST_SUITE(Chart2ExportTest);
 CPPUNIT_TEST(test);
 CPPUNIT_TEST(testErrorBarXLSX);
 CPPUNIT_TEST(testTrendline);
+CPPUNIT_TEST(testStockChart);
 CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -255,6 +258,25 @@ void Chart2ExportTest::testTrendline()
 
 }
 
+void Chart2ExportTest::testStockChart()
+{
+/*  For attached file Stock_Chart.docx, in chart1.xml,
+ * , there are four types of series as
+ * Open,Low,High and Close.
+ * For Open series, in 
+ * an attribute val of index should start from 1 and not from 0.
+ * Which was problem area.
+ */
+load("/chart2/qa/extras/data/docx/", "testStockChart.docx");
+{
+xmlDocPtr pXmlDoc = parseExport("word/charts/chart1.xml");
+if (!pXmlDoc)
+   return;
+  assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:stockChart/c:ser[1]/c:idx", "val", "1");
+  assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:stockChart/c:ser[1]/c:order", "val", "1");
+  assertXPath(pXmlDoc, 
"/c:chartSpace/c:chart/c:plotArea/c:stockChart/c:ser[1]/c:tx/c:strRef/c:strCache/c:pt/c:v",
 "Open");
+}
+}
 CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/chart2/qa/extras/data/docx/testStockChart.docx 
b/chart2/qa/extras/data/docx/testStockChart.docx
new file mode 100644
index 000..a804e7d
Binary files /dev/null and b/chart2/qa/extras/data/docx/testStockChart.docx 
differ
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index 3768cd3..9655f3e 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1626,6 +1626,7 @@ void ChartExport::exportCandleStickSeries(
 
 Reference< chart2::XChartDocument > xNewDoc( getModel(), 
uno::UNO_QUERY );
 const char* sSeries[] = 
{"values-first","values-max","values-min","values-last",0};
+
 for( sal_Int32 idx = 0; sSeries[idx] != 0 ; idx++ )
 {
 Reference< chart2::data::XLabeledDataSequence > xLabeledSeq( 
lcl_getDataSequenceByRole( aSeqCnt, OUString::createFromAscii(sSeries[idx]) ) );
@@ -1639,11 +1640,12 @@ void ChartExport::exportCandleStickSeries(
 FSEND );
 
 // TODO: idx and order
+// idx attribute should start from 1 and not from 
0.
 pFS->singleElement( FSNS( XML_c, XML_idx ),
-XML_val, I32S(idx),
+XML_val, I32S(idx+1),
 FSEND );
 pFS->singleElement( FSNS( XML_c, XML_order ),
-XML_val, I32S(idx),
+XML_val, I32S(idx+1),
 FSEND );
 
 // export label
commit 784d3e2b49fb55bfc46723a99fd00d43f31e090a
Author: Miklos Vajna 
Date:   Wed Dec 11 17:07:16 2013 +0100

drawingml export: fix EllipseShape for docx

Change-Id: Ifc5e6ae2f3161e33f93b1485269f6dc164f74e40

diff --git a/

[Libreoffice-commits] core.git: sw/qa sw/source

2013-11-14 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/ImageCrop.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   18 ++
 sw/source/filter/ww8/docxattributeoutput.cxx |   48 +++
 sw/source/filter/ww8/docxattributeoutput.hxx |6 ++-
 4 files changed, 63 insertions(+), 9 deletions(-)

New commits:
commit 7b947fe24299108fd74baa79c6c25ed8022caf78
Author: Pallavi Jadhav 
Date:   Mon Oct 14 14:47:15 2013 +0530

Save Image-Crop information in docx

Issue:-
1] When MS Office docx file containing cropped image is
   round tripped with LibreOffice 4.2, image looses
   its cropping effect.

Implentation:-
1] Function WriteSrcRect() is implemnted inside docxattributeoutput.cxx
2] It writes out xml tag  which is responsible for storing
   cropping parameters
3] Written Unit Test to verify cropping parameters

Conflicts:
sw/qa/extras/ooxmlimport/ooxmlimport.cxx
Reviewed on:
https://gerrit.libreoffice.org/6240

Change-Id: I6ab30305bae44ca1bfef73b0df2967d943ee60fe

diff --git a/sw/qa/extras/ooxmlexport/data/ImageCrop.docx 
b/sw/qa/extras/ooxmlexport/data/ImageCrop.docx
new file mode 100644
index 000..120ce78
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/ImageCrop.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 5141d36..925da1b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -92,6 +93,7 @@ protected:
 const char* aBlacklist[] = {
 "math-escape.docx",
 "math-mso2k7.docx",
+"ImageCrop.docx",
 };
 std::vector vBlacklist(aBlacklist, aBlacklist + 
SAL_N_ELEMENTS(aBlacklist));
 
@@ -1629,6 +1631,22 @@ DECLARE_OOXML_TEST(testImageData, "image_data.docx")
 CPPUNIT_ASSERT(getXPath(pXmlDoc, 
"/w:hdr/w:p/w:r/w:pict/v:shape/v:imagedata", "detectmouseclick").match("t"));
 }
 
+DECLARE_OOXML_TEST(testImageCrop, "ImageCrop.docx")
+{
+uno::Reference image = getShape(1);
+uno::Reference imageProperties(image, uno::UNO_QUERY);
+::com::sun::star::text::GraphicCrop aGraphicCropStruct;
+
+imageProperties->getPropertyValue( "GraphicCrop" ) >>= aGraphicCropStruct;
+
+CPPUNIT_ASSERT_EQUAL( sal_Int32( 2955 ), aGraphicCropStruct.Left );
+CPPUNIT_ASSERT_EQUAL( sal_Int32( 5477 ), aGraphicCropStruct.Right );
+CPPUNIT_ASSERT_EQUAL( sal_Int32( 2856 ), aGraphicCropStruct.Top );
+// FIXME import test is disabled (we only check after import-export-import)
+// The reason is that after import this is 2291 -- rounding error?
+CPPUNIT_ASSERT_EQUAL( sal_Int32( 2290 ), aGraphicCropStruct.Bottom );
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index cb16233..0173869 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -119,6 +119,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #if OSL_DEBUG_LEVEL > 1
 #include 
@@ -135,6 +136,7 @@ using namespace sw::util;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::drawing;
 
+
 class FFDataWriterHelper
 {
 ::sax_fastparser::FSHelperPtr m_pSerializer;
@@ -1171,7 +1173,7 @@ void DocxAttributeOutput::WritePostponedGraphic()
 for( std::list< PostponedGraphic >::const_iterator it = 
m_postponedGraphic->begin();
  it != m_postponedGraphic->end();
  ++it )
-FlyFrameGraphic( it->grfNode, it->size );
+FlyFrameGraphic( it->grfNode, it->size, 0, 0, it->pSdrObj );
 delete m_postponedGraphic;
 m_postponedGraphic = NULL;
 }
@@ -2687,9 +2689,37 @@ OString lcl_ConvertTransparency(const Color& rColor)
 return OString("");
 }
 
-void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const 
Size& rSize, const SwFlyFrmFmt* pOLEFrmFmt, SwOLENode* pOLENode )
+/* Writes  tag back to document.xml if a file conatins a cropped 
image.
+   NOTE : It works only for images of type JPEG,EMF/WMF and BMP.
+  It does not work for images of type PNG and GIF.
+*/
+void DocxAttributeOutput::WriteSrcRect(const SdrObject* pSdrObj )
+{
+uno::Reference< drawing::XShape > xShape( 
((SdrObject*)pSdrObj)->getUnoShape(), uno::UNO_QUERY );
+uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
+
+OUString sUrl;
+xPropSet->getPropertyValue("GraphicURL") >>= sUrl;
+Size aOriginalSize( GraphicObject::CreateGraphicObjectFromURL( sUrl 
).GetPrefSize() );
+
+::com::sun::star::text::GraphicCrop aGraphicCropStruct;
+xPro

[Libreoffice-commits] core.git: sw/source

2013-11-14 Thread Pallavi Jadhav
 sw/source/filter/ww8/docxattributeoutput.cxx |   21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

New commits:
commit ddaf39843ff8eac8e71a7d9a8bb74b34935cd399
Author: Pallavi Jadhav 
Date:   Thu Oct 31 15:27:00 2013 +0530

Save Image-Crop information in docx for PNG

 Issue:-
  1] When MS Office docx file containing cropped image is
 round tripped with LibreOffice 4.2, image looses
 its cropping effect.

 Implementation:-
  1] Function WriteSrcRect() is implemented inside docxattributeoutput.cxx
  2] It writes out xml tag  which is responsible for storing
 cropping parameters

Change-Id: I8814df40f9907512779b42c9ad2405953c70626b
Reviewed-on: https://gerrit.libreoffice.org/6507
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 0173869..2760f15 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2707,13 +2707,20 @@ void DocxAttributeOutput::WriteSrcRect(const SdrObject* 
pSdrObj )
 
 if ( (0 != aGraphicCropStruct.Left) || (0 != aGraphicCropStruct.Top) || (0 
!= aGraphicCropStruct.Right) || (0 != aGraphicCropStruct.Bottom) )
 {
-m_pSerializer->singleElementNS( XML_a, XML_srcRect,
-  XML_l, I32S(((aGraphicCropStruct.Left) * 
10)/aOriginalSize.Width()),
-  XML_t, I32S(((aGraphicCropStruct.Top) * 
10)/aOriginalSize.Height()),
-  XML_r, I32S(((aGraphicCropStruct.Right) * 
10)/aOriginalSize.Width()),
-  XML_b, I32S(((aGraphicCropStruct.Bottom) * 
10)/aOriginalSize.Height()),
-  FSEND );
-
+double  widthMultiplier  = 10.0/aOriginalSize.Width();
+double  heightMultiplier = 10.0/aOriginalSize.Height();
+
+double left   = aGraphicCropStruct.Left * widthMultiplier;
+double right  = aGraphicCropStruct.Right * widthMultiplier;
+double top= aGraphicCropStruct.Top * heightMultiplier;
+double bottom = aGraphicCropStruct.Bottom * heightMultiplier;
+
+m_pSerializer->singleElementNS( XML_a, XML_srcRect,
+ XML_l, I32S(left),
+ XML_t, I32S(top),
+ XML_r, I32S(right),
+ XML_b, I32S(bottom),
+ FSEND );
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa sw/source

2013-11-15 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/test_GIF_ImageCrop.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   18 ++
 sw/source/filter/ww8/docxattributeoutput.cxx  |   10 --
 3 files changed, 26 insertions(+), 2 deletions(-)

New commits:
commit 09d381adbfba893331a07918c9ec9b3c58939dfb
Author: Pallavi Jadhav 
Date:   Fri Nov 15 13:10:30 2013 +0530

Save Image-Crop information for GIF in docx

Issue:-
1] When MS Office docx file containing cropped image is
   round tripped with LibreOffice 4.2, image looses
   its cropping effect.
Implementation:-
1] Converted MAP unit, MAP_PIXEL to MAP_100TH_MM using
   PixelToLogic function.
   As for calculating EMU values for XML, we need
   Original Height and Width of an image in
   100thMM(HMM) format.
2] Written Export Unit Test (GIF) to verify cropping parameters.

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/6595

Change-Id: I54d7b08c96608a0cfca3c2f8833684c09848351c

diff --git a/sw/qa/extras/ooxmlexport/data/test_GIF_ImageCrop.docx 
b/sw/qa/extras/ooxmlexport/data/test_GIF_ImageCrop.docx
new file mode 100644
index 000..8fe7ff2
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/test_GIF_ImageCrop.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 23fe7cd..b7bdaef 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -94,6 +94,7 @@ protected:
 "math-escape.docx",
 "math-mso2k7.docx",
 "ImageCrop.docx",
+"test_GIF_ImageCrop.docx"
 };
 std::vector vBlacklist(aBlacklist, aBlacklist + 
SAL_N_ELEMENTS(aBlacklist));
 
@@ -1839,6 +1840,23 @@ DECLARE_OOXML_TEST(testParaAutoSpacing, 
"para-auto-spacing.docx")
 CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:spacing", 
"beforeAutospacing").match("1"));
 CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:spacing", 
"afterAutospacing").match("1"));
 }
+
+DECLARE_OOXML_TEST(testGIFImageCrop, "test_GIF_ImageCrop.docx")
+{
+uno::Reference image = getShape(1);
+uno::Reference imageProperties(image, uno::UNO_QUERY);
+::com::sun::star::text::GraphicCrop aGraphicCropStruct;
+
+imageProperties->getPropertyValue( "GraphicCrop" ) >>= aGraphicCropStruct;
+
+// FIXME import test is disabled (we only check after import-export-import)
+// The reason is that after import this is 1171 -- why?
+CPPUNIT_ASSERT_EQUAL( sal_Int32( 1265 ), aGraphicCropStruct.Left );
+CPPUNIT_ASSERT_EQUAL( sal_Int32( 4256 ), aGraphicCropStruct.Right );
+CPPUNIT_ASSERT_EQUAL( sal_Int32( 1109 ), aGraphicCropStruct.Top );
+CPPUNIT_ASSERT_EQUAL( sal_Int32( 1448 ), aGraphicCropStruct.Bottom );
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 70361fa..80c17e3 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2689,8 +2689,7 @@ OString lcl_ConvertTransparency(const Color& rColor)
 }
 
 /* Writes  tag back to document.xml if a file conatins a cropped 
image.
-   NOTE : It works only for images of type JPEG,EMF/WMF and BMP.
-  It does not work for images of type PNG and GIF.
+*  NOTE : Tested on images of type JPEG,EMF/WMF,BMP, PNG and GIF.
 */
 void DocxAttributeOutput::WriteSrcRect(const SdrObject* pSdrObj )
 {
@@ -2704,6 +2703,13 @@ void DocxAttributeOutput::WriteSrcRect(const SdrObject* 
pSdrObj )
 ::com::sun::star::text::GraphicCrop aGraphicCropStruct;
 xPropSet->getPropertyValue( "GraphicCrop" ) >>= aGraphicCropStruct;
 
+const MapMode aMap100mm( MAP_100TH_MM );
+const MapMode& mapMode = GraphicObject::CreateGraphicObjectFromURL( sUrl 
).GetPrefMapMode();
+if( mapMode.GetMapUnit() == MAP_PIXEL )
+{
+aOriginalSize = 
Application::GetDefaultDevice()->PixelToLogic(aOriginalSize, aMap100mm );
+}
+
 if ( (0 != aGraphicCropStruct.Left) || (0 != aGraphicCropStruct.Top) || (0 
!= aGraphicCropStruct.Right) || (0 != aGraphicCropStruct.Bottom) )
 {
 double  widthMultiplier  = 10.0/aOriginalSize.Width();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa

2013-11-15 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/test_PNG_ImageCrop.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   23 +-
 2 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 85ff539bb1b6fa90c16f80e44df5df0962521f72
Author: Pallavi Jadhav 
Date:   Fri Nov 15 16:49:31 2013 +0530

Added Unit test for PNG Crop image in Export.

Reviewed on:
https://gerrit.libreoffice.org/6677

Change-Id: I766460915775791388850691b3b940fe32190052

diff --git a/sw/qa/extras/ooxmlexport/data/test_PNG_ImageCrop.docx 
b/sw/qa/extras/ooxmlexport/data/test_PNG_ImageCrop.docx
new file mode 100644
index 000..7fda321
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/test_PNG_ImageCrop.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index b7bdaef..d182180 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -94,7 +94,8 @@ protected:
 "math-escape.docx",
 "math-mso2k7.docx",
 "ImageCrop.docx",
-"test_GIF_ImageCrop.docx"
+"test_GIF_ImageCrop.docx",
+"test_PNG_ImageCrop.docx"
 };
 std::vector vBlacklist(aBlacklist, aBlacklist + 
SAL_N_ELEMENTS(aBlacklist));
 
@@ -1857,6 +1858,26 @@ DECLARE_OOXML_TEST(testGIFImageCrop, 
"test_GIF_ImageCrop.docx")
 CPPUNIT_ASSERT_EQUAL( sal_Int32( 1448 ), aGraphicCropStruct.Bottom );
 }
 
+DECLARE_OOXML_TEST(testPNGImageCrop, "test_PNG_ImageCrop.docx")
+{
+/* The problem was image cropping information was not getting saved
+ * after roundtrip.
+ * Check for presenece of cropping parameters in exported file.
+ */
+uno::Reference image = getShape(1);
+uno::Reference imageProperties(image, uno::UNO_QUERY);
+::com::sun::star::text::GraphicCrop aGraphicCropStruct;
+
+imageProperties->getPropertyValue( "GraphicCrop" ) >>= aGraphicCropStruct;
+
+// FIXME import test is disabled (we only check after import-export-import)
+// The reason is that after import this is 1141 -- why?
+CPPUNIT_ASSERT_EQUAL( sal_Int32( 1231 ), aGraphicCropStruct.Left );
+CPPUNIT_ASSERT_EQUAL( sal_Int32( 1295 ), aGraphicCropStruct.Right );
+CPPUNIT_ASSERT_EQUAL( sal_Int32( 1358 ), aGraphicCropStruct.Top );
+CPPUNIT_ASSERT_EQUAL( sal_Int32( 737 ), aGraphicCropStruct.Bottom );
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa sw/source

2013-11-15 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/testFootnote.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|   10 ++
 sw/source/filter/ww8/docxattributeoutput.cxx|6 --
 sw/source/filter/ww8/docxattributeoutput.hxx|2 ++
 4 files changed, 16 insertions(+), 2 deletions(-)

New commits:
commit 5cdd6d28d10d815c046b65db48847558259a1d1a
Author: Pallavi Jadhav 
Date:   Fri Nov 8 18:48:58 2013 +0530

LibreOffice Corrupts DOCX files containing Footnotes after Roundtrip

Issue :
1] Extra data was getting written into document.xml after
   
   This includes :
1)  tag
2) Paragraph tag of  from
   footnotes.xml
2] This is leading to document corruption

Implementation :
1] Enabled a flag inside DocxAttributeOutput::FootnotesEndnotes
2] Check value of flag to decide whehter to write section
   properties or not

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
sw/source/filter/ww8/docxattributeoutput.cxx
Reviewed on:
https://gerrit.libreoffice.org/6644

Change-Id: Iae53fd6bf12bcbac84846bd36823bc08f21f9edf

diff --git a/sw/qa/extras/ooxmlexport/data/testFootnote.docx 
b/sw/qa/extras/ooxmlexport/data/testFootnote.docx
new file mode 100644
index 000..5bba6d8
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/testFootnote.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index d182180..7c5738f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1878,6 +1878,16 @@ DECLARE_OOXML_TEST(testPNGImageCrop, 
"test_PNG_ImageCrop.docx")
 CPPUNIT_ASSERT_EQUAL( sal_Int32( 737 ), aGraphicCropStruct.Bottom );
 }
 
+DECLARE_OOXML_TEST(testFootnoteParagraphTag, "testFootnote.docx")
+{
+/* In footnotes.xml, the paragraph tag inside  was 
getting written into document.xml.
+ * Check for, paragraph tag is correctly written into footnotes.xml.
+ */
+xmlDocPtr pXmlFootnotes = parseExport("word/footnotes.xml");
+assertXPath(pXmlFootnotes, "/w:footnotes/w:footnote[3]","id","2");
+assertXPath(pXmlFootnotes, 
"/w:footnotes/w:footnote[3]/w:p/w:r/w:rPr/w:rStyle","val","Footnotereference");
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 80c17e3..054e946 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -501,7 +501,7 @@ void DocxAttributeOutput::StartParagraphProperties()
 m_pSerializer->startElementNS( XML_w, XML_pPr, FSEND );
 
 // and output the section break now (if it appeared)
-if ( m_pSectionInfo )
+if ( m_pSectionInfo && (!m_setFootnote))
 {
 m_rExport.SectionProperties( *m_pSectionInfo );
 m_pSectionInfo.reset();
@@ -5120,6 +5120,7 @@ void DocxAttributeOutput::FootnoteEndnoteReference()
 
 void DocxAttributeOutput::FootnotesEndnotes( bool bFootnotes )
 {
+m_setFootnote = true;
 const FootnotesVector& rVector = bFootnotes? 
m_pFootnotesList->getVector(): m_pEndnotesList->getVector();
 
 sal_Int32 nBody = bFootnotes? XML_footnotes: XML_endnotes;
@@ -6272,7 +6273,8 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport 
&rExport, FSHelperPtr pSeri
   m_bParaBeforeAutoSpacing(false),
   m_bParaAfterAutoSpacing(false),
   m_iParaBeforeSpacing(0),
-  m_iParaAfterSpacing(0)
+  m_iParaAfterSpacing(0),
+  m_setFootnote(false)
 {
 }
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx 
b/sw/source/filter/ww8/docxattributeoutput.hxx
index 14b22b2..2099116 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -784,6 +784,8 @@ private:
 // store hardcoded value which was set during import.
 sal_Int32 m_iParaBeforeSpacing,m_iParaAfterSpacing;
 
+bool m_setFootnote;
+
 public:
 DocxAttributeOutput( DocxExport &rExport, ::sax_fastparser::FSHelperPtr 
pSerializer, oox::drawingml::DrawingML* pDrawingML );
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa sw/source

2014-01-10 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/fdo73227.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   22 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |6 ++--
 sw/source/filter/ww8/docxattributeoutput.hxx |4 +-
 sw/source/filter/ww8/docxsdrexport.cxx   |   39 +--
 sw/source/filter/ww8/docxsdrexport.hxx   |4 +-
 6 files changed, 42 insertions(+), 33 deletions(-)

New commits:
commit 3a6fdd146a37a1dbdec56b6a1d4eff3a8a28a3f8
Author: Pallavi Jadhav 
Date:   Tue Jan 7 17:10:42 2014 +0530

fdo#73227: Fix for corruption after RT

Issue:
1] Document containing SmartArt inside 
   tag gets saved with , due to which
   value of attribute "id" of  gets
   incorrectly written.
   Which was causing the corruption.
2] LO was exporting SmartArt inside 
   bydefault. Hence "ids" of  and 
   were same for value 1 and document gets corrupt.

Implementation:
1] Added code to export SmartArt inside 
   in DocxSdrExport::writeDiagram().
2] Added export Unit test.

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/7292

Change-Id: I5b2efcba030d1736203cf4571d8498fd87600d79

diff --git a/sw/qa/extras/ooxmlexport/data/fdo73227.docx 
b/sw/qa/extras/ooxmlexport/data/fdo73227.docx
new file mode 100644
index 000..015beb9
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo73227.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index a584047..ecad7b0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2274,6 +2274,28 @@ DECLARE_OOXMLEXPORT_TEST(testFDO73034, "FDO73034.docx")
 CPPUNIT_ASSERT(getXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:u", "val").match("single"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testSmartArtAnchoredInline, "fdo73227.docx")
+{
+/* Given file conatins 3 DrawingML objects as 1Picture,1SmartArt and 
1Shape.
+ * Check for SmartArt.
+*  SmartArt shoould get written as "Floating Object" i.e. inside 
 tag.
+*  Also check for value of attribute "id" of  . It should be 
unique for
+*  all 3 DrawingML objects in a document.
+*/
+
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p/w:r/w:drawing[1]/wp:anchor/wp:docPr","id","1");
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p/w:r/w:drawing[1]/wp:anchor/wp:docPr","name","Diagram1");
+
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp:docPr","id","2");
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp:docPr","name","10-Point
 Star 3");
+
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p/w:r/w:drawing[2]/wp:anchor/wp:docPr","id","3");
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p/w:r/w:drawing[2]/wp:anchor/wp:docPr","name","Picture");
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 84ffa58..1606038 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1248,7 +1248,7 @@ void DocxAttributeOutput::WritePostponedDiagram()
 for( std::list< PostponedDiagram >::const_iterator it = 
m_postponedDiagram->begin();
  it != m_postponedDiagram->end();
  ++it )
-m_rExport.SdrExporter().writeDiagram( it->object, it->size );
+m_rExport.SdrExporter().writeDiagram( it->object, *(it->frame), 
m_anchorId++ );
 delete m_postponedDiagram;
 m_postponedDiagram = NULL;
 }
@@ -3269,10 +3269,10 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const 
sw::Frame &rFrame, const Po
 if ( IsDiagram( pSdrObj ) )
 {
 if ( m_postponedDiagram == NULL )
-m_rExport.SdrExporter().writeDiagram( pSdrObj, 
rFrame.GetLayoutSize() );
+m_rExport.SdrExporter().writeDiagram( pSdrObj, 
rFrame.GetFrmFmt(), m_anchorId++);
 else // we are writing out attributes, but w:drawing 
should not be inside w:rPr,
 {// so write it out later
-m_postponedDiagram->push_back( PostponedDiagram( 
pSdrObj, rFrame.GetSize() ) );
+m_postponedDiagram->push_back( Po

[Libreoffice-commits] core.git: sw/inc sw/qa sw/source writerfilter/source

2014-01-20 Thread Pallavi Jadhav
 sw/inc/tox.hxx|1 
 sw/inc/unomap.hxx |1 
 sw/inc/unoprnms.hxx   |1 
 sw/qa/extras/ooxmlexport/data/testTOCFlag_u.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   16 +
 sw/source/core/unocore/unoidx.cxx |3 
 sw/source/core/unocore/unomap.cxx |2 
 sw/source/filter/ww8/ww8atr.cxx   |  227 +++---
 sw/source/ui/index/cntex.cxx  |2 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |3 
 writerfilter/source/dmapper/PropertyIds.cxx   |1 
 writerfilter/source/dmapper/PropertyIds.hxx   |1 
 12 files changed, 145 insertions(+), 113 deletions(-)

New commits:
commit 04a7ac6f062e9296eb643180cf54345bcdb260c4
Author: Pallavi Jadhav 
Date:   Thu Dec 26 19:08:16 2013 +0530

fdo#69613 : Fix for TOC with flag '\u' should get preserved after RT.

Issue :
DOCX contatining TOC Code field '\u' was not getting
preserved after RT.

Implementation :
1] Provided import & export support for TOC field flag '\u'.
2] Written export Unit Test for code field '\u'.

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/7202

Change-Id: I43872c7db21c25e0586bf874d5bb0c9115ab76af

diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx
index 4a60fc3..9e4efeb 100644
--- a/sw/inc/tox.hxx
+++ b/sw/inc/tox.hxx
@@ -393,6 +393,7 @@ namespace nsSwTOXElement
 const SwTOXElement TOX_TAB_IN_TOC   = 512;
 const SwTOXElement TOX_BOOKMARK = 1024;
 const SwTOXElement TOX_NEWLINE  = 2048;
+const SwTOXElement TOX_PARAGRAPH_OUTLINE_LEVEL = 4096;
 }
 
 typedef sal_uInt16 SwTOIOptions;
diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx
index 060d0ae..084abde 100644
--- a/sw/inc/unomap.hxx
+++ b/sw/inc/unomap.hxx
@@ -220,6 +220,7 @@
 #define WID_SECONDARY_KEY_READING   1060
 #define WID_TOC_BOOKMARK1061
 #define WID_TOC_NEWLINE 1062
+#define WID_TOC_PARAGRAPH_OUTLINE_LEVEL 1063
 
 // Text document
 #define WID_DOC_CHAR_COUNT  1000
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 85e478c..0065f12 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -125,6 +125,7 @@
 #define UNO_NAME_TAB_IN_TOC "TabInTOC"
 #define UNO_NAME_TOC_BOOKMARK "TOCBookmark"
 #define UNO_NAME_TOC_NEWLINE "TOCNewLine"
+#define UNO_NAME_TOC_PARAGRAPH_OUTLINE_LEVEL "TOCParagraphOutlineLevel"
 
 #define UNO_NAME_CHAR_FLASH "CharFlash"
 #define UNO_NAME_CHAR_KERNING "CharKerning"
diff --git a/sw/qa/extras/ooxmlexport/data/testTOCFlag_u.docx 
b/sw/qa/extras/ooxmlexport/data/testTOCFlag_u.docx
new file mode 100644
index 000..077bccf
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/testTOCFlag_u.docx 
differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index fe92247..56d6acb 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2348,7 +2348,7 @@ 
DECLARE_OOXMLEXPORT_TEST(testFieldFlagO,"TOC_field_f.docx")
 xmlNodeSetPtr pXmlNodes = 
getXPathNode(pXmlDoc,"/w:document/w:body/w:p[2]/w:r[2]/w:instrText");
 xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
 OUString contents = OUString::createFromAscii((const 
char*)((pXmlNode->children[0]).content));
-CPPUNIT_ASSERT(contents.match(" TOC \\z \\f \\o \"1-3\" \\h"));
+CPPUNIT_ASSERT(contents.match(" TOC \\z \\f \\o \"1-3\" \\u \\h"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTOCFlag_f, "toc_doc.docx")
@@ -2517,6 +2517,20 @@ DECLARE_OOXMLEXPORT_TEST(testShapeThemePreservation, 
"shape-theme-preservation.d
 CPPUNIT_ASSERT_EQUAL(sal_Int32(0x00b050), 
getProperty(getShape(3), "FillColor"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTOCFlag_u,"testTOCFlag_u.docx")
+{
+// DOCX contaning TOC should preserve code field '\u'.
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+// FIXME "p[2]" will have to be "p[1]", once the TOC import code is fixed
+// not to insert an empty paragraph before TOC.
+xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, 
"/w:document/w:body/w:p[2]/w:r[2]/w:instrText");
+xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
+OUString contents = OUString::createFromAscii((const 
char*)((pXmlNode->children[0]).content));
+CPPUNIT_ASSERT(contents.match(" TOC \\z \\o \"1-9\" \\u \\h"));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/unocore/unoid

[Libreoffice-commits] core.git: sw/qa sw/source

2014-05-16 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/fdo78432.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|   27 +
 sw/source/filter/ww8/docxsdrexport.cxx  |   35 ++--
 3 files changed, 60 insertions(+), 2 deletions(-)

New commits:
commit a05e5016287fdf06378e8b854a40db32d2da7204
Author: Pallavi Jadhav 
Date:   Mon May 12 15:33:08 2014 +0530

fdo#78432 : DOCX: File gets  corrupt after RoundTrip

Issue :
- In RT in document.xml, value of Absolute Position Offset
 was going out of bounds.
-  is of type Int(32-bits), hence it's value
should not cross the MAX and MIN limits of Int.

Implementation :
- Added check for  should not cross
Maximum/Minimum limit of Int.
- Written Export Unit test case.

Reviewed on:
https://gerrit.libreoffice.org/9328

Change-Id: I22e75d7e603ebbf6a49e764fb1a3e6a4d2fd8b23

diff --git a/sw/qa/extras/ooxmlexport/data/fdo78432.docx 
b/sw/qa/extras/ooxmlexport/data/fdo78432.docx
new file mode 100644
index 000..343e76a
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo78432.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index cb89ac3..014c3b9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3310,6 +3310,33 @@ 
DECLARE_OOXMLEXPORT_TEST(testPageBreakInFirstPara,"fdo77727.docx")
 assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[2]/w:br","type","page");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testAbsolutePositionOffsetValue,"fdo78432.docx")
+{
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+
+sal_Int32 IntMax = 2147483647;
+
+xmlNodeSetPtr pXmlNodes[6];
+pXmlNodes[0] = 
getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]");
+pXmlNodes[1] = 
getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]");
+
+pXmlNodes[2] = 
getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[2]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]");
+pXmlNodes[3] = 
getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[2]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]");
+
+pXmlNodes[4] = 
getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[3]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]");
+pXmlNodes[5] = 
getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[3]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]");
+
+for(sal_Int32 index = 0; index<6; ++index)
+{
+CPPUNIT_ASSERT(pXmlNodes[index] != 0);
+xmlNodePtr pXmlNode = pXmlNodes[index]->nodeTab[0];
+OUString contents = OUString::createFromAscii((const 
char*)((pXmlNode->children[0]).content));
+CPPUNIT_ASSERT( contents.toInt64() <= IntMax );
+}
+}
+
 DECLARE_OOXMLEXPORT_TEST(testFDO78284, "fdo78284.docx")
 {
 xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index dff5310..e377a36 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -44,6 +44,8 @@
 #include 
 #include 
 
+#include 
+
 using namespace com::sun::star;
 using namespace oox;
 
@@ -422,7 +424,27 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrmFmt* 
pFrmFmt, const Size& rS
 else
 {
 m_pImpl->m_pSerializer->startElementNS(XML_wp, XML_posOffset, 
FSEND);
-m_pImpl->m_pSerializer->write(TwipsToEMU(aPos.X));
+sal_Int64 nTwipstoEMU = TwipsToEMU(aPos.X);
+
+/* Absolute Position Offset Value is of type Int. Hence it should 
not be greater than
+ * Maximum value for Int OR Less than the Minimum value for Int.
+ * - Maximum value for Int = 2147483647
+ * - Minimum value for Int = -2147483648
+ *
+ * As per ECMA Specification : ECMA-376, Second Edition,
+ * Part 1 - Fundamentals And Markup Language Reference[20.4.3.3 
ST_PositionOffset (Absolute Position Offset Value)]
+ *
+ * Please refer : 
http://www.schemacentral.com/sc/xsd/t-xsd_int.html
+ */
+if (nTwipstoEMU > INT_MAX)
+{
+nTwipstoEMU = INT_MAX;
+}
+else if (nTwipstoEMU < INT_MIN)
+   

[Libreoffice-commits] core.git: sw/qa sw/source

2014-05-22 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/fdo78882.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   15 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |3 ++-
 sw/source/filter/ww8/docxsdrexport.cxx   |   13 -
 sw/source/filter/ww8/docxsdrexport.hxx   |1 +
 5 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit 70f49dc6927f3321e764174bd8050acaff63be32
Author: Pallavi Jadhav 
Date:   Thu May 22 13:31:48 2014 +0530

fdo#78882: DOCX: File gets corrupt after Roundtrip

Issue :
- Document contains a Section break(Next Page) with a drawing.
- Section break is manullay adjusted before the drawing.
  Hence in original document.xml it wsectPr comes as
  a part of w:pPr of paragraph.
- But in RT in document.xml, section break is written
  by adding a dummy paragraph.
- This is because  also contains a paragraph
  and hence when encounters section property LO creates
  a dummy paragraph and writes it in between runs.
- This was causing the corruption.

Implementation :
- Added a member varaible m_bDMLAndVMLDrawingOpen.
- It is set to true when it writes drawing.
- It's value is checked in DocxAttributeOutput::EndParagraph()
  If m_bDMLAndVMLDrawingOpen is true Do Not make
  m_bParagraphOpened to false, as one more paragraph is still
  open.
- This will postpone the writing od Section property and will
  be written inside w:pPr and no dummy paragraph will get
  created.
- Added Export Unit test case.

Change-Id: Ifa26fcaf8f02e62d020339670c8ba58ba92d9f40
Reviewed-on: https://gerrit.libreoffice.org/9430
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/fdo78882.docx 
b/sw/qa/extras/ooxmlexport/data/fdo78882.docx
new file mode 100644
index 000..da591f9
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo78882.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index e348ccd..a508a48 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3466,6 +3466,21 @@ DECLARE_OOXMLEXPORT_TEST(testFdo78651, "fdo78651.docx")
 // ensure that there are only two tables
 assertXPath(pXmlDoc, "//w:tbl", 2);
 }
+
+DECLARE_OOXMLEXPORT_TEST(testfdo78882, "fdo78882.docx")
+{
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+
+if (!pXmlDoc)
+return;
+
+// Ensure that Section Break is getting written inside second paragraph
+assertXPath(pXmlDoc, 
"/w:document[1]/w:body[1]/w:p[2]/w:pPr[1]/w:sectPr[1]",1);
+
+// Ensure that no dummy paragarph gets created inside second paragraph for 
Section Break
+assertXPath(pXmlDoc, 
"/w:document[1]/w:body[1]/w:p[2]/w:p[1]/w:pPr[1]/w:sectPr[1]",0);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testWordArtWithinDraingtool, 
"testWordArtWithinDraingtool.docx")
 {
 /*   * Within a file, there is a 2007 wordArt enclosed in a drawing tool
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 25019ba..8a2ac9d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -414,7 +414,8 @@ void DocxAttributeOutput::EndParagraph( 
ww8::WW8TableNodeInfoInner::Pointer_t pT
 // Check for end of cell, rows, tables here
 FinishTableRowCell( pTextNodeInfoInner );
 
-m_bParagraphOpened = false;
+if( !m_rExport.SdrExporter().IsDMLAndVMLDrawingOpen() )
+m_bParagraphOpened = false;
 
 }
 
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index c2481c5..50bfb7d 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -152,6 +152,7 @@ struct DocxSdrExport::Impl
 sax_fastparser::FastAttributeList* m_pDashLineStyleAttr;
 sal_Int32 m_nId ;
 sal_Int32 m_nSeq ;
+bool m_bDMLAndVMLDrawingOpen;
 
 Impl(DocxSdrExport& rSdrExport, DocxExport& rExport, 
sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML)
 : m_rSdrExport(rSdrExport),
@@ -172,7 +173,8 @@ struct DocxSdrExport::Impl
   m_pBodyPrAttrList(0),
   m_pDashLineStyleAttr(0),
   m_nId(0),
-  m_nSeq(0)
+  m_nSeq(0),
+  m_bDMLAndVMLDrawingOpen(false)
 {
 }
 
@@ -247,6 +249,11 @@ bool DocxSdrExport::IsDrawingOpen()
 return m_pImpl->m_bDrawingOpen;
 }
 
+bool DocxSdrExport::IsDMLAndVMLDrawingOpen()
+{
+return m_pImpl->m_bDMLAndVMLDrawingOpen;
+}
+
 bool DocxSdrExport::IsParagraphHasDrawing()
 {
 return m_pImpl->m_bParagraphHasDrawing;
@@ -795,6 +802,8 @@ bool 
DocxSdrExport::Impl::isSupportedDMLShape(u

[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source

2014-06-02 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/fdo76934.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|   15 +++
 sw/source/core/unocore/unomap.cxx   |3 ++-
 writerfilter/source/dmapper/StyleSheetTable.cxx |3 +--
 4 files changed, 18 insertions(+), 3 deletions(-)

New commits:
commit ef8293485adbf6554569ca37b8c1bf8cce955842
Author: Pallavi Jadhav 
Date:   Fri May 30 15:11:51 2014 +0530

fdo#76934 : DOCX: Preservation: AutoSpacing property not getting preserved.

Issue :
- In styles.xml, beforeAutospacing property was set to true.
- In code LO grab bags AustoSpacing property using "ParaInteropGrabBag".
- But ParaInteropGrabBag had only an entry for direct paragraph 
properties,
  not paragraph styles.
- Hence while importing AustoSpacing property from styles.xml, LO was 
throwing exception
  as "Some style properties could not be set: Unknown property: 
ParaInteropGrabBag".

Implementation :
- Added "ParaInteropGarbBag" entry for Paragraph styles in
  sw/source/core/unocore/unomap.cxx
- Removed code from StyleSheetTable::ApplyStyleSheets() as it was 
previously added to
  "Ignore" the AutoSpacing property.
  The code was previously added beacuse due to AutpSpacing in 
styles.xml,
  LO was throwing an exception and this was causing unhandling of 
properties after AutoSpacing.
  So to prevent unhandling of other properties due to AutoSpacing 
property, a check was added to
  "Ignore" AutoSpacing, thus enabling handling of properties after 
AutoSpacing.
  Please refer to : https://gerrit.libreoffice.org/#/c/8902/
  But as now we have to "Preserve AutoSpacing" this check needs to be 
removed in order to set
  it in StyelSheetTable.cxx.
- Added Export Unit test case

Change-Id: I6748f97befcdf40643e75388766e05740290306b
Reviewed-on: https://gerrit.libreoffice.org/9561
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/fdo76934.docx 
b/sw/qa/extras/ooxmlexport/data/fdo76934.docx
new file mode 100644
index 000..0515cf2
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo76934.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 9c1ee8e..aeb66e9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3426,6 +3426,21 @@ DECLARE_OOXMLEXPORT_TEST(testFdo78910, "fdo78910.docx")
 assertXPath ( pXmlDoc, "//w:hyperlink[2]/w:r[5]/w:fldChar", "fldCharType", 
"end" );
 }
 
+DECLARE_OOXMLEXPORT_TEST(testfdo76934, "fdo76934.docx")
+{
+/* Issue was, AuoSpacing property if present inside styles.xml, LO was not 
able to
+ * preserve it.
+ */
+
+xmlDocPtr pXmlDoc = parseExport("word/styles.xml");
+
+if (!pXmlDoc)
+return;
+
+// Ensure that after fix LO is preserving AutoSpacing property in 
styles.xml
+assertXPath ( pXmlDoc, "/w:styles[1]/w:style[36]/w:pPr[1]/w:spacing[1]", 
"beforeAutospacing", "1" );
+}
+
 DECLARE_OOXMLEXPORT_TEST(testFDO79062, "fdo79062.docx")
 {
 xmlDocPtr pXmlFootNotes = parseExport("word/footnotes.xml");
diff --git a/sw/source/core/unocore/unomap.cxx 
b/sw/source/core/unocore/unomap.cxx
index 5a9cb5a..6a26b9d 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -535,7 +535,8 @@ SwUnoPropertyMapProvider::~SwUnoPropertyMapProvider()
 { OUString(UNO_NAME_SNAP_TO_GRID), RES_PARATR_SNAPTOGRID, 
cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, 0 }, \
 { OUString(UNO_NAME_OUTLINE_LEVEL), 
RES_PARATR_OUTLINELEVEL,cppu::UnoType::get(), 
PropertyAttribute::MAYBEVOID, 0}, \
 { OUString(UNO_NAME_HIDDEN), FN_UNO_HIDDEN, 
cppu::UnoType::get(), PROPERTY_NONE, 0}, \
-{ OUString(UNO_NAME_STYLE_INTEROP_GRAB_BAG), 
FN_UNO_STYLE_INTEROP_GRAB_BAG, cppu::UnoType< 
cppu::UnoSequenceType >::get(), PROPERTY_NONE, 0},
+{ OUString(UNO_NAME_STYLE_INTEROP_GRAB_BAG), 
FN_UNO_STYLE_INTEROP_GRAB_BAG, cppu::UnoType< 
cppu::UnoSequenceType >::get(), PROPERTY_NONE, 0}, \
+{ OUString(UNO_NAME_PARA_INTEROP_GRAB_BAG), 
RES_PARATR_GRABBAG, cppu::UnoType< 
cppu::UnoSequenceType >::get(), PROPERTY_NONE, 0},
 
 #define COMMON_FLDTYP_PROPERTIES \
 { OUString(UNO_NAME_IS_FIELD_USED),  
FIELD_PROP_IS_FIELD_USED,  cppu::UnoType::get(), 
PropertyAttribute::READONLY, 0},\
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx 
b/writerfilter/source/dmapper/StyleSheetTable.cxx
index ed5ecbe..a8da876 100644
--- a/

[Libreoffice-commits] core.git: oox/inc oox/source

2013-03-06 Thread Pallavi Jadhav
 oox/inc/oox/export/drawingml.hxx |1 +
 oox/source/export/drawingml.cxx  |   24 
 oox/source/export/shapes.cxx |2 ++
 3 files changed, 27 insertions(+)

New commits:
commit 5d10a0180f5e9922ca197cdea00ee84bc4b2d313
Author: Pallavi Jadhav 
Date:   Fri Feb 8 10:11:42 2013 +0530

fdo#48735: Save crop information in PPTX.

fdo#48735: Save crop information in PPTX.

Change-Id: I8aee13b11406988ab451034f43ee41c662add5fb

diff --git a/oox/inc/oox/export/drawingml.hxx b/oox/inc/oox/export/drawingml.hxx
index 6198ec6..09da104 100644
--- a/oox/inc/oox/export/drawingml.hxx
+++ b/oox/inc/oox/export/drawingml.hxx
@@ -106,6 +106,7 @@ public:
 void WriteGradientFill( ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet > rXPropSet );
 void WriteBlipFill( ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName, 
sal_Int32 nXmlNamespace );
 void WriteBlipFill( ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName );
+void WriteSrcRect( ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet >, const OUString& );
 void WriteOutline( ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet > rXPropSet );
 void WriteStretch();
 void WriteLinespacing( ::com::sun::star::style::LineSpacing& rLineSpacing 
);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index d26002a..ead3ed2 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -44,12 +44,14 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -83,6 +85,7 @@ using ::com::sun::star::beans::XPropertyState;
 using ::com::sun::star::container::XEnumeration;
 using ::com::sun::star::container::XEnumerationAccess;
 using ::com::sun::star::container::XIndexAccess;
+using ::com::sun::star::geometry::IntegerRectangle2D;
 using ::com::sun::star::io::XOutputStream;
 using ::com::sun::star::style::LineSpacing;
 using ::com::sun::star::text::XText;
@@ -604,6 +607,27 @@ void DrawingML::WriteBlipFill( Reference< XPropertySet > 
rXPropSet, OUString sUR
 }
 }
 
+void DrawingML::WriteSrcRect( Reference< XPropertySet > rXPropSet, const 
OUString& rURL )
+{
+Size aOriginalSize( GraphicObject::CreateGraphicObjectFromURL( rURL 
).GetPrefSize() );
+
+if ( GetProperty( rXPropSet, "GraphicCrop" ) )
+{
+::com::sun::star::text::GraphicCrop aGraphicCropStruct;
+mAny >>= aGraphicCropStruct;
+
+if ( (0 != aGraphicCropStruct.Left) || (0 != aGraphicCropStruct.Top) 
|| (0 != aGraphicCropStruct.Right) || (0 != aGraphicCropStruct.Bottom) )
+{
+mpFS->singleElementNS( XML_a, XML_srcRect,
+  XML_l, I32S(((aGraphicCropStruct.Left) * 
10)/aOriginalSize.Width()),
+  XML_t, I32S(((aGraphicCropStruct.Top) * 
10)/aOriginalSize.Height()),
+  XML_r, I32S(((aGraphicCropStruct.Right) * 
10)/aOriginalSize.Width()),
+  XML_b, I32S(((aGraphicCropStruct.Bottom) * 
10)/aOriginalSize.Height()),
+  FSEND );
+}
+}
+}
+
 void DrawingML::WriteStretch()
 {
 mpFS->startElementNS( XML_a, XML_stretch, FSEND );
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 89e6440..f26a527 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -872,6 +872,8 @@ void ShapeExport::WriteGraphicObjectShapePart( Reference< 
XShape > xShape, const
 
 WriteBlip( xShapeProps, sGraphicURL, pGraphic );
 
+WriteSrcRect( xShapeProps, sGraphicURL );
+
 // now we stretch always when we get pGraphic (when changing that
 // behavior, test n#780830 for regression, where the OLE sheet might get 
tiled
 bool bStretch = false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


License statement

2013-03-07 Thread pallavi jadhav
Hi All,

All of my past & future contributions to LibreOffice may be licensed
under the MPL/LGPLv3+ dual license.

-- 
Best regards,
Pallavi Jadhav

-- 
This e-mail, including any attached files, may contain confidential and 
privileged information for the sole use of the intended recipient. Any 
review, use, distribution, or disclosure by others is strictly prohibited. 
If you are not the intended recipient (or authorized to receive information 
for the intended recipient), please contact the sender by reply e-mail and 
delete all copies of this message.

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice-commits] core.git: sw/qa writerfilter/source

2014-07-18 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/fdo80800.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   15 +++
 writerfilter/source/dmapper/DomainMapper.cxx |   13 -
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |9 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx|7 ---
 writerfilter/source/dmapper/DomainMapper_Impl.hxx|5 -
 6 files changed, 23 insertions(+), 26 deletions(-)

New commits:
commit a5f9fb720daeb2df8325768b98b8b720abcc2b9b
Author: Pallavi Jadhav 
Date:   Fri Jul 11 14:27:52 2014 +0530

fdo#80800 : DOCX: Preservation of Direct Formatting for non first Table 
Cells

Issue :
- Direct Formatting for non-first Table cells was not getting preserved.
- In issue file, a table with multiple cells have Line Sapcing = 1.5 
lines.
  But LO was importing only First Table cell with Line Spacing = 1.5 
lines
  whereas for remaining cells LO was applying Line Spacing = Single.
  LO was overriding value from styles.xml
- Issue was due to at line : 
http://opengrok.libreoffice.org/xref/core/writerfilter/source/dmapper/DomainMapper.cxx#399
  here LO sets only a boolean value for all cells and
  here : 
http://opengrok.libreoffice.org/xref/core/writerfilter/source/dmapper/DomainMapperTableHandler.cxx#769
  we set DirectFormatting to False.
  So we have processed only one cell, hence for remaining cells Direct 
Formatting is not getting applied.
- So in order to have Direct Formatting for multiple Table Cells, we 
need to preserve Direct Fomatting property
  for respective cells.
  And with present code structure it is not happening as there is only 
a bool variable we are considering.

Implementation :
- Saved Direct Formatting information in DomainMapper itself.
- Hence when DomainMapperTableHandler::endTableGetCellProperties() gets 
called,
  Table cells already have correct value stored in it.
  We no more need to erase Default Formatting as Default formatting is 
not
  present instead it's actual values are now available.
- This has conditionally reverted : 
https://gerrit.libreoffice.org/#/c/9560/

Change-Id: Ie1c82069cd84e9662f33e734bda3ef69c5169e83
Reviewed-on: https://gerrit.libreoffice.org/10216
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/fdo80800.docx 
b/sw/qa/extras/ooxmlexport/data/fdo80800.docx
new file mode 100644
index 000..64ed769
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo80800.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index eb81a06..2ef9160 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3311,6 +3311,21 @@ DECLARE_OOXMLEXPORT_TEST(testfdo80898, "fdo80898.docx")
 "/word/embeddings/oleObject1.doc");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTableCellWithDirectFormatting, "fdo80800.docx")
+{
+// Issue was Direct Foramatting for non-first Table cells was not getting 
preserved.
+
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+   return;
+
+// Ensure that for Third Table cell Direct Formatting is preserved.
+// In file, Direct Formatting used for Third Table cell is Line 
Spacing="1.5 lines"
+// For Line Spacing "1.5 lines" w:line equals 360
+
assertXPath(pXmlDoc,"/w:document/w:body/w:tbl/w:tr/w:tc[3]/w:p/w:pPr/w:spacing","line","360");
+
+}
+
 DECLARE_OOXMLEXPORT_TEST(test2colHeader, "2col-header.docx")
 {
 // Header was lost on export when the document had multiple columns.
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index f007457..27bda6e 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -393,17 +393,20 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 }
 if( nName == NS_ooxml::LN_CT_Spacing_line )
 {
-if( m_pImpl->getTableManager().isInCell() )
-{
-// direct formatting is applied for table cell data
-m_pImpl->SetIsTableHasDirectFormatting(true);
-}
 m_pImpl->appendGrabBag(m_pImpl->m_aSubInteropGrabBag, "line", 
OUString::number(nIntValue));
 //now set the value depending on the Mode
 if( aSpacing.Mode == style::LineSpacingMode::PROP )
 aSpacing.Height = sal_Int16(sal_Int32(nIntValue) * 100 / 
SINGLE_LINE_SPACING );
 else
  

[Libreoffice-commits] core.git: sw/qa sw/source

2014-08-01 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/fdo81341.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |   17 +
 sw/source/core/fields/docufld.cxx |4 +++-
 sw/source/filter/ww8/ww8atr.cxx   |2 ++
 4 files changed, 22 insertions(+), 1 deletion(-)

New commits:
commit b38b124b64b7a1f6529799552f6e89360edd8280
Author: Pallavi Jadhav 
Date:   Thu Jul 31 10:48:59 2014 +0530

fdo#81341 : DOCX: EditTime is not geting preserved after RT

Issue :
- LO was not able to Import EditTime field in "HH:MM:SS" format.
- LO was Importing it as "HH:MM" format.
- In getTime() third parameter is passed as "false" which is bSec.
  Because of which LO was not able to Import EditTime in seconds.

Implementation :
- Added code to check value of Seconds > 0.
- Added code at Export side to write "EDITTIME" field.
- Added Unit test case at Export side.

Because of which LO was not able to Import EditTime in seconds.

Reviewed on:
https://gerrit.libreoffice.org/10655

Change-Id: Ic740dc30d79be594dec9a0a05e407a7cb1a5941e

diff --git a/sw/qa/extras/ooxmlexport/data/fdo81341.docx 
b/sw/qa/extras/ooxmlexport/data/fdo81341.docx
new file mode 100644
index 000..3c243c0
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo81341.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 0df24fb..36ae02b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -565,6 +565,23 @@ DECLARE_OOXMLEXPORT_TEST(testFdo81492, "fdo81492.docx")
 assertXPathContent(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[5]/w:instrText", "ADDIN EN.CITE.DATA");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testEditTime, "fdo81341.docx")
+{
+/* Issue was LO was not able to Import and Export EditTime in seconds 
format.
+ * It was supporting Time in "HH:MM" format. But if DOCX conatins Time in 
seconds,
+ * then LO was not able to display time in "HH:MM:SS" format.
+ * While exporting LO was writing plian text instead of field entry.
+ */
+if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
+{
+//Ensure that EditTime is written inside w:fldChar in "HH:MM:SS" 
format.
+assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[1]/w:fldChar", 
"fldCharType", "begin");
+assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[3]/w:fldChar", 
"fldCharType", "separate");
+assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:r[4]/w:t", 
"00:00:05");
+assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r[5]/w:fldChar", 
"fldCharType", "end");
+}
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/fields/docufld.cxx 
b/sw/source/core/fields/docufld.cxx
index d03730a..c18cb0f 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -898,8 +898,10 @@ OUString SwDocInfoFieldType::Expand( sal_uInt16 nSub, 
sal_uInt32 nFormat,
 {
 lcl_GetLocalDataWrapper( nLang, &pAppLocalData, &pLocalData );
 sal_Int32 dur = xDocProps->getEditingDuration();
+// If Seconds > 0 then bSec should be TRUE otherwise Seconds
+// information will be lost if file has EditTime in Seconds format.
 aStr = pLocalData->getTime( Time(dur/3600, (dur%3600)/60, dur%60),
-false, false);
+(dur%60 > 0 ? true : false), false);
 }
 else
 {
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index e831bf7..78fe92e 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2822,6 +2822,8 @@ void AttributeOutputBase::TextField( const SwFmtFld& 
rField )
 if( DI_SUB_AUTHOR != (nSubType & DI_SUB_MASK ) &&
 GetExport().GetNumberFmt( *pFld, sStr ))
 eFld = ww::eSAVEDATE;
+else
+eFld = ww::eEDITTIME;
 break;
 case DI_CUSTOM:
 eFld = ww::eDOCPROPERTY;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa sw/source

2014-06-11 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/fdo79540.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   17 +
 sw/source/filter/ww8/docxattributeoutput.cxx |8 +++-
 3 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit 69ba8e94e33c142072920fe455899c04b4e035d1
Author: Pallavi Jadhav 
Date:   Thu Jun 5 19:04:36 2014 +0530

fdo#79540 : DOCX: Lo exports Drawing inside Drawing

Issue :
- In file there is a WordArt inside Table.
- In RT, LO exports  inside .
- The xml sequence was :
  

  // first start of drawing

  
   // second start of drawing. MSO does not 
allow.

Implementation :
- In DocxAttributeOutput::OutputFlyFrame_Impl() under "case 
sw::Frame::eDrawing",
  if drawing is already open then Postpone the Inner Drawing.
- Added Export Unit Test case to check two separate drawings are
  now written in document.xml of RT.

Change-Id: I01d06621576d60d26cd51489ee9718dd79eb9c72
Reviewed-on: https://gerrit.libreoffice.org/9653
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/fdo79540.docx 
b/sw/qa/extras/ooxmlexport/data/fdo79540.docx
new file mode 100644
index 000..ce843d6
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo79540.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 4b5de65..30f7480 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3510,6 +3510,23 @@ DECLARE_OOXMLEXPORT_TEST(testfdo76934, "fdo76934.docx")
 assertXPath ( pXmlDoc, "/w:styles[1]/w:style[36]/w:pPr[1]/w:spacing[1]", 
"beforeAutospacing", "1" );
 }
 
+DECLARE_OOXMLEXPORT_TEST(testfdo79540, "fdo79540.docx")
+{
+/* Issue was,  was getting written inside .
+ * So Postone the writing of Inner Drawing tag.
+ * MS Office does not allow Nestimg of drawing tags.
+ */
+
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+
+if (!pXmlDoc)
+return;
+
+// Ensure that two separate w:drawing tags are written after the code 
changes.
+assertXPath ( pXmlDoc, 
"/w:document/w:body/w:p/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing",1);
+assertXPath ( pXmlDoc, 
"/w:document/w:body/w:p/w:r[3]/mc:AlternateContent/mc:Choice/w:drawing",1);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testFDO79062, "fdo79062.docx")
 {
 xmlDocPtr pXmlFootNotes = parseExport("word/footnotes.xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 645688f..7e7c4a0 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4390,7 +4390,13 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const 
sw::Frame &rFrame, const Po
 if ( m_postponedDMLDrawing == NULL )
 {
 if ( IsAlternateContentChoiceOpen() )
-m_rExport.SdrExporter().writeDMLDrawing( 
pSdrObj, &rFrame.GetFrmFmt(), m_anchorId++);
+{
+// Do not write w:drawing inside w:drawing. 
Instead Postpone the Inner Drawing.
+if( m_rExport.SdrExporter().IsDrawingOpen() )
+
m_postponedCustomShape->push_back(PostponedDrawing(pSdrObj, 
&(rFrame.GetFrmFmt()), &rNdTopLeft));
+else
+m_rExport.SdrExporter().writeDMLDrawing( 
pSdrObj, &rFrame.GetFrmFmt(), m_anchorId++);
+}
 else
 m_rExport.SdrExporter().writeDMLAndVMLDrawing( 
pSdrObj, rFrame.GetFrmFmt(), rNdTopLeft, m_anchorId++);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa sw/source

2014-07-02 Thread Pallavi Jadhav
 sw/qa/core/data/ooxml/pass/fdo79838.docx |binary
 sw/source/core/text/itrform2.cxx |7 +++
 2 files changed, 7 insertions(+)

New commits:
commit 0459e43ae63191ce9846bbcc7fe797fd949e3878
Author: Pallavi Jadhav 
Date:   Fri Jun 27 14:52:34 2014 +0530

fdo#79838 : DOCX : File crashes on open

Issue :
DOCX containing nested form fields FORMCHECKBOX inside
FORMTEXT crashes at open.

Implementation :
- Handled case for FORMTEXT.
- Added issue file isnide sw/qa/core/data/ooxml/pass/

NOTE : This is a due to regression. Issue file opened
   successfully on LO-3.5 and LO-4.1.
   Code changes that caused regression is : 
https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=a52ee51269a47e52d68405caf8507e1abaa6fd8f

Change-Id: I59dbe7bb2d58c1bcb0ddd144cf7891cbec5cdb24
Reviewed-on: https://gerrit.libreoffice.org/9932
Tested-by: Norbert Thiebaud 
Reviewed-by: Norbert Thiebaud 

diff --git a/sw/qa/core/data/ooxml/pass/fdo79838.docx 
b/sw/qa/core/data/ooxml/pass/fdo79838.docx
new file mode 100644
index 000..eef1e59
Binary files /dev/null and b/sw/qa/core/data/ooxml/pass/fdo79838.docx differ
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 8bf8437..8e03566 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -894,6 +894,13 @@ SwTxtPortion *SwTxtFormatter::WhichTxtPor( SwTxtFormatInfo 
&rInf ) const
 {
 pPor = new 
SwFieldFormDropDownPortion(sw::mark::ExpandFieldmark(pBM));
 }
+/* we need to check for ODF_FORMTEXT for scenario 
having FormFields inside FORMTEXT.
+ * Otherwise file will crash on open.
+ */
+else if (pBM->GetFieldname( ) == ODF_FORMTEXT)
+{
+pPor = new SwFieldMarkPortion();
+}
 else
 {
 assert( false );// unknown type...
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa sw/source

2014-05-07 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/fdo77812.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|   17 +
 sw/source/filter/ww8/wrtww8.cxx |   15 +++
 3 files changed, 32 insertions(+)

New commits:
commit f6eb92406bd366c557bc07810649e7ab3d1db614
Author: Pallavi Jadhav 
Date:   Tue Apr 29 18:44:16 2014 +0530

fdo#77812 :FILESAVE :DOCX : Extra Section Break gets added in file

Issue :
LO was exporting DOCX containing MultiColumns with additional
Section break Continuos.

Implementation :
1] Added check for Column_count in MSWordExportBase::WriteText()
   If Column_count > 1 and Text node is empty then do not
   export Section Break.
2] Written Export unit test case.

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/9200

Change-Id: Ibf3e6bd2d4827aa77a659b1600939cc56d65a63b

diff --git a/sw/qa/extras/ooxmlexport/data/fdo77812.docx 
b/sw/qa/extras/ooxmlexport/data/fdo77812.docx
new file mode 100644
index 000..48fb498
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo77812.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 8c99382..acd3d06 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3215,7 +3215,24 @@ DECLARE_OOXMLEXPORT_TEST(testFDO77725, "fdo77725.docx")
 assertXPath(pXmlFootnotes, 
"//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[1]", 0);
 assertXPath(pXmlFootnotes, 
"//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[2]", 0);
 assertXPath(pXmlFootnotes, 
"//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[3]", 0);
+}
+
+DECLARE_OOXMLEXPORT_TEST(testFDO77812, "fdo77812.docx")
+{
+/* Additional sectPr was getting inserted and hence Column properties
+ * were getting added into this additional sectPr instead of Default setPr.
+ */
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+
+// Check no additional section break is inserted.
+assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:pPr/w:sectPr", 0);
 
+// Check w:cols comes under Default sectPr
+assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols", "num", "2");
+assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols/w:col[1]", 1);
+assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols/w:col[2]", 1);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testContentTypeOLE, "fdo77759.docx")
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 718761a..916d33f 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -114,6 +114,7 @@
 #include 
 #include "WW8FibData.hxx"
 #include "numrule.hxx"
+#include "fmtclds.hxx"
 
 using namespace css;
 using namespace sw::util;
@@ -2597,6 +2598,20 @@ void MSWordExportBase::WriteText()
 }
 }
 }
+else
+{
+/* Do not export Section Break in case DOCX containing 
MultiColumn and
+ * aIdx.GetNode().IsTxtNode() is False i.e. Text node is 
NULL.
+ */
+const SwFrmFmt* pPgFmt = rSect.GetFmt();
+const SwFmtCol& rCol = pPgFmt->GetCol();
+sal_uInt16 nColumnCount = rCol.GetNumCols();
+if(nColumnCount > 1)
+{
+bNeedExportBreakHere = sal_False;
+}
+}
+
 if (bNeedExportBreakHere)  //#120140# End of check
 {
 ReplaceCr( (char)0xc ); // indicator for Page/Section-Break
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source

2014-08-11 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/fdo82123.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |   10 
 sw/source/filter/ww8/docxattributeoutput.cxx  |   28 +
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   47 ++
 4 files changed, 85 insertions(+)

New commits:
commit f6e7b94042070241cd1cfb1d7f8610fe1801b4f2
Author: Pallavi Jadhav 
Date:   Fri Aug 8 17:20:31 2014 +0530

fdo#82123 : DOCX: Corruption: File was getting corrupt fafter RT

Issue :
- In issue file there were two runs(first run=SDT, second run=Image).
- These two runs were consecutive(no text/space/tab was there in 
between two runs).
- Due to such scenario, "SdtEndBefore" was not getting set.
- Hence at Export EndSdtBlock() was getting called form EndParagraph()
  Instead EndSdtBlock() should ge called from EndRun() in order to end
  sdt after first run(as in Original file)

Implementation :
- Set "SdtEndBefore" on Graphic in DomainMapper_Impl::ImportGraphic()
- Retrieved same property at export.
- Added export unit test case.

Change-Id: Id514b91f1831af371924f94388f0a404d762c042
Reviewed-on: https://gerrit.libreoffice.org/10827
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/fdo82123.docx 
b/sw/qa/extras/ooxmlexport/data/fdo82123.docx
new file mode 100644
index 000..fc2632c
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo82123.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index be347b5..9ab1ba2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -591,6 +591,16 @@ DECLARE_OOXMLEXPORT_TEST(testFdo81945, "fdo81945.docx")
 assertXPath(pXmlDoc, "//w:sdt//w:sdt", 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testfdo82123, "fdo82123.docx")
+{
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+   return;
+
+// make sure there is only one run inside first SDT after RT as in the 
Original file.
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tr/w:tc[2]/w:p/w:sdt[1]/w:sdtContent/w:r",1);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testfdo81946, "fdo81946.docx")
 {
 xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index b0447cf..edd69c2 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4008,6 +4008,34 @@ void DocxAttributeOutput::ClearRelIdCache()
 void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const 
Size& rSize, const SwFlyFrmFmt* pOLEFrmFmt, SwOLENode* pOLENode, const 
SdrObject* pSdrObj )
 {
 OSL_TRACE( "TODO DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* 
pGrfNode, const Size& rSize, const SwFlyFrmFmt* pOLEFrmFmt, SwOLENode* 
pOLENode, const SdrObject* pSdrObj  ) - some stuff still missing" );
+
+if (pSdrObj)
+{
+uno::Reference 
xShape(const_cast(pSdrObj)->getUnoShape(), uno::UNO_QUERY_THROW);
+if( xShape.is() )
+{
+uno::Reference< beans::XPropertySet > xPropSet( xShape, 
uno::UNO_QUERY );
+uno::Reference< beans::XPropertySetInfo > xPropSetInfo;
+if( xPropSet.is() )
+{
+xPropSetInfo = xPropSet->getPropertySetInfo();
+if (xPropSetInfo.is() && 
xPropSetInfo->hasPropertyByName("FrameInteropGrabBag"))
+{
+uno::Sequence< beans::PropertyValue > aGrabBag;
+xPropSet->getPropertyValue("FrameInteropGrabBag") >>= 
aGrabBag;
+for (sal_Int32 nProp=0; nProp < aGrabBag.getLength(); 
++nProp)
+{
+if ("SdtEndBefore" == aGrabBag[nProp].Name && 
m_bStartedCharSdt && !m_bEndCharSdt)
+{
+aGrabBag[nProp].Value >>= m_bEndCharSdt;
+}
+break;
+}
+}
+}
+}
+}
+
 // detect mis-use of the API
 assert(pGrfNode || (pOLEFrmFmt && pOLENode));
 const SwFrmFmt* pFrmFmt = pGrfNode ? pGrfNode->GetFlyFmt() : pOLEFrmFmt;
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 1bf28fa..feb11e0 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4394,6 +4394,53 @@ void  
DomainMapper_Impl::ImportGraphic(writerfilter::Reference< Prope

[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source

2014-08-18 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/fdo82492.docx   |binary
 sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx |   10 ++
 sw/source/filter/ww8/docxattributeoutput.cxx  |   62 --
 sw/source/filter/ww8/docxattributeoutput.hxx  |1 
 sw/source/filter/ww8/docxsdrexport.cxx|2 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   91 +-
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |3 
 7 files changed, 109 insertions(+), 60 deletions(-)

New commits:
commit 8b9988163c0c0d158fc2d9f5272695ccfec92237
Author: Pallavi Jadhav 
Date:   Wed Aug 13 18:14:47 2014 +0530

fdo#82492 : DOCX: Corruption: File was getting corrupt fafter RT

Issue :
- In issue file there were two runs(first run=SDT, second run=Shape).
- These two runs were consecutive(no text/space/tab was there in 
between two runs).
- Due to such scenario, "SdtEndBefore" was not getting set on Shape.
- Hence at Export EndSdtBlock() was getting called from EndParagraph().
  Due to this SDT was not getting end after first run.
  In order to end SDT after run, EndSdtBlock() should get called from 
EndRun()
  (as in Original file)

Implementation :
- Set "SdtEndBefore" on Shape in DomainMapper_Impl::PushShapeContext()
- Retrieved same property at export.
- Added export unit test case.

Note :
Added common functions at Import and Export with reference to
https://gerrit.libreoffice.org/#/c/10827/

Conflicts:
sw/source/filter/ww8/docxattributeoutput.cxx
Reviewed on:
https://gerrit.libreoffice.org/10912

Change-Id: I357d77cd179c83b8ae976db331ee46c8993b6cb8

diff --git a/sw/qa/extras/ooxmlexport/data/fdo82492.docx 
b/sw/qa/extras/ooxmlexport/data/fdo82492.docx
new file mode 100644
index 000..6533056
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo82492.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 9ab1ba2..d52423f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -610,6 +610,16 @@ DECLARE_OOXMLEXPORT_TEST(testfdo81946, "fdo81946.docx")
 assertXPath(pXmlDoc, 
"/w:hdr[1]/w:p[1]/w:sdt[1]/w:sdtContent[1]/w:r[2]/mc:AlternateContent[1]",0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testfdo82492, "fdo82492.docx")
+{
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+   return;
+
+// make sure there is only one run inside first SDT after RT as in the 
Original file.
+assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt[1]/w:sdtContent/w:r",1);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testSdtHeader, "sdt-header.docx")
 {
 // Problem was that w:sdt elements in headers were lost on import.
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4ead526..86065cb 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1917,6 +1917,41 @@ void DocxAttributeOutput::EndRunProperties( const 
SwRedlineData* pRedlineData )
 m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND );
 }
 
+void DocxAttributeOutput::GetSdtEndBefore(const SdrObject* pSdrObj)
+{
+if (pSdrObj)
+{
+uno::Reference 
xShape(const_cast(pSdrObj)->getUnoShape(), uno::UNO_QUERY_THROW);
+if( xShape.is() )
+{
+uno::Reference< beans::XPropertySet > xPropSet( xShape, 
uno::UNO_QUERY );
+uno::Reference< beans::XPropertySetInfo > xPropSetInfo;
+if( xPropSet.is() )
+{
+xPropSetInfo = xPropSet->getPropertySetInfo();
+uno::Sequence< beans::PropertyValue > aGrabBag;
+if (xPropSetInfo.is() && 
xPropSetInfo->hasPropertyByName("FrameInteropGrabBag"))
+{
+xPropSet->getPropertyValue("FrameInteropGrabBag") >>= 
aGrabBag;
+}
+else if(xPropSetInfo.is() && 
xPropSetInfo->hasPropertyByName("InteropGrabBag"))
+{
+xPropSet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
+}
+
+for (sal_Int32 nProp=0; nProp < aGrabBag.getLength(); ++nProp)
+{
+if ("SdtEndBefore" == aGrabBag[nProp].Name && 
m_bStartedCharSdt && !m_bEndCharSdt)
+{
+aGrabBag[nProp].Value >>= m_bEndCharSdt;
+break;
+}
+}
+}
+}
+}
+}
+
 void DocxAttributeOutput::WritePostponedGraphic()
 

[Libreoffice-commits] core.git: sw/qa writerfilter/source

2014-08-31 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/fdo83048.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx|   12 
 writerfilter/source/dmapper/DomainMapper.cxx |1 +
 3 files changed, 13 insertions(+)

New commits:
commit 61ed5a1f959a7903cfb56dc293dcc511ea28d15e
Author: Pallavi Jadhav 
Date:   Thu Aug 28 12:23:20 2014 +0530

fdo#83048: DOCX: Corrupt: LO exports  wrong SDT properties of Date

Issue :
-File was getting corrupt due to wrong SDT Properties were getting 
export
 and only one SDT tag was getting written.
-Issue file contained a Date SDT and a FieldChar SDT(Page numbers)
-Issue was at Import side.
 LO GRAB BAGS Properties of SDT using PARA_GRAB_BAG or CHAR_GRAB_BAG
-For Date SDT it should be grab bagged using CHAR_GRAB_BAG in order to 
get
 correct data inside 
 But LO was handling it with PARA_GRAB_BAG due to which wrong 
properties were
 getting written and
file was getting corrupt.

Implementation :
-Added a check for Date SDT to handle it through CHAR_GRAB_BAG
-Now correct SDT properties are getting exported due to which Date is 
getting
 written inside an SDT tag.
-Added UT at export side.

Change-Id: Ibcfb6dbbec1c23ffd14ba924ab56dc4122b98595
Reviewed-on: https://gerrit.libreoffice.org/11160
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/sw/qa/extras/ooxmlexport/data/fdo83048.docx 
b/sw/qa/extras/ooxmlexport/data/fdo83048.docx
new file mode 100644
index 000..3ef6d99
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo83048.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 59ae895..27de7ee 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -659,6 +659,18 @@ DECLARE_OOXMLEXPORT_TEST(test2colHeader, 
"2col-header.docx")
 CPPUNIT_ASSERT_EQUAL(true, getProperty(xPageStyle, "HeaderIsOn"));
 }
 
+DECLARE_OOXMLEXPORT_TEST(testfdo83048, "fdo83048.docx")
+{
+// Issue was wrong SDT properties were getting exported for Date SDT
+xmlDocPtr pXmlDoc = parseExport("word/footer1.xml");
+if (!pXmlDoc)
+   return;
+
+// Make sure Date is inside SDT tag.
+// This will happen only if right SDT properties are exported.
+assertXPath(pXmlDoc, 
"/w:ftr/w:sdt/w:sdtContent/w:p[1]/w:sdt/w:sdtContent/w:r[1]/w:t", "1/2/2013");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testSdt2Run, "sdt-2-run.docx")
 {
 xmlDocPtr pXmlDoc = parseExport();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index b5ce4a3..8a4910e 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2961,6 +2961,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, 
size_t len)
 
m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_text") ||
 
m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_dataBinding") 
||
 
m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_citation") ||
+
m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_date") ||
 
(m_pImpl->m_pSdtHelper->containedInInteropGrabBag("ooxml:CT_SdtPr_id") &&
 m_pImpl->m_pSdtHelper->getInteropGrabBagSize() == 1)) 
&& !m_pImpl->m_pSdtHelper->isOutsideAParagraph())
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa sw/source

2014-03-19 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/fdo76316.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   13 +
 sw/source/filter/ww8/docxattributeoutput.cxx |   14 ++
 sw/source/filter/ww8/docxattributeoutput.hxx |2 ++
 4 files changed, 29 insertions(+)

New commits:
commit 20a3792502120d67b1a9fdea641e15ea504359d3
Author: Pallavi Jadhav 
Date:   Wed Mar 19 16:29:42 2014 +0530

fdo#76316 : File gets corrupt after Roundtrip

Issue :
DOCX containing nested Hyperlinks, have mismatch xml tags.
End tag for outer Hyperlinks does not get closed.

Implementation :
1] Added code at Export side to maintain Count of
   Hyperlinks started and ended.
   Added check endParagraph() to to close Hyperlink tag
   if not yet closed but started.
2] Written Export Unit Test case.
NOTE : Corruption was occurring on "Without debug-util" build and Crash was 
occurring on "WITH debug-util build".

Reviewed on:
https://gerrit.libreoffice.org/8654

Change-Id: I9a0ab48578f3d5f4a13c615f4e42a69e790d3ced

diff --git a/sw/qa/extras/ooxmlexport/data/fdo76316.docx 
b/sw/qa/extras/ooxmlexport/data/fdo76316.docx
new file mode 100644
index 000..67d3764
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo76316.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ee6c511..9461ba7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2865,6 +2865,19 @@ DECLARE_OOXMLEXPORT_TEST(test76108, "test76108.docx")
 assertXPath(pXmlDoc, 
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:fldChar[1]", "fldCharType", "begin");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testHyperLinkTagEnded, "fdo76316.docx")
+{
+/* XML tag  was not getting closed when its inside another
+ *  tag.
+ */
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+
+if (!pXmlDoc) return;
+
+CPPUNIT_ASSERT(pXmlDoc);
+assertXPath(pXmlDoc, 
"/w:document[1]/w:body[1]/w:tbl[1]/w:tr[2]/w:tc[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl[1]/w:tr[7]/w:tc[1]/w:tbl[1]/w:tr[2]/w:tc[6]/w:tbl[1]/w:tr[1]/w:tc[1]/w:p[1]/w:hyperlink[1]/w:hyperlink[1]",1);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testSimpleSdts, "simple-sdts.docx")
 {
 xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index f3c97d0..1ff6305 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -359,6 +359,16 @@ void DocxAttributeOutput::EndParagraph( 
ww8::WW8TableNodeInfoInner::Pointer_t pT
 
 --m_nTextFrameLevel;
 
+/* If m_nHyperLinkCount > 0 that means hyperlink tag is not yet colsed.
+ * This is due to nested hyperlink tags. So close it before end of 
paragraph.
+ */
+if(m_nHyperLinkCount > 0)
+{
+for(sal_Int32 nHyperLinkToClose = 0; nHyperLinkToClose < 
m_nHyperLinkCount; ++nHyperLinkToClose)
+m_pSerializer->endElementNS( XML_w, XML_hyperlink );
+m_nHyperLinkCount = 0;
+}
+
 m_pSerializer->endElementNS( XML_w, XML_p );
 
 WriteParagraphSdt();
@@ -712,6 +722,7 @@ void DocxAttributeOutput::EndRun()
 {
 m_pSerializer->endElementNS( XML_w, XML_hyperlink );
 m_startedHyperlink = false;
+m_nHyperLinkCount--;
 }
 m_closeHyperlinkInPreviousRun = false;
 }
@@ -743,6 +754,7 @@ void DocxAttributeOutput::EndRun()
 m_pSerializer->startElementNS( XML_w, XML_hyperlink, xAttrList );
 m_pHyperlinkAttrList = NULL;
 m_startedHyperlink = true;
+m_nHyperLinkCount++;
 }
 
 // if there is some redlining in the document, output it
@@ -830,6 +842,7 @@ void DocxAttributeOutput::EndRun()
 
 m_pSerializer->endElementNS( XML_w, XML_hyperlink );
 m_startedHyperlink = false;
+m_nHyperLinkCount--;
 }
 m_closeHyperlinkInThisRun = false;
 }
@@ -7060,6 +7073,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport 
&rExport, FSHelperPtr pSeri
   m_closeHyperlinkInThisRun( false ),
   m_closeHyperlinkInPreviousRun( false ),
   m_startedHyperlink( false ),
+  m_nHyperLinkCount(0),
   m_postponedGraphic( NULL ),
   m_postponedDiagram( NULL ),
   m_postponedVMLDrawing(NULL),
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx 
b/sw/source/filter/ww8/docxattributeoutput.hxx
index b5a58d8..5b55dc8 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -771,6 +771,8 @@ private:
 bool m_closeHyperlinkInThisRun;
 bool m_closeHyperlinkInPreviousRun;
 bool m_startedHyperlink;
+// Count nested Hype

[Libreoffice-commits] core.git: sw/qa sw/source

2014-04-03 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/fdo76589.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   14 ++
 sw/source/filter/ww8/docxattributeoutput.cxx |2 +-
 3 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 8902a25c1ad11161fe7b9d263e9d7afe23f95e50
Author: Pallavi Jadhav 
Date:   Thu Mar 27 14:55:16 2014 +0530

fdo#76589 : FILESAVE: DOCX: Numbered list is not preserved after RT

Issue :
Numbered list without suffix does not get preserved after
Roudtrip.

Description :
- For level zero LO was writing w:lvlText with epmty value.
- This was because in DocxAttributeOutput::NumberingLevel()
  check was based on empty NumberingString.
- But for "deciaml" also rNumberingString appears to be empty
  for level-0

Implementation :
- Added check to write empty value for w:lvlText only if
  NumberingType is "bullet" with level-0.
- This will not write empty w:lvlText with level-0 and
  NumberingType as "decimal".

Reviewed on:
https://gerrit.libreoffice.org/8768

Change-Id: Ic6ece45e0122da05013beac93a6e11fac926514d

diff --git a/sw/qa/extras/ooxmlexport/data/fdo76589.docx 
b/sw/qa/extras/ooxmlexport/data/fdo76589.docx
new file mode 100644
index 000..d501b1b
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo76589.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 15a5ddf..b68b872 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2991,6 +2991,20 @@ DECLARE_OOXMLEXPORT_TEST(test76317_2K10, 
"test76317_2K10.docx")
 assertXPath(pXmlDoc, 
"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:prstGeom[1]/a:avLst[1]/a:gd[1]",
 "name", "adj");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testfdo76589 , "fdo76589.docx")
+{
+/* Numbered list was not preserve after RT.
+ * In numbering.xml, when NumberingType is "decimal" and level is zero,
+ * w:val of w:lvlText was empty.
+ * It should be 
+ */
+xmlDocPtr pXmlDoc = parseExport("word/numbering.xml");
+if (!pXmlDoc)
+return;
+
+assertXPath ( pXmlDoc, 
"/w:numbering/w:abstractNum[1]/w:lvl[1]/w:lvlText","val","%1" );
+}
+
 DECLARE_OOXMLEXPORT_TEST(testAuthorPropertySdt, "author-property.docx")
 {
 xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index dd8ee93..caea79e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5006,7 +5006,7 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 
nLevel,
 aBuffer.append( pPrev, pIt - pPrev );
 
 // If bullet char is empty, set lvlText as empty
-if ( aText.equals ( OUString(sal_Unicode(0)) ) )
+if ( aText.equals ( OUString(sal_Unicode(0)) ) && nNumberingType == 
SVX_NUM_CHAR_SPECIAL )
 {
 m_pSerializer->singleElementNS( XML_w, XML_lvlText, FSNS( XML_w, 
XML_val ), "", FSEND );
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa sw/source

2014-01-29 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/LineStyle_DashType.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   11 +++
 sw/source/filter/ww8/docxattributeoutput.cxx  |2 ++
 3 files changed, 13 insertions(+)

New commits:
commit 0fc0acb52529a3cc8e2ff2c17e074cf6ac8ba1a7
Author: Pallavi Jadhav 
Date:   Tue Jan 21 19:49:45 2014 +0530

Fix for :DOCX-Preservation of Line style Dash type of "Shape with text 
inside"

Issue :
File containing Shape with text inside it having Line style as
Dash type is not getting preserved after RT.

Implementation :
1] Added XML element  with attribute  val="dash".
2] Written Export Unit test case.

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/7572

Change-Id: I27ca9f8786426a224b32dbd2aeabc40be244c9db

diff --git a/sw/qa/extras/ooxmlexport/data/LineStyle_DashType.docx 
b/sw/qa/extras/ooxmlexport/data/LineStyle_DashType.docx
new file mode 100644
index 000..9256c3e
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/LineStyle_DashType.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 771c2c5..746422e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2687,6 +2687,17 @@ DECLARE_OOXMLEXPORT_TEST(testAlignForShape,"Shape.docx")
 assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp:positionH/wp:align","1");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testLineStyle_DashType, "LineStyle_DashType.docx")
+{
+/* DOCX contatining Shape with LineStyle as Dash Type should get preserved 
inside
+ * an XMl tag  with value "dash".
+ */
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p/w:r[2]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:ln/a:prstDash",
 "val", "dash");
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 7c15a22..caf2635 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5810,6 +5810,8 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& 
rBox )
 XML_val, sColor,
 FSEND);
 m_pSerializer->endElementNS(XML_a, XML_solidFill);
+if( LineStyle_DASH == pTop->GetBorderLineStyle() ) // Line 
Style is Dash type
+m_pSerializer->singleElementNS(XML_a, XML_prstDash, 
XML_val, "dash", FSEND);
 m_pSerializer->endElementNS(XML_a, XML_ln);
 }
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa sw/source

2014-02-13 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/LineStyle_DashType_VML.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx  |   11 ++
 sw/source/filter/ww8/docxattributeoutput.cxx  |3 ++
 sw/source/filter/ww8/docxsdrexport.cxx|   15 +-
 sw/source/filter/ww8/docxsdrexport.hxx|1 
 5 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit e5a891793baafb4504dcedaec82e6827d847ecf1
Author: Pallavi Jadhav 
Date:   Thu Jan 23 15:56:32 2014 +0530

Fix for: DOCX-Preservation of Line style Dash type of "Shape with text 
inside"

Issue :
File containing Shape with text inside it having Line style as
Dash type is not getting preserved after RT in MS office 2007.

Implementation :
1] Added XML element  with attribute  dashstyle="dash".
2] Written Export Unit test case.

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/7611

Change-Id: Id01c5975c2c1cf176a7459f65973f4c9c3c9b9d8

diff --git a/sw/qa/extras/ooxmlexport/data/LineStyle_DashType_VML.docx 
b/sw/qa/extras/ooxmlexport/data/LineStyle_DashType_VML.docx
new file mode 100644
index 000..8b95672
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/LineStyle_DashType_VML.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index b11f4ca..06b881c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2974,6 +2974,17 @@ DECLARE_OOXMLEXPORT_TEST(fdo69656, 
"Table_cell_auto_width_fdo69656.docx")
 assertXPath(pXmlDoc, 
"/w:document/w:body/w:tbl/w:tblPr/w:tblW","type","auto");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testLineStyle_DashType_VML, 
"LineStyle_DashType_VML.docx")
+{
+/* DOCX contatining "Shape with text inside" having Line Style as "Dash 
Type" should get
+ * preserved inside an XML tag  with attribute dashstyle having 
value "dash".
+ */
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p/w:r[2]/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:stroke",
 "dashstyle", "dash");
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 97ec8b7..87b1c6e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5919,6 +5919,9 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& 
rBox )
 AddToAttrList( m_rExport.SdrExporter().getFlyAttrList(), 2,
 XML_strokecolor, sColor.getStr(),
 XML_strokeweight, sWidth.getStr() );
+if( LineStyle_DASH == pTop->GetBorderLineStyle() ) // Line 
Style is Dash type
+AddToAttrList( 
m_rExport.SdrExporter().getDashLineStyle(),
+XML_dashstyle, "dash" );
 }
 else
 {
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index a99f5ea..7abc92a 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -74,6 +74,7 @@ struct DocxSdrExport::Impl
 sax_fastparser::FastAttributeList* m_pFlyFillAttrList;
 sax_fastparser::FastAttributeList* m_pFlyWrapAttrList;
 sax_fastparser::FastAttributeList* m_pBodyPrAttrList;
+sax_fastparser::FastAttributeList* m_pDashLineStyleAttr;
 
 Impl(DocxSdrExport& rSdrExport, DocxExport& rExport, 
sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML)
 : m_rSdrExport(rSdrExport),
@@ -88,7 +89,8 @@ struct DocxSdrExport::Impl
   m_bFrameBtLr(false),
   m_pFlyFillAttrList(0),
   m_pFlyWrapAttrList(0),
-  m_pBodyPrAttrList(0)
+  m_pBodyPrAttrList(0),
+  m_pDashLineStyleAttr(0)
 {
 }
 
@@ -177,6 +179,11 @@ sax_fastparser::FastAttributeList* 
DocxSdrExport::getBodyPrAttrList()
 return m_pImpl->m_pBodyPrAttrList;
 }
 
+sax_fastparser::FastAttributeList*& DocxSdrExport::getDashLineStyle()
+{
+return m_pImpl->m_pDashLineStyleAttr;
+}
+
 void DocxSdrExport::setFlyWrapAttrList(sax_fastparser::FastAttributeList* 
pAttrList)
 {
 m_pImpl->m_pFlyWrapAttrList = pAttrList;
@@ -981,6 +988,12 @@ void DocxSdrExport::writeVMLTextFrame(sw::Frame* 
pParentFrame)
 m_pImpl->m_pFlyFillAttrList = NULL;
 pFS->singleElementNS(XML_v, XML_fill, xFlyFillAttrList);
 }
+if (m_pImpl->m_pDashLineStyleAttr)
+{
+sax_fastparser:

[Libreoffice-commits] core.git: sw/qa sw/source

2014-02-13 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/fdo74153.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|   11 +++
 sw/source/filter/ww8/ww8atr.cxx |5 +
 3 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 78c5cbc720993e9cc01fceadd73678ed1a45d37f
Author: Pallavi Jadhav 
Date:   Mon Feb 3 18:55:13 2014 +0530

fdo#74153 : Preservation of Column Break with column_count = 0

Issue :
1] DOCX containing column break with column_count = 0
   was not getting preserved after RT.
2] LO was writing column break only when column_count > 1

Implementation :
1] Removed check column_count > 1. So that if LO
   encounters a column break with column_count >=0,
   it should preserve it.
2] Added export Unit Test case.

Behavior after Fix :
LO is able to preserve Column Break with
column_count = 0.

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/7815

Change-Id: I29c77f27184ec5afed354be01fc68e0d3471bfee

diff --git a/sw/qa/extras/ooxmlexport/data/fdo74153.docx 
b/sw/qa/extras/ooxmlexport/data/fdo74153.docx
new file mode 100644
index 000..4cbdd7b
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo74153.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 021c8d2..e4789ed 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3027,6 +3027,17 @@ DECLARE_OOXMLEXPORT_TEST(testFdo74110,"fdo74110.docx")
 assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent/mc:Choice/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:prstGeom[1]/a:avLst[1]/a:gd[1]",0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testColumnBreak_ColumnCountIsZero,"fdo74153.docx")
+{
+/* fdo73545: Column Break with Column_count = 0 was not getting preserved.
+ * The  was missing after roundtrip
+ */
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+assertXPath(pXmlDoc, 
"/w:document/w:body/w:p[3]/w:r[1]/w:br","type","column");
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index fb261f9..a6f711e 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3627,10 +3627,7 @@ void AttributeOutputBase::FormatBreak( const 
SvxFmtBreakItem& rBreak )
 // no break;
 case SVX_BREAK_COLUMN_AFTER:
 case SVX_BREAK_COLUMN_BOTH:
-if ( GetExport().Sections().CurrentNumberOfColumns( 
*GetExport().pDoc ) > 1 )
-{
-nC = msword::ColumnBreak;
-}
+nC = msword::ColumnBreak;
 break;
 
 case SVX_BREAK_PAGE_BEFORE: // PageBreak
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source

2014-02-25 Thread Pallavi Jadhav
 sw/qa/extras/ooxmlexport/data/FDO74105.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |   15 +++
 sw/source/filter/ww8/docxattributeoutput.cxx |   13 +
 writerfilter/source/dmapper/NumberingManager.cxx |   12 
 4 files changed, 36 insertions(+), 4 deletions(-)

New commits:
commit 01826dc12550e7a4204034f7876c593726525b54
Author: Pallavi Jadhav 
Date:   Tue Jan 28 11:42:53 2014 +0530

fdo#74105 : Prservation of Numbered lists-Starting with Value '0'

Issue :
  - DOCX containing Numbered lists- Strating with
value '0' is not preserved after RT.
  - LO exports document with Numbered lists starting
from '1' instead of '0'.
  - LO "Import" and "Export" need fixes.
  - If LO will imports correctly, export will get
correct value.

   Implentation :
  - Added code at Import and Export side.
  - Added Export Unit test case to check that
 is not present in numbering.xml
for 0th level.

   NOTE :  is optional. If not mentioned
  Numbered lists starts from '0'.

Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/7710

Change-Id: I30910c41fd188f30a1723cf8e07be5ea1cde1be0

diff --git a/sw/qa/extras/ooxmlexport/data/FDO74105.docx 
b/sw/qa/extras/ooxmlexport/data/FDO74105.docx
new file mode 100644
index 000..4299cf9
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/FDO74105.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index d7692ac..7b7c904 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3498,6 +3498,21 @@ DECLARE_OOXMLEXPORT_TEST(testEmbeddedXlsx, 
"embedded-xlsx.docx")
 CPPUNIT_ASSERT_EQUAL(2, nImageFiles);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testNumberedLists_StartingWithZero, "FDO74105.docx")
+{
+/* Issue : Numbered lists Starting with value '0' is not preserved after 
RT.
+ * In numbering.xml, an XML tag  is optional. If not mentioned,
+ * the Numbered list should start from 0.
+ * Problem was LO was writing  for all levels 0-8 with default 
value "1".
+ */
+xmlDocPtr pXmlDoc = parseExport("word/numbering.xml");
+if (!pXmlDoc)
+  return;
+
+// Check that we do _not_ export w:start for .
+assertXPath(pXmlDoc, "w:numbering/w:abstractNum[1]/w:lvl[1]/w:start", 0);
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 6414d04..77a0aed 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4434,10 +4434,15 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 
nLevel,
 FSNS( XML_w, XML_ilvl ), OString::number( nLevel ).getStr(),
 FSEND );
 
-// start with the nStart value
-m_pSerializer->singleElementNS( XML_w, XML_start,
-FSNS( XML_w, XML_val ), OString::number( nStart ).getStr(),
-FSEND );
+// start with the nStart value. Do not write w:start if Numbered Lists
+// starts from zero.As it's an optional parameter.
+// refer ECMA 376 Second edition Part-1
+if(!(0 == nLevel && 0 == nStart))
+{
+m_pSerializer->singleElementNS( XML_w, XML_start,
+FSNS( XML_w, XML_val ), OString::number( nStart ).getStr(),
+FSEND );
+}
 
 // format
 OString aFmt( impl_NumberingType( nNumberingType ) );
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx 
b/writerfilter/source/dmapper/NumberingManager.cxx
index 60582c8..98d9c44 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -829,6 +829,7 @@ void ListsManager::lcl_attribute( Id nName, Value& rVal )
 
 void ListsManager::lcl_sprm( Sprm& rSprm )
 {
+static bool bIsStartVisited = false;
 //fill the attributes of the style sheet
 sal_uInt32 nSprmId = rSprm.getId();
 if( m_pCurrentDefinition.get() ||
@@ -952,11 +953,22 @@ void ListsManager::lcl_sprm( Sprm& rSprm )
 }
 break;
 case NS_ooxml::LN_CT_Lvl_start:
+if (m_pCurrentDefinition->GetCurrentLevel().get())
+m_pCurrentDefinition->GetCurrentLevel( )->SetValue( 
nSprmId, nIntValue );
+bIsStartVisited = true;
+break;
 case NS_ooxml::LN_CT_Lvl_numFmt:
 case NS_ooxml::LN_CT_Lvl_isLgl:
 case NS_ooxml::LN_CT_Lvl_legacy:
 if (m_pCurrentDefinition-&

[Libreoffice-commits] core.git: Changes to 'refs/changes/27/10827/1'

2014-09-29 Thread Pallavi Jadhav

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/27/10827/2'

2014-09-29 Thread Pallavi Jadhav

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/61/9561/2'

2014-09-29 Thread Pallavi Jadhav

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/00/9200/1'

2014-09-29 Thread Pallavi Jadhav

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/28/9328/2'

2014-09-29 Thread Pallavi Jadhav

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/61/9561/1'

2014-09-29 Thread Pallavi Jadhav

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/28/9328/1'

2014-09-29 Thread Pallavi Jadhav

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/00/9200/2'

2014-09-29 Thread Pallavi Jadhav

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/10/7710/3'

2014-09-29 Thread Pallavi Jadhav

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/10/7710/1'

2014-09-29 Thread Pallavi Jadhav

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/07/6507/1'

2014-09-29 Thread Pallavi Jadhav

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/02/7202/2'

2014-09-29 Thread Pallavi Jadhav

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/95/6595/1'

2014-09-29 Thread Pallavi Jadhav

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Changes to 'refs/changes/55/10655/2'

2014-09-29 Thread Pallavi Jadhav

___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[PATCH] Crop issue resolved

2013-02-09 Thread pallavi jadhav (via Code Review)
Hi,

I have submitted a patch for review:

https://gerrit.libreoffice.org/2050

To pull it, you can do:

git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/50/2050/1

Crop issue resolved

Change-Id: Ia822f87c3b29acd80c50a64edb617344c3e4507b
---
M oox/inc/oox/export/drawingml.hxx
M oox/source/export/drawingml.cxx
M oox/source/export/shapes.cxx
3 files changed, 54 insertions(+), 0 deletions(-)



diff --git a/oox/inc/oox/export/drawingml.hxx b/oox/inc/oox/export/drawingml.hxx
index 6198ec6..5dc79b0 100644
--- a/oox/inc/oox/export/drawingml.hxx
+++ b/oox/inc/oox/export/drawingml.hxx
@@ -106,6 +106,7 @@
 void WriteGradientFill( ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet > rXPropSet );
 void WriteBlipFill( ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName, 
sal_Int32 nXmlNamespace );
 void WriteBlipFill( ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName );
+void WriteSrcRect( ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet >, OUString& );
 void WriteOutline( ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet > rXPropSet );
 void WriteStretch();
 void WriteLinespacing( ::com::sun::star::style::LineSpacing& rLineSpacing 
);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 8389b3a..72bba35 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -70,6 +70,10 @@
 #include 
 #include 
 
+#include 
+#include 
+using ::com::sun::star::geometry::IntegerRectangle2D;
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::drawing;
@@ -605,6 +609,49 @@
 }
 }
 
+
+void DrawingML::WriteSrcRect( Reference< XPropertySet > rXPropSet, OUString& 
rURL )
+{
+
+Size aOriginalSize;
+rtl::OString aURLBS(rtl::OUStringToOString(rURL, 
RTL_TEXTENCODING_UTF8));
+
+const char aURLBegin[] = "vnd.sun.star.GraphicObject:";
+sal_Int32 index = 
aURLBS.indexOfL(RTL_CONSTASCII_STRINGPARAM(aURLBegin));
+
+if ( index != -1 )
+{
+DBG(printf ("begin: %ld %s\n", long( sizeof( aURLBegin ) ), USS( 
rURL ) + RTL_CONSTASCII_LENGTH( aURLBegin ) ));
+GraphicObject aGraphic = GraphicObject( 
aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin)) );
+
+aOriginalSize = aGraphic.GetPrefSize();
+}
+
+bool bCrop,IsCropped=true;
+
+::com::sun::star::text::GraphicCrop aGraphicCropStruct;
+
+if ( ( bCrop= GetProperty( rXPropSet, "GraphicCrop"  ) ) )
+ {  
+mAny >>= aGraphicCropStruct; 
+
+if( (0 == aGraphicCropStruct.Left) && (0 == aGraphicCropStruct.Top) && 
(0 == aGraphicCropStruct.Right) && (0 == aGraphicCropStruct.Bottom) )
+{
+IsCropped=false;
+}
+else
+{
+mpFS->singleElementNS(XML_a, XML_srcRect,
+  XML_l,I32S(((aGraphicCropStruct.Left) * 
10)/aOriginalSize.Width()),
+  XML_t,I32S(((aGraphicCropStruct.Top) * 
10)/aOriginalSize.Height()),
+  XML_r,I32S(((aGraphicCropStruct.Right) * 
10)/aOriginalSize.Width()), 
+  XML_b,I32S(((aGraphicCropStruct.Bottom) * 
10)/aOriginalSize.Height()),
+  FSEND);
+} 
+}
+}
+
+
 void DrawingML::WriteStretch()
 {
 mpFS->startElementNS( XML_a, XML_stretch, FSEND );
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 41d505a..f9e6d8d5 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -873,6 +873,12 @@
 
 WriteBlip( xShapeProps, sGraphicURL, pGraphic );
 
+
/*---*/
+
+WriteSrcRect( xShapeProps, sGraphicURL );
+ 
+   
/*-*/
+
 // now we stretch always when we get pGraphic (when changing that
 // behavior, test n#780830 for regression, where the OLE sheet might get 
tiled
 bool bStretch = false;

-- 
To view, visit https://gerrit.libreoffice.org/2050
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia822f87c3b29acd80c50a64edb617344c3e4507b
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: pallavi jadhav 
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[PATCH] Resolved : FILESAVE save as pptx discard crop information

2013-02-12 Thread pallavi jadhav (via Code Review)
Hi,

I have submitted a patch for review:

https://gerrit.libreoffice.org/2118

To pull it, you can do:

git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/18/2118/1

Resolved :  FILESAVE save as pptx discard crop information

Change-Id: I8aee13b11406988ab451034f43ee41c662add5fb
---
M oox/inc/oox/export/drawingml.hxx
M oox/source/export/drawingml.cxx
M oox/source/export/shapes.cxx
3 files changed, 53 insertions(+), 0 deletions(-)



diff --git a/oox/inc/oox/export/drawingml.hxx b/oox/inc/oox/export/drawingml.hxx
index 6198ec6..5dc79b0 100644
--- a/oox/inc/oox/export/drawingml.hxx
+++ b/oox/inc/oox/export/drawingml.hxx
@@ -106,6 +106,7 @@
 void WriteGradientFill( ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet > rXPropSet );
 void WriteBlipFill( ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName, 
sal_Int32 nXmlNamespace );
 void WriteBlipFill( ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName );
+void WriteSrcRect( ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet >, OUString& );
 void WriteOutline( ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet > rXPropSet );
 void WriteStretch();
 void WriteLinespacing( ::com::sun::star::style::LineSpacing& rLineSpacing 
);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 8389b3a..5230c54 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -69,6 +69,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::beans;
@@ -605,6 +606,51 @@
 }
 }
 
+
+void DrawingML::WriteSrcRect( Reference< XPropertySet > rXPropSet, OUString& 
rURL )
+{
+
+Size aOriginalSize;
+const char aURLBegin[] = "vnd.sun.star.GraphicObject:";
+
+rtl::OString aURLBS(rtl::OUStringToOString(rURL, 
RTL_TEXTENCODING_UTF8));
+
+sal_Int32 index = 
aURLBS.indexOfL(RTL_CONSTASCII_STRINGPARAM(aURLBegin));
+
+if ( index != -1 )
+{
+DBG(printf ("begin: %ld %s\n", long( sizeof( aURLBegin ) ), USS( 
rURL ) + RTL_CONSTASCII_LENGTH( aURLBegin ) ));
+GraphicObject aGraphic = GraphicObject( 
aURLBS.copy(RTL_CONSTASCII_LENGTH(aURLBegin)) );
+
+aOriginalSize = aGraphic.GetPrefSize();
+}
+
+bool bCrop,IsCropped=true;
+::com::sun::star::text::GraphicCrop aGraphicCropStruct;
+
+if ( ( bCrop= GetProperty( rXPropSet, "GraphicCrop"  ) ) )
+ {  
+mAny >>= aGraphicCropStruct; 
+
+/* element  should not be written into an xml file if 
cropping is NOT performed on an image. 
+   IsCropped=false specifies this condition. */
+if( (0 == aGraphicCropStruct.Left) && (0 == aGraphicCropStruct.Top) && 
(0 == aGraphicCropStruct.Right) && (0 == aGraphicCropStruct.Bottom) )
+{
+IsCropped=false;
+}
+else
+{
+mpFS->singleElementNS(XML_a, XML_srcRect,
+  XML_l,I32S(((aGraphicCropStruct.Left) * 
10)/aOriginalSize.Width()),
+  XML_t,I32S(((aGraphicCropStruct.Top) * 
10)/aOriginalSize.Height()),
+  XML_r,I32S(((aGraphicCropStruct.Right) * 
10)/aOriginalSize.Width()), 
+  XML_b,I32S(((aGraphicCropStruct.Bottom) * 
10)/aOriginalSize.Height()),
+  FSEND);
+} 
+}
+}
+
+
 void DrawingML::WriteStretch()
 {
 mpFS->startElementNS( XML_a, XML_stretch, FSEND );
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 41d505a..f9e6d8d5 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -873,6 +873,12 @@
 
 WriteBlip( xShapeProps, sGraphicURL, pGraphic );
 
+
/*---*/
+
+WriteSrcRect( xShapeProps, sGraphicURL );
+ 
+   
/*-*/
+
 // now we stretch always when we get pGraphic (when changing that
 // behavior, test n#780830 for regression, where the OLE sheet might get 
tiled
 bool bStretch = false;

-- 
To view, visit https://gerrit.libreoffice.org/2118
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8aee13b11406988ab451034f43ee41c662add5fb
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: pallavi jadhav 
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice