[Libreoffice-commits] core.git: filter/source

Marco Cecchetti (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 9 14:37:48 UTC 2021


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

New commits:
commit ee2b9e0fd7d000078795ba3fac38e745cb915689
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: Tue Mar 9 15:37:09 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>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111845
    Tested-by: Jenkins

diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 08ad2c5781ce..47dbce93bbd5 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -1138,6 +1138,7 @@ bool SVGTextWriter::nextTextPortion()
 #endif
             msPageCount = "";
             msDateTimeType = "";
+            msTextFieldType = "";
             if( xPortionTextRange.is() )
             {
 #if OSL_DEBUG_LEVEL > 0
@@ -1181,6 +1182,7 @@ bool SVGTextWriter::nextTextPortion()
                             ++pNames;
                         }
 
+                        msTextFieldType = sFieldName;
 #if OSL_DEBUG_LEVEL > 0
                         sInfo += "text field type: " + sFieldName + "; content: " + xTextField->getPresentation( /* show command: */ false ) + "; ";
 #endif
@@ -1717,7 +1719,6 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos,
     if( mbIsPlaceholderShape )
     {
         mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "PlaceholderText" );
-        mbIsPlaceholderShape = false;
     }
 
     addFontAttributes( /* isTexTContainer: */ false );
@@ -1755,6 +1756,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 1fa351f10382..993d1162fcf3 100644
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@ -231,6 +231,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