summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTibor Nagy <nagy.tibor2@nisz.hu>2023-01-26 09:17:56 +0100
committerLászló Németh <nemeth@numbertext.org>2023-02-17 20:01:46 +0000
commita2c32afcae257e797ad69ab2346bbe3b6a2fa8ae (patch)
treefe607b6ca8412fd853514d379da21af3a4ee5889 /sd
parentfc1c9d7ce98a5405785907d8d18db9354b32b824 (diff)
tdf#149756 tdf#152545 PPTX import: position of standard connector - part2
and add new compatibility option "ConnectorUseSnapRect". Standard connectors (bentConnector3, bentConnector4, bentConnector5) are improved. MSO calculates the edge track differently, so have to add "ConnectorUseSnapRect" compatibility option: - For PPTX file format, it is set to true and use the snap rectangle - For ODP format, it is set to false by default and use the bounding rectangle. Follow-up to commit eec48130271188cab63665acedbabf1ff5e850a2 "tdf#148926 tdf#151678 PPTX import: position of standard connector - part1" (bentConnector2) Change-Id: Icca84708d6e10d44ebf7262415d055ce9cfc157d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146162 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/data/pptx/standardConnectors.pptxbin0 -> 36923 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx34
-rw-r--r--sd/source/ui/docshell/docshel4.cxx8
3 files changed, 40 insertions, 2 deletions
diff --git a/sd/qa/unit/data/pptx/standardConnectors.pptx b/sd/qa/unit/data/pptx/standardConnectors.pptx
new file mode 100644
index 000000000000..46bb0735f40f
--- /dev/null
+++ b/sd/qa/unit/data/pptx/standardConnectors.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 07c105fc1b0a..3ab567c43877 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -84,6 +84,7 @@ public:
void testDocumentLayout();
void testTdf152434();
+ void testStandardConnectors();
void testConnectors();
void testTdf153036_resizedConnectorL();
void testTdf150719();
@@ -161,6 +162,7 @@ public:
CPPUNIT_TEST(testDocumentLayout);
CPPUNIT_TEST(testTdf152434);
+ CPPUNIT_TEST(testStandardConnectors);
CPPUNIT_TEST(testConnectors);
CPPUNIT_TEST(testTdf153036_resizedConnectorL);
CPPUNIT_TEST(testTdf150719);
@@ -355,12 +357,40 @@ void SdImportTest::testTdf152434()
CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount());
}
+void SdImportTest::testStandardConnectors()
+{
+ createSdImpressDoc("pptx/standardConnectors.pptx");
+
+ sal_Int32 aEdgeValue[] = { -1352, -2457, 3977, -2900, -1261, 4611, -1431, -2643, 3830, 3438 };
+
+ sal_Int32 nCount = 0;
+ sal_Int32 nEdgeLine = 0;
+ for (size_t i = 0; i < 10; i++)
+ {
+ uno::Reference<beans::XPropertySet> xConnector(getShapeFromPage(i, 0));
+ bool bConnector = xConnector->getPropertySetInfo()->hasPropertyByName("EdgeKind");
+ if (bConnector)
+ {
+ nEdgeLine = xConnector->getPropertyValue("EdgeLine1Delta").get<sal_Int32>();
+ CPPUNIT_ASSERT_EQUAL(aEdgeValue[nCount], nEdgeLine);
+ nCount++;
+
+ nEdgeLine = xConnector->getPropertyValue("EdgeLine2Delta").get<sal_Int32>();
+ if (nEdgeLine != 0)
+ {
+ CPPUNIT_ASSERT_EQUAL(aEdgeValue[nCount], nEdgeLine);
+ nCount++;
+ }
+ }
+ }
+}
+
void SdImportTest::testConnectors()
{
createSdImpressDoc("pptx/connectors.pptx");
- sal_Int32 aEdgeValue[] = { -1123, -1123, -1547, 1432, 1356, -1357, 1604, -1540,
- 599, 1288, -1629, -1052, -513, 1569, -1283, 333 };
+ sal_Int32 aEdgeValue[] = { -1167, -1167, -1591, 1476, 1356, -1357, 1604, -1540,
+ 607, 1296, -1638, -1060, -522, 1578, -1291, 333 };
sal_Int32 nCount = 0;
for (size_t i = 0; i < 18; i++)
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 4df8aee97a4a..aeac2a5a3052 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -402,6 +402,14 @@ bool DrawDocShell::ImportFrom(SfxMedium &rMedium,
mpDoc->SetSummationOfParagraphs();
}
+ if (aFilterName == "Impress MS PowerPoint 2007 XML")
+ {
+ // This is a "MS Compact" mode for connectors.
+ // The Libreoffice uses bounding rectangle of connected shapes but
+ // MSO uses snap rectangle when calculate the edge track.
+ mpDoc->SetConnectorUseSnapRect(true);
+ }
+
if (aFilterName == "Impress MS PowerPoint 2007 XML" ||
aFilterName == "Impress MS PowerPoint 2007 XML AutoPlay" ||
aFilterName == "Impress MS PowerPoint 2007 XML VBA" ||