summaryrefslogtreecommitdiff
path: root/vcl/source/image/Image.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/image/Image.cxx')
-rw-r--r--vcl/source/image/Image.cxx29
1 files changed, 20 insertions, 9 deletions
diff --git a/vcl/source/image/Image.cxx b/vcl/source/image/Image.cxx
index ecb514c5bbac..218f2f8512fc 100644
--- a/vcl/source/image/Image.cxx
+++ b/vcl/source/image/Image.cxx
@@ -49,24 +49,28 @@ Image::Image(const BitmapEx& rBitmapEx)
Image::Image(const css::uno::Reference< css::graphic::XGraphic >& rxGraphic)
{
- const Graphic aGraphic(rxGraphic);
- ImplInit(aGraphic.GetBitmapEx());
+ if (rxGraphic.is())
+ {
+ const Graphic aGraphic(rxGraphic);
+
+ OUString aPath;
+ if (aGraphic.getOriginURL().startsWith("private:graphicrepository/", &aPath))
+ mpImplData = std::make_shared<ImplImage>(aPath);
+ else
+ ImplInit(aGraphic.GetBitmapEx());
+ }
}
Image::Image(const OUString & rFileUrl)
{
- sal_Int32 nIndex = 0;
- if (rFileUrl.getToken( 0, '/', nIndex ) == "private:graphicrepository")
- {
- mpImplData.reset(new ImplImage(rFileUrl.copy(nIndex)));
- }
+ OUString sImageName;
+ if (rFileUrl.startsWith("private:graphicrepository/", &sImageName))
+ mpImplData = std::make_shared<ImplImage>(sImageName);
else
{
Graphic aGraphic;
if (ERRCODE_NONE == GraphicFilter::LoadGraphic(rFileUrl, IMP_PNG, aGraphic))
- {
ImplInit(aGraphic.GetBitmapEx());
- }
}
}
@@ -76,6 +80,13 @@ void Image::ImplInit(const BitmapEx& rBitmapEx)
mpImplData.reset(new ImplImage(rBitmapEx));
}
+OUString Image::GetStock() const
+{
+ if (mpImplData)
+ return mpImplData->getStock();
+ return OUString();
+}
+
Size Image::GetSizePixel() const
{
if (mpImplData)