[Libreoffice-commits] core.git: Branch 'feature/msforms' - sw/qa writerfilter/source

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 3 20:12:52 UTC 2019


Rebased ref, commits from common ancestor:
commit 3abfdb4bf6653f06526e3a9c27006f52617a021d
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Jul 3 19:57:19 2019 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Jul 3 22:11:46 2019 +0200

    MSForms: DOCX filter: The new text-based field is allowed in the header.
    
    Change-Id: I71d61c702ccd0470c4c3df09531704783c1b3e01

diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 3d3c528ef41a..b5b6b6040216 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
@@ -589,13 +589,13 @@ DECLARE_OOXMLEXPORT_TEST(testfdo82492, "fdo82492.docx")
     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt[1]/w:sdtContent/w:r",1);
 }
 
-/*DECLARE_OOXMLEXPORT_TEST(testSdtHeader, "sdt-header.docx")
+DECLARE_OOXMLEXPORT_TEST(testSdtHeader, "sdt-header.docx")
 {
     // Problem was that w:sdt elements in headers were lost on import.
     if (xmlDocPtr pXmlDoc = parseExport("word/header1.xml"))
         // This was 0, w:sdt (and then w:date) was missing.
         assertXPath(pXmlDoc, "//w:sdt/w:sdtPr/w:date", 1);
-}*/
+}
 
 DECLARE_OOXMLEXPORT_TEST(testSdtCompanyMultipara, "sdt-company-multipara.docx")
 {
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index b24e258645d9..5647b6ef115d 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1018,7 +1018,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
 
             if (!m_pImpl->m_pSdtHelper->getDropDownItems().empty())
                 m_pImpl->m_pSdtHelper->createDropDownControl();
-            else if (m_pImpl->m_pSdtHelper->validateDateFormat() && !IsInHeaderFooter())
+            else if (m_pImpl->m_pSdtHelper->validateDateFormat())
                 m_pImpl->m_pSdtHelper->createDateContentControl();
         break;
         case NS_ooxml::LN_CT_SdtListItem_displayText:
@@ -2427,30 +2427,20 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext )
     break;
     case NS_ooxml::LN_CT_SdtDate_dateFormat:
     {
-        if (!IsInHeaderFooter())
-            m_pImpl->m_pSdtHelper->getDateFormat().append(sStringValue);
-        else
-            m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDate_dateFormat", sStringValue);
+        m_pImpl->m_pSdtHelper->getDateFormat().append(sStringValue);
     }
     break;
     case NS_ooxml::LN_CT_SdtDate_storeMappedDataAs:
     {
-        if (IsInHeaderFooter())
-            m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDate_storeMappedDataAs", sStringValue);
     }
     break;
     case NS_ooxml::LN_CT_SdtDate_calendar:
     {
-        if (IsInHeaderFooter())
-            m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDate_calendar", sStringValue);
     }
     break;
     case NS_ooxml::LN_CT_SdtDate_lid:
     {
-        if (!IsInHeaderFooter())
-            m_pImpl->m_pSdtHelper->getLocale().append(sStringValue);
-        else
-            m_pImpl->appendGrabBag(m_pImpl->m_aInteropGrabBag, "ooxml:CT_SdtDate_lid", sStringValue);
+        m_pImpl->m_pSdtHelper->getLocale().append(sStringValue);
     }
     break;
     case NS_ooxml::LN_CT_SdtPr_dataBinding:
@@ -3213,13 +3203,13 @@ void DomainMapper::lcl_utext(const sal_uInt8 * data_, size_t len)
             return;
         }
     }
-    // Form controls are not allowed in headers / footers; see sw::DocumentContentOperationsManager::InsertDrawObj()
-    else if (m_pImpl->m_pSdtHelper->validateDateFormat() && !IsInHeaderFooter())
+    else if (m_pImpl->m_pSdtHelper->validateDateFormat())
     {
         // 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())
+        if((!m_pImpl->m_pSdtHelper->getDate().toString().isEmpty() || sText.isEmpty()) &&
+           (!IsInHeaderFooter() || !m_pImpl->IsDiscardHeaderFooter())) // discard date control with header / footer
         {
             return;
         }


More information about the Libreoffice-commits mailing list