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

2020-10-06 Thread Miklos Vajna (via logerrit)
 oox/source/drawingml/shape.cxx |   16 ++
 oox/source/drawingml/textbodypropertiescontext.cxx |5 
 sd/qa/unit/data/pptx/shape-text-adjust-left.pptx   |binary
 sd/qa/unit/data/xml/n762695_0.xml  |6 -
 sd/qa/unit/data/xml/n762695_1.xml  |   10 -
 sd/qa/unit/data/xml/n819614_0.xml  |  114 ++---
 sd/qa/unit/data/xml/n820786_0.xml  |  102 +-
 sd/qa/unit/data/xml/tdf109317_0.xml|   12 +-
 sd/qa/unit/import-tests.cxx|   27 
 9 files changed, 162 insertions(+), 130 deletions(-)

New commits:
commit bcfe68c96893c39b07c15efd99cd010d6736f560
Author: Miklos Vajna 
AuthorDate: Mon Oct 5 21:06:01 2020 +0200
Commit: Xisco Fauli 
CommitDate: Tue Oct 6 19:15:42 2020 +0200

tdf#137023 PPTX import: fix unexpected center alignment of shape text, 2nd 
try

Regression from commit 10bb02efd8afd42e633e370480104e2575546d8e
(tdf#129685 PPTX import: fix unexpected centering of shape text,
2020-09-18), now the problem was that some text should be left aligned,
but was centered.

Fix the problem by reverting most of the above commit: XML changes,
changes to SdImportTest::testTdf113198() (manual testing show that this
change is not needed after all) and changes to the
TextBodyPropertiesContext ctor in oox/ (but not the testcase itself).

Fix tdf#113198 again, this time in Shape::createAndInsert(), which is
meant to be closer to what the binary PPT import does.

With this, all cases from tdf#104722, tdf#113198, tdf#129685 and
tdf#137023 are meant to be handled correctly at the same time.

(cherry picked from commit dfa1856cdb4c69985ef1e809d33055427b6fbd76)

Change-Id: Id785252c26fc407cd74c9cfb55624091798d7773
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104006
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104023

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 31ea0c696281..b49b52fdd9ce 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1452,6 +1452,22 @@ Reference< XShape > const & Shape::createAndInsert(
 xText->setString("");
 Reference < XTextCursor > xAt = xText->createTextCursor();
 getTextBody()->insertAt( rFilterBase, xText, xAt, 
aCharStyleProperties, mpMasterTextListStyle );
+
+const TextParagraphVector& rParagraphs = 
getTextBody()->getParagraphs();
+if (!rParagraphs.empty())
+{
+const std::shared_ptr& pParagraph = 
rParagraphs[0];
+if (pParagraph->getProperties().getParaAdjust())
+{
+style::ParagraphAdjust eAdjust = 
*pParagraph->getProperties().getParaAdjust();
+if (eAdjust == style::ParagraphAdjust_CENTER)
+{
+// If the first paragraph is centered, then set 
the para adjustment of
+// the shape itself to centered as well.
+aPropertySet.setAnyProperty(PROP_ParaAdjust, 
uno::makeAny(eAdjust));
+}
+}
+}
 }
 }
 else if (mbTextBox)
diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx 
b/oox/source/drawingml/textbodypropertiescontext.cxx
index af02c6f981d8..d696b4c3ac70 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -123,11 +123,6 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( 
ContextHandler2Helper cons
 {
 mrTextBodyProp.meVA = GetTextVerticalAdjust( rAttribs.getToken( 
XML_anchor, XML_t ) );
 mrTextBodyProp.maPropertyMap.setProperty( PROP_TextVerticalAdjust, 
mrTextBodyProp.meVA);
-if (mrTextBodyProp.meVA == drawing::TextVerticalAdjust_CENTER)
-{
-mrTextBodyProp.maPropertyMap.setProperty(PROP_TextHorizontalAdjust,
- 
TextHorizontalAdjust_CENTER);
-}
 }
 
 // Push defaults
diff --git a/sd/qa/unit/data/pptx/shape-text-adjust-left.pptx 
b/sd/qa/unit/data/pptx/shape-text-adjust-left.pptx
new file mode 100644
index ..d197425b9703
Binary files /dev/null and b/sd/qa/unit/data/pptx/shape-text-adjust-left.pptx 
differ
diff --git a/sd/qa/unit/data/xml/n762695_0.xml 
b/sd/qa/unit/data/xml/n762695_0.xml
index fe02e3f00d0d..710a5039ab69 100644
--- a/sd/qa/unit/data/xml/n762695_0.xml
+++ b/sd/qa/unit/data/xml/n762695_0.xml
@@ -1,6 +1,6 @@
 
 
- 
+ 
   
   
   
@@ -86,7 +86,7 @@

   
  
- 
+ 
   
   
   
@@ -163,7 +163,7 @@

   
  
- 
+ 
   
   
   
diff --git 

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

2020-09-21 Thread Miklos Vajna (via logerrit)
 oox/source/drawingml/shape.cxx |3 
 oox/source/drawingml/textbodypropertiescontext.cxx |5 
 sd/qa/unit/data/pptx/shape-text-alignment.pptx |binary
 sd/qa/unit/data/xml/n762695_0.xml  |6 -
 sd/qa/unit/data/xml/n762695_1.xml  |   10 -
 sd/qa/unit/data/xml/n819614_0.xml  |  114 ++---
 sd/qa/unit/data/xml/n820786_0.xml  |  102 +-
 sd/qa/unit/data/xml/tdf109317_0.xml|   12 +-
 sd/qa/unit/import-tests.cxx|   21 +++
 9 files changed, 149 insertions(+), 124 deletions(-)

New commits:
commit 55505edc8eca0e4ba30f192e81ff18982b8e2f95
Author: Miklos Vajna 
AuthorDate: Fri Sep 18 17:53:33 2020 +0200
Commit: Xisco Fauli 
CommitDate: Mon Sep 21 23:49:52 2020 +0200

tdf#129685 PPTX import: fix unexpected centering of shape text

Regression from commit 89f0af144c18efafe2573801641689a1432c0cae (tdf#113198 
set
default shape paragraph alignment.., 2019-11-19), the old bugdoc had this
markup:

 (centered)

The new bugdoc has 2 shapes with text:

 (aligned to left)
 (should be centered)

"anchor" is about vertical, "anchorCtr" is about horizontal centering of 
text.

Checking what the binary filter does, it maps horizontal centering to
TextHorizontalAdjust, so fix the original bug differently, by leaving
ParaAdjust alone, and tweaking TextHorizontalAdjust intead: this keeps the 
old
bugdoc working but fixes the new one.

This caused a number of "change detector" XML-based tests to fail: all of 
them
are unchanged visually, so the XML files are adapted to the new state.

The tdf#113198 fix itself was fixing a regression from tdf#104722, and that
commit had no testcase, I tested that we don't regress there, manually.

(cherry picked from commit 10bb02efd8afd42e633e370480104e2575546d8e)

Change-Id: I81a7b3e8c76bfbce5c5569d16d5238958ac20f75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103088
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103110

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index cce8b9ba7bbc..31ea0c696281 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -214,7 +214,8 @@ void Shape::setDefaults(bool bHeight)
 if (bHeight)
 maDefaultShapeProperties.setProperty(PROP_CharHeight, static_cast< 
float >( 18.0 ));
 maDefaultShapeProperties.setProperty(PROP_TextVerticalAdjust, 
TextVerticalAdjust_TOP);
-maDefaultShapeProperties.setProperty(PROP_ParaAdjust, static_cast< 
sal_Int16 >( ParagraphAdjust_CENTER ));
+maDefaultShapeProperties.setProperty(PROP_ParaAdjust,
+ 
static_cast(ParagraphAdjust_LEFT));
 }
 
 ::oox::vml::OleObjectInfo& Shape::setOleObjectType()
diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx 
b/oox/source/drawingml/textbodypropertiescontext.cxx
index d696b4c3ac70..af02c6f981d8 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -123,6 +123,11 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( 
ContextHandler2Helper cons
 {
 mrTextBodyProp.meVA = GetTextVerticalAdjust( rAttribs.getToken( 
XML_anchor, XML_t ) );
 mrTextBodyProp.maPropertyMap.setProperty( PROP_TextVerticalAdjust, 
mrTextBodyProp.meVA);
+if (mrTextBodyProp.meVA == drawing::TextVerticalAdjust_CENTER)
+{
+mrTextBodyProp.maPropertyMap.setProperty(PROP_TextHorizontalAdjust,
+ 
TextHorizontalAdjust_CENTER);
+}
 }
 
 // Push defaults
diff --git a/sd/qa/unit/data/pptx/shape-text-alignment.pptx 
b/sd/qa/unit/data/pptx/shape-text-alignment.pptx
new file mode 100644
index ..ff4ff06f2fdf
Binary files /dev/null and b/sd/qa/unit/data/pptx/shape-text-alignment.pptx 
differ
diff --git a/sd/qa/unit/data/xml/n762695_0.xml 
b/sd/qa/unit/data/xml/n762695_0.xml
index 710a5039ab69..fe02e3f00d0d 100644
--- a/sd/qa/unit/data/xml/n762695_0.xml
+++ b/sd/qa/unit/data/xml/n762695_0.xml
@@ -1,6 +1,6 @@
 
 
- 
+ 
   
   
   
@@ -86,7 +86,7 @@

   
  
- 
+ 
   
   
   
@@ -163,7 +163,7 @@

   
  
- 
+ 
   
   
   
diff --git a/sd/qa/unit/data/xml/n762695_1.xml 
b/sd/qa/unit/data/xml/n762695_1.xml
index 54b383db40a8..587d22ab2a56 100644
--- a/sd/qa/unit/data/xml/n762695_1.xml
+++ b/sd/qa/unit/data/xml/n762695_1.xml
@@ -1,6 +1,6 @@
 
 
- 
+ 
   
   
   
@@ -86,7 +86,7 @@

   
  
- 
+ 
   
   
   
@@ -172,7 +172,7 @@

   
  
- 
+ 
   
   
   
@@ -325,7 +325,7 @@

   
  
- 
+ 
   
   
   
@@ -478,7 +478,7 @@

   
  
- 
+ 
   
   
   
diff --git a/sd/qa/unit/data/xml/n819614_0.xml 

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

2020-05-29 Thread Miklos Vajna (via logerrit)
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |   23 
 sd/qa/unit/import-tests-smartart.cxx|8 ++
 2 files changed, 31 insertions(+)

New commits:
commit d2cb2ecff3cce10f47a9ae1b1ba80e0eff23745c
Author: Miklos Vajna 
AuthorDate: Wed May 27 14:04:58 2020 +0200
Commit: Mike Kaganski 
CommitDate: Fri May 29 17:23:59 2020 +0200

oox smartart import, composite alg: implement vertical centering

The bugdoc's case was that the total height would be used by 2 shapes,
but then a constraint decreases the height of one shape, so not all
vertical space is used.

We used to just count from the top, need to center vertically, as
PowerPoint does it.

(cherry picked from commit acdde3c643fde015214c546b1567727272ea799e)

Change-Id: I436019e9e837b73130e387c9bcd309e20045b0f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95017
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 33f858386999..19b1d10679f4 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -479,6 +479,11 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
 LayoutProperty& rParent = aProperties[""];
 
 sal_Int32 nParentXOffset = 0;
+
+// Track min/max vertical positions, so we can center everything 
at the end, if needed.
+sal_Int32 nVertMin = std::numeric_limits::max();
+sal_Int32 nVertMax = 0;
+
 if (mfAspectRatio != 1.0)
 {
 rParent[XML_w] = rShape->getSize().Width;
@@ -614,6 +619,24 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
 aCurrShape->setSize(aSize);
 aCurrShape->setChildSize(aSize);
 aCurrShape->setPosition(aPos);
+
+nVertMin = std::min(aPos.Y, nVertMin);
+nVertMax = std::max(aPos.Y + aSize.Height, nVertMax);
+}
+
+// See if all vertical space is used or we have to center the 
content.
+if (nVertMin >= 0 && nVertMax <= rParent[XML_h])
+{
+sal_Int32 nDiff = rParent[XML_h] - (nVertMax - nVertMin);
+if (nDiff > 0)
+{
+for (auto& aCurrShape : rShape->getChildren())
+{
+awt::Point aPosition = aCurrShape->getPosition();
+aPosition.Y += nDiff / 2;
+aCurrShape->setPosition(aPosition);
+}
+}
 }
 break;
 }
diff --git a/sd/qa/unit/import-tests-smartart.cxx 
b/sd/qa/unit/import-tests-smartart.cxx
index 327645fddc3f..4b110f740e11 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -1480,6 +1480,14 @@ void SdImportTestSmartArt::testFillColorList()
 awt::Size aActualSize = xShape->getSize();
 CPPUNIT_ASSERT_EQUAL(static_cast(2239), aActualSize.Height);
 
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected greater than: 1738 (2766)
+// - Actual  : 1738
+// i.e. the columns were not centered vertically.
+sal_Int32 nGroupTop = xGroup->getPosition().Y;
+sal_Int32 nShapeTop = xShape->getPosition().Y;
+CPPUNIT_ASSERT_GREATER(nGroupTop, nShapeTop);
+
 xDocShRef->DoClose();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-05-29 Thread Miklos Vajna (via logerrit)
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |  119 
 sd/qa/unit/data/pptx/fill-color-list.pptx   |binary
 sd/qa/unit/import-tests-smartart.cxx|   10 +
 3 files changed, 109 insertions(+), 20 deletions(-)

New commits:
commit 80493ba382647b51e56fc3a5aa3445b0bd17fc0c
Author: Miklos Vajna 
AuthorDate: Tue May 26 16:16:27 2020 +0200
Commit: Mike Kaganski 
CommitDate: Fri May 29 17:20:14 2020 +0200

oox smartart import: fix aspect ratio of shape with composite algo

The layout node has alg=composite, then a parTx and a desTx child layout
nodes. No matter what order is used (parent first, child first), the
result will be wrong, as the constraints refer to each other. I did not
spot any description in ISO 29500-1 that would describe what is the
expected behavior.

Researching this, found "One other consideration when specifying
composite constraints is that the constraints must be specified in the
same order as the nested layout nodes." at

,
which suggests to handle constraints for each shape in a parent -> child
order, but keep a shared state when iterating over the children which
gives us:

- parent node, all direct constraints
- for each child node:
  - child's constraints from parent
  - child's own constraints

This way the desTx top value can depend on the parTx's height, and it's
supported to define parTx's height only in the parTx layout node, not in
the composite parent.

And after all, it matches what PowerPoint does, so the column headings
in the bugdoc have a 4:10 height:width aspect ratio.

(cherry picked from commit 414586649582e182b2603702f4f586f4beeed8a9)

Change-Id: Ideb76c1ddd18d2a217cddf81106d1bb97eb9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95016
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 0832bb1bfe7b..33f858386999 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -430,6 +430,42 @@ sal_Int32 AlgAtom::getVerticalShapesCount(const ShapePtr& 
rShape)
 return nCount;
 }
 
+namespace
+{
+/**
+ * Apply rConstraint to the rProperties shared layout state.
+ *
+ * Note that the order in which constraints are applied matters, given that 
constraints can refer to
+ * each other, and in case A depends on B and A is applied before B, the 
effect of A won't be
+ * updated when B is applied.
+ */
+void ApplyConstraintToLayout(const Constraint& rConstraint, LayoutPropertyMap& 
rProperties)
+{
+const LayoutPropertyMap::const_iterator aRef = 
rProperties.find(rConstraint.msRefForName);
+if (aRef != rProperties.end())
+{
+const LayoutProperty::const_iterator aRefType = 
aRef->second.find(rConstraint.mnRefType);
+if (aRefType != aRef->second.end())
+rProperties[rConstraint.msForName][rConstraint.mnType]
+= aRefType->second * rConstraint.mfFactor;
+else
+{
+// Values are never in EMU, while oox::drawingml::Shape position 
and size are always in
+// EMU.
+double fUnitFactor = 0;
+if (isFontUnit(rConstraint.mnRefType))
+// Points -> EMU.
+fUnitFactor = EMU_PER_PT;
+else
+// Millimeters -> EMU.
+fUnitFactor = EMU_PER_HMM * 100;
+rProperties[rConstraint.msForName][rConstraint.mnType]
+= rConstraint.mfValue * fUnitFactor;
+}
+}
+}
+}
+
 void AlgAtom::layoutShape( const ShapePtr& rShape,
const std::vector& rConstraints )
 {
@@ -467,31 +503,74 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
 
 for (const auto & rConstr : rConstraints)
 {
-const LayoutPropertyMap::const_iterator aRef = 
aProperties.find(rConstr.msRefForName);
-if (aRef != aProperties.end())
+// Apply direct constraints for all layout nodes.
+ApplyConstraintToLayout(rConstr, aProperties);
+}
+
+for (auto& aCurrShape : rShape->getChildren())
+{
+// Apply constraints from the current layout node for this 
child shape.
+// Previous child shapes may have changed aProperties.
+for (const auto& rConstr : rConstraints)
 {
-const LayoutProperty::const_iterator aRefType = 
aRef->second.find(rConstr.mnRefType);
-if (aRefType != aRef->second.end())
-aProperties[rConstr.msForName][rConstr.mnType] = 
aRefType->second * rConstr.mfFactor;
-  

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

2020-05-01 Thread Xisco Fauli (via logerrit)
 oox/source/ppt/pptshape.cxx |4 +---
 sd/qa/unit/data/pptx/tdf132282.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   14 ++
 3 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 7df4ebf9a658681d02842b14187722ae8161cd7e
Author: Xisco Fauli 
AuthorDate: Tue Apr 28 14:42:29 2020 +0200
Commit: Thorsten Behrens 
CommitDate: Fri May 1 17:57:07 2020 +0200

tdf#132282: Revert fix for tdf#131554

912217285b3058efa54c2336f91fda4efdad6ff0 fixed the
root cause of tdf#131554 and
69b83dc2d3014dd9b18402534e15c937dc082464 is no longer needed
The unittest still passes

Change-Id: I7c723b0c3cc2b56022978bbeb8bf6b3f6f93f1c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93063
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93073
Reviewed-by: Thorsten Behrens 

diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 440103acff12..af7324485c65 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -424,7 +424,6 @@ namespace
 // 3. ph with nSecondSubType and the same oSubTypeIndex
 // 4. ph with nSecondSubType
 // 5. ph with the same oSubTypeIndex
-// It appears 3 and 1 has the same highest prority.
 
 oox::drawingml::ShapePtr PPTShape::findPlaceholder( sal_Int32 nFirstSubType, 
sal_Int32 nSecondSubType,
 const OptValue< sal_Int32 >& oSubTypeIndex, std::vector< 
oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly )
@@ -516,8 +515,7 @@ oox::drawingml::ShapePtr PPTShape::findPlaceholder( 
sal_Int32 nFirstSubType, sal
 }
 }
 
-if (aPlaceholders.hasByPrio(0) ||
-aPlaceholders.hasByPrio(2))
+if (aPlaceholders.hasByPrio(0))
 {
 break;
 }
diff --git a/sd/qa/unit/data/pptx/tdf132282.pptx 
b/sd/qa/unit/data/pptx/tdf132282.pptx
new file mode 100644
index ..cc1d7df4cd8f
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf132282.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index f12ad87e9abc..6bac3cca9584 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -184,6 +184,7 @@ public:
 void testTdf98603();
 void testTdf119087();
 void testTdf131554();
+void testTdf132282();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -286,6 +287,7 @@ public:
 CPPUNIT_TEST(testTdf98603);
 CPPUNIT_TEST(testTdf119087);
 CPPUNIT_TEST(testTdf131554);
+CPPUNIT_TEST(testTdf132282);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2653,6 +2655,18 @@ void SdOOXMLExportTest2::testTdf131554()
 CPPUNIT_ASSERT_EQUAL(static_cast(13251), 
xShape->getPosition().Y);
 }
 
+void SdOOXMLExportTest2::testTdf132282()
+{
+::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf132282.pptx"), 
PPTX);
+xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
+uno::Reference xShape(getShapeFromPage(0, 0, xDocShRef), 
uno::UNO_QUERY);
+// Without the fix in place, the position would be 0,0, height = 1 and 
width = 1
+CPPUNIT_ASSERT_EQUAL(static_cast(1736), 
xShape->getPosition().X);
+CPPUNIT_ASSERT_EQUAL(static_cast(763), xShape->getPosition().Y);
+CPPUNIT_ASSERT_EQUAL(static_cast(30523), 
xShape->getSize().Width);
+CPPUNIT_ASSERT_EQUAL(static_cast(2604), 
xShape->getSize().Height);
+}
+
 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-6-4' - oox/source sd/qa

2020-04-29 Thread Samuel Mehrbrodt (via logerrit)
 oox/source/core/xmlfilterbase.cxx   |3 ++-
 sd/qa/unit/data/pptx/tdf119087.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |9 +
 3 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 68f75fe0701fcf9b92c5f1b5fd5eeb9268297494
Author: Samuel Mehrbrodt 
AuthorDate: Tue Apr 28 13:05:55 2020 +0200
Commit: Michael Stahl 
CommitDate: Wed Apr 29 09:53:47 2020 +0200

tdf#119087 Don't treat OOXML strict namespace as custom XML

Change-Id: I5037ac09f57c92e02e330cbc906da3afbe4c747c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93056
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit 9be543a27ab18427a1c4e66a70cc49b0332b6aa1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93128
Reviewed-by: Michael Stahl 

diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 5808fdc6f234..2cc1daa54b04 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -992,7 +992,8 @@ void 
XmlFilterBase::importCustomFragments(css::uno::Referencehttp://schemas.openxmlformats.org;))
+if (!sType.match("http://schemas.openxmlformats.org;) // 
OOXML/ECMA Transitional
+&& !sType.match("http://purl.oclc.org;)) // OOXML Strict
 {
 StreamDataSequence aDataSeq;
 if (importBinaryData(aDataSeq, sTarget))
diff --git a/sd/qa/unit/data/pptx/tdf119087.pptx 
b/sd/qa/unit/data/pptx/tdf119087.pptx
new file mode 100644
index ..d70bc8b0d4ff
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf119087.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index d0ef2dac0eb7..f12ad87e9abc 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -182,6 +182,7 @@ public:
 void testTdf127372();
 void testTdf127379();
 void testTdf98603();
+void testTdf119087();
 void testTdf131554();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -283,6 +284,7 @@ public:
 CPPUNIT_TEST(testTdf127372);
 CPPUNIT_TEST(testTdf127379);
 CPPUNIT_TEST(testTdf98603);
+CPPUNIT_TEST(testTdf119087);
 CPPUNIT_TEST(testTdf131554);
 
 CPPUNIT_TEST_SUITE_END();
@@ -2635,6 +2637,13 @@ void SdOOXMLExportTest2::testTdf98603()
 CPPUNIT_ASSERT_EQUAL(OUString("IL"), aLocale.Country);
 }
 
+void SdOOXMLExportTest2::testTdf119087()
+{
+::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf119087.pptx"), 
PPTX);
+xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
+// This would fail both on export validation, and reloading the saved pptx 
file.
+}
+
 void SdOOXMLExportTest2::testTdf131554()
 {
 ::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf131554.pptx"), 
PPTX);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-04-23 Thread nd101 (via logerrit)
 oox/source/ppt/pptshape.cxx |  125 +++-
 sd/qa/unit/data/pptx/tdf119187.pptx |binary
 sd/qa/unit/import-tests.cxx |   27 +++
 3 files changed, 108 insertions(+), 44 deletions(-)

New commits:
commit 6ae88e7b2711321783fb756a4796c89b70497db5
Author: nd101 
AuthorDate: Wed Mar 25 13:17:48 2020 +0800
Commit: Thorsten Behrens 
CommitDate: Thu Apr 23 21:41:48 2020 +0200

tdf#119187 fix: Top-aligned text in PPTX becomes bottom-aligned

Change-Id: Ic6c03e512ce3f6e240d86186fb16e24c86942343
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92051
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92725

diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 39b0c2eb4abc..440103acff12 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -429,65 +429,102 @@ namespace
 oox::drawingml::ShapePtr PPTShape::findPlaceholder( sal_Int32 nFirstSubType, 
sal_Int32 nSecondSubType,
 const OptValue< sal_Int32 >& oSubTypeIndex, std::vector< 
oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly )
 {
-oox::drawingml::ShapePtr aShapePtr;
-oox::drawingml::ShapePtr aChoiceShapePtr1;
-oox::drawingml::ShapePtr aChoiceShapePtr2;
-oox::drawingml::ShapePtr aChoiceShapePtr3;
-oox::drawingml::ShapePtr aChoiceShapePtr4;
-std::vector< oox::drawingml::ShapePtr >::reverse_iterator aRevIter( 
rShapes.rbegin() );
-while (aRevIter != rShapes.rend())
+class Placeholders
 {
-if (!bMasterOnly || ShapeLocationIsMaster((*aRevIter).get()))
+public:
+Placeholders()
+: aChoice(5) // resize to 5
 {
-if ((*aRevIter)->getSubTypeIndex() == oSubTypeIndex)
+}
+
+void add(const oox::drawingml::ShapePtr& aShape, sal_Int32 
nFirstSubType, sal_Int32 nSecondSubType, const OptValue< sal_Int32 >& 
oSubTypeIndex)
+{
+if (!aShape.get())
+return;
+
+// get flags
+const bool bSameFirstSubType = aShape->getSubType() == 
nFirstSubType;
+const bool bSameSecondSubType = aShape->getSubType() == 
nSecondSubType;
+const bool bSameIndex = aShape->getSubTypeIndex() == oSubTypeIndex;
+
+// get prio
+int aPrioIndex = -1;
+if (bSameIndex && bSameFirstSubType)
+aPrioIndex = 0;
+else if (!bSameIndex && bSameFirstSubType)
+aPrioIndex = 1;
+else if (bSameIndex && bSameSecondSubType)
+aPrioIndex = 2;
+else if (!bSameIndex && bSameSecondSubType)
+aPrioIndex = 3;
+else if (bSameIndex)
+aPrioIndex = 4;
+
+// add
+if (aPrioIndex != -1)
 {
-if ((*aRevIter)->getSubType() == nFirstSubType)
+if (!aChoice.at(aPrioIndex).get())
 {
-aShapePtr = *aRevIter;
-break;
+aChoice.at(aPrioIndex) = aShape;
 }
-else if ((*aRevIter)->getSubType() == nSecondSubType && 
!aChoiceShapePtr2.get())
-aChoiceShapePtr2 = *aRevIter;
-else if (!aChoiceShapePtr4.get())
-aChoiceShapePtr4 = *aRevIter;
 }
-else if ((*aRevIter)->getSubType() == nFirstSubType && 
!aChoiceShapePtr1.get())
-aChoiceShapePtr1 = *aRevIter;
-else if ((*aRevIter)->getSubType() == nSecondSubType && 
!aChoiceShapePtr3.get())
-aChoiceShapePtr3 = *aRevIter;
 }
-std::vector< oox::drawingml::ShapePtr >& rChildren = 
(*aRevIter)->getChildren();
-aChoiceShapePtr4 = findPlaceholder( nFirstSubType, nSecondSubType, 
oSubTypeIndex, rChildren, bMasterOnly );
-if (aChoiceShapePtr4.get())
+
+// return according to prio
+oox::drawingml::ShapePtr getByPrio() const
 {
-if (aChoiceShapePtr4->getSubType() == nFirstSubType)
+for (const oox::drawingml::ShapePtr& aShape : aChoice)
 {
-if (aChoiceShapePtr4->getSubTypeIndex() == oSubTypeIndex)
-aShapePtr = aChoiceShapePtr4;
-else
-aChoiceShapePtr1 = aChoiceShapePtr4;
+if (aShape.get())
+{
+return aShape;
+}
 }
-else if (aChoiceShapePtr4->getSubType() == nSecondSubType)
+
+return oox::drawingml::ShapePtr();
+}
+
+bool hasByPrio(size_t aIndex) const
+{
+return aChoice.at(aIndex).get();
+}
+
+private:
+std::vector< oox::drawingml::ShapePtr > aChoice;
+
+} aPlaceholders;
+
+// check all shapes
+std::vector< oox::drawingml::ShapePtr >::reverse_iterator aRevIter( 

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

2020-04-02 Thread nd101 (via logerrit)
 oox/source/ppt/pptshape.cxx |4 +++-
 sd/qa/unit/data/pptx/tdf131554.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   11 +++
 3 files changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 55d423e8f371e914c51f9aa18aacede46355b133
Author: nd101 
AuthorDate: Wed Mar 25 13:17:48 2020 +0800
Commit: Thorsten Behrens 
CommitDate: Thu Apr 2 21:40:50 2020 +0200

tdf#131554 placeholder iteration fails to stop when a match is found

Wrong placeholder is returned due to iteration not stopping
when a match is found. It causes a text element position
to be incorrectly set.

Change-Id: I58be6825cec7a61f48b46418bdf28964c1afe4ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91023
Reviewed-by: Xisco Faulí 
Reviewed-by: Michael Stahl 
Tested-by: Jenkins
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91472
Reviewed-by: Thorsten Behrens 

diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 0088c1e51673..39b0c2eb4abc 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -424,6 +424,8 @@ namespace
 // 3. ph with nSecondSubType and the same oSubTypeIndex
 // 4. ph with nSecondSubType
 // 5. ph with the same oSubTypeIndex
+// It appears 3 and 1 has the same highest prority.
+
 oox::drawingml::ShapePtr PPTShape::findPlaceholder( sal_Int32 nFirstSubType, 
sal_Int32 nSecondSubType,
 const OptValue< sal_Int32 >& oSubTypeIndex, std::vector< 
oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly )
 {
@@ -473,7 +475,7 @@ oox::drawingml::ShapePtr PPTShape::findPlaceholder( 
sal_Int32 nFirstSubType, sal
 aChoiceShapePtr3 = aChoiceShapePtr4;
 }
 }
-if (aShapePtr.get())
+if (aShapePtr.get() || aChoiceShapePtr2.get())
 break;
 ++aRevIter;
 }
diff --git a/sd/qa/unit/data/pptx/tdf131554.pptx 
b/sd/qa/unit/data/pptx/tdf131554.pptx
new file mode 100644
index ..a65f423add39
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf131554.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 78452a763f01..d0ef2dac0eb7 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -182,6 +182,7 @@ public:
 void testTdf127372();
 void testTdf127379();
 void testTdf98603();
+void testTdf131554();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -282,6 +283,7 @@ public:
 CPPUNIT_TEST(testTdf127372);
 CPPUNIT_TEST(testTdf127379);
 CPPUNIT_TEST(testTdf98603);
+CPPUNIT_TEST(testTdf131554);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2633,6 +2635,15 @@ void SdOOXMLExportTest2::testTdf98603()
 CPPUNIT_ASSERT_EQUAL(OUString("IL"), aLocale.Country);
 }
 
+void SdOOXMLExportTest2::testTdf131554()
+{
+::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf131554.pptx"), 
PPTX);
+xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
+uno::Reference xShape(getShapeFromPage(1, 0, xDocShRef), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(static_cast(5622), 
xShape->getPosition().X);
+CPPUNIT_ASSERT_EQUAL(static_cast(13251), 
xShape->getPosition().Y);
+}
+
 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-6-4' - oox/source sd/qa

2020-02-23 Thread Gülşah Köse (via logerrit)
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |   12 +---
 sd/qa/unit/import-tests-smartart.cxx|   19 +++
 2 files changed, 24 insertions(+), 7 deletions(-)

New commits:
commit 73cac1031131021819a0fbd4d60554196aea230c
Author: Gülşah Köse 
AuthorDate: Thu Feb 20 14:13:40 2020 +0300
Commit: Gülşah Köse 
CommitDate: Mon Feb 24 08:23:59 2020 +0100

tdf130839: Corrects second level left margin in Smartart

Change-Id: Ifec339759427336fd53012e0a8a906d240be9654
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89085
Tested-by: Jenkins
Reviewed-by: Gülşah Köse 
(cherry picked from commit eeaa7aba6e7ace8b69d7056645b15be2f996d8fb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89277

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 14af84da6ac4..1b6a821f3a0a 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -1224,10 +1224,16 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
 aParagraph->getProperties().setLevel(nLevel);
 if (nLevel >= nStartBulletsAtLevel)
 {
+if 
(!aParagraph->getProperties().getParaLeftMargin().has_value())
+{
+sal_Int32 nLeftMargin = 285750 * (nLevel - 
nStartBulletsAtLevel + 1) / EMU_PER_HMM;
+aParagraph->getProperties().getParaLeftMargin() = 
nLeftMargin;
+}
+
+if 
(!aParagraph->getProperties().getFirstLineIndentation().has_value())
+aParagraph->getProperties().getFirstLineIndentation() 
= -285750 / EMU_PER_HMM;
+
 // It is not possible to change the bullet style for text.
-sal_Int32 nLeftMargin = 285750 * (nLevel - 
nStartBulletsAtLevel + 1) / EMU_PER_HMM;
-aParagraph->getProperties().getParaLeftMargin() = 
nLeftMargin;
-aParagraph->getProperties().getFirstLineIndentation() = 
-285750 / EMU_PER_HMM;
 OUString aBulletChar = OUString::fromUtf8(u8"•");
 
aParagraph->getProperties().getBulletList().setBulletChar(aBulletChar);
 
aParagraph->getProperties().getBulletList().setSuffixNone();
diff --git a/sd/qa/unit/import-tests-smartart.cxx 
b/sd/qa/unit/import-tests-smartart.cxx
index 2d47381c4e67..d14c4bc6950a 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -101,7 +101,7 @@ public:
 void testFontSize();
 void testVerticalBlockList();
 void testBulletList();
-void testMissingBullet();
+void testMissingBulletAndIndent();
 void testRecursion();
 void testDataFollow();
 void testOrgChart2();
@@ -145,7 +145,7 @@ public:
 CPPUNIT_TEST(testFontSize);
 CPPUNIT_TEST(testVerticalBlockList);
 CPPUNIT_TEST(testBulletList);
-CPPUNIT_TEST(testMissingBullet);
+CPPUNIT_TEST(testMissingBulletAndIndent);
 CPPUNIT_TEST(testRecursion);
 CPPUNIT_TEST(testDataFollow);
 CPPUNIT_TEST(testOrgChart2);
@@ -1277,7 +1277,7 @@ void SdImportTestSmartArt::testVerticalBlockList()
 xDocShRef->DoClose();
 }
 
-void SdImportTestSmartArt::testMissingBullet()
+void SdImportTestSmartArt::testMissingBulletAndIndent()
 {
 sd::DrawDocShellRef xDocShRef = loadURL(
 
m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-missing-bullet.pptx"),
@@ -1297,8 +1297,19 @@ void SdImportTestSmartArt::testMissingBullet()
 
 sal_Int16 nNumberingLevel = -1;
 xPara1->getPropertyValue("NumberingLevel")>>= nNumberingLevel;
-
 CPPUNIT_ASSERT_EQUAL(sal_Int16(1), nNumberingLevel);
+
+uno::Reference< container::XIndexAccess > xNumRule;
+xPara1->getPropertyValue("NumberingRules") >>= xNumRule;
+uno::Sequence aBulletProps;
+xNumRule->getByIndex(1) >>= aBulletProps;
+
+for (int i = 0; i < aBulletProps.getLength(); ++i)
+{
+const beans::PropertyValue& rProp = aBulletProps[i];
+if(rProp.Name == "LeftMargin")
+CPPUNIT_ASSERT_EQUAL(sal_Int32(309), rProp.Value.get());
+}
 }
 
 void SdImportTestSmartArt::testBulletList()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-02-21 Thread Gülşah Köse (via logerrit)
 oox/source/drawingml/textparagraphproperties.cxx  |3 ++
 sd/qa/unit/data/pptx/smartart-missing-bullet.pptx |binary
 sd/qa/unit/import-tests-smartart.cxx  |   26 ++
 3 files changed, 29 insertions(+)

New commits:
commit 9ed15a8f5e9a7f4de190499fbfc1fa9a4ff26c67
Author: Gülşah Köse 
AuthorDate: Wed Feb 19 09:08:45 2020 +0300
Commit: Gülşah Köse 
CommitDate: Fri Feb 21 12:00:17 2020 +0100

tdf#130776 Show the bullet on second level in smartart.

Change-Id: Ie35867862d30d490a97dc6f245b50c7311dafe50
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88993
Tested-by: Jenkins
Reviewed-by: Gülşah Köse 
(cherry picked from commit 7865c662a4fdc9dc07f59d6ecd76b9c56d0020ae)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88962

diff --git a/oox/source/drawingml/textparagraphproperties.cxx 
b/oox/source/drawingml/textparagraphproperties.cxx
index f1c966deeaa4..9183c2f53e64 100644
--- a/oox/source/drawingml/textparagraphproperties.cxx
+++ b/oox/source/drawingml/textparagraphproperties.cxx
@@ -396,7 +396,10 @@ void TextParagraphProperties::pushToPropSet( const 
::oox::core::XmlFilterBase* p
 
 sal_Int32 nNumberingType = NumberingType::NUMBER_NONE;
 if ( maBulletList.mnNumberingType.hasValue() )
+{
 maBulletList.mnNumberingType >>= nNumberingType;
+aPropSet.setProperty< sal_Int16 >( PROP_NumberingLevel, getLevel() );
+}
 else if ( pMasterBuList && pMasterBuList->mnNumberingType.hasValue() )
 pMasterBuList->mnNumberingType >>= nNumberingType;
 if ( nNumberingType == NumberingType::NUMBER_NONE )
diff --git a/sd/qa/unit/data/pptx/smartart-missing-bullet.pptx 
b/sd/qa/unit/data/pptx/smartart-missing-bullet.pptx
new file mode 100644
index ..2917875a005a
Binary files /dev/null and b/sd/qa/unit/data/pptx/smartart-missing-bullet.pptx 
differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx 
b/sd/qa/unit/import-tests-smartart.cxx
index a55e340e3ec4..2d47381c4e67 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -101,6 +101,7 @@ public:
 void testFontSize();
 void testVerticalBlockList();
 void testBulletList();
+void testMissingBullet();
 void testRecursion();
 void testDataFollow();
 void testOrgChart2();
@@ -144,6 +145,7 @@ public:
 CPPUNIT_TEST(testFontSize);
 CPPUNIT_TEST(testVerticalBlockList);
 CPPUNIT_TEST(testBulletList);
+CPPUNIT_TEST(testMissingBullet);
 CPPUNIT_TEST(testRecursion);
 CPPUNIT_TEST(testDataFollow);
 CPPUNIT_TEST(testOrgChart2);
@@ -1275,6 +1277,30 @@ void SdImportTestSmartArt::testVerticalBlockList()
 xDocShRef->DoClose();
 }
 
+void SdImportTestSmartArt::testMissingBullet()
+{
+sd::DrawDocShellRef xDocShRef = loadURL(
+
m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-missing-bullet.pptx"),
+PPTX);
+uno::Reference xGroup(getShapeFromPage(0, 0, xDocShRef), 
uno::UNO_QUERY);
+uno::Reference xGroup1(xGroup->getByIndex(2), 
uno::UNO_QUERY);
+uno::Reference xGroup2(xGroup1->getByIndex(0), 
uno::UNO_QUERY);
+uno::Reference xText(xGroup2->getByIndex(0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xText.is());
+
+uno::Reference xParasAccess(xText, 
uno::UNO_QUERY);
+uno::Reference xParas = 
xParasAccess->createEnumeration();
+xParas->nextElement();// skip parent
+
+uno::Reference xPara1(xParas->nextElement(), 
uno::UNO_QUERY);
+CPPUNIT_ASSERT(xPara1.is());
+
+sal_Int16 nNumberingLevel = -1;
+xPara1->getPropertyValue("NumberingLevel")>>= nNumberingLevel;
+
+CPPUNIT_ASSERT_EQUAL(sal_Int16(1), nNumberingLevel);
+}
+
 void SdImportTestSmartArt::testBulletList()
 {
 sd::DrawDocShellRef xDocShRef = loadURL(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2019-11-28 Thread Tamas Bunth (via logerrit)
 oox/source/drawingml/shape.cxx  |2 +-
 sd/qa/unit/data/pptx/tdf113198.pptx |binary
 sd/qa/unit/import-tests.cxx |   14 +-
 3 files changed, 14 insertions(+), 2 deletions(-)

New commits:
commit af6e4633ca12bc2f08db1e86d77847b7793d5791
Author: Tamas Bunth 
AuthorDate: Tue Nov 19 12:38:56 2019 +0100
Commit: Xisco Faulí 
CommitDate: Thu Nov 28 12:07:42 2019 +0100

tdf#113198 set default shape paragraph alignment..

to center when importing oox document.

Using MS Office, the default aligment of a (text) paragraph
inside a shape is centered.

Change-Id: Id9bcaaab109df65f4124f733b2cfee438e82b79b
Reviewed-on: https://gerrit.libreoffice.org/83193
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit 89f0af144c18efafe2573801641689a1432c0cae)
Reviewed-on: https://gerrit.libreoffice.org/83971
Reviewed-by: Xisco Faulí 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 4e574af50869..f1da411ec4af 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -214,7 +214,7 @@ void Shape::setDefaults(bool bHeight)
 if (bHeight)
 maDefaultShapeProperties.setProperty(PROP_CharHeight, static_cast< 
float >( 18.0 ));
 maDefaultShapeProperties.setProperty(PROP_TextVerticalAdjust, 
TextVerticalAdjust_TOP);
-maDefaultShapeProperties.setProperty(PROP_ParaAdjust, static_cast< 
sal_Int16 >( ParagraphAdjust_LEFT )); // check for RTL?
+maDefaultShapeProperties.setProperty(PROP_ParaAdjust, static_cast< 
sal_Int16 >( ParagraphAdjust_CENTER ));
 }
 
 ::oox::vml::OleObjectInfo& Shape::setOleObjectType()
diff --git a/sd/qa/unit/data/pptx/tdf113198.pptx 
b/sd/qa/unit/data/pptx/tdf113198.pptx
new file mode 100755
index ..a541a2b2647d
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf113198.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 3b50bce311ad..025b53077405 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -213,6 +213,7 @@ public:
 void testCropToShape();
 void testTdf127964();
 void testTdf106638();
+void testTdf113198();
 
 CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -313,6 +314,7 @@ public:
 CPPUNIT_TEST(testTdf127964);
 CPPUNIT_TEST(testTdf106638);
 CPPUNIT_TEST(testTdf128684);
+CPPUNIT_TEST(testTdf113198);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -3008,7 +3010,6 @@ void SdImportTest::testTdf106638()
 CPPUNIT_ASSERT(aCharFontName != "Wingdings");
 }
 
-
 void SdImportTest::testTdf128684()
 {
 sd::DrawDocShellRef xDocShRef
@@ -3035,6 +3036,17 @@ void SdImportTest::testTdf128684()
 CPPUNIT_ASSERT_EQUAL(static_cast(-90), nRotateAngle);
 }
 
+void SdImportTest::testTdf113198()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf113198.pptx"), 
PPTX);
+
+uno::Reference xShape(getShapeFromPage(0, 0, 
xDocShRef));
+sal_Int16 nParaAdjust = -1;
+xShape->getPropertyValue("ParaAdjust") >>= nParaAdjust;
+CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, 
static_cast(nParaAdjust));
+}
+
 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-6-4' - oox/source sd/qa

2019-11-27 Thread Gülşah Köse (via logerrit)
 oox/source/export/drawingml.cxx|   13 -
 sd/qa/unit/data/pptx/tdf127090.odp |binary
 sd/qa/unit/export-tests-ooxml1.cxx |   14 ++
 3 files changed, 22 insertions(+), 5 deletions(-)

New commits:
commit 5b5f58f395d1b6c1d007dcc6dc29535c5678f851
Author: Gülşah Köse 
AuthorDate: Wed Nov 27 13:35:29 2019 +0300
Commit: Gülşah Köse 
CommitDate: Thu Nov 28 08:47:07 2019 +0100

tdf#127090 Export textbox rotation attribute.

In case "rotated textbox in a custom shape" handle
draw:text-rotate-angle attribute while exporting
ODP to PPTX.

Change-Id: I13b99da586af5e77e51a7cc93a751ab21bed7170
Reviewed-on: https://gerrit.libreoffice.org/83888
Tested-by: Jenkins
Reviewed-by: Gülşah Köse 
(cherry picked from commit 9b2f5d27cf0a0adcced813e18108d5878061d1ee)
Reviewed-on: https://gerrit.libreoffice.org/83950

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 6ca1e78d3dfb..d844d6f8242b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2644,7 +2644,8 @@ void DrawingML::WriteText( const Reference< XInterface >& 
rXIface, const OUStrin
 if( !xXText.is() )
 return;
 
-sal_Int32 nTextRotateAngle = 0;
+sal_Int32 nTextPreRotateAngle = 0;
+double nTextRotateAngle = 0;
 bool bIsFontworkShape(presetWarp.startsWith("text") && (presetWarp != 
"textNoShape"));
 
 #define DEFLRINS 254
@@ -2695,14 +2696,14 @@ void DrawingML::WriteText( const Reference< XInterface 
>& rXIface, const OUStrin
 {
 for ( const auto& rProp : std::as_const(aProps) )
 {
-if ( rProp.Name == "TextPreRotateAngle" && ( rProp.Value >>= 
nTextRotateAngle ) )
+if ( rProp.Name == "TextPreRotateAngle" && ( rProp.Value >>= 
nTextPreRotateAngle ) )
 {
-if ( nTextRotateAngle == -90 )
+if ( nTextPreRotateAngle == -90 )
 {
 sWritingMode = "vert";
 bVertical = true;
 }
-else if ( nTextRotateAngle == -270 )
+else if ( nTextPreRotateAngle == -270 )
 {
 sWritingMode = "vert270";
 bVertical = true;
@@ -2712,6 +2713,8 @@ void DrawingML::WriteText( const Reference< XInterface >& 
rXIface, const OUStrin
 }
 else if (rProp.Name == "AdjustmentValues")
 rProp.Value >>= aAdjustmentSeq;
+else if( rProp.Name == "TextRotateAngle" )
+rProp.Value >>= nTextRotateAngle;
 else if (rProp.Name == "TextPath")
 {
 rProp.Value >>= aTextPathSeq;
@@ -2769,7 +2772,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 
);
+   XML_rot, ((nTextPreRotateAngle + 
nTextRotateAngle) != 0) ? oox::drawingml::calcRotationValue( 
(nTextPreRotateAngle + nTextRotateAngle) * 100 ).getStr() : nullptr );
 if (bIsFontworkShape)
 {
 if (aAdjustmentSeq.hasElements())
diff --git a/sd/qa/unit/data/pptx/tdf127090.odp 
b/sd/qa/unit/data/pptx/tdf127090.odp
new file mode 100644
index ..bbdc7995853f
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf127090.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index ddc41b563c99..79b18b7cb914 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -81,6 +81,7 @@ public:
 void testTdf111884();
 void testTdf112633();
 void testTdf128952();
+void testTdf127090();
 void testCustomXml();
 void testTdf94238();
 void testPictureTransparency();
@@ -118,6 +119,7 @@ public:
 CPPUNIT_TEST(testTdf111884);
 CPPUNIT_TEST(testTdf112633);
 CPPUNIT_TEST(testTdf128952);
+CPPUNIT_TEST(testTdf127090);
 CPPUNIT_TEST(testCustomXml);
 CPPUNIT_TEST(testTdf94238);
 CPPUNIT_TEST(testTdf125554);
@@ -829,6 +831,18 @@ void SdOOXMLExportTest1::testTdf128952()
 assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm/a:ext", 
"cy", "1462680");
 }
 
+void SdOOXMLExportTest1::testTdf127090()
+{
+::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf127090.odp"), ODP);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocPtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml");
+

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

2019-11-22 Thread Gülşah Köse (via logerrit)
 oox/source/export/drawingml.cxx |2 +-
 sd/qa/unit/data/pptx/tdf128952.pptx |binary
 sd/qa/unit/export-tests-ooxml1.cxx  |   17 +
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit be2a1c28573bb6de0def84b69c15f1079b76bdb5
Author: Gülşah Köse 
AuthorDate: Fri Nov 22 14:05:24 2019 +0300
Commit: Andras Timar 
CommitDate: Fri Nov 22 23:18:37 2019 +0100

tdf#128952 Set the position of shape for 180 deg.

If the rotation value is 180, 540, 900... degree with mirror
pShape->GetRotateAngle() returns 0. In that control 0 means
no rotation but that is not true. For that cases (180, 540, 900)
after the angle conversition GetRotateAngle() returns 0. We should
recalculate the position for 0 too.

Change-Id: I14e981235b2d6cd8382d4c9e151bccd2e73a3fd9
Reviewed-on: https://gerrit.libreoffice.org/83468
Tested-by: Jenkins
Reviewed-by: Gülşah Köse 
(cherry picked from commit aca2e4d270f472b2cbdb9084a55f1855529ea705)
Reviewed-on: https://gerrit.libreoffice.org/83534
Reviewed-by: Andras Timar 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 2cc160d05b57..6ca1e78d3dfb 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1647,7 +1647,7 @@ void DrawingML::WriteShapeTransformation( const 
Reference< XShape >& rXShape, sa
 {
 SdrObject* pShape = GetSdrObjectFromXShape( rXShape );
 nRotation = pShape ? pShape->GetRotateAngle() : 0;
-if ( nRotation != 0 && GetDocumentType() != DOCUMENT_DOCX )
+if ( GetDocumentType() != DOCUMENT_DOCX )
 {
 int faccos=bFlipV ? -1 : 1;
 int facsin=bFlipH ? -1 : 1;
diff --git a/sd/qa/unit/data/pptx/tdf128952.pptx 
b/sd/qa/unit/data/pptx/tdf128952.pptx
new file mode 100644
index ..242a3ee9ace5
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf128952.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index 05d7d3aff31b..ddc41b563c99 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -80,6 +80,7 @@ public:
 void testParaMarginAndindentation();
 void testTdf111884();
 void testTdf112633();
+void testTdf128952();
 void testCustomXml();
 void testTdf94238();
 void testPictureTransparency();
@@ -116,6 +117,7 @@ public:
 CPPUNIT_TEST(testParaMarginAndindentation);
 CPPUNIT_TEST(testTdf111884);
 CPPUNIT_TEST(testTdf112633);
+CPPUNIT_TEST(testTdf128952);
 CPPUNIT_TEST(testCustomXml);
 CPPUNIT_TEST(testTdf94238);
 CPPUNIT_TEST(testTdf125554);
@@ -812,6 +814,21 @@ void SdOOXMLExportTest1::testTdf112633()
 CPPUNIT_ASSERT_EQUAL(true, 
bool(xNameAccess->hasByName("ppt/media/hdphoto1.wdp")));
 }
 
+void SdOOXMLExportTest1::testTdf128952()
+{
+::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf128952.pptx"), 
PPTX);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocPtr pXmlDoc = parseExport(tempFile, "ppt/slides/slide1.xml");
+
+assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm/a:off", 
"x", "360");
+assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm/a:off", 
"y", "-360");
+assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm/a:ext", 
"cx", "1919880");
+assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:spPr/a:xfrm/a:ext", 
"cy", "1462680");
+}
+
 void SdOOXMLExportTest1::testCustomXml()
 {
 // Load document and export it to a temporary file
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-11-17 Thread Tamas Bunth (via logerrit)
 oox/source/drawingml/customshapeproperties.cxx |2 +
 sd/qa/unit/data/pptx/tdf128684.pptx|binary
 sd/qa/unit/import-tests.cxx|   29 +
 3 files changed, 31 insertions(+)

New commits:
commit c2097477e3a43d75c170a6f7a5daf5dcb2169329
Author: Tamas Bunth 
AuthorDate: Thu Nov 14 00:56:08 2019 +0100
Commit: Andras Timar 
CommitDate: Sun Nov 17 16:15:04 2019 +0100

tdf128684: Rotate text in not preset custom shape

The TextPreRotateAngle property should be set in case of a not preset
custom shape as well during ooxml import.

Also add unit test for testing the TextPreRotateAngle property.

Change-Id: Ib5b822286f8a78fe8398bf7e2014a36d7e0a24d5
Reviewed-on: https://gerrit.libreoffice.org/82643
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit 742f59eaa38a3f13b6110573b1428de45c55b035)
Reviewed-on: https://gerrit.libreoffice.org/83020
Reviewed-by: Andras Timar 

diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index df878d39eec3..2f4848088cc4 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -230,6 +230,8 @@ void CustomShapeProperties::pushToPropSet(
 aPropertyMap.setProperty( PROP_Type, OUString( "ooxml-non-primitive" 
));
 aPropertyMap.setProperty( PROP_MirroredX, mbMirroredX );
 aPropertyMap.setProperty( PROP_MirroredY, mbMirroredY );
+if( mnTextRotateAngle )
+aPropertyMap.setProperty( PROP_TextPreRotateAngle, 
mnTextRotateAngle );
 // Note 1: If Equations are defined - they are processed using 
internal div by 360 coordinates
 // while if they are not, standard ooxml coordinates are used.
 // This size specifically affects scaling.
diff --git a/sd/qa/unit/data/pptx/tdf128684.pptx 
b/sd/qa/unit/data/pptx/tdf128684.pptx
new file mode 100755
index ..80a5f30568d3
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf128684.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 191592bbc592..3b50bce311ad 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -196,6 +196,7 @@ public:
 void testTdf77747();
 void testTdf116266();
 void testTdf126324();
+void testTdf128684();
 
 bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, 
std::vector& rExpected);
 void testPatternImport();
@@ -311,6 +312,7 @@ public:
 CPPUNIT_TEST(testCropToShape);
 CPPUNIT_TEST(testTdf127964);
 CPPUNIT_TEST(testTdf106638);
+CPPUNIT_TEST(testTdf128684);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -3006,6 +3008,33 @@ void SdImportTest::testTdf106638()
 CPPUNIT_ASSERT(aCharFontName != "Wingdings");
 }
 
+
+void SdImportTest::testTdf128684()
+{
+sd::DrawDocShellRef xDocShRef
+= 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf128684.pptx"), 
PPTX);
+uno::Reference 
xDoc(xDocShRef->GetDoc()->getUnoModel(),
+ uno::UNO_QUERY);
+CPPUNIT_ASSERT(xDoc.is());
+uno::Reference 
xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
+CPPUNIT_ASSERT(xPage.is());
+uno::Reference xShape(getShape(0, xPage));
+CPPUNIT_ASSERT(xShape.is());
+uno::Any aAny = xShape->getPropertyValue("CustomShapeGeometry");
+CPPUNIT_ASSERT(aAny.hasValue());
+uno::Sequence aProps;
+CPPUNIT_ASSERT(aAny >>= aProps);
+sal_Int32 nRotateAngle = 0;
+for( const auto& rProp : std::as_const(aProps) )
+{
+if( rProp.Name == "TextPreRotateAngle")
+{
+rProp.Value >>= nRotateAngle;
+}
+}
+CPPUNIT_ASSERT_EQUAL(static_cast(-90), nRotateAngle);
+}
+
 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