diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-07-01 15:49:01 +0200 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2019-07-12 06:10:11 +0200 |
commit | 52205f85582aaaee04fcfffd1c1729454f512400 (patch) | |
tree | afbae61d17d01af41ef2ac14d78694a7b5056c07 /writerfilter/source/dmapper | |
parent | 2f4ccb1d5ea4258da42f2f6a0b62161399e13bcc (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>
Diffstat (limited to 'writerfilter/source/dmapper')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index 72b647cb24b8..e1493a31fcb3 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1029,10 +1029,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()) @@ -3233,8 +3230,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()) { |