[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - writerfilter/source

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Tue Nov 19 07:09:43 UTC 2019


 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   23 +++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

New commits:
commit 90424d0b6d316998ff3e2632add0f0c8da55e3a2
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Tue Oct 29 14:39:05 2019 +0100
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Tue Nov 19 08:09:08 2019 +0100

    tdf#128460 import SwInputField from DOCX FILLIN
    
    Actually the whole FILLIN handling is not that correct, because
    the value can actually be formatted in any way in Word, as it's
    just defined as a range of runs with formating, while Writer just
    applies the character formatitng to the whole field.
    
    But this at least allows for a round trip of the exported Writer
    type input field after commit 62aaaad156ef ("tdf#125103 Writer:
    input fields will be exported to docx") changed this.
    
    Change-Id: I6389b4a2ff9d2b62e1e4a00f1c1e112c199377b5
    Regression-from: 62aaaad156ef0daccd2680161ef8b9b99d8a7bc0
    Reviewed-on: https://gerrit.libreoffice.org/81686
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit 5e279f175289234b91f272bbbf48e70315fff5ac)
    Reviewed-on: https://gerrit.libreoffice.org/83039
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index a24eadd95aa0..96352aab7b99 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -5012,7 +5012,9 @@ bool DomainMapper_Impl::IsFieldResultAsString()
     OSL_ENSURE( pContext.get(), "no field context available");
     if( pContext.get() )
     {
-        bRet = pContext->GetTextField().is() || pContext->GetFieldId() == FIELD_FORMDROPDOWN;
+        bRet = pContext->GetTextField().is()
+            || pContext->GetFieldId() == FIELD_FORMDROPDOWN
+            || pContext->GetFieldId() == FIELD_FILLIN;
     }
 
     if (!bRet)
@@ -5183,19 +5185,18 @@ void DomainMapper_Impl::SetFieldResult(OUString const& rResult)
                     else
                     {
                         uno::Reference< beans::XPropertySet > xFieldProperties( xTextField, uno::UNO_QUERY_THROW);
-                        // In case of SetExpression, the field result contains the content of the variable.
                         uno::Reference<lang::XServiceInfo> xServiceInfo(xTextField, uno::UNO_QUERY);
-                        bool bIsSetExpression = xServiceInfo->supportsService("com.sun.star.text.TextField.SetExpression");
-                        // If we already have content set, then use the current presentation
-                        OUString sValue;
-                        if (bIsSetExpression)
-                        {   // this will throw for field types without Content
-                            uno::Any aValue(xFieldProperties->getPropertyValue(
-                                    getPropertyName(PROP_CONTENT)));
-                            aValue >>= sValue;
+                        OUString sContent;
+                        bool bCanHaveContent = false;
+                        try
+                        {   // this will throw for field types without Content property
+                            uno::Any aValue(xFieldProperties->getPropertyValue(getPropertyName(PROP_CONTENT)));
+                            bCanHaveContent = true;
+                            aValue >>= sContent;
                         }
+                        catch (...) {}
                         xFieldProperties->setPropertyValue(
-                                getPropertyName(bIsSetExpression && sValue.isEmpty()? PROP_CONTENT : PROP_CURRENT_PRESENTATION),
+                                getPropertyName(bCanHaveContent && sContent.isEmpty()? PROP_CONTENT : PROP_CURRENT_PRESENTATION),
                              uno::makeAny( rResult ));
                     }
                 }


More information about the Libreoffice-commits mailing list