summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-01-05 18:37:42 +0100
committerMichael Stahl <mstahl@redhat.com>2012-01-05 19:25:05 +0100
commit7482e974117df2bdc737785efdf9eb410787c7b4 (patch)
treeb2fccca68e7530e74460978006febbd4c1b121ec
parent5b8deb57c6782b77fcf180ef6097f71b6e1b07d2 (diff)
svtools: remove unused FileDialog
svtools/filedlg.hxx(88) : warning C4610: class ´FileDialog´ can never be instantiated
-rw-r--r--svtools/inc/svtools/filedlg.hxx30
-rw-r--r--svtools/source/dialogs/filedlg.cxx21
-rw-r--r--svtools/source/dialogs/filedlg2.cxx594
-rw-r--r--svtools/source/dialogs/filedlg2.hxx71
4 files changed, 11 insertions, 705 deletions
diff --git a/svtools/inc/svtools/filedlg.hxx b/svtools/inc/svtools/filedlg.hxx
index d25219a32efb..b771631b45e7 100644
--- a/svtools/inc/svtools/filedlg.hxx
+++ b/svtools/inc/svtools/filedlg.hxx
@@ -26,8 +26,8 @@
*
************************************************************************/
-#ifndef _SVT_FILEDLG_HXX
-#define _SVT_FILEDLG_HXX
+#ifndef SVT_FILEDLG_HXX
+#define SVT_FILEDLG_HXX
#include "svtools/svtdllapi.h"
@@ -43,10 +43,8 @@ class ImpSvFileDlg;
class SVT_DLLPUBLIC PathDialog : public ModalDialog
{
private:
- friend class FileDialog; // Imp...
-
ImpSvFileDlg* pImpFileDlg; // Implementation
- Link aOKHdlLink; // Link zum OK-Handler
+ Link aOKHdlLink; // Link to OK-Handler
protected:
UniString aDfltExt; // Default - Extension
@@ -67,26 +65,6 @@ public:
virtual short Execute();
};
-// --------------
-// - SvFileDialog -
-// --------------
-
-class SVT_DLLPUBLIC FileDialog : public PathDialog
-{
-private:
- Link aFileHdlLink; // Link zum FileSelect-Handler
- Link aFilterHdlLink; // Link zum FilterSelect-Handler
-
-public:
- ~FileDialog();
-
- virtual void FileSelect();
- virtual void FilterSelect();
-
- const UniString& GetDefaultExt() const { return aDfltExt; }
- UniString GetFilterType( sal_uInt16 nPos ) const;
-};
-
-#endif // _FILEDLG_HXX
+#endif // FILEDLG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/dialogs/filedlg.cxx b/svtools/source/dialogs/filedlg.cxx
index 77a071c7a7c5..c2224ae97d90 100644
--- a/svtools/source/dialogs/filedlg.cxx
+++ b/svtools/source/dialogs/filedlg.cxx
@@ -34,7 +34,7 @@ PathDialog::PathDialog( Window* _pParent, WinBits nStyle, sal_Bool bCreateDir )
ModalDialog( _pParent, WB_STDMODAL | nStyle )
{
pImpFileDlg = new ImpSvFileDlg;
- pImpFileDlg->CreateDialog( this, nStyle, WINDOW_PATHDIALOG, bCreateDir );
+ pImpFileDlg->CreatePathDialog(this, bCreateDir);
}
PathDialog::~PathDialog()
@@ -72,23 +72,4 @@ long PathDialog::OK()
return sal_True;
}
-FileDialog::~FileDialog()
-{
-}
-
-void FileDialog::FileSelect()
-{
- aFileHdlLink.Call( this );
-}
-
-void FileDialog::FilterSelect()
-{
- aFilterHdlLink.Call( this );
-}
-
-UniString FileDialog::GetFilterType( sal_uInt16 nPos ) const
-{
- return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterType( nPos );
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svtools/source/dialogs/filedlg2.cxx b/svtools/source/dialogs/filedlg2.cxx
index 319848ff5de1..32f6ef6f8240 100644
--- a/svtools/source/dialogs/filedlg2.cxx
+++ b/svtools/source/dialogs/filedlg2.cxx
@@ -692,600 +692,10 @@ UniString ImpPathDialog::GetPath() const
return aFile.GetFull();
}
-
-ImpFileDialog::ImpFileDialog( PathDialog* pDlg, WinBits nWinBits, RESOURCE_TYPE nType ) :
- ImpPathDialog( pDlg, nType, sal_False )
-{
- bOpen = (nWinBits & WB_SAVEAS) == 0;
-
- SvtResId aSvtResId = bOpen ? STR_FILEDLG_OPEN : STR_FILEDLG_SAVE;
-
- // Titel setzen
- GetFileDialog()->SetText( UniString( aSvtResId ) );
- nDirCount = 0;
-
- // initialize Controls if not used as a base class
- if ( nType == WINDOW_FILEDIALOG )
- InitControls();
-
- pDlg->SetHelpId( HID_FILEDLG_OPENDLG );
-
-}
-
-ImpFileDialog::~ImpFileDialog()
-{
- for ( size_t i = 0, n = aFilterList.size(); i < n; ++i ) {
- delete aFilterList[ i ];
- }
- aFilterList.clear();
-
- delete pFileTitel;
- if (pFileList && ( pFileList != pDirList ) )
- delete pFileList;
-
- delete pTypeTitel;
- delete pTypeList;
-}
-
-void ImpFileDialog::InitControls()
-{
- UniString aEmptyStr;
-
- const int nW = 160;
- const int nH = 48; // Um den Dialog in eine akzeptable Form zu bringen
-
- INITCONTROL( pFileTitel, FixedText, 0,
- Point(10, 12), Size(nW, 18), UniString( SvtResId( STR_FILEDLG_FILE ) ), HID_FILEDLG_FILE );
- INITCONTROL( pEdit, Edit, WB_BORDER,
- Point(10, 31), Size(nW, 20), aEmptyStr, HID_FILEDLG_EDIT ); // aMask()
- INITCONTROL( pFileList, ListBox, WB_SORT | WB_AUTOHSCROLL | WB_BORDER,
- Point(10, 58), Size(nW, 180-nH), aEmptyStr, HID_FILEDLG_FILES );
-
- INITCONTROL( pDirTitel, FixedText, 0,
- Point(nW+20, 12), Size(nW, 18), UniString( SvtResId( STR_FILEDLG_DIR ) ), HID_FILEDLG_DIR );
- INITCONTROL( pDirPath, FixedInfo, WB_PATHELLIPSIS,
- Point(nW+20, 33), Size(nW, 20), aPath.GetFull(), HID_FILEDLG_PATH );
- INITCONTROL( pDirList, KbdListBox, WB_AUTOHSCROLL | WB_BORDER,
- Point(nW+20, 58), Size(nW, 180-nH ), aEmptyStr, HID_FILEDLG_DIRS );
-
- INITCONTROL( pTypeTitel, FixedText, 0,
- Point(10, 246-nH), Size(nW, 18), UniString( SvtResId( STR_FILEDLG_TYPE ) ), HID_FILEDLG_TYPE );
-
-#ifndef UNX
- INITCONTROL( pTypeList, ListBox, WB_DROPDOWN,
- Point(10, 265-nH ), Size(nW, 100 ), aEmptyStr, HID_FILEDLG_TYPES );
-
- INITCONTROL( pDriveTitle, FixedText, 0,
- Point(nW+20, 246-nH), Size(nW, 18), UniString( SvtResId( STR_FILEDLG_DRIVES ) ), HID_FILEDLG_DRIVE );
- INITCONTROL( pDriveList, ListBox, WB_DROPDOWN,
- Point(nW+20, 265-nH ), Size(nW, 100 ), aEmptyStr, HID_FILEDLG_DRIVES );
- pNewDirBtn = NULL;
- pHomeBtn = NULL;
-#else
- INITCONTROL( pTypeList, ListBox, WB_DROPDOWN,
- Point(10, 265-nH ), Size(2*nW+20, 100 ), aEmptyStr, HID_FILEDLG_TYPES );
-
- pDriveTitle = NULL;
- pDriveList = NULL;
- pNewDirBtn = NULL;
- pHomeBtn = NULL;
-#endif
-
- const long nButtonStartX = 2*nW+20+15;
- INITCONTROL( pOkBtn, PushButton, WB_DEFBUTTON,
- Point(nButtonStartX, 10), Size(STD_BTN_WIDTH, STD_BTN_HEIGHT),
- Button::GetStandardText( BUTTON_OK ), "" );
- INITCONTROL( pCancelBtn, CancelButton, 0,
- Point(nButtonStartX, 45 ), Size(STD_BTN_WIDTH, STD_BTN_HEIGHT),
- Button::GetStandardText( BUTTON_CANCEL ), "" );
-
- pLoadBtn = 0;
-
- GetFileDialog()->SetOutputSizePixel( Size(nButtonStartX+STD_BTN_WIDTH+10, 298-nH) );
-
- nOwnChildren = GetPathDialog()->GetChildCount();
-
- // Handler setzen
- if (pDriveList)
- pDriveList->SetSelectHdl( LINK( this, ImpFileDialog, SelectHdl ) );
-
- if (pDirList)
- pDirList->SetDoubleClickHdl(LINK( this, ImpFileDialog, DblClickHdl) );
-
- if (pOkBtn)
- pOkBtn->SetClickHdl( LINK( this, ImpFileDialog, ClickHdl) );
-
- if (pCancelBtn)
- pCancelBtn->SetClickHdl( LINK( this, ImpFileDialog, ClickHdl) );
-
- if( pFileList )
- {
- pFileList->SetSelectHdl( LINK( this, ImpFileDialog, SelectHdl ) );
- pFileList->SetDoubleClickHdl( LINK( this, ImpFileDialog, DblClickHdl ) );
- }
-
- if( pTypeList )
- pTypeList->SetSelectHdl( LINK( this, ImpFileDialog, DblClickHdl ) );
-}
-
-IMPL_LINK( ImpFileDialog, SelectHdl, ListBox *, p )
-{
- if( p == pDriveList )
- {
- UniString aDrive ( pDriveList->GetSelectEntry(), 0, 2);
- aDrive += '\\';
- SetPath( aDrive );
- }
- else if (p == pFileList)
- {
- // Ausgewaehltes File in das Edit stellen
- pEdit->SetText( pFileList->GetSelectEntry() );
- GetFileDialog()->FileSelect();
- }
- return 0;
-}
-
-
-IMPL_LINK( ImpFileDialog, DblClickHdl, ListBox *, pBox )
-{
- // isolate the pure name of the entry
- // removing trailing stuff and leading spaces
- UniString aEntry( pBox->GetSelectEntry() );
-
- aEntry.EraseLeadingChars( ' ' );
- sal_uInt16 nPos = aEntry.Search( '/' );
- aEntry.Erase( nPos );
-
- // build the absolute path to the selected item
- DirEntry aNewPath;
- aNewPath.ToAbs();
-
- if( ( pDirList != pFileList ) && ( pBox == pDirList ) )
- {
- // SVLOOK
- sal_uInt16 nCurPos = pDirList->GetSelectEntryPos();
-
- // Wenn es schon das aktuelle ist, dann mache nichts
- if( nCurPos == nDirCount-1 )
- return 0;
-
- // Wird nach oben gewechselt
- if( nCurPos < nDirCount )
- aNewPath = aNewPath[nDirCount-nCurPos-1];
- else
- aNewPath += aEntry;
- }
- else
- {
- // non-SVLOOK
- if( aEntry == UniString( SvtResId( STR_FILEDLG_GOUP ) ) )
- aEntry.AssignAscii( ".." );
- aNewPath += aEntry;
- }
-
- if( pBox == pFileList )
- {
- DirEntry aFile( aEntry );
-
- // Abfrage, ob File ueberschrieben werden soll...
- if( !FileStat(aFile).IsKind(FSYS_KIND_DIR) && IsFileOk( aFile ) )
- {
- // dann kompletten Pfad mit Filenamen merken und Dialog beenden
- aPath = aNewPath;
- GetFileDialog()->EndDialog( sal_True );
- }
- }
-
- GetFileDialog()->EnterWait();
-
- UniString aFull = aNewPath.GetFull();
-
- if( ( ( pBox == pDirList ) && ( pDirList != pFileList ) ) ||
- ( ( pDirList == pFileList ) && FileStat( aNewPath ).GetKind() & FSYS_KIND_DIR ) )
- {
- // Neuen Pfad setzen und Listboxen updaten
- aPath = aNewPath;
- if( !aPath.SetCWD( sal_True ) )
- {
- if( ErrorBox( GetFileDialog(), WB_OK_CANCEL|WB_DEF_OK,
- UniString( SvtResId( STR_FILEDLG_CANTCHDIR ) ) ).Execute() == RET_CANCEL )
- {
- GetFileDialog()->EndDialog( sal_False );
- }
- }
- UpdateEntries( sal_True );
- GetFileDialog()->FileSelect();
- }
-
- if( pBox == pTypeList )
- {
- // Neue Maske setzen, und Listboxen updaten
- size_t nCurPos = pTypeList->GetSelectEntryPos();
- if( nCurPos+1 > aFilterList.size() )
- aMask.setGlob(UniString::CreateFromAscii( ALLFILES ));
- else
- {
- UniString aFilterListMask = aFilterList[ nCurPos ]->aMask;
- aMask = WildCard( aFilterListMask, ';' );
- }
-
- pEdit->SetText( aMask.getGlob() );
- UpdateEntries( sal_False );
- GetFileDialog()->FilterSelect();
- }
-
- GetFileDialog()->LeaveWait();
-
- return 0;
-}
-
-IMPL_LINK( ImpFileDialog, ClickHdl, Button*, pBtn )
-{
- if( ( pBtn == pOkBtn ) || ( pBtn == pLoadBtn ) )
- {
- DirEntry aFile( pEdit->GetText() );
-
- // Existiert File / File ueberschreiben
- if( IsFileOk( aFile ) )
- {
- // Ja, dann kompletten Pfad mit Filenamen merken und Dialog beenden
- aPath = aFile;
- aPath.ToAbs();
- GetFileDialog()->EndDialog( sal_True );
- }
- else
- {
- GetFileDialog()->EnterWait();
-
- // Falls der Pfad eine Wildcard oder einen Filenamen enthaelt
- // -> abschneiden und merken
- if( FileStat( aFile ).GetKind() & (FSYS_KIND_FILE | FSYS_KIND_WILD) || !aFile.Exists() )
- {
- aMask.setGlob(aFile.CutName());
- }
-
- // Neue Maske und neues Verzeichnis setzen, und Listboxen updaten
- pEdit->SetText( aMask.getGlob() );
- aFile.SetCWD( sal_True );
- UpdateEntries( sal_True );
-
- GetFileDialog()->LeaveWait();
- }
- }
- else if( pBtn == pCancelBtn )
- GetFileDialog()->EndDialog( sal_False );
-
- return 0;
-}
-
-void ImpFileDialog::UpdateEntries( const sal_Bool bWithDirs )
-{
- GetFileDialog()->EnterWait();
-
- UniString aTabString;
- DirEntry aTmpPath;
- aTmpPath.ToAbs();
- nDirCount = aTmpPath.Level();
-
- if( pFileList )
- {
- pFileList->SetUpdateMode( sal_False );
- pFileList->Clear();
- }
-
- if( bWithDirs && (pDirList != pFileList) )
- {
- pDirList->SetUpdateMode( sal_False );
- pDirList->Clear();
-
- for( sal_uInt16 i = nDirCount; i > 0; i-- )
- {
- UniString aEntryStr( aTabString );
- aEntryStr += aTmpPath[i-1].GetName();
- pDirList->InsertEntry( aEntryStr );
- aTabString.AppendAscii( " ", 2 );
- }
- }
-
- // for the combined box insert a '..'
- // (this happens only if WB_3DLOOK is not set)
-
- if( pDirList == pFileList && nDirCount != 1 )
- pFileList->InsertEntry( UniString( SvtResId( STR_FILEDLG_GOUP ) ) );
-
- // scan the directory
- DirEntry aCurrent;
- aCurrent.ToAbs();
- Dir aDir( aCurrent, FSYS_KIND_DIR|FSYS_KIND_FILE );
- sal_uInt16 nEntries = aDir.Count();
-
- // TempMask, weil Vergleich case-sensitiv
- sal_Bool bMatchCase = sal_False; //aCurrent.IsCaseSensitive();
- UniString aWildCard( aMask.getGlob() );
- if ( !bMatchCase )
- aWildCard.ToLowerAscii();
- WildCard aTmpMask( aWildCard, ';' );
- if ( nEntries )
- {
- UniStringList aSortDirList;
- const comphelper::string::NaturalStringSorter& rSorter =
- ::vcl::unohelper::getNaturalStringSorterForAppLocale();
- for ( sal_uInt16 n = 0; n < nEntries; n++ )
- {
- DirEntry& rEntry = aDir[n];
- UniString aName( rEntry.GetName() );
-
- if( aName.Len() &&
- ( ( ( aName.GetChar(0) != '.' ) ||
- ( ( aName.GetChar(0) == '.' ) && aMask.getGlob()[0] == '.' ) )
- && rEntry.Exists() ) )
- {
- FileStat aFileStat( rEntry );
- UniString aTmpName( aName );
- if ( !bMatchCase )
- aTmpName.ToLowerAscii();
- if( ( aFileStat.GetKind() & FSYS_KIND_FILE ) && aTmpMask.Matches( aTmpName ) )
- {
- if( pFileList )
- pFileList->InsertEntry( aName );
- }
- else if( bWithDirs && ( aFileStat.GetKind() & FSYS_KIND_DIR ) )
- {
- if( pDirList == pFileList )
- {
- UniString aEntryStr( aName );
- aEntryStr += '/';
- pDirList->InsertEntry( aEntryStr );
- }
- else
- {
- size_t l = 0;
- for( l = 0; l < aSortDirList.size(); l++ )
- if( rSorter.compare( *aSortDirList[ l ], aName ) > 0 )
- break;
- if ( l < aSortDirList.size() ) {
- UniStringList::iterator it = aSortDirList.begin();
- ::std::advance( it, l );
- aSortDirList.insert( it, new UniString( aName ) );
- } else {
- aSortDirList.push_back( new UniString( aName ) );
- }
- }
- }
- }
- }
- for( size_t l = 0; l < aSortDirList.size(); l++ )
- {
- UniString aEntryStr( aTabString );
- aEntryStr += *aSortDirList[ l ];
- pDirList->InsertEntry( aEntryStr );
- delete aSortDirList[ l ];
- }
- }
-
- if( bWithDirs )
- UpdateDirs( aTmpPath );
-
- if( pFileList )
- {
- if ( pDirList == pFileList && nDirCount > 1 )
- pFileList->SelectEntryPos( 1 );
- else
- pFileList->SetNoSelection();
- pFileList->SetUpdateMode( sal_True );
- pFileList->Invalidate();
- pFileList->Update();
- }
-
- if( pDriveList )
- {
- if( pDirList->GetEntryCount() > 0 )
- {
- UniString aStr( pDirList->GetEntry( 0 ) );
- aStr.Erase( 2 );
- aStr.ToLowerAscii();
- pDriveList->SelectEntry( aStr );
- }
- }
-
- GetFileDialog()->LeaveWait();
-}
-
-sal_Bool ImpFileDialog::IsFileOk( const DirEntry& rDirEntry )
-{
- if( FileStat( rDirEntry ).GetKind() & (FSYS_KIND_WILD | FSYS_KIND_DEV) )
- return sal_False;
- if( FileStat( rDirEntry ).GetKind() & FSYS_KIND_DIR )
- {
- if( pFileList )
- return sal_False;
- }
- else if( bOpen )
- {
- // Datei vorhanden ?
- if( !FileStat( rDirEntry ).IsKind( FSYS_KIND_FILE ) )
- {
- UniString aErrorString( SvtResId( STR_FILEDLG_CANTOPENFILE ) );
- aErrorString.AppendAscii( "\n[" );
- aErrorString += rDirEntry.GetFull();
- aErrorString += ']';
- InfoBox aBox( GetFileDialog(),
- aErrorString );
- aBox.Execute();
- return sal_False;
- }
- }
- else
- {
- // Datei vorhanden ?
- if( FileStat( ExtendFileName( rDirEntry ) ).IsKind( FSYS_KIND_FILE ) )
- {
- UniString aQueryString( SvtResId( STR_FILEDLG_OVERWRITE ) );
- aQueryString.AppendAscii( "\n[" );
- aQueryString += rDirEntry.GetFull();
- aQueryString += ']';
- QueryBox aBox( GetFileDialog(),
- WinBits( WB_YES_NO | WB_DEF_NO ),
- aQueryString );
- if( aBox.Execute() != RET_YES )
- return sal_False;
- }
- }
- return GetFileDialog()->OK() != 0;
-}
-
-void ImpFileDialog::SetPath( UniString const & rPath )
-{
- aPath = DirEntry( rPath );
- GetFileDialog()->EnterWait();
-
- DirEntry aFile( rPath );
-
- // Falls der Pfad eine Wildcard oder einen Filenamen enthaelt
- // -> abschneiden und merken
- if( FileStat( aFile ).GetKind() & (FSYS_KIND_FILE | FSYS_KIND_WILD) || !aFile.Exists() )
- {
- aMask.setGlob(aFile.CutName());
-
- // Neue Maske und neues Verzeichnis setzen, und Listboxen updaten
- if( pDirList )
- pEdit->SetText( aMask.getGlob() );
- else
- pEdit->SetText( rPath );
- }
-
- aFile.SetCWD( sal_True );
-
- UpdateEntries( sal_True );
-
- GetFileDialog()->LeaveWait();
-}
-
-void ImpFileDialog::SetPath( Edit const& rEdit )
-{
- UniString aPresetText = rEdit.GetText();
- if( aPresetText.Len() )
- SetPath( aPresetText );
-}
-
-void ImpFileDialog::PreExecute()
-{
- // ListBoxen erst unmittelbar vor Execute fuellen
- // (damit vor Execute der Pfad umgesetzt werden kann, ohne das immer die
- // Listboxen sofort upgedatet werden)
-
- GetFileDialog()->EnterWait();
-
- // Wenn kein Filter vorhanden, dann auch keine FilterBox
- if( pTypeList && !pTypeList->GetEntryCount() )
- {
- // pTypeList->InsertEntry( "* (all files)" );
- pTypeTitel->Disable();
- pTypeList->Disable();
- }
-
- if( pTypeList )
- {
- sal_uInt16 nCurType = pTypeList->GetSelectEntryPos();
- if( nCurType < aFilterList.size() )
- {
- 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
- aMask = WildCard( aFilterListMask, ';' );
- }
- else
- aMask.setGlob(UniString::CreateFromAscii( ALLFILES ));
- }
- else
- aMask.setGlob(UniString::CreateFromAscii( ALLFILES ));
-
- // Neue Maske setzen
- if( pEdit->GetText().Len() == 0 )
- pEdit->SetText( aMask.getGlob() );
-
- ImpPathDialog::PreExecute();
-
- GetFileDialog()->LeaveWait();
-}
-
-UniString ImpFileDialog::GetPath() const
-{
- DirEntry aFile( pEdit->GetText() );
- return ExtendFileName( aFile );
-}
-
-UniString ImpFileDialog::ExtendFileName( DirEntry aEntry ) const
-{
- aEntry.ToAbs();
- // das ganze Theater hier ohnehin nur machen, wenn Dateiname
- // ohne Extension angegeben wurde
- if( !aEntry.GetExtension().Len() )
- {
- UniString aPostfix; // hier kommt die ausgesuchte Extension herein
-
- // ist ein Filter mit Extension gesetzt?
- sal_uInt16 nChosenFilterPos = pTypeList->GetSelectEntryPos();
- if( nChosenFilterPos != LISTBOX_ENTRY_NOTFOUND )
- {
- UniString aExtensionMask = GetFileDialog()->GetFilterType( nChosenFilterPos );
- // aExtension ist z.B. *.sdw, alles bis einschliesslich Punkt abschneiden
- UniString aExtension = aExtensionMask.Copy( aExtensionMask.Search( '.' )+1 );
-
- // hat der Filter ueberhaupt eine Extension
- if( aExtension.Len() )
- {
- // keine Wildcards enthalten?
- if( ( aExtension.Search( '*' ) == STRING_NOTFOUND ) &&
- ( aExtension.Search( '?' ) == STRING_NOTFOUND ) )
- {
- // OK, Filter hat Extension ohne Wildcards -> verwenden
- aPostfix = aExtension;
- }
- else
- {
- // Filter hat Extension mit Wildcards (z.B. *.*) -> nicht verwenden
- aPostfix.Erase();
- }
- }
- else
- {
- // Filter hatte keine Extension (schwer vorstellbar) -> nichts anhaengen
- aPostfix.Erase();
- }
- }
- else
- {
- // kein Filter gefunden (merkw�rdig) -> Default-Extension anhaengen
- aPostfix = GetFileDialog()->GetDefaultExt();
- }
-
- // jetzt kann es mit dem Anhaengen losgehen
- const sal_Unicode* pExt = aPostfix.GetBuffer();
- while( *pExt == '*' || *pExt == '?' )
- pExt++;
-
- if( *pExt )
- {
- UniString aName = aEntry.GetName();
- if( *pExt != '.' )
- aName += '.';
- aName += pExt;
- aEntry.SetName( aName );
- }
- }
- return aEntry.GetFull();
-}
-
-
-void ImpSvFileDlg::CreateDialog( PathDialog* pSvDlg, WinBits nStyle, RESOURCE_TYPE nType, sal_Bool bCreate )
+void ImpSvFileDlg::CreatePathDialog( PathDialog* pSvDlg, bool bCreate )
{
delete pDlg;
- if ( nType == WINDOW_PATHDIALOG )
- pDlg = new ImpPathDialog( pSvDlg, nType, bCreate );
- else
- pDlg = new ImpFileDialog( pSvDlg, nStyle, nType );
+ pDlg = new ImpPathDialog( pSvDlg, WINDOW_PATHDIALOG, bCreate );
}
diff --git a/svtools/source/dialogs/filedlg2.hxx b/svtools/source/dialogs/filedlg2.hxx
index 39edd059ec84..300cd198c9f4 100644
--- a/svtools/source/dialogs/filedlg2.hxx
+++ b/svtools/source/dialogs/filedlg2.hxx
@@ -26,8 +26,8 @@
*
************************************************************************/
-#ifndef _FILEDLG2_HXX
-#define _FILEDLG2_HXX
+#ifndef FILEDLG2_HXX
+#define FILEDLG2_HXX
#include <tools/debug.hxx>
#include <tools/fsys.hxx>
@@ -126,69 +126,6 @@ public:
};
-
-class ImpFileDialog : public ImpPathDialog
-{
-private:
- FixedText* pFileTitel;
- ListBox* pFileList;
- FixedText* pTypeTitel;
- ListBox* pTypeList;
-
- WildCard aMask; // aktuelle Maske
-
- ImpFilterList aFilterList; // Filterliste
- sal_uInt16 nCurFilter; // aktueller Filter
-
- sal_Bool bOpen; // sal_True = Open; sal_False = SAVEAS
-
-protected:
- void InitControls();
-
- String ExtendFileName( DirEntry aEntry ) const;
-
- DECL_LINK( SelectHdl, ListBox * );
- DECL_LINK( DblClickHdl, ListBox * );
- DECL_LINK( ClickHdl, Button * );
-
- virtual void UpdateEntries( const sal_Bool bWithDirs );
- sal_Bool IsFileOk( const DirEntry& rDirEntry );
-
-public:
- ImpFileDialog( PathDialog* pDlg, WinBits nStyle, RESOURCE_TYPE nType );
- virtual ~ImpFileDialog();
-
- 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 );
- virtual String GetPath() const;
-
- virtual void PreExecute();
-
- FileDialog* GetFileDialog() const { return (FileDialog*)GetPathDialog(); }
-};
-
-inline String ImpFileDialog::GetFilterName( size_t nPos ) const
-{
- String aName;
- if ( nPos < aFilterList.size() ) {
- aName = aFilterList[ nPos ]->aName;
- }
- return aName;
-}
-
-inline String ImpFileDialog::GetFilterType( size_t nPos ) const
-{
- String aFilterMask;
- if ( nPos < aFilterList.size() ) {
- aFilterMask = aFilterList[ nPos ]->aMask;
- }
- return aFilterMask;
-}
-
class ImpSvFileDlg
{
private:
@@ -199,13 +136,13 @@ public:
~ImpSvFileDlg() { delete pDlg; }
ImpPathDialog* GetDialog() const { return pDlg; }
- void CreateDialog( PathDialog* pCreateFrom, WinBits nStyle, RESOURCE_TYPE nType, sal_Bool bCreate );
+ void CreatePathDialog(PathDialog* pCreateFrom, bool bCreate);
void SetOkButtonText( const String& rText ) { pDlg->SetOkButtonText( rText ); } // ihr habts ja nicht anders gewollt
void SetCancelButtonText( const String& rText ) { pDlg->SetCancelButtonText( rText ); }
};
-#endif // _FILEDLG2_HXX
+#endif // FILEDLG2_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */