sfx2/qa/complex/sfx2/DocumentProperties.java | 3 ++- sfx2/source/doc/SfxDocumentMetaData.cxx | 15 +++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-)
New commits: commit 6adddbc2a80456cc2ad3b62deada7ecd4a6cf641 Author: Stephan Bergmann <sberg...@redhat.com> Date: Mon Oct 7 12:10:14 2013 +0200 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 diff --git a/sfx2/qa/complex/sfx2/DocumentProperties.java b/sfx2/qa/complex/sfx2/DocumentProperties.java index 88f0f4c..0588979 100644 --- a/sfx2/qa/complex/sfx2/DocumentProperties.java +++ b/sfx2/qa/complex/sfx2/DocumentProperties.java @@ -199,7 +199,8 @@ public class DocumentProperties assertTrue("TemplateURL", xDP.getTemplateURL().endsWith("memmodern.ott")); assertEquals("TemplateDate", 17, xDP.getTemplateDate().Hours); - assertEquals("AutoloadURL", "../TEST.odt", xDP.getAutoloadURL()); + assertTrue( + "AutoloadURL", xDP.getAutoloadURL().endsWith("/TEST.odt")); assertEquals("AutoloadSecs", 0, xDP.getAutoloadSecs()); assertEquals("DefaultTarget", "_blank", xDP.getDefaultTarget()); assertEquals("EditingCycles", 3, xDP.getEditingCycles()); diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index fe9cc58..4e89b6a 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))); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits