summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorJacobo Aragunde Pérez <jaragunde@igalia.com>2014-03-19 19:44:27 +0100
committerJacobo Aragunde Pérez <jaragunde@igalia.com>2014-03-20 10:28:24 +0100
commit306859babd5a997a1e5d50e7791e8e5852a7ea2e (patch)
tree1d5c95f0b1a6599518e59fa37cb34aed2f06cd40 /writerfilter
parent876f1cf9bfcbd9f0e578aea6e2a96443ecf823fd (diff)
ooxml: preserve dataBinding tag in SDT properties
SDT blocks can contain document properties, like the author. This is done with the dataBinding tag inside sdtPr. Added a resource definition to the ooxml model file, so the parser can process this tag. The attributes are stored in the existing grab bag used for other sdt properties and written back on export. The code to write the SDT block in the exporter has been modified to be able to extract the new tag from the grab bag and write it to the document. Added a unit test. Change-Id: I18f35a61784eb0a03ab9ca2cc398ca0df289956c
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx11
-rw-r--r--writerfilter/source/ooxml/model.xml5
2 files changed, 15 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 85cbcec2fd59..f57c142bcd7b 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -898,6 +898,14 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
if (static_cast<sal_uInt32>(nIntValue) == NS_ooxml::LN_Value_wordprocessingml_ST_FtnEdn_separator)
m_pImpl->m_bIgnoreNextPara = true;
break;
+ case NS_ooxml::LN_CT_DataBinding_prefixMappings:
+ case NS_ooxml::LN_CT_DataBinding_xpath:
+ case NS_ooxml::LN_CT_DataBinding_storeItemID:
+ {
+ OUString sName = OUString::createFromAscii((*QNameToString::Instance())(nName).c_str());
+ m_pImpl->m_pSdtHelper->appendToInteropGrabBag(sName, uno::Any(sStringValue));
+ }
+ break;
default:
{
#if OSL_DEBUG_LEVEL > 0
@@ -2234,6 +2242,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
m_pImpl->m_pSdtHelper->getLocale().append(sStringValue);
}
break;
+ case NS_ooxml::LN_CT_SdtPr_dataBinding:
case NS_ooxml::LN_CT_SdtPr_equation:
case NS_ooxml::LN_CT_SdtPr_checkbox:
case NS_ooxml::LN_CT_SdtPr_docPartObj:
@@ -2656,7 +2665,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
// save them in the paragraph interop grab bag
OUString sName = m_pImpl->m_pSdtHelper->getInteropGrabBagName();
uno::Any aPropValue = uno::makeAny(m_pImpl->m_pSdtHelper->getInteropGrabBagAndClear());
- if(sName == "ooxml:CT_SdtPr_checkbox")
+ if(sName == "ooxml:CT_SdtPr_checkbox" || sName == "ooxml:CT_SdtPr_dataBinding")
m_pImpl->GetTopContextOfType(CONTEXT_CHARACTER)->Insert(PROP_SDTPR, aPropValue, true, CHAR_GRAB_BAG);
else
m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH)->Insert(PROP_SDTPR, aPropValue, true, PARA_GRAB_BAG);
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 2ab502a37785..e60d60e50881 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -24536,6 +24536,11 @@
<attribute name="val" tokenid="ooxml:CT_CalendarType_val" action="setValue"/>
<action name="start" action="setDefaultStringValue"/>
</resource>
+ <resource name="CT_DataBinding" resource="Properties">
+ <attribute name="prefixMappings" tokenid="ooxml:CT_DataBinding_prefixMappings"/>
+ <attribute name="xpath" tokenid="ooxml:CT_DataBinding_xpath"/>
+ <attribute name="storeItemID" tokenid="ooxml:CT_DataBinding_storeItemID"/>
+ </resource>
<resource xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" name="CT_SdtPr" resource="Properties" tag="field">
<element name="rPr" tokenid="ooxml:CT_SdtPr_rPr"/>
<element name="alias" tokenid="ooxml:CT_SdtPr_alias"/>