summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-02-19 21:52:33 +0900
committerTomaž Vajngerl <quikee@gmail.com>2018-02-22 09:28:12 +0100
commit1cf55d6397418dd3cd86eae59c2f75085dbb0d51 (patch)
treed35d2dd19703a6491c7c120dde5bceeb0b6753f1 /sw
parent6a9f851e54f416820c61baf8caa79e4d91c8c61f (diff)
Replace "ReplacementGraphicURL" with "ReplacementGraphic" property
To transport the replacement graphic we use "ReplacementGraphicURL" property, but as it uses an GraphicObject URL it needs to be replaced. The new "ReplacementGraphic" does this with an XGraphic object as instead of the String URL. Change-Id: Iddf01c9aecb2a31a467e7b9d399495e0428d1859 Reviewed-on: https://gerrit.libreoffice.org/49993 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/unoprnms.hxx1
-rw-r--r--sw/source/core/unocore/unoframe.cxx21
-rw-r--r--sw/source/core/unocore/unomap1.cxx1
3 files changed, 23 insertions, 0 deletions
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 21e68ea83296..e5e1f31d2464 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -829,6 +829,7 @@
#define UNO_NAME_INITIALS "Initials"
#define UNO_NAME_TABLE_BORDER2 "TableBorder2"
#define UNO_NAME_REPLACEMENT_GRAPHIC_URL "ReplacementGraphicURL"
+#define UNO_NAME_REPLACEMENT_GRAPHIC "ReplacementGraphic"
#define UNO_NAME_HIDDEN "Hidden"
#define UNO_NAME_DEFAULT_PAGE_MODE "DefaultPageMode"
#define UNO_NAME_CHAR_SHADING_VALUE "CharShadingValue"
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index c576e2ffc459..8b3595b40af0 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2107,6 +2107,27 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
aAny <<= sGrfName;
}
+ else if (FN_UNO_REPLACEMENT_GRAPHIC == pEntry->nWID)
+ {
+ const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
+ uno::Reference<graphic::XGraphic> xGraphic;
+
+ if (pIdx)
+ {
+ SwNodeIndex aIdx(*pIdx, 1);
+ SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
+ if (!pGrfNode)
+ throw uno::RuntimeException();
+
+ const GraphicObject* pGraphicObject = pGrfNode->GetReplacementGrfObj();
+
+ if (pGraphicObject)
+ {
+ xGraphic = pGraphicObject->GetGraphic().GetXGraphic();
+ }
+ }
+ aAny <<= xGraphic;
+ }
else if( FN_UNO_GRAPHIC_FILTER == pEntry->nWID )
{
OUString sFltName;
diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx
index 8f0352f09394..7074c5b2b0f6 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -848,6 +848,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetGraphicPropertyMap(
{ OUString(UNO_NAME_VERT_MIRRORED), RES_GRFATR_MIRRORGRF, cppu::UnoType<bool>::get(), PROPERTY_NONE, MID_MIRROR_VERT },
{ OUString(UNO_NAME_GRAPHIC_URL), FN_UNO_GRAPHIC_U_R_L, cppu::UnoType<OUString>::get(), 0, 0 },
{ OUString(UNO_NAME_REPLACEMENT_GRAPHIC_URL), FN_UNO_REPLACEMENT_GRAPHIC_U_R_L, cppu::UnoType<OUString>::get(), 0, 0 },
+ { 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_ACTUAL_SIZE), FN_UNO_ACTUAL_SIZE, cppu::UnoType<css::awt::Size>::get(), PropertyAttribute::READONLY, CONVERT_TWIPS},