summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-12-15 17:37:08 +0100
committerMichael Stahl <mstahl@redhat.com>2015-12-16 20:37:39 +0100
commit291f55edf3d5c1d443cbd9a06bc6f7fd773884e5 (patch)
treec7caddd7dba7afa7d0eae1d137535a8363ff6317
parent032e34d0014d2154feaf97105d2dbe69b290b8c5 (diff)
assert that no ODF import happens without a BaseURL
Change-Id: I4520a9d0350349cb083ed627a19264a3a97e090f
-rw-r--r--chart2/source/model/filter/XMLFilter.cxx1
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx1
-rw-r--r--reportdesign/source/filter/xml/xmlfilter.cxx1
-rw-r--r--sc/source/filter/xml/xmlwrap.cxx1
-rw-r--r--sd/source/filter/xml/sdxmlwrp.cxx4
-rw-r--r--starmath/source/mathmlimport.cxx8
-rw-r--r--sw/source/filter/xml/swxml.cxx2
7 files changed, 13 insertions, 5 deletions
diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
index 2ffe00d63ad7..dc49724c4776 100644
--- a/chart2/source/model/filter/XMLFilter.cxx
+++ b/chart2/source/model/filter/XMLFilter.cxx
@@ -383,6 +383,7 @@ sal_Int32 XMLFilter::impl_Import(
}
}
+ assert(!aBaseUri.isEmpty()); // needed for relative URLs
if( !aBaseUri.isEmpty() )
xImportInfo->setPropertyValue( "BaseURI", uno::makeAny( aBaseUri ) );
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index e25b714c03b6..777b779f2287 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -485,6 +485,7 @@ void ODatabaseDocument::impl_import_nolck_throw( const Reference< XComponentCont
OUString sBaseURI = _rResource.getOrDefault("BaseURI", OUString());
if (sBaseURI.isEmpty())
sBaseURI = _rResource.getOrDefault("URL",OUString());
+ assert(!sBaseURI.isEmpty()); // needed for relative URLs
xInfoSet->setPropertyValue("BaseURI", uno::makeAny(sBaseURI));
xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("content.xml")));
diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx
index 27cd7b8ba921..529fdd61ac89 100644
--- a/reportdesign/source/filter/xml/xmlfilter.cxx
+++ b/reportdesign/source/filter/xml/xmlfilter.cxx
@@ -512,6 +512,7 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
utl::MediaDescriptor aDescriptor(rDescriptor);
uno::Reference<beans::XPropertySet> xProp = comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(pMap));
const OUString sVal( aDescriptor.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_DOCUMENTBASEURL(),OUString()) );
+ assert(!sVal.isEmpty()); // needed for relative URLs
xProp->setPropertyValue("BaseURI", uno::makeAny(sVal));
const OUString sHierarchicalDocumentName( aDescriptor.getUnpackedValueOrDefault("HierarchicalDocumentName",OUString()) );
xProp->setPropertyValue("StreamRelPath", uno::makeAny(sHierarchicalDocumentName));
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index a365584f05d8..b63e140a148a 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -379,6 +379,7 @@ bool ScXMLImportWrapper::Import( sal_uInt8 nMode, ErrCode& rError )
// Set base URI
OSL_ENSURE( pMedium, "There is no medium to get MediaDescriptor from!\n" );
OUString aBaseURL = pMedium ? pMedium->GetBaseURL() : OUString();
+ assert(!aBaseURL.isEmpty()); // needed for relative URLs
OUString sPropName("BaseURI");
xInfoSet->setPropertyValue( sPropName, uno::makeAny( aBaseURL ) );
diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx
index 8848b8f1e9cd..5e522ef963b6 100644
--- a/sd/source/filter/xml/sdxmlwrp.cxx
+++ b/sd/source/filter/xml/sdxmlwrp.cxx
@@ -587,7 +587,9 @@ bool SdXMLFilter::Import( ErrCode& nError )
}
// Set base URI
- xInfoSet->setPropertyValue( "BaseURI" , makeAny( mrMedium.GetBaseURL() ) );
+ OUString const baseURI(mrMedium.GetBaseURL());
+ assert(!baseURI.isEmpty()); // needed for relative URLs
+ xInfoSet->setPropertyValue("BaseURI", makeAny(baseURI));
if( 0 == nRet && SfxObjectCreateMode::EMBEDDED == mrDocShell.GetCreateMode() )
{
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index 48c0d488a727..5ba3826ef2a1 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -141,8 +141,9 @@ sal_uLong SmXMLImportWrapper::Import(SfxMedium &rMedium)
new comphelper::PropertySetInfo( aInfoMap ) ) );
// Set base URI
- OUString sPropName( "BaseURI" );
- xInfoSet->setPropertyValue( sPropName, makeAny( rMedium.GetBaseURL() ) );
+ OUString const baseURI(rMedium.GetBaseURL());
+ assert(!baseURI.isEmpty()); // needed for relative URLs
+ xInfoSet->setPropertyValue("BaseURI", makeAny(baseURI));
sal_Int32 nSteps=3;
if ( !(rMedium.IsStorage()))
@@ -174,8 +175,7 @@ sal_uLong SmXMLImportWrapper::Import(SfxMedium &rMedium)
if ( !aName.isEmpty() )
{
- sPropName = "StreamRelPath";
- xInfoSet->setPropertyValue( sPropName, makeAny( aName ) );
+ xInfoSet->setPropertyValue("StreamRelPath", makeAny(aName));
}
}
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 63be8a31c178..cae28ea0f8fd 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -492,6 +492,8 @@ static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs(SwDoc& _rDoc)
sal_uLong XMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, const OUString & rName )
{
+ // TODO: sadly SwXMLTextBlocks doesn't set this? assert(!rBaseURL.isEmpty()); // needed for relative URLs
+
// Get service factory
uno::Reference< uno::XComponentContext > xContext =
comphelper::getProcessComponentContext();