sc/inc/autoform.hxx | 62 +++++++++++++++++----------------- sc/source/core/tool/autoform.cxx | 41 +++++++++------------- sc/source/ui/inc/scuiautofmt.hxx | 2 - sc/source/ui/miscdlgs/scuiautofmt.cxx | 14 ++----- sc/source/ui/unoobj/afmtuno.cxx | 19 +++------- sc/source/ui/unoobj/cellsuno.cxx | 5 -- 6 files changed, 63 insertions(+), 80 deletions(-)
New commits: commit 9abbf7c181467e665e4b8da3561a31086b65ed08 Author: Kohei Yoshida <kohei.yosh...@suse.com> Date: Mon Feb 6 21:50:40 2012 -0500 The usual bool & string conversion. diff --git a/sc/inc/autoform.hxx b/sc/inc/autoform.hxx index c65a6f4..5ab5ac1 100644 --- a/sc/inc/autoform.hxx +++ b/sc/inc/autoform.hxx @@ -200,17 +200,17 @@ public: class SC_DLLPUBLIC ScAutoFormatData : public ScDataObject { private: - String aName; - sal_uInt16 nStrResId; + rtl::OUString aName; + sal_uInt16 nStrResId; // common flags of Calc and Writer - sal_Bool bIncludeFont : 1; - sal_Bool bIncludeJustify : 1; - sal_Bool bIncludeFrame : 1; - sal_Bool bIncludeBackground : 1; + bool bIncludeFont : 1; + bool bIncludeJustify : 1; + bool bIncludeFrame : 1; + bool bIncludeBackground : 1; // Calc specific flags - sal_Bool bIncludeValueFormat : 1; - sal_Bool bIncludeWidthHeight : 1; + bool bIncludeValueFormat : 1; + bool bIncludeWidthHeight : 1; ScAutoFormatDataField** ppDataField; @@ -224,22 +224,22 @@ public: virtual ScDataObject* Clone() const { return new ScAutoFormatData( *this ); } - void SetName( const String& rName ) { aName = rName; nStrResId = USHRT_MAX; } - void GetName( String& rName ) const { rName = aName; } + void SetName( const rtl::OUString& rName ) { aName = rName; nStrResId = USHRT_MAX; } + const rtl::OUString& GetName() const { return aName; } - sal_Bool GetIncludeValueFormat() const { return bIncludeValueFormat; } - sal_Bool GetIncludeFont() const { return bIncludeFont; } - sal_Bool GetIncludeJustify() const { return bIncludeJustify; } - sal_Bool GetIncludeFrame() const { return bIncludeFrame; } - sal_Bool GetIncludeBackground() const { return bIncludeBackground; } - sal_Bool GetIncludeWidthHeight() const { return bIncludeWidthHeight; } + bool GetIncludeValueFormat() const { return bIncludeValueFormat; } + bool GetIncludeFont() const { return bIncludeFont; } + bool GetIncludeJustify() const { return bIncludeJustify; } + bool GetIncludeFrame() const { return bIncludeFrame; } + bool GetIncludeBackground() const { return bIncludeBackground; } + bool GetIncludeWidthHeight() const { return bIncludeWidthHeight; } - void SetIncludeValueFormat( sal_Bool bValueFormat ) { bIncludeValueFormat = bValueFormat; } - void SetIncludeFont( sal_Bool bFont ) { bIncludeFont = bFont; } - void SetIncludeJustify( sal_Bool bJustify ) { bIncludeJustify = bJustify; } - void SetIncludeFrame( sal_Bool bFrame ) { bIncludeFrame = bFrame; } - void SetIncludeBackground( sal_Bool bBackground ) { bIncludeBackground = bBackground; } - void SetIncludeWidthHeight( sal_Bool bWidthHeight ) { bIncludeWidthHeight = bWidthHeight; } + void SetIncludeValueFormat( bool bValueFormat ) { bIncludeValueFormat = bValueFormat; } + void SetIncludeFont( bool bFont ) { bIncludeFont = bFont; } + void SetIncludeJustify( bool bJustify ) { bIncludeJustify = bJustify; } + void SetIncludeFrame( bool bFrame ) { bIncludeFrame = bFrame; } + void SetIncludeBackground( bool bBackground ) { bIncludeBackground = bBackground; } + void SetIncludeWidthHeight( bool bWidthHeight ) { bIncludeWidthHeight = bWidthHeight; } const SfxPoolItem* GetItem( sal_uInt16 nIndex, sal_uInt16 nWhich ) const; void PutItem( sal_uInt16 nIndex, const SfxPoolItem& rItem ); @@ -247,13 +247,13 @@ public: const ScNumFormatAbbrev& GetNumFormat( sal_uInt16 nIndex ) const; - sal_Bool IsEqualData( sal_uInt16 nIndex1, sal_uInt16 nIndex2 ) const; + bool IsEqualData( sal_uInt16 nIndex1, sal_uInt16 nIndex2 ) const; void FillToItemSet( sal_uInt16 nIndex, SfxItemSet& rItemSet, ScDocument& rDoc ) const; void GetFromItemSet( sal_uInt16 nIndex, const SfxItemSet& rItemSet, const ScNumFormatAbbrev& rNumFormat ); - sal_Bool Load( SvStream& rStream, const ScAfVersions& rVersions ); - sal_Bool Save( SvStream& rStream ); + bool Load( SvStream& rStream, const ScAfVersions& rVersions ); + bool Save( SvStream& rStream ); #ifdef READ_OLDVERS sal_Bool LoadOld( SvStream& rStream, const ScAfVersions& rVersions ); @@ -263,7 +263,7 @@ public: class SC_DLLPUBLIC ScAutoFormat : public ScSortedCollection { private: - sal_Bool bSaveLater; + bool bSaveLater; public: ScAutoFormat( sal_uInt16 nLim = 4, sal_uInt16 nDel = 4, sal_Bool bDup = false ); @@ -272,11 +272,11 @@ public: virtual ScDataObject* Clone() const { return new ScAutoFormat( *this ); } ScAutoFormatData* operator[]( const sal_uInt16 nIndex ) const {return (ScAutoFormatData*)At( nIndex );} virtual short Compare( ScDataObject* pKey1, ScDataObject* pKey2 ) const; - sal_Bool Load(); - sal_Bool Save(); - sal_uInt16 FindIndexPerName( const String& rName ) const; - void SetSaveLater( sal_Bool bSet ); - sal_Bool IsSaveLater() const { return bSaveLater; } + bool Load(); + bool Save(); + sal_uInt16 FindIndexPerName( const rtl::OUString& rName ) const; + void SetSaveLater( bool bSet ); + bool IsSaveLater() const { return bSaveLater; } }; diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx index ee03c4a..76dc8b5 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 00113dc..6547796 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 9466a4b..8f8ef23 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 58abbe4..e29fa2d 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 139d3d1..65f2dc4 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) _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits