summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-08-08 17:58:20 +0200
committerCaolán McNamara <caolanm@redhat.com>2018-09-03 16:31:52 +0200
commit2fb37f232849db1f0ae852203fef4d4a40145755 (patch)
tree3d878cb815e936db63280eec962ac15347fcc15c /sw/source
parentd687d1bbba3f7226f3a533c31b2c84d833331755 (diff)
sw TextGraphicObject: handle XBitmap for GraphicURL
This restores compatibility for API users who called getByName() on the bitmap table and expected that the result can be set as a value for the GraphicURL property. Changing the property type to cppu::UnoType<css::uno::Any>::get() is necessary, otherwise scripting languages figure out (via reflection) that the type doesn't match, and SwXFrame::setPropertyValue() is not called. Change-Id: Idd62f109e91dbaebf1138b9038f66c6c648d780e Reviewed-on: https://gerrit.libreoffice.org/58745 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins (cherry picked from commit 587803ba46055d43b5b108be744fdde17aeabc7c) Reviewed-on: https://gerrit.libreoffice.org/59850 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/unocore/unoframe.cxx7
-rw-r--r--sw/source/core/unocore/unomap1.cxx2
2 files changed, 8 insertions, 1 deletions
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index c4a1b7dfbf6e..b0de9f773463 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2753,8 +2753,15 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
if (m_pProps->GetProperty(FN_UNO_GRAPHIC_URL, 0, pGraphicURL))
{
OUString sGraphicURL;
+ uno::Reference<awt::XBitmap> xBitmap;
if (((*pGraphicURL) >>= sGraphicURL) && !sGraphicURL.isEmpty())
aGraphic = vcl::graphic::loadFromURL(sGraphicURL);
+ else if ((*pGraphicURL) >>= xBitmap)
+ {
+ uno::Reference<graphic::XGraphic> xGraphic(xBitmap, uno::UNO_QUERY);
+ if (xGraphic.is())
+ aGraphic = xGraphic;
+ }
}
const ::uno::Any* pGraphicAny;
diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx
index 10365bd83082..273edc7c4dab 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -850,7 +850,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetGraphicPropertyMap(
{ OUString(UNO_NAME_REPLACEMENT_GRAPHIC), FN_UNO_REPLACEMENT_GRAPHIC, cppu::UnoType<css::graphic::XGraphic>::get(), 0, 0 },
{ OUString(UNO_NAME_GRAPHIC_FILTER), FN_UNO_GRAPHIC_FILTER, cppu::UnoType<OUString>::get(), 0, 0 },
{ OUString(UNO_NAME_GRAPHIC), FN_UNO_GRAPHIC, cppu::UnoType<css::graphic::XGraphic>::get(), 0, 0 },
- { OUString(UNO_NAME_GRAPHIC_URL), FN_UNO_GRAPHIC_URL, cppu::UnoType<OUString>::get(), 0, 0 },
+ { OUString(UNO_NAME_GRAPHIC_URL), FN_UNO_GRAPHIC_URL, cppu::UnoType<css::uno::Any>::get(), 0, 0 },
{ OUString(UNO_NAME_ACTUAL_SIZE), FN_UNO_ACTUAL_SIZE, cppu::UnoType<css::awt::Size>::get(), PropertyAttribute::READONLY, CONVERT_TWIPS},
{ OUString(UNO_NAME_CONTOUR_POLY_POLYGON), FN_PARAM_CONTOUR_PP, cppu::UnoType<css::drawing::PointSequenceSequence>::get(), PropertyAttribute::MAYBEVOID, 0 },
{ OUString(UNO_NAME_IS_PIXEL_CONTOUR), FN_UNO_IS_PIXEL_CONTOUR, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0 },