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

Matteo Casalin matteo.casalin at yahoo.com
Sat Aug 17 16:41:26 PDT 2013


 sw/inc/fmtruby.hxx                 |   19 +++++++++----------
 sw/source/core/doc/docruby.cxx     |    4 ++--
 sw/source/core/txtnode/fmtatr2.cxx |    2 +-
 sw/source/core/txtnode/txtatr2.cxx |   16 ++++++++--------
 4 files changed, 20 insertions(+), 21 deletions(-)

New commits:
commit 70ef99c447fcdb73ecadb8b3afd251ef8021a6cc
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 18 01:36:45 2013 +0200

    String to OUString, mark as const
    
    Change-Id: Id5ab789b3518a23ccef6f3a13f852c478a129089

diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index e5464dc..659a756 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -139,9 +139,9 @@ SwCharFmt* SwTxtINetFmt::GetCharFmt()
             SetVisitedValid( true );
         }
         sal_uInt16 nId;
-        const String& rStr = IsVisited() ? rFmt.GetVisitedFmt()
+        const OUString rStr = IsVisited() ? rFmt.GetVisitedFmt()
                                            : rFmt.GetINetFmt();
-        if( rStr.Len() )
+        if( !rStr.isEmpty() )
             nId = IsVisited() ? rFmt.GetVisitedFmtId() : rFmt.GetINetFmtId();
         else
             nId = static_cast<sal_uInt16>(IsVisited() ? RES_POOLCHR_INET_VISIT : RES_POOLCHR_INET_NORMAL);
@@ -258,14 +258,14 @@ SwCharFmt* SwTxtRuby::GetCharFmt()
     if( !rFmt.GetText().isEmpty() )
     {
         const SwDoc* pDoc = GetTxtNode().GetDoc();
-        const String& rStr = rFmt.GetCharFmtName();
-        sal_uInt16 nId = RES_POOLCHR_RUBYTEXT;
-        if ( rStr.Len() )
-            nId = rFmt.GetCharFmtId();
+        const OUString rStr = rFmt.GetCharFmtName();
+        const sal_uInt16 nId = rStr.isEmpty()
+                             ? static_cast<sal_uInt16>(RES_POOLCHR_RUBYTEXT)
+                             : rFmt.GetCharFmtId();
 
         // JP 10.02.2000, Bug 72806: dont modify the doc for getting the
         //              correct charstyle.
-        bool bResetMod = !pDoc->IsModified();
+        const bool bResetMod = !pDoc->IsModified();
         Link aOle2Lnk;
         if( bResetMod )
         {
commit 9eea0332e091ebd49b25c1289fbb3572b3f4bc2c
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 18 01:22:41 2013 +0200

    String to OUString
    
    Change-Id: I5dbb39e429ee35c47b492dc29bf172879bc32b1e

diff --git a/sw/inc/fmtruby.hxx b/sw/inc/fmtruby.hxx
index ed8edfe..1371cd9 100644
--- a/sw/inc/fmtruby.hxx
+++ b/sw/inc/fmtruby.hxx
@@ -16,11 +16,10 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#ifndef _FMTRUBY_HXX
-#define _FMTRUBY_HXX
+#ifndef FMTRUBY_HXX
+#define FMTRUBY_HXX
 
 
-#include <tools/string.hxx>
 #include <svl/poolitem.hxx>
 
 class SwTxtRuby;
@@ -29,15 +28,15 @@ class SW_DLLPUBLIC SwFmtRuby : public SfxPoolItem
 {
     friend class SwTxtRuby;
 
-    String sRubyTxt;                        ///< The ruby txt.
-    String sCharFmtName;                    ///< Name of the charformat.
+    OUString sRubyTxt;                      ///< The ruby txt.
+    OUString sCharFmtName;                  ///< Name of the charformat.
     SwTxtRuby* pTxtAttr;                    ///< The TextAttribute.
     sal_uInt16 nCharFmtId;                  ///< PoolId of the charformat.
     sal_uInt16 nPosition;                   ///< Position of the Ruby-character.
     sal_uInt16 nAdjustment;                 ///< Specific adjustment of the Ruby-ch.
 
 public:
-    SwFmtRuby( const String& rRubyTxt );
+    SwFmtRuby( const OUString& rRubyTxt );
     SwFmtRuby( const SwFmtRuby& rAttr );
     virtual ~SwFmtRuby();
 
@@ -62,11 +61,11 @@ public:
     const SwTxtRuby* GetTxtRuby() const         { return pTxtAttr; }
     SwTxtRuby* GetTxtRuby()                     { return pTxtAttr; }
 
-    const String& GetText() const               { return sRubyTxt; }
-    void SetText( const String& rTxt )          { sRubyTxt = rTxt; }
+    OUString GetText() const                    { return sRubyTxt; }
+    void SetText( const OUString& rTxt )        { sRubyTxt = rTxt; }
 
-    const String& GetCharFmtName() const        { return sCharFmtName; }
-    void SetCharFmtName( const String& rNm )    { sCharFmtName = rNm; }
+    OUString GetCharFmtName() const             { return sCharFmtName; }
+    void SetCharFmtName( const OUString& rNm )  { sCharFmtName = rNm; }
 
     sal_uInt16 GetCharFmtId() const                 { return nCharFmtId; }
     void SetCharFmtId( sal_uInt16 nNew )            { nCharFmtId = nNew; }
diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx
index 138645c..1760bf5 100644
--- a/sw/source/core/doc/docruby.cxx
+++ b/sw/source/core/doc/docruby.cxx
@@ -124,7 +124,7 @@ sal_uInt16 SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
                     if( aCheckEntry.GetRubyAttr() != pEntry->GetRubyAttr() )
                     {
                         // set/reset the attribut
-                        if( pEntry->GetRubyAttr().GetText().Len() )
+                        if( !pEntry->GetRubyAttr().GetText().isEmpty() )
                         {
                             InsertPoolItem( aPam, pEntry->GetRubyAttr(), 0 );
                         }
@@ -155,7 +155,7 @@ sal_uInt16 SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
                         const SwRubyListEntry* pEntry = &rList[ nListEntry++ ];
 
                         // set/reset the attribut
-                        if( pEntry->GetRubyAttr().GetText().Len() &&
+                        if( !pEntry->GetRubyAttr().GetText().isEmpty() &&
                             pEntry->GetText().Len() )
                         {
                             InsertString( aPam, pEntry->GetText() );
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index b2fa6d1..841ac42 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -421,7 +421,7 @@ bool SwFmtINetFmt::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId  )
 |*    class SwFmtRuby
 *************************************************************************/
 
-SwFmtRuby::SwFmtRuby( const String& rRubyTxt )
+SwFmtRuby::SwFmtRuby( const OUString& rRubyTxt )
     : SfxPoolItem( RES_TXTATR_CJK_RUBY ),
     sRubyTxt( rRubyTxt ),
     pTxtAttr( 0 ),
diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index 351fdee..e5464dc 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -255,7 +255,7 @@ SwCharFmt* SwTxtRuby::GetCharFmt()
     const SwFmtRuby& rFmt = SwTxtAttrEnd::GetRuby();
     SwCharFmt* pRet = 0;
 
-    if( rFmt.GetText().Len() )
+    if( !rFmt.GetText().isEmpty() )
     {
         const SwDoc* pDoc = GetTxtNode().GetDoc();
         const String& rStr = rFmt.GetCharFmtName();


More information about the Libreoffice-commits mailing list