summaryrefslogtreecommitdiff
path: root/writerfilter/source
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2021-11-18 20:06:08 +0300
committerXisco Fauli <xiscofauli@libreoffice.org>2021-12-09 09:48:42 +0100
commit2a57cd4e01b5fba00f210b792d1fcf0acb9c69fb (patch)
tree5e651e7dde9b3e35a8ff961172c52f25c2b0e191 /writerfilter/source
parent9ac193fd3cc1f66aeedaa64a09642c4fcc4c62e0 (diff)
sw: support for other sdt attributes roundtrip in datepicker
Word Control Field with datepicker is implemented with LO datepicker, but during this conversion we lose some field data, like control color, data mapping, etc. This data is already retrieved and stored in grab bag, so we need just to keep this grabbag in field and use it again on export. Change-Id: I6af8204fe1a7d2f9081d83372a6786b2f86260d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125486 Tested-by: Jenkins Reviewed-by: Vasily Melenchuk <vasily.melenchuk@cib.de> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126280
Diffstat (limited to 'writerfilter/source')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx9
-rw-r--r--writerfilter/source/dmapper/SdtHelper.cxx3
-rw-r--r--writerfilter/source/dmapper/SdtHelper.hxx15
3 files changed, 22 insertions, 5 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index ea16e51e0f9f..b247e0156b38 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1132,12 +1132,15 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
}
break;
case NS_ooxml::LN_CT_DataBinding_prefixMappings:
+ m_pImpl->m_pSdtHelper->setDataBindingPrefixMapping(sStringValue);
m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_DataBinding_prefixMappings", sStringValue);
break;
case NS_ooxml::LN_CT_DataBinding_xpath:
+ m_pImpl->m_pSdtHelper->setDataBindingXPath(sStringValue);
m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_DataBinding_xpath", sStringValue);
break;
case NS_ooxml::LN_CT_DataBinding_storeItemID:
+ m_pImpl->m_pSdtHelper->setDataBindingStoreItemID(sStringValue);
m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_DataBinding_storeItemID", sStringValue);
break;
case NS_ooxml::LN_CT_SdtPlaceholder_docPart_val:
@@ -3539,11 +3542,7 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
}
else if (m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::datePicker)
{
- if (!m_pImpl->m_pSdtHelper->isInteropGrabBagEmpty())
- {
- m_pImpl->m_pSdtHelper->getInteropGrabBagAndClear();
- }
- else if (IsInHeaderFooter() && m_pImpl->IsDiscardHeaderFooter())
+ if (IsInHeaderFooter() && m_pImpl->IsDiscardHeaderFooter())
{
m_pImpl->m_pSdtHelper->getDateFormat().truncate();
m_pImpl->m_pSdtHelper->getLocale().truncate();
diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx
index 46f834280404..5466baec8fc1 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -196,6 +196,9 @@ void SdtHelper::createDateContentControl()
}
setControlType(SdtControlType::unknown);
+
+ // Store all unused sdt parameters from grabbag
+ xNameCont->insertByName("SdtParams", uno::makeAny(getInteropGrabBagAndClear()));
}
void SdtHelper::createControlShape(awt::Size aSize,
diff --git a/writerfilter/source/dmapper/SdtHelper.hxx b/writerfilter/source/dmapper/SdtHelper.hxx
index 5a39177c4a56..9d31e1621504 100644
--- a/writerfilter/source/dmapper/SdtHelper.hxx
+++ b/writerfilter/source/dmapper/SdtHelper.hxx
@@ -54,6 +54,14 @@ class SdtHelper final : public virtual SvRefBase
OUStringBuffer m_sDate;
/// Date format string as it comes from the ooxml document.
OUStringBuffer m_sDateFormat;
+
+ /// <w:dataBinding w:prefixMappings="">
+ OUString m_sDataBindingPrefixMapping;
+ /// <w:dataBinding w:xpath="">
+ OUString m_sDataBindingXPath;
+ /// <w:dataBinding w:storeItemID="">
+ OUString m_sDataBindingStoreItemID;
+
/// Start range of the date field
css::uno::Reference<css::text::XTextRange> m_xDateFieldStartRange;
/// Locale string as it comes from the ooxml document.
@@ -81,6 +89,13 @@ public:
OUStringBuffer& getDateFormat() { return m_sDateFormat; }
+ void setDataBindingPrefixMapping(const OUString& sValue)
+ {
+ m_sDataBindingPrefixMapping = sValue;
+ }
+ void setDataBindingXPath(const OUString& sValue) { m_sDataBindingXPath = sValue; }
+ void setDataBindingStoreItemID(const OUString& sValue) { m_sDataBindingStoreItemID = sValue; }
+
void setDateFieldStartRange(const css::uno::Reference<css::text::XTextRange>& xStartRange)
{
m_xDateFieldStartRange = xStartRange;