From ee2b9e0fd7d000078795ba3fac38e745cb915689 Mon Sep 17 00:00:00 2001 From: Marco Cecchetti Date: Mon, 15 Feb 2021 17:57:00 +0100 Subject: filter: svg: text field: placeholder localization issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The text content for a placeholder is localized, so in case a French locale is used, the placeholder for a PageNumber text field is instead of . Change-Id: If1d31fee98d044775995b5b80567296f78d2a6c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110944 Tested-by: Jenkins CollaboraOffice Reviewed-by: Ashod Nakashian Reviewed-by: Marco Cecchetti Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111845 Tested-by: Jenkins --- filter/source/svg/svgwriter.cxx | 16 +++++++++++++++- filter/source/svg/svgwriter.hxx | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'filter') 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 = ""; + else if( msTextFieldType == "PageName" ) + sContent = ""; + 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; -- cgit