include/xmloff/xmlstyle.hxx      |    8 ++++----
 xmloff/source/style/prstylei.cxx |    4 +---
 xmloff/source/text/txtstyli.cxx  |    4 ++--
 3 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit a6aa71f6f3357f4fcd06c2307882733606af37ca
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon May 1 18:34:31 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Mon May 1 19:28:23 2023 +0200

    AutoName is only used as Any, no need to extract into intermediate string
    
    Change-Id: I00b0d647946e3943852098ff96cc09b7a2fd49ed
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151233
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/include/xmloff/xmlstyle.hxx b/include/xmloff/xmlstyle.hxx
index 04a74b841a15..7e09259c7443 100644
--- a/include/xmloff/xmlstyle.hxx
+++ b/include/xmloff/xmlstyle.hxx
@@ -41,7 +41,7 @@ class XMLOFF_DLLPUBLIC SvXMLStyleContext : public 
SvXMLImportContext
 {
     OUString     maName;
     OUString     maDisplayName;
-    OUString     maAutoName;
+    css::uno::Any maAutoName;
     OUString     maParentName;// Will be moved to XMLPropStyle soon!!!!
     OUString     maFollow;    // Will be moved to XMLPropStyle soon!!!!
     OUString     maLinked;
@@ -51,7 +51,7 @@ class XMLOFF_DLLPUBLIC SvXMLStyleContext : public 
SvXMLImportContext
 
     bool         mbValid : 1; // Set this to false in CreateAndInsert
                               // if the style shouldn't be processed
-                              // by Finish() or si somehow invalid.
+                              // by Finish() or is somehow invalid.
     bool         mbNew : 1;   // Set this to false in CreateAnsInsert
                               // if the style is already existing.
     bool         mbDefaultStyle : 1;
@@ -61,7 +61,7 @@ protected:
     virtual void SetAttribute( sal_Int32 nElement, const OUString& rValue );
 
     void SetFamily( XmlStyleFamily nSet ) { mnFamily = nSet; }
-    void SetAutoName( const OUString& rName ) { maAutoName = rName; }
+    void SetAutoName( const css::uno::Any& rName ) { maAutoName = rName; }
 
 public:
 
@@ -77,7 +77,7 @@ public:
 
     const OUString&  GetName() const { return maName; }
     const OUString&  GetDisplayName() const { return maDisplayName.getLength() 
? maDisplayName : maName; }
-    const OUString&  GetAutoName() const { return maAutoName; }
+    const css::uno::Any& GetAutoName() const { return maAutoName; }
     const OUString&  GetParentName() const { return maParentName; }
     const OUString&  GetFollow() const { return maFollow; }
     const OUString&  GetLinked() const { return maLinked; }
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
index 3dc8fc7087a3..c688a3a24b31 100644
--- a/xmloff/source/style/prstylei.cxx
+++ b/xmloff/source/style/prstylei.cxx
@@ -341,9 +341,7 @@ void XMLPropStyleContext::CreateAndInsert( bool bOverwrite )
                     Sequence< Any > aAny = xAutoStyle->getPropertyValues( 
aPropNames );
                     if( aAny.hasElements() )
                     {
-                        OUString aName;
-                        aAny[0] >>= aName;
-                        SetAutoName( aName );
+                        SetAutoName(aAny[0]);
                     }
                 }
             }
diff --git a/xmloff/source/text/txtstyli.cxx b/xmloff/source/text/txtstyli.cxx
index 01a0deab4e4b..bd21e35ad6a2 100644
--- a/xmloff/source/text/txtstyli.cxx
+++ b/xmloff/source/text/txtstyli.cxx
@@ -431,7 +431,7 @@ void XMLTextStyleContext::FillPropertySet(
     {
         bAutomatic = true;
 
-        if( !GetAutoName().isEmpty() )
+        if( GetAutoName().hasValue() )
         {
             OUString sAutoProp = ( GetFamily() == XmlStyleFamily::TEXT_TEXT ) ?
                 OUString( "CharAutoStyleName" ):
@@ -446,7 +446,7 @@ void XMLTextStyleContext::FillPropertySet(
 
                 if ( xInfo->hasPropertyByName( sAutoProp ) )
                 {
-                    rPropSet->setPropertyValue( sAutoProp, Any(GetAutoName()) 
);
+                    rPropSet->setPropertyValue( sAutoProp, GetAutoName() );
                 }
                 else
                 {

Reply via email to