[Libreoffice-commits] core.git: 2 commits - include/LibreOfficeKit oox/source sd/qa
Andrea Gelmini (via logerrit)
logerrit at kemper.freedesktop.org
Tue May 21 07:30:12 UTC 2019
include/LibreOfficeKit/LibreOfficeKitEnums.h | 2 -
oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 22 ++++++++++++--
sd/qa/unit/data/pptx/smartart-center-cycle.pptx |binary
sd/qa/unit/import-tests-smartart.cxx | 30 ++++++++++++++++++++
4 files changed, 50 insertions(+), 4 deletions(-)
New commits:
commit 6953aa7ce0e276c4961d7caac9ea2542d92f08bc
Author: Andrea Gelmini <andrea.gelmini at gelma.net>
AuthorDate: Mon May 20 19:33:45 2019 +0000
Commit: Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Tue May 21 09:29:05 2019 +0200
Fix typo
Change-Id: I7fd8a1657f0c39937860671de54e7f85e8f13a35
Reviewed-on: https://gerrit.libreoffice.org/72623
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
Tested-by: Julien Nabet <serval2412 at yahoo.fr>
diff --git a/include/LibreOfficeKit/LibreOfficeKitEnums.h b/include/LibreOfficeKit/LibreOfficeKitEnums.h
index 6b706a70cd6d..5b3dda95d7a3 100644
--- a/include/LibreOfficeKit/LibreOfficeKitEnums.h
+++ b/include/LibreOfficeKit/LibreOfficeKitEnums.h
@@ -195,7 +195,7 @@ typedef enum
* }
*
* where the "svg" property is a string containing an svg document
- * which is a rapresentation of the pie segment.
+ * which is a representation of the pie segment.
*/
LOK_CALLBACK_GRAPHIC_SELECTION = 6,
commit c91302d8818587a6b817ee1325b920578f06d5c5
Author: Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
AuthorDate: Sun May 19 15:40:14 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue May 21 09:28:55 2019 +0200
SmartArt: Support ctrShpMap cycle algorithm parameter
it allows to lay out first node in the center and others around it
Change-Id: Ie9d7d66df638767d8713e301dee2a89a63900fbe
Reviewed-on: https://gerrit.libreoffice.org/72589
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 323fafe12045..cab140cc84e8 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -661,18 +661,34 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
const sal_Int32 nStartAngle = maMap.count(XML_stAng) ? maMap.find(XML_stAng)->second : 0;
const sal_Int32 nSpanAngle = maMap.count(XML_spanAng) ? maMap.find(XML_spanAng)->second : 360;
const sal_Int32 nRotationPath = maMap.count(XML_rotPath) ? maMap.find(XML_rotPath)->second : XML_none;
- const sal_Int32 nShapes = rShape->getChildren().size();
+ const sal_Int32 nctrShpMap = maMap.count(XML_ctrShpMap) ? maMap.find(XML_ctrShpMap)->second : XML_none;
const awt::Size aCenter(rShape->getSize().Width / 2, rShape->getSize().Height / 2);
const awt::Size aChildSize(rShape->getSize().Width / 4, rShape->getSize().Height / 4);
const awt::Size aConnectorSize(rShape->getSize().Width / 12, rShape->getSize().Height / 12);
const sal_Int32 nRadius = std::min(
(rShape->getSize().Width - aChildSize.Width) / 2,
(rShape->getSize().Height - aChildSize.Height) / 2);
- const sal_Int32 nConnectorRadius = nRadius * cos(basegfx::deg2rad(nSpanAngle/nShapes));
+
+ std::vector<oox::drawingml::ShapePtr> aCycleChildren = rShape->getChildren();
+
+ if (nctrShpMap == XML_fNode)
+ {
+ // first node placed in center, others around
+ oox::drawingml::ShapePtr pCenterShape = aCycleChildren.front();
+ aCycleChildren.erase(aCycleChildren.begin());
+ const awt::Point aCurrPos(aCenter.Width - aChildSize.Width / 2,
+ aCenter.Height - aChildSize.Height / 2);
+ pCenterShape->setPosition(aCurrPos);
+ pCenterShape->setSize(aChildSize);
+ pCenterShape->setChildSize(aChildSize);
+ }
+
+ const sal_Int32 nShapes = aCycleChildren.size();
+ const sal_Int32 nConnectorRadius = nRadius * cos(basegfx::deg2rad(nSpanAngle / nShapes));
const sal_Int32 nConnectorAngle = nSpanAngle > 0 ? 0 : 180;
sal_Int32 idx = 0;
- for (auto & aCurrShape : rShape->getChildren())
+ for (auto & aCurrShape : aCycleChildren)
{
const double fAngle = static_cast<double>(idx)*nSpanAngle/nShapes + nStartAngle;
awt::Size aCurrSize = aChildSize;
diff --git a/sd/qa/unit/data/pptx/smartart-center-cycle.pptx b/sd/qa/unit/data/pptx/smartart-center-cycle.pptx
new file mode 100644
index 000000000000..72f3685fb2ab
Binary files /dev/null and b/sd/qa/unit/data/pptx/smartart-center-cycle.pptx differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index a1acd88cc213..1e726a5d1339 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -74,6 +74,7 @@ public:
void testInteropGrabBag();
void testBackground();
void testBackgroundDrawingmlFallback();
+ void testCenterCycle();
CPPUNIT_TEST_SUITE(SdImportTestSmartArt);
@@ -110,6 +111,7 @@ public:
CPPUNIT_TEST(testInteropGrabBag);
CPPUNIT_TEST(testBackground);
CPPUNIT_TEST(testBackgroundDrawingmlFallback);
+ CPPUNIT_TEST(testCenterCycle);
CPPUNIT_TEST_SUITE_END();
};
@@ -1136,6 +1138,34 @@ void SdImportTestSmartArt::testBackgroundDrawingmlFallback()
xDocShRef->DoClose();
}
+void SdImportTestSmartArt::testCenterCycle()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(
+ m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-center-cycle.pptx"), PPTX);
+ uno::Reference<drawing::XShapes> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xGroup.is());
+
+ uno::Reference<drawing::XShapes> xGroupNested(xGroup->getByIndex(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xGroupNested.is());
+
+ uno::Reference<drawing::XShape> xShapeCenter(xGroupNested->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShapeA(xGroupNested->getByIndex(1), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShapeB(xGroupNested->getByIndex(2), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShapeC(xGroupNested->getByIndex(3), uno::UNO_QUERY);
+
+ uno::Reference<text::XText> xTextCenter(xShapeCenter, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xTextCenter.is());
+ CPPUNIT_ASSERT_EQUAL(OUString("center"), xTextCenter->getString());
+
+ CPPUNIT_ASSERT_LESS(xShapeCenter->getPosition().Y, xShapeA->getPosition().Y);
+ CPPUNIT_ASSERT_GREATER(xShapeCenter->getPosition().X, xShapeB->getPosition().X);
+ CPPUNIT_ASSERT_GREATER(xShapeCenter->getPosition().Y, xShapeB->getPosition().Y);
+ CPPUNIT_ASSERT_LESS(xShapeCenter->getPosition().X, xShapeC->getPosition().X);
+ CPPUNIT_ASSERT_GREATER(xShapeCenter->getPosition().Y, xShapeC->getPosition().Y);
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list