summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2019-07-01 15:49:01 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2019-07-17 11:39:59 +0200
commit4dc4dc2e1de1785bd7a5b9417981447e1c80e8c3 (patch)
tree958a27ca9859a19698eb2da4352bf1fd66a48921 /writerfilter
parentaa6dd9e51c1ce293f8fcafa6b8ec53ef3f3e47ee (diff)
MSForms: DOCX filter: import manually set date field as plain text
In MSO the user can add any text in the date field without having it in the specified date format. We import this kind of date as plain text. Change-Id: Ied4bf03a3ac4c9b6f1cfc78d91e6a52ad3d6e179 Reviewed-on: https://gerrit.libreoffice.org/75452 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit 52205f85582aaaee04fcfffd1c1729454f512400)
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx17
1 files changed, 11 insertions, 6 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index b136e8f2f298..2687a35f32eb 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1028,10 +1028,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
m_pImpl->m_pSdtHelper->getDropDownItems().push_back(sStringValue);
break;
case NS_ooxml::LN_CT_SdtDate_fullDate:
- if (!IsInHeaderFooter())
- m_pImpl->m_pSdtHelper->getDate().append(sStringValue);
- else
- m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDate_fullDate", sStringValue);
+ m_pImpl->m_pSdtHelper->getDate().append(sStringValue);
break;
case NS_ooxml::LN_CT_Background_color:
if (m_pImpl->GetSettingsTable()->GetDisplayBackgroundShape())
@@ -3197,8 +3194,16 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
// Form controls are not allowed in headers / footers; see sw::DocumentContentOperationsManager::InsertDrawObj()
else if (m_pImpl->m_pSdtHelper->validateDateFormat() && !IsInHeaderFooter())
{
- // date field is imported, we don't need the corresponding date text
- return;
+ // Date field will be imported, so we don't need the corresponding date text in most of the cases
+ // however when fullDate is not specified, but we have a date string we need to import it as
+ // simple text (this is the case when user sets date field manually in MSO).
+ if(!m_pImpl->m_pSdtHelper->getDate().toString().isEmpty() || sText.isEmpty())
+ {
+ return;
+ }
+ // Remove date field attributes to avoid to import an actual date field
+ m_pImpl->m_pSdtHelper->getDateFormat().truncate();
+ m_pImpl->m_pSdtHelper->getLocale().truncate();
}
else if (!m_pImpl->m_pSdtHelper->isInteropGrabBagEmpty())
{