diff options
author | Noel Grandin <noel@peralex.com> | 2013-09-03 11:43:20 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-09-05 08:54:27 +0200 |
commit | 9d003eca64ef50dddca7796fff6760b0b99fe623 (patch) | |
tree | 8c51489a52b3fcfba7b12beae6a8e1eb0afdbc5f | |
parent | f6ada649d67b8b3fcf31e6588e56c3cd7d5c1fe0 (diff) |
convert includes/svx/numfmtsh.hxx from String to OUString
Change-Id: I95884864dd943a65cef64262cc9f05b9ceb524b2
-rw-r--r-- | cui/source/inc/numfmt.hxx | 4 | ||||
-rw-r--r-- | cui/source/tabpages/numfmt.cxx | 87 | ||||
-rw-r--r-- | include/svx/numfmtsh.hxx | 96 | ||||
-rw-r--r-- | svx/source/items/numfmtsh.cxx | 161 |
4 files changed, 160 insertions, 188 deletions
diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx index 7cd9c79b4882..cdbc1f3cd5a5 100644 --- a/cui/source/inc/numfmt.hxx +++ b/cui/source/inc/numfmt.hxx @@ -132,10 +132,10 @@ private: void Init_Impl(); void FillCurrencyBox(); - void FillFormatListBox_Impl( std::vector<String*>& rEntries ); + void FillFormatListBox_Impl( std::vector<OUString>& rEntries ); void UpdateOptions_Impl( sal_Bool bCheckCatChange ); void UpdateFormatListBox_Impl( sal_uInt16 bCat, sal_Bool bUpdateEdit ); - void DeleteEntryList_Impl( std::vector<String*>& rEntries ); + void DeleteEntryList_Impl( std::vector<OUString>& rEntries ); void Obstructing(); void EnableBySourceFormat_Impl(); void SetCategory( sal_uInt16 nPos ); diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index f0893481d80b..4503e471bb55 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -385,10 +385,10 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet& rSet ) sal_uInt16 nCatLbSelPos = 0; sal_uInt16 nFmtLbSelPos = 0; LanguageType eLangType = LANGUAGE_DONTKNOW; - std::vector<String*> aFmtEntryList; + std::vector<OUString> aFmtEntryList; SvxNumberValueType eValType = SVX_VALUE_TYPE_UNDEFINED; double nValDouble = 0; - String aValString; + OUString aValString; SfxItemState eState = rSet.GetItemState( GetWhich( SID_ATTR_NUMBERFORMAT_NOLANGUAGE ),sal_True,&pItem); @@ -524,7 +524,7 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet& rSet ) FillCurrencyBox(); - String aPrevString; + OUString aPrevString; Color* pDummy = NULL; pNumFmtShell->GetInitSettings( nCatLbSelPos, eLangType, nFmtLbSelPos, aFmtEntryList, aPrevString, pDummy ); @@ -580,8 +580,6 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet& rSet ) // everything disabled except SourceFormat checkbox EnableBySourceFormat_Impl(); } - - DeleteEntryList_Impl(aFmtEntryList); } /************************************************************************* @@ -803,9 +801,9 @@ void SvxNumberFormatTabPage::SetInfoItem( const SvxNumberInfoItem& rItem ) } } -void SvxNumberFormatTabPage::FillFormatListBox_Impl( std::vector<String*>& rEntries ) +void SvxNumberFormatTabPage::FillFormatListBox_Impl( std::vector<OUString>& rEntries ) { - String* pEntry; + OUString aEntry; String aTmpString; Font aFont=m_pLbCategory->GetFont(); size_t i = 0; @@ -832,16 +830,13 @@ void SvxNumberFormatTabPage::FillFormatListBox_Impl( std::vector<String*>& rEntr case CAT_ALL: case CAT_TEXT: case CAT_NUMBER: i=1; - pEntry=rEntries[0]; - if(pEntry!=NULL) - { - if (nTmpCatPos == CAT_TEXT) - aTmpString=*pEntry; - else - aTmpString = pNumFmtShell->GetStandardName(); - aPrivCat=pNumFmtShell->GetCategory4Entry(0); - m_pLbFormat->InsertFontEntry( aTmpString, aFont ); - } + aEntry=rEntries[0]; + if (nTmpCatPos == CAT_TEXT) + aTmpString=aEntry; + else + aTmpString = pNumFmtShell->GetStandardName(); + aPrivCat=pNumFmtShell->GetCategory4Entry(0); + m_pLbFormat->InsertFontEntry( aTmpString, aFont ); break; default: break; @@ -851,30 +846,28 @@ void SvxNumberFormatTabPage::FillFormatListBox_Impl( std::vector<String*>& rEntr { for ( ; i < rEntries.size(); ++i ) { - pEntry = rEntries[i]; + aEntry = rEntries[i]; aPrivCat=pNumFmtShell->GetCategory4Entry( static_cast<sal_uInt16>(i) ); if(aPrivCat!=CAT_TEXT) { Color* pPreviewColor = NULL; - String aPreviewString( GetExpColorString( pPreviewColor, *pEntry, aPrivCat ) ); + String aPreviewString( GetExpColorString( pPreviewColor, aEntry, aPrivCat ) ); Font aEntryFont( m_pLbFormat->GetFont() ); m_pLbFormat->InsertFontEntry( aPreviewString, aEntryFont, pPreviewColor ); } else { - m_pLbFormat->InsertFontEntry(*pEntry,aFont); + m_pLbFormat->InsertFontEntry(aEntry,aFont); } } } m_pLbFormat->SetUpdateMode( sal_True ); - DeleteEntryList_Impl(rEntries); + rEntries.clear(); } -void SvxNumberFormatTabPage::DeleteEntryList_Impl( std::vector<String*>& rEntries ) +void SvxNumberFormatTabPage::DeleteEntryList_Impl( std::vector<OUString>& rEntries ) { - for( std::vector<String*>::const_iterator it(rEntries.begin()); it != rEntries.end(); ++it ) - delete *it; rEntries.clear(); } @@ -1010,9 +1003,9 @@ void SvxNumberFormatTabPage::UpdateFormatListBox_Impl sal_Bool bUpdateEdit ) { - std::vector<String*> aEntryList; - short nFmtLbSelPos = 0; - short nTmpCatPos; + std::vector<OUString> aEntryList; + short nFmtLbSelPos = 0; + short nTmpCatPos; if(bOneAreaFlag) { @@ -1044,7 +1037,7 @@ void SvxNumberFormatTabPage::UpdateFormatListBox_Impl { if(bUpdateEdit) { - String aFormat=*aEntryList[nFmtLbSelPos]; + OUString aFormat=aEntryList[nFmtLbSelPos]; m_pEdFormat->SetText(aFormat); m_pFtComment->SetText(pNumFmtShell->GetComment4Entry(nFmtLbSelPos)); } @@ -1057,7 +1050,7 @@ void SvxNumberFormatTabPage::UpdateFormatListBox_Impl m_pFtComment->SetText(pNumFmtShell->GetComment4Entry(nFmtLbSelPos)); if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos)) { - if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).Len()==0) + if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).isEmpty()) { m_pFtComment->SetText(m_pLbCategory->GetEntry(1)); } @@ -1076,7 +1069,7 @@ void SvxNumberFormatTabPage::UpdateFormatListBox_Impl m_pFtComment->SetText(pNumFmtShell->GetComment4Entry(nFmtLbSelPos)); if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos)) { - if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).Len()==0) + if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).isEmpty()) { m_pFtComment->SetText(m_pLbCategory->GetEntry(1)); } @@ -1094,7 +1087,7 @@ void SvxNumberFormatTabPage::UpdateFormatListBox_Impl } } - DeleteEntryList_Impl( aEntryList ); + aEntryList.clear(); } @@ -1197,7 +1190,7 @@ IMPL_LINK( SvxNumberFormatTabPage, SelFormatHdl_Impl, void *, pLb ) aComment=pNumFmtShell->GetComment4Entry(nSelPos); if(pNumFmtShell->GetUserDefined4Entry(nFmtLbSelPos)) { - if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).Len()==0) + if(pNumFmtShell->GetComment4Entry(nFmtLbSelPos).isEmpty()) { aComment = m_pLbCategory->GetEntry(1); } @@ -1281,9 +1274,9 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, PushButton*, pIB) if (pIB == m_pIbAdd) { // Also called from FillItemSet() if a temporary currency format has // to be added, not only if the Add button is enabled. - String aFormat = m_pEdFormat->GetText(); - std::vector<String*> aEntryList; - std::vector<String*> a2EntryList; + OUString aFormat = m_pEdFormat->GetText(); + std::vector<OUString> aEntryList; + std::vector<OUString> a2EntryList; sal_uInt16 nCatLbSelPos = 0; short nFmtLbSelPos = SELPOS_NONE; xub_StrLen nErrPos=0; @@ -1316,12 +1309,12 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, PushButton*, pIB) if(bOneAreaFlag && (nFixedCategory!=nCatLbSelPos)) { - if(bAdded) DeleteEntryList_Impl(aEntryList); + if(bAdded) aEntryList.clear(); bDeleted = pNumFmtShell->RemoveFormat( aFormat, nCatLbSelPos, nFmtLbSelPos, a2EntryList); - if(bDeleted) DeleteEntryList_Impl(a2EntryList); + if(bDeleted) a2EntryList.clear(); m_pEdFormat->GrabFocus(); m_pEdFormat->SetSelection( Selection( (short)nErrPos, SELECTION_MAX ) ); nReturn |= nReturnOneArea; @@ -1364,13 +1357,13 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, PushButton*, pIB) EditHdl_Impl(m_pEdFormat); nReturn = ((nReturn & nReturnOneArea) ? 0 : (nReturn & nReturnChanged)); - DeleteEntryList_Impl( aEntryList ); - DeleteEntryList_Impl( a2EntryList ); + aEntryList.clear(); + a2EntryList.clear(); } else if (pIB == m_pIbRemove) { - String aFormat = m_pEdFormat->GetText(); - std::vector<String*> aEntryList; + OUString aFormat = m_pEdFormat->GetText(); + std::vector<OUString> aEntryList; sal_uInt16 nCatLbSelPos = 0; short nFmtLbSelPos = SELPOS_NONE; @@ -1384,7 +1377,7 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, PushButton*, pIB) { if( nFmtLbSelPos>=0 && static_cast<size_t>(nFmtLbSelPos)<aEntryList.size() ) { - aFormat = *aEntryList[nFmtLbSelPos]; + aFormat = aEntryList[nFmtLbSelPos]; } FillFormatListBox_Impl( aEntryList ); @@ -1409,7 +1402,7 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, PushButton*, pIB) } EditHdl_Impl(m_pEdFormat); - DeleteEntryList_Impl( aEntryList ); + aEntryList.clear(); } else if (pIB == m_pIbInfo) { @@ -1520,7 +1513,7 @@ IMPL_LINK( SvxNumberFormatTabPage, OptHdl_Impl, void *, pOptCtrl ) || (pOptCtrl == m_pBtnNegRed) || (pOptCtrl == m_pBtnThousand) ) { - String aFormat; + OUString aFormat; sal_Bool bThousand = m_pBtnThousand->IsEnabled() && m_pBtnThousand->IsChecked(); sal_Bool bNegRed = m_pBtnNegRed->IsEnabled() @@ -1632,14 +1625,14 @@ String SvxNumberFormatTabPage::GetExpColorString( default: nVal=0;break; } - String aPreviewString; + OUString aPreviewString; pNumFmtShell->MakePrevStringFromVal( rFormatStr, aPreviewString, rpPreviewColor, nVal ); return aPreviewString; } void SvxNumberFormatTabPage::MakePreviewText( const String& rFormat ) { - String aPreviewString; + OUString aPreviewString; Color* pPreviewColor = NULL; pNumFmtShell->MakePreviewString( rFormat, aPreviewString, pPreviewColor ); m_pWndPreview->NotifyChange( aPreviewString, pPreviewColor ); @@ -1647,7 +1640,7 @@ void SvxNumberFormatTabPage::MakePreviewText( const String& rFormat ) void SvxNumberFormatTabPage::ChangePreviewText( sal_uInt16 nPos ) { - String aPreviewString; + OUString aPreviewString; Color* pPreviewColor = NULL; pNumFmtShell->FormatChanged( nPos, aPreviewString, pPreviewColor ); m_pWndPreview->NotifyChange( aPreviewString, pPreviewColor ); diff --git a/include/svx/numfmtsh.hxx b/include/svx/numfmtsh.hxx index cba55594d6a6..86ade997f049 100644 --- a/include/svx/numfmtsh.hxx +++ b/include/svx/numfmtsh.hxx @@ -62,13 +62,13 @@ public: SvxNumberFormatShell( SvNumberFormatter* pNumFormatter, sal_uInt32 nFormatKey, SvxNumberValueType eNumValType, - const String& rNumStr ); + const OUString& rNumStr ); SvxNumberFormatShell( SvNumberFormatter* pNumFormatter, sal_uInt32 nFormatKey, SvxNumberValueType eNumValType, double nNumVal, - const String* pNumStr = NULL ); + const OUString* pNumStr = NULL ); ~SvxNumberFormatShell(); @@ -76,71 +76,71 @@ public: static SvxNumberFormatShell* Create( SvNumberFormatter* pNumFormatter, sal_uInt32 nFormatKey, SvxNumberValueType eNumValType, - const String& rNumStr ); + const OUString& rNumStr ); static SvxNumberFormatShell* Create( SvNumberFormatter* pNumFormatter, sal_uInt32 nFormatKey, SvxNumberValueType eNumValType, double nNumVal, - const String* pNumStr = NULL ); + const OUString* pNumStr = NULL ); void GetInitSettings( sal_uInt16& nCatLbPos, LanguageType& rLangType, sal_uInt16& nFmtLbSelPos, - std::vector<String*>& rFmtEntries, - String& rPrevString, + std::vector<OUString>& rFmtEntries, + OUString& rPrevString, Color*& rpPrevColor ); void CategoryChanged( sal_uInt16 nCatLbPos, short& rFmtSelPos, - std::vector<String*>& rFmtEntries ); + std::vector<OUString>& rFmtEntries ); void LanguageChanged( LanguageType eLangType, short& rFmtSelPos, - std::vector<String*>& rFmtEntries ); + std::vector<OUString>& rFmtEntries ); void FormatChanged( sal_uInt16 nFmtLbPos, - String& rPreviewStr, - Color*& rpFontColor ); + OUString& rPreviewStr, + Color*& rpFontColor ); - bool AddFormat( String& rFormat, + bool AddFormat( OUString& rFormat, xub_StrLen& rErrPos, sal_uInt16& rCatLbSelPos, short& rFmtSelPos, - std::vector<String*>& rFmtEntries ); + std::vector<OUString>& rFmtEntries ); - bool RemoveFormat( const String& rFormat, + bool RemoveFormat( const OUString& rFormat, sal_uInt16& rCatLbSelPos, short& rFmtSelPos, - std::vector<String*>& rFmtEntries ); + std::vector<OUString>& rFmtEntries ); - void MakeFormat( String& rFormat, + void MakeFormat( OUString& rFormat, bool bThousand, bool bNegRed, sal_uInt16 nPrecision, sal_uInt16 nLeadingZeroes, sal_uInt16 nCurrencyEntryPos); - void GetOptions( const String& rFormat, - bool& rThousand, - bool& rNegRed, - sal_uInt16& rPrecision, - sal_uInt16& rLeadingZeroes, - sal_uInt16& rCatLbPos ); + void GetOptions( const OUString& rFormat, + bool& rThousand, + bool& rNegRed, + sal_uInt16& rPrecision, + sal_uInt16& rLeadingZeroes, + sal_uInt16& rCatLbPos ); - void MakePreviewString( const String& rFormatStr, - String& rPreviewStr, - Color*& rpFontColor ); + void MakePreviewString( const OUString& rFormatStr, + OUString& rPreviewStr, + Color*& rpFontColor ); - void MakePrevStringFromVal( const String& rFormatStr, - String& rPreviewStr, - Color*& rpFontColor, - double nValue); + void MakePrevStringFromVal( const OUString& rFormatStr, + OUString& rPreviewStr, + Color*& rpFontColor, + double nValue); - bool IsUserDefined( const String& rFmtString ); - bool IsTmpCurrencyFormat( const String& rFmtString ); - bool FindEntry( const String& rFmtString, sal_uInt32* pAt = NULL ); + bool IsUserDefined( const OUString& rFmtString ); + bool IsTmpCurrencyFormat( const OUString& rFmtString ); + bool FindEntry( const OUString& rFmtString, sal_uInt32* pAt = NULL ); void ValidateNewEntries( bool bValidate = true ) { bUndoAddList = !bValidate; } size_t GetUpdateDataCount() const; @@ -153,26 +153,26 @@ public: /** Returns the name of Standard, General, ... for the current language. */ - String GetStandardName() const; + OUString GetStandardName() const; - String GetComment4Entry(short nEntry); + OUString GetComment4Entry(short nEntry); short GetCategory4Entry(short nEntry); bool GetUserDefined4Entry(short nEntry); - String GetFormat4Entry(short nEntry); + OUString GetFormat4Entry(short nEntry); void SetComment4Entry(short nEntry,String aCommentString); void SetCurrencySymbol(sal_uInt16 nPos); sal_uInt32 GetCurrencySymbol(); - sal_uInt16 FindCurrencyFormat( const String& rFmtString ); + sal_uInt16 FindCurrencyFormat( const OUString& rFmtString ); sal_uInt16 FindCurrencyFormat(const NfCurrencyEntry* pTmpCurrencyEntry,bool bTmpBanking); void SetCurCurrencyEntry(NfCurrencyEntry*); short GetListPos4Entry(sal_uInt32 nIdx); - short GetListPos4Entry( const String& rFmtString ); + short GetListPos4Entry( const OUString& rFmtString ); void GetCurrencySymbols(std::vector<OUString>& rList, sal_uInt16* pPos ); void GetCurrencySymbols(std::vector<OUString>& rList, bool bFlag ); - sal_uInt16 FindCurrencyTableEntry( const String& rFmtString, bool &bTestBanking ); + sal_uInt16 FindCurrencyTableEntry( const OUString& rFmtString, bool &bTestBanking ); bool IsInTable(sal_uInt16 nPos, bool bTmpBanking, OUString const& rFmtString); @@ -184,7 +184,7 @@ private: SvNumberFormatter* pFormatter; SvNumberFormatTable* pCurFmtTable; SvxNumberValueType eValType; - String aValStr; + OUString aValStr; double nValNum; bool bUndoAddList; std::vector<sal_uInt32> aAddList; @@ -197,26 +197,26 @@ private: NfCurrencyEntry* pCurCurrencyEntry; bool bBankingSymbol; sal_uInt16 nCurCurrencyEntryPos; - std::vector<String*> aCurrencyFormatList; + std::vector<OUString> aCurrencyFormatList; bool bUseStarFormat; - SVX_DLLPRIVATE short FillEntryList_Impl( std::vector<String*>& rList ); - SVX_DLLPRIVATE void FillEListWithStd_Impl( std::vector<String*>& rList,sal_uInt16 aPrivCat, short &Pos); - SVX_DLLPRIVATE short FillEListWithFormats_Impl( std::vector<String*>& rList,short nSelPos, + SVX_DLLPRIVATE short FillEntryList_Impl( std::vector<OUString>& rList ); + SVX_DLLPRIVATE void FillEListWithStd_Impl( std::vector<OUString>& rList,sal_uInt16 aPrivCat, short &Pos); + SVX_DLLPRIVATE short FillEListWithFormats_Impl( std::vector<OUString>& rList,short nSelPos, NfIndexTableOffset eOffsetStart, NfIndexTableOffset eOffsetEnd); - SVX_DLLPRIVATE short FillEListWithDateTime_Impl( std::vector<String*>& rList,short nSelPos); - SVX_DLLPRIVATE short FillEListWithCurrency_Impl( std::vector<String*>& rList,short nSelPos); - SVX_DLLPRIVATE short FillEListWithSysCurrencys( std::vector<String*>& rList,short nSelPos); - SVX_DLLPRIVATE short FillEListWithUserCurrencys( std::vector<String*>& rList,short nSelPos); - SVX_DLLPRIVATE short FillEListWithUsD_Impl( std::vector<String*>& rList, sal_uInt16 nPrivCat, short Pos ); + SVX_DLLPRIVATE short FillEListWithDateTime_Impl( std::vector<OUString>& rList,short nSelPos); + SVX_DLLPRIVATE short FillEListWithCurrency_Impl( std::vector<OUString>& rList,short nSelPos); + SVX_DLLPRIVATE short FillEListWithSysCurrencys( std::vector<OUString>& rList,short nSelPos); + SVX_DLLPRIVATE short FillEListWithUserCurrencys( std::vector<OUString>& rList,short nSelPos); + SVX_DLLPRIVATE short FillEListWithUsD_Impl( std::vector<OUString>& rList, sal_uInt16 nPrivCat, short Pos ); SVX_DLLPRIVATE ::std::vector<sal_uInt32>::iterator GetRemoved_Impl( size_t nKey ); SVX_DLLPRIVATE bool IsRemoved_Impl( size_t nKey ); SVX_DLLPRIVATE ::std::vector<sal_uInt32>::iterator GetAdded_Impl( size_t nKey ); SVX_DLLPRIVATE bool IsAdded_Impl( size_t nKey ); - SVX_DLLPRIVATE void GetPreviewString_Impl( String& rString, + SVX_DLLPRIVATE void GetPreviewString_Impl( OUString& rString, Color*& rpColor ); SVX_DLLPRIVATE void PosToCategory_Impl( sal_uInt16 nPos, short& rCategory ); SVX_DLLPRIVATE void CategoryToPos_Impl( short nCategory, sal_uInt16& rPos ); diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index 0c7e03f352eb..1040e2f4e142 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -42,19 +42,19 @@ const double SvxNumberFormatShell::DEFAULT_NUMVALUE = 1234.56789; SvxNumberFormatShell* SvxNumberFormatShell::Create( SvNumberFormatter* pNumFormatter, - sal_uInt32 nFormatKey, - SvxNumberValueType eNumValType, - const String& rNumStr ) + sal_uInt32 nFormatKey, + SvxNumberValueType eNumValType, + const OUString& rNumStr ) { return new SvxNumberFormatShell(pNumFormatter,nFormatKey, eNumValType,rNumStr ); } SvxNumberFormatShell* SvxNumberFormatShell::Create( SvNumberFormatter* pNumFormatter, - sal_uInt32 nFormatKey, + sal_uInt32 nFormatKey, SvxNumberValueType eNumValType, double nNumVal, - const String* pNumStr ) + const OUString* pNumStr ) { return new SvxNumberFormatShell(pNumFormatter,nFormatKey, eNumValType,nNumVal,pNumStr ); @@ -63,9 +63,9 @@ SvxNumberFormatShell* SvxNumberFormatShell::Create( SvNumberFormatter* pNumForma // ----------------------------------------------------------------------- SvxNumberFormatShell::SvxNumberFormatShell( SvNumberFormatter* pNumFormatter, - sal_uInt32 nFormatKey, + sal_uInt32 nFormatKey, SvxNumberValueType eNumValType, - const String& rNumStr ) : + const OUString& rNumStr ) : pFormatter ( pNumFormatter ), pCurFmtTable ( NULL ), eValType ( eNumValType ), @@ -86,17 +86,17 @@ SvxNumberFormatShell::SvxNumberFormatShell( SvNumberFormatter* pNumFormatter, case SVX_VALUE_TYPE_NUMBER: case SVX_VALUE_TYPE_UNDEFINED: default: - aValStr.Erase(); + aValStr = ""; } } // ----------------------------------------------------------------------- SvxNumberFormatShell::SvxNumberFormatShell( SvNumberFormatter* pNumFormatter, - sal_uInt32 nFormatKey, + sal_uInt32 nFormatKey, SvxNumberValueType eNumValType, double nNumVal, - const String* pNumStr ) : + const OUString* pNumStr ) : pFormatter ( pNumFormatter ), pCurFmtTable ( NULL ), eValType ( eNumValType ), @@ -147,10 +147,6 @@ SvxNumberFormatShell::~SvxNumberFormatShell() for ( std::vector<sal_uInt32>::const_iterator it(aAddList.begin()); it != aAddList.end(); ++it ) pFormatter->DeleteEntry( *it ); } - - for ( std::vector<String*>::const_iterator it(aCurrencyFormatList.begin()); - it != aCurrencyFormatList.end(); ++it ) - delete *it; } // ----------------------------------------------------------------------- @@ -177,7 +173,7 @@ void SvxNumberFormatShell::GetUpdateData( sal_uInt32* pDelArray, const sal_uInt3 void SvxNumberFormatShell::CategoryChanged( sal_uInt16 nCatLbPos, short& rFmtSelPos, - std::vector<String*>& rFmtEntries ) + std::vector<OUString>& rFmtEntries ) { short nOldCategory = nCurCategory; PosToCategory_Impl( nCatLbPos, nCurCategory ); @@ -194,7 +190,7 @@ void SvxNumberFormatShell::CategoryChanged( sal_uInt16 nCatLbPos, void SvxNumberFormatShell::LanguageChanged( LanguageType eLangType, short& rFmtSelPos, - std::vector<String*>& rFmtEntries ) + std::vector<OUString>& rFmtEntries ) { eCurLanguage = eLangType; pCurFmtTable = &(pFormatter->ChangeCL( nCurCategory, @@ -206,8 +202,8 @@ void SvxNumberFormatShell::LanguageChanged( LanguageType eLangType, // ----------------------------------------------------------------------- void SvxNumberFormatShell::FormatChanged( sal_uInt16 nFmtLbPos, - String& rPreviewStr, - Color*& rpFontColor ) + OUString& rPreviewStr, + Color*& rpFontColor ) { if( static_cast<size_t>(nFmtLbPos) < aCurEntryList.size() ) { @@ -221,7 +217,7 @@ void SvxNumberFormatShell::FormatChanged( sal_uInt16 nFmtLbPos, { if( static_cast<size_t>(nFmtLbPos) < aCurrencyFormatList.size() ) { - MakePrevStringFromVal(*aCurrencyFormatList[nFmtLbPos], + MakePrevStringFromVal(aCurrencyFormatList[nFmtLbPos], rPreviewStr,rpFontColor,nValNum); } } @@ -229,9 +225,9 @@ void SvxNumberFormatShell::FormatChanged( sal_uInt16 nFmtLbPos, } // ----------------------------------------------------------------------- -bool SvxNumberFormatShell::AddFormat( String& rFormat, xub_StrLen& rErrPos, +bool SvxNumberFormatShell::AddFormat( OUString& rFormat, xub_StrLen& rErrPos, sal_uInt16& rCatLbSelPos, short& rFmtSelPos, - std::vector<String*>& rFmtEntries ) + std::vector<OUString>& rFmtEntries ) { bool bInserted = false; sal_uInt32 nAddKey = pFormatter->GetEntryKey( rFormat, eCurLanguage ); @@ -303,10 +299,10 @@ bool SvxNumberFormatShell::AddFormat( String& rFormat, xub_StrLen& rErrPos, // ----------------------------------------------------------------------- -bool SvxNumberFormatShell::RemoveFormat( const String& rFormat, +bool SvxNumberFormatShell::RemoveFormat( const OUString& rFormat, sal_uInt16& rCatLbSelPos, short& rFmtSelPos, - std::vector<String*>& rFmtEntries ) + std::vector<OUString>& rFmtEntries ) { sal_uInt32 nDelKey = pFormatter->GetEntryKey( rFormat, eCurLanguage ); @@ -339,7 +335,7 @@ bool SvxNumberFormatShell::RemoveFormat( const String& rFormat, // ----------------------------------------------------------------------- -void SvxNumberFormatShell::MakeFormat( String& rFormat, +void SvxNumberFormatShell::MakeFormat( OUString& rFormat, bool bThousand, bool bNegRed, sal_uInt16 nPrecision, sal_uInt16 nLeadingZeroes, sal_uInt16 nCurrencyPos) @@ -347,15 +343,15 @@ void SvxNumberFormatShell::MakeFormat( String& rFormat, if( aCurrencyFormatList.size() > static_cast<size_t>(nCurrencyPos) ) { xub_StrLen rErrPos=0; - std::vector<String*> aFmtEList; + std::vector<OUString> aFmtEList; - sal_uInt32 nFound = pFormatter->TestNewString( *aCurrencyFormatList[nCurrencyPos], eCurLanguage ); + sal_uInt32 nFound = pFormatter->TestNewString( aCurrencyFormatList[nCurrencyPos], eCurLanguage ); if ( nFound == NUMBERFORMAT_ENTRY_NOT_FOUND ) { sal_uInt16 rCatLbSelPos=0; short rFmtSelPos=0; - AddFormat( *aCurrencyFormatList[nCurrencyPos],rErrPos,rCatLbSelPos, + AddFormat( aCurrencyFormatList[nCurrencyPos],rErrPos,rCatLbSelPos, rFmtSelPos,aFmtEList); } @@ -366,8 +362,6 @@ void SvxNumberFormatShell::MakeFormat( String& rFormat, bThousand, bNegRed, nPrecision, nLeadingZeroes); } - for ( std::vector<String*>::const_iterator it(aFmtEList.begin()); it != aFmtEList.end(); ++it ) - delete *it; } else { @@ -380,7 +374,7 @@ void SvxNumberFormatShell::MakeFormat( String& rFormat, // ----------------------------------------------------------------------- -void SvxNumberFormatShell::GetOptions( const String& rFormat, +void SvxNumberFormatShell::GetOptions( const OUString& rFormat, bool& rThousand, bool& rNegRed, sal_uInt16& rPrecision, @@ -422,9 +416,9 @@ void SvxNumberFormatShell::GetOptions( const String& rFormat, // ----------------------------------------------------------------------- -void SvxNumberFormatShell::MakePreviewString( const String& rFormatStr, - String& rPreviewStr, - Color*& rpFontColor ) +void SvxNumberFormatShell::MakePreviewString( const OUString& rFormatStr, + OUString& rPreviewStr, + Color*& rpFontColor ) { rpFontColor = NULL; @@ -444,7 +438,7 @@ void SvxNumberFormatShell::MakePreviewString( const String& rFormatStr, // #50441# if a string was set in addition to the value, use it for text formats bool bUseText = ( eValType == SVX_VALUE_TYPE_STRING || - ( aValStr.Len() && ( pFormatter->GetType(nExistingFormat) & NUMBERFORMAT_TEXT ) ) ); + ( !aValStr.isEmpty() && ( pFormatter->GetType(nExistingFormat) & NUMBERFORMAT_TEXT ) ) ); if ( bUseText ) { OUString sTempIn(aValStr); @@ -466,7 +460,7 @@ void SvxNumberFormatShell::MakePreviewString( const String& rFormatStr, // ----------------------------------------------------------------------- -bool SvxNumberFormatShell::IsUserDefined( const String& rFmtString ) +bool SvxNumberFormatShell::IsUserDefined( const OUString& rFmtString ) { sal_uInt32 nFound = pFormatter->GetEntryKey( rFmtString, eCurLanguage ); @@ -492,7 +486,7 @@ bool SvxNumberFormatShell::IsUserDefined( const String& rFmtString ) // ----------------------------------------------------------------------- -bool SvxNumberFormatShell::FindEntry( const String& rFmtString, sal_uInt32* pAt /* = NULL */ ) +bool SvxNumberFormatShell::FindEntry( const OUString& rFmtString, sal_uInt32* pAt /* = NULL */ ) { bool bRes=false; sal_uInt32 nFound = pFormatter->TestNewString( rFmtString, eCurLanguage ); @@ -525,9 +519,9 @@ bool SvxNumberFormatShell::FindEntry( const String& rFmtString, sal_uInt32* pAt void SvxNumberFormatShell::GetInitSettings( sal_uInt16& nCatLbPos, LanguageType& rLangType, sal_uInt16& nFmtLbSelPos, - std::vector<String*>& rFmtEntries, - String& rPrevString, - Color*& rpPrevColor ) + std::vector<OUString>& rFmtEntries, + OUString& rPrevString, + Color*& rpPrevColor ) { // ------------------------------------------------------------------- // Vorbedingung: Zahlenformatierer gefunden @@ -562,7 +556,7 @@ void SvxNumberFormatShell::GetInitSettings( sal_uInt16& nCatLbPos, // ----------------------------------------------------------------------- -short SvxNumberFormatShell::FillEntryList_Impl( std::vector<String*>& rList ) +short SvxNumberFormatShell::FillEntryList_Impl( std::vector<OUString>& rList ) { /* Erstellen einer aktuellen Liste von Format-Eintraegen. * Rueckgabewert ist die Listenposition des aktuellen Formates. @@ -599,7 +593,7 @@ short SvxNumberFormatShell::FillEntryList_Impl( std::vector<String*>& rList ) return nSelPos; } -void SvxNumberFormatShell::FillEListWithStd_Impl( std::vector<String*>& rList, +void SvxNumberFormatShell::FillEListWithStd_Impl( std::vector<OUString>& rList, sal_uInt16 nPrivCat,short &nSelPos ) { /* Erstellen einer aktuellen Liste von Format-Eintraegen. @@ -609,9 +603,6 @@ void SvxNumberFormatShell::FillEListWithStd_Impl( std::vector<String*>& rList, */ DBG_ASSERT( pCurFmtTable != NULL, "Unbekanntes Zahlenformat!" ); - for ( std::vector<String*>::const_iterator it(aCurrencyFormatList.begin()); - it != aCurrencyFormatList.end(); ++it ) - delete *it; aCurrencyFormatList.clear(); if(nPrivCat==CAT_CURRENCY) @@ -665,7 +656,7 @@ void SvxNumberFormatShell::FillEListWithStd_Impl( std::vector<String*>& rList, } } -short SvxNumberFormatShell::FillEListWithFormats_Impl( std::vector<String*>& rList, +short SvxNumberFormatShell::FillEListWithFormats_Impl( std::vector<OUString>& rList, short nSelPos, NfIndexTableOffset eOffsetStart, NfIndexTableOffset eOffsetEnd) @@ -701,21 +692,19 @@ short SvxNumberFormatShell::FillEListWithFormats_Impl( std::vector<String*>& rLi CategoryToPos_Impl(nMyCat,nMyType); aNewFormNInfo= pNumEntry->GetFormatstring(); - String *const pStr = new String(aNewFormNInfo); - if ( nNFEntry == nCurFormatKey ) { nSelPos = ( !IsRemoved_Impl( nNFEntry ) ) ? aCurEntryList.size() : SELPOS_NONE; } - rList.push_back( pStr ); + rList.push_back( aNewFormNInfo ); aCurEntryList.push_back( nNFEntry ); } return nSelPos; } -short SvxNumberFormatShell::FillEListWithDateTime_Impl( std::vector<String*>& rList, +short SvxNumberFormatShell::FillEListWithDateTime_Impl( std::vector<OUString>& rList, short nSelPos) { sal_uInt16 nMyType; @@ -743,14 +732,12 @@ short SvxNumberFormatShell::FillEListWithDateTime_Impl( std::vector<String*>& rL CategoryToPos_Impl(nMyCat,nMyType); aNewFormNInfo= pNumEntry->GetFormatstring(); - String *const pStr = new String(aNewFormNInfo); - if ( nNFEntry == nCurFormatKey ) { nSelPos = ( !IsRemoved_Impl( nNFEntry ) ) ? aCurEntryList.size() : SELPOS_NONE; } - rList.push_back( pStr ); + rList.push_back( aNewFormNInfo ); aCurEntryList.push_back( nNFEntry ); } } @@ -758,7 +745,7 @@ short SvxNumberFormatShell::FillEListWithDateTime_Impl( std::vector<String*>& rL return nSelPos; } -short SvxNumberFormatShell::FillEListWithCurrency_Impl( std::vector<String*>& rList, +short SvxNumberFormatShell::FillEListWithCurrency_Impl( std::vector<OUString>& rList, short nSelPos) { /* Erstellen einer aktuellen Liste von Format-Eintraegen. @@ -792,7 +779,7 @@ short SvxNumberFormatShell::FillEListWithCurrency_Impl( std::vector<String*>& rL } -short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<String*>& rList, +short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<OUString>& rList, short nSelPos) { /* Erstellen einer aktuellen Liste von Format-Eintraegen. @@ -830,14 +817,12 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<String*>& rLi CategoryToPos_Impl(nMyCat,nMyType); aNewFormNInfo= pNumEntry->GetFormatstring(); - String *const pStr = new String(aNewFormNInfo); - if ( nNFEntry == nCurFormatKey ) { nSelPos = ( !IsRemoved_Impl( nNFEntry ) ) ? aCurEntryList.size() : SELPOS_NONE; } - rList.push_back( pStr ); + rList.push_back( aNewFormNInfo ); aCurEntryList.push_back( nNFEntry ); } @@ -873,10 +858,8 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<String*>& rLi CategoryToPos_Impl(nMyCat,nMyType); aNewFormNInfo= pNumEntry->GetFormatstring(); - String *const pStr = new String(aNewFormNInfo); - if ( nKey == nCurFormatKey ) nSelPos =aCurEntryList.size(); - rList.push_back( pStr ); + rList.push_back( aNewFormNInfo ); aCurEntryList.push_back( nKey ); } } @@ -886,7 +869,7 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<String*>& rLi return nSelPos; } -short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rList, +short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<OUString>& rList, short nSelPos) { /* Erstellen einer aktuellen Liste von Format-Eintraegen. @@ -907,7 +890,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL OUString rSymbol; OUString rBankSymbol; - std::vector<String*> aList; + std::vector<OUString> aList; std::vector<sal_uInt32> aKeyList; pFormatter->GetNewCurrencySymbolString(nCurFormatKey,rSymbol, @@ -992,7 +975,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL if(bInsFlag) { - aList.push_back( new String(aNewFormNInfo) ); + aList.push_back( aNewFormNInfo ); aKeyList.push_back( nKey ); } } @@ -1036,9 +1019,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL size_t j; for( j=0; j < aList.size(); ++j ) { - const String * pTestStr=aList[j]; - - if(*pTestStr==aInsStr) + if(aList[j]==aInsStr) { bFlag = false; break; @@ -1046,7 +1027,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL } if(bFlag) { - rList.push_back( new String(aInsStr) ); + rList.push_back( aInsStr ); aCurEntryList.insert( aCurEntryList.begin() + (nPos++), NUMBERFORMAT_ENTRY_NOT_FOUND); } else @@ -1069,7 +1050,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL for( size_t i = nOldListCount; i < rList.size(); ++i ) { - aCurrencyFormatList.push_back( new String(*rList[i]) ); + aCurrencyFormatList.push_back( rList[i] ); if ( nSelPos == SELPOS_NONE && bAdaptSelPos && aCurEntryList[i] == nCurFormatKey ) nSelPos = i; @@ -1082,7 +1063,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<String*>& rL } -short SvxNumberFormatShell::FillEListWithUsD_Impl( std::vector<String*>& rList, +short SvxNumberFormatShell::FillEListWithUsD_Impl( std::vector<OUString>& rList, sal_uInt16 nPrivCat, short nSelPos ) { /* Erstellen einer aktuellen Liste von Format-Eintraegen. @@ -1126,10 +1107,8 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( std::vector<String*>& rList, } if(bFlag) { - String *const pStr = new String(aNewFormNInfo); - if ( nKey == nCurFormatKey ) nSelPos = aCurEntryList.size(); - rList.push_back( pStr ); + rList.push_back( aNewFormNInfo ); aCurEntryList.push_back( nKey ); } } @@ -1142,13 +1121,13 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( std::vector<String*>& rList, // ----------------------------------------------------------------------- -void SvxNumberFormatShell::GetPreviewString_Impl( String& rString, Color*& rpColor ) +void SvxNumberFormatShell::GetPreviewString_Impl( OUString& rString, Color*& rpColor ) { rpColor = NULL; // #50441# if a string was set in addition to the value, use it for text formats bool bUseText = ( eValType == SVX_VALUE_TYPE_STRING || - ( aValStr.Len() && ( pFormatter->GetType(nCurFormatKey) & NUMBERFORMAT_TEXT ) ) ); + ( !aValStr.isEmpty() && ( pFormatter->GetType(nCurFormatKey) & NUMBERFORMAT_TEXT ) ) ); if ( bUseText ) { @@ -1258,8 +1237,8 @@ void SvxNumberFormatShell::CategoryToPos_Impl( short nCategory, sal_uInt16& rPos #************************************************************************/ void SvxNumberFormatShell::MakePrevStringFromVal( - const String& rFormatStr, - String& rPreviewStr, + const OUString& rFormatStr, + OUString& rPreviewStr, Color*& rpFontColor, double nValue) { @@ -1308,10 +1287,10 @@ void SvxNumberFormatShell::SetComment4Entry(short nEntry,String aEntStr) #* #************************************************************************/ -String SvxNumberFormatShell::GetComment4Entry(short nEntry) +OUString SvxNumberFormatShell::GetComment4Entry(short nEntry) { if(nEntry < 0) - return String(); + return OUString(); if( static_cast<size_t>(nEntry) < aCurEntryList.size()) { @@ -1321,7 +1300,7 @@ String SvxNumberFormatShell::GetComment4Entry(short nEntry) return pNumEntry->GetComment(); } - return String(); + return OUString(); } /************************************************************************* @@ -1420,15 +1399,15 @@ bool SvxNumberFormatShell::GetUserDefined4Entry(short nEntry) #* #************************************************************************/ -String SvxNumberFormatShell::GetFormat4Entry(short nEntry) +OUString SvxNumberFormatShell::GetFormat4Entry(short nEntry) { if(nEntry < 0) - return String(); + return OUString(); if( !aCurrencyFormatList.empty() ) { if( aCurrencyFormatList.size() > static_cast<size_t>(nEntry) ) - return *aCurrencyFormatList[nEntry]; + return aCurrencyFormatList[nEntry]; } else { @@ -1438,7 +1417,7 @@ String SvxNumberFormatShell::GetFormat4Entry(short nEntry) if(pNumEntry!=NULL) return pNumEntry->GetFormatstring(); } - return String(); + return OUString(); } /************************************************************************* @@ -1479,7 +1458,7 @@ short SvxNumberFormatShell::GetListPos4Entry(sal_uInt32 nIdx) return nSelP; } -short SvxNumberFormatShell::GetListPos4Entry( const String& rFmtString ) +short SvxNumberFormatShell::GetListPos4Entry( const OUString& rFmtString ) { sal_uInt32 nAt=0; short nSelP=SELPOS_NONE; @@ -1493,7 +1472,7 @@ short SvxNumberFormatShell::GetListPos4Entry( const String& rFmtString ) { for( size_t i=0; i<aCurrencyFormatList.size(); i++ ) { - if (rFmtString==*aCurrencyFormatList[i]) + if (rFmtString==aCurrencyFormatList[i]) { nSelP = static_cast<short>(i); break; @@ -1504,7 +1483,7 @@ short SvxNumberFormatShell::GetListPos4Entry( const String& rFmtString ) return nSelP; } -String SvxNumberFormatShell::GetStandardName() const +OUString SvxNumberFormatShell::GetStandardName() const { return pFormatter->GetStandardName( eCurLanguage); } @@ -1659,7 +1638,7 @@ void SvxNumberFormatShell::SetCurCurrencyEntry(NfCurrencyEntry* pCEntry) pCurCurrencyEntry=pCEntry; } -bool SvxNumberFormatShell::IsTmpCurrencyFormat( const String& rFmtString ) +bool SvxNumberFormatShell::IsTmpCurrencyFormat( const OUString& rFmtString ) { sal_uInt32 nFound; FindEntry(rFmtString, &nFound); @@ -1671,7 +1650,7 @@ bool SvxNumberFormatShell::IsTmpCurrencyFormat( const String& rFmtString ) return false; } -sal_uInt16 SvxNumberFormatShell::FindCurrencyFormat( const String& rFmtString ) +sal_uInt16 SvxNumberFormatShell::FindCurrencyFormat( const OUString& rFmtString ) { const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable(); sal_uInt16 nCount=rCurrencyTable.size(); @@ -1695,7 +1674,7 @@ sal_uInt16 SvxNumberFormatShell::FindCurrencyFormat( const String& rFmtString ) return (sal_uInt16) -1; } -sal_uInt16 SvxNumberFormatShell::FindCurrencyTableEntry( const String& rFmtString, bool &bTestBanking ) +sal_uInt16 SvxNumberFormatShell::FindCurrencyTableEntry( const OUString& rFmtString, bool &bTestBanking ) { sal_uInt16 nPos=(sal_uInt16) -1; @@ -1732,13 +1711,13 @@ sal_uInt16 SvxNumberFormatShell::FindCurrencyTableEntry( const String& rFmtStrin OUString _aSymbol = pTmpCurrencyEntry->BuildSymbolString(false); OUString aBankSymbol = pTmpCurrencyEntry->BuildSymbolString(true); - if(rFmtString.Search(_aSymbol)!=STRING_NOTFOUND) + if(rFmtString.indexOf(_aSymbol) != -1) { bTestBanking=false; nPos=i; break; } - else if(rFmtString.Search(aBankSymbol)!=STRING_NOTFOUND) + else if(rFmtString.indexOf(aBankSymbol) != -1) { bTestBanking=true; nPos=i; |