[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - oox/source sd/qa
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 cbc9190fd61c5e4ac88d92ebe1af64eff907d7d5 Author: Gülşah Köse AuthorDate: Wed Nov 27 13:35:29 2019 +0300 Commit: Andras Timar CommitDate: Fri Nov 29 11:38:58 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/84037 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 9ac4fd744963..bc6b7db45a44 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -2537,7 +2537,8 @@ void DrawingML::WriteText( const Reference< XInterface >& rXIface, const OUStrin if( !xXText.is() ) return; -sal_Int32 nTextRotateAngle = 0; +sal_Int32 nTextPreRotateAngle = 0; +double nTextRotateAngle = 0; #define DEFLRINS 254 #define DEFTBINS 127 @@ -2578,20 +2579,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; } } } @@ -2634,7 +2636,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, FSEND ); if( !presetWarp.isEmpty()) { 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 59795b9f3c22..bf35a56dcb52 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -101,6 +101,7 @@ public: void testTdf111884(); void testTdf112633(); void testTdf128952(); +void testTdf127090(); void testCustomXml(); void testPictureTransparency(); void testTdf94238(); @@ -134,6 +135,7 @@ public: CPPUNIT_TEST(testTdf111884); CPPUNIT_TEST(testTdf112633); CPPUNIT_TEST(testTdf128952); +CPPUNIT_TEST(testTdf127090); CPPUNIT_TEST(testCustomXml); CPPUNIT_TEST(testPictureTransparency); CPPUNIT_TEST(testTdf94238); @@ -853,6 +855,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 'distro/collabora/cp-6.2' - oox/source sd/qa
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 baac2e608dd0781cdce0e038b2a2d80537b77974 Author: Tamas Bunth AuthorDate: Tue Nov 19 12:38:56 2019 +0100 Commit: Andras Timar CommitDate: Fri Nov 29 10:51:32 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í Reviewed-on: https://gerrit.libreoffice.org/84038 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 93619d0e7642..baf9b66a996e 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -206,7 +206,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 b38d5e51d0c9..c525444c5b26 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -186,7 +186,6 @@ public: void testTdf77747(); void testTdf116266(); void testTdf126324(); -void testTdf128684(); bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, std::vector& rExpected); void testPatternImport(); @@ -196,6 +195,8 @@ public: void testTdf120028(); void testTdf120028b(); void testCropToShape(); +void testTdf128684(); +void testTdf113198(); CPPUNIT_TEST_SUITE(SdImportTest); @@ -284,6 +285,7 @@ public: CPPUNIT_TEST(testTdf120028b); CPPUNIT_TEST(testCropToShape); CPPUNIT_TEST(testTdf128684); +CPPUNIT_TEST(testTdf113198); CPPUNIT_TEST_SUITE_END(); }; @@ -2694,7 +2696,6 @@ void SdImportTest::testCropToShape() CPPUNIT_ASSERT_EQUAL(css::drawing::BitmapMode_STRETCH, bitmapmode); } - void SdImportTest::testTdf128684() { sd::DrawDocShellRef xDocShRef @@ -2722,6 +2723,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 'distro/collabora/cp-6.2' - oox/source sd/qa
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 fe9545f05a5d5ad871564a24a395d9893fe00da4 Author: Gülşah Köse AuthorDate: Fri Nov 22 14:05:24 2019 +0300 Commit: Andras Timar CommitDate: Fri Nov 22 23:18:22 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/83536 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 7962c41f6406..9ac4fd744963 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1576,7 +1576,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 601497cee2b3..59795b9f3c22 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -100,6 +100,7 @@ public: void testParaMarginAndindentation(); void testTdf111884(); void testTdf112633(); +void testTdf128952(); void testCustomXml(); void testPictureTransparency(); void testTdf94238(); @@ -132,6 +133,7 @@ public: CPPUNIT_TEST(testParaMarginAndindentation); CPPUNIT_TEST(testTdf111884); CPPUNIT_TEST(testTdf112633); +CPPUNIT_TEST(testTdf128952); CPPUNIT_TEST(testCustomXml); CPPUNIT_TEST(testPictureTransparency); CPPUNIT_TEST(testTdf94238); @@ -836,6 +838,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 'distro/collabora/cp-6.2' - oox/source sd/qa
oox/source/drawingml/customshapeproperties.cxx |2 + sd/qa/unit/data/pptx/tdf128684.pptx|binary sd/qa/unit/import-tests.cxx| 30 + 3 files changed, 32 insertions(+) New commits: commit 15606d7539d5f82598f522e7f00be70433b2 Author: Tamas Bunth AuthorDate: Thu Nov 14 00:56:08 2019 +0100 Commit: Andras Timar CommitDate: Sun Nov 17 16:55:10 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/83022 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx index 1b1f6513ab22..3f6d58b07e9f 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 0de7cf85963e..b38d5e51d0c9 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -186,6 +186,7 @@ public: void testTdf77747(); void testTdf116266(); void testTdf126324(); +void testTdf128684(); bool checkPattern(sd::DrawDocShellRef const & rDocRef, int nShapeNumber, std::vector& rExpected); void testPatternImport(); @@ -282,6 +283,7 @@ public: CPPUNIT_TEST(testTdf120028); CPPUNIT_TEST(testTdf120028b); CPPUNIT_TEST(testCropToShape); +CPPUNIT_TEST(testTdf128684); CPPUNIT_TEST_SUITE_END(); }; @@ -2692,6 +2694,34 @@ void SdImportTest::testCropToShape() CPPUNIT_ASSERT_EQUAL(css::drawing::BitmapMode_STRETCH, bitmapmode); } + +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(int i=0;i>= 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 'distro/collabora/cp-6.2' - oox/source sd/qa
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 128b02cf56c929fd9d5e39a4aa214e081a58bb6a Author: Grzegorz Araminowicz AuthorDate: Wed Jul 10 10:27:08 2019 +0200 Commit: Grzegorz Araminowicz CommitDate: Thu Jul 11 11:31:24 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/75397 Tested-by: Jenkins CollaboraOffice Reviewed-by: Grzegorz Araminowicz diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index 93d12f23db8d..46d058b9ad68 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 8e5632801b45..6e615afdc5bc 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -745,10 +745,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 'distro/collabora/cp-6.2' - oox/source sd/qa
oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 76 ++-- oox/source/drawingml/diagram/diagramlayoutatoms.hxx |3 2 files changed, 28 insertions(+), 51 deletions(-) New commits: commit e222aa0d7882d5365e6ea28e82613795f5a8629a Author: Grzegorz Araminowicz AuthorDate: Thu Apr 11 14:56:37 2019 +0200 Commit: Grzegorz Araminowicz CommitDate: Thu Jul 11 10:27:56 2019 +0200 SmartArt: better detecting connector arrow type * basing on provided conn alg params * also moved setting arrow direction from getConnectorType() to algorithms Change-Id: I76898a4ccad961edd389677c31e7d8c05bcdf5fe Reviewed-on: https://gerrit.libreoffice.org/70598 Tested-by: Jenkins Reviewed-by: Miklos Vajna Reviewed-on: https://gerrit.libreoffice.org/75395 Tested-by: Jenkins CollaboraOffice Reviewed-by: Grzegorz Araminowicz diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index 8d569bc8fa3b..9c83d95fea5d 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -87,56 +87,6 @@ sal_Int32 getPropertyFromConstraint(sal_Int32 nConstraint) return 0; } -/// Determines the connector shape type from a linear alg. -sal_Int32 getConnectorType(const oox::drawingml::LayoutNode* pNode) -{ -sal_Int32 nType = oox::XML_rightArrow; - -if (!pNode) -return nType; - -// This is cheaper than visiting the whole sub-tree. -if (pNode->getName().startsWith("hierChild")) -return oox::XML_bentConnector3; - -for (const auto& pChild : pNode->getChildren()) -{ -auto pAlgAtom = dynamic_cast(pChild.get()); -if (!pAlgAtom) -continue; - -switch (pAlgAtom->getType()) -{ -case oox::XML_lin: -{ -sal_Int32 nDir = oox::XML_fromL; -if (pAlgAtom->getMap().count(oox::XML_linDir)) -nDir = pAlgAtom->getMap().find(oox::XML_linDir)->second; - -switch (nDir) -{ -case oox::XML_fromL: -nType = oox::XML_rightArrow; -break; -case oox::XML_fromR: -nType = oox::XML_leftArrow; -break; -} -break; -} -case oox::XML_hierChild: -{ -// TODO should be able -// to customize this. -nType = oox::XML_bentConnector3; -break; -} -} -} - -return nType; -} - /** * Determines if pShape is (or contains) a presentation of a data node of type * nType. @@ -444,6 +394,30 @@ void AlgAtom::accept( LayoutAtomVisitor& rVisitor ) rVisitor.visit(*this); } +sal_Int32 AlgAtom::getConnectorType() +{ +sal_Int32 nConnRout = 0; +sal_Int32 nBegSty = 0; +sal_Int32 nEndSty = 0; +if (maMap.count(oox::XML_connRout)) +nConnRout = maMap.find(oox::XML_connRout)->second; +if (maMap.count(oox::XML_begSty)) +nBegSty = maMap.find(oox::XML_begSty)->second; +if (maMap.count(oox::XML_endSty)) +nEndSty = maMap.find(oox::XML_endSty)->second; + +if (nConnRout == oox::XML_bend) +return oox::XML_bentConnector3; +if (nBegSty == oox::XML_arr && nEndSty == oox::XML_arr) +return oox::XML_leftRightArrow; +if (nBegSty == oox::XML_arr) +return oox::XML_leftArrow; +if (nEndSty == oox::XML_arr) +return oox::XML_rightArrow; + +return oox::XML_rightArrow; +} + void AlgAtom::layoutShape( const ShapePtr& rShape, const std::vector& rConstraints ) { @@ -559,7 +533,7 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, { // There is no shape type "conn", replace it by an arrow based // on the direction of the parent linear layout. -sal_Int32 nType = getConnectorType(getLayoutNode().getParentLayoutNode()); +sal_Int32 nType = getConnectorType(); rShape->setSubType(nType); rShape->getCustomShapeProperties()->setShapePresetType(nType); diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx index 726e75e2b01e..c742f604a409 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx @@ -178,6 +178,9 @@ private: ParamMap maMap; /// Aspect ratio is not integer, so not part of maMap. double mfAspectRatio = 0; + +/// Determines the connector shape type for conn algorithm +sal_Int32 getConnectorType(); }; typedef std::shared_ptr< AlgAtom > AlgAtomPtr; diff --git a/sd/qa/unit/data/pptx/smartart-mutidirectional.pptx
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - oox/source sd/qa
oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 57 sd/qa/unit/import-tests-smartart.cxx|5 + 2 files changed, 5 insertions(+), 57 deletions(-) New commits: commit 8eafe9d63e6c265f6104fba3c21fc404a118621d Author: Grzegorz Araminowicz AuthorDate: Thu Jul 4 16:16:47 2019 +0200 Commit: Grzegorz Araminowicz CommitDate: Thu Jul 11 09:35:25 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/75392 Tested-by: Jenkins CollaboraOffice diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index 503f141a4fa7..eff192868c61 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -155,53 +155,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(); -auto it = std::find_if( -rChildren.begin(), rChildren.end(), -[pShape](const oox::drawingml::ShapePtr& pChild) { return pChild == pShape; }); -if (it == rChildren.end()) -// 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) { @@ -493,7 +446,7 @@ void AlgAtom::accept( LayoutAtomVisitor& rVisitor ) void AlgAtom::layoutShape( const ShapePtr& rShape, const std::vector& rConstraints, - sal_Int32 nShapeLevel ) + sal_Int32 /*nShapeLevel*/ ) { switch(mnType) { @@ -739,11 +692,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) { @@ -752,11 +700,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 1a5fe78decf4..e10d407ee359 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -699,7 +699,7 @@ void
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - oox/source sd/qa
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 c3e0d46062c6b37dfa74b6b388767c61912145f4 Author: Grzegorz Araminowicz AuthorDate: Tue Jun 4 13:51:40 2019 +0200 Commit: Andras Timar CommitDate: Sat Jun 15 07:36:33 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/74086 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index d7d6fda1e1e0..a4b80548e3dd 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -1196,27 +1196,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; } } @@ -1229,8 +1232,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 5a0cd7679ea1..930006fd3931 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -75,6 +75,7 @@ public: void testBackgroundDrawingmlFallback(); void testFontSize(); void testVerticalBlockList(); +void testBulletList(); CPPUNIT_TEST_SUITE(SdImportTestSmartArt); @@ -112,6 +113,7 @@ public: CPPUNIT_TEST(testBackgroundDrawingmlFallback); CPPUNIT_TEST(testFontSize); CPPUNIT_TEST(testVerticalBlockList); +CPPUNIT_TEST(testBulletList); CPPUNIT_TEST_SUITE_END(); }; @@ -534,7 +536,7 @@ void SdImportTestSmartArt::testAccentProcess() uno::Reference xRules(xPara->getPropertyValue("NumberingRules"), uno::UNO_QUERY); -