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

2020-03-27 Thread nd101 (via logerrit)
 oox/source/drawingml/shape.cxx |   13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 8c0f424a131dbb2e5f82ec27362d5c3cbfc4b92d
Author: nd101 
AuthorDate: Wed Mar 25 13:43:32 2020 +0800
Commit: Michael Stahl 
CommitDate: Fri Mar 27 10:57:16 2020 +0100

tdf#131553 a null pointer crashes Impress

When constructing a shape object from property EmbeddedObject,
it may return null object. Check the returned value first.

Change-Id: I9d7a2d9c0c919007ae2a34a0af86dea5639b1bd6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91024
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit df1be683ab935fe5362750360508ba69eb415afb)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90959
Reviewed-by: Xisco Faulí 
(cherry picked from commit 3142872bcba19b6c4d60b464fc9b14293860348d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90962
Reviewed-by: Michael Stahl 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index e061902096f6..6336bd04652d 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -936,11 +936,14 @@ Reference< XShape > const & Shape::createAndInsert(
 xSet->setPropertyValue("CLSID", uno::makeAny(name.GetHexName()));
 uno::Reference const xObj(
 xSet->getPropertyValue("EmbeddedObject"), uno::UNO_QUERY);
-uno::Reference const 
xMathModel(xObj->getComponent());
-oox::FormulaImportBase *const pMagic(
-dynamic_cast(xMathModel.get()));
-assert(pMagic);
-pMagic->readFormulaOoxml(*pMathXml);
+if (xObj.is())
+{
+uno::Reference const 
xMathModel(xObj->getComponent());
+oox::FormulaImportBase *const pMagic(
+
dynamic_cast(xMathModel.get()));
+assert(pMagic);
+pMagic->readFormulaOoxml(*pMathXml);
+}
 }
 
 const GraphicHelper& rGraphicHelper = rFilterBase.getGraphicHelper();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-03-24 Thread Rico Tzschichholz (via logerrit)
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 4f75f6a7434bae5f11e1205130fee1b4ac2df50b
Author: Rico Tzschichholz 
AuthorDate: Fri Mar 20 07:51:53 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Mar 24 18:16:17 2020 +0100

Fix build with boost < 1.68

Follow-up fix for 73cac1031131021819a0fbd4d60554196aea230c
"tdf130839: Corrects second level left margin in Smartart"

Change-Id: Ie194062ba33cf505ad33fbfdc73c2f764b61d0aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90808
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 51b4c8c96472..f625dac2cd97 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -1224,13 +1224,13 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
 aParagraph->getProperties().setLevel(nLevel);
 if (nLevel >= nStartBulletsAtLevel)
 {
-if 
(!aParagraph->getProperties().getParaLeftMargin().has_value())
+if 
(aParagraph->getProperties().getParaLeftMargin().get_ptr() == nullptr)
 {
 sal_Int32 nLeftMargin = 285750 * (nLevel - 
nStartBulletsAtLevel + 1) / EMU_PER_HMM;
 aParagraph->getProperties().getParaLeftMargin() = 
nLeftMargin;
 }
 
-if 
(!aParagraph->getProperties().getFirstLineIndentation().has_value())
+if 
(aParagraph->getProperties().getFirstLineIndentation().get_ptr() == nullptr)
 aParagraph->getProperties().getFirstLineIndentation() 
= -285750 / EMU_PER_HMM;
 
 // It is not possible to change the bullet style for text.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - 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 3c10f574cd342bfdb6b11ea9bb89849c978dab5e
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:48:58 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/+/89278

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 12dcae71663c..51b4c8c96472 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 842cc979ca9c..f0ab9ff067f5 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);
@@ -1278,7 +1278,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"),
@@ -1298,8 +1298,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-3' - oox/source sd/qa

2020-02-20 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 09a027f682e873f572df533ed558ee99965f5839
Author: Gülşah Köse 
AuthorDate: Wed Feb 19 09:08:45 2020 +0300
Commit: Gülşah Köse 
CommitDate: Thu Feb 20 20:17:40 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/+/88963

diff --git a/oox/source/drawingml/textparagraphproperties.cxx 
b/oox/source/drawingml/textparagraphproperties.cxx
index 48e3b486e8b8..ae4fe98c8ff9 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 9226bbe79152..842cc979ca9c 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);
@@ -1276,6 +1278,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-3' - oox/source

2020-01-13 Thread Xisco Fauli (via logerrit)
 oox/source/drawingml/chart/plotareaconverter.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 242506ba9abcbd86f368e57bc4b046aa58e33651
Author: Xisco Fauli 
AuthorDate: Thu Jan 9 13:00:35 2020 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jan 13 21:12:38 2020 +0100

oox: add missing nullptr checks

See

http://crashreport.libreoffice.org/stats/signature/oox::drawingml::chart::PlotAreaConverter::convertFromModel(oox::drawingml::chart::View3DModel%20&)

Regression from 11473832b5717cb3222ce72baee885bc9e8e2386

Change-Id: I6cf08582fb384203ca1ce5736b88b85c11ff56da
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86483
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
(cherry picked from commit aa499120c4cb3935cd942751859b6d5d3689ea43)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86524
Reviewed-by: Caolán McNamara 

diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx 
b/oox/source/drawingml/chart/plotareaconverter.cxx
index 24ab5f0bfd3e..af3139618824 100644
--- a/oox/source/drawingml/chart/plotareaconverter.cxx
+++ b/oox/source/drawingml/chart/plotareaconverter.cxx
@@ -415,7 +415,8 @@ void PlotAreaConverter::convertFromModel( View3DModel& 
rView3DModel )
 bool bSupportsVaryColorsByPoint = mrModel.maTypeGroups.size() == 1;
 
 // convert all axes sets, and check which axis is attached to the first 
maTypeGroups
-sal_Int32 nStartAxesSetIdx = (rValAxisIds.size() > 1 && 
aAxesSets[0]->maAxes[1]->mnAxisId != rValAxisIds[0] ) ? 1 : 0;
+sal_Int32 nStartAxesSetIdx = (rValAxisIds.size() > 1 && aAxesSets.size() > 
0 && aAxesSets[0]->maAxes.count( API_Y_AXIS )
+&& aAxesSets[0]->maAxes[ API_Y_AXIS ]->mnAxisId != rValAxisIds[0] 
) ? 1 : 0;
 sal_Int32 nAxesSetIdx = nStartAxesSetIdx;
 
 for (auto const& axesSet : aAxesSets)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

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

New commits:
commit a06884e5967c4ebf730772b25682cf85dd026d50
Author: Gülşah Köse 
AuthorDate: Wed Nov 27 13:35:29 2019 +0300
Commit: Andras Timar 
CommitDate: Fri Nov 29 09:06:35 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 
Reviewed-on: https://gerrit.libreoffice.org/84023
Reviewed-by: Andras Timar 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 9e5b3f2648f4..e3b5e80ba2e4 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2619,7 +2619,8 @@ void DrawingML::WriteText( const Reference< XInterface >& 
rXIface, const OUStrin
 if( !xXText.is() )
 return;
 
-sal_Int32 nTextRotateAngle = 0;
+double nTextRotateAngle = 0;
+sal_Int32 nTextPreRotateAngle = 0;
 
 #define DEFLRINS 254
 #define DEFTBINS 127
@@ -2665,20 +2666,21 @@ void DrawingML::WriteText( const Reference< XInterface 
>& rXIface, const OUStrin
 {
 for ( sal_Int32 i = 0, nElems = aProps.getLength(); i < nElems; 
++i )
 {
-if ( aProps[ i ].Name == "TextPreRotateAngle" && ( aProps[ i 
].Value >>= nTextRotateAngle ) )
+if ( aProps[ i ].Name == "TextPreRotateAngle" && ( aProps[ i 
].Value >>= nTextPreRotateAngle ) )
 {
-if ( nTextRotateAngle == -90 )
+if ( nTextPreRotateAngle == -90 )
 {
 sWritingMode = "vert";
 bVertical = true;
 }
-else if ( nTextRotateAngle == -270 )
+else if ( nTextPreRotateAngle == -270 )
 {
 sWritingMode = "vert270";
 bVertical = true;
 }
-break;
 }
+else if( aProps[ i ].Name == "TextRotateAngle" )
+aProps[ i ].Value >>= nTextRotateAngle;
 }
 }
 }
@@ -2722,7 +2724,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( !presetWarp.isEmpty())
 {
 mpFS->singleElementNS(XML_a, XML_prstTxWarp, XML_prst, 
presetWarp.toUtf8());
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 6048cb850e2e..79eaa05f99a3 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -104,6 +104,7 @@ public:
 void testTdf111884();
 void testTdf112633();
 void testTdf128952();
+void testTdf127090();
 void testCustomXml();
 void testTdf94238();
 void testPictureTransparency();
@@ -138,6 +139,7 @@ public:
 CPPUNIT_TEST(testTdf111884);
 CPPUNIT_TEST(testTdf112633);
 CPPUNIT_TEST(testTdf128952);
+CPPUNIT_TEST(testTdf127090);
 CPPUNIT_TEST(testCustomXml);
 CPPUNIT_TEST(testTdf94238);
 CPPUNIT_TEST(testTdf125554);
@@ -846,6 +848,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");
+
+assertXPath(pXmlDoc, "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr", 
"rot", "-540");
+}
+
 void SdOOXMLExportTest1::testCustomXml()
 {
 // Load document and export it to a temporary file
___

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - 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 |   16 ++--
 3 files changed, 15 insertions(+), 3 deletions(-)

New commits:
commit dfacdb99208be964111b8c7bdfa2458b080fba71
Author: Tamas Bunth 
AuthorDate: Tue Nov 19 12:38:56 2019 +0100
Commit: Xisco Faulí 
CommitDate: Thu Nov 28 14:07:35 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.

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í 
Signed-off-by: Xisco Fauli 

Change-Id: Id9bcaaab109df65f4124f733b2cfee438e82b79b
Reviewed-on: https://gerrit.libreoffice.org/83988
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 7bb7b39e482b..e061902096f6 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -208,7 +208,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 943fc49cfc3f..5cab4e7ae8cd 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -196,7 +196,6 @@ public:
 void testTdf77747();
 void testTdf116266();
 void testTdf126324();
-void testTdf128684();
 
 bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, 
std::vector& rExpected);
 void testPatternImport();
@@ -212,6 +211,8 @@ public:
 void testOOXTheme();
 void testCropToShape();
 void testTdf127964();
+void testTdf128684();
+void testTdf113198();
 
 CPPUNIT_TEST_SUITE(SdImportTest);
 
@@ -308,6 +309,7 @@ public:
 CPPUNIT_TEST(testCropToShape);
 CPPUNIT_TEST(testTdf127964);
 CPPUNIT_TEST(testTdf128684);
+CPPUNIT_TEST(testTdf113198);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -2923,7 +2925,6 @@ void SdImportTest::testTdf127964()
 xDocShRef->DoClose();
 }
 
