diff options
-rw-r--r-- | sw/inc/rdfhelper.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/rdfhelper.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/basflt/fltshell.cxx | 29 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 2 |
4 files changed, 35 insertions, 2 deletions
diff --git a/sw/inc/rdfhelper.hxx b/sw/inc/rdfhelper.hxx index d9787cb0e402..edee106b4186 100644 --- a/sw/inc/rdfhelper.hxx +++ b/sw/inc/rdfhelper.hxx @@ -24,6 +24,8 @@ class SW_DLLPUBLIC SwRDFHelper public: /// Gets all (rTextNode, key, value) statements in RDF graphs of type rType. static std::map<OUString, OUString> getTextNodeStatements(const OUString& rType, SwTextNode& rTextNode); + /// Add an (rTextNode, key, value) statement in the graph of type rType -- or if it does not exist, create a graph at rPath first. + static void addTextNodeStatement(const OUString& rType, const OUString& rPath, SwTextNode& rTextNode, const OUString& rKey, const OUString& rValue); }; #endif // INCLUDED_SW_INC_RDFHELPER_HXX diff --git a/sw/source/core/doc/rdfhelper.cxx b/sw/source/core/doc/rdfhelper.cxx index f476bf7bc37e..25acac9720eb 100644 --- a/sw/source/core/doc/rdfhelper.cxx +++ b/sw/source/core/doc/rdfhelper.cxx @@ -48,4 +48,8 @@ std::map<OUString, OUString> SwRDFHelper::getTextNodeStatements(const OUString& return aRet; } +void SwRDFHelper::addTextNodeStatement(const OUString& /*rType*/, const OUString& /*rPath*/, SwTextNode& /*rTextNode*/, const OUString& /*rKey*/, const OUString& /*rValue*/) +{ +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx index 37aad9fd5bde..6c378882f4e3 100644 --- a/sw/source/filter/basflt/fltshell.cxx +++ b/sw/source/filter/basflt/fltshell.cxx @@ -64,6 +64,7 @@ #include <fltshell.hxx> #include <viewsh.hxx> #include <shellres.hxx> +#include <rdfhelper.hxx> using namespace com::sun::star; @@ -80,6 +81,14 @@ static SwContentNode* GetContentNode(SwDoc* pDoc, SwNodeIndex& rIdx, bool bNext) return pCNd; } +static OUString lcl_getTypePath(const OUString& rType) +{ + OUString aRet; + if (rType == "urn:tscp:names:baf:1.1") + aRet = "tscp/baf.rdf"; + return aRet; +} + // Stack entry for all text attributes SwFltStackEntry::SwFltStackEntry(const SwPosition& rStartPos, SfxPoolItem* pHt) : m_aMkPos(rStartPos) @@ -614,7 +623,25 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, { if (MakeBookRegionOrPoint(rEntry, pDoc, aRegion, true)) { - // TODO handle RDF mark + SwFltRDFMark* pMark = static_cast<SwFltRDFMark*>(rEntry.pAttr); + if (aRegion.GetNode().IsTextNode()) + { + SwTextNode& rTextNode = *aRegion.GetNode().GetTextNode(); + + 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 aMetadataFilePath = lcl_getTypePath(aTypeNS); + if (aMetadataFilePath.isEmpty()) + continue; + + SwRDFHelper::addTextNodeStatement(aTypeNS, aMetadataFilePath, rTextNode, rAttribute.first, rAttribute.second); + } + } } else SAL_WARN("sw", "failed to make book region or point"); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 2cc0743b170b..05a109bd381a 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -253,7 +253,7 @@ long SwWW8ImplReader::Read_FactoidBook(WW8PLCFManResult*) SwFltRDFMark aMark; aMark.SetHandle(pFactoidBook->getHandle()); GetSmartTagInfo(aMark); - m_pReffedStck->NewAttr(*m_pPaM->GetPoint(), CntUInt16Item(RES_FLTR_RDFMARK, pFactoidBook->getHandle())); + m_pReffedStck->NewAttr(*m_pPaM->GetPoint(), aMark); } } return 0; |