diff options
author | Kurt Zenker <kz@openoffice.org> | 2010-07-13 14:54:15 +0200 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2010-07-13 14:54:15 +0200 |
commit | 49b06312d167ec3c210062ef704f8403abadf058 (patch) | |
tree | cfa14cc1acccfd55f195121c6f876dc3c0c21305 /xmloff | |
parent | 8e4c72043946b971c712b6a3fad959c3bb54c6dc (diff) | |
parent | d73100a4f9999f144ce5d9a8b64428fd9830da5e (diff) |
CWS-TOOLING: integrate CWS sw33bf06_OOO330
Notes
Notes:
split repo tag: libs-core_ooo/OOO330_m1
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/RDFaExportHelper.cxx | 37 | ||||
-rw-r--r-- | xmloff/source/text/XMLTextMarkImportContext.cxx | 1 |
2 files changed, 37 insertions, 1 deletions
diff --git a/xmloff/source/core/RDFaExportHelper.cxx b/xmloff/source/core/RDFaExportHelper.cxx index 593e2d1f29e6..f603d21258fd 100644 --- a/xmloff/source/core/RDFaExportHelper.cxx +++ b/xmloff/source/core/RDFaExportHelper.cxx @@ -37,6 +37,8 @@ #include <comphelper/stlunosequence.hxx> #include <comphelper/stl_types.hxx> +#include <com/sun/star/uri/XUriReference.hpp> +#include <com/sun/star/uri/XUriReferenceFactory.hpp> #include <com/sun/star/rdf/Statement.hpp> #include <com/sun/star/rdf/URIs.hpp> #include <com/sun/star/rdf/URI.hpp> @@ -85,6 +87,39 @@ makeCURIE(SvXMLExport * i_pExport, return buf.makeStringAndClear(); } +// #i112473# SvXMLExport::GetRelativeReference() not right for RDF on SaveAs +// because the URIs in the repository are not rewritten on SaveAs, the +// URI of the loaded document has to be used, not the URI of the target doc. +static ::rtl::OUString +getRelativeReference(SvXMLExport const& rExport, ::rtl::OUString const& rURI) +{ + uno::Reference< rdf::XURI > const xModelURI( + rExport.GetModel(), uno::UNO_QUERY_THROW ); + ::rtl::OUString const baseURI( xModelURI->getStringValue() ); + + uno::Reference<uno::XComponentContext> const xContext( + rExport.GetComponentContext()); + uno::Reference<lang::XMultiComponentFactory> const xServiceFactory( + xContext->getServiceManager(), uno::UNO_SET_THROW); + uno::Reference<uri::XUriReferenceFactory> const xUriFactory( + xServiceFactory->createInstanceWithContext( + ::rtl::OUString::createFromAscii( + "com.sun.star.uri.UriReferenceFactory"), xContext), + uno::UNO_QUERY_THROW); + + uno::Reference< uri::XUriReference > const xBaseURI( + xUriFactory->parse(baseURI), uno::UNO_SET_THROW ); + uno::Reference< uri::XUriReference > const xAbsoluteURI( + xUriFactory->parse(rURI), uno::UNO_SET_THROW ); + uno::Reference< uri::XUriReference > const xRelativeURI( + xUriFactory->makeRelative(xBaseURI, xAbsoluteURI, true, true, false), + uno::UNO_SET_THROW ); + ::rtl::OUString const relativeURI(xRelativeURI->getUriReference()); + + return relativeURI; +} + + //////////////////////////////////////////////////////////////////////////// RDFaExportHelper::RDFaExportHelper(SvXMLExport & i_rExport) @@ -145,7 +180,7 @@ RDFaExportHelper::AddRDFa( static const sal_Unicode s_OpenBracket ('['); static const sal_Unicode s_CloseBracket(']'); const ::rtl::OUString about( xSubjectURI.is() - ? m_rExport.GetRelativeReference(xSubjectURI->getStringValue()) + ? getRelativeReference(m_rExport, xSubjectURI->getStringValue()) : ::rtl::OUStringBuffer().append(s_OpenBracket).append( LookupBlankNode(xSubjectBNode)).append(s_CloseBracket) .makeStringAndClear() diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx index af51f5f56d98..00cdce37f4d5 100644 --- a/xmloff/source/text/XMLTextMarkImportContext.cxx +++ b/xmloff/source/text/XMLTextMarkImportContext.cxx @@ -116,6 +116,7 @@ XMLTextMarkImportContext::XMLTextMarkImportContext( const OUString& rLocalName ) : SvXMLImportContext(rImport, nPrefix, rLocalName) , m_rHelper(rHlp) + , m_bHaveAbout(false) { } |