Kaydet (Commit) 896714db authored tarafından umeshkadam's avatar umeshkadam Kaydeden (comit) Miklos Vajna

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
üst 4bdf9a02
...@@ -2582,6 +2582,14 @@ DECLARE_OOXMLEXPORT_TEST(testTableRowDataDisplayedTwice,"table-row-data-displaye ...@@ -2582,6 +2582,14 @@ DECLARE_OOXMLEXPORT_TEST(testTableRowDataDisplayedTwice,"table-row-data-displaye
CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor->getPage()); 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 #endif
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -786,22 +786,27 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) ...@@ -786,22 +786,27 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
rAppendContext.pLastParagraphProperties->GetWrap() : rAppendContext.pLastParagraphProperties->GetWrap() :
pStyleProperties->GetWrap()); pStyleProperties->GetWrap());
sal_Int32 nBottomDist; /** FDO#73546 : distL & distR should be unsigned intgers <Ecma 20.4.3.6>
sal_Int32 nTopDist = nBottomDist = 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() >= 0 ?
rAppendContext.pLastParagraphProperties->GethSpace() : rAppendContext.pLastParagraphProperties->GethSpace() :
pStyleProperties->GethSpace(); pStyleProperties->GethSpace() >= 0 ? pStyleProperties->GethSpace() : 0;
pFrameProperties[11].Value <<= nVertOrient == text::VertOrientation::TOP ? 0 : nTopDist; pFrameProperties[11].Value <<= nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist;
pFrameProperties[12].Value <<= nVertOrient == text::VertOrientation::BOTTOM ? 0 : nBottomDist; pFrameProperties[12].Value <<= nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist;
sal_Int32 nRightDist; sal_Int32 nBottomDist;
sal_Int32 nLeftDist = nRightDist = sal_Int32 nTopDist = nBottomDist =
rAppendContext.pLastParagraphProperties->GetvSpace() >= 0 ? rAppendContext.pLastParagraphProperties->GetvSpace() >= 0 ?
rAppendContext.pLastParagraphProperties->GetvSpace() : rAppendContext.pLastParagraphProperties->GetvSpace() :
pStyleProperties->GetvSpace() >= 0 ? pStyleProperties->GetvSpace() : 0; pStyleProperties->GetvSpace() >= 0 ? pStyleProperties->GetvSpace() : 0;
pFrameProperties[13].Value <<= nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist;
pFrameProperties[14].Value <<= nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist; 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. // If there is no fill, the Word default is 100% transparency.
// Otherwise CellColorHandler has priority, and this setting // Otherwise CellColorHandler has priority, and this setting
// will be ignored. // will be ignored.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment