Kaydet (Commit) 0b7ef695 authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: handle RDF mark in SwFltControlStack::SetAttrInDoc()

Change-Id: I13e510e305c4aa24c37b1c25b4c3116ef3f06a8a
üst 97824ec9
...@@ -24,6 +24,8 @@ class SW_DLLPUBLIC SwRDFHelper ...@@ -24,6 +24,8 @@ class SW_DLLPUBLIC SwRDFHelper
public: public:
/// Gets all (rTextNode, key, value) statements in RDF graphs of type rType. /// Gets all (rTextNode, key, value) statements in RDF graphs of type rType.
static std::map<OUString, OUString> getTextNodeStatements(const OUString& rType, SwTextNode& rTextNode); 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 #endif // INCLUDED_SW_INC_RDFHELPER_HXX
......
...@@ -48,4 +48,8 @@ std::map<OUString, OUString> SwRDFHelper::getTextNodeStatements(const OUString& ...@@ -48,4 +48,8 @@ std::map<OUString, OUString> SwRDFHelper::getTextNodeStatements(const OUString&
return aRet; 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#include <fltshell.hxx> #include <fltshell.hxx>
#include <viewsh.hxx> #include <viewsh.hxx>
#include <shellres.hxx> #include <shellres.hxx>
#include <rdfhelper.hxx>
using namespace com::sun::star; using namespace com::sun::star;
...@@ -80,6 +81,14 @@ static SwContentNode* GetContentNode(SwDoc* pDoc, SwNodeIndex& rIdx, bool bNext) ...@@ -80,6 +81,14 @@ static SwContentNode* GetContentNode(SwDoc* pDoc, SwNodeIndex& rIdx, bool bNext)
return pCNd; 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 // Stack entry for all text attributes
SwFltStackEntry::SwFltStackEntry(const SwPosition& rStartPos, SfxPoolItem* pHt) SwFltStackEntry::SwFltStackEntry(const SwPosition& rStartPos, SfxPoolItem* pHt)
: m_aMkPos(rStartPos) : m_aMkPos(rStartPos)
...@@ -614,7 +623,25 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, ...@@ -614,7 +623,25 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos,
{ {
if (MakeBookRegionOrPoint(rEntry, pDoc, aRegion, true)) 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 else
SAL_WARN("sw", "failed to make book region or point"); SAL_WARN("sw", "failed to make book region or point");
......
...@@ -253,7 +253,7 @@ long SwWW8ImplReader::Read_FactoidBook(WW8PLCFManResult*) ...@@ -253,7 +253,7 @@ long SwWW8ImplReader::Read_FactoidBook(WW8PLCFManResult*)
SwFltRDFMark aMark; SwFltRDFMark aMark;
aMark.SetHandle(pFactoidBook->getHandle()); aMark.SetHandle(pFactoidBook->getHandle());
GetSmartTagInfo(aMark); GetSmartTagInfo(aMark);
m_pReffedStck->NewAttr(*m_pPaM->GetPoint(), CntUInt16Item(RES_FLTR_RDFMARK, pFactoidBook->getHandle())); m_pReffedStck->NewAttr(*m_pPaM->GetPoint(), aMark);
} }
} }
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment