diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-10-07 12:10:14 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-10-07 12:25:11 +0200 |
commit | 6adddbc2a80456cc2ad3b62deada7ecd4a6cf641 (patch) | |
tree | 160d6d573bf5b7d4bc9f0eee89744a7b2bded189 /sfx2/source/doc | |
parent | 1bbfa2834ee5f6ddefc801c2a63ce3fe9a5c863e (diff) |
Use URL as fallback for DocumentBaseURL in css.document.MediaDescriptor
...in SfxDocumentMetaData::getURLProperties, to avoid
"tools/source/fsys/urlobj.cxx:1741: cannot make <[...]> absolute against broken
base <>" warnings when SvXMLImport::GetAbsoluteReference tries to make absolute
against an erroneously empty base URI any relative URIs contained in the
document's meta data.
As a consequence, such relative URIs contained in the document's meta data will
now be made absolute upon loading in SfxDocumentMetaData::getURLProperties.
However, I saw no negative consequences of that (other than having to adapt
sfx2/qa/complex/sfx2/DocumentProperties.java in the obvious way). Whether a
document written out again contains such meta data URIs as absolute or relative
is only controlled by "Tools - Options... - Load/Save - General - Save - Save
URLs relative to file system" and not affected by this fix. (I verified that by
loading sfx2/qa/complex/sfx2/testdocuments/TEST.odt, which contains a relative
meta:auto-reload xlink:href="../TEST.odt" in its meta.xml, and saving it as a
new file, with and without "Save URLs relative to file system" checked, and
inspecting the resulting documen's meta.xml entries.)
Change-Id: Ia1b6004c8597a726eb59c6b2234fd3ecb0bdcc09
Diffstat (limited to 'sfx2/source/doc')
-rw-r--r-- | sfx2/source/doc/SfxDocumentMetaData.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index fe9cc58b9780..4e89b6ac1625 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -649,12 +649,14 @@ SfxDocumentMetaData::getURLProperties( { css::uno::Reference< css::beans::XPropertyBag> xPropArg = css::beans::PropertyBag::createDefault( m_xContext ); try { + css::uno::Any baseUri; for (sal_Int32 i = 0; i < i_rMedium.getLength(); ++i) { if (i_rMedium[i].Name == "DocumentBaseURL") { - xPropArg->addProperty( - OUString("BaseURI"), - css::beans::PropertyAttribute::MAYBEVOID, - i_rMedium[i].Value); + baseUri = i_rMedium[i].Value; + } else if (i_rMedium[i].Name == "URL") { + if (!baseUri.hasValue()) { + baseUri = i_rMedium[i].Value; + } } else if (i_rMedium[i].Name == "HierarchicalDocumentName") { xPropArg->addProperty( OUString("StreamRelPath"), @@ -662,6 +664,11 @@ SfxDocumentMetaData::getURLProperties( i_rMedium[i].Value); } } + if (baseUri.hasValue()) { + xPropArg->addProperty( + "BaseURI", css::beans::PropertyAttribute::MAYBEVOID, + baseUri); + } xPropArg->addProperty(OUString("StreamName"), css::beans::PropertyAttribute::MAYBEVOID, css::uno::makeAny(OUString(s_meta))); |