[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - oox/source sd/qa

2017-10-31 Thread Szymon Kłos
 oox/source/export/drawingml.cxx |   17 +
 sd/qa/unit/data/pptx/group-rot.pptx |binary
 sd/qa/unit/data/pptx/group.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   30 ++
 4 files changed, 47 insertions(+)

New commits:
commit 8d366246234e5df784e7596e4c5b21891ae463c1
Author: Szymon Kłos 
Date:   Tue Oct 24 22:39:08 2017 +0200

PPTX export: correct position of rotated groups

* added testcase for tdf#113263

Change-Id: I7abf68d8fb4ffd8b883cfbf4d69916912add8182
Reviewed-on: https://gerrit.libreoffice.org/43794
Tested-by: Jenkins 
Reviewed-by: Szymon Kłos 
Reviewed-on: https://gerrit.libreoffice.org/44082
Reviewed-by: Andras Timar 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index e33dca9f5fe6..40e0c7abe7d2 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1174,11 +1174,17 @@ void DrawingML::WriteShapeTransformation( const 
Reference< XShape >& rXShape, sa
 awt::Point aPos = rXShape->getPosition();
 awt::Size aSize = rXShape->getSize();
 
+bool bPositiveY = true;
+bool bPositiveX = true;
+
 if (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 )
@@ -1196,6 +1202,17 @@ void DrawingML::WriteShapeTransformation( const 
Reference< XShape >& rXShape, sa
 
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)
+{
+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 xPropertySet(rXShape, 
uno::UNO_QUERY);
diff --git a/sd/qa/unit/data/pptx/group-rot.pptx 
b/sd/qa/unit/data/pptx/group-rot.pptx
new file mode 100755
index ..11b2d6367da0
Binary files /dev/null and b/sd/qa/unit/data/pptx/group-rot.pptx differ
diff --git a/sd/qa/unit/data/pptx/group.pptx b/sd/qa/unit/data/pptx/group.pptx
new file mode 100755
index ..8895fe2a2203
Binary files /dev/null and b/sd/qa/unit/data/pptx/group.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index edac049c2ba7..9bad50abbdab 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -109,6 +109,8 @@ public:
 void testTdf112552();
 void testTdf112647();
 void testSmartartRotation2();
+void testGroupsPosition();
+void testGroupsRotatedPosition();
 void testAccentColor();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -140,6 +142,8 @@ public:
 CPPUNIT_TEST(testTdf112552);
 CPPUNIT_TEST(testTdf112647);
 CPPUNIT_TEST(testSmartartRotation2);
+CPPUNIT_TEST(testGroupsPosition);
+CPPUNIT_TEST(testGroupsRotatedPosition);
 CPPUNIT_TEST(testAccentColor);
 
 CPPUNIT_TEST_SUITE_END();
@@ -842,6 +846,32 @@ void SdOOXMLExportTest2::testSmartartRotation2()
 assertXPath(pXmlDocContent, 
"/p:sld/p:cSld/p:spTree/p:sp[3]/p:txBody/a:bodyPr", "rot", "1080");
 }
 
+void SdOOXMLExportTest2::testGroupsPosition()
+{
+::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/group.pptx"), PPTX);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+assertXPath(pXmlDocContent, 
"/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:xfrm/a:off", "x", "4817880");
+assertXPath(pXmlDocContent, 
"/p:sld/p:cSld/p:spTree/p:sp[3]/p:spPr/a:xfrm/a:off", "y", "1810440");
+assertXPath(pXmlDocContent, 
"/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:xfrm/a:off", "x", "457200");
+assertXPath(pXmlDocContent, 
"/p:sld/p:cSld/p:spTree/p:sp[1]/p:spPr/a:xfrm/a:off", "y", "1798560");
+}
+
+void SdOOXMLExportTest2::testGroupsRotatedPosition()
+{
+::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/group-rot.pptx"), 
PPTX);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+assertXPath(pXmlDocContent, 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - oox/source

2017-05-04 Thread Thomas Beck
 oox/source/drawingml/fillproperties.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit da8e35e190b96a2cbd26f848bcd2acd139618ebb
Author: Thomas Beck 
Date:   Fri Apr 7 15:04:25 2017 +0200

tdf#106520 xlsx: black square where image should be

Reversed order of Transforms. Duotone will now be applied after a
ColorChange due to the ColorChange Transform not being able to
distinguish the colors properly anymore after Duotone had been applied.

This seems to better match what MSO is doing there.

Change-Id: I6ca66cc411c3e2a3d009325f0f1641c560949a54
Reviewed-on: https://gerrit.libreoffice.org/36263
Reviewed-by: Katarina Behrens 
Tested-by: Katarina Behrens 
(cherry picked from commit 184362002955d750c6597a444ae5240cf15932ac)
Reviewed-on: https://gerrit.libreoffice.org/37236
Tested-by: Jenkins 
Reviewed-by: Bartosz Kosiorek 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index ed8dbfcc5741..ed01746b4c64 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -77,7 +77,7 @@ Reference< XGraphic > lclCheckAndApplyDuotoneTransform( const 
BlipFillProperties
 return xGraphic;
 }
 
-Reference< XGraphic > lclCheckAndApplyChangeColorTransform( const 
BlipFillProperties , Reference< XGraphic > & xGraphic,
+Reference< XGraphic > lclCheckAndApplyChangeColorTransform( const 
BlipFillProperties , Reference< XGraphic >  const & xGraphic,
 const 
GraphicHelper& rGraphicHelper, const sal_Int32 nPhClr )
 {
 if( aBlipProps.maColorChangeFrom.isUsed() && 
aBlipProps.maColorChangeTo.isUsed() )
@@ -709,8 +709,8 @@ void GraphicProperties::pushToPropMap( PropertyMap& 
rPropMap, const GraphicHelpe
 if( maBlipProps.mxGraphic.is() )
 {
 // created transformed graphic
-Reference< XGraphic > xGraphic = lclCheckAndApplyDuotoneTransform( 
maBlipProps, maBlipProps.mxGraphic, rGraphicHelper, API_RGB_TRANSPARENT );
-xGraphic = lclCheckAndApplyChangeColorTransform( maBlipProps, 
xGraphic, rGraphicHelper, API_RGB_TRANSPARENT );
+Reference< XGraphic > xGraphic = 
lclCheckAndApplyChangeColorTransform(maBlipProps, maBlipProps.mxGraphic, 
rGraphicHelper, API_RGB_TRANSPARENT);
+xGraphic = lclCheckAndApplyDuotoneTransform(maBlipProps, xGraphic, 
rGraphicHelper, API_RGB_TRANSPARENT);
 
 if (eColorMode == ColorMode_STANDARD && nBrightness == 70 && nContrast 
== -70)
 // map MSO 'washout' to our Watermark colormode
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - oox/source

2017-02-24 Thread Tor Lillqvist
 oox/source/export/drawingml.cxx |   13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 8a4f99175b09eec634a9a31e9e2a55e9c97d02ca
Author: Tor Lillqvist 
Date:   Fri Feb 17 11:21:02 2017 +0200

tdf#90407: Export Text AutoFit to .pptx

Change-Id: I2120f13fff58d4736ab55071236e0c2f80ba2eb0
(cherry picked from commit 7277991e78c264025b4894ae07b40fb12cd57ce6)
Reviewed-on: https://gerrit.libreoffice.org/34371
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 1f3b593..bd4c0c1 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -51,6 +51,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -84,11 +85,11 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
+#include 
 #include 
 
-
 using namespace ::css;
 using namespace ::css::beans;
 using namespace ::css::drawing;
@@ -2164,6 +2165,14 @@ void DrawingML::WriteText( const Reference< XInterface 
>& rXIface, const OUStrin
 GET(bTextAutoGrowHeight, TextAutoGrowHeight);
 mpFS->singleElementNS(XML_a, (bTextAutoGrowHeight ? XML_spAutoFit 
: XML_noAutofit), FSEND);
 }
+if (GetDocumentType() == DOCUMENT_PPTX)
+{
+TextFitToSizeType eFit = TextFitToSizeType_NONE;
+if (GETA(TextFitToSize))
+mAny >>= eFit;
+if (eFit == TextFitToSizeType_AUTOFIT)
+mpFS->singleElementNS(XML_a, XML_normAutofit, FSEND);
+}
 mpFS->endElementNS((nXmlNamespace ? nXmlNamespace : XML_a), 
XML_bodyPr);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - oox/source

2017-02-16 Thread Tor Lillqvist
 oox/source/export/drawingml.cxx |   28 
 1 file changed, 28 insertions(+)

New commits:
commit 48acd5c5793edfec5d6b168fa39dcebc4500effe
Author: Tor Lillqvist 
Date:   Wed Feb 15 16:20:13 2017 +0200

tdf#106026: Export paragraph top and bottom margin to DrawingML

Change-Id: I8c60f86a1debe135c9172ff639aa5af93f03b99b
(cherry picked from commit d2b014edc0f466370023a35eb46548390ceb7fb2)
Reviewed-on: https://gerrit.libreoffice.org/34299
Tested-by: Jenkins 
Reviewed-by: Christian Lohmaier 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 73bf449..1f3b593 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1947,6 +1947,12 @@ void DrawingML::WriteParagraphProperties( const 
Reference< XTextContent >& rPara
 GET( nParaLeftMargin, ParaLeftMargin );
 GET( nParaFirstLineIndent,ParaFirstLineIndent);
 
+sal_Int32 nParaTopMargin = 0;
+sal_Int32 nParaBottomMargin = 0;
+
+GET( nParaTopMargin, ParaTopMargin );
+GET( nParaBottomMargin, ParaBottomMargin );
+
 sal_Int32 nLeftMargin =  getBulletMarginIndentation ( rXPropSet, 
nLevel,"LeftMargin");
 sal_Int32 nLineIndentation = getBulletMarginIndentation ( rXPropSet, 
nLevel,"FirstLineOffset");
 
@@ -1979,6 +1985,28 @@ void DrawingML::WriteParagraphProperties( const 
Reference< XTextContent >& rPara
 mpFS->endElementNS( XML_a, XML_lnSpc );
 }
 
+if( nParaTopMargin != 0 )
+{
+mpFS->startElementNS( XML_a, XML_spcBef, FSEND );
+{
+mpFS->singleElementNS( XML_a, XML_spcPts,
+   XML_val, I32S( std::lround( 
nParaTopMargin / 25.4 * 72 ) ),
+   FSEND );
+}
+mpFS->endElementNS( XML_a, XML_spcBef );
+}
+
+if( nParaBottomMargin != 0 )
+{
+mpFS->startElementNS( XML_a, XML_spcAft, FSEND );
+{
+mpFS->singleElementNS( XML_a, XML_spcPts,
+   XML_val, I32S( std::lround( 
nParaBottomMargin / 25.4 * 72 ) ),
+   FSEND );
+}
+mpFS->endElementNS( XML_a, XML_spcAft );
+}
+
 WriteParagraphNumbering( rXPropSet, nLevel );
 
 mpFS->endElementNS( XML_a, XML_pPr );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - oox/source

2017-02-14 Thread Miklos Vajna
 oox/source/drawingml/graphicshapecontext.cxx |   12 
 oox/source/ppt/extdrawingfragmenthandler.cxx |5 -
 2 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 3ad76f312bfe1161201ff44e523623729dd80738
Author: Miklos Vajna 
Date:   Fri Feb 10 14:33:51 2017 +0100

Related: tdf#105707 PPTX import: warn on invalid/empty SmartArt fallback 
relid

We already warn when the SmartArt doesn't have a drawingML fallback, but
having a reference to a fallback that is not a valid one (so resolves to
an empty fragment path) is also unusable. So warn in that case as well.

(cherry picked from commit 2d732b498bab244cde6978e9389511a940101995)

This second related situation is about when there is drawingML fallback
for the SmartArt, but it's ampty shape tree, which is never created with
MSO2010+ (those shape trees always have at least one element). This is
as bad as the missing drawingML fallback, so warn on it.

(cherry picked from commit 8c6776f27cef1e2b7b40957f1801b08707bc3230)

Change-Id: I03b2325003b4eb38b1347a88899799c6d5c33606
Reviewed-on: https://gerrit.libreoffice.org/34196
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/oox/source/drawingml/graphicshapecontext.cxx 
b/oox/source/drawingml/graphicshapecontext.cxx
index b58bf56..e211d73 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -275,6 +275,18 @@ ContextHandlerRef 
DiagramGraphicDataContext::onCreateContext( ::sal_Int32 aEleme
 // No DrawingML fallback, need to warn the user at the end.
 if (mpShapePtr->getExtDrawings().empty())
 getFilter().setMissingExtDrawing();
+else
+{
+for (const auto& rRelId : mpShapePtr->getExtDrawings())
+{
+// An invalid fallback reference is as bad as a missing one.
+if (getFragmentPathFromRelId(rRelId).isEmpty())
+{
+getFilter().setMissingExtDrawing();
+break;
+}
+}
+}
 
 break;
 }
diff --git a/oox/source/ppt/extdrawingfragmenthandler.cxx 
b/oox/source/ppt/extdrawingfragmenthandler.cxx
index 72b33ff..7d1a3cf 100644
--- a/oox/source/ppt/extdrawingfragmenthandler.cxx
+++ b/oox/source/ppt/extdrawingfragmenthandler.cxx
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 
 using namespace ::oox::core;
 using namespace ::com::sun::star::xml::sax;
@@ -35,7 +36,9 @@ ExtDrawingFragmentHandler::ExtDrawingFragmentHandler( 
XmlFilterBase& rFilter,
 
 ExtDrawingFragmentHandler::~ExtDrawingFragmentHandler( ) throw ()
 {
-
+// Empty DrawingML fallback, need to warn the user at the end.
+if (mpShapePtr && mpShapePtr->getChildren().empty())
+getFilter().setMissingExtDrawing();
 }
 
 ContextHandlerRef
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - oox/source

2017-02-13 Thread Andras Timar
 oox/source/ppt/pptimport.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ac0b2c90a9ae6a6442111b72113257fa16916d47
Author: Andras Timar 
Date:   Fri Feb 10 21:27:26 2017 +0100

Related: tdf#105707 PPTX import: decode document name from URL

Change-Id: I7448c48b9376a4b73b8a35034a73353981174823
Reviewed-on: https://gerrit.libreoffice.org/34136
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index 792e677..2b2619a 100644
--- a/oox/source/ppt/pptimport.cxx
+++ b/oox/source/ppt/pptimport.cxx
@@ -104,7 +104,7 @@ bool PowerPointImport::importDocument()
 {
 // Construct a warning message.
 INetURLObject aURL(getFileUrl());
-SfxErrorContext aContext(ERRCTX_SFX_OPENDOC, 
aURL.getName(INetURLObject::LAST_SEGMENT), nullptr, RID_ERRCTX);
+SfxErrorContext aContext(ERRCTX_SFX_OPENDOC, 
aURL.getName(INetURLObject::LAST_SEGMENT, true, 
INetURLObject::DECODE_WITH_CHARSET), nullptr, RID_ERRCTX);
 OUString aWarning;
 aContext.GetString(ERRCODE_WARNING_MASK, aWarning);
 aWarning += ":\n";
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - oox/source sd/qa

2017-02-07 Thread Tamás Zolnai
 oox/source/ppt/slidepersist.cxx |5 -
 sd/qa/unit/data/pptx/tdf105739.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   34 ++
 3 files changed, 38 insertions(+), 1 deletion(-)

New commits:
commit 90dd417259170f74ec74dfdd80183e49dc9a1f6d
Author: Tamás Zolnai 
Date:   Mon Feb 6 13:24:50 2017 +0100

tdf#31488: Background fill changes its color when saving a PPTX file to ODP

For a gradient fill we need to generate a name because
ODP export works with this name.
In case of shapes it works because when fill attribute
changes some internal name generation is triggered.
The same thing doesn't work for slide background
so generate this name explicitely in oox code.

Reviewed-on: https://gerrit.libreoffice.org/33937
Tested-by: Jenkins 
Reviewed-by: Tamás Zolnai 
(cherry picked from commit aeece6f198685b96579bdbd1409b3535fb5f09d1)

Change-Id: Ic6ebf37ef3d66a9c274747ca04653363b1fe6d02
Reviewed-on: https://gerrit.libreoffice.org/33941
Tested-by: Jenkins 
Reviewed-by: Miklos Vajna 

diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index ec79325..f79131d 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -173,7 +173,10 @@ void SlidePersist::createBackground( const XmlFilterBase& 
rFilterBase )
 sal_Int32 nPhClr = maBackgroundColor.isUsed() ?
 maBackgroundColor.getColor( rFilterBase.getGraphicHelper() ) : 
API_RGB_TRANSPARENT;
 
-::oox::drawingml::ShapePropertyMap aPropMap( 
rFilterBase.getModelObjectHelper() );
+oox::drawingml::ShapePropertyIds aPropertyIds = 
(oox::drawingml::ShapePropertyInfo::DEFAULT).mrPropertyIds;
+aPropertyIds[oox::drawingml::ShapeProperty::FillGradient] = 
PROP_FillGradientName;
+oox::drawingml::ShapePropertyInfo aPropInfo( aPropertyIds, true, 
false, true, false );
+oox::drawingml::ShapePropertyMap aPropMap( 
rFilterBase.getModelObjectHelper(), aPropInfo );
 mpBackgroundPropertiesPtr->pushToPropMap( aPropMap, 
rFilterBase.getGraphicHelper(), 0, nPhClr );
 PropertySet( mxPage ).setProperty( PROP_Background, 
aPropMap.makePropertySet() );
 }
diff --git a/sd/qa/unit/data/pptx/tdf105739.pptx 
b/sd/qa/unit/data/pptx/tdf105739.pptx
new file mode 100755
index 000..08e26f5
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf105739.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 540e800..e213086 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -103,6 +103,7 @@ public:
 void testTdf99224();
 void testTdf92076();
 void testTdf59046();
+void testTdf105739();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -129,6 +130,7 @@ public:
 CPPUNIT_TEST(testTdf99224);
 CPPUNIT_TEST(testTdf92076);
 CPPUNIT_TEST(testTdf59046);
+CPPUNIT_TEST(testTdf105739);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -757,6 +759,38 @@ void SdOOXMLExportTest2::testTdf59046()
 assertXPath(pXmlDocRels, 
"/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:custGeom/a:pathLst/a:path", 1);
 }
 
+void SdOOXMLExportTest2::testTdf105739()
+{
+// Gradient was lost during saving to ODP
+sd::DrawDocShellRef xShell = 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf105739.pptx"), 
PPTX);
+utl::TempFile tempFile;
+xShell = saveAndReload(xShell.get(), ODP, );
+uno::Reference xPage = getPage(0, xShell);
+uno::Reference xPropSet(xPage, uno::UNO_QUERY);
+uno::Any aAny = xPropSet->getPropertyValue("Background");
+CPPUNIT_ASSERT(aAny.hasValue());
+if (aAny.hasValue())
+{
+uno::Reference< beans::XPropertySet > aXBackgroundPropSet;
+aAny >>= aXBackgroundPropSet;
+
+// Test fill type
+drawing::FillStyle aFillStyle(drawing::FillStyle_NONE);
+aXBackgroundPropSet->getPropertyValue("FillStyle") >>= aFillStyle;
+CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, aFillStyle);
+
+// Test gradient properties
+com::sun::star::awt::Gradient aFillGradient;
+aXBackgroundPropSet->getPropertyValue("FillGradient") >>= 
aFillGradient;
+CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aFillGradient.Style);
+CPPUNIT_ASSERT_EQUAL(util::Color(0xff), aFillGradient.StartColor);
+CPPUNIT_ASSERT_EQUAL(util::Color(0x00b050), aFillGradient.EndColor);
+}
+
+xShell->DoClose();
+}
+
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - oox/source sw/qa

2017-01-06 Thread Miklos Vajna
 oox/source/vml/vmlshape.cxx  |   22 ++
 sw/qa/extras/ooxmlimport/data/tdf105127.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx |7 +++
 3 files changed, 29 insertions(+)

New commits:
commit 86847b02c581e908b5aae1cb13be7dba0e40e180
Author: Miklos Vajna 
Date:   Fri Jan 6 09:42:20 2017 +0100

tdf#105127 VML import: handle 

I don't see an easy way to implement this via UNO, so use the internal
API. As to the internal API usage,
SdrEditView::MirrorMarkedObjVertical() (for UI) and
SvxMSDffManager::ImportShape() (for WW8 import) are example client code.

Change-Id: I9bf27788db32fd35d6b56e0f1a240c4b7abc5604
(cherry picked from commit ac03883cd66a2d58c17c8dac555a053586e46625)
Reviewed-on: https://gerrit.libreoffice.org/32778
Tested-by: Jenkins 
Reviewed-by: Jan Holesovsky 

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index c978c39..0b68675 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1058,6 +1058,28 @@ Reference< XShape > BezierShape::implConvertAndInsert( 
const Reference< XShapes
 aPropSet.setProperty( PROP_PolyPolygonBezier, aBezierCoords );
 }
 
+// Handle horizontal and vertical flip.
+if (!maTypeModel.maFlip.isEmpty())
+{
+if (SdrObject* pShape = GetSdrObjectFromXShape(xShape))
+{
+if (maTypeModel.maFlip.startsWith("x"))
+{
+Point aCenter(pShape->GetSnapRect().Center());
+Point aPoint2(aCenter);
+aPoint2.setY(aPoint2.getY() + 1);
+pShape->NbcMirror(aCenter, aPoint2);
+}
+if (maTypeModel.maFlip.endsWith("y"))
+{
+Point aCenter(pShape->GetSnapRect().Center());
+Point aPoint2(aCenter);
+aPoint2.setX(aPoint2.getX() + 1);
+pShape->NbcMirror(aCenter, aPoint2);
+}
+}
+}
+
 // Hacky way of ensuring the shape is correctly sized/positioned
 xShape->setSize( awt::Size( rShapeRect.Width, rShapeRect.Height ) );
 xShape->setPosition( awt::Point( rShapeRect.X, rShapeRect.Y ) );
diff --git a/sw/qa/extras/ooxmlimport/data/tdf105127.docx 
b/sw/qa/extras/ooxmlimport/data/tdf105127.docx
new file mode 100644
index 000..3cdfa7f
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf105127.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index b1ccafc..0acf8f0 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -692,6 +692,13 @@ DECLARE_OOXMLIMPORT_TEST(testBnc779620, "bnc779620.docx")
 lcl_countTextFrames( mxComponent, 1 );
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf105127, "tdf105127.docx")
+{
+auto aPolyPolygon = 
getProperty(getShape(1), "PolyPolygonBezier");
+// This was 1910, the shape was rendered upside down.
+CPPUNIT_ASSERT_EQUAL(static_cast(3257), 
aPolyPolygon.Coordinates[0][0].Y);
+}
+
 DECLARE_OOXMLIMPORT_TEST(testfdo76583, "fdo76583.docx")
 {
 // The problem was that the floating table was imported as a non-floating 
one.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - oox/source

2017-01-01 Thread Andras Timar
 oox/source/export/drawingml.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c6f34422a444cb8be3ac522424a15b3223e161ff
Author: Andras Timar 
Date:   Wed Dec 28 09:56:59 2016 +0100

tdf#104539 dir attribute of outerShdw has to be non-negative

Change-Id: Ic6f1c8555eb8d137ced2f4e87baa866df84c69ac
Reviewed-on: https://gerrit.libreoffice.org/32470
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 8d02565..73bf449 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2982,7 +2982,7 @@ void DrawingML::WriteShapeEffects( const Reference< 
XPropertySet >& rXPropSet )
 aShadowAttribsGrabBag[0].Name = "dist";
 aShadowAttribsGrabBag[0].Value = Any(static_cast< sal_Int32 
>(sqrt(dX*dX + dY*dY) * 360));
 aShadowAttribsGrabBag[1].Name = "dir";
-aShadowAttribsGrabBag[1].Value = Any(static_cast< sal_Int32 
>(atan2(dY,dX) * 180 * 6 / M_PI));
+aShadowAttribsGrabBag[1].Value = Any((static_cast< sal_Int32 
>(atan2(dY,dX) * 180 * 6 / M_PI) + 2160) % 2160);
 
 aShadowGrabBag[0].Name = "Attribs";
 aShadowGrabBag[0].Value = Any(aShadowAttribsGrabBag);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - oox/source sd/qa

2016-12-09 Thread Tamás Zolnai
 oox/source/drawingml/textbody.cxx   |4 ++
 oox/source/ppt/pptshape.cxx |2 -
 sd/qa/unit/data/pptx/tdf104445.pptx |binary
 sd/qa/unit/import-tests.cxx |   53 
 4 files changed, 57 insertions(+), 2 deletions(-)

New commits:
commit 653535729c9690d6d5e05e4e829e917072840e40
Author: Tamás Zolnai 
Date:   Fri Dec 9 12:26:45 2016 +

tdf#104445: PPTX import: Extra bullets are added to placeholder text

Reviewed-on: https://gerrit.libreoffice.org/31771
Reviewed-by: Tamás Zolnai 
Tested-by: Tamás Zolnai 
(cherry picked from commit cb598029835477326b190bc99abd31a487cc5a91)

Change-Id: I25ce98ed391f70292bed6238645b121b9cf50d5e
Reviewed-on: https://gerrit.libreoffice.org/31788
Tested-by: Jenkins 
Reviewed-by: Tamás Zolnai 

diff --git a/oox/source/drawingml/textbody.cxx 
b/oox/source/drawingml/textbody.cxx
index 662a52f..8efb70d 100644
--- a/oox/source/drawingml/textbody.cxx
+++ b/oox/source/drawingml/textbody.cxx
@@ -23,6 +23,7 @@
 #include 
 #include "drawingml/textparagraph.hxx"
 #include "oox/helper/propertyset.hxx"
+#include 
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::text;
@@ -110,10 +111,11 @@ void TextBody::ApplyStyleEmpty(
 {
 Reference< XPropertySet > xProps(xText, UNO_QUERY);
 PropertyMap aioBulletList;
+aioBulletList.setProperty< sal_Int32 >(PROP_LeftMargin, 0); // Init 
bullets left margin to 0 (no bullets).
 float nCharHeight = 
xProps->getPropertyValue("CharHeight").get();
 TextParagraphProperties aParaProp;
 aParaProp.apply(*pTextParagraphStyle);
-aParaProp.pushToPropSet(, xProps, aioBulletList, 
>getBulletList(), false, nCharHeight, true);
+aParaProp.pushToPropSet(, xProps, aioBulletList, 
>getBulletList(), true, nCharHeight, true);
 }
 }
 
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 08e2df8..80a056e 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -352,7 +352,7 @@ void PPTShape::addShape(
 }
 
 // Apply text properties on placeholder text inside this 
placeholder shape
-if (mpPlaceholder.get() != nullptr && getTextBody() && 
getTextBody()->isEmpty())
+if (meShapeLocation == Slide && mpPlaceholder.get() != nullptr && 
getTextBody() && getTextBody()->isEmpty())
 {
 Reference < XText > xText(mxShape, UNO_QUERY);
 if (xText.is())
diff --git a/sd/qa/unit/data/pptx/tdf104445.pptx 
b/sd/qa/unit/data/pptx/tdf104445.pptx
new file mode 100755
index 000..bee32dc
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf104445.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index c1c4224..79d6cd0 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -63,6 +63,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -131,6 +132,7 @@ public:
 void testTdf103876();
 void testTdf104015();
 void testTdf104201();
+void testTdf104445();
 
 CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -187,6 +189,7 @@ public:
 CPPUNIT_TEST(testTdf103876);
 CPPUNIT_TEST(testTdf104015);
 CPPUNIT_TEST(testTdf104201);
+CPPUNIT_TEST(testTdf104445);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -1621,6 +1624,56 @@ void SdImportTest::testTdf104201()
 xDocShRef->DoClose();
 }
 
+void SdImportTest::testTdf104445()
+{
+// Extra bullets were added to the first shape
+sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf104445.pptx"), 
PPTX);
+
+// First shape should not have bullet
+   {
+uno::Reference< beans::XPropertySet > xShape(getShapeFromPage(0, 0, 
xDocShRef));
+uno::Reference< text::XText > xText = uno::Reference< 
text::XTextRange>(xShape, uno::UNO_QUERY)->getText();
+CPPUNIT_ASSERT_MESSAGE("Not a text shape", xText.is());
+uno::Reference< beans::XPropertySet > xPropSet(xText, 
uno::UNO_QUERY_THROW);
+
+uno::Reference< container::XIndexAccess > xNumRule;
+xPropSet->getPropertyValue("NumberingRules") >>= xNumRule;
+uno::Sequence aBulletProps;
+xNumRule->getByIndex(0) >>= aBulletProps;
+
+for (int i = 0; i < aBulletProps.getLength(); ++i)
+{
+const beans::PropertyValue& rProp = aBulletProps[i];
+if(rProp.Name == "NumberingType")
+
CPPUNIT_ASSERT_EQUAL(sal_Int16(style::NumberingType::NUMBER_NONE), 
rProp.Value.get());
+if(rProp.Name == "LeftMargin")
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), 
rProp.Value.get());
+}
+}
+// Second shape should have bullet set
+{
+uno::Reference< beans::XPropertySet > 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - oox/source sc/qa sc/source

2016-12-04 Thread Mike Kaganski
 oox/source/core/fragmenthandler2.cxx   |1 
 oox/source/core/xmlfilterbase.cxx  |5 +
 oox/source/token/namespaces-strict.txt |1 
 oox/source/token/namespaces.hxx.tail   |1 
 oox/source/token/namespaces.txt|1 
 oox/source/token/tokens.txt|1 
 sc/qa/unit/bugfix-test.cxx |   50 +-
 sc/qa/unit/data/xlsx/tdf104310-2.xlsx  |binary
 sc/source/filter/inc/worksheetfragment.hxx |   41 +++
 sc/source/filter/oox/worksheetfragment.cxx |   77 +
 10 files changed, 155 insertions(+), 23 deletions(-)

New commits:
commit 90aca5a284c0d0828853b1a9ed2e4a0fd05f7f1a
Author: Mike Kaganski 
Date:   Fri Dec 2 03:31:22 2016 +0300

tdf#104310: Accept x12ac lists and fallbacks in dataValidations

Change-Id: I42cf20fcfe3ec03ebd09923be509a9d11e0b40da
Reviewed-on: https://gerrit.libreoffice.org/31516
Tested-by: Jenkins 
Reviewed-by: Kohei Yoshida 
(cherry picked from commit ce17ebb69500530c978767b1389c9e8341acb9bf)
Reviewed-on: https://gerrit.libreoffice.org/31529
Reviewed-by: Mike Kaganski 
Tested-by: Mike Kaganski 

diff --git a/oox/source/core/fragmenthandler2.cxx 
b/oox/source/core/fragmenthandler2.cxx
index 9a708d5..ba3f880 100644
--- a/oox/source/core/fragmenthandler2.cxx
+++ b/oox/source/core/fragmenthandler2.cxx
@@ -76,6 +76,7 @@ bool FragmentHandler2::prepareMceContext( sal_Int32 nElement, 
const AttributeLis
 {
 "p14",
 "p15",
+"x12ac",
 };
 
 if (std::find(aSupportedNS.begin(), aSupportedNS.end(), 
aRequires) != aSupportedNS.end())
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index fae720f..952bf5e 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -146,7 +146,10 @@ struct NamespaceIds: public rtl::StaticWithInit<
 {"http://schemas.microsoft.com/office/powerpoint/2010/main;,
  NMSP_p14},
 {"http://schemas.microsoft.com/office/powerpoint/2012/main;,
- NMSP_p15}};
+ NMSP_p15},
+{"http://schemas.microsoft.com/office/spreadsheetml/2011/1/ac;,
+ NMSP_x12ac},
+};
 }
 };
 
diff --git a/oox/source/token/namespaces-strict.txt 
b/oox/source/token/namespaces-strict.txt
index f9a4633..0f606f7 100644
--- a/oox/source/token/namespaces-strict.txt
+++ b/oox/source/token/namespaces-strict.txt
@@ -83,6 +83,7 @@ p14 
http://schemas.microsoft.com/office/powerpoint/2010/main
 # MSO 2012/2013 extensions 
-
 
 p15 
http://schemas.microsoft.com/office/powerpoint/2012/main
+x12ac   
http://schemas.microsoft.com/office/spreadsheetml/2011/1/ac
 
 # extlst namespaces
 
diff --git a/oox/source/token/namespaces.hxx.tail 
b/oox/source/token/namespaces.hxx.tail
index 89f8c1c..17770dc 100644
--- a/oox/source/token/namespaces.hxx.tail
+++ b/oox/source/token/namespaces.hxx.tail
@@ -46,6 +46,7 @@ inline sal_Int32 getNamespace( sal_Int32 nToken ) { return 
nToken & NMSP_MASK; }
 #define R_TOKEN( token )OOX_TOKEN( officeRel, token )
 #define VML_TOKEN( token )  OOX_TOKEN( vml, token )
 #define VMLX_TOKEN( token ) OOX_TOKEN( vmlExcel, token )
