sw/source/filter/ww8/docxattributeoutput.cxx |   31 ---------------------------
 sw/source/filter/ww8/ww8atr.cxx              |   31 ++++++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 31 deletions(-)

New commits:
commit c2bcaaeab0787c6658eeda0f570bb6aa59d4d64e
Author:     Justin Luth <[email protected]>
AuthorDate: Wed Jan 18 11:06:44 2023 -0500
Commit:     Justin Luth <[email protected]>
CommitDate: Wed Jan 18 20:53:58 2023 +0000

    tdf#114537 doc/rtf export: move DOCX impl so all formats use it
    
    The DOC import keeps duplicating the content part,
    so I haven't added a separate unit test to this patch,
    but manual testing shows this works for DOC and RTF.
    The unit test for DOCX already handles the correctness
    of the code, so no real need for another test anyway.
    
    Change-Id: Iceb41a647b8408150ae8558b10b581d3a6c49e45
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145755
    Tested-by: Justin Luth <[email protected]>
    Reviewed-by: Justin Luth <[email protected]>

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index cef4bf2e33e9..477768e7019a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -8728,37 +8728,8 @@ void DocxAttributeOutput::RefField( const SwField&  
rField, const OUString& rRef
     // There is nothing to do here for the set fields
 }
 
-void DocxAttributeOutput::HiddenField(const SwField& rField)
+void DocxAttributeOutput::HiddenField(const SwField& /*rField*/)
 {
-    auto eSubType = static_cast<SwFieldTypesEnum>(rField.GetSubType());
-    if (eSubType == SwFieldTypesEnum::ConditionalText)
-    {
-        OUString aCond = rField.GetPar1();
-        OUString aTrueFalse = rField.GetPar2();
-        sal_Int32 nPos = aTrueFalse.indexOf('|');
-        OUString aTrue;
-        OUString aFalse;
-        if (nPos == -1)
-        {
-            aTrue = aTrueFalse;
-        }
-        else
-        {
-            aTrue = aTrueFalse.subView(0, nPos);
-            aFalse = aTrueFalse.subView(nPos + 1);
-        }
-        if (aTrue.getLength() > 1 && aTrue.startsWith("\"") && 
aTrue.endsWith("\""))
-            aTrue = aTrue.copy(1, aTrue.getLength() - 2);
-        if (aFalse.getLength() > 1 && aFalse.startsWith("\"") && 
aFalse.endsWith("\""))
-            aFalse = aFalse.copy(1, aFalse.getLength() - 2);
-
-        // Substitute a single quote for an illegal double quote if one exists
-        OUString aCmd = FieldString(ww::eIF) + aCond + " \"" + 
aTrue.replaceAll("\"", "'")
-            + "\" \"" + aFalse.replaceAll("\"", "'") + "\"";
-        m_rExport.OutputField(&rField, ww::eIF, aCmd);
-        return;
-    }
-
     SAL_INFO("sw.ww8", "TODO DocxAttributeOutput::HiddenField()" );
 }
 
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 862dbbe70e66..354c54862dcd 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3338,7 +3338,36 @@ void AttributeOutputBase::TextField( const 
SwFormatField& rField )
             OUString sExpand(pField->GetPar2());
             if (!sExpand.isEmpty())
             {
-                HiddenField( *pField );
+                auto eSubType = 
static_cast<SwFieldTypesEnum>(pField->GetSubType());
+                if (eSubType == SwFieldTypesEnum::ConditionalText)
+                {
+                    OUString aCond = pField->GetPar1();
+                    OUString aTrueFalse = pField->GetPar2();
+                    sal_Int32 nPos = aTrueFalse.indexOf('|');
+                    OUString aTrue;
+                    OUString aFalse;
+                    if (nPos == -1)
+                    {
+                        aTrue = aTrueFalse;
+                    }
+                    else
+                    {
+                        aTrue = aTrueFalse.subView(0, nPos);
+                        aFalse = aTrueFalse.subView(nPos + 1);
+                    }
+                    if (aTrue.getLength() > 1 && aTrue.startsWith("\"") && 
aTrue.endsWith("\""))
+                        aTrue = aTrue.copy(1, aTrue.getLength() - 2);
+                    if (aFalse.getLength() > 1 && aFalse.startsWith("\"") && 
aFalse.endsWith("\""))
+                        aFalse = aFalse.copy(1, aFalse.getLength() - 2);
+
+                    // Substitute a single quote for an illegal double quote 
if one exists
+                    OUString aCmd = FieldString(ww::eIF) + aCond + " \""
+                        + aTrue.replaceAll("\"", "'") + "\" \"" + 
aFalse.replaceAll("\"", "'")
+                            + "\"";
+                    GetExport().OutputField(pField, ww::eIF, aCmd);
+                }
+                else
+                    HiddenField(*pField);
             }
         }
         break;

Reply via email to