diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-06 21:50:40 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2012-02-06 21:57:44 -0500 |
commit | 9abbf7c181467e665e4b8da3561a31086b65ed08 (patch) | |
tree | b1bc532d855ffc2dee3fbbfbd373aaa7207c54a4 /sc/source | |
parent | 9ccaa4b1468527bbec12d7e0fccf4ea443478f50 (diff) |
The usual bool & string conversion.
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/tool/autoform.cxx | 41 | ||||
-rw-r--r-- | sc/source/ui/inc/scuiautofmt.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/scuiautofmt.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/unoobj/afmtuno.cxx | 19 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 5 |
5 files changed, 32 insertions, 49 deletions
diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx index ee03c4a53241..76dc8b5d7f02 100644 --- a/sc/source/core/tool/autoform.cxx +++ b/sc/source/core/tool/autoform.cxx @@ -487,7 +487,7 @@ ScAutoFormatData::ScAutoFormatData() bIncludeJustify = bIncludeFrame = bIncludeBackground = - bIncludeWidthHeight = sal_True; + bIncludeWidthHeight = true; ppDataField = new ScAutoFormatDataField*[ 16 ]; for( sal_uInt16 nIndex = 0; nIndex < 16; ++nIndex ) @@ -618,9 +618,9 @@ const ScNumFormatAbbrev& ScAutoFormatData::GetNumFormat( sal_uInt16 nIndex ) con return GetField( nIndex ).GetNumFormat(); } -sal_Bool ScAutoFormatData::IsEqualData( sal_uInt16 nIndex1, sal_uInt16 nIndex2 ) const +bool ScAutoFormatData::IsEqualData( sal_uInt16 nIndex1, sal_uInt16 nIndex2 ) const { - sal_Bool bEqual = sal_True; + bool bEqual = true; const ScAutoFormatDataField& rField1 = GetField( nIndex1 ); const ScAutoFormatDataField& rField2 = GetField( nIndex2 ); @@ -787,9 +787,9 @@ void ScAutoFormatData::GetFromItemSet( sal_uInt16 nIndex, const SfxItemSet& rIte rField.SetRotateMode ( (const SvxRotateModeItem&) rItemSet.Get( ATTR_ROTATE_MODE ) ); } -sal_Bool ScAutoFormatData::Load( SvStream& rStream, const ScAfVersions& rVersions ) +bool ScAutoFormatData::Load( SvStream& rStream, const ScAfVersions& rVersions ) { - sal_Bool bRet = sal_True; + sal_Bool bRet = true; sal_uInt16 nVer = 0; rStream >> nVer; bRet = 0 == rStream.GetError(); @@ -838,7 +838,7 @@ sal_Bool ScAutoFormatData::Load( SvStream& rStream, const ScAfVersions& rVersion #ifdef READ_OLDVERS sal_Bool ScAutoFormatData::LoadOld( SvStream& rStream, const ScAfVersions& rVersions ) { - sal_Bool bRet = sal_True; + sal_Bool bRet = true; sal_uInt16 nVal = 0; rStream >> nVal; bRet = (rStream.GetError() == 0); @@ -863,7 +863,7 @@ sal_Bool ScAutoFormatData::LoadOld( SvStream& rStream, const ScAfVersions& rVers } #endif -sal_Bool ScAutoFormatData::Save(SvStream& rStream) +bool ScAutoFormatData::Save(SvStream& rStream) { sal_uInt16 nVal = AUTOFORMAT_DATA_ID; sal_Bool b; @@ -988,17 +988,15 @@ ScAutoFormat::~ScAutoFormat() Save(); } -void ScAutoFormat::SetSaveLater( sal_Bool bSet ) +void ScAutoFormat::SetSaveLater( bool bSet ) { bSaveLater = bSet; } short ScAutoFormat::Compare(ScDataObject* pKey1, ScDataObject* pKey2) const { - String aStr1; - String aStr2; - ((ScAutoFormatData*)pKey1)->GetName(aStr1); - ((ScAutoFormatData*)pKey2)->GetName(aStr2); + rtl::OUString aStr1 = ((ScAutoFormatData*)pKey1)->GetName(); + rtl::OUString aStr2 = ((ScAutoFormatData*)pKey2)->GetName(); String aStrStandard = ScGlobal::GetRscString(STR_STYLENAME_STANDARD); if ( ScGlobal::GetpTransliteration()->isEqual( aStr1, aStrStandard ) ) return -1; @@ -1007,9 +1005,9 @@ short ScAutoFormat::Compare(ScDataObject* pKey1, ScDataObject* pKey2) const return (short) ScGlobal::GetpTransliteration()->compareString( aStr1, aStr2 ); } -sal_Bool ScAutoFormat::Load() +bool ScAutoFormat::Load() { - sal_Bool bRet = sal_True; + bool bRet = true; INetURLObject aURL; SvtPathOptions aPathOpt; @@ -1017,7 +1015,7 @@ sal_Bool ScAutoFormat::Load() aURL.setFinalSlash(); aURL.Append( String( RTL_CONSTASCII_USTRINGPARAM( sAutoTblFmtName ) ) ); - SfxMedium aMedium( aURL.GetMainURL(INetURLObject::NO_DECODE), STREAM_READ, sal_True ); + SfxMedium aMedium( aURL.GetMainURL(INetURLObject::NO_DECODE), STREAM_READ, true ); SvStream* pStream = aMedium.GetInStream(); bRet = (pStream && pStream->GetError() == 0); if (bRet) @@ -1111,9 +1109,9 @@ sal_Bool ScAutoFormat::Load() return bRet; } -sal_Bool ScAutoFormat::Save() +bool ScAutoFormat::Save() { - sal_Bool bRet = sal_True; + bool bRet = true; INetURLObject aURL; SvtPathOptions aPathOpt; @@ -1121,7 +1119,7 @@ sal_Bool ScAutoFormat::Save() aURL.setFinalSlash(); aURL.Append( String( RTL_CONSTASCII_USTRINGPARAM( sAutoTblFmtName ) ) ); - SfxMedium aMedium( aURL.GetMainURL(INetURLObject::NO_DECODE), STREAM_WRITE, sal_True ); + SfxMedium aMedium( aURL.GetMainURL(INetURLObject::NO_DECODE), STREAM_WRITE, true ); SvStream* pStream = aMedium.GetOutStream(); bRet = (pStream && pStream->GetError() == 0); if (bRet) @@ -1151,16 +1149,13 @@ sal_Bool ScAutoFormat::Save() return bRet; } -sal_uInt16 ScAutoFormat::FindIndexPerName( const String& rName ) const +sal_uInt16 ScAutoFormat::FindIndexPerName( const rtl::OUString& rName ) const { - String aName; - for( sal_uInt16 i=0; i<nCount ; i++ ) { ScAutoFormatData* pItem = (ScAutoFormatData*)pItems[i]; - pItem->GetName( aName ); - if( aName == rName ) + if (pItem->GetName().equals(rName)) return i; } diff --git a/sc/source/ui/inc/scuiautofmt.hxx b/sc/source/ui/inc/scuiautofmt.hxx index 00113dca3806..654779673ed6 100644 --- a/sc/source/ui/inc/scuiautofmt.hxx +++ b/sc/source/ui/inc/scuiautofmt.hxx @@ -39,7 +39,7 @@ public: ~ScAutoFormatDlg(); sal_uInt16 GetIndex() const { return nIndex; } - String GetCurrFormatName(); + rtl::OUString GetCurrFormatName(); private: FixedLine aFlFormat; diff --git a/sc/source/ui/miscdlgs/scuiautofmt.cxx b/sc/source/ui/miscdlgs/scuiautofmt.cxx index 9466a4b53b81..8f8ef237ffb4 100644 --- a/sc/source/ui/miscdlgs/scuiautofmt.cxx +++ b/sc/source/ui/miscdlgs/scuiautofmt.cxx @@ -149,7 +149,7 @@ void ScAutoFormatDlg::Init() for ( sal_uInt16 i = 0; i < nCount; i++ ) { - ((*pFormat)[i])->GetName( aEntry ); + aEntry = ((*pFormat)[i])->GetName(); aLbFormat.InsertEntry( aEntry ); } @@ -379,7 +379,7 @@ IMPL_LINK( ScAutoFormatDlg, RenameHdl, void *, EMPTYARG ) { for( n = 0; n < pFormat->GetCount(); ++n ) { - (*pFormat)[n]->GetName(aEntry); + aEntry = (*pFormat)[n]->GetName(); if (aFormatName.equals(aEntry)) break; } @@ -405,7 +405,7 @@ IMPL_LINK( ScAutoFormatDlg, RenameHdl, void *, EMPTYARG ) aLbFormat.Clear(); for ( sal_uInt16 i = 0; i < nCount; i++ ) { - ((*pFormat)[i])->GetName( aEntry ); + aEntry = ((*pFormat)[i])->GetName(); aLbFormat.InsertEntry( aEntry ); } @@ -465,13 +465,9 @@ IMPL_LINK( ScAutoFormatDlg, SelFmtHdl, void *, EMPTYARG ) //------------------------------------------------------------------------ -String ScAutoFormatDlg::GetCurrFormatName() +rtl::OUString ScAutoFormatDlg::GetCurrFormatName() { - String aResult; - - ((*pFormat)[nIndex])->GetName( aResult ); - - return aResult; + return ((*pFormat)[nIndex])->GetName(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx index 58abbe449302..e29fa2db7442 100644 --- a/sc/source/ui/unoobj/afmtuno.cxx +++ b/sc/source/ui/unoobj/afmtuno.cxx @@ -164,18 +164,17 @@ SC_SIMPLE_SERVICE_INFO( ScAutoFormatsObj, "ScAutoFormatsObj", SCAUTOFORMATSOBJ_S //------------------------------------------------------------------------ -sal_Bool lcl_FindAutoFormatIndex( const ScAutoFormat& rFormats, const String& rName, sal_uInt16& rOutIndex ) +bool lcl_FindAutoFormatIndex( const ScAutoFormat& rFormats, const String& rName, sal_uInt16& rOutIndex ) { - String aEntryName; sal_uInt16 nCount = rFormats.GetCount(); for( sal_uInt16 nPos=0; nPos<nCount; nPos++ ) { ScAutoFormatData* pEntry = rFormats[nPos]; - pEntry->GetName( aEntryName ); - if ( aEntryName == rName ) + const rtl::OUString& aEntryName = pEntry->GetName(); + if ( aEntryName.equals(rName) ) { rOutIndex = nPos; - return sal_True; + return true; } } return false; // is nich @@ -390,8 +389,7 @@ uno::Sequence<rtl::OUString> SAL_CALL ScAutoFormatsObj::getElementNames() rtl::OUString* pAry = aSeq.getArray(); for (sal_uInt16 i=0; i<nCount; i++) { - (*pFormats)[i]->GetName(aName); - pAry[i] = aName; + pAry[i] = (*pFormats)[i]->GetName(); } return aSeq; } @@ -539,11 +537,8 @@ rtl::OUString SAL_CALL ScAutoFormatObj::getName() throw(uno::RuntimeException) SolarMutexGuard aGuard; ScAutoFormat* pFormats = ScGlobal::GetOrCreateAutoFormat(); if (IsInserted() && nFormatIndex < pFormats->GetCount()) - { - String aName; - (*pFormats)[nFormatIndex]->GetName(aName); - return aName; - } + return (*pFormats)[nFormatIndex]->GetName(); + return rtl::OUString(); } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 139d3d17900f..65f2dc49c234 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -5484,14 +5484,11 @@ void SAL_CALL ScCellRangeObj::autoFormat( const rtl::OUString& aName ) if ( pDocSh ) { ScAutoFormat* pAutoFormat = ScGlobal::GetOrCreateAutoFormat(); - String aNameString(aName); sal_uInt16 nCount = pAutoFormat->GetCount(); sal_uInt16 nIndex; - String aCompare; for (nIndex=0; nIndex<nCount; nIndex++) { - (*pAutoFormat)[nIndex]->GetName(aCompare); - if ( aCompare == aNameString ) //! Case-insensitiv ??? + if ((*pAutoFormat)[nIndex]->GetName().equals(aName)) //! Case-insensitiv ??? break; } if (nIndex<nCount) |