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

Matteo Casalin matteo.casalin at yahoo.com
Wed Aug 21 04:44:14 PDT 2013


 sw/inc/numrule.hxx               |    3 +--
 sw/source/core/doc/docnew.cxx    |    4 ++--
 sw/source/core/doc/docnum.cxx    |    4 +---
 sw/source/core/doc/number.cxx    |    8 +++++---
 sw/source/core/txtnode/ndtxt.cxx |    5 ++---
 5 files changed, 11 insertions(+), 13 deletions(-)

New commits:
commit 64b315df9b7f90621db92062c6ce62f487325388
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Aug 21 08:58:16 2013 +0200

    GetOutlineRuleName: return OUString instead of char*
    
    Change-Id: I79cd722aa2d3bb0292f9b0f7fb6989e2e17d0ff0
    Reviewed-on: https://gerrit.libreoffice.org/5563
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx
index a01e0b5..850d412 100644
--- a/sw/inc/numrule.hxx
+++ b/sw/inc/numrule.hxx
@@ -115,7 +115,6 @@ private:
     /// default list level properties for position-and-space mode LABEL_ALIGNMENT
     static SwNumFmt* aLabelAlignmentBaseFmts [ RULE_END ][ MAXLEVEL ];
     static sal_uInt16 nRefCount;
-    static char* pDefOutlineName;
 
     SwNumFmt* aFmts[ MAXLEVEL ];
 
@@ -208,7 +207,7 @@ public:
     void SetNumRuleMap(
                 boost::unordered_map<OUString, SwNumRule *, OUStringHash>* pNumRuleMap );
 
-    static char* GetOutlineRuleName() { return pDefOutlineName; }
+    static OUString GetOutlineRuleName();
 
     static sal_uInt16 GetNumIndent( sal_uInt8 nLvl );
     static sal_uInt16 GetBullIndent( sal_uInt8 nLvl );
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 5d81fd1..7c3b3c8 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -370,7 +370,7 @@ SwDoc::SwDoc()
     _InitFieldTypes();
 
     // Create a default OutlineNumRule (for Filters)
-    mpOutlineRule = new SwNumRule( OUString::createFromAscii( SwNumRule::GetOutlineRuleName() ),
+    mpOutlineRule = new SwNumRule( SwNumRule::GetOutlineRuleName(),
                                   // #i89178#
                                   numfunc::GetDefaultPositionAndSpaceMode(),
                                   OUTLINE_RULE );
@@ -843,7 +843,7 @@ void SwDoc::ClearDoc()
     maListStyleLists.clear();
 
     // creation of new outline numbering rule
-    mpOutlineRule = new SwNumRule( OUString::createFromAscii( SwNumRule::GetOutlineRuleName() ),
+    mpOutlineRule = new SwNumRule( SwNumRule::GetOutlineRuleName(),
                                   // #i89178#
                                   numfunc::GetDefaultPositionAndSpaceMode(),
                                   OUTLINE_RULE );
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 97e08fa..dca7753 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -104,9 +104,7 @@ void SwDoc::SetOutlineNumRule( const SwNumRule& rRule )
     }
 
     mpOutlineRule->SetRuleType( OUTLINE_RULE );
-    mpOutlineRule->SetName( OUString::createFromAscii(
-                                        SwNumRule::GetOutlineRuleName() ),
-                           *this);
+    mpOutlineRule->SetName(SwNumRule::GetOutlineRuleName(), *this);
 
     // assure that the outline numbering rule is an automatic rule
     mpOutlineRule->SetAutoRule( sal_True );
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index 9f1fc86..aa9b425 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -59,15 +59,17 @@ SwNumFmt* SwNumRule::aBaseFmts[ RULE_END ][ MAXLEVEL ] = {
 SwNumFmt* SwNumRule::aLabelAlignmentBaseFmts[ RULE_END ][ MAXLEVEL ] = {
     {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
 
-char sOutline[] = "Outline";
-char* SwNumRule::pDefOutlineName = sOutline;
-
 const sal_uInt16 SwNumRule::aDefNumIndents[ MAXLEVEL ] = {
 //inch:   0,5  1,0  1,5  2,0   2,5   3,0   3,5   4,0   4,5   5,0
         1440/4, 1440/2, 1440*3/4, 1440, 1440*5/4, 1440*3/2, 1440*7/4, 1440*2,
         1440*9/4, 1440*5/2
 };
 
+OUString SwNumRule::GetOutlineRuleName()
+{
+    return OUString("Outline");
+}
+
 const SwNumFmt& SwNumRule::Get( sal_uInt16 i ) const
 {
     OSL_ASSERT( i < MAXLEVEL && eRuleType < RULE_END );
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 9cfe807..d0cd25a 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3599,7 +3599,7 @@ namespace {
                     rTxtNode.RemoveFromList();
                     // If new list style is the outline style, apply outline
                     // level as the list level.
-                    if (sNumRule.equalsAscii(SwNumRule::GetOutlineRuleName()))
+                    if (sNumRule==SwNumRule::GetOutlineRuleName())
                     {
                         // #i70748#
                         OSL_ENSURE( rTxtNode.GetTxtColl()->IsAssignedToListLevelOfOutlineStyle(),
@@ -4830,8 +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(
-                        SwNumRule::GetOutlineRuleName()) &&
+                     mrTxtNode.GetNumRule()->GetName()==SwNumRule::GetOutlineRuleName() &&
                      mrTxtNode.GetTxtColl()->IsAssignedToListLevelOfOutlineStyle() )
                 {
                     int nNewListLevel = mrTxtNode.GetTxtColl()->GetAssignedOutlineStyleLevel();


More information about the Libreoffice-commits mailing list