summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-01-04 17:39:58 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-01-04 17:40:29 +0100
commitce814d1a28bb1ff2e6df23e6ed8c256c948787af (patch)
tree6bf790627509cddd3899f9e4b2bb171dc5c0d659 /sw
parent6415b9e4d1ee58029837ca76843c03e589c18ba4 (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 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tscp.docxbin4758 -> 4878 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport5.cxx13
-rw-r--r--sw/qa/extras/ww8export/data/tscp.docbin23040 -> 10240 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export.cxx13
-rw-r--r--sw/source/core/doc/rdfhelper.cxx3
-rw-r--r--sw/source/filter/basflt/fltshell.cxx15
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx2
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx2
8 files changed, 25 insertions, 23 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tscp.docx b/sw/qa/extras/ooxmlexport/data/tscp.docx
index 3cda72de572e..bbb32b178bd9 100644
--- a/sw/qa/extras/ooxmlexport/data/tscp.docx
+++ b/sw/qa/extras/ooxmlexport/data/tscp.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 65203a6437b7..0507fcca7693 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -90,10 +90,10 @@ DECLARE_OOXMLEXPORT_TEST(testFDO76248, "FDO76248.docx")
DECLARE_OOXMLEXPORT_TEST(testTscp, "tscp.docx")
{
uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
- uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, "urn:tscp:names:baf:1.1");
+ uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, "urn:bails");
uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(mxComponent, uno::UNO_QUERY);
uno::Sequence< uno::Reference<rdf::XURI> > aGraphNames = xDocumentMetadataAccess->getMetadataGraphsWithType(xType);
- // This failed, no graphs had the urn:tscp:names:baf:1.1 type.
+ // This failed, no graphs had the urn:bails type.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aGraphNames.getLength());
uno::Reference<rdf::XURI> xGraphName = aGraphNames[0];
uno::Reference<rdf::XNamedGraph> xGraph = xDocumentMetadataAccess->getRDFRepository()->getGraph(xGraphName);
@@ -105,10 +105,11 @@ DECLARE_OOXMLEXPORT_TEST(testTscp, "tscp.docx")
// 3 RDF statements on the second paragraph.
xParagraph.set(getParagraph(2), uno::UNO_QUERY);
- std::map<OUString, OUString> aExpectedStatements = {
- {"urn:tscp:names:baf:1.1#BusinessAuthorization", "urn:example:tscp:1"},
- {"urn:tscp:names:baf:1.1#BusinessAuthorizationCategory", "urn:example:tscp:1:confidential"},
- {"urn:tscp:names:baf:1.1#BusinessAuthorizationDate", "2015-11-27T11:45:00"}
+ std::map<OUString, OUString> aExpectedStatements =
+ {
+ {"urn:bails:ExportControl:BusinessAuthorization:Identifier", "urn:example:tscp:1"},
+ {"urn:bails:ExportControl:BusinessAuthorizationCategory:Identifier", "urn:example:tscp:1:confidential"},
+ {"urn:bails:ExportControl:Authorization:StartValidity", "2015-11-27"}
};
std::map<OUString, OUString> aActualStatements;
xStatements = xGraph->getStatements(xParagraph, uno::Reference<rdf::XURI>(), uno::Reference<rdf::XURI>());
diff --git a/sw/qa/extras/ww8export/data/tscp.doc b/sw/qa/extras/ww8export/data/tscp.doc
index 7b710fcab770..9830b288c1a4 100644
--- a/sw/qa/extras/ww8export/data/tscp.doc
+++ b/sw/qa/extras/ww8export/data/tscp.doc
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index de107665d665..39c3fc80e8ea 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -103,10 +103,10 @@ DECLARE_WW8EXPORT_TEST(testN325936, "n325936.doc")
DECLARE_WW8EXPORT_TEST(testTscp, "tscp.doc")
{
uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
- uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, "urn:tscp:names:baf:1.1");
+ uno::Reference<rdf::XURI> xType = rdf::URI::create(xComponentContext, "urn:bails");
uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess(mxComponent, uno::UNO_QUERY);
uno::Sequence< uno::Reference<rdf::XURI> > aGraphNames = xDocumentMetadataAccess->getMetadataGraphsWithType(xType);
- // This failed, no graphs had the urn:tscp:names:baf:1.1 type.
+ // This failed, no graphs had the urn:bails type.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aGraphNames.getLength());
uno::Reference<rdf::XURI> xGraphName = aGraphNames[0];
uno::Reference<rdf::XNamedGraph> xGraph = xDocumentMetadataAccess->getRDFRepository()->getGraph(xGraphName);
@@ -118,10 +118,11 @@ DECLARE_WW8EXPORT_TEST(testTscp, "tscp.doc")
// 3 RDF statements on the second paragraph.
xParagraph.set(getParagraph(2), uno::UNO_QUERY);
- std::map<OUString, OUString> aExpectedStatements = {
- {"urn:tscp:names:baf:1.1#BusinessAuthorization", "urn:example:tscp:1"},
- {"urn:tscp:names:baf:1.1#BusinessAuthorizationCategory", "urn:example:tscp:1:confidential"},
- {"urn:tscp:names:baf:1.1#BusinessAuthorizationDate", "2015-11-27T11:45:00"}
+ std::map<OUString, OUString> aExpectedStatements =
+ {
+ {"urn:bails:ExportControl:BusinessAuthorization:Identifier", "urn:example:tscp:1"},
+ {"urn:bails:ExportControl:BusinessAuthorizationCategory:Identifier", "urn:example:tscp:1:confidential"},
+ {"urn:bails:ExportControl:Authorization:StartValidity", "2015-11-27"}
};
std::map<OUString, OUString> aActualStatements;
xStatements = xGraph->getStatements(xParagraph, uno::Reference<rdf::XURI>(), uno::Reference<rdf::XURI>());
diff --git a/sw/source/core/doc/rdfhelper.cxx b/sw/source/core/doc/rdfhelper.cxx
index 83605ed4858a..7f9381329ae4 100644
--- a/sw/source/core/doc/rdfhelper.cxx
+++ b/sw/source/core/doc/rdfhelper.cxx
@@ -9,6 +9,7 @@
#include <rdfhelper.hxx>
+#include <com/sun/star/rdf/Literal.hpp>
#include <com/sun/star/rdf/Statement.hpp>
#include <com/sun/star/rdf/URI.hpp>
#include <com/sun/star/rdf/XDocumentMetadataAccess.hpp>
@@ -68,7 +69,7 @@ void SwRDFHelper::addTextNodeStatement(const OUString& rType, const OUString& rP
uno::Reference<rdf::XNamedGraph> xGraph = xDocumentMetadataAccess->getRDFRepository()->getGraph(xGraphName);
uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(*rTextNode.GetDoc(), &rTextNode), uno::UNO_QUERY);
uno::Reference<rdf::XURI> xKey = rdf::URI::create(xComponentContext, rKey);
- uno::Reference<rdf::XURI> xValue = rdf::URI::create(xComponentContext, rValue);
+ uno::Reference<rdf::XLiteral> xValue = rdf::Literal::create(xComponentContext, rValue);
xGraph->addStatement(xSubject, xKey, xValue);
}
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx
index c80eab7701d0..de1e97cd4763 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -81,11 +81,14 @@ static SwContentNode* GetContentNode(SwDoc* pDoc, SwNodeIndex& rIdx, bool bNext)
return pCNd;
}
-static OUString lcl_getTypePath(const OUString& rType)
+static 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;
}
@@ -634,11 +637,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
for (const std::pair<OUString, OUString>& rAttribute : pMark->GetAttributes())
{
- 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;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 2b9fdedc9ba5..6b4cadee2331 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1038,7 +1038,7 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar
// RDF metadata for this text node.
SwTextNode* pTextNode = m_rExport.m_pCurPam->GetNode().GetTextNode();
- std::map<OUString, OUString> aStatements = SwRDFHelper::getTextNodeStatements("urn:tscp:names:baf:1.1", *pTextNode);
+ std::map<OUString, OUString> aStatements = SwRDFHelper::getTextNodeStatements("urn:bails", *pTextNode);
if (!aStatements.empty())
{
m_pSerializer->startElementNS(XML_w, XML_smartTag,
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index ae956e04be3b..6503a6886ae0 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1501,7 +1501,7 @@ void WW8Export::AppendAnnotationMarks(const SwTextNode& rNode, sal_Int32 nAktPos
void WW8Export::AppendSmartTags(const SwTextNode& rTextNode)
{
- std::map<OUString, OUString> aStatements = SwRDFHelper::getTextNodeStatements("urn:tscp:names:baf:1.1", rTextNode);
+ std::map<OUString, OUString> aStatements = SwRDFHelper::getTextNodeStatements("urn:bails", rTextNode);
if (!aStatements.empty())
{
WW8_CP nCP = Fc2Cp(Strm().Tell());