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

umeshkadam umesh.kadam at synerzip.com
Thu Jan 23 02:06:22 PST 2014


 sw/qa/extras/ooxmlexport/data/FDO73546.docx       |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx          |    8 +++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   25 +++++++++++++---------
 3 files changed, 23 insertions(+), 10 deletions(-)

New commits:
commit 896714db527f39497aedee8946964e5acd73778c
Author: umeshkadam <umesh.kadam at synerzip.com>
Date:   Fri Jan 17 19:00:29 2014 +0530

    fdo#73546 : faulty value of attribute value in <wp:anchor> tag
    
       Issue :
        - The margins for distL & distR were getting exported as a negative
          value viz ( distL="-635" distR="-635" ).
        - While setting the default frame properties the values for distL
          & distR were getting defaulted to -1, this value was further
          considered while exporting for calculations hence the value
          -635 used to appear.
    
       Implementation :
        - according to Ecma 20.4.3.6 the values of distL & distR should
          be positive.
        - Added a condition to check the negativity of the value while
          setting it to default.
        - observed that horizontal orientation values were being populated
          to distT & distB( top & bottom margin respectively) and
          vertical orientation values were being populated to distL & distR
          (Left and right margin respectively). The values should have been
          vice versa. Corrected the same.
    
    Conflicts:
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    Reviewed on:
    	https://gerrit.libreoffice.org/7501
    
    Change-Id: I056e5845b64cd755429297899eeb972f6009efec

diff --git a/sw/qa/extras/ooxmlexport/data/FDO73546.docx b/sw/qa/extras/ooxmlexport/data/FDO73546.docx
new file mode 100644
index 0000000..4682971
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/FDO73546.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index cdb228e..c18277c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2582,6 +2582,14 @@ DECLARE_OOXMLEXPORT_TEST(testTableRowDataDisplayedTwice,"table-row-data-displaye
     CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor->getPage());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testFDO73546, "FDO73546.docx")
+{
+    xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
+    if (!pXmlDoc)
+        return;
+    assertXPath(pXmlDoc, "/w:hdr/w:p[1]/w:r[3]/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor", "distL","0");
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 354b6eb..1d44373 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -786,22 +786,27 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
                     rAppendContext.pLastParagraphProperties->GetWrap() :
                     pStyleProperties->GetWrap());
 
-                sal_Int32 nBottomDist;
-                sal_Int32 nTopDist = nBottomDist =
+                /** FDO#73546 : distL & distR should be unsigned intgers <Ecma 20.4.3.6>
+                    Swapped the array elements 11,12 & 13,14 since 11 & 12 are
+                    LEFT & RIGHT margins and 13,14 are TOP and BOTTOM margins respectively.
+                */
+                sal_Int32 nRightDist;
+                sal_Int32 nLeftDist = nRightDist =
                     rAppendContext.pLastParagraphProperties->GethSpace() >= 0 ?
                     rAppendContext.pLastParagraphProperties->GethSpace() :
-                    pStyleProperties->GethSpace();
+                    pStyleProperties->GethSpace() >= 0 ? pStyleProperties->GethSpace() : 0;
 
-                pFrameProperties[11].Value <<= nVertOrient == text::VertOrientation::TOP ? 0 : nTopDist;
-                pFrameProperties[12].Value <<= nVertOrient == text::VertOrientation::BOTTOM ? 0 : nBottomDist;
+                pFrameProperties[11].Value <<= nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist;
+                pFrameProperties[12].Value <<= nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist;
 
-                sal_Int32 nRightDist;
-                sal_Int32 nLeftDist = nRightDist =
+                sal_Int32 nBottomDist;
+                sal_Int32 nTopDist = nBottomDist =
                     rAppendContext.pLastParagraphProperties->GetvSpace() >= 0 ?
                     rAppendContext.pLastParagraphProperties->GetvSpace() :
-                pStyleProperties->GetvSpace() >= 0 ? pStyleProperties->GetvSpace() : 0;
-                pFrameProperties[13].Value <<= nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist;
-                pFrameProperties[14].Value <<= nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist;
+                    pStyleProperties->GetvSpace() >= 0 ? pStyleProperties->GetvSpace() : 0;
+
+                pFrameProperties[13].Value <<= nVertOrient == text::VertOrientation::TOP ? 0 : nTopDist;
+                pFrameProperties[14].Value <<= nVertOrient == text::VertOrientation::BOTTOM ? 0 : nBottomDist;
                 // If there is no fill, the Word default is 100% transparency.
                 // Otherwise CellColorHandler has priority, and this setting
                 // will be ignored.


More information about the Libreoffice-commits mailing list