cui/source/inc/autocdlg.hxx | 4 --- cui/source/tabpages/autocdlg.cxx | 25 ++++++------------- cui/source/tabpages/numfmt.cxx | 11 +++----- svl/inc/svl/svstdarr.hxx | 5 --- svl/source/memtools/svarray.cxx | 48 ------------------------------------- svx/inc/svx/numfmtsh.hxx | 4 +-- svx/source/items/numfmtsh.cxx | 50 ++++++++++++++++----------------------- 7 files changed, 37 insertions(+), 110 deletions(-)
New commits: commit 9556b3847edb9223db7c65614b49e10d4566b712 Author: August Sodora <aug...@gmail.com> Date: Wed Jan 11 18:01:02 2012 -0500 Remove SvStringISort diff --git a/svl/inc/svl/svstdarr.hxx b/svl/inc/svl/svstdarr.hxx index 1d1b6e8..1533e47 100644 --- a/svl/inc/svl/svstdarr.hxx +++ b/svl/inc/svl/svstdarr.hxx @@ -50,11 +50,6 @@ SV_DECL_PTRARR_DEL_VISIBILITY( SvStringsDtor, StringPtr, 1, 1, SVL_DLLPUBLIC ) #define _SVSTDARR_STRINGSDTOR_DECL #endif -#ifndef _SVSTDARR_STRINGSISORT_DECL -SV_DECL_PTRARR_SORT_VISIBILITY( SvStringsISort, StringPtr, 1, 1, SVL_DLLPUBLIC ) -#define _SVSTDARR_STRINGSISORT_DECL -#endif - #ifndef _SVSTDARR_STRINGSISORTDTOR_DECL SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvStringsISortDtor, StringPtr, 1, 1, SVL_DLLPUBLIC ) #define _SVSTDARR_STRINGSISORTDTOR_DECL diff --git a/svl/source/memtools/svarray.cxx b/svl/source/memtools/svarray.cxx index 52f3f0c..a8bbb68 100644 --- a/svl/source/memtools/svarray.cxx +++ b/svl/source/memtools/svarray.cxx @@ -28,7 +28,6 @@ #define _SVSTDARR_STRINGSDTOR #define _SVSTDARR_STRINGSSORTDTOR -#define _SVSTDARR_STRINGSISORT #include <svl/svstdarr.hxx> #include <tools/debug.hxx> @@ -46,53 +45,6 @@ SV_IMPL_PTRARR( SvStringsDtor, StringPtr ) // ---------------- strings ------------------------------------- // Array with different Seek method -_SV_IMPL_SORTAR_ALG( SvStringsISort, StringPtr ) -void SvStringsISort::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL ) -{ - if( nL ) - { - DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" ); - for( sal_uInt16 n=nP; n < nP + nL; n++ ) - delete *((StringPtr*)pData+n); - SvPtrarr::Remove( nP, nL ); - } -} -sal_Bool SvStringsISort::Seek_Entry( const StringPtr aE, sal_uInt16* pP ) const -{ - register sal_uInt16 nO = SvStringsISort_SAR::Count(), - nM, - nU = 0; - if( nO > 0 ) - { - nO--; - while( nU <= nO ) - { - nM = nU + ( nO - nU ) / 2; - StringCompare eCmp = (*((StringPtr*)pData + nM))-> - CompareIgnoreCaseToAscii( *(aE) ); - if( COMPARE_EQUAL == eCmp ) - { - if( pP ) *pP = nM; - return sal_True; - } - else if( COMPARE_LESS == eCmp ) - nU = nM + 1; - else if( nM == 0 ) - { - if( pP ) *pP = nU; - return sal_False; - } - else - nO = nM - 1; - } - } - if( pP ) *pP = nU; - return sal_False; -} - -// ---------------- strings ------------------------------------- - -// Array with different Seek method _SV_IMPL_SORTAR_ALG( SvStringsISortDtor, StringPtr ) void SvStringsISortDtor::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL ) { commit 4497c499d2b57095a2dbeb592dce3b5067f417c9 Author: August Sodora <aug...@gmail.com> Date: Wed Jan 11 14:02:02 2012 -0500 SvStringsISort->std::set diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx index a22d7b3..3043739 100644 --- a/cui/source/inc/autocdlg.hxx +++ b/cui/source/inc/autocdlg.hxx @@ -67,8 +67,6 @@ public: #include <svtools/svtabbx.hxx> #include <svx/simptabl.hxx> -class SvStringsISortDtor; - // class OfaACorrCheckListBox ------------------------------------------ class OfaACorrCheckListBox : public SvxSimpleTable @@ -240,7 +238,7 @@ private: String sModify; String sNew; - SvStringsISortDtor* pFormatText; + std::set<rtl::OUString> aFormatText; DoubleStringTable aDoubleStringTable; CollatorWrapper* pCompareClass; CharClass* pCharClass; diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index 48eb935..a0ce04b 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -960,7 +960,6 @@ OfaAutocorrReplacePage::OfaAutocorrReplacePage( Window* pParent, aDeleteReplacePB(this,CUI_RES(PB_DELETE_REPLACE )), sModify(CUI_RES(STR_MODIFY)), sNew(aNewReplacePB.GetText()), - pFormatText(0), eLang(eLastDialogLanguage), bHasSelectionText(sal_False), bFirstSelect(sal_True), @@ -995,7 +994,6 @@ OfaAutocorrReplacePage::OfaAutocorrReplacePage( Window* pParent, OfaAutocorrReplacePage::~OfaAutocorrReplacePage() { - delete pFormatText; lcl_ClearTable(aDoubleStringTable); delete pCompareClass; delete pCharClass; @@ -1187,12 +1185,7 @@ void OfaAutocorrReplacePage::RefillReplaceBox(sal_Bool bFromReset, aReplaceTLB.Clear(); if(!bSWriter) - { - if(pFormatText) - pFormatText->DeleteAndDestroy(0, pFormatText->Count()); - else - pFormatText = new SvStringsISortDtor(); - } + aFormatText.clear(); if(aDoubleStringTable.IsKeyValid(eLang)) { @@ -1213,9 +1206,7 @@ void OfaAutocorrReplacePage::RefillReplaceBox(sal_Bool bFromReset, pEntry->SetUserData(pDouble->pUserData); // Das heisst: mit Formatinfo oder sogar mit Selektionstext } else - { - pFormatText->Insert(new String(pDouble->sShort)); - } + aFormatText.insert(pDouble->sShort); } } else @@ -1239,9 +1230,7 @@ void OfaAutocorrReplacePage::RefillReplaceBox(sal_Bool bFromReset, pEntry->SetUserData(&aTextOnlyCB); // Das heisst: mit Formatinfo } else - { - pFormatText->Insert(new String(pWordPtr->GetShort())); - } + aFormatText.insert(pWordPtr->GetShort()); } aNewReplacePB.Enable(sal_False); aDeleteReplacePB.Enable(sal_False); @@ -1452,14 +1441,16 @@ IMPL_LINK(OfaAutocorrReplacePage, ModifyHdl, Edit*, pEdt) ( bHasSelectionText && bSWriter )) && ( !pFirstSel || rRepString != aReplaceTLB.GetEntryText( pFirstSel, 1 ) ); - if(bEnableNew && pFormatText) + if(bEnableNew) { - for(sal_uInt16 i = 0; i < pFormatText->Count(); i++) - if(*pFormatText->GetObject(i) == rShortTxt) + for(std::set<rtl::OUString>::iterator i = aFormatText.begin(); i != aFormatText.end(); ++i) + { + if((*i).equals(rShortTxt)) { bEnableNew = sal_False; break; } + } } aNewReplacePB.Enable(bEnableNew); commit a140141e272854110e2e164be69c35839631a0e0 Author: August Sodora <aug...@gmail.com> Date: Wed Jan 11 10:47:56 2012 -0500 SvStringsDtor->std::vector diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index be12b14..3507644 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -1730,15 +1730,14 @@ void SvxNumberFormatTabPage::SetOkHdl( const Link& rOkHandler ) void SvxNumberFormatTabPage::FillCurrencyBox() { - SvStringsDtor aList; + std::vector<rtl::OUString> aList; + sal_uInt16 nSelPos=0; + pNumFmtShell->GetCurrencySymbols(aList, &nSelPos); - pNumFmtShell->GetCurrencySymbols( aList, &nSelPos); + for(std::vector<rtl::OUString>::iterator i = aList.begin() + 1;i != aList.end(); ++i) + aLbCurrency.InsertEntry(*i); - for(sal_uInt16 i=1;i<aList.Count();i++) - { - aLbCurrency.InsertEntry( *aList[i] ); - } aLbCurrency.SelectEntryPos(nSelPos); } diff --git a/svx/inc/svx/numfmtsh.hxx b/svx/inc/svx/numfmtsh.hxx index a2425a4..3ae23f4 100644 --- a/svx/inc/svx/numfmtsh.hxx +++ b/svx/inc/svx/numfmtsh.hxx @@ -190,8 +190,8 @@ public: short GetListPos4Entry(sal_uInt32 nIdx); short GetListPos4Entry( const String& rFmtString ); - void GetCurrencySymbols( SvStringsDtor& rList, sal_uInt16* pPos ); - void GetCurrencySymbols( SvStringsDtor& rList, bool bFlag ); + void GetCurrencySymbols(std::vector<rtl::OUString>& rList, sal_uInt16* pPos ); + void GetCurrencySymbols(std::vector<rtl::OUString>& rList, bool bFlag ); sal_uInt16 FindCurrencyTableEntry( const String& rFmtString, bool &bTestBanking ); bool IsInTable(sal_uInt16 nPos,bool bTmpBanking,const String &rFmtString); diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index 9736e97..c76f7a4 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -1500,14 +1500,13 @@ String SvxNumberFormatShell::GetStandardName() const return pFormatter->GetStandardName( eCurLanguage); } -void SvxNumberFormatShell::GetCurrencySymbols( SvStringsDtor& rList, sal_uInt16* pPos ) +void SvxNumberFormatShell::GetCurrencySymbols(std::vector<rtl::OUString>& rList, sal_uInt16* pPos) { - const NfCurrencyEntry* pTmpCurrencyEntry=SvNumberFormatter::MatchSystemCurrency(); bool bFlag=(pTmpCurrencyEntry==NULL); - GetCurrencySymbols( rList, bFlag); + GetCurrencySymbols(rList, bFlag); if(pPos!=NULL) { @@ -1540,7 +1539,7 @@ void SvxNumberFormatShell::GetCurrencySymbols( SvStringsDtor& rList, sal_uInt16* } -void SvxNumberFormatShell::GetCurrencySymbols( SvStringsDtor& rList, bool bFlag ) +void SvxNumberFormatShell::GetCurrencySymbols(std::vector<rtl::OUString>& rList, bool bFlag) { aCurCurrencyList.clear(); @@ -1550,21 +1549,18 @@ void SvxNumberFormatShell::GetCurrencySymbols( SvStringsDtor& rList, bool bFlag SvtLanguageTable* pLanguageTable=new SvtLanguageTable; sal_uInt16 nStart=1; - sal_uInt16 i,j; XubString aString( ApplyLreOrRleEmbedding( rCurrencyTable[0]->GetSymbol())); aString += sal_Unicode(' '); aString += ApplyLreOrRleEmbedding( pLanguageTable->GetString( rCurrencyTable[0]->GetLanguage())); - WSStringPtr pStr = new XubString(aString); - rList.Insert( pStr,rList.Count()); + rList.push_back(aString); sal_uInt16 nAuto=(sal_uInt16)-1; aCurCurrencyList.push_back(nAuto); if(bFlag) { - pStr = new XubString(aString); - rList.Insert( pStr,rList.Count()); + rList.push_back(aString); aCurCurrencyList.push_back(0); ++nStart; } @@ -1574,7 +1570,7 @@ void SvxNumberFormatShell::GetCurrencySymbols( SvStringsDtor& rList, bool bFlag const String aTwoSpace( RTL_CONSTASCII_USTRINGPARAM( " ")); - for(i=1;i<nCount;i++) + for(sal_uInt16 i = 1; i < nCount; ++i) { XubString aStr( ApplyLreOrRleEmbedding( rCurrencyTable[i]->GetBankSymbol())); aStr += aTwoSpace; @@ -1582,40 +1578,36 @@ void SvxNumberFormatShell::GetCurrencySymbols( SvStringsDtor& rList, bool bFlag aStr += aTwoSpace; aStr += ApplyLreOrRleEmbedding( pLanguageTable->GetString( rCurrencyTable[i]->GetLanguage())); - pStr = new XubString(aStr); - for(j=nStart;j<rList.Count();j++) - { - const StringPtr pTestStr=rList[j]; - if (aCollator.compareString( *pStr, *pTestStr) < 0) + sal_uInt16 j = nStart; + for(; j < rList.size(); ++j) + if (aCollator.compareString(aStr, rList[j]) < 0) break; // insert before first greater than - } - rList.Insert( pStr,j); - aCurCurrencyList.insert(aCurCurrencyList.begin()+j, i); + + rList.insert(rList.begin() + j, aStr); + aCurCurrencyList.insert(aCurCurrencyList.begin() + j, i); } // Append ISO codes to symbol list. // XXX If this is to be changed, various other places would had to be // adapted that assume this order! - sal_uInt16 nCont = rList.Count(); + sal_uInt16 nCont = rList.size(); - for(i=1;i<nCount;i++) + for(sal_uInt16 i = 1; i < nCount; ++i) { bool bInsert = true; - pStr = new XubString( ApplyLreOrRleEmbedding( rCurrencyTable[i]->GetBankSymbol())); + rtl::OUString aStr(ApplyLreOrRleEmbedding(rCurrencyTable[i]->GetBankSymbol())); - for (j = nCont; j < rList.Count() && bInsert; ++j) + sal_uInt16 j = nCont; + for(; j < rList.size() && bInsert; ++j) { - const StringPtr pTestStr=rList[j]; - - if(*pTestStr==*pStr) + if(rList[j] == aStr) bInsert = false; - else - if (aCollator.compareString( *pStr, *pTestStr) < 0) - break; // insert before first greater than + else if (aCollator.compareString(aStr, rList[j]) < 0) + break; // insert before first greater than } if(bInsert) { - rList.Insert( pStr,j); + rList.insert(rList.begin() + j, aStr); aCurCurrencyList.insert(aCurCurrencyList.begin()+j, i); } } _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits