summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-12-09 10:49:17 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-12-09 13:52:33 +0100
commit97824ec98932284c7668fec90630b5d474266609 (patch)
tree22b5285bb02d7ca9f8f1c25113875d981093f34b /sw/source
parent0c5c971d36e444b0d50eb385c6c5105edcfe045c (diff)
SwWW8ImplReader::GetSmartTagInfo: read from SmartTagData
With this, SwWW8ImplReader::Read_FactoidBook() gets exactly the matching key/value strings for the smart-tag bookmark, so now only SwFltControlStack has to store the item and process it. Change-Id: If799d7d0bd1d69ddf8325d05f2b7c6e55112bba2
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/filter/ww8/ww8par.cxx36
-rw-r--r--sw/source/filter/ww8/ww8par.hxx2
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx5
3 files changed, 39 insertions, 4 deletions
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 15a731b17f43..85557ceb344c 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5978,13 +5978,47 @@ const OUString* SwWW8ImplReader::GetAnnotationAuthor(sal_uInt16 nIdx)
return pRet;
}
-void SwWW8ImplReader::GetSmartTagInfo(sal_uInt16 /*nIndex*/)
+void SwWW8ImplReader::GetSmartTagInfo(SwFltRDFMark& rMark)
{
if (!m_pSmartTagData && m_pWwFib->lcbFactoidData)
{
m_pSmartTagData.reset(new WW8SmartTagData());
m_pSmartTagData->Read(*m_pTableStream, m_pWwFib->fcFactoidData, m_pWwFib->lcbFactoidData);
}
+
+ // Check if the handle is a valid smart tag bookmark index.
+ size_t nIndex = rMark.GetHandle();
+ if (nIndex >= m_pSmartTagData->m_aPropBags.size())
+ return;
+
+ // Check if the smart tag bookmark refers to a valid factoid type.
+ const MSOPropertyBag& rPropertyBag = m_pSmartTagData->m_aPropBags[rMark.GetHandle()];
+ auto itPropertyBag = m_pSmartTagData->m_aPropBagStore.m_aFactoidTypes.begin();
+ for (; itPropertyBag != m_pSmartTagData->m_aPropBagStore.m_aFactoidTypes.end(); ++itPropertyBag)
+ if (itPropertyBag->m_nId == rPropertyBag.m_nId)
+ break;
+ if (itPropertyBag == m_pSmartTagData->m_aPropBagStore.m_aFactoidTypes.end())
+ return;
+
+ // Check if the factoid is an RDF one.
+ const MSOFactoidType& rFactoidType = *itPropertyBag;
+ if (rFactoidType.m_aUri != "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
+ return;
+
+ // Finally put the relevant attributes to the mark.
+ std::vector< std::pair<OUString, OUString> > aAttributes;
+ for (const MSOProperty& rProperty : rPropertyBag.m_aProperties)
+ {
+ OUString aKey;
+ OUString aValue;
+ if (rProperty.m_nKey < m_pSmartTagData->m_aPropBagStore.m_aStringTable.size())
+ aKey = m_pSmartTagData->m_aPropBagStore.m_aStringTable[rProperty.m_nKey];
+ if (rProperty.m_nValue < m_pSmartTagData->m_aPropBagStore.m_aStringTable.size())
+ aValue = m_pSmartTagData->m_aPropBagStore.m_aStringTable[rProperty.m_nValue];
+ if (!aKey.isEmpty() && !aValue.isEmpty())
+ aAttributes.push_back(std::make_pair(aKey, aValue));
+ }
+ rMark.SetAttributes(aAttributes);
}
sal_uLong SwWW8ImplReader::LoadDoc(WW8Glossary *pGloss)
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index d231d573826a..65632bd9d90b 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1640,7 +1640,7 @@ private:
const OUString* GetAnnotationAuthor(sal_uInt16 nIdx);
- void GetSmartTagInfo(sal_uInt16 nIndex);
+ void GetSmartTagInfo(SwFltRDFMark& rMark);
// interfaces for the toggle attributes
void SetToggleAttr(sal_uInt8 nAttrId, bool bOn);
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 5394be4b722c..2cc0743b170b 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -250,8 +250,9 @@ long SwWW8ImplReader::Read_FactoidBook(WW8PLCFManResult*)
m_pReffedStck->SetAttr(*m_pPaM->GetPoint(), RES_FLTR_RDFMARK, true, pFactoidBook->getHandle());
else
{
- // TODO make this non-void and put keys/values into the RDF mark.
- GetSmartTagInfo(pFactoidBook->getHandle());
+ SwFltRDFMark aMark;
+ aMark.SetHandle(pFactoidBook->getHandle());
+ GetSmartTagInfo(aMark);
m_pReffedStck->NewAttr(*m_pPaM->GetPoint(), CntUInt16Item(RES_FLTR_RDFMARK, pFactoidBook->getHandle()));
}
}