Remove DECLARE_LIST( ImpFilterList, ImpFilterItem* )
This commit is contained in:
parent
9f4f8dae5a
commit
2ba79400a4
2 changed files with 42 additions and 50 deletions
|
@ -43,7 +43,6 @@
|
|||
#include <com/sun/star/i18n/XCollator.hpp>
|
||||
|
||||
#include <svtools/stdctrl.hxx>
|
||||
#include <vector>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma optimize ("", off)
|
||||
|
@ -725,12 +724,10 @@ ImpFileDialog::ImpFileDialog( PathDialog* pDlg, WinBits nWinBits, RESOURCE_TYPE
|
|||
|
||||
ImpFileDialog::~ImpFileDialog()
|
||||
{
|
||||
ImpFilterItem* pItem = aFilterList.First();
|
||||
while( pItem )
|
||||
{
|
||||
delete pItem;
|
||||
pItem = aFilterList.Next();
|
||||
for ( size_t i = 0, n = aFilterList.size(); i < n; ++i ) {
|
||||
delete aFilterList[ i ];
|
||||
}
|
||||
aFilterList.clear();
|
||||
|
||||
delete pFileTitel;
|
||||
if (pFileList && ( pFileList != pDirList ) )
|
||||
|
@ -913,15 +910,12 @@ IMPL_LINK( ImpFileDialog, DblClickHdl, ListBox *, pBox )
|
|||
if( pBox == pTypeList )
|
||||
{
|
||||
// Neue Maske setzen, und Listboxen updaten
|
||||
USHORT nCurPos = pTypeList->GetSelectEntryPos();
|
||||
if( nCurPos+1 > (USHORT)aFilterList.Count() )
|
||||
size_t nCurPos = pTypeList->GetSelectEntryPos();
|
||||
if( nCurPos+1 > aFilterList.size() )
|
||||
aMask = UniString::CreateFromAscii( ALLFILES );
|
||||
else
|
||||
{
|
||||
UniString aFilterListMask = aFilterList.GetObject( nCurPos )->aMask;
|
||||
// if( aFilterListMask.Search( ';' ) == STRING_NOTFOUND ) // kein ; in der Maske
|
||||
// aMask = WildCard( aFilterListMask, '\0' );
|
||||
// else // ; muss beruecksichtigt werden
|
||||
UniString aFilterListMask = aFilterList[ nCurPos ]->aMask;
|
||||
aMask = WildCard( aFilterListMask, ';' );
|
||||
}
|
||||
|
||||
|
@ -1191,7 +1185,7 @@ void ImpFileDialog::SetPath( Edit const& rEdit )
|
|||
|
||||
void ImpFileDialog::AddFilter( const UniString& rFilter, const UniString& rMask )
|
||||
{
|
||||
aFilterList.Insert( new ImpFilterItem( rFilter, rMask ), LIST_APPEND );
|
||||
aFilterList.push_back( new ImpFilterItem( rFilter, rMask ) );
|
||||
if( pTypeList )
|
||||
pTypeList->InsertEntry( rFilter, LISTBOX_APPEND );
|
||||
|
||||
|
@ -1201,27 +1195,24 @@ void ImpFileDialog::AddFilter( const UniString& rFilter, const UniString& rMask
|
|||
|
||||
void ImpFileDialog::RemoveFilter( const UniString& rFilter )
|
||||
{
|
||||
ImpFilterItem* pItem = aFilterList.First();
|
||||
while( pItem && pItem->aName != rFilter )
|
||||
pItem = aFilterList.Next();
|
||||
|
||||
if( pItem )
|
||||
{
|
||||
delete aFilterList.Remove();
|
||||
if( pTypeList )
|
||||
for ( ImpFilterList::iterator it = aFilterList.begin(); it < aFilterList.end(); ++it ) {
|
||||
if ( (*it)->aName == rFilter ) {
|
||||
delete *it;
|
||||
aFilterList.erase( it );
|
||||
if ( pTypeList ) {
|
||||
pTypeList->RemoveEntry( rFilter );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ImpFileDialog::RemoveAllFilter()
|
||||
{
|
||||
ImpFilterItem* pItem = aFilterList.First();
|
||||
while( pItem )
|
||||
{
|
||||
delete pItem;
|
||||
pItem = aFilterList.Next();
|
||||
for ( size_t i = 0, n = aFilterList.size(); i < n ; ++i ) {
|
||||
delete aFilterList[ i ];
|
||||
}
|
||||
aFilterList.Clear();
|
||||
aFilterList.clear();
|
||||
|
||||
if( pTypeList )
|
||||
pTypeList->Clear();
|
||||
|
@ -1232,13 +1223,13 @@ void ImpFileDialog::SetCurFilter( const UniString& rFilter )
|
|||
if( !pTypeList )
|
||||
return;
|
||||
|
||||
ImpFilterItem* pItem = aFilterList.First();
|
||||
while( pItem && pItem->aName != rFilter )
|
||||
pItem = aFilterList.Next();
|
||||
for ( size_t i = 0, n = aFilterList.size(); i < n; ++i ) {
|
||||
if ( aFilterList[ i ]->aName == rFilter ) {
|
||||
pTypeList->SelectEntryPos( USHORT( i ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( pItem )
|
||||
pTypeList->SelectEntryPos( (USHORT)aFilterList.GetCurPos() );
|
||||
else
|
||||
pTypeList->SetNoSelection();
|
||||
}
|
||||
|
||||
|
@ -1269,9 +1260,9 @@ void ImpFileDialog::PreExecute()
|
|||
if( pTypeList )
|
||||
{
|
||||
USHORT nCurType = pTypeList->GetSelectEntryPos();
|
||||
if( nCurType < aFilterList.Count() )
|
||||
if( nCurType < aFilterList.size() )
|
||||
{
|
||||
UniString aFilterListMask = aFilterList.GetObject( nCurType )->aMask;
|
||||
UniString aFilterListMask = aFilterList[ nCurType ]->aMask;
|
||||
if( aFilterListMask.Search( ';' ) == STRING_NOTFOUND ) // kein ; in der Maske
|
||||
aMask = WildCard( aFilterListMask, '\0' );
|
||||
else // ; in der Maske, muss in der Wildcard beruecksichtigt werden
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <tools/fsys.hxx>
|
||||
#include <vcl/button.hxx>
|
||||
#include <vcl/unohelp.hxx>
|
||||
#include <vector>
|
||||
|
||||
class FixedText;
|
||||
class Edit;
|
||||
|
@ -56,7 +57,7 @@ struct ImpFilterItem
|
|||
}
|
||||
};
|
||||
|
||||
DECLARE_LIST( ImpFilterList, ImpFilterItem* )
|
||||
typedef ::std::vector< ImpFilterItem* > ImpFilterList;
|
||||
#include <vcl/lstbox.hxx>
|
||||
|
||||
class KbdListBox : public ListBox
|
||||
|
@ -167,9 +168,9 @@ public:
|
|||
void SetCurFilter( const String& rFilter );
|
||||
String GetCurFilter() const;
|
||||
|
||||
USHORT GetFilterCount() const { return (USHORT)aFilterList.Count(); }
|
||||
inline String GetFilterName( USHORT nPos ) const;
|
||||
inline String GetFilterType( USHORT nPos ) const;
|
||||
size_t GetFilterCount() const { return aFilterList.size(); }
|
||||
inline String GetFilterName( size_t nPos ) const;
|
||||
inline String GetFilterType( size_t nPos ) const;
|
||||
|
||||
virtual void SetPath( const String& rPath );
|
||||
virtual void SetPath( const Edit& rEdit );
|
||||
|
@ -180,21 +181,21 @@ public:
|
|||
FileDialog* GetFileDialog() const { return (FileDialog*)GetPathDialog(); }
|
||||
};
|
||||
|
||||
inline String ImpFileDialog::GetFilterName( USHORT nPos ) const
|
||||
inline String ImpFileDialog::GetFilterName( size_t nPos ) const
|
||||
{
|
||||
String aName;
|
||||
ImpFilterItem* pItem = aFilterList.GetObject( nPos );
|
||||
if ( pItem )
|
||||
aName = pItem->aName;
|
||||
if ( nPos < aFilterList.size() ) {
|
||||
aName = aFilterList[ nPos ]->aName;
|
||||
}
|
||||
return aName;
|
||||
}
|
||||
|
||||
inline String ImpFileDialog::GetFilterType( USHORT nPos ) const
|
||||
inline String ImpFileDialog::GetFilterType( size_t nPos ) const
|
||||
{
|
||||
String aFilterMask;
|
||||
ImpFilterItem* pItem = aFilterList.GetObject( nPos );
|
||||
if ( pItem )
|
||||
aFilterMask = pItem->aMask;
|
||||
if ( nPos < aFilterList.size() ) {
|
||||
aFilterMask = aFilterList[ nPos ]->aMask;
|
||||
}
|
||||
return aFilterMask;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue