diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-03-05 20:44:08 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-03-07 02:38:28 +0100 |
commit | 27008aa028cde8d270e898c5743a9fe5c7701dab (patch) | |
tree | d3c8bbd6c1607122dc8009beeba68f7d0b89d256 /xmloff/source/text/XMLTextFrameContext.cxx | |
parent | 5a4d6162f643050faf00ccf08d58feed00dcd781 (diff) |
xmloff: convert XMLTextParagraphExport to get rid of "GraphicURL"
Change-Id: I10cc1115bfe628dc296b67b75e386e1a2e4a6c46
Reviewed-on: https://gerrit.libreoffice.org/50789
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'xmloff/source/text/XMLTextFrameContext.cxx')
-rw-r--r-- | xmloff/source/text/XMLTextFrameContext.cxx | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 0580c1a70915..786461819d89 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -660,20 +660,19 @@ void XMLTextFrameContext_Impl::Create() "neither URL nor base64 image data given" ); rtl::Reference < XMLTextImportHelper > xTxtImport = GetImport().GetTextImport(); - if( !sHRef.isEmpty() ) + uno::Reference<graphic::XGraphic> xGraphic; + if (!sHRef.isEmpty()) { - bool bForceLoad = xTxtImport->IsInsertMode() || - xTxtImport->IsBlockMode() || - xTxtImport->IsStylesOnlyMode() || - xTxtImport->IsOrganizerMode(); - sHRef = GetImport().ResolveGraphicObjectURL( sHRef, !bForceLoad ); + xGraphic = GetImport().loadGraphicByURL(sHRef); } - else if( xBase64Stream.is() ) + else if (xBase64Stream.is()) { - sHRef = GetImport().ResolveGraphicObjectURLFromBase64( xBase64Stream ); + xGraphic = GetImport().loadGraphicFromBase64(xBase64Stream); xBase64Stream = nullptr; } - xPropSet->setPropertyValue( "GraphicURL", Any(sHRef) ); + + if (xGraphic.is()) + xPropSet->setPropertyValue("Graphic", Any(xGraphic)); // filter name xPropSet->setPropertyValue( "GraphicFilter", Any(sFilterName) ); @@ -763,18 +762,41 @@ void XMLTextFrameContext::removeGraphicFromImportContext(const SvXMLImportContex } } -OUString XMLTextFrameContext::getGraphicURLFromImportContext(const SvXMLImportContext& rContext) const +OUString XMLTextFrameContext::getGraphicPackageURLFromImportContext(const SvXMLImportContext& rContext) const { const XMLTextFrameContext_Impl* pXMLTextFrameContext_Impl = dynamic_cast< const XMLTextFrameContext_Impl* >(&rContext); if(pXMLTextFrameContext_Impl) { - return pXMLTextFrameContext_Impl->GetHRef(); + return "vnd.sun.star.Package:" + pXMLTextFrameContext_Impl->GetHRef(); } return OUString(); } +css::uno::Reference<css::graphic::XGraphic> XMLTextFrameContext::getGraphicFromImportContext(const SvXMLImportContext& rContext) const +{ + uno::Reference<graphic::XGraphic> xGraphic; + + const XMLTextFrameContext_Impl* pXMLTextFrameContext_Impl = dynamic_cast<const XMLTextFrameContext_Impl*>(&rContext); + + if (pXMLTextFrameContext_Impl) + { + try + { + const uno::Reference<beans::XPropertySet>& xPropertySet = pXMLTextFrameContext_Impl->GetPropSet(); + + if (xPropertySet.is()) + { + xPropertySet->getPropertyValue("Graphic") >>= xGraphic; + } + } + catch (uno::Exception&) + {} + } + return xGraphic; +} + bool XMLTextFrameContext_Impl::CreateIfNotThere() { if( !xPropSet.is() && |