diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2013-09-18 00:46:03 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-09-26 07:07:32 +0000 |
commit | 3b74822938e66dc50d6ae659bc849223aec23a9e (patch) | |
tree | 90a3deb07a087a953aed07dd9e62aff39713b8e3 | |
parent | 8a183e1a7dec63742d6438adc0aa03b9b02396c3 (diff) |
String to OUString
Change-Id: I775327d5218655841006bcac5a1dbf236503fbb5
Reviewed-on: https://gerrit.libreoffice.org/6025
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/source/ui/config/optcomp.cxx | 32 | ||||
-rw-r--r-- | sw/source/ui/inc/optcomp.hxx | 5 |
2 files changed, 18 insertions, 19 deletions
diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx index 5b3e990b69c3..5a52f5f302d3 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 c6fd91ca218e..fd9f127e94eb 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(); |