1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: filedlg2.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <tools/debug.hxx>
35 #include <tools/fsys.hxx>
36 #ifndef _SV_BUTTON_HXX //autogen wg. PushButton
37 #include <vcl/button.hxx>
39 #include <vcl/unohelp.hxx>
56 ImpFilterItem( const String
& rFilter
, const String
& rMask
)
63 DECLARE_LIST( ImpFilterList
, ImpFilterItem
* )
64 #include <vcl/lstbox.hxx>
66 class KbdListBox
: public ListBox
70 KbdListBox( Window
* pParent
, WinBits nStyle
= WB_BORDER
)
71 : ListBox ( pParent
, nStyle
)
74 virtual long PreNotify( NotifyEvent
& rNEvt
);
81 friend class ImpFileDialog
;
84 PathDialog
* pSvPathDialog
;
90 FixedText
* pDriveTitle
;
93 PushButton
* pCancelBtn
;
95 PushButton
* pNewDirBtn
;
99 DirEntry aPath
; // aktuell angewaehlter Pfad
100 USHORT nDirCount
; // Anzahl der Verzeichnis-
103 ::com::sun::star::uno::Reference
< ::com::sun::star::i18n::XCollator
>
108 virtual void UpdateEntries( const BOOL bWithDirs
);
109 void UpdateDirs( const DirEntry
& rTmpPath
);
111 BOOL
IsFileOk( const DirEntry
& rDirEntry
);
114 DECL_LINK( SelectHdl
, ListBox
* );
115 DECL_LINK( DblClickHdl
, ListBox
* );
116 DECL_LINK( ClickHdl
, Button
* );
119 ImpPathDialog( PathDialog
* pDlg
, RESOURCE_TYPE nType
, BOOL bCreateDir
);
120 virtual ~ImpPathDialog();
122 virtual void SetPath( const String
& rPath
);
123 virtual void SetPath( const Edit
& rEdit
);
124 virtual String
GetPath() const;
126 virtual void PreExecute();
127 virtual void PostExecute();
129 PathDialog
* GetPathDialog() const { return pSvPathDialog
; }
131 void SetOkButtonText( const String
& rText
) { pOkBtn
->SetText( rText
); }
132 void SetCancelButtonText( const String
& rText
) { pCancelBtn
->SetText( rText
); }
137 class ImpFileDialog
: public ImpPathDialog
140 FixedText
* pFileTitel
;
142 FixedText
* pTypeTitel
;
145 WildCard aMask
; // aktuelle Maske
147 ImpFilterList aFilterList
; // Filterliste
148 USHORT nCurFilter
; // aktueller Filter
150 BOOL bOpen
; // TRUE = Open; FALSE = SAVEAS
155 String
ExtendFileName( DirEntry aEntry
) const;
157 DECL_LINK( SelectHdl
, ListBox
* );
158 DECL_LINK( DblClickHdl
, ListBox
* );
159 DECL_LINK( ClickHdl
, Button
* );
161 virtual void UpdateEntries( const BOOL bWithDirs
);
162 BOOL
IsFileOk( const DirEntry
& rDirEntry
);
165 ImpFileDialog( PathDialog
* pDlg
, WinBits nStyle
, RESOURCE_TYPE nType
);
166 virtual ~ImpFileDialog();
168 void AddFilter( const String
& rFilter
, const String
& rMask
);
169 void RemoveFilter( const String
& rFilter
);
170 void RemoveAllFilter();
171 void SetCurFilter( const String
& rFilter
);
172 String
GetCurFilter() const;
174 USHORT
GetFilterCount() const { return (USHORT
)aFilterList
.Count(); }
175 inline String
GetFilterName( USHORT nPos
) const;
176 inline String
GetFilterType( USHORT nPos
) const;
178 virtual void SetPath( const String
& rPath
);
179 virtual void SetPath( const Edit
& rEdit
);
180 virtual String
GetPath() const;
182 virtual void PreExecute();
184 FileDialog
* GetFileDialog() const { return (FileDialog
*)GetPathDialog(); }
187 inline String
ImpFileDialog::GetFilterName( USHORT nPos
) const
190 ImpFilterItem
* pItem
= aFilterList
.GetObject( nPos
);
192 aName
= pItem
->aName
;
196 inline String
ImpFileDialog::GetFilterType( USHORT nPos
) const
199 ImpFilterItem
* pItem
= aFilterList
.GetObject( nPos
);
201 aFilterMask
= pItem
->aMask
;
211 ImpSvFileDlg() { pDlg
= 0; }
212 ~ImpSvFileDlg() { delete pDlg
; }
214 ImpPathDialog
* GetDialog() const { return pDlg
; }
215 void CreateDialog( PathDialog
* pCreateFrom
, WinBits nStyle
, RESOURCE_TYPE nType
, BOOL bCreate
);
217 void SetOkButtonText( const String
& rText
) { pDlg
->SetOkButtonText( rText
); } // ihr habts ja nicht anders gewollt
218 void SetCancelButtonText( const String
& rText
) { pDlg
->SetCancelButtonText( rText
); }
222 #endif // _FILEDLG2_HXX