summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTibor Nagy <nagy.tibor2@nisz.hu>2021-06-23 13:15:57 +0200
committerLászló Németh <nemeth@numbertext.org>2021-06-29 22:49:24 +0200
commitf0c8a0a00d74a21ac940923f02710bdceb63f508 (patch)
treea8812431cb86f579a6484e13610bf6c58bf989f4
parent66cc4828d438655d9a1f2affbc594c4096d1acaf (diff)
tdf#142913 PPTX: slideshow setting “Start from” not imported
Note: see Slide Show->Slide Show Settings...->Range->From: on the UI, or press Shift-F5 after loading the unit test document sd/qa/unit/data/pptx/tdf142913.pptx. Change-Id: I2e10a4353c26600bf405475cb89990413c81dc1e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117705 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 3d55149dcf19cffefcc19c16a3abbe8851453c5e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118062 Tested-by: Jenkins
-rw-r--r--include/oox/ppt/presPropsfragmenthandler.hxx1
-rw-r--r--oox/source/ppt/presPropsfragmenthandler.cxx18
-rw-r--r--sd/qa/unit/data/pptx/tdf142913.pptxbin0 -> 35076 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx19
4 files changed, 38 insertions, 0 deletions
diff --git a/include/oox/ppt/presPropsfragmenthandler.hxx b/include/oox/ppt/presPropsfragmenthandler.hxx
index 3edf60cf3273..5125ee3357c7 100644
--- a/include/oox/ppt/presPropsfragmenthandler.hxx
+++ b/include/oox/ppt/presPropsfragmenthandler.hxx
@@ -33,6 +33,7 @@ public:
private:
bool m_bLoop = false;
OUString m_sId;
+ OUString m_sSt;
};
} // namespace ppt
} // namespace oox
diff --git a/oox/source/ppt/presPropsfragmenthandler.cxx b/oox/source/ppt/presPropsfragmenthandler.cxx
index 47965050b164..ca466177e944 100644
--- a/oox/source/ppt/presPropsfragmenthandler.cxx
+++ b/oox/source/ppt/presPropsfragmenthandler.cxx
@@ -13,12 +13,17 @@
#include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/drawing/XDrawPages.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <oox/core/xmlfilterbase.hxx>
#include <oox/helper/attributelist.hxx>
#include <oox/ppt/presPropsfragmenthandler.hxx>
#include <oox/token/namespaces.hxx>
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
namespace oox::ppt
{
PresPropsFragmentHandler::PresPropsFragmentHandler(core::XmlFilterBase& rFilter,
@@ -47,6 +52,16 @@ void PresPropsFragmentHandler::finalizeImport()
xPresentationProps->setPropertyValue("CustomShow",
css::uno::Any(aNameSeq[m_sId.toInt32()]));
}
+
+ if (!m_sSt.isEmpty())
+ {
+ Reference<drawing::XDrawPagesSupplier> xDPS(getFilter().getModel(), uno::UNO_QUERY_THROW);
+ Reference<drawing::XDrawPages> xDrawPages(xDPS->getDrawPages(), uno::UNO_SET_THROW);
+ Reference<drawing::XDrawPage> xDrawPage;
+ xDrawPages->getByIndex(m_sSt.toInt32() - 1) >>= xDrawPage;
+ Reference<container::XNamed> xNamed(xDrawPage, uno::UNO_QUERY_THROW);
+ xPresentationProps->setPropertyValue("FirstPage", uno::Any(xNamed->getName()));
+ }
}
core::ContextHandlerRef PresPropsFragmentHandler::onCreateContext(sal_Int32 aElementToken,
@@ -62,6 +77,9 @@ core::ContextHandlerRef PresPropsFragmentHandler::onCreateContext(sal_Int32 aEle
case PPT_TOKEN(custShow):
m_sId = rAttribs.getString(XML_id).get();
return this;
+ case PPT_TOKEN(sldRg):
+ m_sSt = rAttribs.getString(XML_st).get();
+ return this;
}
return this;
}
diff --git a/sd/qa/unit/data/pptx/tdf142913.pptx b/sd/qa/unit/data/pptx/tdf142913.pptx
new file mode 100644
index 000000000000..4fd938de1e41
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf142913.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index ad013f280180..5978bf42aa01 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -122,6 +122,7 @@ public:
virtual void setUp() override;
void testDocumentLayout();
+ void testTdf142913();
void testTdf142590();
void testCustomSlideShow();
void testInternalHyperlink();
@@ -242,6 +243,7 @@ public:
CPPUNIT_TEST_SUITE(SdImportTest);
CPPUNIT_TEST(testDocumentLayout);
+ CPPUNIT_TEST(testTdf142913);
CPPUNIT_TEST(testTdf142590);
CPPUNIT_TEST(testCustomSlideShow);
CPPUNIT_TEST(testInternalHyperlink);
@@ -438,6 +440,23 @@ void SdImportTest::testDocumentLayout()
}
}
+void SdImportTest::testTdf142913()
+{
+ ::sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf142913.pptx"), PPTX);
+
+ uno::Reference<presentation::XPresentationSupplier> xPresentationSupplier(
+ xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xPresentationProps(xPresentationSupplier->getPresentation(),
+ uno::UNO_QUERY_THROW);
+
+ OUString sFirstPage = xPresentationProps->getPropertyValue("FirstPage").get<OUString>();
+
+ CPPUNIT_ASSERT_EQUAL(OUString("Second"), sFirstPage);
+
+ xDocShRef->DoClose();
+}
+
void SdImportTest::testTdf142590()
{
::sd::DrawDocShellRef xDocShRef