diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-04 17:39:58 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-04 17:40:29 +0100 |
commit | ce814d1a28bb1ff2e6df23e6ed8c256c948787af (patch) | |
tree | 6bf790627509cddd3899f9e4b2bb171dc5c0d659 /writerfilter/source/dmapper | |
parent | 6415b9e4d1ee58029837ca76843c03e589c18ba4 (diff) |
DOC(X) filter: BAF -> BAILS in the smart tag mapping
The filters map between a common subset of Word smart tags and Writer
RDF annotations, and when doing so, they need to know what path to use
for a smart tag namespace and also the other way around: what RDF types
are interesting for smart tag purposes.
It turns out there is BAILS specification at
<http://www.tscp.org/wp-content/uploads/2013/08/TSCP_BAILSv1.pdf> that
describes how to refer to BAF objects, so use that instead of our custom
RDF statement / document metadata key names.
Change-Id: Iac569608b05aa61547f664f2a5df7d46fe46da76
Diffstat (limited to 'writerfilter/source/dmapper')
-rw-r--r-- | writerfilter/source/dmapper/SmartTagHandler.cxx | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/writerfilter/source/dmapper/SmartTagHandler.cxx b/writerfilter/source/dmapper/SmartTagHandler.cxx index dc9f094e4917..27f4e393db7d 100644 --- a/writerfilter/source/dmapper/SmartTagHandler.cxx +++ b/writerfilter/source/dmapper/SmartTagHandler.cxx @@ -9,17 +9,21 @@ #include <SmartTagHandler.hxx> +#include <com/sun/star/rdf/Literal.hpp> #include <com/sun/star/rdf/URI.hpp> #include <ooxml/resourceids.hxx> namespace { -OUString lcl_getTypePath(const OUString& rType) +OUString lcl_getTypePath(OUString& rType) { OUString aRet; - if (rType == "urn:tscp:names:baf:1.1") - aRet = "tscp/baf.rdf"; + if (rType.startsWith("urn:bails")) + { + rType = "urn:bails"; + aRet = "tscp/bails.rdf"; + } return aRet; } } @@ -91,11 +95,7 @@ void SmartTagHandler::handle(const uno::Reference<text::XTextRange>& xParagraph) for (const std::pair<OUString, OUString>& rAttribute : m_aAttributes) { - sal_Int32 nIndex = rAttribute.first.indexOf('#'); - if (nIndex == -1) - continue; - - OUString aTypeNS = rAttribute.first.copy(0, nIndex); + OUString aTypeNS = rAttribute.first; OUString aMetadataFilePath = lcl_getTypePath(aTypeNS); if (aMetadataFilePath.isEmpty()) continue; @@ -112,7 +112,7 @@ void SmartTagHandler::handle(const uno::Reference<text::XTextRange>& xParagraph) } uno::Reference<rdf::XNamedGraph> xGraph = m_xDocumentMetadataAccess->getRDFRepository()->getGraph(xGraphName); uno::Reference<rdf::XURI> xKey = rdf::URI::create(m_xComponentContext, rAttribute.first); - uno::Reference<rdf::XURI> xValue = rdf::URI::create(m_xComponentContext, rAttribute.second); + uno::Reference<rdf::XLiteral> xValue = rdf::Literal::create(m_xComponentContext, rAttribute.second); xGraph->addStatement(xSubject, xKey, xValue); } |