summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/xmloff/xmlimp.hxx5
-rw-r--r--xmloff/source/core/xmlimp.cxx38
-rw-r--r--xmloff/source/draw/XMLReplacementImageContext.cxx37
3 files changed, 22 insertions, 58 deletions
diff --git a/include/xmloff/xmlimp.hxx b/include/xmloff/xmlimp.hxx
index 3249b6797ae7..926a44d08f59 100644
--- a/include/xmloff/xmlimp.hxx
+++ b/include/xmloff/xmlimp.hxx
@@ -406,10 +406,7 @@ public:
// internal package URL. The later one happens only if bLoadURL is true
OUString ResolveGraphicObjectURL( const OUString& rURL, bool bLoadOnDemand );
- css::uno::Reference< css::io::XOutputStream >
- GetStreamForGraphicObjectURLFromBase64();
- OUString ResolveGraphicObjectURLFromBase64(
- const css::uno::Reference< css::io::XOutputStream >& rOut );
+ css::uno::Reference< css::io::XOutputStream > GetStreamForGraphicObjectURLFromBase64();
bool IsPackageURL( const OUString& rURL ) const;
OUString ResolveEmbeddedObjectURL( const OUString& rURL,
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index a58f32ba861b..3c1e8bb0c6ea 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -1399,33 +1399,6 @@ uno::Reference<graphic::XGraphic> SvXMLImport::loadGraphicFromBase64(uno::Refere
return xGraphic;
}
-OUString SvXMLImport::ResolveGraphicObjectURL( const OUString& rURL,
- bool bLoadOnDemand )
-{
- OUString sRet;
-
- if( IsPackageURL( rURL ) )
- {
- if( !bLoadOnDemand && mxGraphicResolver.is() )
- {
- OUString aTmp( msPackageProtocol );
- aTmp += rURL;
- sRet = mxGraphicResolver->resolveGraphicObjectURL( aTmp );
- }
-
- if( sRet.isEmpty() )
- {
- sRet = msPackageProtocol;
- sRet += rURL;
- }
- }
-
- if( sRet.isEmpty() )
- sRet = GetAbsoluteReference( rURL );
-
- return sRet;
-}
-
Reference< XOutputStream > SvXMLImport::GetStreamForGraphicObjectURLFromBase64()
{
Reference< XOutputStream > xOStm;
@@ -1437,17 +1410,6 @@ Reference< XOutputStream > SvXMLImport::GetStreamForGraphicObjectURLFromBase64()
return xOStm;
}
-OUString SvXMLImport::ResolveGraphicObjectURLFromBase64(
- const Reference < XOutputStream >& rOut )
-{
- OUString sURL;
- Reference< document::XBinaryStreamResolver > xStmResolver( mxGraphicResolver, UNO_QUERY );
- if( xStmResolver.is() )
- sURL = xStmResolver->resolveOutputStream( rOut );
-
- return sURL;
-}
-
OUString SvXMLImport::ResolveEmbeddedObjectURL(
const OUString& rURL,
const OUString& rClassId )
diff --git a/xmloff/source/draw/XMLReplacementImageContext.cxx b/xmloff/source/draw/XMLReplacementImageContext.cxx
index cbea729a59af..eb5f6ea52c15 100644
--- a/xmloff/source/draw/XMLReplacementImageContext.cxx
+++ b/xmloff/source/draw/XMLReplacementImageContext.cxx
@@ -19,6 +19,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
#include <osl/diagnose.h>
#include <xmloff/xmlimp.hxx>
#include <xmloff/xmltoken.hxx>
@@ -31,7 +32,7 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::makeAny;
using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::beans;
-
+using namespace css;
XMLReplacementImageContext::XMLReplacementImageContext(
SvXMLImport& rImport,
@@ -75,25 +76,29 @@ void XMLReplacementImageContext::EndElement()
"neither URL nor base64 image data given" );
rtl::Reference < XMLTextImportHelper > xTxtImport =
GetImport().GetTextImport();
- OUString sHRef;
- if( !m_sHRef.isEmpty() )
+ uno::Reference<graphic::XGraphic> xGraphic;
+
+ try
{
- bool bForceLoad = xTxtImport->IsInsertMode() ||
- xTxtImport->IsBlockMode() ||
- xTxtImport->IsStylesOnlyMode() ||
- xTxtImport->IsOrganizerMode();
- sHRef = GetImport().ResolveGraphicObjectURL( m_sHRef, !bForceLoad );
+ if( !m_sHRef.isEmpty() )
+ {
+ xGraphic = GetImport().loadGraphicByURL(m_sHRef);
+ }
+ else if( m_xBase64Stream.is() )
+ {
+ xGraphic = GetImport().loadGraphicFromBase64(m_xBase64Stream);
+ m_xBase64Stream = nullptr;
+ }
}
- else if( m_xBase64Stream.is() )
+ catch (uno::Exception const &)
+ {}
+
+ Reference < XPropertySetInfo > xPropSetInfo = m_xPropSet->getPropertySetInfo();
+
+ if (xGraphic.is() && xPropSetInfo->hasPropertyByName("Graphic"))
{
- sHRef = GetImport().ResolveGraphicObjectURLFromBase64( m_xBase64Stream );
- m_xBase64Stream = nullptr;
+ m_xPropSet->setPropertyValue("Graphic", uno::makeAny(xGraphic));
}
-
- Reference < XPropertySetInfo > xPropSetInfo =
- m_xPropSet->getPropertySetInfo();
- if( xPropSetInfo->hasPropertyByName("GraphicURL") )
- m_xPropSet->setPropertyValue("GraphicURL", makeAny( sHRef ) );
}
SvXMLImportContextRef XMLReplacementImageContext::CreateChildContext(