summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/CppunitTest_sw_filters_test.mk1
-rw-r--r--sw/CppunitTest_sw_globalfilter.mk1
-rw-r--r--sw/ooxmlexport_setup.mk2
-rw-r--r--sw/qa/extras/ooxmlexport/data/tscp.docx (renamed from sw/qa/extras/ooxmlimport/data/tscp.docx)bin4758 -> 4758 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport5.cxx40
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx40
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx20
7 files changed, 64 insertions, 40 deletions
diff --git a/sw/CppunitTest_sw_filters_test.mk b/sw/CppunitTest_sw_filters_test.mk
index 94b91c3f4d99..80d9fce30b02 100644
--- a/sw/CppunitTest_sw_filters_test.mk
+++ b/sw/CppunitTest_sw_filters_test.mk
@@ -80,6 +80,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_filters_test,\
ucb/source/core/ucb1 \
ucb/source/ucp/file/ucpfile1 \
unotools/util/utl \
+ unoxml/source/rdf/unordf \
unoxml/source/service/unoxml \
writerfilter/util/writerfilter \
$(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \
diff --git a/sw/CppunitTest_sw_globalfilter.mk b/sw/CppunitTest_sw_globalfilter.mk
index c6fa6ccd1168..66502663862c 100644
--- a/sw/CppunitTest_sw_globalfilter.mk
+++ b/sw/CppunitTest_sw_globalfilter.mk
@@ -78,6 +78,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_globalfilter,\
ucb/source/core/ucb1 \
ucb/source/ucp/file/ucpfile1 \
unotools/util/utl \
+ unoxml/source/rdf/unordf \
unoxml/source/service/unoxml \
uui/util/uui \
$(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \
diff --git a/sw/ooxmlexport_setup.mk b/sw/ooxmlexport_setup.mk
index a3a2182cd9c4..c8cfc9f4d205 100644
--- a/sw/ooxmlexport_setup.mk
+++ b/sw/ooxmlexport_setup.mk
@@ -58,7 +58,9 @@ define sw_ooxmlexport_components
toolkit/util/tk \
ucb/source/core/ucb1 \
ucb/source/ucp/file/ucpfile1 \
+ ucb/source/ucp/tdoc/ucptdoc1 \
unotools/util/utl \
+ unoxml/source/rdf/unordf \
unoxml/source/service/unoxml \
uui/util/uui \
writerfilter/util/writerfilter \
diff --git a/sw/qa/extras/ooxmlimport/data/tscp.docx b/sw/qa/extras/ooxmlexport/data/tscp.docx
index 3cda72de572e..3cda72de572e 100644
--- a/sw/qa/extras/ooxmlimport/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 b4b8896ea57f..c0979dbff9df 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -49,6 +49,8 @@
#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/rdf/URI.hpp>
+#include <com/sun/star/rdf/Statement.hpp>
#include <string>
@@ -85,6 +87,44 @@ DECLARE_OOXMLEXPORT_TEST(testFDO76248, "FDO76248.docx")
assertXPath(pXmlDoc, "//a:graphicData[not(*)]", 0);
}
+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::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.
+ 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);
+
+ // No RDF statement on the first paragraph.
+ uno::Reference<rdf::XResource> xParagraph(getParagraph(1), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xStatements = xGraph->getStatements(xParagraph, uno::Reference<rdf::XURI>(), uno::Reference<rdf::XURI>());
+ CPPUNIT_ASSERT_EQUAL(false, static_cast<bool>(xStatements->hasMoreElements()));
+
+ // 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> aActualStatements;
+ xStatements = xGraph->getStatements(xParagraph, uno::Reference<rdf::XURI>(), uno::Reference<rdf::XURI>());
+ while (xStatements->hasMoreElements())
+ {
+ rdf::Statement aStatement = xStatements->nextElement().get<rdf::Statement>();
+ aActualStatements[aStatement.Predicate->getNamespace() + aStatement.Predicate->getLocalName()] = aStatement.Object->getStringValue();
+ }
+ CPPUNIT_ASSERT(aExpectedStatements == aActualStatements);
+
+ // No RDF statement on the third paragraph.
+ xParagraph.set(getParagraph(3), uno::UNO_QUERY);
+ xStatements = xGraph->getStatements(xParagraph, uno::Reference<rdf::XURI>(), uno::Reference<rdf::XURI>());
+ CPPUNIT_ASSERT_EQUAL(false, static_cast<bool>(xStatements->hasMoreElements()));
+}
+
DECLARE_OOXMLEXPORT_TEST(testfdo76589 , "fdo76589.docx")
{
/* Numbered list was not preserve after RT.
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index a4bb78b8d81c..e19d1ba4c91e 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -79,8 +79,6 @@
#include <unotools/streamwrap.hxx>
#include <comphelper/propertysequence.hxx>
#include <com/sun/star/drawing/HomogenMatrix3.hpp>
-#include <com/sun/star/rdf/URI.hpp>
-#include <com/sun/star/rdf/Statement.hpp>
#include <bordertest.hxx>
@@ -2843,44 +2841,6 @@ DECLARE_OOXMLIMPORT_TEST(testIndents, "indents.docx")
} while (xParaEnum->hasMoreElements());
}
-DECLARE_OOXMLIMPORT_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::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.
- 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);
-
- // No RDF statement on the first paragraph.
- uno::Reference<rdf::XResource> xParagraph(getParagraph(1), uno::UNO_QUERY);
- uno::Reference<container::XEnumeration> xStatements = xGraph->getStatements(xParagraph, uno::Reference<rdf::XURI>(), uno::Reference<rdf::XURI>());
- CPPUNIT_ASSERT_EQUAL(false, static_cast<bool>(xStatements->hasMoreElements()));
-
- // 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> aActualStatements;
- xStatements = xGraph->getStatements(xParagraph, uno::Reference<rdf::XURI>(), uno::Reference<rdf::XURI>());
- while (xStatements->hasMoreElements())
- {
- rdf::Statement aStatement = xStatements->nextElement().get<rdf::Statement>();
- aActualStatements[aStatement.Predicate->getNamespace() + aStatement.Predicate->getLocalName()] = aStatement.Object->getStringValue();
- }
- CPPUNIT_ASSERT(aExpectedStatements == aActualStatements);
-
- // No RDF statement on the third paragraph.
- xParagraph.set(getParagraph(3), uno::UNO_QUERY);
- xStatements = xGraph->getStatements(xParagraph, uno::Reference<rdf::XURI>(), uno::Reference<rdf::XURI>());
- CPPUNIT_ASSERT_EQUAL(false, static_cast<bool>(xStatements->hasMoreElements()));
-}
-
DECLARE_OOXMLIMPORT_TEST(testTdf92454, "tdf92454.docx")
{
// The first paragraph had a large indentation / left margin as inheritance
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index c21910850e25..e27309426286 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -36,6 +36,7 @@
#include "unoframe.hxx"
#include "unodraw.hxx"
#include "textboxhelper.hxx"
+#include "rdfhelper.hxx"
#include "wrtww8.hxx"
#include <comphelper/random.hxx>
@@ -1034,6 +1035,25 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar
m_pSerializer->endElementNS( XML_w, XML_pPr );
+ // 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);
+ if (!aStatements.empty())
+ {
+ m_pSerializer->startElementNS(XML_w, XML_smartTag,
+ FSNS(XML_w, XML_uri), "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+ FSNS(XML_w, XML_element), "RDF",
+ FSEND);
+ m_pSerializer->startElementNS(XML_w, XML_smartTagPr, FSEND);
+ for (const std::pair<OUString, OUString>& rStatement : aStatements)
+ m_pSerializer->singleElementNS(XML_w, XML_attr,
+ FSNS(XML_w, XML_name), rStatement.first.toUtf8(),
+ FSNS(XML_w, XML_val), rStatement.second.toUtf8(),
+ FSEND);
+ m_pSerializer->endElementNS(XML_w, XML_smartTagPr);
+ m_pSerializer->endElementNS(XML_w, XML_smartTag);
+ }
+
if ( m_nColBreakStatus == COLBRK_WRITE )
{
m_pSerializer->startElementNS( XML_w, XML_r, FSEND );