include/oox/export/drawingml.hxx | 5 -- oox/source/export/drawingml.cxx | 46 ++++------------------ sd/qa/unit/data/pptx/tdf91999_rotateShape.pptx |binary sd/qa/unit/export-tests-ooxml2.cxx | 16 +++++++ sw/qa/extras/ooxmlexport/data/dml-textshapeB.docx |binary sw/qa/extras/ooxmlexport/data/tdf117988.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 5 ++ sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 17 ++++++++ sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 3 - writerfilter/source/filter/WriterFilter.cxx | 2 10 files changed, 53 insertions(+), 41 deletions(-)
New commits: commit 8229f44e2a18c54055a5e2105dfbdceb3d98a50b Author: Justin Luth <justin_l...@sil.org> AuthorDate: Wed Aug 1 14:08:34 2018 +0300 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Sep 13 11:56:54 2018 +0200 tdf#91999 export/drawingml: shape rotate 180 is not special This commit reverts the first (LO 4.3ish) regression commit 6063555744ed89d8a757b667cddcdd4357839466 and most of the two commits that tried to fix that: commit 9ae1e094d5a8a5b4432c88ebea0ca9fc1c79f602 and commit ee45d881efab230e7682f964d6ad4d00f85b0006 in LO6.0/6.2. The ooxmlexport6 unit test shows that there is nothing special about 180degrees. So, all transformations need to be avoided in docx format - not just 180 degree ones. I removed IsInGroupShape() since it is no longer being used - as per standard procedures. Reviewed-on: https://gerrit.libreoffice.org/58434 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> (cherry picked from commit ab296726263655bd3a722c125dd9cec2d507aaa5) Change-Id: Id2bba5bc542875a10ac21fbb67f29b2d59705493 diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx index f281d7f7ccc4..5b7e9660ace1 100644 --- a/include/oox/export/drawingml.hxx +++ b/include/oox/export/drawingml.hxx @@ -197,7 +197,7 @@ public: void WriteBlipMode( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet, const OUString& rURL ); void WriteShapeTransformation(const css::uno::Reference< css::drawing::XShape >& rXShape, - sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = false, bool bSuppressRotation = false, bool bSuppressFlipping = false ); + sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = false, bool bSuppressRotation = false, bool bSuppressFlipping = false, bool bFlippedBeforeRotation = false); void WriteTransformation(const tools::Rectangle& rRectangle, sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = false, sal_Int32 nRotation = 0, bool bIsGroupShape = false); @@ -226,8 +226,7 @@ public: void WriteShape3DEffects( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); void WriteArtisticEffect( const css::uno::Reference< css::beans::XPropertySet >& rXPropSet ); OString WriteWdpPicture( const OUString& rFileId, const css::uno::Sequence< sal_Int8 >& rPictureData ); - bool IsInGroupShape() const; - bool IsGroupShape( const css::uno::Reference< css::drawing::XShape >& rXShape, bool bOrChildShape = false ) const; + bool IsGroupShape( const css::uno::Reference< css::drawing::XShape >& rXShape ) const; sal_Int32 getBulletMarginIndentation (const css::uno::Reference< css::beans::XPropertySet >& rXPropSet,sal_Int16 nLevel, const OUString& propName); static void ResetCounters(); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index ddea4d2a168b..302abe723545 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1347,7 +1347,7 @@ void DrawingML::WriteTransformation(const tools::Rectangle& rRect, mpFS->endElementNS( nXmlNamespace, XML_xfrm ); } -void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sal_Int32 nXmlNamespace, bool bFlipH, bool bFlipV, bool bSuppressRotation, bool bSuppressFlipping ) +void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sal_Int32 nXmlNamespace, bool bFlipH, bool bFlipV, bool bSuppressRotation, bool bSuppressFlipping, bool bFlippedBeforeRotation ) { SAL_INFO("oox.shape", "write shape transformation"); @@ -1355,17 +1355,16 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa awt::Point aPos = rXShape->getPosition(); awt::Size aSize = rXShape->getSize(); - bool bPositiveY = true; - bool bPositiveX = true; + bool bFlipHWrite = bFlipH && !bSuppressFlipping; + bool bFlipVWrite = bFlipV && !bSuppressFlipping; + bFlipH = bFlipH && !bFlippedBeforeRotation; + bFlipV = bFlipV && !bFlippedBeforeRotation; if (GetDocumentType() == DOCUMENT_DOCX && m_xParent.is()) { awt::Point aParentPos = m_xParent->getPosition(); aPos.X -= aParentPos.X; aPos.Y -= aParentPos.Y; - - bPositiveX = aParentPos.X >= 0; - bPositiveY = aParentPos.Y >= 0; } if ( aSize.Width < 0 ) @@ -1376,24 +1375,13 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa { SdrObject* pShape = GetSdrObjectFromXShape( rXShape ); nRotation = pShape ? pShape->GetRotateAngle() : 0; - if (nRotation != 0 && nRotation != 18000) + if ( nRotation != 0 && GetDocumentType() != DOCUMENT_DOCX ) { int faccos=bFlipV ? -1 : 1; int facsin=bFlipH ? -1 : 1; aPos.X-=(1-faccos*cos(nRotation*F_PI18000))*aSize.Width/2-facsin*sin(nRotation*F_PI18000)*aSize.Height/2; aPos.Y-=(1-faccos*cos(nRotation*F_PI18000))*aSize.Height/2+facsin*sin(nRotation*F_PI18000)*aSize.Width/2; } - else if ( nRotation == 18000 && IsGroupShape( rXShape, /*bOrChildShape=*/true ) ) - { - if (!bFlipV && bPositiveX) - { - aPos.X -= aSize.Width; - } - if (!bFlipH && bPositiveY) - { - aPos.Y -= aSize.Height; - } - } // The RotateAngle property's value is independent from any flipping, and that's exactly what we need here. uno::Reference<beans::XPropertySet> xPropertySet(rXShape, uno::UNO_QUERY); @@ -1406,11 +1394,8 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa if(bFlipH != bFlipV) nRotation = nRotation * -1 + 36000; - if(bSuppressFlipping) - bFlipH = bFlipV = false; - WriteTransformation(tools::Rectangle(Point(aPos.X, aPos.Y), Size(aSize.Width, aSize.Height)), nXmlNamespace, - bFlipH, bFlipV, OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation), IsGroupShape( rXShape )); + bFlipHWrite, bFlipVWrite, OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation), IsGroupShape( rXShape )); } void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool bIsField, sal_Int32 nElement, bool bCheckDirect, @@ -2082,21 +2067,10 @@ void DrawingML::WriteParagraphNumbering( const Reference< XPropertySet >& rXProp } } -bool DrawingML::IsInGroupShape () const -{ - bool bRet = m_xParent.is(); - if ( bRet ) - { - uno::Reference<lang::XServiceInfo> xServiceInfo(m_xParent, uno::UNO_QUERY_THROW); - bRet = xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"); - } - return bRet; -} - -bool DrawingML::IsGroupShape( const Reference< XShape >& rXShape, bool bOrChildShape ) const +bool DrawingML::IsGroupShape( const Reference< XShape >& rXShape ) const { - bool bRet = bOrChildShape && IsInGroupShape(); - if ( !bRet && rXShape.is() ) + bool bRet = false; + if ( rXShape.is() ) { uno::Reference<lang::XServiceInfo> xServiceInfo(rXShape, uno::UNO_QUERY_THROW); bRet = xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"); diff --git a/sd/qa/unit/data/pptx/tdf91999_rotateShape.pptx b/sd/qa/unit/data/pptx/tdf91999_rotateShape.pptx new file mode 100644 index 000000000000..7559597b74e8 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf91999_rotateShape.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 4cf1e8e3e2c2..c1f15d7a5a05 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -121,6 +121,7 @@ public: void testGroupRotation(); void testTdf104788(); void testSmartartRotation2(); + void testTdf91999_rotateShape(); void testTdf114845_rotateShape(); void testGroupsPosition(); void testGroupsRotatedPosition(); @@ -188,6 +189,7 @@ public: CPPUNIT_TEST(testGroupRotation); CPPUNIT_TEST(testTdf104788); CPPUNIT_TEST(testSmartartRotation2); + CPPUNIT_TEST(testTdf91999_rotateShape); CPPUNIT_TEST(testTdf114845_rotateShape); CPPUNIT_TEST(testGroupsPosition); CPPUNIT_TEST(testGroupsRotatedPosition); @@ -1294,6 +1296,20 @@ void SdOOXMLExportTest2::testSmartartRotation2() assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:grpSp/p:sp[3]/p:txBody/a:bodyPr", "rot", "10800000"); } +void SdOOXMLExportTest2::testTdf91999_rotateShape() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf91999_rotateShape.pptx"), PPTX); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + xDocShRef->DoClose(); + + xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml"); + assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:nvSpPr/p:cNvPr", "name", "CustomShape 2"); + assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm", "rot", "10800000"); + assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm/a:off", "x", "2960640"); + assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:sp[2]/p:spPr/a:xfrm/a:off", "y", "1449000"); +} + void SdOOXMLExportTest2::testTdf114845_rotateShape() { ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf114845_rotateShape.pptx"), PPTX); diff --git a/sw/qa/extras/ooxmlexport/data/dml-textshapeB.docx b/sw/qa/extras/ooxmlexport/data/dml-textshapeB.docx new file mode 100644 index 000000000000..ab790a896fd4 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/dml-textshapeB.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index a46448d4fd9e..dc82f0578093 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -114,6 +114,23 @@ DECLARE_OOXMLEXPORT_TEST(testDmlTextshape, "dml-textshape.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(-4727), xShape->getPosition().Y); } +DECLARE_OOXMLEXPORT_TEST(testDmlTextshapeB, "dml-textshapeB.docx") +{ + uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY); + xmlDocPtr pXmlDocument = parseExport("word/document.xml"); + if (!pXmlDocument) + return; + + uno::Reference<drawing::XShape> xShape(xGroup->getByIndex(3), uno::UNO_QUERY); + // Connector was incorrectly shifted towards the top left corner, X was 192, Y was -5743. + CPPUNIT_ASSERT_EQUAL(sal_Int32(3778), xShape->getPosition().X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-5064), xShape->getPosition().Y); + + xShape.set(xGroup->getByIndex(5), uno::UNO_QUERY); + // This was incorrectly shifted towards the top of the page, Y was -5011. + CPPUNIT_ASSERT_EQUAL(sal_Int32(-4713), xShape->getPosition().Y); +} + DECLARE_OOXMLEXPORT_TEST(testDMLSolidfillAlpha, "dml-solidfill-alpha.docx") { // Problem was that the transparency was not exported (a:alpha). diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index 8bb8f3ecf4b5..f5a8b95e1737 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -1040,7 +1040,8 @@ DECLARE_OOXMLEXPORT_TEST(testFdo66474, "fdo66474.docx") DECLARE_OOXMLEXPORT_TEST(testGroupshapeRotation, "groupshape-rotation.docx") { // Rotation on groupshapes wasn't handled at all by the VML importer. - CPPUNIT_ASSERT_EQUAL(sal_Int32(315 * 100), getProperty<sal_Int32>(getShape(1), "RotateAngle")); + // Note: the shapes are still shifting on the page, so the rotation drifts after multiple round-trips. + CPPUNIT_ASSERT_DOUBLES_EQUAL(31500.0, getProperty<double>(getShape(1), "RotateAngle"), 100); } DECLARE_OOXMLEXPORT_TEST(testBnc780044Spacing, "bnc780044_spacing.docx") commit 70cb1aa0e8cd4fe67792ae5f7e95d3396594b196 Author: Justin Luth <justin_l...@sil.org> AuthorDate: Wed Jul 25 16:33:47 2018 +0300 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Sep 13 11:18:07 2018 +0200 tdf#117988 writerfilter: IgnoreTabsAndBlanksForLineCalculation Introduced in LO 4.0 in a mass copy of compat settings in commit 355d25eac764713f4d52eac801ade6e2ff1deab0 Reviewed-on: https://gerrit.libreoffice.org/57991 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> (cherry picked from commit 49ddaad2f3ba4e17e1e41e94824fb94468d2b680) Change-Id: I0d95941ff2815a43e571be1a6a0dbab1d12185d6 diff --git a/sw/qa/extras/ooxmlexport/data/tdf117988.docx b/sw/qa/extras/ooxmlexport/data/tdf117988.docx new file mode 100644 index 000000000000..86f1672fa023 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf117988.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index ca518d554a29..e2cf32f2e7dc 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -158,6 +158,11 @@ DECLARE_OOXMLEXPORT_TEST(testTdf116410, "tdf116410.docx") CPPUNIT_ASSERT_EQUAL(1, getPages()); } +DECLARE_OOXMLEXPORT_TEST(testTdf117988, "tdf117988.docx") +{ + CPPUNIT_ASSERT_EQUAL(1, getPages()); +} + DECLARE_OOXMLEXPORT_TEST(testTdf113183, "tdf113183.docx") { // This was 2096, the horizontal positioning of the star shape affected the diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx index 2953c6cc3f17..87f5b4bc6fc9 100644 --- a/writerfilter/source/filter/WriterFilter.cxx +++ b/writerfilter/source/filter/WriterFilter.cxx @@ -286,7 +286,7 @@ void WriterFilter::setTargetDocument(const uno::Reference< lang::XComponent >& x xSettings->setPropertyValue("ConsiderTextWrapOnObjPos", uno::makeAny(true)); xSettings->setPropertyValue("UseFormerTextWrapping", uno::makeAny(false)); xSettings->setPropertyValue("TableRowKeep", uno::makeAny(true)); - xSettings->setPropertyValue("IgnoreTabsAndBlanksForLineCalculation", uno::makeAny(true)); + xSettings->setPropertyValue("IgnoreTabsAndBlanksForLineCalculation", uno::makeAny(false)); xSettings->setPropertyValue("InvertBorderSpacing", uno::makeAny(true)); xSettings->setPropertyValue("CollapseEmptyCellPara", uno::makeAny(true)); xSettings->setPropertyValue("TabOverflow", uno::makeAny(true)); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits