summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTibor Nagy <nagy.tibor2@nisz.hu>2021-04-28 13:10:59 +0200
committerLászló Németh <nemeth@numbertext.org>2021-05-04 17:27:55 +0200
commitcfa672013a1a75ff53993084ae5e69fcd985d010 (patch)
treeac929f2ee06b2a19430074b243d48f8471ceae96 /sd
parent84b4bca314ded015911ab986e8f999518616b248 (diff)
tdf#103347 PPTX import: fix duplicated slide name
PPTX import uses title text as slide names, but this resulted duplicated slide names in the case of repeating title text, which forbidden by UNO API: == GenericDrawPage.idl == /** Gets or sets the name of this page. <p>Duplicated page names inside a document are not allowed. */ [optional] interface com::sun::star::container::XNamed; Now the import code skips the duplicated title text, resulting default numbered slide names instead of the duplicated title names. Note: it seems, this hasn't fixed the jumping slide selection, e.g. sometimes pressing Shift-F5 still presents the first slide instead of the actual one. Change-Id: I98511c3c9a59598ea113e7387db5202d7f8a7cd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114810 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sd')
-rwxr-xr-xsd/qa/unit/data/pptx/tdf103347.pptxbin0 -> 35161 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx25
2 files changed, 25 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tdf103347.pptx b/sd/qa/unit/data/pptx/tdf103347.pptx
new file mode 100755
index 000000000000..12078519076a
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf103347.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index bbdc8b5a19cd..bf539dfdd08d 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -85,6 +85,7 @@
#include <com/sun/star/text/GraphicCrop.hpp>
#include <com/sun/star/text/XTextCursor.hpp>
#include <com/sun/star/xml/dom/XDocument.hpp>
+#include <com/sun/star/container/XNamed.hpp>
#include <stlpool.hxx>
#include <comphelper/processfactory.hxx>
@@ -233,6 +234,7 @@ public:
void testTdf106638();
void testTdf113198();
void testTdf49856();
+ void testTdf103347();
CPPUNIT_TEST_SUITE(SdImportTest);
@@ -349,6 +351,7 @@ public:
CPPUNIT_TEST(testMirroredGraphic);
CPPUNIT_TEST(testGreysScaleGraphic);
CPPUNIT_TEST(testTdf134210CropPosition);
+ CPPUNIT_TEST(testTdf103347);
CPPUNIT_TEST_SUITE_END();
};
@@ -3443,6 +3446,28 @@ void SdImportTest::testGreysScaleGraphic()
xDocShRef->DoClose();
}
+void SdImportTest::testTdf103347()
+{
+ sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf103347.pptx"), PPTX);
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(),
+ uno::UNO_QUERY_THROW);
+
+ uno::Reference<drawing::XDrawPage> xPage1(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<container::XNamed> xNamed1(xPage1, uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(OUString("Hello"), xNamed1->getName());
+
+ uno::Reference<drawing::XDrawPage> xPage2(xDoc->getDrawPages()->getByIndex(1), uno::UNO_QUERY);
+ uno::Reference<container::XNamed> xNamed2(xPage2, uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(OUString("page2"), xNamed2->getName());
+
+ uno::Reference<drawing::XDrawPage> xPage3(xDoc->getDrawPages()->getByIndex(2), uno::UNO_QUERY);
+ uno::Reference<container::XNamed> xNamed3(xPage3, uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(OUString("page3"), xNamed3->getName());
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();