filter/source/svg/svgexport.cxx |   29 +++++++++++++++--------------
 filter/source/svg/svgfilter.hxx |    4 ++--
 2 files changed, 17 insertions(+), 16 deletions(-)

New commits:
commit 8fb366c13ac1b23c455c32afc085bca2edff03bb
Author:     Hossein <hoss...@libreoffice.org>
AuthorDate: Fri Oct 8 19:55:46 2021 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Oct 8 22:55:04 2021 +0200

    const OUString -> constexpr OUStringLiteral
    
    * Defining the constant strings as "constexpr OUStringLiteral"
      instead of using macros
    * Changing "const OUString" to "constexpr OUStringLiteral" where
      possible
    * Using "inline" in the header files to avoid duplicate copies of the
      global variable inside the files that included them
    
    * Read more:
    
https://learncpp.com/cpp-tutorial/sharing-global-constants-across-multiple-files-using-inline-variables/
    
    Change-Id: Ic0741c0044ff160734e641d072fef9be956815a3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123104
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index 4b81f491a204..7dff65c1f8d6 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -78,7 +78,7 @@ using namespace ::xmloff::token;
 
 // - ooo elements and attributes -
 
-#define NSPREFIX "ooo:"
+#define NSPREFIX u"ooo:"
 
 constexpr OUStringLiteral SVG_PROP_TINYPROFILE = u"TinyMode";
 constexpr OUStringLiteral SVG_PROP_DTDSTRING = u"DTDString";
@@ -88,23 +88,23 @@ constexpr OUStringLiteral SVG_PROP_OPACITY = u"Opacity";
 constexpr OUStringLiteral SVG_PROP_POSITIONED_CHARACTERS = 
u"UsePositionedCharacters";
 
 // ooo xml elements
-constexpr OUStringLiteral aOOOElemTextField = u"" NSPREFIX "text_field";
+constexpr OUStringLiteral aOOOElemTextField = NSPREFIX "text_field";
 
 
 // ooo xml attributes for meta_slide
-const char    aOOOAttrSlide[] = NSPREFIX "slide";
-const char    aOOOAttrMaster[] = NSPREFIX "master";
-const char    aOOOAttrHasCustomBackground[] = NSPREFIX "has-custom-background";
-const char    aOOOAttrDisplayName[] = NSPREFIX "display-name";
-const char    aOOOAttrBackgroundVisibility[] = NSPREFIX 
"background-visibility";
-const char    aOOOAttrMasterObjectsVisibility[] = NSPREFIX 
"master-objects-visibility";
-const char    aOOOAttrSlideDuration[] = NSPREFIX "slide-duration";
-const OUString aOOOAttrDateTimeField = NSPREFIX "date-time-field";
-constexpr OUStringLiteral aOOOAttrFooterField = u"" NSPREFIX "footer-field";
-const char    aOOOAttrHasTransition[] = NSPREFIX "has-transition";
+constexpr OUStringLiteral aOOOAttrSlide = NSPREFIX "slide";
+constexpr OUStringLiteral aOOOAttrMaster = NSPREFIX "master";
+constexpr OUStringLiteral aOOOAttrHasCustomBackground = NSPREFIX 
"has-custom-background";
+constexpr OUStringLiteral aOOOAttrDisplayName = NSPREFIX "display-name";
+constexpr OUStringLiteral aOOOAttrBackgroundVisibility = NSPREFIX 
"background-visibility";
+constexpr OUStringLiteral aOOOAttrMasterObjectsVisibility = NSPREFIX 
"master-objects-visibility";
+constexpr OUStringLiteral aOOOAttrSlideDuration = NSPREFIX "slide-duration";
+constexpr OUStringLiteral aOOOAttrDateTimeField = NSPREFIX "date-time-field";
+constexpr OUStringLiteral aOOOAttrFooterField = NSPREFIX "footer-field";
+constexpr OUStringLiteral aOOOAttrHasTransition = NSPREFIX "has-transition";
 
 // ooo xml attributes for pages and shapes
-const char    aOOOAttrName[] = NSPREFIX "name";
+constexpr OUStringLiteral aOOOAttrName = NSPREFIX "name";
 
 constexpr OUStringLiteral constSvgNamespace = u"http://www.w3.org/2000/svg";;
 
@@ -2108,6 +2108,7 @@ bool SVGFilter::implExportShape( const Reference< 
css::drawing::XShape >& rxShap
                 if( rMtf.GetActionSize() )
                 {   // for text field shapes we set up text-adjust attributes
                     // and set visibility to hidden
+                    const OUString aElementId(sPlaceholderTag);
                     const OUString* pElementId = nullptr;
                     if( mbPresentation )
                     {
@@ -2119,7 +2120,7 @@ bool SVGFilter::implExportShape( const Reference< 
css::drawing::XShape >& rxShap
                         {
                             // to notify to the 
SVGActionWriter::ImplWriteActions method
                             // that we are dealing with a placeholder shape
-                            pElementId = &sPlaceholderTag;
+                            pElementId = &aElementId;
 
                             mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, 
"visibility", "hidden" );
                         }
diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
index 4c2f8229922b..1a8796bd9046 100644
--- a/filter/source/svg/svgfilter.hxx
+++ b/filter/source/svg/svgfilter.hxx
@@ -54,9 +54,9 @@ using namespace ::com::sun::star::xml::sax;
 
 
 // Placeholder tag used into the ImplWriteActions method to filter text 
placeholder fields
-const OUString sPlaceholderTag( "<[:isPlaceholder:]>" );
+inline constexpr OUStringLiteral sPlaceholderTag = u"<[:isPlaceholder:]>";
 // This tag is used for exporting a slide background made of tiled bitmaps
-const OString sTiledBackgroundTag( "SLIDE_BACKGROUND" );
+inline constexpr OStringLiteral sTiledBackgroundTag = "SLIDE_BACKGROUND";
 
 class SVGExport : public SvXMLExport
 {

Reply via email to