summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-04-26 15:54:16 +0900
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-05-02 11:47:19 +0200
commit3f9ffa26f90d7976840c192ef267fe9841759e57 (patch)
tree2402f25116ad5abd31651c37759749f5f757cb16
parent9123711dd092139fb95be92f3ff0cdde657086dd (diff)
Restore ReplacementGraphicURL for setting, no API change
Change-Id: I6511cf4c7025ee82889dffe94232291bb51d6741 Reviewed-on: https://gerrit.libreoffice.org/53490 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/inc/cmdid.h2
-rw-r--r--sw/source/core/unocore/unoframe.cxx27
-rw-r--r--sw/source/core/unocore/unomap1.cxx1
3 files changed, 24 insertions, 6 deletions
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index a385ecde1300..28de05b41c2f 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -566,7 +566,7 @@
#define FN_UNO_PARA_STYLE_CONDITIONS (FN_EXTRA2 + 100)
#define FN_UNO_GRAPHIC (FN_EXTRA2 + 101)
-// #define free (FN_EXTRA2 + 102)
+#define FN_UNO_REPLACEMENT_GRAPHIC_URL (FN_EXTRA2 + 102)
#define FN_UNO_CELL_ROW_SPAN (FN_EXTRA2 + 103)
#define FN_UNO_TABLE_BORDER_DISTANCES (FN_EXTRA2 + 104)
#define FN_SPELL_GRAMMAR_DIALOG (FN_EXTRA2 + 105)
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index a49f49f7d973..e18c20dfce84 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -111,6 +111,7 @@
#include <ndgrf.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
+#include <vcl/GraphicLoader.hxx>
#include <sfx2/printer.hxx>
#include <SwStyleNameMapper.hxx>
#include <editeng/xmlcnitm.hxx>
@@ -1595,11 +1596,28 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
}
}
}
- else if (FN_UNO_REPLACEMENT_GRAPHIC == pEntry->nWID)
+ else if (FN_UNO_REPLACEMENT_GRAPHIC == pEntry->nWID || FN_UNO_REPLACEMENT_GRAPHIC_URL == pEntry->nWID)
{
- uno::Reference<graphic::XGraphic> xGraphic;
- aValue >>= xGraphic;
- if (xGraphic.is())
+ Graphic aGraphic;
+ if (aValue.has<OUString>())
+ {
+ OUString aURL = aValue.get<OUString>();
+ if (!aURL.isEmpty())
+ {
+ aGraphic = vcl::graphic::loadFromURL(aURL);
+ }
+ }
+ else if (aValue.has<uno::Reference<graphic::XGraphic>>())
+ {
+ uno::Reference<graphic::XGraphic> xGraphic;
+ xGraphic = aValue.get<uno::Reference<graphic::XGraphic>>();
+ if (xGraphic.is())
+ {
+ aGraphic = Graphic(xGraphic);
+ }
+ }
+
+ if (aGraphic)
{
const ::SwFormatContent* pCnt = &pFormat->GetContent();
if ( pCnt->GetContentIdx() && pDoc->GetNodes()[ pCnt->GetContentIdx()->GetIndex() + 1 ] )
@@ -1609,7 +1627,6 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
if ( pOleNode )
{
svt::EmbeddedObjectRef &rEmbeddedObject = pOleNode->GetOLEObj().GetObject();
- Graphic aGraphic(xGraphic);
rEmbeddedObject.SetGraphic(aGraphic, OUString() );
}
}
diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx
index 3c9e9720d990..f7a3d0eff130 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -886,6 +886,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetEmbeddedPropertyMap
{ OUString(UNO_NAME_CLSID), FN_UNO_CLSID, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0 },
{ OUString(UNO_NAME_STREAM_NAME), FN_UNO_STREAM_NAME, cppu::UnoType<OUString>::get(), PROPERTY_NONE, 0 },
{ OUString(UNO_NAME_MODEL), FN_UNO_MODEL, cppu::UnoType<css::frame::XModel>::get(), PropertyAttribute::READONLY|PropertyAttribute::MAYBEVOID, 0},
+ { OUString(UNO_NAME_GRAPHIC_URL), FN_UNO_REPLACEMENT_GRAPHIC_URL, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0 },
{ OUString(UNO_NAME_GRAPHIC), FN_UNO_REPLACEMENT_GRAPHIC, cppu::UnoType<css::graphic::XGraphic>::get(), PropertyAttribute::MAYBEVOID, 0 },
{ OUString(UNO_NAME_COMPONENT),FN_UNO_COMPONENT, cppu::UnoType<css::lang::XComponent>::get(), PropertyAttribute::READONLY, 0},
{ OUString(UNO_NAME_EMBEDDED_OBJECT),FN_EMBEDDED_OBJECT, cppu::UnoType<css::embed::XEmbeddedObject>::get(), PROPERTY_NONE, 0},