diff options
-rw-r--r-- | sw/qa/core/layout/data/bullet.png | bin | 0 -> 351 bytes | |||
-rw-r--r-- | sw/qa/core/layout/data/linked-bullet.odt | bin | 0 -> 8779 bytes | |||
-rw-r--r-- | sw/qa/core/layout/layout.cxx | 21 | ||||
-rw-r--r-- | sw/source/core/layout/paintfrm.cxx | 8 |
4 files changed, 29 insertions, 0 deletions
diff --git a/sw/qa/core/layout/data/bullet.png b/sw/qa/core/layout/data/bullet.png Binary files differnew file mode 100644 index 000000000000..4e2dcf414919 --- /dev/null +++ b/sw/qa/core/layout/data/bullet.png diff --git a/sw/qa/core/layout/data/linked-bullet.odt b/sw/qa/core/layout/data/linked-bullet.odt Binary files differnew file mode 100644 index 000000000000..ae165531abba --- /dev/null +++ b/sw/qa/core/layout/data/linked-bullet.odt diff --git a/sw/qa/core/layout/layout.cxx b/sw/qa/core/layout/layout.cxx index 911c17189f8c..ff2b0a192c62 100644 --- a/sw/qa/core/layout/layout.cxx +++ b/sw/qa/core/layout/layout.cxx @@ -13,6 +13,7 @@ #include <vcl/gdimtf.hxx> #include <svx/svdpage.hxx> +#include <svx/unopage.hxx> #include <wrtsh.hxx> #include <docsh.hxx> @@ -505,6 +506,26 @@ CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testCrashRemoveFromLayout) load(DATA_DIRECTORY, "tdf122894-4.doc"); } +CPPUNIT_TEST_FIXTURE(SwCoreLayoutTest, testLinkedBullet) +{ + // Given a document with a graphic bullet, where the image is a linked one: + load(DATA_DIRECTORY, "linked-bullet.odt"); + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + SwDocShell* pShell = pTextDoc->GetDocShell(); + + // When rendering that document: + std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile(); + + // Then make sure the render result contains exactly one bitmap: + MetafileXmlDump aDumper; + xmlDocUniquePtr pXmlDoc = dumpAndParse(aDumper, *xMetaFile); + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 1 + // - Actual : 0 + // i.e. the bullet's bitmap was lost. + assertXPath(pXmlDoc, "//bmpexscale", 1); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 5fa8a22864d4..d7ea6592d1c9 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -115,6 +115,7 @@ #include <vcl/BitmapTools.hxx> #include <comphelper/lok.hxx> +#include <vcl/GraphicLoader.hxx> #define COL_NOTES_SIDEPANE Color(230,230,230) #define COL_NOTES_SIDEPANE_BORDER Color(200,200,200) @@ -1690,6 +1691,13 @@ static void lcl_DrawGraphic( const SvxBrushItem& rBrush, vcl::RenderContext &rOu GraphicObject *pGrf = const_cast<GraphicObject*>(rBrush.GetGraphicObject()); + OUString aOriginURL = pGrf->GetGraphic().getOriginURL(); + if (pGrf->GetGraphic().GetType() == GraphicType::Default && !aOriginURL.isEmpty()) + { + Graphic aGraphic = vcl::graphic::loadFromURL(aOriginURL); + pGrf->SetGraphic(aGraphic); + } + // Outsource drawing of background with a background color ::lcl_DrawGraphicBackground( rBrush, rOutDev, aAlignedGrfRect, *pGrf, bGrfNum, properties, bBackgrdAlreadyDrawn ); |