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

Matteo Casalin matteo.casalin at yahoo.com
Sat Aug 17 06:02:12 PDT 2013


 sw/inc/redline.hxx              |    2 +-
 sw/inc/swmodule.hxx             |   15 +++++++--------
 sw/source/core/doc/docredln.cxx |    4 ++--
 sw/source/ui/app/swmodul1.cxx   |   18 +++++++++++-------
 sw/source/ui/app/swmodule.cxx   |    2 +-
 5 files changed, 22 insertions(+), 19 deletions(-)

New commits:
commit 4cf1c9058610b10a8081b10342653ae08a9181a3
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Fri Aug 16 23:17:31 2013 +0200

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

diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index 2c54a2e..e6d0d99 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -215,7 +215,7 @@ public:
 
     sal_uInt16 GetStackCount() const;
     sal_uInt16 GetAuthor( sal_uInt16 nPos = 0) const;
-    const String& GetAuthorString( sal_uInt16 nPos = 0 ) const;
+    OUString GetAuthorString( sal_uInt16 nPos = 0 ) const;
     const DateTime& GetTimeStamp( sal_uInt16 nPos = 0) const;
     RedlineType_t GetRealType( sal_uInt16 nPos = 0 ) const;
     RedlineType_t GetType( sal_uInt16 nPos = 0) const
diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx
index f9f043e..41e9cd9 100644
--- a/sw/inc/swmodule.hxx
+++ b/sw/inc/swmodule.hxx
@@ -16,9 +16,8 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#ifndef _SWMODULE_HXX
-#define _SWMODULE_HXX
-#include <tools/string.hxx>
+#ifndef SWMODULE_HXX
+#define SWMODULE_HXX
 #include <tools/fldunit.hxx>
 #include <svl/lstner.hxx>
 #include <unotools/options.hxx>
@@ -66,7 +65,7 @@ namespace com{ namespace sun{ namespace star{ namespace scanner{
 
 class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::ConfigurationListener
 {
-    String              sActAuthor;
+    OUString            sActAuthor;
 
     // ConfigItems
     SwModuleOptions*    pModuleConfig;
@@ -95,7 +94,7 @@ class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::C
     SwView*             pView;
 
     // List of all Redline-authors.
-    std::vector<String>*      pAuthorNames;
+    std::vector<OUString>* pAuthorNames;
 
     // DictionaryList listener to trigger spellchecking or hyphenation
     ::com::sun::star::uno::Reference<
@@ -186,9 +185,9 @@ public:
 
     // Redlining.
     sal_uInt16          GetRedlineAuthor();
-    const String&       GetRedlineAuthor(sal_uInt16 nPos);
-    sal_uInt16          InsertRedlineAuthor(const String& rAuthor);
-    void                SetRedlineAuthor(const String& rAuthor); // for unit tests
+    OUString            GetRedlineAuthor(sal_uInt16 nPos);
+    sal_uInt16          InsertRedlineAuthor(const OUString& rAuthor);
+    void                SetRedlineAuthor(const OUString& rAuthor); // for unit tests
 
     void                GetInsertAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
     void                GetDeletedAuthorAttr(sal_uInt16 nAuthor, SfxItemSet &rSet);
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 29209b7..0acb592 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -291,7 +291,7 @@ bool SwDoc::AppendRedline( SwRedline* pNewRedl, bool bCallDelete )
     _CHECK_REDLINE( this )
 
     if( IsRedlineOn() && !IsShowOriginal( meRedlineMode ) &&
-         pNewRedl->GetAuthorString().Len() )
+        !pNewRedl->GetAuthorString().isEmpty() )
     {
         pNewRedl->InvalidateRange();
 
@@ -3711,7 +3711,7 @@ sal_uInt16 SwRedline::GetAuthor( sal_uInt16 nPos ) const
     return GetRedlineData(nPos).nAuthor;
 }
 
-const String& SwRedline::GetAuthorString( sal_uInt16 nPos ) const
+OUString SwRedline::GetAuthorString( sal_uInt16 nPos ) const
 {
     return SW_MOD()->GetRedlineAuthor(GetRedlineData(nPos).nAuthor);
 }
diff --git a/sw/source/ui/app/swmodul1.cxx b/sw/source/ui/app/swmodul1.cxx
index cad791d..235410e 100644
--- a/sw/source/ui/app/swmodul1.cxx
+++ b/sw/source/ui/app/swmodul1.cxx
@@ -398,32 +398,36 @@ sal_uInt16 SwModule::GetRedlineAuthor()
     if (!bAuthorInitialised)
     {
         const SvtUserOptions& rOpt = GetUserOptions();
-        if( !(sActAuthor = rOpt.GetFullName()).Len() )
-            if( !(sActAuthor = rOpt.GetID()).Len() )
-                sActAuthor = String( SW_RES( STR_REDLINE_UNKNOWN_AUTHOR ));
+        sActAuthor = rOpt.GetFullName();
+        if (sActAuthor.isEmpty())
+        {
+            sActAuthor = rOpt.GetID();
+            if (sActAuthor.isEmpty())
+                sActAuthor = SW_RESSTR( STR_REDLINE_UNKNOWN_AUTHOR );
+        }
         bAuthorInitialised = sal_True;
     }
     return InsertRedlineAuthor( sActAuthor );
 }
 
-void SwModule::SetRedlineAuthor(const String &rAuthor)
+void SwModule::SetRedlineAuthor(const OUString &rAuthor)
 {
     bAuthorInitialised = sal_True;
     sActAuthor = rAuthor;
     InsertRedlineAuthor( sActAuthor );
 }
 
-const String& SwModule::GetRedlineAuthor(sal_uInt16 nPos)
+OUString SwModule::GetRedlineAuthor(sal_uInt16 nPos)
 {
     OSL_ENSURE(nPos < pAuthorNames->size(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
     while(!(nPos < pAuthorNames->size()))
     {
-        InsertRedlineAuthor(String("nn"));
+        InsertRedlineAuthor("nn");
     };
     return (*pAuthorNames)[nPos];
 }
 
-sal_uInt16 SwModule::InsertRedlineAuthor(const String& rAuthor)
+sal_uInt16 SwModule::InsertRedlineAuthor(const OUString& rAuthor)
 {
     sal_uInt16 nPos = 0;
 
diff --git a/sw/source/ui/app/swmodule.cxx b/sw/source/ui/app/swmodule.cxx
index b0465ca..c903c4a 100644
--- a/sw/source/ui/app/swmodule.cxx
+++ b/sw/source/ui/app/swmodule.cxx
@@ -191,7 +191,7 @@ SwModule::SwModule( SfxObjectFactory* pWebFact,
 
     pStdFontConfig = new SwStdFontConfig;
 
-    pAuthorNames = new std::vector<String>;    // All Redlining-Authors
+    pAuthorNames = new std::vector<OUString>;  // All Redlining-Authors
 
     // replace SvxAutocorrect with SwAutocorrect
     SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();


More information about the Libreoffice-commits mailing list