[Libreoffice-commits] core.git: sw/inc sw/source

Matteo Casalin matteo.casalin at yahoo.com
Wed Aug 21 03:48:07 PDT 2013


 sw/inc/doc.hxx                     |    2 
 sw/inc/numrule.hxx                 |   30 ++++++------
 sw/source/core/doc/docnum.cxx      |    2 
 sw/source/core/doc/number.cxx      |   91 +++++++++++++++++--------------------
 sw/source/core/text/inftxt.cxx     |    9 ---
 sw/source/core/txtnode/ndtxt.cxx   |   13 +----
 sw/source/core/unocore/unosett.cxx |    4 -
 sw/source/filter/ww8/ww8par.hxx    |    2 
 sw/source/filter/ww8/ww8par3.cxx   |   14 ++---
 sw/source/ui/shells/txtnum.cxx     |    6 +-
 10 files changed, 78 insertions(+), 95 deletions(-)

New commits:
commit 5cd96a57b36d15ab7869a6cbfebad06ce351d8bf
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Tue Aug 20 02:51:38 2013 +0200

    String to OUString
    
    Change-Id: I1117318d9201a8951017ebe835b6c57c6b4ad706
    Reviewed-on: https://gerrit.libreoffice.org/5561
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 24a4216..58bd8aa 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -350,7 +350,7 @@ class SW_DLLPUBLIC SwDoc :
     mutable SwNumRuleTbl    *mpNumRuleTbl;   ///< List of all named NumRules.
 
     /// Hash map to find numrules by name
-    mutable boost::unordered_map<String, SwNumRule *, StringHash> maNumRuleMap;
+    mutable boost::unordered_map<OUString, SwNumRule *, OUStringHash> maNumRuleMap;
 
     typedef boost::unordered_map< String, SwList*, StringHash > tHashMapForLists;
     /// container to hold the lists of the text document
diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index fe25ce8..a01e0b5 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -20,7 +20,7 @@
 #define _NUMRULE_HXX
 
 #include <sal/types.h>
-#include <tools/string.hxx>
+#include <rtl/ustring.hxx>
 #include <editeng/svxenum.hxx>
 #include <editeng/numitem.hxx>
 #include "swdllapi.h"
@@ -75,7 +75,7 @@ public:
     SwCharFmt* GetCharFmt() const { return (SwCharFmt*)GetRegisteredIn(); }
     void SetCharFmt( SwCharFmt* );
 
-    virtual void            SetCharFmtName(const String& rSet);
+    virtual void            SetCharFmtName(const OUString& rSet);
     virtual OUString        GetCharFmtName()const;
 
     //For i120928,access the cp info of graphic within bullet
@@ -126,9 +126,9 @@ private:
     tParagraphStyleList maParagraphStyleList;
 
     /** boost::unordered_map containing "name->rule" relation */
-    boost::unordered_map<String, SwNumRule *, StringHash> * pNumRuleMap;
+    boost::unordered_map<OUString, SwNumRule *, OUStringHash> * pNumRuleMap;
 
-    String sName;
+    OUString sName;
     SwNumRuleType eRuleType;
     sal_uInt16 nPoolFmtId;      ///< Id-for NumRules created "automatically"
     sal_uInt16 nPoolHelpId;     ///< HelpId for this Pool-style.
@@ -141,11 +141,11 @@ private:
     bool mbCountPhantoms;
 
     const SvxNumberFormat::SvxNumPositionAndSpaceMode meDefaultNumberFormatPositionAndSpaceMode;
-    String msDefaultListId;
+    OUString msDefaultListId;
 
 public:
     /// add parameter <eDefaultNumberFormatPositionAndSpaceMode>
