diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-12-02 17:00:17 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-12-02 17:16:17 +0100 |
commit | 08e5fc257fa8c106be34bb034ebe5e00b6fcf711 (patch) | |
tree | edcc122c1591380c63957436837818e5d94a97e5 /sw/source/filter | |
parent | 5402ac4e006b9aac6944f7fb9f1a9f256a754472 (diff) |
DOCX export: handle <w:smartTag>
A Writer document can have multiple arbitrary RDF graphs, handle the following
subset:
- instead of handling all graphs, have a whitelist, look at the TSCP graph the
DOCX importer creates
- look for (paragraph, key, value) statements and export those
Change-Id: I142c24fb4c8140bde5fc1efad2932886de167b90
Diffstat (limited to 'sw/source/filter')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
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 ); |