Convert SV_DECL_PTRARR_DEL(_SwTableAutoFmtTbl) to boost::ptr_vector
Change-Id: I1c92f9d77723979a9d16e9114282dec8d3566de6
This commit is contained in:
committed by
Michael Stahl
parent
b16ce6e60f
commit
60473b5eca
@@ -305,8 +305,7 @@ public:
|
|||||||
sal_Bool Save( SvStream& rStream, sal_uInt16 fileVersion ) const;
|
sal_Bool Save( SvStream& rStream, sal_uInt16 fileVersion ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SwTableAutoFmt* SwTableAutoFmtPtr ;
|
typedef boost::ptr_vector<SwTableAutoFmt> _SwTableAutoFmtTbl;
|
||||||
SV_DECL_PTRARR_DEL( _SwTableAutoFmtTbl, SwTableAutoFmtPtr, 1 )
|
|
||||||
|
|
||||||
class SW_DLLPUBLIC SwTableAutoFmtTbl : public _SwTableAutoFmtTbl
|
class SW_DLLPUBLIC SwTableAutoFmtTbl : public _SwTableAutoFmtTbl
|
||||||
{
|
{
|
||||||
|
@@ -97,9 +97,6 @@ SwBoxAutoFmt* SwTableAutoFmt::pDfltBoxAutoFmt = 0;
|
|||||||
|
|
||||||
#define sAutoTblFmtName "autotbl.fmt"
|
#define sAutoTblFmtName "autotbl.fmt"
|
||||||
|
|
||||||
// SwTable AutoFormat Table
|
|
||||||
SV_IMPL_PTRARR( _SwTableAutoFmtTbl, SwTableAutoFmt* )
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
/// Begins a writer-specific data block. Call before serializing any writer-specific properties.
|
/// 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 );
|
((SwBoxAutoFmt&)pNew->GetBoxFmt( i )).SetBox( aBox );
|
||||||
}
|
}
|
||||||
|
|
||||||
Insert( pNew, Count() );
|
push_back( pNew );
|
||||||
}
|
}
|
||||||
|
|
||||||
sal_Bool SwTableAutoFmtTbl::Load()
|
sal_Bool SwTableAutoFmtTbl::Load()
|
||||||
@@ -1164,7 +1161,7 @@ sal_Bool SwTableAutoFmtTbl::Load( SvStream& rStream )
|
|||||||
bRet = pNew->Load( rStream, aVersions );
|
bRet = pNew->Load( rStream, aVersions );
|
||||||
if( bRet )
|
if( bRet )
|
||||||
{
|
{
|
||||||
Insert( pNew, Count() );
|
push_back( pNew );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1199,14 +1196,14 @@ sal_Bool SwTableAutoFmtTbl::Save( SvStream& rStream ) const
|
|||||||
bRet = 0 == rStream.GetError();
|
bRet = 0 == rStream.GetError();
|
||||||
|
|
||||||
// Write this version number for all attributes
|
// 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();
|
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 );
|
bRet = pFmt->Save( rStream, AUTOFORMAT_FILE_VERSION );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2966,8 +2966,8 @@ void SwXTextTable::autoFormat(const OUString& aName) throw( lang::IllegalArgumen
|
|||||||
String sAutoFmtName(aName);
|
String sAutoFmtName(aName);
|
||||||
SwTableAutoFmtTbl aAutoFmtTbl;
|
SwTableAutoFmtTbl aAutoFmtTbl;
|
||||||
aAutoFmtTbl.Load();
|
aAutoFmtTbl.Load();
|
||||||
for( sal_uInt16 i = aAutoFmtTbl.Count(); i; )
|
for( sal_uInt16 i = aAutoFmtTbl.size(); i; )
|
||||||
if( sAutoFmtName == aAutoFmtTbl[ --i ]->GetName() )
|
if( sAutoFmtName == aAutoFmtTbl[ --i ].GetName() )
|
||||||
{
|
{
|
||||||
SwSelBoxes aBoxes;
|
SwSelBoxes aBoxes;
|
||||||
const SwTableSortBoxes& rTBoxes = pTable->GetTabSortBoxes();
|
const SwTableSortBoxes& rTBoxes = pTable->GetTabSortBoxes();
|
||||||
@@ -2977,7 +2977,7 @@ void SwXTextTable::autoFormat(const OUString& aName) throw( lang::IllegalArgumen
|
|||||||
aBoxes.Insert( pBox );
|
aBoxes.Insert( pBox );
|
||||||
}
|
}
|
||||||
UnoActionContext aContext( pFmt->GetDoc() );
|
UnoActionContext aContext( pFmt->GetDoc() );
|
||||||
pFmt->GetDoc()->SetTableAutoFmt( aBoxes, *aAutoFmtTbl[i] );
|
pFmt->GetDoc()->SetTableAutoFmt( aBoxes, aAutoFmtTbl[i] );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -120,9 +120,6 @@ using namespace ::com::sun::star::sdbc;
|
|||||||
using namespace ::com::sun::star::sdbcx;
|
using namespace ::com::sun::star::sdbcx;
|
||||||
using namespace ::com::sun::star::beans;
|
using namespace ::com::sun::star::beans;
|
||||||
|
|
||||||
// tblafmt.hxx
|
|
||||||
SV_IMPL_PTRARR( _SwTableAutoFmtTbl, SwTableAutoFmt* )
|
|
||||||
|
|
||||||
const char cDBFldStart = '<';
|
const char cDBFldStart = '<';
|
||||||
const char cDBFldEnd = '>';
|
const char cDBFldEnd = '>';
|
||||||
|
|
||||||
@@ -1830,10 +1827,10 @@ void SwInsertDBColAutoPilot::Load()
|
|||||||
// then load the AutoFmt file and look for Autoformat first
|
// then load the AutoFmt file and look for Autoformat first
|
||||||
SwTableAutoFmtTbl aAutoFmtTbl;
|
SwTableAutoFmtTbl aAutoFmtTbl;
|
||||||
aAutoFmtTbl.Load();
|
aAutoFmtTbl.Load();
|
||||||
for( sal_uInt16 nAutoFmt = aAutoFmtTbl.Count(); nAutoFmt; )
|
for( sal_uInt16 nAutoFmt = aAutoFmtTbl.size(); nAutoFmt; )
|
||||||
if( sTmp == aAutoFmtTbl[ --nAutoFmt ]->GetName() )
|
if( sTmp == aAutoFmtTbl[ --nAutoFmt ].GetName() )
|
||||||
{
|
{
|
||||||
pTAutoFmt = new SwTableAutoFmt( *aAutoFmtTbl[ nAutoFmt ] );
|
pTAutoFmt = new SwTableAutoFmt( aAutoFmtTbl[ nAutoFmt ] );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -804,9 +804,9 @@ void SwBaseShell::Execute(SfxRequest &rReq)
|
|||||||
pAutoFmtTbl = new SwTableAutoFmtTbl;
|
pAutoFmtTbl = new SwTableAutoFmtTbl;
|
||||||
pAutoFmtTbl->Load();
|
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 )
|
if( pFmt->GetName() == sAutoFmt )
|
||||||
{
|
{
|
||||||
pTAFmt = pFmt;
|
pTAFmt = pFmt;
|
||||||
@@ -2598,11 +2598,11 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest )
|
|||||||
{
|
{
|
||||||
SwTableAutoFmtTbl aTableTbl;
|
SwTableAutoFmtTbl aTableTbl;
|
||||||
aTableTbl.Load();
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -259,9 +259,9 @@ void SwAutoFormatDlg::Init( const SwTableAutoFmt* pSelFmt )
|
|||||||
nIndex = 255;
|
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() );
|
aLbFormat.InsertEntry( pFmt->GetName() );
|
||||||
if( pSelFmt && pFmt->GetName() == pSelFmt->GetName() )
|
if( pSelFmt && pFmt->GetName() == pSelFmt->GetName() )
|
||||||
nIndex = i;
|
nIndex = i;
|
||||||
@@ -297,9 +297,9 @@ void SwAutoFormatDlg::FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const
|
|||||||
if( 255 != nIndex )
|
if( 255 != nIndex )
|
||||||
{
|
{
|
||||||
if( rToFill )
|
if( rToFill )
|
||||||
*rToFill = *(*pTableTbl)[ nIndex ];
|
*rToFill = (*pTableTbl)[ nIndex ];
|
||||||
else
|
else
|
||||||
rToFill = new SwTableAutoFmt( *(*pTableTbl)[ nIndex ] );
|
rToFill = new SwTableAutoFmt( (*pTableTbl)[ nIndex ] );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
delete rToFill, rToFill = 0;
|
delete rToFill, rToFill = 0;
|
||||||
@@ -313,7 +313,7 @@ void SwAutoFormatDlg::FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const
|
|||||||
|
|
||||||
IMPL_LINK( SwAutoFormatDlg, CheckHdl, Button *, pBtn )
|
IMPL_LINK( SwAutoFormatDlg, CheckHdl, Button *, pBtn )
|
||||||
{
|
{
|
||||||
SwTableAutoFmtPtr pData = (*pTableTbl)[nIndex];
|
SwTableAutoFmt* pData = &(*pTableTbl)[nIndex];
|
||||||
sal_Bool bCheck = ((CheckBox*)pBtn)->IsChecked(), bDataChgd = sal_True;
|
sal_Bool bCheck = ((CheckBox*)pBtn)->IsChecked(), bDataChgd = sal_True;
|
||||||
|
|
||||||
if( pBtn == &aBtnNumFormat )
|
if( pBtn == &aBtnNumFormat )
|
||||||
@@ -362,24 +362,24 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, AddHdl)
|
|||||||
if( aFormatName.Len() > 0 )
|
if( aFormatName.Len() > 0 )
|
||||||
{
|
{
|
||||||
sal_uInt16 n;
|
sal_uInt16 n;
|
||||||
for( n = 0; n < pTableTbl->Count(); ++n )
|
for( n = 0; n < pTableTbl->size(); ++n )
|
||||||
if( (*pTableTbl)[n]->GetName() == aFormatName )
|
if( (*pTableTbl)[n].GetName() == aFormatName )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( n >= pTableTbl->Count() )
|
if( n >= pTableTbl->size() )
|
||||||
{
|
{
|
||||||
// Format mit dem Namen noch nicht vorhanden, also
|
// Format mit dem Namen noch nicht vorhanden, also
|
||||||
// aufnehmen
|
// aufnehmen
|
||||||
SwTableAutoFmtPtr pNewData = new
|
SwTableAutoFmt* pNewData = new
|
||||||
SwTableAutoFmt( aFormatName );
|
SwTableAutoFmt( aFormatName );
|
||||||
pShell->GetTableAutoFmt( *pNewData );
|
pShell->GetTableAutoFmt( *pNewData );
|
||||||
|
|
||||||
// Sortiert einfuegen!!
|
// Sortiert einfuegen!!
|
||||||
for( n = 1; n < pTableTbl->Count(); ++n )
|
for( n = 1; n < pTableTbl->size(); ++n )
|
||||||
if( (*pTableTbl)[ n ]->GetName() > aFormatName )
|
if( (*pTableTbl)[ n ].GetName() > aFormatName )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
pTableTbl->Insert( pNewData, n );
|
pTableTbl->insert( pTableTbl->begin() + n, pNewData );
|
||||||
aLbFormat.InsertEntry( aFormatName, nDfltStylePos + n );
|
aLbFormat.InsertEntry( aFormatName, nDfltStylePos + n );
|
||||||
aLbFormat.SelectEntryPos( nDfltStylePos + n );
|
aLbFormat.SelectEntryPos( nDfltStylePos + n );
|
||||||
bFmtInserted = sal_True;
|
bFmtInserted = sal_True;
|
||||||
@@ -427,7 +427,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RemoveHdl)
|
|||||||
aLbFormat.RemoveEntry( nDfltStylePos + nIndex );
|
aLbFormat.RemoveEntry( nDfltStylePos + nIndex );
|
||||||
aLbFormat.SelectEntryPos( nDfltStylePos + nIndex-1 );
|
aLbFormat.SelectEntryPos( nDfltStylePos + nIndex-1 );
|
||||||
|
|
||||||
pTableTbl->DeleteAndDestroy( nIndex );
|
pTableTbl->erase( pTableTbl->begin() + nIndex );
|
||||||
nIndex--;
|
nIndex--;
|
||||||
|
|
||||||
if( !nIndex )
|
if( !nIndex )
|
||||||
@@ -466,27 +466,27 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, RenameHdl)
|
|||||||
if ( aFormatName.Len() > 0 )
|
if ( aFormatName.Len() > 0 )
|
||||||
{
|
{
|
||||||
sal_uInt16 n;
|
sal_uInt16 n;
|
||||||
for( n = 0; n < pTableTbl->Count(); ++n )
|
for( n = 0; n < pTableTbl->size(); ++n )
|
||||||
if ((*pTableTbl)[n]->GetName() == aFormatName)
|
if ((*pTableTbl)[n].GetName() == aFormatName)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( n >= pTableTbl->Count() )
|
if( n >= pTableTbl->size() )
|
||||||
{
|
{
|
||||||
// Format mit dem Namen noch nicht vorhanden, also
|
// Format mit dem Namen noch nicht vorhanden, also
|
||||||
// umbenennen
|
// umbenennen
|
||||||
|
|
||||||
aLbFormat.RemoveEntry( nDfltStylePos + nIndex );
|
aLbFormat.RemoveEntry( nDfltStylePos + nIndex );
|
||||||
SwTableAutoFmtPtr p = (*pTableTbl)[ nIndex ];
|
SwTableAutoFmt* p = &(*pTableTbl)[ nIndex ];
|
||||||
pTableTbl->Remove( nIndex );
|
pTableTbl->erase( pTableTbl->begin() + nIndex );
|
||||||
|
|
||||||
p->SetName( aFormatName );
|
p->SetName( aFormatName );
|
||||||
|
|
||||||
// Sortiert einfuegen!!
|
// Sortiert einfuegen!!
|
||||||
for( n = 1; n < pTableTbl->Count(); ++n )
|
for( n = 1; n < pTableTbl->size(); ++n )
|
||||||
if( (*pTableTbl)[ n ]->GetName() > aFormatName )
|
if( (*pTableTbl)[ n ].GetName() > aFormatName )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
pTableTbl->Insert( p, n );
|
pTableTbl->insert( pTableTbl->begin() + n, p );
|
||||||
aLbFormat.InsertEntry( aFormatName, nDfltStylePos + n );
|
aLbFormat.InsertEntry( aFormatName, nDfltStylePos + n );
|
||||||
aLbFormat.SelectEntryPos( nDfltStylePos + n );
|
aLbFormat.SelectEntryPos( nDfltStylePos + n );
|
||||||
|
|
||||||
@@ -526,9 +526,9 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, SelFmtHdl)
|
|||||||
if( nSelPos >= nDfltStylePos )
|
if( nSelPos >= nDfltStylePos )
|
||||||
{
|
{
|
||||||
nIndex = nSelPos - nDfltStylePos;
|
nIndex = nSelPos - nDfltStylePos;
|
||||||
pWndPreview->NotifyChange( *(*pTableTbl)[nIndex] );
|
pWndPreview->NotifyChange( (*pTableTbl)[nIndex] );
|
||||||
bBtnEnable = 0 != nIndex;
|
bBtnEnable = 0 != nIndex;
|
||||||
UpdateChecks( *(*pTableTbl)[nIndex], sal_True );
|
UpdateChecks( (*pTableTbl)[nIndex], sal_True );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -557,7 +557,7 @@ IMPL_LINK_NOARG(SwAutoFormatDlg, SelFmtHdl)
|
|||||||
IMPL_LINK_NOARG_INLINE_START(SwAutoFormatDlg, OkHdl)
|
IMPL_LINK_NOARG_INLINE_START(SwAutoFormatDlg, OkHdl)
|
||||||
{
|
{
|
||||||
if( bSetAutoFmt )
|
if( bSetAutoFmt )
|
||||||
pShell->SetTableAutoFmt( *(*pTableTbl)[ nIndex ] );
|
pShell->SetTableAutoFmt( (*pTableTbl)[ nIndex ] );
|
||||||
EndDialog( RET_OK );
|
EndDialog( RET_OK );
|
||||||
return sal_True;
|
return sal_True;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user