Convert SV_DECL_PTRARR_DEL(ImageItemListDescriptor) to boost::ptr_vector

Change-Id: Ic3b06e179d182d68288c7c6832149309160cd637
This commit is contained in:
Noel Grandin
2012-06-07 16:27:06 +02:00
committed by Michael Stahl
parent 0169c40e13
commit 153c5e3f07
7 changed files with 20 additions and 26 deletions

View File

@@ -1479,11 +1479,11 @@ SvtFileDialogFilter_Impl* SvtFileDialog::FindFilter_Impl
{
SvtFileDialogFilter_Impl* pFoundFilter = NULL;
SvtFileDialogFilterList_Impl* pList = _pImp->_pFilter;
sal_uInt16 nFilter = pList->Count();
sal_uInt16 nFilter = pList->size();
while ( nFilter-- )
{
SvtFileDialogFilter_Impl* pFilter = pList->GetObject( nFilter );
SvtFileDialogFilter_Impl* pFilter = &(*pList)[ nFilter ];
const String& rType = pFilter->GetType();
String aSingleType = rType;
@@ -2191,7 +2191,7 @@ short SvtFileDialog::PrepareExecute()
break;
}
}
SvtFileDialogFilter_Impl* pNewCurFilter = _pImp->_pFilter->GetObject( nPos );
SvtFileDialogFilter_Impl* pNewCurFilter = &(*_pImp->_pFilter)[ nPos ];
DBG_ASSERT( pNewCurFilter, "SvtFileDialog::Execute: invalid filter pos!" );
_pImp->SetCurFilter( pNewCurFilter, pNewCurFilter->GetName() );
}
@@ -2366,7 +2366,7 @@ void SvtFileDialog::OpenURL_Impl( const String& _rURL )
SvtFileDialogFilter_Impl* SvtFileDialog::implAddFilter( const String& _rFilter, const String& _rType )
{
SvtFileDialogFilter_Impl* pNewFilter = new SvtFileDialogFilter_Impl( _rFilter, _rType );
_pImp->_pFilter->C40_INSERT( SvtFileDialogFilter_Impl, pNewFilter, (sal_uInt16)0 );
_pImp->_pFilter->push_front( pNewFilter );
if ( !_pImp->GetCurFilter() )
_pImp->SetCurFilter( pNewFilter, _rFilter );
@@ -2400,11 +2400,11 @@ void SvtFileDialog::SetCurFilter( const String& rFilter )
DBG_ASSERT( !IsInExecute(), "SvtFileDialog::SetCurFilter: currently executing!" );
// look for corresponding filter
sal_uInt16 nPos = _pImp->_pFilter->Count();
sal_uInt16 nPos = _pImp->_pFilter->size();
while ( nPos-- )
{
SvtFileDialogFilter_Impl* pFilter = _pImp->_pFilter->GetObject( nPos );
SvtFileDialogFilter_Impl* pFilter = &(*_pImp->_pFilter)[ nPos ];
if ( pFilter->GetName() == rFilter )
{
_pImp->SetCurFilter( pFilter, rFilter );
@@ -2435,7 +2435,7 @@ String SvtFileDialog::getCurFilter( ) const
sal_uInt16 SvtFileDialog::GetFilterCount() const
{
return _pImp->_pFilter->Count();
return _pImp->_pFilter->size();
}
//*****************************************************************************
@@ -2443,7 +2443,7 @@ sal_uInt16 SvtFileDialog::GetFilterCount() const
const String& SvtFileDialog::GetFilterName( sal_uInt16 nPos ) const
{
DBG_ASSERT( nPos < GetFilterCount(), "invalid index" );
return _pImp->_pFilter->GetObject( nPos )->GetName();
return (*_pImp->_pFilter)[ nPos ].GetName();
}
//*****************************************************************************

View File

@@ -122,8 +122,6 @@ SvtFileDialogFilter_Impl::~SvtFileDialogFilter_Impl()
// SvtFileDialogFilterList_Impl
//*****************************************************************************
SV_IMPL_PTRARR( SvtFileDialogFilterList_Impl, SvtFileDialogFilter_Impl* );
//=============================================================================
//= SvtFileDialogURLSelector
//=============================================================================
@@ -375,15 +373,15 @@ void SvtExpFileDlg_Impl::InitFilterList( )
ClearFilterList( );
// reinit it
sal_uInt16 nPos = _pFilter->Count();
sal_uInt16 nPos = _pFilter->size();
// search for the first entry which is no group separator
while ( nPos-- && _pFilter->GetObject( nPos ) && _pFilter->GetObject( nPos )->isGroupSeparator() )
while ( nPos-- && (*_pFilter)[ nPos ].isGroupSeparator() )
;
// add all following entries
while ( (sal_Int16)nPos >= 0 )
InsertFilterListEntry( _pFilter->GetObject( nPos-- ) );
InsertFilterListEntry( &(*_pFilter)[ nPos-- ] );
}
//-----------------------------------------------------------------------------

View File

@@ -37,9 +37,8 @@
#include <vcl/timer.hxx>
#include <vcl/group.hxx>
#include "svl/svarray.hxx"
#include <vector>
#include <boost/ptr_container/ptr_deque.hpp>
class Accelerator;
class CheckBox;
@@ -76,7 +75,7 @@ public:
sal_Bool isGroupSeparator() const { return 0 == m_aType.Len(); }
};
SV_DECL_PTRARR_DEL( SvtFileDialogFilterList_Impl, SvtFileDialogFilter_Impl*, 3 )
typedef boost::ptr_deque<SvtFileDialogFilter_Impl> SvtFileDialogFilterList_Impl;
enum SvtFileDlgMode
{

View File

@@ -65,8 +65,7 @@ struct ExternalImageItemDescriptor
String aURL; // a URL to an external bitmap
};
typedef ImageItemDescriptor* ImageItemDescriptorPtr;
SV_DECL_PTRARR_DEL( ImageItemListDescriptor, ImageItemDescriptorPtr, 10 )
typedef boost::ptr_vector<ImageItemDescriptor> ImageItemListDescriptor;
typedef boost::ptr_vector<ExternalImageItemDescriptor> ExternalImageItemListDescriptor;

View File

@@ -507,12 +507,12 @@ sal_Bool ImageManagerImpl::implts_loadUserImages(
( !aUserImageListInfo.pImageList->empty() ))
{
ImageListItemDescriptor* pList = &aUserImageListInfo.pImageList->front();
sal_Int32 nCount = pList->pImageItemList->Count();
sal_Int32 nCount = pList->pImageItemList->size();
std::vector< OUString > aUserImagesVector;
aUserImagesVector.reserve(nCount);
for ( sal_uInt16 i=0; i < nCount; i++ )
{
const ImageItemDescriptor* pItem = pList->pImageItemList->GetObject(i);
const ImageItemDescriptor* pItem = &(*pList->pImageItemList)[i];
aUserImagesVector.push_back( pItem->aCommandURL );
}
@@ -589,7 +589,7 @@ sal_Bool ImageManagerImpl::implts_storeUserImages(
pItem->nIndex = i;
pItem->aCommandURL = pImageList->GetImageName( i );
pList->pImageItemList->Insert( pItem, pList->pImageItemList->Count() );
pList->pImageItemList->push_back( pItem );
}
pList->aURL = String::CreateFromAscii("Bitmaps/");

View File

@@ -61,8 +61,6 @@ using namespace ::com::sun::star::io;
namespace framework
{
SV_IMPL_PTRARR( ImageItemListDescriptor, ImageItemDescriptorPtr );
static Reference< XParser > GetSaxParser(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory
)

View File

@@ -393,7 +393,7 @@ throw( SAXException, RuntimeException )
}
if ( m_pImages )
m_pImages->pImageItemList->Insert( pItem, m_pImages->pImageItemList->Count() );
m_pImages->pImageItemList->push_back( pItem );
}
break;
@@ -765,8 +765,8 @@ void OWriteImagesDocumentHandler::WriteImageList( const ImageListItemDescriptor*
ImageItemListDescriptor* pImageItemList = pImageList->pImageItemList;
if ( pImageItemList )
{
for ( sal_uInt16 i = 0; i < pImageItemList->Count(); i++ )
WriteImage( (*pImageItemList)[i] );
for ( sal_uInt16 i = 0; i < pImageItemList->size(); i++ )
WriteImage( &(*pImageItemList)[i] );
}
m_xWriteDocumentHandler->endElement( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_NS_IMAGES )) );