summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-04-26 19:28:35 +0900
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-05-03 13:06:33 +0200
commit2bf4d69e0bfa98d641939e62945a7f8915441297 (patch)
tree2c64c371f0261bdda2b2adc16abb1b24e5315cb8 /sw
parentf1579d3d6c5f5f3a651825e035b93bee7a4f43c6 (diff)
[API CHANGE] revert and deprecate GraphicURL, modify Graphic prop.
Revert the state of GraphicURL property so it supports setting a external URL, but getting throws and exception. Modify the Graphic property, so it reflects what was used with GraphicURL before. Change-Id: Ia05b8ea37997b5ed8c75215557cce9979630c898 Reviewed-on: https://gerrit.libreoffice.org/53509 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/cmdid.h2
-rw-r--r--sw/source/core/unocore/unoframe.cxx37
-rw-r--r--sw/source/core/unocore/unomap1.cxx1
3 files changed, 31 insertions, 9 deletions
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index 28de05b41c2f..fccfd6c87bb9 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -548,7 +548,7 @@
#define FN_UNO_IS_PIXEL_CONTOUR (FN_EXTRA2 + 83)
#define FN_UNO_ALTERNATIVE_TEXT (FN_EXTRA2 + 84)
#define FN_UNO_ACTUAL_SIZE (FN_EXTRA2 + 85)
-// #define free (FN_EXTRA2 + 86)
+#define FN_UNO_GRAPHIC_URL (FN_EXTRA2 + 86)
#define FN_UNO_GRAPHIC_FILTER (FN_EXTRA2 + 87)
#define FN_UNO_CELL_NAME (FN_EXTRA2 + 88)
#define FN_INSERT_GLOSSARY (FN_EXTRA2 + 89)
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index e18c20dfce84..f8a500a53f7b 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1575,14 +1575,31 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
pFormat->GetDoc()->getIDocumentContentOperations().ReRead(aGrfPaM, sGrfName, sFltName, nullptr);
}
}
- else if (FN_UNO_GRAPHIC == pEntry->nWID)
+ else if (FN_UNO_GRAPHIC == pEntry->nWID || FN_UNO_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 ::SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
- if(pIdx)
+ if (pIdx)
{
SwNodeIndex aIdx(*pIdx, 1);
SwGrfNode* pGrfNode = aIdx.GetNode().GetGrfNode();
@@ -1591,8 +1608,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
throw uno::RuntimeException();
}
SwPaM aGrfPaM(*pGrfNode);
- Graphic aGraphic( xGraphic );
- pFormat->GetDoc()->getIDocumentContentOperations().ReRead( aGrfPaM, OUString(), OUString(), &aGraphic );
+ pFormat->GetDoc()->getIDocumentContentOperations().ReRead(aGrfPaM, OUString(), OUString(), &aGraphic);
}
}
}
@@ -2030,6 +2046,10 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
SwDoc::GetGrfNms( *static_cast<SwFlyFrameFormat*>(pFormat), nullptr, &sFltName );
aAny <<= sFltName;
}
+ else if( FN_UNO_GRAPHIC_URL == pEntry->nWID )
+ {
+ throw uno::RuntimeException("Getting from this property is not unsupported");
+ }
else if( FN_UNO_GRAPHIC == pEntry->nWID )
{
const SwNodeIndex* pIdx = pFormat->GetContent().GetContentIdx();
@@ -2311,7 +2331,8 @@ uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates(
pEntry->nWID == FN_PARAM_LINK_DISPLAY_NAME||
FN_UNO_FRAME_STYLE_NAME == pEntry->nWID||
FN_UNO_GRAPHIC == pEntry->nWID||
- FN_UNO_GRAPHIC_FILTER == pEntry->nWID||
+ FN_UNO_GRAPHIC_URL == pEntry->nWID||
+ FN_UNO_GRAPHIC_FILTER == pEntry->nWID||
FN_UNO_ACTUAL_SIZE == pEntry->nWID||
FN_UNO_ALTERNATIVE_TEXT == pEntry->nWID)
{
diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx
index f7a3d0eff130..35723c4a3893 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -843,6 +843,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_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 },