-    SwNumRule( const String& rNm,
+    SwNumRule( const OUString& rNm,
                const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode,
                SwNumRuleType = NUM_RULE,
                sal_Bool bAutoFlg = sal_True );
@@ -165,16 +165,16 @@ public:
 
     void Set( sal_uInt16 i, const SwNumFmt* );
     void Set( sal_uInt16 i, const SwNumFmt& );
-    String MakeNumString( const SwNodeNum&, sal_Bool bInclStrings = sal_True,
+    OUString MakeNumString( const SwNodeNum&, sal_Bool bInclStrings = sal_True,
                             sal_Bool bOnlyArabic = sal_False ) const;
     /** - add optional parameter <_nRestrictToThisLevel> in order to
          restrict returned string to this level. */
-    String MakeNumString( const SwNumberTree::tNumberVector & rNumVector,
+    OUString MakeNumString( const SwNumberTree::tNumberVector & rNumVector,
                           const sal_Bool bInclStrings = sal_True,
                           const sal_Bool bOnlyArabic = sal_False,
                           const unsigned int _nRestrictToThisLevel = MAXLEVEL,
                           Extremities* pExtremities = 0 ) const;
-    String MakeRefNumString( const SwNodeNum& rNodeNum,
+    OUString MakeRefNumString( const SwNodeNum& rNodeNum,
                              const bool bInclSuperiorNumLabels = false,
                              const sal_uInt8 nRestrictInclToThisLevel = 0 ) const;
 
@@ -192,11 +192,11 @@ public:
     void AddParagraphStyle( SwTxtFmtColl& rTxtFmtColl );
     void RemoveParagraphStyle( SwTxtFmtColl& rTxtFmtColl );
 
-    inline void SetDefaultListId( const String sDefaultListId )
+    inline void SetDefaultListId( const OUString sDefaultListId )
     {
         msDefaultListId = sDefaultListId;
     }
-    inline String GetDefaultListId() const
+    inline OUString GetDefaultListId() const
     {
         return msDefaultListId;
     }
@@ -206,7 +206,7 @@ public:
        @param pNumRuleMap      map to register in
      */
     void SetNumRuleMap(
-                boost::unordered_map<String, SwNumRule *, StringHash>* pNumRuleMap );
+                boost::unordered_map<OUString, SwNumRule *, OUStringHash>* pNumRuleMap );
 
     static char* GetOutlineRuleName() { return pDefOutlineName; }
 
@@ -226,9 +226,9 @@ public:
        and copies them if appropriate. */
     void CheckCharFmts( SwDoc* pDoc );
 
-    const String& GetName() const       { return sName; }
+    OUString GetName() const { return sName; }
 
-    void SetName( const String& rNm,
+    void SetName( const OUString& rNm,
                   IDocumentListsAccess& rDocListAccess );
 
     sal_Bool IsAutoRule() const             { return bAutoRuleFlag; }
@@ -280,7 +280,7 @@ namespace numfunc
 
         @author OD
     */
-    const String& GetDefBulletFontname();
+    OUString GetDefBulletFontname();
 
     /** determine if default bullet font is user defined
 
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index a7872ac..97e08fa 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1065,7 +1065,7 @@ bool SwDoc::DelNumRule( const String& rName, bool bBroadcast )
 
 void SwDoc::ChgNumRuleFmts( const SwNumRule& rRule, const String * pName )
 {
-    SwNumRule* pRule = FindNumRulePtr( pName ? *pName : rRule.GetName() );
+    SwNumRule* pRule = FindNumRulePtr( pName ? *pName : String(rRule.GetName()) );
     if( pRule )
     {
         SwUndoInsNum* pUndo = 0;
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 10fc1ee..346f6f8 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -92,7 +92,7 @@ const SwNumFmt* SwNumRule::GetNumFmt( sal_uInt16 i ) const
 }
 
 // #i91400#
-void SwNumRule::SetName( const String & rName,
+void SwNumRule::SetName( const OUString & rName,
                          IDocumentListsAccess& rDocListAccess)
 {
     if ( sName != rName )
@@ -102,7 +102,7 @@ void SwNumRule::SetName( const String & rName,
             pNumRuleMap->erase(sName);
             (*pNumRuleMap)[rName] = this;
 
-            if ( GetDefaultListId().Len() > 0 )
+            if ( !GetDefaultListId().isEmpty() )
             {
                 rDocListAccess.trackChangeOfListStyleName( sName, rName );
             }
@@ -144,7 +144,7 @@ void SwNumRule::RemoveTxtNode( SwTxtNode& rTxtNode )
     }
 }
 
-void SwNumRule::SetNumRuleMap(boost::unordered_map<String, SwNumRule *, StringHash> *
+void SwNumRule::SetNumRuleMap(boost::unordered_map<OUString, SwNumRule *, OUStringHash> *
                               _pNumRuleMap)
 {
     pNumRuleMap = _pNumRuleMap;
@@ -194,8 +194,8 @@ SwNumFmt::SwNumFmt(const SvxNumberFormat& rNumFmt, SwDoc* pDoc) :
     sal_Int16 eMyVertOrient = rNumFmt.GetVertOrient();
     SetGraphicBrush( rNumFmt.GetBrush(), &rNumFmt.GetGraphicSize(),
                                                 &eMyVertOrient);
-    const String& rCharStyleName = rNumFmt.SvxNumberFormat::GetCharFmtName();
-    if( rCharStyleName.Len() )
+    const OUString rCharStyleName = rNumFmt.SvxNumberFormat::GetCharFmtName();
+    if( !rCharStyleName.isEmpty() )
     {
         SwCharFmt* pCFmt = pDoc->FindCharFmtByName( rCharStyleName );
         if( !pCFmt )
@@ -300,7 +300,7 @@ void SwNumFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
         CheckRegistration( pOld, pNew );
 }
 
-void SwNumFmt::SetCharFmtName(const String& rSet)
+void SwNumFmt::SetCharFmtName(const OUString& rSet)
 {
     SvxNumberFormat::SetCharFmtName(rSet);
 }
@@ -370,7 +370,7 @@ const SwFmtVertOrient*      SwNumFmt::GetGraphicOrientation() const
     }
 }
 
-SwNumRule::SwNumRule( const String& rNm,
+SwNumRule::SwNumRule( const OUString& rNm,
                       const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode,
                       SwNumRuleType eType,
                       sal_Bool bAutoFlg )
@@ -469,7 +469,7 @@ SwNumRule::SwNumRule( const String& rNm,
         }
     }
     memset( aFmts, 0, sizeof( aFmts ));
-    OSL_ENSURE( sName.Len(), "NumRule without a name!" );
+    OSL_ENSURE( !sName.isEmpty(), "NumRule without a name!" );
 }
 
 SwNumRule::SwNumRule( const SwNumRule& rNumRule )
@@ -623,25 +623,23 @@ void SwNumRule::Set( sal_uInt16 i, const SwNumFmt* pNumFmt )
         *pOld = *pNumFmt, bInvalidRuleFlag = sal_True;
 }
 
-String SwNumRule::MakeNumString( const SwNodeNum& rNum, sal_Bool bInclStrings,
+OUString SwNumRule::MakeNumString( const SwNodeNum& rNum, sal_Bool bInclStrings,
                                 sal_Bool bOnlyArabic ) const
 {
-    String aStr;
-
     if (rNum.IsCounted())
-        aStr = MakeNumString(rNum.GetNumberVector(),
+        return MakeNumString(rNum.GetNumberVector(),
                              bInclStrings, bOnlyArabic, MAXLEVEL);
 
-    return aStr;
+    return OUString();
 }
 
-String SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVector,
+OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVector,
                                  const sal_Bool bInclStrings,
                                  const sal_Bool bOnlyArabic,
                                  const unsigned int _nRestrictToThisLevel,
                                  SwNumRule::Extremities* pExtremities ) const
 {
-    String aStr;
+    OUString aStr;
 
     unsigned int nLevel = rNumVector.size() - 1;
 
@@ -694,8 +692,8 @@ String SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVector,
                         aStr += rNFmt.GetNumStr( rNumVector[ i ] );
                 }
                 else
-                    aStr += '0';        // all 0 level are a 0
-                if( i != nLevel && aStr.Len() )
+                    aStr += "0";        // all 0 level are a 0
+                if( i != nLevel && !aStr.isEmpty() )
                     aStr += aDotStr;
             }
 
@@ -705,15 +703,14 @@ String SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVector,
                 SVX_NUM_CHAR_SPECIAL != rMyNFmt.GetNumberingType() &&
                 SVX_NUM_BITMAP != rMyNFmt.GetNumberingType() )
             {
-                String const &rPrefix = rMyNFmt.GetPrefix();
-                String const &rSuffix = rMyNFmt.GetSuffix();
+                const OUString sPrefix = rMyNFmt.GetPrefix();
+                const OUString sSuffix = rMyNFmt.GetSuffix();
 
-                aStr.Insert( rPrefix, 0 );
-                aStr += rSuffix;
+                aStr = sPrefix + aStr + sSuffix;
                 if ( pExtremities )
                 {
-                    pExtremities->nPrefixChars = rPrefix.Len();
-                    pExtremities->nSuffixChars = rSuffix.Len();
+                    pExtremities->nPrefixChars = sPrefix.getLength();
+                    pExtremities->nSuffixChars = sSuffix.getLength();
                 }
             }
         }
@@ -722,11 +719,11 @@ String SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVector,
     return aStr;
 }
 
-String SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum,
+OUString SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum,
                                     const bool bInclSuperiorNumLabels,
                                     const sal_uInt8 nRestrictInclToThisLevel ) const
 {
-    String aRefNumStr;
+    OUString aRefNumStr;
 
     if ( rNodeNum.GetLevelInListTree() >= 0 )
     {
@@ -751,23 +748,21 @@ String SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum,
                    pWorkingNodeNum->GetTxtNode()->HasNumber() ) )
             {
                 Extremities aExtremities;
-                String aPrevStr = MakeNumString( pWorkingNodeNum->GetNumberVector(),
+                OUString aPrevStr = MakeNumString( pWorkingNodeNum->GetNumberVector(),
                                                  sal_True, sal_False, MAXLEVEL,
                                                  &aExtremities);
-                int        nStrip = 0;
-                sal_Unicode        c;
-
-
-                while ( nStrip < aExtremities.nPrefixChars &&
-                       ( '\t' == ( c = aPrevStr.GetChar( nStrip ) ) ||
-                         ' ' == c) )
+                sal_Int32 nStrip = 0;
+                while ( nStrip < aExtremities.nPrefixChars )
                 {
-                        ++nStrip;
+                    const sal_Unicode c = aPrevStr[nStrip];
+                    if ( c!='\t' && c!=' ')
+                        break;
+                    ++nStrip;
                 }
 
                 if (nStrip)
                 {
-                    aPrevStr.Erase( 0, nStrip );
+                    aPrevStr = aPrevStr.copy( nStrip );
                     aExtremities.nPrefixChars -= nStrip;
                 }
 
@@ -776,32 +771,32 @@ String SwNumRule::MakeRefNumString( const SwNodeNum& rNodeNum,
                      !aExtremities.nPrefixChars
                    )
                 {
-                    int nStrip2 = aPrevStr.Len();
-                    while (aPrevStr.Len() - nStrip2 < aExtremities.nSuffixChars)
+                    nStrip = aPrevStr.getLength();
+                    while (aPrevStr.getLength() - nStrip < aExtremities.nSuffixChars)
                     {
-                        char const cur = aPrevStr.GetChar(nStrip2);
+                        const sal_Unicode cur = aPrevStr[nStrip];
                         if  (!bFirstIteration && '\t' != cur && ' ' != cur)
                         {
                             break;
                         }
-                        --nStrip2;
+                        --nStrip;
                     }
-                    if (nStrip2 < aPrevStr.Len())
+                    if (nStrip < aPrevStr.getLength())
                     {
-                        aPrevStr.Erase(nStrip2, aPrevStr.Len() - nStrip2);
+                        aPrevStr = aPrevStr.copy(0, nStrip);
                     }
                 }
-                else if (sOldPrefix.getLength())
+                else if (!sOldPrefix.isEmpty())
                 {
-                    aRefNumStr.Insert(sOldPrefix, 0);
+                    aRefNumStr = sOldPrefix + aRefNumStr;
                 }
                 sOldPrefix = OUString();
 
                 bOldHadPrefix = ( aExtremities.nPrefixChars >  0);
 
-                aRefNumStr.Insert( aPrevStr, 0 );
+                aRefNumStr = aPrevStr + aRefNumStr;
             }
-            else if ( aRefNumStr.Len() > 0 )
+            else if ( !aRefNumStr.isEmpty() )
             {
                 sOldPrefix += " ";
                 bOldHadPrefix = true;
@@ -1068,7 +1063,7 @@ namespace numfunc
         public:
             static SwDefBulletConfig& getInstance();
 
-            inline const String& GetFontname() const
+            inline OUString GetFontname() const
             {
                 return msFontname;
             }
@@ -1115,7 +1110,7 @@ namespace numfunc
             virtual void Commit();
 
             // default bullet list configuration data
-            String msFontname;
+            OUString msFontname;
             bool mbUserDefinedFontname;
             FontWeight meFontWeight;
             FontItalic meFontItalic;
@@ -1277,7 +1272,7 @@ namespace numfunc
     {
     }
 
-    const String& GetDefBulletFontname()
+    OUString GetDefBulletFontname()
     {
         return SwDefBulletConfig::getInstance().GetFontname();
     }
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index aff0ec9..cae5afc1 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -63,6 +63,7 @@
 #include <doc.hxx>
 #include <pam.hxx>
 #include <SwGrammarMarkUp.hxx>
+#include "numrule.hxx"
 #include <cstdio>
 // #i12836# enhanced pdf export
 #include <EnhancedPDFExportHelper.hxx>
@@ -92,14 +93,6 @@ using namespace ::com::sun::star::beans;
 #define DRAW_SPECIAL_OPTIONS_CENTER 1
 #define DRAW_SPECIAL_OPTIONS_ROTATE 2
 
-// variable moved to class <numfunc:GetDefBulletConfig>
-//extern const sal_Char sBulletFntName[];
-namespace numfunc
-{
-    extern const String& GetDefBulletFontname();
-    extern bool IsDefBulletFontUserDefined();
-}
-
 #ifdef DBG_UTIL
 sal_Bool SwTxtSizeInfo::IsOptDbg() const { return GetOpt().IsTest4(); }
 #endif
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 33952c0..9cfe807 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3870,8 +3870,6 @@ bool SwTxtNode::IsListRestart() const
  */
 bool SwTxtNode::HasVisibleNumberingOrBullet() const
 {
-    bool bRet = false;
-
     const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0L;
     if ( pRule && IsCountedInList())
     {
@@ -3879,14 +3877,11 @@ bool SwTxtNode::HasVisibleNumberingOrBullet() const
         // Correction of #newlistlevelattrs#:
         // The numbering type has to be checked for bullet lists.
         const SwNumFmt& rFmt = pRule->Get( static_cast<sal_uInt16>(GetActualListLevel() ));
-        if ( SVX_NUM_NUMBER_NONE != rFmt.GetNumberingType() ||
-             pRule->MakeNumString( *(GetNum()) ).Len() > 0 )
-        {
-            bRet = true;
-        }
+        return SVX_NUM_NUMBER_NONE != rFmt.GetNumberingType() ||
+               !pRule->MakeNumString( *(GetNum()) ).isEmpty();
     }
 
-    return bRet;
+    return false;
 }
 
 void SwTxtNode::SetAttrListRestartValue( SwNumberTree::tSwNumTreeNumber nNumber )
@@ -4835,7 +4830,7 @@ namespace {
                 // If paragraph has no list level attribute set and list style
                 // is the outline style, apply outline level as the list level.
                 if ( !mrTxtNode.HasAttrListLevel() &&
-                     mrTxtNode.GetNumRule()->GetName().EqualsAscii(
+                     mrTxtNode.GetNumRule()->GetName().equalsAscii(
                         SwNumRule::GetOutlineRuleName()) &&
                      mrTxtNode.GetTxtColl()->IsAssignedToListLevelOfOutlineStyle() )
                 {
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 8b06232..4a474e4 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -2255,9 +2255,9 @@ Any SwXNumberingRules::getPropertyValue( const OUString& rPropertyName )
     }
     else if(rPropertyName.equalsAsciiL( SW_PROP_NAME(UNO_NAME_DEFAULT_LIST_ID)))
     {
-        OSL_ENSURE( pRule->GetDefaultListId().Len() != 0,
+        OSL_ENSURE( !pRule->GetDefaultListId().isEmpty(),
                 "<SwXNumberingRules::getPropertyValue(..)> - no default list id found. Serious defect -> please inform OD." );
-        aRet <<= OUString(pRule->GetDefaultListId());
+        aRet <<= pRule->GetDefaultListId();
     }
     else
         throw UnknownPropertyException();
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index ee770c0..825ab3f 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -185,7 +185,7 @@ private:
 
     void AdjustLVL(sal_uInt8 nLevel, SwNumRule& rNumRule, WW8aISet& rListItemSet,
         WW8aCFmt& aCharFmt, bool& bNewCharFmtCreated,
-        String aPrefix = aEmptyStr);
+        OUString aPrefix = OUString());
 
     //No copying
     WW8ListManager(const WW8ListManager&);
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 9086aed..068bca9 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -959,7 +959,7 @@ bool WW8ListManager::ReadLVL(SwNumFmt& rNumFmt, SfxItemSet*& rpItemSet,
 
 void WW8ListManager::AdjustLVL( sal_uInt8 nLevel, SwNumRule& rNumRule,
     WW8aISet& rListItemSet, WW8aCFmt& rCharFmt, bool& bNewCharFmtCreated,
-    String sPrefix )
+    OUString sPrefix )
 {
     bNewCharFmtCreated = false;
     SfxItemSet* pThisLevelItemSet;
@@ -1010,8 +1010,8 @@ void WW8ListManager::AdjustLVL( sal_uInt8 nLevel, SwNumRule& rNumRule,
         if (nMaxLevel == nIdenticalItemSetLevel)
         {
             // Style definieren
-            String aName( sPrefix.Len() ? sPrefix : rNumRule.GetName() );
-            (aName += 'z') += OUString::number( nLevel );
+            const OUString aName( (!sPrefix.isEmpty() ? sPrefix : rNumRule.GetName())
+                                  + "z" + OUString::number( nLevel ) );
 
             // const Wegcasten
             pFmt = rDoc.MakeCharFmt(aName, (SwCharFmt*)rDoc.GetDfltCharFmt());
@@ -1039,11 +1039,11 @@ void WW8ListManager::AdjustLVL( sal_uInt8 nLevel, SwNumRule& rNumRule,
         SwCharFmt* pFmt = aNumFmt.GetCharFmt();
         if ( !pFmt)
         {
-            OUString aName = ( sPrefix.Len() ? sPrefix : rNumRule.GetName() );
-                     aName += "z" + OUString::number( nLevel );
+            const OUString aName( (!sPrefix.isEmpty() ? sPrefix : rNumRule.GetName())
+                                  + "z" + OUString::number( nLevel ) );
 
-                    pFmt = rDoc.MakeCharFmt(aName, (SwCharFmt*)rDoc.GetDfltCharFmt());
-                    bNewCharFmtCreated = true;
+            pFmt = rDoc.MakeCharFmt(aName, (SwCharFmt*)rDoc.GetDfltCharFmt());
+            bNewCharFmtCreated = true;
             rCharFmt[ nLevel ] = pFmt;
             aNumFmt.SetCharFmt( pFmt );
         }
diff --git a/sw/source/ui/shells/txtnum.cxx b/sw/source/ui/shells/txtnum.cxx
index 62e36f0..f55e3f2 100644
--- a/sw/source/ui/shells/txtnum.cxx
+++ b/sw/source/ui/shells/txtnum.cxx
@@ -201,7 +201,7 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq)
                 pSetRule->UnLinkGraphics();
                 SwNumRule aSetRule( pCurRule
                                         ? pCurRule->GetName()
-                                        : String(GetShell().GetUniqueNumRuleName()),
+                                        : GetShell().GetUniqueNumRuleName(),
                                     // #i89178#
                                     numfunc::GetDefaultPositionAndSpaceMode() );
                 aSetRule.SetSvxRule( *pSetRule, GetShell().GetDoc());
@@ -343,7 +343,7 @@ void SwTextShell::ExecSetNumber(SfxRequest &rReq)
                     aSvxRule.UnLinkGraphics();
                     SwNumRule aSetRule( pCurRule
                                             ? pCurRule->GetName()
-                                            : String(GetShell().GetUniqueNumRuleName()),
+                                            : GetShell().GetUniqueNumRuleName(),
                                         numfunc::GetDefaultPositionAndSpaceMode() );
                     aSetRule.SetSvxRule( aSvxRule, GetShell().GetDoc());
 
@@ -397,7 +397,7 @@ void SwTextShell::ExecSetNumber(SfxRequest &rReq)
 
                     SwNumRule aSetRule( pCurRule
                                             ? pCurRule->GetName()
-                                            : String(GetShell().GetUniqueNumRuleName()),
+                                            : GetShell().GetUniqueNumRuleName(),
                                         numfunc::GetDefaultPositionAndSpaceMode() );
 
                     aSetRule.SetSvxRule( aSvxRule, GetShell().GetDoc());


More information about the Libreoffice-commits mailing list