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

Matteo Casalin matteo.casalin at yahoo.com
Thu Sep 26 00:07:51 PDT 2013


 sw/source/ui/config/optcomp.cxx |   32 +++++++++++++++-----------------
 sw/source/ui/inc/optcomp.hxx    |    5 +++--
 2 files changed, 18 insertions(+), 19 deletions(-)

New commits:
commit 3b74822938e66dc50d6ae659bc849223aec23a9e
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Wed Sep 18 00:46:03 2013 +0200

    String to OUString
    
    Change-Id: I775327d5218655841006bcac5a1dbf236503fbb5
    Reviewed-on: https://gerrit.libreoffice.org/6025
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx
index 5b3e990..5a52f5f 100644
--- a/sw/source/ui/config/optcomp.cxx
+++ b/sw/source/ui/config/optcomp.cxx
@@ -47,8 +47,8 @@ using namespace ::std;
 
 struct CompatibilityItem
 {
-    String      m_sName;
-    String      m_sModule;
+    OUString    m_sName;
+    OUString    m_sModule;
     bool        m_bUsePrtMetrics;
     bool        m_bAddSpacing;
     bool        m_bAddSpacingAtPages;
@@ -63,7 +63,7 @@ struct CompatibilityItem
     bool        m_bIsDefault;
     bool        m_bIsUser;
 
-    CompatibilityItem( const String& _rName, const String& _rModule,
+    CompatibilityItem( const OUString& _rName, const OUString& _rModule,
                        bool _bUsePrtMetrics, bool _bAddSpacing, bool _bAddSpacingAtPages,
                        bool _bUseOurTabStops, bool _bNoExtLeading, bool _bUseLineSpacing,
                        bool _bAddTableSpacing, bool _bUseObjPos, bool _bUseOurTextWrapping,
@@ -112,7 +112,7 @@ SwCompatibilityOptPage::SwCompatibilityOptPage(Window* pParent, const SfxItemSet
 
     for (sal_uInt16 nId = COPT_USE_PRINTERDEVICE; nId <= COPT_EXPAND_WORDSPACE; ++nId)
     {
-        String sEntry = m_pFormattingLB->GetEntry(nId);
+        OUString sEntry = m_pFormattingLB->GetEntry(nId);
         if ( COPT_USE_OUR_TABSTOPS == nId ||
              COPT_USE_LINESPACING == nId ||
              COPT_USE_OBJECTPOSITIONING == nId ||
@@ -143,20 +143,18 @@ SwCompatibilityOptPage::~SwCompatibilityOptPage()
     delete m_pImpl;
 }
 
-void SwCompatibilityOptPage::ReplaceFormatName( String& rEntry )
+void SwCompatibilityOptPage::ReplaceFormatName( OUString& rEntry )
 {
     OUString sFormatName(utl::ConfigManager::getProductName());
-    OUString sFormatVersion;
-    bool bOpenOffice = ( sFormatName == "OpenOffice.org" );
-    if ( bOpenOffice )
-        sFormatVersion = OUString("1.1");
-    else
-        sFormatVersion = OUString("6.0/7");
+    const bool bOpenOffice = ( sFormatName == "OpenOffice.org" );
+    const OUString sFormatVersion = bOpenOffice
+        ? OUString("1.1")
+        : OUString("6.0/7");
     if ( !bOpenOffice && ( sFormatName != "StarSuite" ) )
-        sFormatName = OUString("StarOffice");
+        sFormatName = "StarOffice";
 
-    rEntry.SearchAndReplace( OUString("%FORMATNAME"), sFormatName );
-    rEntry.SearchAndReplace( OUString("%FORMATVERSION"), sFormatVersion );
+    rEntry = rEntry.replaceFirst( "%FORMATNAME", sFormatName )
+                   .replaceFirst( "%FORMATVERSION", sFormatVersion );
 }
 
 sal_uLong convertBools2Ulong_Impl
@@ -216,7 +214,7 @@ sal_uLong convertBools2Ulong_Impl
 void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet )
 {
     // init objectshell and detect document name
-    String sDocTitle;
+    OUString sDocTitle;
     const SfxPoolItem* pItem = NULL;
     SfxObjectShell* pObjShell = NULL;
     if ( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_WRTSHELL, sal_False, &pItem ) )
@@ -252,7 +250,6 @@ void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet )
     int i, j, nCount = aList.getLength();
     for ( i = 0; i < nCount; ++i )
     {
-        String sNewEntry;
         const Sequence< PropertyValue >& rEntry = aList[i];
         for ( j = 0; j < rEntry.getLength(); j++ )
         {
@@ -297,6 +294,7 @@ void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet )
         if ( aItem.m_bIsDefault )
             continue;
 
+        OUString sNewEntry;
         if ( sName.equals( USER_ENTRY ) )
             sNewEntry = m_sUserEntry;
         else if ( pObjShell && !sName.isEmpty() )
@@ -307,7 +305,7 @@ void SwCompatibilityOptPage::InitControls( const SfxItemSet& rSet )
                 sNewEntry = pFilter->GetUIName();
         }
 
-        if ( sNewEntry.Len() == 0 )
+        if ( sNewEntry.isEmpty() )
             sNewEntry = sName;
 
         sal_uInt16 nPos = m_pFormattingLB->InsertEntry( sNewEntry );
diff --git a/sw/source/ui/inc/optcomp.hxx b/sw/source/ui/inc/optcomp.hxx
index c6fd91c..fd9f127 100644
--- a/sw/source/ui/inc/optcomp.hxx
+++ b/sw/source/ui/inc/optcomp.hxx
@@ -25,6 +25,7 @@
 #include <vcl/lstbox.hxx>
 #include <unotools/compatibility.hxx>
 #include <svx/checklbx.hxx>
+#include "rtl/ustring.hxx"
 
 // class SwCompatibilityOptPage ------------------------------------------
 class SwWrtShell;
@@ -41,7 +42,7 @@ private:
     // config item
     SvtCompatibilityOptions m_aConfigItem;
     // text of the user entry
-    String                  m_sUserEntry;
+    OUString                m_sUserEntry;
     // shell of the current document
     SwWrtShell*             m_pWrtShell;
     // impl object
@@ -55,7 +56,7 @@ private:
 
     // private methods
     void                    InitControls( const SfxItemSet& rSet );
-    void                    ReplaceFormatName( String& rEntry );
+    void                    ReplaceFormatName( OUString& rEntry );
     void                    SetCurrentOptions( sal_uLong nOptions );
     sal_uLong                   GetDocumentOptions() const;
     void                    WriteOptions();


More information about the Libreoffice-commits mailing list