Kaydet (Commit) 3f9ffa26 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Miklos Vajna

Restore ReplacementGraphicURL for setting, no API change

Change-Id: I6511cf4c7025ee82889dffe94232291bb51d6741
Reviewed-on: https://gerrit.libreoffice.org/53490Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 9123711d
...@@ -566,7 +566,7 @@ ...@@ -566,7 +566,7 @@
#define FN_UNO_PARA_STYLE_CONDITIONS (FN_EXTRA2 + 100) #define FN_UNO_PARA_STYLE_CONDITIONS (FN_EXTRA2 + 100)
#define FN_UNO_GRAPHIC (FN_EXTRA2 + 101) #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_CELL_ROW_SPAN (FN_EXTRA2 + 103)
#define FN_UNO_TABLE_BORDER_DISTANCES (FN_EXTRA2 + 104) #define FN_UNO_TABLE_BORDER_DISTANCES (FN_EXTRA2 + 104)
#define FN_SPELL_GRAMMAR_DIALOG (FN_EXTRA2 + 105) #define FN_SPELL_GRAMMAR_DIALOG (FN_EXTRA2 + 105)
......
...@@ -111,6 +111,7 @@ ...@@ -111,6 +111,7 @@
#include <ndgrf.hxx> #include <ndgrf.hxx>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/GraphicLoader.hxx>
#include <sfx2/printer.hxx> #include <sfx2/printer.hxx>
#include <SwStyleNameMapper.hxx> #include <SwStyleNameMapper.hxx>
#include <editeng/xmlcnitm.hxx> #include <editeng/xmlcnitm.hxx>
...@@ -1595,11 +1596,28 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any& ...@@ -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; Graphic aGraphic;
aValue >>= xGraphic; if (aValue.has<OUString>())
if (xGraphic.is()) {
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(); const ::SwFormatContent* pCnt = &pFormat->GetContent();
if ( pCnt->GetContentIdx() && pDoc->GetNodes()[ pCnt->GetContentIdx()->GetIndex() + 1 ] ) if ( pCnt->GetContentIdx() && pDoc->GetNodes()[ pCnt->GetContentIdx()->GetIndex() + 1 ] )
...@@ -1609,7 +1627,6 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any& ...@@ -1609,7 +1627,6 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
if ( pOleNode ) if ( pOleNode )
{ {
svt::EmbeddedObjectRef &rEmbeddedObject = pOleNode->GetOLEObj().GetObject(); svt::EmbeddedObjectRef &rEmbeddedObject = pOleNode->GetOLEObj().GetObject();
Graphic aGraphic(xGraphic);
rEmbeddedObject.SetGraphic(aGraphic, OUString() ); rEmbeddedObject.SetGraphic(aGraphic, OUString() );
} }
} }
......
...@@ -886,6 +886,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetEmbeddedPropertyMap ...@@ -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_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_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_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_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_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}, { OUString(UNO_NAME_EMBEDDED_OBJECT),FN_EMBEDDED_OBJECT, cppu::UnoType<css::embed::XEmbeddedObject>::get(), PROPERTY_NONE, 0},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment