summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/source/ppt/presentationfragmenthandler.cxx11
-rw-r--r--sd/qa/unit/data/pptx/bnc584721_1_2.pptx (renamed from sd/qa/unit/data/pptx/bnc584721_1.pptx)bin15008 -> 15008 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx19
3 files changed, 29 insertions, 1 deletions
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index bef84de51bd6..811550ea561f 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -465,9 +465,20 @@ bool PresentationFragmentHandler::importSlide( const FragmentHandlerRef& rxSlide
SlidePersistPtr pMasterPersistPtr( pSlidePersistPtr->getMasterPersist() );
if ( pMasterPersistPtr.get() )
{
+ // Setting "Layout" property adds extra title and outliner preset shapes to the master slide
+ Reference< drawing::XDrawPage > xMasterSlide(pMasterPersistPtr->getPage());
+ const int nCount = xMasterSlide->getCount();
+
const OUString sLayout = "Layout";
uno::Reference< beans::XPropertySet > xSet( xSlide, uno::UNO_QUERY_THROW );
xSet->setPropertyValue( sLayout, Any( pMasterPersistPtr->getLayoutFromValueToken() ) );
+
+ while( nCount < xMasterSlide->getCount())
+ {
+ Reference< drawing::XShape > xShape;
+ xMasterSlide->getByIndex(xMasterSlide->getCount()-1) >>= xShape;
+ xMasterSlide->remove(xShape);
+ }
}
while( xSlide->getCount() )
{
diff --git a/sd/qa/unit/data/pptx/bnc584721_1.pptx b/sd/qa/unit/data/pptx/bnc584721_1_2.pptx
index dbbcabddcbbb..dbbcabddcbbb 100644
--- a/sd/qa/unit/data/pptx/bnc584721_1.pptx
+++ b/sd/qa/unit/data/pptx/bnc584721_1_2.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 3036a58ad9b3..3f8d1447deda 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -79,6 +79,7 @@ public:
void testBnc480256();
void testCreationDate();
void testBnc584721_1();
+ void testBnc584721_2();
CPPUNIT_TEST_SUITE(SdFiltersTest);
CPPUNIT_TEST(testDocumentLayout);
@@ -102,6 +103,7 @@ public:
CPPUNIT_TEST(testBnc480256);
CPPUNIT_TEST(testCreationDate);
CPPUNIT_TEST(testBnc584721_1);
+ CPPUNIT_TEST(testBnc584721_2);
CPPUNIT_TEST_SUITE_END();
};
@@ -715,7 +717,7 @@ void SdFiltersTest::testBnc584721_1()
{
// Title text shape on the master page contained wrong text.
- ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_1.pptx"), PPTX);
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_1_2.pptx"), PPTX);
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
@@ -729,6 +731,21 @@ void SdFiltersTest::testBnc584721_1()
xDocShRef->DoClose();
}
+void SdFiltersTest::testBnc584721_2()
+{
+ // Import created an extra/unneeded outliner shape on the master slide next to the imported title shape.
+
+ ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/bnc584721_1_2.pptx"), PPTX);
+
+ SdDrawDocument *pDoc = xDocShRef->GetDoc();
+ CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
+ const SdrPage *pPage = &(pDoc->GetPage(1)->TRG_GetMasterPage());
+ CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
+ CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount());
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdFiltersTest);
CPPUNIT_PLUGIN_IMPLEMENT();