summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-07-19 15:51:39 +0200
committerMichael Stahl <mstahl@redhat.com>2012-07-26 14:30:10 +0200
commit6376dd83fb436f73cb891bc11b502014e66a74da (patch)
tree67d938090919a0d43300f95d42a24bd722314abf /svx
parented24564ce11683731b820c29d5a46e073ab7a2a7 (diff)
Convert SV_DECL_VARARR_VISIBILITY(SrchAttrItemList) to std::vector
Change-Id: Ib6d6bb62613004ba0a8ee603f7047fb017570e89
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/svx/srchdlg.hxx16
-rw-r--r--svx/source/dialog/srchdlg.cxx47
2 files changed, 26 insertions, 37 deletions
diff --git a/svx/inc/svx/srchdlg.hxx b/svx/inc/svx/srchdlg.hxx
index 7f0fa67c1bbb..6d032e6f49fb 100644
--- a/svx/inc/svx/srchdlg.hxx
+++ b/svx/inc/svx/srchdlg.hxx
@@ -38,10 +38,10 @@
#include <vcl/dialog.hxx>
#include <sfx2/childwin.hxx>
#include <sfx2/basedlgs.hxx>
-#include <svl/svarray.hxx>
#include <svtools/svmedit.hxx>
#include <svl/srchdefs.hxx>
#include "svx/svxdllapi.h"
+#include <vector>
class SvxSearchItem;
class MoreButton;
@@ -63,7 +63,7 @@ struct SearchAttrItem
// class SearchAttrItemList ----------------------------------------------
-SV_DECL_VARARR_VISIBILITY(SrchAttrItemList, SearchAttrItem, 8, SVX_DLLPUBLIC)
+typedef std::vector<SearchAttrItem> SrchAttrItemList;
class SVX_DLLPUBLIC SearchAttrItemList : private SrchAttrItemList
{
@@ -75,15 +75,15 @@ public:
void Put( const SfxItemSet& rSet );
SfxItemSet& Get( SfxItemSet& rSet );
void Clear();
- sal_uInt16 Count() const { return SrchAttrItemList::Count(); }
- SearchAttrItem& operator[](sal_uInt16 nPos) const
+ sal_uInt16 Count() const { return SrchAttrItemList::size(); }
+ SearchAttrItem& operator[](sal_uInt16 nPos)
+ { return SrchAttrItemList::operator[]( nPos ); }
+ SearchAttrItem& GetObject( sal_uInt16 nPos )
{ return SrchAttrItemList::operator[]( nPos ); }
- SearchAttrItem& GetObject( sal_uInt16 nPos ) const
- { return SrchAttrItemList::GetObject( nPos ); }
- // the pointer to the item is not being copierd, so don't delete
+ // the pointer to the item is not being copied, so don't delete
void Insert( const SearchAttrItem& rItem )
- { SrchAttrItemList::Insert( rItem, SrchAttrItemList::Count() ); }
+ { SrchAttrItemList::push_back( rItem ); }
// deletes the pointer to the items
void Remove( sal_uInt16 nPos, sal_uInt16 nLen = 1 );
};
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index eb7eb10be939..70af2582de04 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -98,8 +98,6 @@ using namespace comphelper;
#define MODIFY_ALLTABLES 0x00004000
#define MODIFY_NOTES 0x00008000
-SV_IMPL_VARARR(SrchAttrItemList, SearchAttrItem);
-
#define GetCheckBoxValue( rBox ) \
rBox.IsEnabled() ? rBox.IsChecked() : sal_False
@@ -170,16 +168,11 @@ void StrArrToList_Impl( sal_uInt16 nId, const std::vector<rtl::OUString>& rStrLs
// class SearchAttrItemList ----------------------------------------------
SearchAttrItemList::SearchAttrItemList( const SearchAttrItemList& rList ) :
-
- SrchAttrItemList( (sal_uInt8)rList.Count() )
-
+ SrchAttrItemList(rList)
{
- SrchAttrItemList::Insert( &rList, 0 );
- SearchAttrItem* _pData = (SearchAttrItem*)GetData();
-
- for ( sal_uInt16 i = Count(); i; --i, ++_pData )
- if ( !IsInvalidItem( _pData->pItem ) )
- _pData->pItem = _pData->pItem->Clone();
+ for ( sal_uInt16 i = 0; i < size(); ++i )
+ if ( !IsInvalidItem( (*this)[i].pItem ) )
+ (*this)[i].pItem = (*this)[i].pItem->Clone();
}
// -----------------------------------------------------------------------
@@ -230,13 +223,12 @@ void SearchAttrItemList::Put( const SfxItemSet& rSet )
SfxItemSet& SearchAttrItemList::Get( SfxItemSet& rSet )
{
SfxItemPool* pPool = rSet.GetPool();
- SearchAttrItem* _pData = (SearchAttrItem*)GetData();
- for ( sal_uInt16 i = Count(); i; --i, ++_pData )
- if ( IsInvalidItem( _pData->pItem ) )
- rSet.InvalidateItem( pPool->GetWhich( _pData->nSlot ) );
+ for ( sal_uInt16 i = 0; i < size(); ++i )
+ if ( IsInvalidItem( (*this)[i].pItem ) )
+ rSet.InvalidateItem( pPool->GetWhich( (*this)[i].nSlot ) );
else
- rSet.Put( *_pData->pItem );
+ rSet.Put( *(*this)[i].pItem );
return rSet;
}
@@ -244,12 +236,10 @@ SfxItemSet& SearchAttrItemList::Get( SfxItemSet& rSet )
void SearchAttrItemList::Clear()
{
- SearchAttrItem* _pData = (SearchAttrItem*)GetData();
-
- for ( sal_uInt16 i = Count(); i; --i, ++_pData )
- if ( !IsInvalidItem( _pData->pItem ) )
- delete _pData->pItem;
- SrchAttrItemList::Remove( 0, Count() );
+ for ( sal_uInt16 i = 0; i < size(); ++i )
+ if ( !IsInvalidItem( (*this)[i].pItem ) )
+ delete (*this)[i].pItem;
+ SrchAttrItemList::clear();
}
// -----------------------------------------------------------------------
@@ -257,15 +247,14 @@ void SearchAttrItemList::Clear()
// Deletes the pointer to the items
void SearchAttrItemList::Remove( sal_uInt16 nPos, sal_uInt16 nLen )
{
- if ( nPos + nLen > Count() )
- nLen = Count() - nPos;
- SearchAttrItem* _pData = (SearchAttrItem*)GetData() + nPos;
+ if ( nPos + nLen > size() )
+ nLen = size() - nPos;
- for ( sal_uInt16 n = nLen; n; --n, ++_pData )
- if ( !IsInvalidItem( _pData->pItem ) )
- delete _pData->pItem;
+ for ( sal_uInt16 i = nPos; i < nPos + nLen; ++i )
+ if ( !IsInvalidItem( (*this)[i].pItem ) )
+ delete (*this)[i].pItem;
- SrchAttrItemList::Remove( nPos, nLen );
+ SrchAttrItemList::erase( begin() + nPos, begin() + nPos + nLen );
}
#undef INI_LIST