diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-03-10 00:42:20 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-03-10 02:12:24 +0100 |
commit | 0d1479cbd442c3ec3bdd20333c341ea24dcca21e (patch) | |
tree | 7c5b253802a0dd18b8e6c7419fc0ba973c2b4669 /xmloff/source/forms | |
parent | d0b36b780dca966bc5e8682d8dff635072124603 (diff) |
xmloff: modify code relying on Graph.Object URL and cleanup code
Change-Id: Id08ee261ae06673809fcf8581e2490ecd957891f
Reviewed-on: https://gerrit.libreoffice.org/51011
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'xmloff/source/forms')
-rw-r--r-- | xmloff/source/forms/propertyexport.cxx | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx index 2f611bc61f8b..df34513b94a4 100644 --- a/xmloff/source/forms/propertyexport.cxx +++ b/xmloff/source/forms/propertyexport.cxx @@ -33,6 +33,7 @@ #include <rtl/strbuf.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/util/Date.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/util/Time.hpp> #include <com/sun/star/util/DateTime.hpp> #include <comphelper/extract.hxx> @@ -46,6 +47,7 @@ namespace xmloff { + using namespace css; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; @@ -394,20 +396,33 @@ namespace xmloff { DBG_CHECK_PROPERTY( _sPropertyName, OUString ); - OUString sTargetLocation = comphelper::getString(m_xProps->getPropertyValue(_sPropertyName)); - if ( !sTargetLocation.isEmpty() ) - // If this isn't a GraphicObject then GetRelativeReference - // will be called anyway ( in AddEmbeddedGraphic ) - sTargetLocation = m_rContext.getGlobalContext().AddEmbeddedGraphicObject(sTargetLocation); - AddAttribute(OAttributeMetaData::getCommonControlAttributeNamespace(_nProperty) - ,OAttributeMetaData::getCommonControlAttributeName(_nProperty) - , sTargetLocation); + Any aAny = m_xProps->getPropertyValue(_sPropertyName); - // #i110911# add xlink:type="simple" if required - if (_bAddType) - AddAttribute(XML_NAMESPACE_XLINK, token::XML_TYPE, token::XML_SIMPLE); + OUString sTargetLocation; + if (aAny.has<uno::Reference<graphic::XGraphic>>()) + { + auto xGraphic = aAny.get<uno::Reference<graphic::XGraphic>>(); + OUString sOutMimeType; + sTargetLocation = m_rContext.getGlobalContext().AddEmbeddedXGraphic(xGraphic, sOutMimeType); + } + else if (aAny.has<OUString>()) + { + auto sURL = aAny.get<OUString>(); + sTargetLocation = m_rContext.getGlobalContext().AddEmbeddedObject(sURL); + } - exportedProperty(_sPropertyName); + if (!sTargetLocation.isEmpty()) + { + AddAttribute(OAttributeMetaData::getCommonControlAttributeNamespace(_nProperty) + ,OAttributeMetaData::getCommonControlAttributeName(_nProperty) + , sTargetLocation); + + // #i110911# add xlink:type="simple" if required + if (_bAddType) + AddAttribute(XML_NAMESPACE_XLINK, token::XML_TYPE, token::XML_SIMPLE); + + exportedProperty(_sPropertyName); + } } void OPropertyExport::flagStyleProperties() { |