[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - include/oox oox/source sd/qa sd/source

2018-02-12 Thread Szymon Kłos
 include/oox/ppt/slidetransitioncontext.hxx |1 +
 oox/source/ppt/slidetransitioncontext.cxx  |9 -
 sd/qa/unit/data/pptx/tdf115394-zero.pptx   |binary
 sd/qa/unit/export-tests-ooxml2.cxx |   16 
 sd/source/filter/eppt/pptx-epptooxml.cxx   |   10 +-
 5 files changed, 30 insertions(+), 6 deletions(-)

New commits:
commit d55a5e99a6a6ca8f9cc39f49ee398906e962f213
Author: Szymon Kłos 
Date:   Thu Feb 8 23:21:38 2018 +0100

tdf#115394 correct transition in case of 0s

Change-Id: I23d18acef0bd5db4a4ad6fc67d409e7ed5c93949
Reviewed-on: https://gerrit.libreoffice.org/49462
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/49524
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/include/oox/ppt/slidetransitioncontext.hxx 
b/include/oox/ppt/slidetransitioncontext.hxx
index 4edaa3fcae9f..54b8d89ffb9b 100644
--- a/include/oox/ppt/slidetransitioncontext.hxx
+++ b/include/oox/ppt/slidetransitioncontext.hxx
@@ -47,6 +47,7 @@ namespace oox { namespace ppt {
 private:
 PropertyMap&maSlideProperties;
 boolmbHasTransition;
+boolmbHasTransitionDuration;
 SlideTransition maTransition;
 };
 
diff --git a/oox/source/ppt/slidetransitioncontext.cxx 
b/oox/source/ppt/slidetransitioncontext.cxx
index bed6060d4d4a..bc2a56845b54 100644
--- a/oox/source/ppt/slidetransitioncontext.cxx
+++ b/oox/source/ppt/slidetransitioncontext.cxx
@@ -47,6 +47,7 @@ SlideTransitionContext::SlideTransitionContext( 
FragmentHandler2& rParent, const
 : FragmentHandler2( rParent )
 , maSlideProperties( aProperties )
 , mbHasTransition( false )
+, mbHasTransitionDuration( false )
 {
 // ST_TransitionSpeed
 maTransition.setOoxTransitionSpeed( rAttribs.getToken( XML_spd, XML_fast ) 
);
@@ -54,7 +55,13 @@ SlideTransitionContext::SlideTransitionContext( 
FragmentHandler2& rParent, const
 // p14:dur
 sal_Int32 nDurationInMs = rAttribs.getInteger( P14_TOKEN( dur ), -1 );
 if( nDurationInMs > -1 )
+{
+// In MSO 0 is visible as 0.01s
+if( nDurationInMs == 0.0 )
+nDurationInMs = 10;
 maTransition.setOoxTransitionSpeed( nDurationInMs / 1000.0 );
+mbHasTransitionDuration = true;
+}
 
 // TODO
 rAttribs.getBool( XML_advClick, true );
@@ -182,7 +189,7 @@ void SlideTransitionContext::onEndElement()
 {
 if( isCurrentElement(PPT_TOKEN( transition )) )
 {
-if( mbHasTransition )
+if( mbHasTransition || mbHasTransitionDuration )
 {
 maTransition.setSlideProperties( maSlideProperties );
 mbHasTransition = false;
diff --git a/sd/qa/unit/data/pptx/tdf115394-zero.pptx 
b/sd/qa/unit/data/pptx/tdf115394-zero.pptx
new file mode 100644
index ..e8fb0cfa240c
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf115394-zero.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 59d1d0e7f424..80518487b96a 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -126,6 +126,7 @@ public:
 void testAccentColor();
 void testTdf114848();
 void testTdf115394();
+void testTdf115394Zero();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -173,6 +174,7 @@ public:
 CPPUNIT_TEST(testAccentColor);
 CPPUNIT_TEST(testTdf114848);
 CPPUNIT_TEST(testTdf115394);
+CPPUNIT_TEST(testTdf115394Zero);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -1166,6 +1168,20 @@ void SdOOXMLExportTest2::testTdf115394()
 xDocShRef->DoClose();
 }
 
+void SdOOXMLExportTest2::testTdf115394Zero()
+{
+sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf115394-zero.pptx"),
 PPTX);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+double fTransitionDuration;
+
+SdPage* pPage = xDocShRef->GetDoc()->GetSdPage(0, PageKind::Standard);
+fTransitionDuration = pPage->getTransitionDuration();
+CPPUNIT_ASSERT_EQUAL(0.01, fTransitionDuration);
+
+xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 07c290895970..9d6f3066b7e9 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -634,10 +634,6 @@ void PowerPointExport::WriteTransition( const FSHelperPtr& 
pFS )
 }
 }
 
-// check if we resolved what transition to export
-if (!nPPTTransitionType && !bOOXmlSpecificTransition)
-return;
-
 AnimationSpeed animationSpeed = AnimationSpeed_MEDIUM;
 const 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - include/oox oox/source sd/qa sd/source

2017-11-06 Thread Szymon Kłos
 include/oox/drawingml/clrscheme.hxx |   33 +++
 include/oox/export/utils.hxx|2 
 include/oox/ppt/presentationfragmenthandler.hxx |1 
 oox/source/export/drawingml.cxx |2 
 oox/source/ppt/presentationfragmenthandler.cxx  |   76 
 sd/qa/unit/data/pptx/accent-color.pptx  |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   19 ++
 sd/source/filter/eppt/epptooxml.hxx |4 
 sd/source/filter/eppt/pptx-epptooxml.cxx|  210 ++--
 9 files changed, 294 insertions(+), 53 deletions(-)

New commits:
commit c99f02e17f436a5887578f0da55e4daae78a2ca6
Author: Szymon Kłos 
Date:   Tue Oct 17 22:14:38 2017 +0200

PPTX export: remember color schemes in theme

Remember color scheme from loaded pptx file
or use default values.

Change-Id: Icb69c51603afc5f332c20c75e4ed5f659f4b5614
Reviewed-on: https://gerrit.libreoffice.org/43470
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/44321
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/include/oox/drawingml/clrscheme.hxx 
b/include/oox/drawingml/clrscheme.hxx
index ccb1517e44eb..ccf918d7ba74 100644
--- a/include/oox/drawingml/clrscheme.hxx
+++ b/include/oox/drawingml/clrscheme.hxx
@@ -28,9 +28,42 @@
 
 #include 
 #include 
+#include 
 
 namespace oox { namespace drawingml {
 
+enum PredefinedClrSchemeId {
+//dk1,
+//lt1,
+dk2 = 0,
+lt2,
+accent1,
+accent2,
+accent3,
+accent4,
+accent5,
+accent6,
+hlink,
+folHlink,
+Count
+};
+
+static std::map PredefinedClrNames =
+{
+//{ dk1,  "dk1" },
+//{ lt1, "lt1" },
+{ dk2, "dk2" },
+{ lt2, "lt2" },
+{ accent1, "accent1" },
+{ accent2, "accent2" },
+{ accent3, "accent3" },
+{ accent4, "accent4" },
+{ accent5, "accent5" },
+{ accent6, "accent6" },
+{ hlink, "hlink" },
+{ folHlink, "folHlink" }
+};
+
 class ClrMap
 {
 std::map < sal_Int32, sal_Int32 > maClrMap;
diff --git a/include/oox/export/utils.hxx b/include/oox/export/utils.hxx
index c1187b634419..b0a8fe5cafb9 100644
--- a/include/oox/export/utils.hxx
+++ b/include/oox/export/utils.hxx
@@ -30,7 +30,7 @@
 inline OString I32SHEX_(sal_Int32 x)
 {
 OString aStr = OString::number(x, 16);
-if (aStr.getLength() % 2 != 0)
+while (aStr.getLength() < 6)
 aStr = OString("0") + aStr;
 return aStr.getStr();
 }
diff --git a/include/oox/ppt/presentationfragmenthandler.hxx 
b/include/oox/ppt/presentationfragmenthandler.hxx
index aeda119cd2f1..637e70643be7 100644
--- a/include/oox/ppt/presentationfragmenthandler.hxx
+++ b/include/oox/ppt/presentationfragmenthandler.hxx
@@ -53,6 +53,7 @@ protected:
 private:
 
 void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes);
+void saveThemeToGrabBag(oox::drawingml::ThemePtr pThemePtr, const 
OUString& sTheme);
 
 std::vector< OUString > maSlideMasterVector;
 std::vector< OUString > maSlidesVector;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 7a142d9ed8bc..686c8b3c8549 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2904,7 +2904,7 @@ void DrawingML::WriteStyleProperties( sal_Int32 nTokenId, 
const Sequence< Proper
 aProperties[i].Value >>= aTransformations;
 }
 mpFS->startElementNS( XML_a, nTokenId, XML_idx, I32S( nIdx ), FSEND );
-WriteColor( sSchemeClr, aTransformations );
+WriteColor(sSchemeClr, aTransformations);
 mpFS->endElementNS( XML_a, nTokenId );
 }
 else
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx 
b/oox/source/ppt/presentationfragmenthandler.cxx
index 41a283a445d1..6b157877db9a 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -64,6 +64,22 @@ using namespace ::com::sun::star::xml::sax;
 
 namespace oox { namespace ppt {
 
+static std::map PredefinedClrTokens =
+{
+//{ dk1, XML_dk1 },
+//{ lt1, XML_lt1 },
+{ dk2, XML_dk2 },
+{ lt2, XML_lt2 },
+{ accent1, XML_accent1 },
+{ accent2, XML_accent2 },
+{ accent3, XML_accent3 },
+{ accent4, XML_accent4 },
+{ accent5, XML_accent5 },
+{ accent6, XML_accent6 },
+{ hlink, XML_hlink },
+{ folHlink, XML_folHlink }
+};
+
 PresentationFragmentHandler::PresentationFragmentHandler( XmlFilterBase& 
rFilter, const OUString& rFragmentPath ) throw()
 : FragmentHandler2( rFilter, rFragmentPath )
 , mpTextListStyle( new TextListStyle )
@@ -143,6 +159,65 @@ void ResolveTextFields( XmlFilterBase& rFilter )
 }
 }
 
+void 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - include/oox oox/source sd/qa

2017-11-01 Thread Szymon Kłos
 include/oox/drawingml/drawingmltypes.hxx |   15 +++
 oox/source/export/chartexport.cxx|   22 +-
 oox/source/export/drawingml.cxx  |4 +++-
 sd/qa/unit/data/pptx/smartart-rotation2.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx   |   13 +
 5 files changed, 32 insertions(+), 22 deletions(-)

New commits:
commit ea524432686ca8779c7aba0144d8a72e1b03fa83
Author: Szymon Kłos 
Date:   Fri Oct 6 16:04:25 2017 +0200

SmartArt: export text rotation in the PPTX

Change-Id: I74bfc172fe7434d14de468ecfd3412636e53780c
Reviewed-on: https://gerrit.libreoffice.org/43202
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 
(cherry picked from commit 3cbb6e73ecbff5d83be817c0dab680c5d925c6fa)
Reviewed-on: https://gerrit.libreoffice.org/43984
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/include/oox/drawingml/drawingmltypes.hxx 
b/include/oox/drawingml/drawingmltypes.hxx
index a845f728541f..c6e4437e129a 100644
--- a/include/oox/drawingml/drawingmltypes.hxx
+++ b/include/oox/drawingml/drawingmltypes.hxx
@@ -150,6 +150,21 @@ struct IndexRange {
 /** retrieve the content of CT_IndexRange */
 IndexRange GetIndexRange( const css::uno::Reference< 
css::xml::sax::XFastAttributeList >& xAttributes );
 
+/**
+* nRotation is a 100th of a degree and the return value is
+* in a 60,000th of a degree
+*
+* Also rotation is in opposite directions so multiply with -1
+*/
+inline OString calcRotationValue(sal_Int32 nRotation)
+{
+if (nRotation > 18000) // 180 degree
+{
+nRotation -= 36000;
+}
+nRotation *= -600;
+return OString::number(nRotation);
+}
 
 const sal_Int32 EMU_PER_HMM = 360;  /// 360 EMUs per 1/100 mm.
 const sal_Int32 EMU_PER_PT = 12700;
diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index b1e9368d7c7a..18b9a02bcd0d 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1030,26 +1030,6 @@ void ChartExport::exportLegend( const Reference< 
css::chart::XChartDocument >& x
 pFS->endElement( FSNS( XML_c, XML_legend ) );
 }
 
-namespace {
-
-/**
- * nRotation is a 100th of a degree and the return value is
- * in a 60,000th of a degree
- *
- * Also rotation is in opposite directions so multiply with -1
- */
-OString calcRotationValue(sal_Int32 nRotation)
-{
-if (nRotation > 18000) // 180 degree
-{
-nRotation -= 36000;
-}
-nRotation *= -600;
-return OString::number(nRotation);
-}
-
-}
-
 void ChartExport::exportTitle( const Reference< XShape >& xShape )
 {
 OUString sText;
@@ -1082,7 +1062,7 @@ void ChartExport::exportTitle( const Reference< XShape >& 
xShape )
 
 pFS->singleElement( FSNS( XML_a, XML_bodyPr ),
 XML_vert, sWritingMode,
-XML_rot, calcRotationValue(nRotation).getStr(),
+XML_rot, oox::drawingml::calcRotationValue(nRotation).getStr(),
 FSEND );
 // TODO: lstStyle
 pFS->singleElement( FSNS( XML_a, XML_lstStyle ),
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 444f26b0405e..7a142d9ed8bc 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2193,6 +2193,8 @@ void DrawingML::WriteText( const Reference< XInterface >& 
rXIface, const OUStrin
 if( !xXText.is() )
 return;
 
+sal_Int32 nTextRotateAngle = 0;
+
 #define DEFLRINS 254
 #define DEFTBINS 127
 sal_Int32 nLeft, nRight, nTop, nBottom;
@@ -2232,7 +2234,6 @@ void DrawingML::WriteText( const Reference< XInterface >& 
rXIface, const OUStrin
 {
 for ( sal_Int32 i = 0, nElems = aProps.getLength(); i < nElems; 
++i )
 {
-sal_Int32 nTextRotateAngle = 0;
 if ( aProps[ i ].Name == "TextPreRotateAngle" && ( aProps[ i 
].Value >>= nTextRotateAngle ) )
 {
 if ( nTextRotateAngle == -90 )
@@ -2289,6 +2290,7 @@ void DrawingML::WriteText( const Reference< XInterface >& 
rXIface, const OUStrin
XML_anchor, sVerticalAlignment,
XML_anchorCtr, bHorizontalCenter ? "1" : 
nullptr,
XML_vert, sWritingMode,
+   XML_rot, (nTextRotateAngle != 0) ? 
oox::drawingml::calcRotationValue( nTextRotateAngle * 100 ).getStr() : nullptr,
FSEND );
 if( !presetWarp.isEmpty())
 {
diff --git a/sd/qa/unit/data/pptx/smartart-rotation2.pptx 
b/sd/qa/unit/data/pptx/smartart-rotation2.pptx
new file mode 100755
index ..e1c4493a7407
Binary files /dev/null and b/sd/qa/unit/data/pptx/smartart-rotation2.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - include/oox oox/source sd/qa

2017-09-26 Thread Szymon Kłos
 include/oox/drawingml/fillproperties.hxx|2 -
 oox/source/drawingml/fillproperties.cxx |   17 ++
 oox/source/drawingml/fillpropertiesgroupcontext.cxx |3 +-
 oox/source/drawingml/shape.cxx  |2 -
 oox/source/vml/vmlformatting.cxx|   23 ++--
 sd/qa/unit/data/pptx/tdf112088.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   14 
 7 files changed, 47 insertions(+), 14 deletions(-)

New commits:
commit a5853d13d3cab93e666301e90da786d55d02f1ee
Author: Szymon Kłos 
Date:   Tue Sep 12 13:26:35 2017 +0200

tdf#112088 gradient stop map -> multimap

When two gradientstops were set to position 50%
only one was stored and the exported file was
detected as broken by MSO.

Change-Id: I5fd1acde6051f734a5f3e4cff9bde01b675e1984
Reviewed-on: https://gerrit.libreoffice.org/42210
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/42473
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 

diff --git a/include/oox/drawingml/fillproperties.hxx 
b/include/oox/drawingml/fillproperties.hxx
index bed67d6fcc46..ef863c2a348e 100644
--- a/include/oox/drawingml/fillproperties.hxx
+++ b/include/oox/drawingml/fillproperties.hxx
@@ -48,7 +48,7 @@ class ShapePropertyMap;
 
 struct GradientFillProperties
 {
-typedef ::std::map< double, Color > GradientStopMap;
+typedef ::std::multimap< double, Color > GradientStopMap;
 
 GradientStopMap maGradientStops;/// Gradient stops 
(colors/transparence).
 OptValue< css::geometry::IntegerRectangle2D > moFillToRect;
diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index ed01746b4c64..dc93623b9f6b 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -385,18 +385,20 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 
 // Add a fake gradient stop at 0% and 100% if 
necessary, so that the gradient always starts
 // at 0% and ends at 100%, to make following logic 
clearer (?).
-if( aGradientStops.find(0.0) == aGradientStops.end() )
+auto a0 = aGradientStops.find( 0.0 );
+if( a0 == aGradientStops.end() )
 {
 // temp variable required
 Color aFirstColor(aGradientStops.begin()->second);
-aGradientStops[0.0] = aFirstColor;
+aGradientStops.emplace( 0.0, aFirstColor );
 }
 
-if( aGradientStops.find(1.0) == aGradientStops.end() )
+auto a1 = aGradientStops.find( 1.0 );
+if( a1 == aGradientStops.end() )
 {
 // ditto
 Color aLastColor(aGradientStops.rbegin()->second);
-aGradientStops[1.0] = aLastColor;
+aGradientStops.emplace( 1.0, aLastColor );
 }
 
 // Check if the gradient is symmetric, which we will 
emulate with an "axial" gradient.
@@ -427,7 +429,12 @@ void FillProperties::pushToPropMap( ShapePropertyMap& 
rPropMap,
 if( aItA->first != aItZ->first )
 {
 Color aMiddleColor = aItZ->second;
-aGradientStops[0.5] = aMiddleColor;
+auto a05 = aGradientStops.find( 0.5 );
+
+if( a05 != aGradientStops.end() )
+a05->second = aMiddleColor;
+else
+aGradientStops.emplace( 0.5, 
aMiddleColor );
 }
 // Drop the rest of the stops
 while( aGradientStops.rbegin()->first > 0.5 )
diff --git a/oox/source/drawingml/fillpropertiesgroupcontext.cxx 
b/oox/source/drawingml/fillpropertiesgroupcontext.cxx
index 22d68faabeb9..7214af4f7016 100644
--- a/oox/source/drawingml/fillpropertiesgroupcontext.cxx
+++ b/oox/source/drawingml/fillpropertiesgroupcontext.cxx
@@ -63,7 +63,8 @@ ContextHandlerRef GradientFillContext::onCreateContext(
 if( rAttribs.hasAttribute( XML_pos ) )
 {
 double fPosition = getLimitedValue< double >( 
rAttribs.getDouble( XML_pos, 0.0 ) / 10.0, 0.0, 1.0 );
-return new ColorContext( *this, 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - include/oox oox/source sd/qa sd/source

2017-09-07 Thread Jan Holesovsky
 include/oox/export/drawingml.hxx |4 +-
 oox/source/export/drawingml.cxx  |   18 +++---
 oox/source/export/shapes.cxx |   55 +--
 sd/qa/unit/data/pptx/tdf111884.pptx  |binary
 sd/qa/unit/export-tests-ooxml1.cxx   |   43 +++-
 sd/source/filter/eppt/pptx-epptooxml.cxx |9 -
 6 files changed, 90 insertions(+), 39 deletions(-)

New commits:
commit 7b65e7eea560da718c3cbc76a049a8d60b2809e9
Author: Jan Holesovsky 
Date:   Thu Aug 31 18:32:58 2017 +0200

tdf#111884: Implement export of group shapes in pptx.

Contains also:

tdf#111884: Unit test.
related tdf#111884: GroupShapes are now handled in oox.

Change-Id: If12984c0670db6396cbfd0dcb8ae1f5a9b591705
Reviewed-on: https://gerrit.libreoffice.org/41766
Tested-by: Jenkins 
Reviewed-by: Jan Holesovsky 
Reviewed-on: https://gerrit.libreoffice.org/41997
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 97d8dff58de6..d9216d2c6bf4 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -190,8 +190,8 @@ public:
 
 void WriteShapeTransformation( const css::uno::Reference< 
css::drawing::XShape >& rXShape,
   sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = 
false, bool bSuppressRotation = false );
-void WriteTransformation( const Rectangle& rRectangle,
-  sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = 
false, sal_Int32 nRotation = 0 );
+void WriteTransformation(const Rectangle& rRectangle,
+  sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = 
false, sal_Int32 nRotation = 0, bool bIsGroupShape = false);
 
 void WriteText( const css::uno::Reference< css::uno::XInterface >& 
rXIface, const OUString& presetWarp, bool bBodyPr = true, bool bText = true, 
sal_Int32 nXmlNamespace = 0);
 void WriteParagraph( const css::uno::Reference< css::text::XTextContent >& 
rParagraph,
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index c8d148aeb1c2..bb90a48eb96d 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1142,8 +1142,8 @@ void DrawingML::WriteStretch( const css::uno::Reference< 
css::beans::XPropertySe
 mpFS->endElementNS( XML_a, XML_stretch );
 }
 
-void DrawingML::WriteTransformation( const Rectangle& rRect,
-sal_Int32 nXmlNamespace, bool bFlipH, bool bFlipV, sal_Int32 nRotation 
)
+void DrawingML::WriteTransformation(const Rectangle& rRect,
+sal_Int32 nXmlNamespace, bool bFlipH, bool bFlipV, sal_Int32 
nRotation, bool bIsGroupShape)
 {
 mpFS->startElementNS( nXmlNamespace, XML_xfrm,
   XML_flipH, bFlipH ? "1" : nullptr,
@@ -1162,6 +1162,12 @@ void DrawingML::WriteTransformation( const Rectangle& 
rRect,
 mpFS->singleElementNS( XML_a, XML_off, XML_x, IS( 
oox::drawingml::convertHmmToEmu( nLeft ) ), XML_y, IS( 
oox::drawingml::convertHmmToEmu( nTop ) ), FSEND );
 mpFS->singleElementNS( XML_a, XML_ext, XML_cx, IS( 
oox::drawingml::convertHmmToEmu( rRect.GetWidth() ) ), XML_cy, IS( 
oox::drawingml::convertHmmToEmu( rRect.GetHeight() ) ), FSEND );
 
+if (GetDocumentType() != DOCUMENT_DOCX && bIsGroupShape)
+{
+mpFS->singleElementNS(XML_a, XML_chOff, XML_x, 
IS(oox::drawingml::convertHmmToEmu(nLeft)), XML_y, 
IS(oox::drawingml::convertHmmToEmu(nTop)), FSEND);
+mpFS->singleElementNS(XML_a, XML_chExt, XML_cx, 
IS(oox::drawingml::convertHmmToEmu(rRect.GetWidth())), XML_cy, 
IS(oox::drawingml::convertHmmToEmu(rRect.GetHeight())), FSEND);
+}
+
 mpFS->endElementNS( nXmlNamespace, XML_xfrm );
 }
 
@@ -1173,7 +1179,7 @@ void DrawingML::WriteShapeTransformation( const 
Reference< XShape >& rXShape, sa
 awt::Point aPos = rXShape->getPosition();
 awt::Size aSize = rXShape->getSize();
 
-if (m_xParent.is())
+if (GetDocumentType() == DOCUMENT_DOCX && m_xParent.is())
 {
 awt::Point aParentPos = m_xParent->getPosition();
 aPos.X -= aParentPos.X;
@@ -1202,7 +1208,11 @@ void DrawingML::WriteShapeTransformation( const 
Reference< XShape >& rXShape, sa
 if (xPropertySetInfo->hasPropertyByName("RotateAngle"))
 xPropertySet->getPropertyValue("RotateAngle") >>= nRotation;
 }
-WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( 
aSize.Width, aSize.Height ) ), nXmlNamespace, bFlipH, bFlipV, 
OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation) );
+
+uno::Reference xServiceInfo(rXShape, 
uno::UNO_QUERY_THROW);
+bool bIsGroupShape = (xServiceInfo.is() && 
xServiceInfo->supportsService("com.sun.star.drawing.GroupShape"));
+
+WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - include/oox oox/source sd/qa

2017-09-06 Thread Jan Holesovsky
 dev/null   |binary
 include/oox/export/drawingml.hxx   |4 +-
 oox/source/export/drawingml.cxx|   10 --
 oox/source/export/shapes.cxx   |6 +--
 sd/qa/unit/export-tests-ooxml2.cxx |   59 -
 5 files changed, 5 insertions(+), 74 deletions(-)

New commits:
commit 3595090d6a64de78a40f7d45c0088359d9d49f7b
Author: Jan Holesovsky 
Date:   Wed Sep 6 16:33:31 2017 +0200

Revert "tdf#111798 Fix deformed export of flipped custom shapes to pptx"

This work is incomplete, rather I'll fix my conflicts.

This reverts commit 9c0387ef602d84d0079828f0ad4b53ada7ab1d8a.

Change-Id: I20961cee4a5c28fc5486ca385974e9fcd5827dbe
Reviewed-on: https://gerrit.libreoffice.org/42012
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index a3ad66897e80..97d8dff58de6 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -188,8 +188,8 @@ public:
 const OUString& rURL, bool bRelPathToMedia = false , const Graphic 
*pGraphic=nullptr );
 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 );
+void WriteShapeTransformation( const css::uno::Reference< 
css::drawing::XShape >& rXShape,
+  sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = 
false, bool bSuppressRotation = false );
 void WriteTransformation( const Rectangle& rRectangle,
   sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = 
false, sal_Int32 nRotation = 0 );
 
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index cbf3abb513d7..c8d148aeb1c2 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1165,7 +1165,7 @@ void DrawingML::WriteTransformation( const 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  )
 {
 SAL_INFO("oox.shape",  "write shape transformation");
 
@@ -1202,14 +1202,6 @@ void DrawingML::WriteShapeTransformation( const 
Reference< XShape >& rXShape, sa
 if (xPropertySetInfo->hasPropertyByName("RotateAngle"))
 xPropertySet->getPropertyValue("RotateAngle") >>= nRotation;
 }
-
-// OOXML flips shapes before rotating them.
-if(bFlipH != bFlipV)
-nRotation = nRotation * -1 + 36000;
-
-if(bSuppressFlipping)
-bFlipH = bFlipV = false;
-
 WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( 
aSize.Width, aSize.Height ) ), nXmlNamespace, bFlipH, bFlipV, 
OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation) );
 }
 
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index c4edcf07f1bb..1d4f4a20a217 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -827,7 +827,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 
 if (bHasHandles && bCustGeom && pShape)
 {
-WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV, false, true 
);// do not flip, polypolygon coordinates are flipped already
+WriteShapeTransformation( xShape, XML_a ); // do not flip, polypolygon 
coordinates are flipped already
 tools::PolyPolygon aPolyPolygon( pShape->GetLineGeometry(true) );
 sal_Int32 nRotation = 0;
 // The RotateAngle property's value is independent from any flipping, 
and that's exactly what we need here.
@@ -835,10 +835,8 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 uno::Reference xPropertySetInfo = 
xPropertySet->getPropertySetInfo();
 if (xPropertySetInfo->hasPropertyByName("RotateAngle"))
 xPropertySet->getPropertyValue("RotateAngle") >>= nRotation;
-// Remove rotation
-bool bInvertRotation = bFlipH != bFlipV;
 if (nRotation != 0)
-aPolyPolygon.Rotate(Point(0,0), 
static_cast(bInvertRotation ? nRotation/10 : 3600-nRotation/10));
+aPolyPolygon.Rotate(Point(0,0), 
static_cast(3600-nRotation/10));
 WritePolyPolygon( aPolyPolygon );
 }
 else if (bCustGeom)
diff --git a/sd/qa/unit/data/odp/tdf111798.odp 
b/sd/qa/unit/data/odp/tdf111798.odp
deleted file mode 100644
index 

[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - include/oox oox/source sd/qa

2017-09-06 Thread Paul Trojahn
 include/oox/export/drawingml.hxx   |4 +-
 oox/source/export/drawingml.cxx|   10 +-
 oox/source/export/shapes.cxx   |6 ++-
 sd/qa/unit/data/odp/tdf111798.odp  |binary
 sd/qa/unit/export-tests-ooxml2.cxx |   59 +
 5 files changed, 74 insertions(+), 5 deletions(-)

New commits:
commit 9c0387ef602d84d0079828f0ad4b53ada7ab1d8a
Author: Paul Trojahn 
Date:   Thu Aug 17 20:04:27 2017 +0200

tdf#111798 Fix deformed export of flipped custom shapes to pptx

Shapes were deformed because flipping wasn't considered when removing
the rotation. Also WriteShapeTransformation needs information about
flipping to convert the angle correctly.

Change-Id: I7d485e93c00e02b9ec6c73ad6ae2876e5bc6360a
Reviewed-on: https://gerrit.libreoffice.org/41462
Tested-by: Jenkins 
Reviewed-by: Tamás Zolnai 
Reviewed-on: https://gerrit.libreoffice.org/41996
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 97d8dff58de6..a3ad66897e80 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -188,8 +188,8 @@ public:
 const OUString& rURL, bool bRelPathToMedia = false , const Graphic 
*pGraphic=nullptr );
 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 );
+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 );
 void WriteTransformation( const Rectangle& rRectangle,
   sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = 
false, sal_Int32 nRotation = 0 );
 
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index c8d148aeb1c2..cbf3abb513d7 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1165,7 +1165,7 @@ void DrawingML::WriteTransformation( const Rectangle& 
rRect,
 mpFS->endElementNS( nXmlNamespace, XML_xfrm );
 }
 
-void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, 
sal_Int32 nXmlNamespace, bool bFlipH, bool bFlipV, bool bSuppressRotation  )
+void DrawingML::WriteShapeTransformation( const Reference< XShape >& rXShape, 
sal_Int32 nXmlNamespace, bool bFlipH, bool bFlipV, bool bSuppressRotation, bool 
bSuppressFlipping )
 {
 SAL_INFO("oox.shape",  "write shape transformation");
 
@@ -1202,6 +1202,14 @@ void DrawingML::WriteShapeTransformation( const 
Reference< XShape >& rXShape, sa
 if (xPropertySetInfo->hasPropertyByName("RotateAngle"))
 xPropertySet->getPropertyValue("RotateAngle") >>= nRotation;
 }
+
+// OOXML flips shapes before rotating them.
+if(bFlipH != bFlipV)
+nRotation = nRotation * -1 + 36000;
+
+if(bSuppressFlipping)
+bFlipH = bFlipV = false;
+
 WriteTransformation( Rectangle( Point( aPos.X, aPos.Y ), Size( 
aSize.Width, aSize.Height ) ), nXmlNamespace, bFlipH, bFlipV, 
OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation) );
 }
 
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 7bd85a8cd39f..066a1ecf1021 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -827,7 +827,7 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 
 if (bHasHandles && bCustGeom && pShape)
 {
-WriteShapeTransformation( xShape, XML_a ); // do not flip, polypolygon 
coordinates are flipped already
+WriteShapeTransformation( xShape, XML_a, bFlipH, bFlipV, false, true 
);// do not flip, polypolygon coordinates are flipped already
 tools::PolyPolygon aPolyPolygon( pShape->GetLineGeometry(true) );
 sal_Int32 nRotation = 0;
 // The RotateAngle property's value is independent from any flipping, 
and that's exactly what we need here.
@@ -835,8 +835,10 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 uno::Reference xPropertySetInfo = 
xPropertySet->getPropertySetInfo();
 if (xPropertySetInfo->hasPropertyByName("RotateAngle"))
 xPropertySet->getPropertyValue("RotateAngle") >>= nRotation;
+// Remove rotation
+bool bInvertRotation = bFlipH != bFlipV;
 if (nRotation != 0)
-aPolyPolygon.Rotate(Point(0,0), 
static_cast(3600-nRotation/10));
+aPolyPolygon.Rotate(Point(0,0), 
static_cast(bInvertRotation ? nRotation/10 :