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

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 30 16:06:08 UTC 2020


 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   24 +++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

New commits:
commit 2a8d083655cdbe59b61904b9144d7837dc5f7bc0
Author:     Jan-Marek Glogowski <jan-marek.glogowski at extern.cib.de>
AuthorDate: Mon Jan 20 17:33:41 2020 +0100
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Thu Jan 30 17:05:09 2020 +0100

    tdf#129237 just add content checks for Input fields
    
    There seems to be fields with content values, which don't use it
    as the presentation value. So this reverts the content handling
    code back to the original one and just checks the content value
    from Input fields in addition to the SetExpression fields.
    
    Change-Id: I2abd227883035c559b1fc3f7aacf10769b0e79a8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87093
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    (cherry picked from commit 3a248dfe57318af57fc5df89652cb64dfa923e46)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87740
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 8128c800e834..fe6283616c1e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -5539,18 +5539,24 @@ void DomainMapper_Impl::SetFieldResult(OUString const& rResult)
                     else
                     {
                         uno::Reference< beans::XPropertySet > xFieldProperties( xTextField, uno::UNO_QUERY_THROW);
+                        // In case of SetExpression, and Input fields the field result contains the content of the variable.
                         uno::Reference<lang::XServiceInfo> xServiceInfo(xTextField, uno::UNO_QUERY);
-                        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;
+                        // there are fields with a content property, which aren't working correctly with
+                        // a generalized try catch of the content, property, so just restrict content
+                        // handling to these explicit services.
+                        const bool bHasContent = xServiceInfo->supportsService("com.sun.star.text.TextField.SetExpression") ||
+                            xServiceInfo->supportsService("com.sun.star.text.TextField.Input");
+                        // If we already have content set, then use the current presentation
+                        OUString sValue;
+                        if (bHasContent)
+                        {
+                            // this will throw for field types without Content
+                            uno::Any aValue(xFieldProperties->getPropertyValue(
+                                    getPropertyName(PROP_CONTENT)));
+                            aValue >>= sValue;
                         }
-                        catch (...) {}
                         xFieldProperties->setPropertyValue(
-                                getPropertyName(bCanHaveContent && sContent.isEmpty()? PROP_CONTENT : PROP_CURRENT_PRESENTATION),
+                                getPropertyName(bHasContent && sValue.isEmpty()? PROP_CONTENT : PROP_CURRENT_PRESENTATION),
                              uno::makeAny( rResult ));
                     }
                 }


More information about the Libreoffice-commits mailing list