+#define X12AC_TOKEN( token )OOX_TOKEN( x12ac, token )
 #define XDR_TOKEN( token )  OOX_TOKEN( dmlSpreadDr, token )
 #define XLS_TOKEN( token )  OOX_TOKEN( xls, token )
 #define XLS14_TOKEN( token )OOX_TOKEN( xls14Lst, token )
diff --git a/oox/source/token/namespaces.txt b/oox/source/token/namespaces.txt
index 7920572..4b6f49a 100644
--- a/oox/source/token/namespaces.txt
+++ b/oox/source/token/namespaces.txt
@@ -83,6 +83,7 @@ p14 
http://schemas.microsoft.com/office/powerpoint/2010/main
 # MSO 2012/2013 extensions 
-
 
 p15 
http://schemas.microsoft.com/office/powerpoint/2012/main
+x12ac   
http://schemas.microsoft.com/office/spreadsheetml/2011/1/ac
 
 # extlst namespaces
 
diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt
index b113c84..6d4fcb8 100644
--- a/oox/source/token/tokens.txt
+++ b/oox/source/token/tokens.txt
@@ -5781,6 +5781,7 @@ writeProtection
 wsDr
 wsp
 x
+x12ac
 x14
 xAlign
 xIllusions
diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx
index 9b7f2b7..3499109 100644
--- a/sc/qa/unit/bugfix-test.cxx
+++ b/sc/qa/unit/bugfix-test.cxx
@@ -242,20 +242,42 @@ void ScFiltersTest::testRhbz1390776()
 
 void ScFiltersTest::testTdf104310()
 {
-ScDocShellRef xDocSh = loadDoc("tdf104310.", FORMAT_XLSX);
-ScDocument& rDoc = 

[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - oox/source sw/qa

2016-11-30 Thread Miklos Vajna
 oox/source/export/drawingml.cxx  |4 +++-
 sw/qa/extras/ooxmlexport/data/tdf104115.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx|   10 ++
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit c3d124254a3097163aae127e2fe3e34980417f20
Author: Miklos Vajna 
Date:   Tue Nov 29 09:20:28 2016 +0100

tdf#104115 DOCX export: ClosedBezierShape should always result in 


Regression from commit 6b084f0001fc15112bf3c40d20a0c7096c83b7fe (asan:
global-buffer-overflow on fdo55736-1.docx, 2015-01-08), the problem as
seen by the user was that our VML->DML conversion in a DOCX file
resulted in output that wasn't accepted by Word anymore.

Now that commit itself is fine, but as a side effect, the somewhat
unusual (bezier with no actual polypolygons) child shape of the group
shape is now written, but not in a way that conforms to the drawingML
schema.

Fix that pre-existing, but now visible problem by always writing
 in the DOCX case.

(cherry picked from commit a5cc8993dceb61c63caf26ae995d9d62905291e5)

Change-Id: Idbcb903dda07b5c2408d2b0ebbf4b5e4a08b20ed
Reviewed-on: https://gerrit.libreoffice.org/31383
Reviewed-by: Miklos Vajna 
Tested-by: Miklos Vajna 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 0951449..8d02565 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2540,7 +2540,9 @@ bool DrawingML::WriteCustomGeometry( const Reference< 
XShape >& rXShape )
 
 void DrawingML::WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon )
 {
-if( rPolyPolygon.Count() < 1 )
+// In case of Writer, the parent element is , and there the
+//  element is not optional.
+if (rPolyPolygon.Count() < 1 && GetDocumentType() != DOCUMENT_DOCX)
 return;
 
 mpFS->startElementNS( XML_a, XML_custGeom, FSEND );
diff --git a/sw/qa/extras/ooxmlexport/data/tdf104115.docx 
b/sw/qa/extras/ooxmlexport/data/tdf104115.docx
new file mode 100644
index 000..9236f0e
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf104115.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 8d117e6..f4bd83e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -141,6 +141,16 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103982, "tdf103982.docx")
 CPPUNIT_ASSERT(nDistB >= 0);
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf104115, "tdf104115.docx")
+{
+xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+if (!pXmlDoc)
+return;
+// This found 0 nodes: the custom geometry was not written for the Bezier
+// curve -> Word refused to open the document.
+assertXPath(pXmlDoc, "//a:custGeom", 1);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - oox/source sd/qa

2016-11-27 Thread Tamás Zolnai
 oox/source/drawingml/shape.cxx  |6 +++---
 sd/qa/unit/data/pptx/tdf104201.pptx |binary
 sd/qa/unit/import-tests.cxx |   36 
 3 files changed, 39 insertions(+), 3 deletions(-)

New commits:
commit ae79fbd42fd61c878939111a04bca22f84c37e03
Author: Tamás Zolnai 
Date:   Sun Nov 27 17:44:46 2016 +

tdf#104201: PPTX: Group solid fill is not imported

Reviewed-on: https://gerrit.libreoffice.org/31263
Reviewed-by: Tamás Zolnai 
Tested-by: Tamás Zolnai 
(cherry picked from commit 7c5aaa254f444d54b9ebf6574f0ccd37af548ee5)

Change-Id: Iec273714108598d7017e73a9e7d384f8410d6ee1
Reviewed-on: https://gerrit.libreoffice.org/31266
Tested-by: Jenkins 
Reviewed-by: Tamás Zolnai 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 0ee6cef..cd56496 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1462,14 +1462,14 @@ FillProperties Shape::getActualFillProperties(const 
Theme* pTheme, const FillPro
 }
 }
 
+// Properties specified directly for this shape
+aFillProperties.assignUsed(getFillProperties());
+
 // Parent shape's properties
 if ( pParentShapeFillProps != nullptr)
 if( getFillProperties().moFillType.has() && 
getFillProperties().moFillType.get() == XML_grpFill )
 aFillProperties.assignUsed( *pParentShapeFillProps );
 
-// Properties specified directly for this shape
-aFillProperties.assignUsed( getFillProperties() );
-
 return aFillProperties;
 }
 
diff --git a/sd/qa/unit/data/pptx/tdf104201.pptx 
b/sd/qa/unit/data/pptx/tdf104201.pptx
new file mode 100755
index 000..99a6532
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf104201.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 6c14bd5..c1c4224 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -130,6 +130,7 @@ public:
 void testTdf103792();
 void testTdf103876();
 void testTdf104015();
+void testTdf104201();
 
 CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -185,6 +186,7 @@ public:
 CPPUNIT_TEST(testTdf103792);
 CPPUNIT_TEST(testTdf103876);
 CPPUNIT_TEST(testTdf104015);
+CPPUNIT_TEST(testTdf104201);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -1585,6 +1587,40 @@ void SdImportTest::testTdf104015()
 xDocShRef->DoClose();
 }
 
+void SdImportTest::testTdf104201()
+{
+// Group shape properties did not overwrite the child shapes' fill
+sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf104201.pptx"), 
PPTX);
+
+const SdrPage *pPage = GetPage(1, xDocShRef);
+CPPUNIT_ASSERT_MESSAGE("No page found", pPage != nullptr);
+
+// First shape has red fill, but this should be overwritten by green group 
fill
+{
+SdrObject *const pObj = pPage->GetObj(0);
+CPPUNIT_ASSERT_MESSAGE("Wrong object", pObj != nullptr);
+const XFillStyleItem& rStyleItem = dynamic_cast(
+pObj->GetMergedItem(XATTR_FILLSTYLE));
+CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue());
+const XFillColorItem& rColorItem = dynamic_cast(
+pObj->GetMergedItem(XATTR_FILLCOLOR));
+CPPUNIT_ASSERT_EQUAL(ColorData(0x00FF00), 
rColorItem.GetColorValue().GetColor());
+}
+// Scond shape has blue fill, but this should be overwritten by green 
group fill
+{
+SdrObject *const pObj = pPage->GetObj(0);
+CPPUNIT_ASSERT_MESSAGE("Wrong object", pObj != nullptr);
+const XFillStyleItem& rStyleItem = dynamic_cast(
+pObj->GetMergedItem(XATTR_FILLSTYLE));
+CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, rStyleItem.GetValue());
+const XFillColorItem& rColorItem = dynamic_cast(
+pObj->GetMergedItem(XATTR_FILLCOLOR));
+CPPUNIT_ASSERT_EQUAL(ColorData(0x00FF00), 
rColorItem.GetColorValue().GetColor());
+}
+
+xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - oox/source sd/qa

2016-11-26 Thread Mark Hung
 oox/source/export/shapes.cxx   |8 +---
 sd/qa/unit/export-tests-ooxml2.cxx |2 --
 2 files changed, 1 insertion(+), 9 deletions(-)

New commits:
commit 308a00e1dc1799b33bfc26bd8e0ec2797128b671
Author: Mark Hung 
Date:   Wed Nov 23 20:23:37 2016 +0800

tdf#96052 - export the forbidden shape as path instead of preset shape.

OOXML noSmoking shape has different definition so that convert LO's
forbidden shape to OOXML noSmoking do not produce good result.
I put it on whitelist and now the geometry looks correct although handle
is lost.

This partially revert unit test for the shape in
2b4f9d0b2b0006fc7bebb9e696a32eabd1aeb993, where forbidden is exported as
a preset shape.

Change-Id: I2e134940fa4a36e6b7b814b008d859691fbcdd6a
Reviewed-on: https://gerrit.libreoffice.org/31110
Tested-by: Jenkins 
Reviewed-by: Mark Hung 
(cherry picked from commit b6f52c5c6bc57d831e09126f802739589e5eea37)
Reviewed-on: https://gerrit.libreoffice.org/31226

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 820cb4c..7bd85a8 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -547,7 +547,6 @@ static bool lcl_IsOnBlacklist(OUString& rShapeType)
 OUStringLiteral("smiley"),
 OUStringLiteral("sun"),
 OUStringLiteral("flower"),
-OUStringLiteral("forbidden"),
 OUStringLiteral("bracket-pair"),
 OUStringLiteral("brace-pair"),
 OUStringLiteral("col-60da8460"),
@@ -606,6 +605,7 @@ static bool lcl_IsOnWhitelist(OUString& rShapeType)
 static
 #endif
 const std::initializer_list vWhitelist = {
+OUStringLiteral("forbidden"),
 OUStringLiteral("heart"),
 OUStringLiteral("puzzle")
 };
@@ -918,12 +918,6 @@ ShapeExport& ShapeExport::WriteCustomShape( const 
Reference< XShape >& xShape )
 lcl_AppendAdjustmentValue( aAvList, 0, adj );
 break;
 }
-case mso_sptNoSmoking:
-{
-sal_Int32 adj =  double( nXPosition )/7200 *5 ;
-lcl_AppendAdjustmentValue( aAvList, 0, adj );
-break;
-}
 case mso_sptDonut:
 case mso_sptSun:
 case mso_sptMoon:
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 05ef4aa..540e800 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -467,8 +467,6 @@ void SdOOXMLExportTest2::testPresetShapesExport()
 "adj1","val 10490",
 "donut",
 "adj","val 9601",
-"noSmoking",
-"adj","val 16118",
 "bevel",
 "adj","val 42587",
 "foldedCorner",
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits