diff options
author | Noel Grandin <noel@peralex.com> | 2012-05-09 14:24:47 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-05-14 19:49:15 +0200 |
commit | 60473b5ecaa4aceef876b54c2134c4da294217e5 (patch) | |
tree | e31b15e3f44cc0d5d735804a738305c753dfb8b5 /sw | |
parent | b16ce6e60ffcfea13f025b2cee0011be76f42023 (diff) |
Convert SV_DECL_PTRARR_DEL(_SwTableAutoFmtTbl) to boost::ptr_vector
Change-Id: I1c92f9d77723979a9d16e9114282dec8d3566de6
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/tblafmt.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/doc/tblafmt.cxx | 15 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/dbui/dbinsdlg.cxx | 9 | ||||
-rw-r--r-- | sw/source/ui/shells/basesh.cxx | 10 | ||||
-rw-r--r-- | sw/source/ui/table/tautofmt.cxx | 48 |
6 files changed, 42 insertions, 49 deletions
diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx index 5ea37b523c96..a185c0fc8914 100644 --- a/sw/inc/tblafmt.hxx +++ b/sw/inc/tblafmt.hxx @@ -305,8 +305,7 @@ public: sal_Bool Save( SvStream& rStream, sal_uInt16 fileVersion ) const; }; -typedef SwTableAutoFmt* SwTableAutoFmtPtr ; -SV_DECL_PTRARR_DEL( _SwTableAutoFmtTbl, SwTableAutoFmtPtr, 1 ) +typedef boost::ptr_vector<SwTableAutoFmt> _SwTableAutoFmtTbl; class SW_DLLPUBLIC SwTableAutoFmtTbl : public _SwTableAutoFmtTbl { diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index db8d7cb94797..747863d8b869 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -97,9 +97,6 @@ SwBoxAutoFmt* SwTableAutoFmt::pDfltBoxAutoFmt = 0; #define sAutoTblFmtName "autotbl.fmt" -// SwTable AutoFormat Table -SV_IMPL_PTRARR( _SwTableAutoFmtTbl, SwTableAutoFmt* ) - namespace { /// Begins a writer-specific data block. Call before serializing any writer-specific properties. @@ -1084,7 +1081,7 @@ SwTableAutoFmtTbl::SwTableAutoFmtTbl() ((SwBoxAutoFmt&)pNew->GetBoxFmt( i )).SetBox( aBox ); } - Insert( pNew, Count() ); + push_back( pNew ); } sal_Bool SwTableAutoFmtTbl::Load() @@ -1164,7 +1161,7 @@ sal_Bool SwTableAutoFmtTbl::Load( SvStream& rStream ) bRet = pNew->Load( rStream, aVersions ); if( bRet ) { - Insert( pNew, Count() ); + push_back( pNew ); } else { @@ -1199,14 +1196,14 @@ sal_Bool SwTableAutoFmtTbl::Save( SvStream& rStream ) const bRet = 0 == rStream.GetError(); // Write this version number for all attributes - (*this)[ 0 ]->GetBoxFmt( 0 ).SaveVersionNo( rStream, AUTOFORMAT_FILE_VERSION ); + (*this)[ 0 ].GetBoxFmt( 0 ).SaveVersionNo( rStream, AUTOFORMAT_FILE_VERSION ); - rStream << (sal_uInt16)(Count() - 1); + rStream << (sal_uInt16)(size() - 1); bRet = 0 == rStream.GetError(); - for( sal_uInt16 i = 1; bRet && i < Count(); ++i ) + for( sal_uInt16 i = 1; bRet && i < size(); ++i ) { - SwTableAutoFmt* pFmt = (*this)[ i ]; + const SwTableAutoFmt* pFmt = &(*this)[ i ]; bRet = pFmt->Save( rStream, AUTOFORMAT_FILE_VERSION ); } } diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index f0099aa0a639..da7dacec0112 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -2966,8 +2966,8 @@ void SwXTextTable::autoFormat(const OUString& aName) throw( lang::IllegalArgumen String sAutoFmtName(aName); SwTableAutoFmtTbl aAutoFmtTbl; aAutoFmtTbl.Load(); - for( sal_uInt16 i = aAutoFmtTbl.Count(); i; ) - if( sAutoFmtName == aAutoFmtTbl[ --i ]->GetName() ) + for( sal_uInt16 i = aAutoFmtTbl.size(); i; ) + if( sAutoFmtName == aAutoFmtTbl[ --i ].GetName() ) { SwSelBoxes aBoxes; const SwTableSortBoxes& rTBoxes = pTable->GetTabSortBoxes(); @@ -2977,7 +2977,7 @@ void SwXTextTable::autoFormat(const OUString& aName) throw( lang::IllegalArgumen aBoxes.Insert( pBox ); } UnoActionContext aContext( pFmt->GetDoc() ); - pFmt->GetDoc()->SetTableAutoFmt( aBoxes, *aAutoFmtTbl[i] ); + pFmt->GetDoc()->SetTableAutoFmt( aBoxes, aAutoFmtTbl[i] ); break; } } diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 0151f0f58a45..6a640587265b 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -120,9 +120,6 @@ using namespace ::com::sun::star::sdbc; using namespace ::com::sun::star::sdbcx; using namespace ::com::sun::star::beans; -// tblafmt.hxx -SV_IMPL_PTRARR( _SwTableAutoFmtTbl, SwTableAutoFmt* ) - const char cDBFldStart = '<'; const char cDBFldEnd = '>'; @@ -1830,10 +1827,10 @@ void SwInsertDBColAutoPilot::Load() // then load the AutoFmt file and look for Autoformat first SwTableAutoFmtTbl aAutoFmtTbl; aAutoFmtTbl.Load(); - for( sal_uInt16 nAutoFmt = aAutoFmtTbl.Count(); nAutoFmt; ) - if( sTmp == aAutoFmtTbl[ --nAutoFmt ]->GetName() ) + for( sal_uInt16 nAutoFmt = aAutoFmtTbl.size(); nAutoFmt; ) + if( sTmp == aAutoFmtTbl[ --nAutoFmt ].GetName() ) { - pTAutoFmt = new SwTableAutoFmt( *aAutoFmtTbl[ nAutoFmt ] ); + pTAutoFmt = new SwTableAutoFmt( aAutoFmtTbl[ nAutoFmt ] ); break; } } diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index 0246d905df69..c0c2c4f915d8 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -804,9 +804,9 @@ void SwBaseShell::Execute(SfxRequest &rReq) pAutoFmtTbl = new SwTableAutoFmtTbl; pAutoFmtTbl->Load(); - for( sal_uInt16 i = 0, nCount = pAutoFmtTbl->Count(); i < nCount; i++ ) + for( sal_uInt16 i = 0, nCount = pAutoFmtTbl->size(); i < nCount; i++ ) { - SwTableAutoFmt* pFmt = (*pAutoFmtTbl)[ i ]; + SwTableAutoFmt* pFmt = &(*pAutoFmtTbl)[ i ]; if( pFmt->GetName() == sAutoFmt ) { pTAFmt = pFmt; @@ -2598,11 +2598,11 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest ) { SwTableAutoFmtTbl aTableTbl; aTableTbl.Load(); - for ( sal_uInt16 n=0; n<aTableTbl.Count(); n++ ) + for ( sal_uInt16 n=0; n<aTableTbl.size(); n++ ) { - if ( aTableTbl[n]->GetName() == aAutoName ) + if ( aTableTbl[n].GetName() == aAutoName ) { - pTAFmt = new SwTableAutoFmt( *aTableTbl[n] ); + pTAFmt = new SwTableAutoFmt( aTableTbl[n] ); break; } } diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx index efe3c9135253..98c0fd48c334 100644 --- a/sw/source/ui/table/tautofmt.cxx +++ b/sw/source/ui/table/tautofmt.cxx @@ -259,9 +259,9 @@ void SwAutoFormatDlg::Init( const SwTableAutoFmt* pSelFmt ) nIndex = 255; } - for( sal_uInt8 i = 0, nCount = (sal_uInt8)pTableTbl->Count(); i < nCount; i++ ) + for( sal_uInt8 i = 0, nCount = (sal_uInt8)pTableTbl->size(); i < nCount; i++ ) { - SwTableAutoFmt* pFmt = (*pTableTbl)[ i ]; + SwTableAutoFmt* pFmt = &(*pTableTbl)[ i ]; aLbFormat.InsertEntry( pFmt->GetName() ); if( pSelFmt && pFmt->GetName() == pSelFmt->GetName() ) nIndex = i; @@ -297,9 +297,9 @@ void SwAutoFormatDlg::FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const if( 255 != nIndex ) { if( rToFill ) - *rToFill = *(*pTableTbl)[ nIndex ]; + *rToFill = (*pTableTbl)[ nIndex ]; else - rToFill = new SwTableAutoFmt( *(*pTableTbl)[ nIndex ] ); + rToFill = new SwTableAutoFmt( (*pTableTbl)[ nIndex ] ); } else delete rToFill, rToFill = 0; @@ -313,7 +313,7 @@ void SwAutoFormatDlg::FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const IMPL_LINK( SwAutoFormatDlg, CheckHdl, Button *, pBtn ) { - SwTableAutoFmtPtr pData = (*pTableTbl)[nIndex]; + SwTableAutoFmt* pData = &(*pTableTbl)[nIndex]; sal_Bool bCheck = ((CheckBox*)pBtn)->IsChecked(), bDataChgd = sal_True; if( pBtn == &aBtnNumFormat ) @@ -362,24 +362,24 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, AddHdl) if( aFormatName.Len() > 0 ) { sal_uInt16 n; - for( n = 0; n < pTableTbl->Count(); ++n ) - if( (*pTableTbl)[n]->GetName() == aFormatName ) + for( n = 0; n < pTableTbl->size(); ++n ) + if( (*pTableTbl)[n].GetName() == aFormatName ) break; - if( n >= pTableTbl->Count() ) + if( n >= pTableTbl->size() ) { // Format mit dem Namen noch nicht vorhanden, also // aufnehmen - SwTableAutoFmtPtr pNewData = new + SwTableAutoFmt* pNewData = new SwTableAutoFmt( aFormatName ); pShell->GetTableAutoFmt( *pNewData ); // Sortiert einfuegen!! - for( n = 1; n < pTableTbl->Count(); ++n ) - if( (*pTableTbl)[ n ]->GetName() > aFormatName ) + for( n = 1; n < pTableTbl->size(); ++n ) + if( (*pTableTbl)[ n ].GetName() > aFormatName ) break; - pTableTbl->Insert( pNewData, n ); + pTableTbl->insert( pTableTbl->begin() + n, pNewData ); aLbFormat.InsertEntry( aFormatName, nDfltStylePos + n ); aLbFormat.SelectEntryPos( nDfltStylePos + n ); bFmtInserted = sal_True; @@ -427,7 +427,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RemoveHdl) aLbFormat.RemoveEntry( nDfltStylePos + nIndex ); aLbFormat.SelectEntryPos( nDfltStylePos + nIndex-1 ); - pTableTbl->DeleteAndDestroy( nIndex ); + pTableTbl->erase( pTableTbl->begin() + nIndex ); nIndex--; if( !nIndex ) @@ -466,27 +466,27 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl) if ( aFormatName.Len() > 0 ) { sal_uInt16 n; - for( n = 0; n < pTableTbl->Count(); ++n ) - if ((*pTableTbl)[n]->GetName() == aFormatName) + for( n = 0; n < pTableTbl->size(); ++n ) + if ((*pTableTbl)[n].GetName() == aFormatName) break; - if( n >= pTableTbl->Count() ) + if( n >= pTableTbl->size() ) { // Format mit dem Namen noch nicht vorhanden, also // umbenennen aLbFormat.RemoveEntry( nDfltStylePos + nIndex ); - SwTableAutoFmtPtr p = (*pTableTbl)[ nIndex ]; - pTableTbl->Remove( nIndex ); + SwTableAutoFmt* p = &(*pTableTbl)[ nIndex ]; + pTableTbl->erase( pTableTbl->begin() + nIndex ); p->SetName( aFormatName ); // Sortiert einfuegen!! - for( n = 1; n < pTableTbl->Count(); ++n ) - if( (*pTableTbl)[ n ]->GetName() > aFormatName ) + for( n = 1; n < pTableTbl->size(); ++n ) + if( (*pTableTbl)[ n ].GetName() > aFormatName ) break; - pTableTbl->Insert( p, n ); + pTableTbl->insert( pTableTbl->begin() + n, p ); aLbFormat.InsertEntry( aFormatName, nDfltStylePos + n ); aLbFormat.SelectEntryPos( nDfltStylePos + n ); @@ -526,9 +526,9 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, SelFmtHdl) if( nSelPos >= nDfltStylePos ) { nIndex = nSelPos - nDfltStylePos; - pWndPreview->NotifyChange( *(*pTableTbl)[nIndex] ); + pWndPreview->NotifyChange( (*pTableTbl)[nIndex] ); bBtnEnable = 0 != nIndex; - UpdateChecks( *(*pTableTbl)[nIndex], sal_True ); + UpdateChecks( (*pTableTbl)[nIndex], sal_True ); } else { @@ -557,7 +557,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, SelFmtHdl) IMPL_LINK_NOARG_INLINE_START(SwAutoFormatDlg, OkHdl) { if( bSetAutoFmt ) - pShell->SetTableAutoFmt( *(*pTableTbl)[ nIndex ] ); + pShell->SetTableAutoFmt( (*pTableTbl)[ nIndex ] ); EndDialog( RET_OK ); return sal_True; } |