-
 void SdImportTest::testTdf128684()
 {
 sd::DrawDocShellRef xDocShRef
@@ -2950,6 +2951,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-3' - oox/source sax/source sw/qa vcl/source writerfilter/source

2019-11-25 Thread Mike Kaganski (via logerrit)
 oox/source/export/shapes.cxx  |   35 +++---
 sax/source/fastparser/fastparser.cxx  |   14 +-
 sw/qa/extras/ooxmlexport/data/tdf128820.fodt  |   16 ++
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx|   25 
 vcl/source/filter/graphicfilter2.cxx  |  128 +++---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   13 ++
 writerfilter/source/dmapper/PropertyMap.cxx   |   11 +
 7 files changed, 161 insertions(+), 81 deletions(-)

New commits:
commit 01ac1e24856121239e289b07b711b3f688187ccf
Author: Mike Kaganski 
AuthorDate: Sat Nov 16 15:02:35 2019 +0300
Commit: Michael Stahl 
CommitDate: Mon Nov 25 18:04:13 2019 +0100

tdf#128820: use wps namespace for simple text shapes

Without that, simple text shapes inside groups were written in
 elements, with many child elements also having pic::
prefix.

Change-Id: I114cf3499e03aa5ca042211d7b134aaf5b0e7fbf
Reviewed-on: https://gerrit.libreoffice.org/82980
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Signed-off-by: Xisco Fauli 

Also consider saved exceptions when terminating parse

As with previous commit 18ae77a065cb8ae6940d4067f6ab7e99a3f74047, this
will start showing parse errors on invalid files which previously just
opened without warnings, silently losing the invalid stream part. Any
bug bisected to this commit is not a regression from this commit! The
real problem was already before, and was just disclosed by this (which
is the actual goal).

Also simplify unit test data for tdf#128820, which will now be enough
after the change.

A unit test (testN779627) revealed unexpected throws when parsing; this
was fixed.

Change-Id: I5a21b9001874ec6e3b8273c10043ef930bf1cc82
Reviewed-on: https://gerrit.libreoffice.org/82981
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Signed-off-by: Xisco Fauli 

tdf#128820: improve unit test to not depend on opening bad file failing

... also test exported XML directly

Change-Id: I50237593dd111e7c7974452769c8d49c22012713
Reviewed-on: https://gerrit.libreoffice.org/83005
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Signed-off-by: Xisco Fauli 

Fix UBSan build after 9fdf8c0a5cc036ea9bd1e11dd8f2c1a6e601fae2

The said commit simplified a testdoc to testTdf128820, using a smallest
possible SVG in it. This seems to produce the smallest possible PNG of
size 8, which is passed into GraphicDescriptor::ImpDetectPNG. There its
size is read into nTemp32 past the end of the file without checks,
which keeps last value of the variable (which was the magic number
0x0d0a1a0a), which is then saved into the descriptor. Then that value
is used in ImpGraphic::ImplGetSizePixel, and later multiplying it in
lclConvertScreenPixelToHmm causes UB.

Fix by checking all the reads in GraphicDescriptor::ImpDetectPNG.

Change-Id: Ib4740fac2b87fbef57d5150151129b9852f3ecb8
Reviewed-on: https://gerrit.libreoffice.org/83119
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/83296
(cherry picked from commit d54bae3471e9b9529f1ac03c811c3370d9f5ed89)
Reviewed-on: https://gerrit.libreoffice.org/83337
Reviewed-by: Michael Stahl 

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 80de09f97a76..64513b58067c 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -377,6 +377,14 @@ awt::Size ShapeExport::MapSize( const awt::Size& rSize ) 
const
 return awt::Size( aRetSize.Width(), aRetSize.Height() );
 }
 
+static bool IsNonEmptySimpleText(const Reference& xIface)
+{
+if (Reference xText{ xIface, UNO_QUERY })
+return xText->getString().getLength();
+
+return false;
+}
+
 bool ShapeExport::NonEmptyText( const Reference< XInterface >& xIface )
 {
 Reference< XPropertySet > xPropSet( xIface, UNO_QUERY );
@@ -410,12 +418,7 @@ bool ShapeExport::NonEmptyText( const Reference< 
XInterface >& xIface )
 }
 }
 
-Reference< XSimpleText > xText( xIface, UNO_QUERY );
-
-if( xText.is() )
-return xText->getString().getLength();
-
-return false;
+return IsNonEmptySimpleText(xIface);
 }
 
 ShapeExport& ShapeExport::WritePolyPolygonShape( const Reference< XShape >& 
xShape, const bool bClosed )
@@ -525,7 +528,11 @@ ShapeExport& ShapeExport::WriteGroupShape(const 
uno::Reference&
 uno::Reference xServiceInfo(xChild, 
uno::UNO_QUERY_THROW);
 if (GetDocumentType() == DOCUMENT_DOCX)
 {
-if 
(xServiceInfo->supportsService("com.sun.star.drawing.GraphicObjectShape"))
+// tdf#128820: WriteGraphicObjectShapePart calls WriteTextShape 
for non-empty simple
+// text objects, which needs writing into wps::wsp element, so 
make 

[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - 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 2dc030922eb7991befcc9ea02ef2e400fca65141
Author: Gülşah Köse 
AuthorDate: Fri Nov 22 14:05:24 2019 +0300
Commit: Andras Timar 
CommitDate: Fri Nov 22 23:18:55 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/83535
Reviewed-by: Andras Timar 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 60b674287a43..9e5b3f2648f4 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1621,7 +1621,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 a0cd3b837af3..6048cb850e2e 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -103,6 +103,7 @@ public:
 void testParaMarginAndindentation();
 void testTdf111884();
 void testTdf112633();
+void testTdf128952();
 void testCustomXml();
 void testTdf94238();
 void testPictureTransparency();
@@ -136,6 +137,7 @@ public:
 CPPUNIT_TEST(testParaMarginAndindentation);
 CPPUNIT_TEST(testTdf111884);
 CPPUNIT_TEST(testTdf112633);
+CPPUNIT_TEST(testTdf128952);
 CPPUNIT_TEST(testCustomXml);
 CPPUNIT_TEST(testTdf94238);
 CPPUNIT_TEST(testTdf125554);
@@ -829,6 +831,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-3' - 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 d6c3f1d37f651637ed4d803a2226ead4392fd85f
Author: Tamas Bunth 
AuthorDate: Thu Nov 14 00:56:08 2019 +0100
Commit: Andras Timar 
CommitDate: Sun Nov 17 16:48:41 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 
Reviewed-on: https://gerrit.libreoffice.org/83021
Reviewed-by: Andras Timar 

diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index fe3be0c97de2..b937140c04d9 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -234,6 +234,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 1d1f5a6a46d1..943fc49cfc3f 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();
@@ -306,6 +307,7 @@ public:
 CPPUNIT_TEST(testOOXTheme);
 CPPUNIT_TEST(testCropToShape);
 CPPUNIT_TEST(testTdf127964);
+CPPUNIT_TEST(testTdf128684);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -2921,6 +2923,33 @@ void SdImportTest::testTdf127964()
 xDocShRef->DoClose();
 }
 
+
+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

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

2019-10-31 Thread Justin Luth (via logerrit)
 oox/source/vml/vmlinputstream.cxx   |6 ++
 sc/qa/unit/data/xlsx/tdf120301_xmlSpaceParsing.xlsx |binary
 2 files changed, 6 insertions(+)

New commits:
commit fd0a32ec2654b0d6cc11883991dd2f4a85ae0a44
Author: Justin Luth 
AuthorDate: Wed Oct 30 11:11:45 2019 +0300
Commit: Xisco Faulí 
CommitDate: Thu Oct 31 10:33:52 2019 +0100

tdf#128447 sc/vml: accept  xml prolog

... or processing instruction, or text directive.

The inability to parse this was exposed in LO 6.2
with commit 2cae2ecfef47d8dd10647c10f9577392c1887d3a

I added 
to the top of vmlDrawing1.vml from the unit test,
which invalidates the entire .vml file and the two
controls are lost without this fix.

Change-Id: Ia1e6d5f9bb932756f70dca59fa8b32004c9e8013
Reviewed-on: https://gerrit.libreoffice.org/81730
Reviewed-by: Michael Stahl 
Tested-by: Jenkins
(cherry picked from commit 32efd4529aba776eca9456e96656d542267874f3)
Reviewed-on: https://gerrit.libreoffice.org/81814
Reviewed-by: Justin Luth 
Reviewed-by: Xisco Faulí 

diff --git a/oox/source/vml/vmlinputstream.cxx 
b/oox/source/vml/vmlinputstream.cxx
index 2442fa9bc489..55d0ad17f008 100644
--- a/oox/source/vml/vmlinputstream.cxx
+++ b/oox/source/vml/vmlinputstream.cxx
@@ -168,6 +168,12 @@ void lclProcessElement( OStringBuffer& rBuffer, const 
OString& rElement )
 // do nothing
 }
 
+// just append any xml prolog (text directive) or processing instructions: 

+else if( (nElementLen >= 4) && (pcOpen[ 1 ] == '?') && (pcClose[ -1 ] == 
'?') )
+{
+rBuffer.append( rElement );
+}
+
 // replace '' element with newline
 else if( (nElementLen >= 4) && (pcOpen[ 1 ] == 'b') && (pcOpen[ 2 ] == 
'r') && (lclFindNonWhiteSpace( pcOpen + 3, pcClose ) == pcClose) )
 {
diff --git a/sc/qa/unit/data/xlsx/tdf120301_xmlSpaceParsing.xlsx 
b/sc/qa/unit/data/xlsx/tdf120301_xmlSpaceParsing.xlsx
index 0677a0cf2eb2..b28c4dd71643 100644
Binary files a/sc/qa/unit/data/xlsx/tdf120301_xmlSpaceParsing.xlsx and 
b/sc/qa/unit/data/xlsx/tdf120301_xmlSpaceParsing.xlsx differ
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-30 Thread Tamas Bunth (via logerrit)
 oox/source/drawingml/textfield.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit a8a97925f79bb1859604988483168c9dded44052
Author: Tamas Bunth 
AuthorDate: Fri Oct 25 17:45:01 2019 +0200
Commit: Xisco Faulí 
CommitDate: Wed Oct 30 09:09:01 2019 +0100

tdf#126324 Import custom date as custom XTextField

Change-Id: I89f96490a47210e7daa3b21b2399e0dfe0cf3abf
Reviewed-on: https://gerrit.libreoffice.org/81513
Tested-by: Jenkins
Reviewed-by: Tamás Bunth 
(cherry picked from commit df9672b1fada6fc847bfa4c8a8f016fb2af6a7b5)
Reviewed-on: https://gerrit.libreoffice.org/81592
Reviewed-by: Xisco Faulí 

diff --git a/oox/source/drawingml/textfield.cxx 
b/oox/source/drawingml/textfield.cxx
index 713c5a745b3d..f7f9a6f28f40 100644
--- a/oox/source/drawingml/textfield.cxx
+++ b/oox/source/drawingml/textfield.cxx
@@ -67,6 +67,12 @@ void lclCreateTextFields( std::vector< Reference< XTextField 
> > & aFields,
 OString p( s.pData->buffer + 8 );
 try
 {
+if(p.startsWith("'"))
+{
+xIface = xFactory->createInstance( 
"com.sun.star.text.TextField.Custom" );
+aFields.emplace_back( xIface, UNO_QUERY );
+return;
+}
 bool bIsDate = true;
 int idx = p.toInt32();
 sal_uInt16 nNumFmt;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-22 Thread Samuel Mehrbrodt (via logerrit)
 oox/source/core/filterdetect.cxx |   13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit a2c94755d883ed807efa4a60302762cf4c6fbefe
Author: Samuel Mehrbrodt 
AuthorDate: Mon Oct 21 17:12:28 2019 +0200
Commit: Thorsten Behrens 
CommitDate: Tue Oct 22 15:42:56 2019 +0200

Rather not put unencrypted doc in a tempfile

Keep it in memory instead

Change-Id: I25e5cb7183a4d192938110323e27f2f5d1d006fc
Reviewed-on: https://gerrit.libreoffice.org/81253
Reviewed-by: Tomaž Vajngerl 
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 
(cherry picked from commit bd3929da20b5a536b82b15af552864e7549f91ef)
Reviewed-on: https://gerrit.libreoffice.org/81298
Reviewed-by: Thorsten Behrens 

diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx
index c5ea4b385849..4537e61a93c8 100644
--- a/oox/source/core/filterdetect.cxx
+++ b/oox/source/core/filterdetect.cxx
@@ -327,20 +327,23 @@ Reference< XInputStream > 
FilterDetect::extractUnencryptedPackage( MediaDescript
 }
 else
 {
-// create temporary file for unencrypted package
-Reference xTempFile( TempFile::create(mxContext), 
UNO_QUERY_THROW );
+// create MemoryStream for unencrypted package - rather 
not put this in a tempfile
+Reference const xTempStream(
+
mxContext->getServiceManager()->createInstanceWithContext(
+"com.sun.star.comp.MemoryStream", mxContext),
+UNO_QUERY_THROW);
 
 // if decryption was unsuccessful (corrupted file or any 
other reason)
-if (!aDecryptor.decrypt(xTempFile))
+if (!aDecryptor.decrypt(xTempStream))
 {
 rMediaDescriptor[ MediaDescriptor::PROP_ABORTED() ] 
<<= true;
 }
 else
 {
 // store temp file in media descriptor to keep it alive
-rMediaDescriptor.setComponentDataEntry( 
"DecryptedPackage", Any( xTempFile ) );
+rMediaDescriptor.setComponentDataEntry( 
"DecryptedPackage", Any( xTempStream ) );
 
-Reference xDecryptedInputStream = 
xTempFile->getInputStream();
+Reference xDecryptedInputStream = 
xTempStream->getInputStream();
 if( lclIsZipPackage( mxContext, xDecryptedInputStream 
) )
 return xDecryptedInputStream;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-18 Thread Xisco Fauli (via logerrit)
 oox/source/export/drawingml.cxx|   18 ++
 sd/qa/unit/data/odp/tdf127901.odp  |binary
 sd/qa/unit/export-tests-ooxml2.cxx |   21 +
 3 files changed, 39 insertions(+)

New commits:
commit ff2f0e839f7b7ef5e79b8ec4311c971c0e8053f9
Author: Xisco Fauli 
AuthorDate: Tue Oct 1 21:05:10 2019 +0200
Commit: Michael Stahl 
CommitDate: Fri Oct 18 11:14:26 2019 +0200

tdf#127901: pptx export image greyscale, watermark, black/white

Similar to 0db96caf0fcce09b87621c11b584a6d81cc7df86

Change-Id: I5c3ec17c7a3472629ba8a63ab500175add36ee8e
Reviewed-on: https://gerrit.libreoffice.org/79994
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 
(cherry picked from commit cb5eaa791739865d54b381c16c60224c432171dc)
Reviewed-on: https://gerrit.libreoffice.org/80014
Reviewed-by: Michael Stahl 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 2d7b300e51e3..60b674287a43 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -54,6 +54,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1285,6 +1286,23 @@ void 
DrawingML::WriteImageBrightnessContrastTransparence(uno::Reference(mAny.get());
 
+if (GetProperty(rXPropSet, "GraphicColorMode"))
+{
+drawing::ColorMode aColorMode;
+mAny >>= aColorMode;
+if (aColorMode == drawing::ColorMode_GREYS)
+mpFS->singleElementNS(XML_a, XML_grayscl);
+else if (aColorMode == drawing::ColorMode_MONO)
+//black/white has a 0,5 threshold in LibreOffice
+mpFS->singleElementNS(XML_a, XML_biLevel, XML_thresh, 
OString::number(5));
+else if (aColorMode == drawing::ColorMode_WATERMARK)
+{
+//map watermark with mso washout
+nBright = 70;
+nContrast = -70;
+}
+}
+
 
 if (nBright || nContrast)
 {
diff --git a/sd/qa/unit/data/odp/tdf127901.odp 
b/sd/qa/unit/data/odp/tdf127901.odp
new file mode 100644
index ..e1c5dfad3fae
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf127901.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 239a362514d9..f820160837e2 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -170,6 +170,7 @@ public:
 void testThemeColors();
 void testTdf114848();
 void testTdf68759();
+void testTdf127901();
 void testTdf90626();
 void testTdf107608();
 void testTdf111786();
@@ -264,6 +265,7 @@ public:
 CPPUNIT_TEST(testThemeColors);
 CPPUNIT_TEST(testTdf114848);
 CPPUNIT_TEST(testTdf68759);
+CPPUNIT_TEST(testTdf127901);
 CPPUNIT_TEST(testTdf90626);
 CPPUNIT_TEST(testTdf107608);
 CPPUNIT_TEST(testTdf111786);
@@ -1560,6 +1562,25 @@ void SdOOXMLExportTest2::testTdf68759()
 
 }
 
+void SdOOXMLExportTest2::testTdf127901()
+{
+::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf127901.odp"), ODP);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocPtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml");
+assertXPath(pXmlDocContent1, 
"/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:lum", "bright", "7");
+assertXPath(pXmlDocContent1, 
"/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:lum", "contrast", "-7");
+
+xmlDocPtr pXmlDocContent2 = parseExport(tempFile, "ppt/slides/slide2.xml");
+assertXPath(pXmlDocContent2, 
"/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:grayscl", 1);
+
+xmlDocPtr pXmlDocContent3 = parseExport(tempFile, "ppt/slides/slide3.xml");
+assertXPath(pXmlDocContent3, 
"/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:biLevel", "thresh", "5");
+
+}
+
 void SdOOXMLExportTest2::testTdf90626()
 {
 ::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf90626.odp"), ODP);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-15 Thread Xisco Fauli (via logerrit)
 oox/source/drawingml/fillproperties.cxx   |5 ++
 sd/qa/unit/data/pptx/tdf79007.pptx|binary
 sd/qa/unit/import-tests.cxx   |   58 ++
 writerfilter/source/dmapper/GraphicImport.cxx |9 
 4 files changed, 63 insertions(+), 9 deletions(-)

New commits:
commit 4b8415616071ec74e21040369d5dd1a9496db71d
Author: Xisco Fauli 
AuthorDate: Mon Sep 30 23:18:14 2019 +0200
Commit: Michael Stahl 
CommitDate: Tue Oct 15 14:31:55 2019 +0200

tdf#79007: PPTX: reset Contrast and Brightness when we map...

...MSO 'washout' to our watermark colormode

After d151ed35ad4c4e7aa9fbb807930fcf91dea2eba7,
Contrast and Brightness was reset only in writer,
so do it earlier for Impress and Writer

Reviewed-on: https://gerrit.libreoffice.org/79905
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 
(cherry picked from commit 727ca36e83868acbe40aaa239cefc69659b9bc39)

Change-Id: Icaf2b565880e31d86e09e2f56bac25eba52c8467
Reviewed-on: https://gerrit.libreoffice.org/80003
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/oox/source/drawingml/fillproperties.cxx 
b/oox/source/drawingml/fillproperties.cxx
index 9c5338ce8975..f784f6f0b57f 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -758,8 +758,12 @@ void GraphicProperties::pushToPropMap( PropertyMap& 
rPropMap, const GraphicHelpe
 xGraphic = lclCheckAndApplyDuotoneTransform(maBlipProps, xGraphic, 
rGraphicHelper, API_RGB_TRANSPARENT);
 
 if (eColorMode == ColorMode_STANDARD && nBrightness == 70 && nContrast 
== -70)
+{
 // map MSO 'washout' to our Watermark colormode
 eColorMode = ColorMode_WATERMARK;
+nBrightness = 0;
+nContrast = 0;
+}
 else if( nBrightness != 0 && nContrast != 0 )
 {
 // MSO uses a different algorithm for contrast+brightness, LO 
applies contrast before brightness,
@@ -770,6 +774,7 @@ void GraphicProperties::pushToPropMap( PropertyMap& 
rPropMap, const GraphicHelpe
 nBrightness = 0;
 nContrast = 0;
 }
+
 if(mbIsCustomShape)
 {
 // it is a cropped graphic.
diff --git a/sd/qa/unit/data/pptx/tdf79007.pptx 
b/sd/qa/unit/data/pptx/tdf79007.pptx
new file mode 100644
index ..65e94f1a9d9e
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf79007.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 28a908197fdc..f083b38bbc58 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -53,6 +53,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -169,6 +170,7 @@ public:
 void testTdf103567();
 void testTdf103792();
 void testTdf103876();
+void testTdf79007();
 void testTdf104015();
 void testTdf104201();
 void testTdf103477();
@@ -264,6 +266,7 @@ public:
 CPPUNIT_TEST(testTdf103567);
 CPPUNIT_TEST(testTdf103792);
 CPPUNIT_TEST(testTdf103876);
+CPPUNIT_TEST(testTdf79007);
 CPPUNIT_TEST(testTdf104015);
 CPPUNIT_TEST(testTdf104201);
 CPPUNIT_TEST(testTdf103477);
@@ -1707,6 +1710,61 @@ void SdImportTest::testTdf103876()
 xDocShRef->DoClose();
 }
 
+void SdImportTest::testTdf79007()
+{
+sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf79007.pptx"), 
PPTX);
+
+uno::Reference xShape1(getShapeFromPage(0, 0, 
xDocShRef));
+CPPUNIT_ASSERT_MESSAGE("Not a shape", xShape1.is());
+
+// Check we map mso washout to our watermark
+drawing::ColorMode aColorMode1;
+xShape1->getPropertyValue("GraphicColorMode") >>= aColorMode1;
+CPPUNIT_ASSERT_EQUAL(drawing::ColorMode_WATERMARK, aColorMode1);
+
+sal_Int16 nContrast1;
+xShape1->getPropertyValue("AdjustContrast") >>= nContrast1;
+CPPUNIT_ASSERT_EQUAL(static_cast(0), nContrast1);
+
+sal_Int16 nLuminance1;
+xShape1->getPropertyValue("AdjustLuminance") >>= nLuminance1;
+CPPUNIT_ASSERT_EQUAL(static_cast(0), nLuminance1);
+
+uno::Reference xShape2(getShapeFromPage(1, 0, 
xDocShRef));
+CPPUNIT_ASSERT_MESSAGE("Not a shape", xShape2.is());
+
+// Check we map mso grayscale to our grayscale
+drawing::ColorMode aColorMode2;
+xShape2->getPropertyValue("GraphicColorMode") >>= aColorMode2;
+CPPUNIT_ASSERT_EQUAL(drawing::ColorMode_GREYS, aColorMode2);
+
+sal_Int16 nContrast2;
+xShape2->getPropertyValue("AdjustContrast") >>= nContrast2;
+CPPUNIT_ASSERT_EQUAL(static_cast(0), nContrast2);
+
+sal_Int16 nLuminance2;
+xShape2->getPropertyValue("AdjustLuminance") >>= nLuminance2;
+CPPUNIT_ASSERT_EQUAL(static_cast(0), nLuminance2);
+
+uno::Reference xShape3(getShapeFromPage(2, 0, 
xDocShRef));
+CPPUNIT_ASSERT_MESSAGE("Not a shape", xShape3.is());
+
+// Check we map mso black/white to our black/white
+  

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

2019-10-15 Thread Xisco Fauli (via logerrit)
 oox/source/export/drawingml.cxx|   16 
 sd/qa/unit/data/odp/tdf128096.odp  |binary
 sd/qa/unit/export-tests-ooxml2.cxx |   16 
 3 files changed, 32 insertions(+)

New commits:
commit 63fff549e05e6007d9692996274982afeb34cd7f
Author: Xisco Fauli 
AuthorDate: Fri Oct 11 17:43:46 2019 +0200
Commit: Tamás Zolnai 
CommitDate: Tue Oct 15 11:21:50 2019 +0200

tdf#128096: pptx: export highlight

Reviewed-on: https://gerrit.libreoffice.org/80670
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 
(cherry picked from commit 3e0811660ba4cecd0ab27918c27a5ddab47cc5c5)

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

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index de0c65cbcd8d..2d7b300e51e3 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1839,6 +1839,22 @@ void DrawingML::WriteRunProperties( const Reference< 
XPropertySet >& rRun, bool
 }
 }
 
+// tdf#128096, exporting XML_highlight to docx already works fine,
+// so make sure this code is only run when exporting to pptx, just in case
+if (GetDocumentType() == DOCUMENT_PPTX)
+{
+if (GetProperty(rXPropSet, "CharBackColor"))
+{
+::Color color(*o3tl::doAccess(mAny));
+if( color != COL_AUTO )
+{
+mpFS->startElementNS(XML_a, XML_highlight);
+WriteColor( color );
+mpFS->endElementNS( XML_a, XML_highlight );
+}
+}
+}
+
 if (underline
 && ((bCheckDirect
  && GetPropertyAndState(rXPropSet, rXPropState, 
"CharUnderlineColor", eState)
diff --git a/sd/qa/unit/data/odp/tdf128096.odp 
b/sd/qa/unit/data/odp/tdf128096.odp
new file mode 100644
index ..827239973c84
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf128096.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 6d29d075c62d..239a362514d9 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -195,6 +195,7 @@ public:
 void testTdf118768();
 void testTdf118836();
 void testTdf116350TextEffects();
+void testTdf128096();
 void testTdf120573();
 void testTdf118825();
 void testTdf119118();
@@ -286,6 +287,7 @@ public:
 CPPUNIT_TEST(testTdf118768);
 CPPUNIT_TEST(testTdf118836);
 CPPUNIT_TEST(testTdf116350TextEffects);
+CPPUNIT_TEST(testTdf128096);
 CPPUNIT_TEST(testTdf120573);
 CPPUNIT_TEST(testTdf118825);
 CPPUNIT_TEST(testTdf119118);
@@ -2060,6 +2062,20 @@ void SdOOXMLExportTest2::testTdf116350TextEffects()
 xDocShRef->DoClose();
 }
 
+void SdOOXMLExportTest2::testTdf128096()
+{
+::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf128096.odp"), ODP);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xDocShRef->DoClose();
+
+xmlDocPtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml");
+assertXPath(pXmlDocContent1, 
"//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:highlight/a:srgbClr", 
"val", "00");
+
+// Check that underlined content is also highlighted
+xmlDocPtr pXmlDocContent2 = parseExport(tempFile, "ppt/slides/slide2.xml");
+assertXPath(pXmlDocContent2, 
"//p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:highlight/a:srgbClr", 
"val", "00");
+}
 void SdOOXMLExportTest2::testTdf120573()
 {
 ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc( 
"sd/qa/unit/data/pptx/tdf120573.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-3' - oox/source

2019-10-14 Thread Mike Kaganski (via logerrit)
 oox/source/ppt/pptimport.cxx |   28 
 1 file changed, 20 insertions(+), 8 deletions(-)

New commits:
commit 5dfaf7a608a1827d1b56ac7a7d4651f26e4754d1
Author: Mike Kaganski 
AuthorDate: Mon Oct 14 00:12:23 2019 +0300
Commit: Michael Stahl 
CommitDate: Mon Oct 14 13:10:23 2019 +0200

tdf#127164: Disable Undo during pptx save

Change-Id: I07fe6895cc2ba43dfa1716e67bdbb4e697e3420c
Reviewed-on: https://gerrit.libreoffice.org/80727
Tested-by: Jenkins
Reviewed-by: Jim Raykowski 
(cherry picked from commit 03ec3b7dd11656c8b64a94efb172e17d97ea662e)
Reviewed-on: https://gerrit.libreoffice.org/80756
Tested-by: Xisco Faulí 
Reviewed-by: Michael Stahl 

diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index d65e408d3c13..9476eca2d825 100644
--- a/oox/source/ppt/pptimport.cxx
+++ b/oox/source/ppt/pptimport.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -232,17 +233,28 @@ sal_Bool SAL_CALL PowerPointImport::filter( const 
Sequence< PropertyValue >& rDe
 Reference 
aFactory(getComponentContext()->getServiceManager(), UNO_QUERY_THROW);
 Reference< XExporter > 
xExporter(aFactory->createInstanceWithArguments("com.sun.star.comp.Impress.oox.PowerPointExport",
 aArguments), UNO_QUERY);
 
-if (xExporter.is())
+if (Reference xFilter{ xExporter, UNO_QUERY })
 {
-Reference< XComponent > xDocument( getModel(), UNO_QUERY );
-Reference< XFilter > xFilter( xExporter, UNO_QUERY );
-
-if (xFilter.is())
+Reference xUndoManager;
+bool bWasUnLocked = true;
+if (Reference xUMS{ getModel(), 
UNO_QUERY })
 {
-xExporter->setSourceDocument( xDocument );
-if( xFilter->filter( rDescriptor ) )
-return true;
+xUndoManager = xUMS->getUndoManager();
+if (xUndoManager.is())
+{
+bWasUnLocked = !xUndoManager->isLocked();
+xUndoManager->lock();
+}
 }
+comphelper::ScopeGuard aGuard([xUndoManager, bWasUnLocked] {
+if (xUndoManager && bWasUnLocked)
+xUndoManager->unlock();
+});
+
+Reference< XComponent > xDocument(getModel(), UNO_QUERY);
+xExporter->setSourceDocument(xDocument);
+if (xFilter->filter(rDescriptor))
+return true;
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-10-13 Thread Xisco Fauli (via logerrit)
 oox/source/drawingml/textcharacterproperties.cxx |3 +++
 oox/source/token/properties.txt  |1 +
 sd/qa/unit/data/pptx/tdf127129.pptx  |binary
 sd/qa/unit/import-tests.cxx  |   22 ++
 4 files changed, 26 insertions(+)

New commits:
commit 3ff748399ded70c71c9340ee6f1fdd7e7af28180
Author: Xisco Fauli 
AuthorDate: Thu Oct 10 21:29:50 2019 +0200
Commit: Xisco Faulí 
CommitDate: Sun Oct 13 21:15:17 2019 +0200

tdf#127129: pptx: map highlight to CharBackColor

Change-Id: I033c15db6848e96ba6b6bd7a2852c9e4d1524a8e
Reviewed-on: https://gerrit.libreoffice.org/80630
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai 
(cherry picked from commit 57cfbc6830c3d8dc64107aed4a613415f069)
Reviewed-on: https://gerrit.libreoffice.org/80738
Reviewed-by: Xisco Faulí 

diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index 552dcf933e81..bc078d491737 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -156,6 +156,9 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
 rPropMap.setProperty( PROP_CharUnderlineColor, 
maUnderlineColor.getColor( rFilter.getGraphicHelper() ));
 }
 // TODO If bUnderlineFillFollowText uFillTx 
(CT_TextUnderlineFillFollowText) is set, fill color of the underline should be 
the same color as the text
+
+if( maHighlightColor.isUsed() )
+rPropMap.setProperty( PROP_CharBackColor, maHighlightColor.getColor( 
rFilter.getGraphicHelper() ));
 }
 
 static void pushToGrabBag( PropertySet& rPropSet, const 
std::vector& aVectorOfProperyValues )
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 0bbd14b79b30..44320afe0e87 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -50,6 +50,7 @@ CellStyle
 CenterHorizontally
 CenterVertically
 Change
+CharBackColor
 CharCaseMap
 CharColor
 CharContoured
diff --git a/sd/qa/unit/data/pptx/tdf127129.pptx 
b/sd/qa/unit/data/pptx/tdf127129.pptx
new file mode 100644
index ..680fcf631be4
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf127129.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 04ac4b474ab8..6252ca27161f 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -154,6 +154,7 @@ public:
 void testBnc910045();
 void testRowHeight();
 void testTdf93830();
+void testTdf127129();
 void testTdf93097();
 void testTdf62255();
 void testTdf93124();
@@ -247,6 +248,7 @@ public:
 CPPUNIT_TEST(testBnc910045);
 CPPUNIT_TEST(testRowHeight);
 CPPUNIT_TEST(testTdf93830);
+CPPUNIT_TEST(testTdf127129);
 CPPUNIT_TEST(testTdf93097);
 CPPUNIT_TEST(testTdf62255);
 CPPUNIT_TEST(testTdf93124);
@@ -1281,6 +1283,7 @@ void SdImportTest::testRowHeight()
 
 xDocShRef->DoClose();
 }
+
 void SdImportTest::testTdf93830()
 {
 // Text shape offset was ignored
@@ -1299,6 +1302,25 @@ void SdImportTest::testTdf93830()
 xDocShRef->DoClose();
 }
 
+void SdImportTest::testTdf127129()
+{
+sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf127129.pptx"), 
PPTX);
+uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, 
xDocShRef ) );
+uno::Reference< text::XTextRange > xParagraph( getParagraphFromShape( 0, 
xShape ) );
+uno::Reference< text::XTextRange > xRun( getRunFromParagraph( 0, 
xParagraph ) );
+uno::Reference< beans::XPropertySet > xPropSet( xRun, uno::UNO_QUERY_THROW 
);
+
+sal_Int32 nCharColor;
+xPropSet->getPropertyValue( "CharColor" ) >>= nCharColor;
+CPPUNIT_ASSERT_EQUAL( sal_Int32(0x00), nCharColor );
+
+// Without the accompanying fix in place, the highlight would be -1
+sal_Int32 nCharBackColor;
+xPropSet->getPropertyValue( "CharBackColor" ) >>= nCharBackColor;
+CPPUNIT_ASSERT_EQUAL( sal_Int32(0xFF00), nCharBackColor );
+
+xDocShRef->DoClose();
+}
 void SdImportTest::testTdf93097()
 {
 // Throwing metadata import aborted the filter, check that metadata is now 
imported.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-09-17 Thread Balazs Varga (via logerrit)
 oox/source/export/drawingml.cxx|3 ++-
 sd/qa/unit/data/odp/testLegacyShapeAutofit.odp |binary
 sd/qa/unit/export-tests-ooxml2.cxx |   18 ++
 3 files changed, 20 insertions(+), 1 deletion(-)

New commits:
commit 3fe3588d6743c27c3734b1b4993f5155c15abe98
Author: Balazs Varga 
AuthorDate: Wed Aug 21 16:00:42 2019 +0200
Commit: Xisco Faulí 
CommitDate: Tue Sep 17 15:29:47 2019 +0200

tdf#127030 PPTX export: keep fixed size of legacy shapes

Classical/legacy shapes lost their fixed size by exporting them with the
option "Resize shape to fit text".

Regression from commit 86b14cc8bd910651cef422a0f7408adc0fc51a17
(tdf#119617 Fix export of Autofit property of shapes to PPTX)

Change-Id: Iab67db113edc61f4c94a89ec1bb8df0736c26f21
Reviewed-on: https://gerrit.libreoffice.org/77888
Reviewed-by: László Németh 
Tested-by: László Németh 
(cherry picked from commit b50d1a42064c8333926166ec047d3467c83d2fd0)
Reviewed-on: https://gerrit.libreoffice.org/79060
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 95d160ab5e4a..de0c65cbcd8d 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2726,8 +2726,9 @@ void DrawingML::WriteText( const Reference< XInterface >& 
rXIface, const OUStrin
 }
 else
 {
+// tdf#127030: Only custom shapes obey the TextAutoGrowHeight 
option.
 bool bTextAutoGrowHeight = false;
-if (GetProperty(rXPropSet, "TextAutoGrowHeight"))
+if (dynamic_cast(rXIface.get()) && 
GetProperty(rXPropSet, "TextAutoGrowHeight"))
 mAny >>= bTextAutoGrowHeight;
 mpFS->singleElementNS(XML_a, (bTextAutoGrowHeight ? 
XML_spAutoFit : XML_noAutofit));
 }
diff --git a/sd/qa/unit/data/odp/testLegacyShapeAutofit.odp 
b/sd/qa/unit/data/odp/testLegacyShapeAutofit.odp
new file mode 100755
index ..16a900b636c8
Binary files /dev/null and b/sd/qa/unit/data/odp/testLegacyShapeAutofit.odp 
differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 5a6fbbd5f7f6..6d29d075c62d 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -175,6 +175,7 @@ public:
 void testTdf111786();
 void testFontScale();
 void testShapeAutofitPPTX();
+void testLegacyShapeAutofitPPTX();
 void testTdf115394();
 void testTdf115394Zero();
 void testTdf115005();
@@ -267,6 +268,7 @@ public:
 CPPUNIT_TEST(testTdf111786);
 CPPUNIT_TEST(testFontScale);
 CPPUNIT_TEST(testShapeAutofitPPTX);
+CPPUNIT_TEST(testLegacyShapeAutofitPPTX);
 CPPUNIT_TEST(testTdf115394);
 CPPUNIT_TEST(testTdf115394Zero);
 CPPUNIT_TEST(testTdf115005);
@@ -1644,6 +1646,22 @@ void SdOOXMLExportTest2::testShapeAutofitPPTX()
 assertXPath(pXmlDocContent, 
"/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr/a:noAutofit", 1);
 }
 
+void SdOOXMLExportTest2::testLegacyShapeAutofitPPTX()
+{
+sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/testLegacyShapeAutofit.odp"),
 ODP);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+xmlDocPtr pXmlDocContent = parseExport(tempFile, "ppt/slides/slide1.xml");
+CPPUNIT_ASSERT(pXmlDocContent);
+
+// Text in a legacy rectangle
+assertXPath(pXmlDocContent, 
"/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:bodyPr/a:noAutofit", 1);
+// Text in (closed) Polygon
+assertXPath(pXmlDocContent, 
"/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:bodyPr/a:noAutofit", 1);
+// Text in a legacy ellipse
+assertXPath(pXmlDocContent, 
"/p:sld/p:cSld/p:spTree/p:sp[3]/p:txBody/a:bodyPr/a:noAutofit", 1);
+}
+
 void SdOOXMLExportTest2::testTdf115394()
 {
 sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf115394.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-3' - oox/source sw/qa

2019-09-04 Thread Tamás Zolnai (via logerrit)
 oox/source/ole/axbinarywriter.cxx|4 ++--
 sw/qa/extras/ooxmlexport/data/tdf118169.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx   |   11 +++
 3 files changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 7d9f20a723a73300e05a9885c5f02516f771692d
Author: Tamás Zolnai 
AuthorDate: Wed Aug 28 16:24:59 2019 +0200
Commit: Xisco Faulí 
CommitDate: Wed Sep 4 15:30:07 2019 +0200

tdf#118169: ActiveX form control saved incorrectly with accented letters

Write out unicode strings without any compression.

Change-Id: I93cadc40bacbd679724c3404fd870cba48065650
Reviewed-on: https://gerrit.libreoffice.org/78234
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai 
Signed-off-by: Xisco Fauli 
Reviewed-on: https://gerrit.libreoffice.org/78592

diff --git a/oox/source/ole/axbinarywriter.cxx 
b/oox/source/ole/axbinarywriter.cxx
index 89d2dc25351a..400e6fbde551 100644
--- a/oox/source/ole/axbinarywriter.cxx
+++ b/oox/source/ole/axbinarywriter.cxx
@@ -144,8 +144,8 @@ void AxBinaryPropertyWriter::writePairProperty( AxPairData& 
orPairData )
 
 void AxBinaryPropertyWriter::writeStringProperty( OUString& orValue )
 {
-sal_uInt32 nSize = orValue.getLength();
-setFlag(  nSize, AX_STRING_COMPRESSED );
+sal_uInt32 nSize = orValue.getLength() * 2;
+setFlag(  nSize, AX_STRING_COMPRESSED, false );
 maOutStrm.writeAligned< sal_uInt32 >( nSize );
 maLargeProps.push_back( ComplexPropVector::value_type( new StringProperty( 
orValue, nSize ) ) );
 startNextProperty();
diff --git a/sw/qa/extras/ooxmlexport/data/tdf118169.docx 
b/sw/qa/extras/ooxmlexport/data/tdf118169.docx
new file mode 100644
index ..2510fb3e59eb
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf118169.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index aab416a86f25..6a71a8e24747 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -414,6 +414,17 @@ DECLARE_OOXMLEXPORT_TEST(tdf127085, "tdf127085.docx")
 uno::Reference xShape(getShape(1), uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(sal_Int16(50), getProperty(xShape, 
"FillTransparence"));
 }
+
+DECLARE_OOXMLEXPORT_TEST(tdf118169, "tdf118169.docx")
+{
+// Unicode characters were converted to question marks.
+uno::Reference xControlShape(getShape(1), 
uno::UNO_QUERY);
+uno::Reference 
xPropertySet(xControlShape->getControl(), uno::UNO_QUERY);
+uno::Reference xServiceInfo(xPropertySet, 
uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(true, 
bool(xServiceInfo->supportsService("com.sun.star.form.component.CheckBox")));
+CPPUNIT_ASSERT_EQUAL(OUString(u"őőő"), 
getProperty(xPropertySet, "Label"));
+}
+
 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-6-3' - oox/source sw/qa

2019-08-29 Thread Tamás Zolnai (via logerrit)
 oox/source/export/drawingml.cxx  |   10 +++---
 sw/qa/extras/ooxmlexport/data/tdf127085.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx   |6 ++
 3 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 4719c2360a5fa347707d47db7e3e85a5f1dd267a
Author: Tamás Zolnai 
AuthorDate: Thu Aug 22 15:57:41 2019 +0200
Commit: Miklos Vajna 
CommitDate: Thu Aug 29 09:40:33 2019 +0200

tdf#127085: FILESAVE: Transparency is lost after RT

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

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

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 79046932000b..95d160ab5e4a 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1272,14 +1272,18 @@ void 
DrawingML::WriteImageBrightnessContrastTransparence(uno::Reference();
 if (GetProperty(rXPropSet, "AdjustContrast"))
 nContrast = mAny.get();
-if (GetProperty(rXPropSet, "Transparency"))
-nTransparence = mAny.get();
+// Used for shapes with picture fill
+if (GetProperty(rXPropSet, "FillTransparence"))
+nTransparence = mAny.get();
+// Used for pictures
+if (nTransparence == 0 && GetProperty(rXPropSet, "Transparency"))
+nTransparence = static_cast(mAny.get());
 
 
 if (nBright || nContrast)
diff --git a/sw/qa/extras/ooxmlexport/data/tdf127085.docx 
b/sw/qa/extras/ooxmlexport/data/tdf127085.docx
new file mode 100644
index ..65556fe38abd
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf127085.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 0f4174033a29..aab416a86f25 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -408,6 +408,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf125518, "tdf125518.odt")
 CPPUNIT_ASSERT_EQUAL(OUString("Object3"), anchorName);
 }
 
+DECLARE_OOXMLEXPORT_TEST(tdf127085, "tdf127085.docx")
+{
+// Fill transparency was lost during export
+uno::Reference xShape(getShape(1), uno::UNO_QUERY);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(50), getProperty(xShape, 
"FillTransparence"));
+}
 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-6-3' - oox/source

2019-07-15 Thread Gabor Kelemen (via logerrit)
 oox/source/helper/graphichelper.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 1c04b5c97ca3b12e52ec55572da77f7b6636e34c
Author: Gabor Kelemen 
AuthorDate: Sun Jul 14 20:21:08 2019 +0200
Commit: Xisco Faulí 
CommitDate: Mon Jul 15 12:05:35 2019 +0200

tdf#126310 Disable lazy loading of WMF images

Change-Id: I70d271e29bedc640cbfeab187ddb9ffce3e779e6
Reviewed-on: https://gerrit.libreoffice.org/75599
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
(cherry picked from commit 184a4771dad448a37f80b29bc62ad62e0a6a4bb6)
Reviewed-on: https://gerrit.libreoffice.org/75614
Reviewed-by: Xisco Faulí 

diff --git a/oox/source/helper/graphichelper.cxx 
b/oox/source/helper/graphichelper.cxx
index 6ada6cd5a5a0..8e56f58ccabb 100644
--- a/oox/source/helper/graphichelper.cxx
+++ b/oox/source/helper/graphichelper.cxx
@@ -355,9 +355,9 @@ Reference< XGraphic > GraphicHelper::importEmbeddedGraphic( 
const OUString& rStr
 EmbeddedGraphicMap::const_iterator aIt = maEmbeddedGraphics.find( 
rStreamName );
 if( aIt == maEmbeddedGraphics.end() )
 {
-// Lazy-loading doesn't work with TIFF at the moment.
+// Lazy-loading doesn't work with TIFF or WMF at the moment.
 WmfExternal aHeader;
-if (rStreamName.endsWith(".tiff") && !pExtHeader)
+if ( (rStreamName.endsWith(".tiff") || 
rStreamName.endsWith(".wmf") ) && !pExtHeader)
 pExtHeader = 
 
 xGraphic = importGraphic(mxStorage->openInputStream(rStreamName), 
pExtHeader);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-07-10 Thread Grzegorz Araminowicz (via logerrit)
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |   30 
 sd/qa/unit/import-tests-smartart.cxx|5 ++-
 2 files changed, 4 insertions(+), 31 deletions(-)

New commits:
commit 4220b3caa405d301f8c15ea25049a33e4bc8138a
Author: Grzegorz Araminowicz 
AuthorDate: Wed Jul 10 10:27:08 2019 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jul 10 16:21:56 2019 +0200

SmartArt: hide connectors in org chart as they don't work correctly

Fixing them would require a lot of effort.
Changes are needed in data part (connector shapes are not created in group
shapes associated with data shapes) and in layout part - routing them
differently in all 4 or 5 hierBranch styles, with assistants and without.

Change-Id: I48840454b0272dff9ba42db2eb5d65945642459a
Reviewed-on: https://gerrit.libreoffice.org/75339
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/75348

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 7f77880b28e8..12dcae71663c 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -104,28 +104,6 @@ bool containsDataNodeType(const oox::drawingml::ShapePtr& 
pShape, sal_Int32 nTyp
 
 return false;
 }
-
-/// Sets the position and size of a connector inside a hierChild algorithm.
-void setHierChildConnPosSize(const oox::drawingml::ShapePtr& pShape)
-{
-// Connect to the top center of the child.
-awt::Point aShapePoint = pShape->getPosition();
-awt::Size aShapeSize = pShape->getSize();
-tools::Rectangle aRectangle(Point(aShapePoint.X, aShapePoint.Y),
-Size(aShapeSize.Width, aShapeSize.Height));
-Point aTo = aRectangle.TopCenter();
-
-// Connect from the bottom center of the parent.
-Point aFrom = aTo;
-aFrom.setY(aFrom.getY() - aRectangle.getHeight() * 0.3);
-
-tools::Rectangle aRect(aFrom, aTo);
-aRect.Justify();
-aShapePoint = awt::Point(aRect.Left(), aRect.Top());
-aShapeSize = awt::Size(aRect.getWidth(), aRect.getHeight());
-pShape->setPosition(aShapePoint);
-pShape->setSize(aShapeSize);
-}
 }
 
 namespace oox { namespace drawingml {
@@ -407,7 +385,7 @@ sal_Int32 AlgAtom::getConnectorType()
 nEndSty = maMap.find(oox::XML_endSty)->second;
 
 if (nConnRout == oox::XML_bend)
-return oox::XML_bentConnector3;
+return 0; // was oox::XML_bentConnector3 - connectors are hidden in 
org chart as they don't work anyway
 if (nBegSty == oox::XML_arr && nEndSty == oox::XML_arr)
 return oox::XML_leftRightArrow;
 if (nBegSty == oox::XML_arr)
@@ -571,12 +549,6 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
 
 rShape->setSubType(nType);
 rShape->getCustomShapeProperties()->setShapePresetType(nType);
-
-if (nType == XML_bentConnector3)
-{
-setHierChildConnPosSize(rShape);
-break;
-}
 }
 
 // Parse constraints to adjust the size.
diff --git a/sd/qa/unit/import-tests-smartart.cxx 
b/sd/qa/unit/import-tests-smartart.cxx
index ffb3a8add28a..9226bbe79152 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -878,10 +878,11 @@ void SdImportTestSmartArt::testOrgChart()
 uno::Reference xAssistantConnector(
 getChildShape(getChildShape(getChildShape(xGroup, 1), 1), 0), 
uno::UNO_QUERY);
 CPPUNIT_ASSERT(xAssistantConnector.is());
-awt::Point aAssistantConnectorPos = xAssistantConnector->getPosition();
+//awt::Point aAssistantConnectorPos = xAssistantConnector->getPosition();
 // This failed, the vertical positions of the connector and the shape of
 // the assistant were the same.
-CPPUNIT_ASSERT_LESS(aAssistantPos.Y, aAssistantConnectorPos.Y);
+//CPPUNIT_ASSERT_LESS(aAssistantPos.Y, aAssistantConnectorPos.Y);
+// connectors are hidden as they don't work correctly
 
 // Make sure the height of xManager and xManager2 is the same.
 uno::Reference xManager2(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-07-08 Thread Grzegorz Araminowicz (via logerrit)
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx|3 +--
 oox/source/drawingml/diagram/diagramlayoutatoms.hxx|   12 +---
 oox/source/drawingml/diagram/layoutatomvisitorbase.cxx |2 --
 oox/source/drawingml/diagram/layoutatomvisitorbase.hxx |4 +---
 oox/source/drawingml/diagram/layoutatomvisitors.cxx|   15 +--
 5 files changed, 12 insertions(+), 24 deletions(-)

New commits:
commit ca042fea20d86aad2deac34d88010b0ab185c901
Author: Grzegorz Araminowicz 
AuthorDate: Sun Jul 7 11:31:22 2019 +0200
Commit: Miklos Vajna 
CommitDate: Mon Jul 8 13:46:28 2019 +0200

Revert "SmartArt: support multiple levels of shapes in LayoutNodes"

As we have presentation node - shape mapping, keeping shape level 
information is no longer needed.

This reverts commit 596a03b65e1b870be671ea1a44f4fba9fc66e4ae.

Change-Id: Ibde1b4afde41778304138253c1548422c5b173c3
Reviewed-on: https://gerrit.libreoffice.org/75173
Tested-by: Jenkins
Reviewed-by: Grzegorz Araminowicz 
Reviewed-on: https://gerrit.libreoffice.org/75204
Reviewed-by: Miklos Vajna 

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index a981dd99138c..f3c3f52dce04 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -419,8 +419,7 @@ sal_Int32 AlgAtom::getConnectorType()
 }
 
 void AlgAtom::layoutShape( const ShapePtr& rShape,
-   const std::vector& rConstraints,
-   sal_Int32 /*nShapeLevel*/ )
+   const std::vector& rConstraints )
 {
 switch(mnType)
 {
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
index eafe8ce1f1ae..d77a98135c02 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
@@ -161,8 +161,7 @@ public:
 void addParam( sal_Int32 nType, sal_Int32 nVal )
 { maMap[nType]=nVal; }
 void layoutShape( const ShapePtr& rShape,
-  const std::vector& rConstraints,
-  sal_Int32 nShapeLevel );
+  const std::vector& rConstraints );
 
 void setAspectRatio(double fAspectRatio) { mfAspectRatio = fAspectRatio; }
 
@@ -237,7 +236,6 @@ class LayoutNode
 {
 public:
 typedef std::map VarMap;
-typedef std::map> ShapeLevelMap;
 
 LayoutNode(const Diagram& rDgm) : LayoutAtom(*this), mrDgm(rDgm), 
mnChildOrder(0) {}
 const Diagram& getDiagram() const
@@ -255,10 +253,10 @@ public:
 { mpExistingShape = pShape; }
 const ShapePtr& getExistingShape() const
 { return mpExistingShape; }
-const ShapeLevelMap& getNodeShapes() const
+const std::vector & getNodeShapes() const
 { return mpNodeShapes; }
-void addNodeShape(const ShapePtr& pShape, sal_Int32 nLevel)
-{ mpNodeShapes[nLevel].push_back(pShape); }
+void addNodeShape(const ShapePtr& pShape)
+{ mpNodeShapes.push_back(pShape); }
 
 bool setupShape( const ShapePtr& rShape,
  const dgm::Point* pPresNode ) const;
@@ -271,7 +269,7 @@ private:
 OUString msMoveWith;
 OUString msStyleLabel;
 ShapePtr mpExistingShape;
-ShapeLevelMapmpNodeShapes;
+std::vectormpNodeShapes;
 sal_Int32mnChildOrder;
 };
 
diff --git a/oox/source/drawingml/diagram/layoutatomvisitorbase.cxx 
b/oox/source/drawingml/diagram/layoutatomvisitorbase.cxx
index c8761ffa3d67..98206433653a 100644
--- a/oox/source/drawingml/diagram/layoutatomvisitorbase.cxx
+++ b/oox/source/drawingml/diagram/layoutatomvisitorbase.cxx
@@ -131,11 +131,9 @@ void LayoutAtomVisitorBase::visit(LayoutNode& rAtom)
 
 const dgm::Point* pPreviousNode = mpCurrentNode;
 mpCurrentNode = pNewNode;
-mnCurrLevel++;
 
 defaultVisit(rAtom);
 
-mnCurrLevel--;
 mpCurrentNode = pPreviousNode;
 }
 
diff --git a/oox/source/drawingml/diagram/layoutatomvisitorbase.hxx 
b/oox/source/drawingml/diagram/layoutatomvisitorbase.hxx
index 25f2b4dea54b..7007cf283070 100644
--- a/oox/source/drawingml/diagram/layoutatomvisitorbase.hxx
+++ b/oox/source/drawingml/diagram/layoutatomvisitorbase.hxx
@@ -50,8 +50,7 @@ public:
 mpCurrentNode(pRootPoint),
 mnCurrIdx(0),
 mnCurrStep(0),
-mnCurrCnt(0),
-mnCurrLevel(0)
+mnCurrCnt(0)
 {}
 
 void defaultVisit(LayoutAtom const& rAtom);
@@ -68,7 +67,6 @@ protected:
 sal_Int32 mnCurrIdx;
 sal_Int32 mnCurrStep;
 sal_Int32 mnCurrCnt;
-sal_Int32 mnCurrLevel;
 };
 
 class ShallowPresNameVisitor : public LayoutAtomVisitorBase
diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.cxx 
b/oox/source/drawingml/diagram/layoutatomvisitors.cxx
index 

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

2019-07-08 Thread Grzegorz Araminowicz (via logerrit)
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |   55 
 sd/qa/unit/import-tests-smartart.cxx|5 +
 2 files changed, 5 insertions(+), 55 deletions(-)

New commits:
commit dc063e223cc12df52fa377d4009b30b46c62acaf
Author: Grzegorz Araminowicz 
AuthorDate: Thu Jul 4 16:16:47 2019 +0200
Commit: Miklos Vajna 
CommitDate: Mon Jul 8 12:10:08 2019 +0200

SmartArt: remove calculateHierChildOffsetScale() from org chart algorithm

Its purpose was to center subtree if sibling parent has no children.
It was not working correctly for complex charts causing shapes to overlap.
Without it chart is still readable (just sometimes not centered).
Remove it for now until more universal solution is found.

Change-Id: I397bd4264d6ce0fadf5c5fa1352f22e72d5d163a
Reviewed-on: https://gerrit.libreoffice.org/75092
Tested-by: Jenkins
Reviewed-by: Grzegorz Araminowicz 
Reviewed-on: https://gerrit.libreoffice.org/75138
Reviewed-by: Miklos Vajna 

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 6a8ffd2c4b3e..a981dd99138c 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -105,51 +105,6 @@ bool containsDataNodeType(const oox::drawingml::ShapePtr& 
pShape, sal_Int32 nTyp
 return false;
 }
 
-/**
- * Calculates the offset and scaling for pShape (laid out with the hierChild
- * algorithm) based on the siblings of pParent.
- */
-void calculateHierChildOffsetScale(const oox::drawingml::ShapePtr& pShape,
-   const oox::drawingml::LayoutNode* pParent, 
sal_Int32& rXOffset,
-   double& rWidthScale, sal_Int32 nLevel)
-{
-if (!pParent)
-return;
-
-auto pShapes = pParent->getNodeShapes().find(nLevel - 1);
-if (pShapes == pParent->getNodeShapes().end())
-return;
-
-const std::vector& rParents = pShapes->second;
-for (size_t nParent = 0; nParent < rParents.size(); ++nParent)
-{
-const oox::drawingml::ShapePtr& pParentShape = rParents[nParent];
-const std::vector& rChildren = 
pParentShape->getChildren();
-if (std::none_of(rChildren.begin(), rChildren.end(),
- [pShape](const oox::drawingml::ShapePtr& pChild) { 
return pChild == pShape; }))
-// This is not our parent.
-continue;
-
-if (nParent > 0)
-{
-if (rParents[nParent - 1]->getChildren().size() == 1)
-{
-// Previous sibling of our parent has no children: can use that
-// space, so shift to the left and scale up.
-rWidthScale += 1.0;
-rXOffset -= pShape->getSize().Width;
-}
-}
-if (nParent < rParents.size() - 1)
-{
-if (rParents[nParent + 1]->getChildren().size() == 1)
-// Next sibling of our parent has no children: can use that
-// space, so scale up.
-rWidthScale += 1.0;
-}
-}
-}
-
 /// Sets the position and size of a connector inside a hierChild algorithm.
 void setHierChildConnPosSize(const oox::drawingml::ShapePtr& pShape)
 {
@@ -465,7 +420,7 @@ sal_Int32 AlgAtom::getConnectorType()
 
 void AlgAtom::layoutShape( const ShapePtr& rShape,
const std::vector& rConstraints,
-   sal_Int32 nShapeLevel )
+   sal_Int32 /*nShapeLevel*/ )
 {
 switch(mnType)
 {
@@ -750,11 +705,6 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
 std::swap(rChildren[1], rChildren[2]);
 }
 
-sal_Int32 nXOffset = 0;
-double fWidthScale = 1.0;
-if (mnType == XML_hierChild)
-calculateHierChildOffsetScale(rShape, 
getLayoutNode().getParentLayoutNode(), nXOffset, fWidthScale, nShapeLevel);
-
 awt::Size aChildSize = rShape->getSize();
 if (nDir == XML_fromT)
 {
@@ -763,11 +713,10 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
 else
 aChildSize.Width /= nCount;
 aChildSize.Height *= fHeightScale;
-aChildSize.Width *= fWidthScale;
 awt::Size aConnectorSize = aChildSize;
 aConnectorSize.Width = 1;
 
-awt::Point aChildPos(nXOffset, 0);
+awt::Point aChildPos(0, 0);
 for (auto& pChild : rShape->getChildren())
 {
 pChild->setPosition(aChildPos);
diff --git a/sd/qa/unit/import-tests-smartart.cxx 
b/sd/qa/unit/import-tests-smartart.cxx
index fde35bd0a48d..e40b364d6b58 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -832,7 +832,7 @@ void SdImportTestSmartArt::testOrgChart()
 

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

2019-06-25 Thread Grzegorz Araminowicz (via logerrit)
 oox/source/drawingml/diagram/diagramlayoutatoms.hxx |5 -
 oox/source/drawingml/diagram/layoutatomvisitors.cxx |6 +-
 oox/source/drawingml/diagram/layoutnodecontext.cxx  |1 -
 3 files changed, 1 insertion(+), 11 deletions(-)

New commits:
commit 5780e11ccaf9c3fd006d4412290e59dacb8b3368
Author: Grzegorz Araminowicz 
AuthorDate: Mon Jun 24 16:31:48 2019 +0200
Commit: Grzegorz Araminowicz 
CommitDate: Tue Jun 25 22:39:02 2019 +0200

SmartArt: move setting shape aspect ratio to alg atom visit

it allows to correctly follow if/else nodes instead of using once assigned
alg atom

Change-Id: I8c321b638524df3ca68242da6300bc8c2a838bbf
Reviewed-on: https://gerrit.libreoffice.org/74648
Tested-by: Jenkins
Reviewed-by: Grzegorz Araminowicz 
Reviewed-on: https://gerrit.libreoffice.org/74702

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
index 9fff33686dd6..ef99229b66ab 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
@@ -271,10 +271,6 @@ public:
 
 const LayoutNode* getParentLayoutNode() const;
 
-void setAlgAtom(AlgAtomPtr pAlgAtom) { mpAlgAtom = pAlgAtom; }
-
-AlgAtomPtr getAlgAtom() const { return mpAlgAtom.lock(); }
-
 private:
 const Diagram&   mrDgm;
 VarMap   mVariables;
@@ -283,7 +279,6 @@ private:
 ShapePtr mpExistingShape;
 ShapeLevelMapmpNodeShapes;
 sal_Int32mnChildOrder;
-std::weak_ptr   mpAlgAtom;
 };
 
 typedef std::shared_ptr< LayoutNode > LayoutNodePtr;
diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.cxx 
b/oox/source/drawingml/diagram/layoutatomvisitors.cxx
index 5d6f0065241d..aa1d21b179f1 100644
--- a/oox/source/drawingml/diagram/layoutatomvisitors.cxx
+++ b/oox/source/drawingml/diagram/layoutatomvisitors.cxx
@@ -43,7 +43,7 @@ void ShapeCreationVisitor::visit(ConstraintAtom& /*rAtom*/)
 
 void ShapeCreationVisitor::visit(AlgAtom& rAtom)
 {
-defaultVisit(rAtom);
+mpParentShape->setAspectRatio(rAtom.getAspectRatio());
 }
 
 void ShapeCreationVisitor::visit(ForEachAtom& rAtom)
@@ -140,8 +140,6 @@ void ShapeCreationVisitor::visit(LayoutNode& rAtom)
 if (rAtom.setupShape(pShape, pNewNode))
 {
 pShape->setInternalName(rAtom.getName());
-if (AlgAtomPtr pAlgAtom = rAtom.getAlgAtom())
-pShape->setAspectRatio(pAlgAtom->getAspectRatio());
 rAtom.addNodeShape(pShape, mnCurrLevel);
 }
 }
@@ -161,8 +159,6 @@ void ShapeCreationVisitor::visit(LayoutNode& rAtom)
 if (rAtom.setupShape(pShape, pNewNode))
 {
 pShape->setInternalName(rAtom.getName());
-if (AlgAtomPtr pAlgAtom = rAtom.getAlgAtom())
-pShape->setAspectRatio(pAlgAtom->getAspectRatio());
 pCurrParent->addChild(pShape);
 pCurrParent = pShape;
 rAtom.addNodeShape(pShape, mnCurrLevel);
diff --git a/oox/source/drawingml/diagram/layoutnodecontext.cxx 
b/oox/source/drawingml/diagram/layoutnodecontext.cxx
index 8e3e3c2f6eb4..3547aad28a7a 100644
--- a/oox/source/drawingml/diagram/layoutnodecontext.cxx
+++ b/oox/source/drawingml/diagram/layoutnodecontext.cxx
@@ -233,7 +233,6 @@ LayoutNodeContext::onCreateContext( ::sal_Int32 aElement,
 // CT_Algorithm
 AlgAtomPtr pAtom( new AlgAtom(mpNode->getLayoutNode()) );
 LayoutAtom::connect(mpNode, pAtom);
-mpNode->getLayoutNode().setAlgAtom(pAtom);
 return new AlgorithmContext( *this, rAttribs, pAtom );
 }
 case DGM_TOKEN( choose ):
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

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

2019-06-19 Thread Grzegorz Araminowicz (via logerrit)
 oox/source/drawingml/diagram/diagram.hxx|   10 
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |   14 ++
 oox/source/drawingml/diagram/diagramlayoutatoms.hxx |6 ++
 oox/source/drawingml/diagram/layoutatomvisitors.cxx |   14 ++
 oox/source/drawingml/diagram/layoutnodecontext.cxx  |5 +-
 sd/qa/unit/data/pptx/smartart-recursion.pptx|binary
 sd/qa/unit/import-tests-smartart.cxx|   42 
 7 files changed, 90 insertions(+), 1 deletion(-)

New commits:
commit a95d04250f6921730c6164fbd207ed1222c4315f
Author: Grzegorz Araminowicz 
AuthorDate: Tue Jun 11 08:31:18 2019 +0200
Commit: Grzegorz Araminowicz 
CommitDate: Wed Jun 19 14:31:53 2019 +0200

SmartArt: support ForEach references

ForEach 'ref' parameter causes specified ForEach node to be used instead.
Used to create recursive structures like organisation charts.

Change-Id: Iee61b2e103759355b59beb8d3f33eb3cce47c590
Reviewed-on: https://gerrit.libreoffice.org/74271
Tested-by: Jenkins
Reviewed-by: Grzegorz Araminowicz 
(cherry picked from commit 76478f9938a5f6d96ac65b3b633280024b60baed)
Reviewed-on: https://gerrit.libreoffice.org/74337

diff --git a/oox/source/drawingml/diagram/diagram.hxx 
b/oox/source/drawingml/diagram/diagram.hxx
index 91cb0f39fd2c..cf12dce576a7 100644
--- a/oox/source/drawingml/diagram/diagram.hxx
+++ b/oox/source/drawingml/diagram/diagram.hxx
@@ -149,6 +149,8 @@ typedef std::vector< Point >Points;
 class Diagram;
 class LayoutNode;
 typedef std::shared_ptr< LayoutNode > LayoutNodePtr;
+class LayoutAtom;
+typedef std::shared_ptr LayoutAtomPtr;
 
 typedef std::map< OUString, css::uno::Reference > 
DiagramDomMap;
 
@@ -205,6 +207,8 @@ private:
 
 typedef std::shared_ptr< DiagramData > DiagramDataPtr;
 
+typedef std::map LayoutAtomMap;
+
 class DiagramLayout
 {
 public:
@@ -233,6 +237,8 @@ public:
 { return mpStyleData; }
 const DiagramDataPtr & getStyleData() const
 { return mpStyleData; }
+LayoutAtomMap & getLayoutAtomMap()
+{ return maLayoutAtomMap; }
 
 private:
 const Diagram& mrDgm;
@@ -248,6 +254,8 @@ private:
 // TODO
 // catLst
 // clrData
+
+LayoutAtomMap maLayoutAtomMap;
 };
 
 typedef std::shared_ptr< DiagramLayout > DiagramLayoutPtr;
@@ -283,6 +291,8 @@ public:
 { return mpData; }
 void setLayout( const DiagramLayoutPtr & pLayout )
 { mpLayout = pLayout; }
+const DiagramLayoutPtr& getLayout() const
+{ return mpLayout; }
 
 DiagramQStyleMap& getStyles() { return maStyles; }
 const DiagramQStyleMap& getStyles() const { return maStyles; }
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index f9c443c5d626..6497e3ba22cf 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -229,6 +229,20 @@ void ForEachAtom::accept( LayoutAtomVisitor& rVisitor )
 rVisitor.visit(*this);
 }
 
+LayoutAtomPtr ForEachAtom::getRefAtom()
+{
+if (!msRef.isEmpty())
+{
+const LayoutAtomMap& rLayoutAtomMap = 
getLayoutNode().getDiagram().getLayout()->getLayoutAtomMap();
+LayoutAtomMap::const_iterator pRefAtom = rLayoutAtomMap.find(msRef);
+if (pRefAtom != rLayoutAtomMap.end())
+return pRefAtom->second;
+else
+SAL_WARN("oox.drawingml", "ForEach reference \"" << msRef << "\" 
not found");
+}
+return LayoutAtomPtr();
+}
+
 void ChooseAtom::accept( LayoutAtomVisitor& rVisitor )
 {
 rVisitor.visit(*this);
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
index 8a11ed5cbac8..9fff33686dd6 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
@@ -188,10 +188,16 @@ public:
 
 IteratorAttr & iterator()
 { return maIter; }
+void setRef(const OUString& rsRef)
+{ msRef = rsRef; }
+const OUString& getRef() const
+{ return msRef; }
 virtual void accept( LayoutAtomVisitor& ) override;
+LayoutAtomPtr getRefAtom();
 
 private:
 IteratorAttr maIter;
+OUString msRef;
 };
 
 typedef std::shared_ptr< ForEachAtom > ForEachAtomPtr;
diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.cxx 
b/oox/source/drawingml/diagram/layoutatomvisitors.cxx
index cd7b82aa9efd..5d6f0065241d 100644
--- a/oox/source/drawingml/diagram/layoutatomvisitors.cxx
+++ b/oox/source/drawingml/diagram/layoutatomvisitors.cxx
@@ -48,6 +48,13 @@ void ShapeCreationVisitor::visit(AlgAtom& rAtom)
 
 void ShapeCreationVisitor::visit(ForEachAtom& rAtom)
 {
+if (!rAtom.getRef().isEmpty())
+{
+if (LayoutAtomPtr pRefAtom = rAtom.getRefAtom())
+pRefAtom->accept(*this);
+return;
+}
+
 if (rAtom.iterator().mbHideLastTrans && 

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

2019-06-19 Thread Grzegorz Araminowicz (via logerrit)
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |   13 +++---
 oox/source/drawingml/diagram/diagramlayoutatoms.hxx |   12 +-
 oox/source/drawingml/diagram/layoutatomvisitors.cxx |   24 ++--
 oox/source/drawingml/diagram/layoutatomvisitors.hxx |6 -
 4 files changed, 38 insertions(+), 17 deletions(-)

New commits:
commit c94a452d0a6a2224a8b0c610e8e41024f5d5f735
Author: Grzegorz Araminowicz 
AuthorDate: Fri Jun 14 15:12:33 2019 +0200
Commit: Grzegorz Araminowicz 
CommitDate: Wed Jun 19 11:55:01 2019 +0200

SmartArt: support multiple levels of shapes in LayoutNodes

it is needed for recurrent ForEach node, so that shapes on different levels
are divided and can be layouted separately

Change-Id: Iefbc82925078fe2346858748259680fa8ea252d6
Reviewed-on: https://gerrit.libreoffice.org/74043
Tested-by: Jenkins
Reviewed-by: Grzegorz Araminowicz 
(cherry picked from commit 596a03b65e1b870be671ea1a44f4fba9fc66e4ae)
Reviewed-on: https://gerrit.libreoffice.org/74341

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 2c612233251d..f9c443c5d626 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -109,12 +109,16 @@ bool containsDataNodeType(const oox::drawingml::ShapePtr& 
pShape, sal_Int32 nTyp
  */
 void calculateHierChildOffsetScale(const oox::drawingml::ShapePtr& pShape,
const oox::drawingml::LayoutNode* pParent, 
sal_Int32& rXOffset,
-   double& rWidthScale)
+   double& rWidthScale, sal_Int32 nLevel)
 {
 if (!pParent)
 return;
 
-const std::vector& rParents = 
pParent->getNodeShapes();
+auto pShapes = pParent->getNodeShapes().find(nLevel - 1);
+if (pShapes == pParent->getNodeShapes().end())
+return;
+
+const std::vector& rParents = pShapes->second;
 for (size_t nParent = 0; nParent < rParents.size(); ++nParent)
 {
 const oox::drawingml::ShapePtr& pParentShape = rParents[nParent];
@@ -469,7 +473,8 @@ sal_Int32 AlgAtom::getConnectorType()
 }
 
 void AlgAtom::layoutShape( const ShapePtr& rShape,
-   const std::vector& rConstraints )
+   const std::vector& rConstraints,
+   sal_Int32 nShapeLevel )
 {
 switch(mnType)
 {
@@ -752,7 +757,7 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
 sal_Int32 nXOffset = 0;
 double fWidthScale = 1.0;
 if (mnType == XML_hierChild)
-calculateHierChildOffsetScale(rShape, 
getLayoutNode().getParentLayoutNode(), nXOffset, fWidthScale);
+calculateHierChildOffsetScale(rShape, 
getLayoutNode().getParentLayoutNode(), nXOffset, fWidthScale, nShapeLevel);
 
 awt::Size aChildSize = rShape->getSize();
 if (nDir == XML_fromT)
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
index e56539eb8717..8a11ed5cbac8 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
@@ -161,7 +161,8 @@ public:
 void addParam( sal_Int32 nType, sal_Int32 nVal )
 { maMap[nType]=nVal; }
 void layoutShape( const ShapePtr& rShape,
-  const std::vector& rConstraints );
+  const std::vector& rConstraints,
+  sal_Int32 nShapeLevel );
 
 void setAspectRatio(double fAspectRatio) { mfAspectRatio = fAspectRatio; }
 
@@ -236,6 +237,7 @@ class LayoutNode
 {
 public:
 typedef std::map VarMap;
+typedef std::map> ShapeLevelMap;
 
 LayoutNode(const Diagram& rDgm) : LayoutAtom(*this), mrDgm(rDgm), 
mnChildOrder(0) {}
 const Diagram& getDiagram() const
@@ -253,10 +255,10 @@ public:
 { mpExistingShape = pShape; }
 const ShapePtr& getExistingShape() const
 { return mpExistingShape; }
-const std::vector & getNodeShapes() const
+const ShapeLevelMap& getNodeShapes() const
 { return mpNodeShapes; }
-void addNodeShape(const ShapePtr& pShape)
-{ mpNodeShapes.push_back(pShape); }
+void addNodeShape(const ShapePtr& pShape, sal_Int32 nLevel)
+{ mpNodeShapes[nLevel].push_back(pShape); }
 
 bool setupShape( const ShapePtr& rShape,
  const dgm::Point* pPresNode ) const;
@@ -273,7 +275,7 @@ private:
 OUString msMoveWith;
 OUString msStyleLabel;
 ShapePtr mpExistingShape;
-std::vectormpNodeShapes;
+ShapeLevelMapmpNodeShapes;
 sal_Int32mnChildOrder;
 std::weak_ptr   mpAlgAtom;
 };
diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.cxx 

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

2019-06-14 Thread Regina Henschel (via logerrit)
 oox/source/drawingml/shape.cxx  |   77 ++--
 sd/qa/unit/data/pptx/tdf116350-texteffects.pptx |binary
 2 files changed, 58 insertions(+), 19 deletions(-)

New commits:
commit 0aff57b3a4f227c02bfdb4850bb11279325f41db
Author: Regina Henschel 
AuthorDate: Thu Jun 6 16:07:29 2019 +0200
Commit: Xisco Faulí 
CommitDate: Fri Jun 14 11:17:23 2019 +0200

tdf#125563 Adapt adjustment values to binary shape geometry

All presetTextWarp shapes are mapped to MS binary WordArt geometry in
current implementation. But they use different reference systems for
coordinates and different unit for angles. So _all_ adjustment values
have to be adapted. Error was, that only angles were treated.
Correct test file to actually contain the claimed 213.25 degree.
Other bugs than adjustment values will be addressed in separate issues.

Change-Id: I719b364af23887e50f003cf9878665755b8989ae
Reviewed-on: https://gerrit.libreoffice.org/73624
Tested-by: Jenkins
Reviewed-by: Regina Henschel 
(cherry picked from commit 95b61f7da41acaabeb0a4bf74749b8fa95ae9966)
Reviewed-on: https://gerrit.libreoffice.org/73875
Reviewed-by: Xisco Faulí 

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 4656c96bc111..34582aa0920d 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -454,36 +454,72 @@ static void lcl_createPresetShape(const 
uno::Reference& xShape,
 if (!xSet.is())
 return;
 
-auto aGdList = pCustomShapePropertiesPtr->getAdjustmentGuideList();
+// The DrawingML shapes from the presetTextWarpDefinitions are mapped to 
the definitions
+// in svx/../EnhancedCustomShapeGeometry.cxx, which are used for WordArt 
shapes from
+// binary MS Office. Therefore all adjustment values need to be adapted.
+auto aAdjGdList = pCustomShapePropertiesPtr->getAdjustmentGuideList();
 Sequence aAdjustment(
-!aGdList.empty() ? aGdList.size() : 1 );
+!aAdjGdList.empty() ? aAdjGdList.size() : 1 );
 
 int nIndex = 0;
-for (auto& aEntry : aGdList)
+for (auto& aEntry : aAdjGdList)
 {
-double fAngle = NormAngle36000( aEntry.maFormula.toDouble() / -600.0 );
-fAngle = 360.0 - fAngle / 100.0;
+double fValue = aEntry.maFormula.toDouble();
+// then: polar-handle, else: XY-handle
+// There exist only 8 polar-handles at all in presetTextWarp.
+if ((rClass == "fontwork-arch-down-curve")
+|| (rClass == "fontwork-arch-down-pour" && aEntry.maName == "adj1")
+|| (rClass == "fontwork-arch-up-curve")
+|| (rClass == "fontwork-arch-up-pour" && aEntry.maName == "adj1")
+|| (rClass == "fontwork-open-circle-curve")
+|| (rClass == "fontwork-open-circle-pour" && aEntry.maName == 
"adj1")
+|| (rClass == "fontwork-circle-curve")
+|| (rClass == "fontwork-circle-pour" && aEntry.maName == "adj1"))
+{
+// DrawingML has 1/6 degree unit, but WortArt simple degree. 
Range [0..360[
+// or range ]-180..180] doesn't matter, because only cos(angle) and
+// sin(angle) are used.
+fValue = NormAngle360(fValue / 6.0);
+}
+else
+{
+// DrawingML writes adjustment guides as relative value with 100% 
= 10,
+// but WordArt definitions use values absolute in viewBox 0 0 
21600 21600,
+// so scale with 21600/10 = 0.216, with two exceptions:
+// X-handles of waves describe increase/decrease relative to 
horizontal center.
+// The gdRefR of pour-shapes is not relative to viewBox but to 
radius.
+if ((rClass == "mso-spt158" && aEntry.maName == "adj2") // 
textDoubleWave1
+|| (rClass == "fontwork-wave" && aEntry.maName == "adj2") // 
textWave1
+|| (rClass == "mso-spt157" && aEntry.maName == "adj2") // 
textWave2
+|| (rClass == "mso-spt159" && aEntry.maName == "adj2")) // 
textWave4
+{
+fValue = (fValue + 5.0) * 0.216;
+}
+else if ( (rClass == "fontwork-arch-down-pour" && aEntry.maName == 
"adj2")
+|| (rClass == "fontwork-arch-up-pour" && aEntry.maName == 
"adj2")
+|| (rClass == "fontwork-open-circle-pour" && aEntry.maName 
== "adj2")
+|| (rClass == "fontwork-circle-pour" && aEntry.maName == 
"adj2"))
+{
+fValue *= 0.108;
+}
+else
+{
+fValue *= 0.216;
+}
+}
 
-aAdjustment[nIndex].Value <<= fAngle;
+aAdjustment[nIndex].Value <<= fValue;
 aAdjustment[nIndex++].State = css::beans::PropertyState_DIRECT_VALUE;
 }
 
-if (aGdList.empty())
-{
-// Default angle
-double fAngle = 0;

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

2019-06-08 Thread Grzegorz Araminowicz (via logerrit)
 oox/source/export/drawingml.cxx |   18 ++
 sd/qa/unit/data/pptx/tdf125551.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   17 +
 3 files changed, 31 insertions(+), 4 deletions(-)

New commits:
commit 3644c9ab6f15a5d539681e84a1d29aa30af561d5
Author: Grzegorz Araminowicz 
AuthorDate: Fri Jun 7 15:48:25 2019 +0200
Commit: Grzegorz Araminowicz 
CommitDate: Sat Jun 8 11:23:02 2019 +0200

tdf#125551 PPTX export: correct position and size of diagrams

Save position and size of diagram background instead of whole group shape.
Some diagrams contain shapes that are outside these boundaries. That caused
diagram to grow and move.

Change-Id: I909c13a5dc268f77832234b3884b91292922823c
Reviewed-on: https://gerrit.libreoffice.org/73663
Tested-by: Jenkins
Reviewed-by: Grzegorz Araminowicz 
Reviewed-on: https://gerrit.libreoffice.org/73681

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index cd91bb12cbe0..85834a14b1b0 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -67,6 +67,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -4074,10 +4075,19 @@ void DrawingML::WriteDiagram(const 
css::uno::Reference& rX
 
 mpFS->endElementNS(XML_p, XML_nvGraphicFramePr);
 
-awt::Point aPos = rXShape->getPosition();
-awt::Size aSize = rXShape->getSize();
-WriteTransformation(tools::Rectangle(Point(aPos.X, aPos.Y), 
Size(aSize.Width, aSize.Height)),
-XML_p, false, false, 0, false);
+// store size and position of background shape instead of group shape
+// as some shapes may be outside
+css::uno::Reference xShapes(rXShape, 
uno::UNO_QUERY);
+if (xShapes.is() && xShapes->hasElements())
+{
+css::uno::Reference 
xShapeBg(xShapes->getByIndex(0),
+   uno::UNO_QUERY);
+awt::Point aPos = xShapeBg->getPosition();
+awt::Size aSize = xShapeBg->getSize();
+WriteTransformation(
+tools::Rectangle(Point(aPos.X, aPos.Y), Size(aSize.Width, 
aSize.Height)),
+XML_p, false, false, 0, false);
+}
 
 mpFS->startElementNS(XML_a, XML_graphic);
 }
diff --git a/sd/qa/unit/data/pptx/tdf125551.pptx 
b/sd/qa/unit/data/pptx/tdf125551.pptx
new file mode 100644
index ..fb7c106d20e2
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf125551.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index bc987a018af2..9c6cc27aa804 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -205,6 +205,7 @@ public:
 void testTdf125360();
 void testTdf125360_1();
 void testTdf125360_2();
+void testTdf125551();
 
 CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -292,6 +293,7 @@ public:
 CPPUNIT_TEST(testTdf125360);
 CPPUNIT_TEST(testTdf125360_1);
 CPPUNIT_TEST(testTdf125360_2);
+CPPUNIT_TEST(testTdf125551);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2318,6 +2320,21 @@ void SdOOXMLExportTest2::testTdf125360_2()
 xDocShRef->DoClose();
 }
 
+void SdOOXMLExportTest2::testTdf125551()
+{
+::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf125551.pptx"), 
PPTX);
+utl::TempFile tempFile;
+xDocShRef = saveAndReload(xDocShRef.get(), PPTX, );
+
+uno::Reference xGroupShape(getShapeFromPage(0, 0, 
xDocShRef), uno::UNO_QUERY);
+uno::Reference xShapeBg(xGroupShape->getByIndex(0), 
uno::UNO_QUERY);
+
+CPPUNIT_ASSERT_EQUAL(static_cast(1024), 
xShapeBg->getPosition().X);
+CPPUNIT_ASSERT_EQUAL(static_cast(576), 
xShapeBg->getPosition().Y);
+CPPUNIT_ASSERT_EQUAL(static_cast(10815), 
xShapeBg->getSize().Width);
+CPPUNIT_ASSERT_EQUAL(static_cast(8587), 
xShapeBg->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-3' - oox/source sd/qa

2019-06-06 Thread Grzegorz Araminowicz (via logerrit)
 oox/source/drawingml/diagram/diagramlayoutatoms.cxx |   22 +++--
 sd/qa/unit/data/pptx/smartart-bullet-list.pptx  |binary
 sd/qa/unit/import-tests-smartart.cxx|   32 +++-
 3 files changed, 43 insertions(+), 11 deletions(-)

New commits:
commit d966c30d2b2a0b6d71b1c107a90b22825fed55c1
Author: Grzegorz Araminowicz 
AuthorDate: Tue Jun 4 13:51:40 2019 +0200
Commit: Miklos Vajna 
CommitDate: Thu Jun 6 10:44:03 2019 +0200

SmartArt: bullet list improvements

by default start bullet list at second level
use stBulletLvl parameter to change this behaviour

Change-Id: I5084e7bf1902fdca83bea6d57a8c1f37dd2e65be
Reviewed-on: https://gerrit.libreoffice.org/73440
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 
Reviewed-on: https://gerrit.libreoffice.org/73568

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 4d0c18c27561..2c612233251d 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -1227,27 +1227,30 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
 nBaseLevel = aParagraph->getProperties().getLevel();
 }
 
+// Start bullets at:
+// 1 - top level
+// 2 - with children (default)
+int nStartBulletsAtLevel = 2;
 ParamMap::const_iterator aBulletLvl = maMap.find(XML_stBulletLvl);
-int nStartBulletsAtLevel = 0;
 if (aBulletLvl != maMap.end())
-{
-nBaseLevel -= aBulletLvl->second;
 nStartBulletsAtLevel = aBulletLvl->second;
-}
+nStartBulletsAtLevel--;
 
+bool isBulletList = false;
 for (auto & aParagraph : pTextBody->getParagraphs())
 {
-sal_Int32 nLevel = aParagraph->getProperties().getLevel();
-aParagraph->getProperties().setLevel(nLevel - nBaseLevel);
-if (nStartBulletsAtLevel > 0 && nLevel >= nStartBulletsAtLevel)
+sal_Int32 nLevel = aParagraph->getProperties().getLevel() - 
nBaseLevel;
+aParagraph->getProperties().setLevel(nLevel);
+if (nLevel >= nStartBulletsAtLevel)
 {
 // It is not possible to change the bullet style for text.
-sal_Int32 nLeftMargin = 285750 * (nLevel - 
nStartBulletsAtLevel) / EMU_PER_HMM;
+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();
+isBulletList = true;
 }
 }
 
@@ -1260,8 +1263,7 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
 for (auto & aParagraph : pTextBody->getParagraphs())
 aParagraph->getProperties().setParaAdjust(aAlignment);
 }
-else if (std::all_of(pTextBody->getParagraphs().begin(), 
pTextBody->getParagraphs().end(),
-[](const std::shared_ptr& aParagraph) { return 
aParagraph->getProperties().getLevel() == 0; }))
+else if (!isBulletList)
 {
 // if not list use default alignment - centered
 for (auto & aParagraph : pTextBody->getParagraphs())
diff --git a/sd/qa/unit/data/pptx/smartart-bullet-list.pptx 
b/sd/qa/unit/data/pptx/smartart-bullet-list.pptx
new file mode 100644
index ..d95bdb769140
Binary files /dev/null and b/sd/qa/unit/data/pptx/smartart-bullet-list.pptx 
differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx 
b/sd/qa/unit/import-tests-smartart.cxx
index 722cb142fbfc..775411c57bba 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -78,6 +78,7 @@ public:
 void testCenterCycle();
 void testFontSize();
 void testVerticalBlockList();
+void testBulletList();
 
 CPPUNIT_TEST_SUITE(SdImportTestSmartArt);
 
@@ -117,6 +118,7 @@ public:
 CPPUNIT_TEST(testCenterCycle);
 CPPUNIT_TEST(testFontSize);
 CPPUNIT_TEST(testVerticalBlockList);
+CPPUNIT_TEST(testBulletList);
 
 CPPUNIT_TEST_SUITE_END();
 };
@@ -674,7 +676,7 @@ void SdImportTestSmartArt::testAccentProcess()
 
 uno::Reference 
xRules(xPara->getPropertyValue("NumberingRules"),
uno::UNO_QUERY);
-comphelper::SequenceAsHashMap aRule(xRules->getByIndex(1));
+