summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2021-02-15 17:57:00 +0100
committerAndras Timar <andras.timar@collabora.com>2021-02-22 15:49:21 +0100
commitecdbba7cf2326c77fd0ec3102554e3d1e8f97452 (patch)
tree54aae312f95aed5e79b62cd97213488eaf8b3a8e
parentfilter: svg: export tiled background by exploiting svg:pattern element (diff)
downloadcore-ecdbba7cf2326c77fd0ec3102554e3d1e8f97452.tar.gz
core-ecdbba7cf2326c77fd0ec3102554e3d1e8f97452.zip
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@gmail.com> Reviewed-by: Ashod Nakashian <ash@collabora.com> Reviewed-by: Marco Cecchetti <marco.cecchetti@collabora.com>
-rw-r--r--filter/source/svg/svgwriter.cxx16
-rw-r--r--filter/source/svg/svgwriter.hxx1
2 files changed, 16 insertions, 1 deletions
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index a96efaaec878..f10906147777 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -1112,6 +1112,7 @@ bool SVGTextWriter::nextTextPortion()
#endif
msPageCount = "";
msDateTimeType = "";
+ msTextFieldType = "";
if( xPortionTextRange.is() )
{
#if OSL_DEBUG_LEVEL > 0
@@ -1155,6 +1156,7 @@ bool SVGTextWriter::nextTextPortion()
++pNames;
}
+ msTextFieldType = sFieldName;
#if OSL_DEBUG_LEVEL > 0
sInfo += "text field type: " + sFieldName + "; content: " + xTextField->getPresentation( /* show command: */ false ) + "; ";
#endif
@@ -1690,7 +1692,6 @@ void SVGTextWriter::implWriteTextPortion( const Point& rPos,
if( mbIsPlaceholderShape )
{
mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", "PlaceholderText" );
- mbIsPlaceholderShape = false;
}
addFontAttributes( /* isTexTContainer: */ false );
@@ -1723,6 +1724,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 c5725d63e491..11df01208168 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;