summaryrefslogtreecommitdiff
path: root/svx/source/unodraw/XPropertyTable.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-02-01 15:28:53 +0900
committerTomaž Vajngerl <quikee@gmail.com>2018-02-01 11:54:22 +0100
commite02efb621fe672aa52e56caa916cf5c3fd0a9cb8 (patch)
tree725947b541b4774722d9d4a9d11a2ac58463a753 /svx/source/unodraw/XPropertyTable.cxx
parenta61747c2c375d1fe404c976d2a03125e4dc78d8f (diff)
Change bitmap table to store XBitmap instead of GraphicObject URL
As we want to get rid of GraphicObject URLs for the more robust image life-cycle handling, it was necessary to change the way bitmap table stores and handles images, so that they always store a Graphic object (wrapped in UNO object that provides the XGraphic and XBitmap interface). In addition this changes loading and saving from ODF (xmloff) and OOXML (oox) filters so they don't depend on GraphicObject URL anymore, but load or save directly to / from XGraphic or XBitmap. Change-Id: I2b88e10056e7d6c920249d59188f86b1a5a32d21 Reviewed-on: https://gerrit.libreoffice.org/49074 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx/source/unodraw/XPropertyTable.cxx')
-rw-r--r--svx/source/unodraw/XPropertyTable.cxx23
1 files changed, 12 insertions, 11 deletions
diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx
index 55ca9a09cc90..1765cee285ab 100644
--- a/svx/source/unodraw/XPropertyTable.cxx
+++ b/svx/source/unodraw/XPropertyTable.cxx
@@ -23,6 +23,8 @@
#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
#include <com/sun/star/drawing/LineDash.hpp>
#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/drawing/Hatch.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
@@ -613,28 +615,27 @@ uno::Reference< uno::XInterface > SvxUnoXBitmapTable_createInstance( XPropertyLi
// SvxUnoXPropertyTable
uno::Any SvxUnoXBitmapTable::getAny( const XPropertyEntry* pEntry ) const
{
- OUString aURL( UNO_NAME_GRAPHOBJ_URLPREFIX);
- const GraphicObject& rGraphicObject(static_cast<const XBitmapEntry*>(pEntry)->GetGraphicObject());
- aURL += OStringToOUString(rGraphicObject.GetUniqueID(), RTL_TEXTENCODING_ASCII_US);
-
- return uno::Any(aURL);
+ auto xBitmapEntry = static_cast<const XBitmapEntry*>(pEntry);
+ css::uno::Reference<css::awt::XBitmap> xBitmap(xBitmapEntry->GetGraphicObject().GetGraphic().GetXGraphic(), uno::UNO_QUERY);
+ return uno::Any(xBitmap);
}
std::unique_ptr<XPropertyEntry> SvxUnoXBitmapTable::createEntry(const OUString& rName, const uno::Any& rAny) const
{
- OUString aURL;
- if(!(rAny >>= aURL))
+ if (!rAny.has<uno::Reference<awt::XBitmap>>())
return std::unique_ptr<XPropertyEntry>();
- const GraphicObject aGrafObj(GraphicObject::CreateGraphicObjectFromURL(aURL));
-
- return o3tl::make_unique<XBitmapEntry>(aGrafObj, rName);
+ auto xBitmap = rAny.get<uno::Reference<awt::XBitmap>>();
+ uno::Reference<graphic::XGraphic> xGraphic(xBitmap, uno::UNO_QUERY);
+ Graphic aGraphic(xGraphic);
+ GraphicObject aGraphicObject(aGraphic);
+ return o3tl::make_unique<XBitmapEntry>(aGraphicObject, rName);
}
// XElementAccess
uno::Type SAL_CALL SvxUnoXBitmapTable::getElementType()
{
- return ::cppu::UnoType<OUString>::get();
+ return ::cppu::UnoType<awt::XBitmap>::get();
}
// XServiceInfo