diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-08-03 13:39:20 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-08-03 15:00:22 +0200 |
commit | c88ff9298b25132fc34102230cef0263f045a523 (patch) | |
tree | ad0c86c0b5965a065056dccf683e6bc64799c665 /svx/source/sdr | |
parent | e6671ea1ceb9e6925ef396156c922a62ded19461 (diff) |
tdf#142436 svx: fix handling of linked background images
Regression from commit 9fb7aaf570c03c8a26d763f1205fb8c890e8211a (Make
linked graphic register into LinkedManager again, 2018-04-13), the
problem was that now SvXMLImport::loadGraphicByURL() produces a Graphic
that has its type set to GraphicType::Default, but when
drawinglayer::primitive2d::createNewSdrFillGraphicAttribute() consumes
this graphic, it expects that the type is either a bitmap or a metafile.
Fix the problem by explicitly loading the image when the default-type,
origin-url-set case happens: this is rendering, so no problem to load
the URL and that will give us the expected graphic type.
This is also meant to keep the original problem fixed, since the Graphic
that is part of the doc model is unchanged.
Change-Id: If5bba09faa23ef35f99152d4b5d30cd9cf67ace8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119935
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'svx/source/sdr')
-rw-r--r-- | svx/source/sdr/primitive2d/sdrattributecreator.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
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 |