diff options
-rw-r--r-- | drawinglayer/source/tools/primitive2dxmldump.cxx | 4 | ||||
-rw-r--r-- | svx/qa/unit/data/slide-background.odp | bin | 0 -> 28090 bytes | |||
-rw-r--r-- | svx/qa/unit/data/slide-background.png | bin | 0 -> 18426 bytes | |||
-rw-r--r-- | svx/qa/unit/sdr.cxx | 24 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrattributecreator.cxx | 8 |
5 files changed, 35 insertions, 1 deletions
diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx b/drawinglayer/source/tools/primitive2dxmldump.cxx index d48115baafa6..a78b4a894e7a 100644 --- a/drawinglayer/source/tools/primitive2dxmldump.cxx +++ b/drawinglayer/source/tools/primitive2dxmldump.cxx @@ -422,7 +422,9 @@ void Primitive2dXmlDump::decomposeAndWrite( } rWriter.attribute("x", aTranslate.getX()); rWriter.attribute("y", aTranslate.getY()); - rWriter.attribute("text", rTextSimplePortionPrimitive2D.getText()); + OUString aText = rTextSimplePortionPrimitive2D.getText(); + // TODO share code with sax_fastparser::FastSaxSerializer::write(). + rWriter.attribute("text", aText.replaceAll("", "	")); rWriter.attribute("fontcolor", convertColorToString( rTextSimplePortionPrimitive2D.getFontColor())); diff --git a/svx/qa/unit/data/slide-background.odp b/svx/qa/unit/data/slide-background.odp Binary files differnew file mode 100644 index 000000000000..ea62bd63903b --- /dev/null +++ b/svx/qa/unit/data/slide-background.odp diff --git a/svx/qa/unit/data/slide-background.png b/svx/qa/unit/data/slide-background.png Binary files differnew file mode 100644 index 000000000000..3a8c5ceb4262 --- /dev/null +++ b/svx/qa/unit/data/slide-background.png diff --git a/svx/qa/unit/sdr.cxx b/svx/qa/unit/sdr.cxx index 10f9901a0d60..e6ca7f7a87ad 100644 --- a/svx/qa/unit/sdr.cxx +++ b/svx/qa/unit/sdr.cxx @@ -118,6 +118,30 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testZeroWidthTextWrap) // i.e. the text on the only shape on the slide had 12 lines, not a single one. assertXPath(pDocument, "//textsimpleportion", 1); } + +CPPUNIT_TEST_FIXTURE(SdrTest, testSlideBackground) +{ + // Given a document with a slide what has a linked background image: + test::Directories aDirectories; + OUString aURL = aDirectories.getURLFromSrc(u"svx/qa/unit/data/slide-background.odp"); + getComponent() = loadFromDesktop(aURL); + uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY); + uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0), + uno::UNO_QUERY); + + // When rendering that document: + drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence + = renderPageToPrimitives(xDrawPage); + + // Then make sure that the background has a bitmap: + drawinglayer::Primitive2dXmlDump aDumper; + xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1 + // - Actual : 0 + // i.e. the rendering did not find the bitmap. + assertXPath(pDocument, "//bitmap", 1); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 8b2fa387a836..855bc0daf573 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -58,6 +58,7 @@ #include <svx/xbtmpit.hxx> #include <svl/itempool.hxx> #include <vcl/svapp.hxx> +#include <vcl/GraphicLoader.hxx> #include <basegfx/range/b2drange.hxx> #include <svx/svx3ditems.hxx> #include <com/sun/star/drawing/ProjectionMode.hpp> @@ -656,6 +657,13 @@ namespace drawinglayer::primitive2d { Graphic aGraphic(rSet.Get(XATTR_FILLBITMAP).GetGraphicObject().GetGraphic()); + OUString aOriginURL = aGraphic.getOriginURL(); + if (aGraphic.GetType() == GraphicType::Default && !aOriginURL.isEmpty()) + { + aGraphic = vcl::graphic::loadFromURL(aGraphic.getOriginURL()); + aGraphic.setOriginURL(aOriginURL); + } + if(GraphicType::Bitmap != aGraphic.GetType() && GraphicType::GdiMetafile != aGraphic.GetType()) { // no content if not bitmap or metafile |