[Libreoffice-commits] core.git: include/oox oox/source sd/qa
Paul Trojahn
paul.trojahn at gmail.com
Fri Dec 8 02:40:19 UTC 2017
include/oox/export/drawingml.hxx | 2 +-
oox/source/export/drawingml.cxx | 12 +++++++-----
oox/source/export/shapes.cxx | 7 ++++++-
sd/qa/unit/data/odp/tdf68759.odp |binary
sd/qa/unit/export-tests-ooxml2.cxx | 21 +++++++++++++++++++++
5 files changed, 35 insertions(+), 7 deletions(-)
New commits:
commit baa205c001540b5dbc795cd876e661549d432ac1
Author: Paul Trojahn <paul.trojahn at gmail.com>
Date: Thu Nov 30 15:17:04 2017 +0100
tdf#68759 PPTX: Export IsMirrored
Change-Id: I6bab00f79f1cb122344e4bb9fd62eb4c48a1838b
Reviewed-on: https://gerrit.libreoffice.org/45808
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 2e0625c43ed9..276e18d0bcc2 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);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index d243a4f99d13..1ec05fa2a2e9 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1286,7 +1286,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");
@@ -1294,6 +1294,11 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa
awt::Point aPos = rXShape->getPosition();
awt::Size aSize = rXShape->getSize();
+ bool bFlipHWrite = bFlipH && !bSuppressFlipping;
+ bool bFlipVWrite = bFlipV && !bSuppressFlipping;
+ bFlipH = bFlipH && !bFlippedBeforeRotation;
+ bFlipV = bFlipV && !bFlippedBeforeRotation;
+
bool bPositiveY = true;
bool bPositiveX = true;
@@ -1345,14 +1350,11 @@ void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, sa
if(bFlipH != bFlipV)
nRotation = nRotation * -1 + 36000;
- if(bSuppressFlipping)
- bFlipH = bFlipV = false;
-
uno::Reference<lang::XServiceInfo> xServiceInfo(rXShape, uno::UNO_QUERY_THROW);
bool bIsGroupShape = (xServiceInfo.is() && xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"));
WriteTransformation(tools::Rectangle(Point(aPos.X, aPos.Y), Size(aSize.Width, aSize.Height)), nXmlNamespace,
- bFlipH, bFlipV, OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation), bIsGroupShape);
+ bFlipHWrite, bFlipVWrite, OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation), bIsGroupShape);
}
void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool bIsField, sal_Int32 nElement, bool bCheckDirect,
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index a80809c663e2..b2a07a2f4ca4 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1186,7 +1186,12 @@ void ShapeExport::WriteGraphicObjectShapePart( const Reference< XShape >& xShape
// visual shape properties
pFS->startElementNS( mnXmlNamespace, XML_spPr, FSEND );
- WriteShapeTransformation( xShape, XML_a );
+ bool bFlipH = false;
+ if( xShapeProps->getPropertySetInfo()->hasPropertyByName("IsMirrored") )
+ {
+ xShapeProps->getPropertyValue("IsMirrored") >>= bFlipH;
+ }
+ WriteShapeTransformation( xShape, XML_a, bFlipH, false, false, false, true );
WritePresetShape( "rect" );
// graphic object can come with the frame (bnc#654525)
WriteOutline( xShapeProps );
diff --git a/sd/qa/unit/data/odp/tdf68759.odp b/sd/qa/unit/data/odp/tdf68759.odp
new file mode 100644
index 000000000000..db3e51e97637
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf68759.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index dc314491de03..2a380b3fc7ab 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -123,6 +123,7 @@ public:
void testGroupsPosition();
void testGroupsRotatedPosition();
void testAccentColor();
+ void testTdf68759();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -171,6 +172,7 @@ public:
CPPUNIT_TEST(testGroupsPosition);
CPPUNIT_TEST(testGroupsRotatedPosition);
CPPUNIT_TEST(testAccentColor);
+ CPPUNIT_TEST(testTdf68759);
CPPUNIT_TEST_SUITE_END();
@@ -1300,6 +1302,25 @@ void SdOOXMLExportTest2::testAccentColor()
assertXPath(pXmlDocTheme2, "/a:theme/a:themeElements/a:clrScheme/a:accent6/a:srgbClr", "val", "deb340");
}
+void SdOOXMLExportTest2::testTdf68759()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf68759.odp"), ODP);
+ 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:pic[1]/p:spPr/a:xfrm/a:off", "x", "1687320");
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[1]/p:spPr/a:xfrm/a:off", "y", "1615320");
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm", "flipH", "1");
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm", "rot", "9600000");
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm/a:off", "x", "3847320");
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[2]/p:spPr/a:xfrm/a:off", "y", "1614600");
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[3]/p:spPr/a:xfrm", "flipH", "1");
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[3]/p:spPr/a:xfrm/a:off", "x", "5934960");
+ assertXPath(pXmlDocContent, "/p:sld/p:cSld/p:spTree/p:pic[3]/p:spPr/a:xfrm/a:off", "y", "1615320");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list