[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - filter/source

Marco Cecchetti (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 17 12:20:11 UTC 2021


 filter/source/svg/svgwriter.cxx |   16 +++++++++++++++-
 filter/source/svg/svgwriter.hxx |    1 +
 2 files changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 0cfd16cbb8e0ad712caf1fc05fba4797749ba106
Author:     Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Mon Feb 15 17:57:00 2021 +0100
Commit:     Marco Cecchetti <marco.cecchetti at collabora.com>
CommitDate: Wed Feb 17 13:19:34 2021 +0100

    filter: svg: text field: placeholder localization issue
    
    The text content for a placeholder is localized,
    so in case a French locale is used, the placeholder
    for a PageNumber text field is <numéro> instead of
    <number>.
    
    Change-Id: If1d31fee98d044775995b5b80567296f78d2a6c8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110944
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Ashod Nakashian <ash at collabora.com>
    Reviewed-by: Marco Cecchetti <marco.cecchetti at collabora.com>

diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 1d7b62153d94..39bd446a31b0 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -1111,6 +1111,7 @@ bool SVGTextWriter::nextTextPortion()
 #endif
             msPageCount = "";
             msDateTimeType = "";
+            msTextFieldType = "";
             if( xPortionTextRange.is() )
             {
 #if OSL_DEBUG_LEVEL > 0
@@ -1154,6 +1155,7 @@ bool SVGTextWriter::nextTextPortion()
                             ++pNames;
                         }
 
+                        msTextFieldType = sFieldName;
 #if OSL_DEBUG_LEVEL > 0
                         sInfo += "text field type: " + sFieldName + "; content: " + xTextField->getPresentation( /* show command: */ false ) + "; ";
 #endif
@@ -1688,7 +1690,6 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos,
     if( mbIsPlaceholderShape )
     {
         mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "PlaceholderText" );
-        mbIsPlaceholderShape = false;
     }
 
     addFontAttributes( /* isTexTContainer: */ false );
@@ -1721,6 +1722,19 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos,
         SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS );
         mrExport.GetDocHandler()->characters( msDateTimeType );
     }
+    else if( mbIsPlaceholderShape && rText.startsWith("<") && rText.endsWith(">") )
+    {
+        OUString sContent;
+        if( msTextFieldType == "PageNumber" )
+            sContent = "<number>";
+        else if( msTextFieldType == "PageName" )
+            sContent = "<slide-name>";
+        else
+            sContent = rText;
+
+        SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS );
+        mrExport.GetDocHandler()->characters( sContent );
+    }
     else
     {
         SvXMLElementExport aSVGTspanElem( mrExport, XML_NAMESPACE_NONE, aXMLElemTspan, mbIWS, mbIWS );
diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx
index ba8037d1ea91..d7458d053120 100644
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@ -252,6 +252,7 @@ class SVGTextWriter final
     OUString                                    msHyperlinkIdList;
     OUString                                    msPageCount;
     OUString                                    msDateTimeType;
+    OUString                                    msTextFieldType;
     bool                                        mbIsPlaceholderShape;
     static const bool                           mbIWS = false;
     vcl::Font                                   maCurrentFont;


More information about the Libreoffice-commits mailing list