diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-04-12 10:30:11 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2016-04-19 07:14:12 +0000 |
commit | 1e2f33e9d66b4017a63b410da0029ef5caab7661 (patch) | |
tree | cae9fa1590aeb3c1ee6f6d95d157ecb176d280eb | |
parent | cfb4519a971e3168f202486665a8ce28942ed97b (diff) |
tdf#99224 PPTX export: implement support for images with text
In case an image had text, then ShapeExport::WriteGraphicObjectShapePart()
wanted to write "only the text", but PowerPointShapeExport::WriteTextShape()
had no idea how to write an image, so at the end nothing was exported.
(cherry picked from commit fc70e4c4e192372f77511bc6ce2bc77b9c9539be)
Conflicts:
sd/qa/unit/export-tests.cxx
Change-Id: I6c1ad0b41d4c5dc260b952322fb8a59e7f175603
Reviewed-on: https://gerrit.libreoffice.org/24017
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit e8e761ed003f5e509fea8eebd47111b1ed6aa672)
Reviewed-on: https://gerrit.libreoffice.org/24076
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
-rw-r--r-- | sd/qa/unit/data/odp/tdf99224.odp | bin | 0 -> 11212 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests.cxx | 12 | ||||
-rw-r--r-- | sd/qa/unit/sdmodeltestbase.hxx | 16 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 4 |
4 files changed, 31 insertions, 1 deletions
diff --git a/sd/qa/unit/data/odp/tdf99224.odp b/sd/qa/unit/data/odp/tdf99224.odp Binary files differnew file mode 100644 index 000000000000..e52a000dec54 --- /dev/null +++ b/sd/qa/unit/data/odp/tdf99224.odp diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 4d1de955efc6..2387447dbdb9 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -112,6 +112,7 @@ public: void testBnc822341(); #endif void testTdf80224(); + void testTdf99224(); CPPUNIT_TEST_SUITE(SdExportTest); CPPUNIT_TEST(testFdo90607); @@ -148,6 +149,7 @@ public: CPPUNIT_TEST(testBnc822341); #endif CPPUNIT_TEST(testTdf80224); + CPPUNIT_TEST(testTdf99224); CPPUNIT_TEST_SUITE_END(); }; @@ -1238,6 +1240,16 @@ void SdExportTest::testTdf80224() xDocShRef->DoClose(); } +void SdExportTest::testTdf99224() +{ + sd::DrawDocShellRef xShell = loadURL(getURLFromSrc("/sd/qa/unit/data/odp/tdf99224.odp"), ODP); + xShell = saveAndReload(xShell, PPTX); + uno::Reference<drawing::XDrawPage> xPage = getPage(0, xShell); + // This was 0: the image with text was lost on export. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), xPage->getCount()); + xShell->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx index a5b136cc663f..717a5dbf87db 100644 --- a/sd/qa/unit/sdmodeltestbase.hxx +++ b/sd/qa/unit/sdmodeltestbase.hxx @@ -250,6 +250,22 @@ protected: } xDocShRef->DoClose(); } + + uno::Reference< drawing::XDrawPagesSupplier > getDoc( sd::DrawDocShellRef xDocShRef ) + { + uno::Reference< drawing::XDrawPagesSupplier > xDoc ( + xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW ); + CPPUNIT_ASSERT_MESSAGE( "no document", xDoc.is() ); + return xDoc; + } + + uno::Reference< drawing::XDrawPage > getPage( int nPage, sd::DrawDocShellRef xDocShRef ) + { + uno::Reference< drawing::XDrawPagesSupplier > xDoc( getDoc( xDocShRef ) ); + uno::Reference< drawing::XDrawPage > xPage( xDoc->getDrawPages()->getByIndex( nPage ), uno::UNO_QUERY_THROW ); + CPPUNIT_ASSERT_MESSAGE( "no page", xPage.is() ); + return xPage; + } }; #endif diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 0c045d3f56ab..20aeed8f0e12 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -232,7 +232,7 @@ ShapeExport& PowerPointShapeExport::WriteTextShape( Reference< XShape > xShape ) DBG(printf( "shape(text): %s\n", USS(sShapeType) )); - if ( sShapeType == "com.sun.star.drawing.TextShape" ) + if ( sShapeType == "com.sun.star.drawing.TextShape" || sShapeType == "com.sun.star.drawing.GraphicObjectShape" ) { ShapeExport::WriteTextShape( xShape ); } @@ -273,6 +273,8 @@ ShapeExport& PowerPointShapeExport::WriteTextShape( Reference< XShape > xShape ) if( !WritePlaceholder( xShape, Title, mbMaster ) ) ShapeExport::WriteTextShape( xShape ); } + else + SAL_WARN("sd.filter", "PowerPointShapeExport::WriteTextShape: shape of type '" << sShapeType << "' is ignored"); return *this; } |