xref: /AOO41X/main/svtools/inc/svtools/filedlg.hxx (revision 01aa44aa134af97080e2cf8e8bf3a0a4cd1cffe0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVT_FILEDLG_HXX
25 #define _SVT_FILEDLG_HXX
26 
27 #include "svtools/svtdllapi.h"
28 
29 #ifndef _DIALOG_HXX
30 #include <vcl/dialog.hxx>
31 #endif
32 
33 class Edit;
34 class ImpSvFileDlg;
35 
36 // --------------
37 // - SvPathDialog -
38 // --------------
39 
40 class SVT_DLLPUBLIC PathDialog : public ModalDialog
41 {
42 private:
43     friend class FileDialog;    // Imp...
44 
45     ImpSvFileDlg*       pImpFileDlg;    // Implementation
46     Link                aOKHdlLink;     // Link zum OK-Handler
47 
48 protected:
49     UniString           aDfltExt;       // Default - Extension
50 
51 public:
52                         PathDialog( Window* pParent, WinBits nWinStyle = 0, sal_Bool bCreateDir = sal_True );
53                         ~PathDialog();
54 
55     virtual long        OK();
56 
57     void                SetPath( const UniString& rNewPath );
58     void                SetPath( const Edit& rEdit );
59     UniString               GetPath() const;
60 
SetOKHdl(const Link & rLink)61     void                SetOKHdl( const Link& rLink ) { aOKHdlLink = rLink; }
GetOKHdl() const62     const Link&         GetOKHdl() const { return aOKHdlLink; }
63 
64     virtual short       Execute();
65 };
66 
67 // --------------
68 // - SvFileDialog -
69 // --------------
70 
71 class SVT_DLLPUBLIC FileDialog : public PathDialog
72 {
73 private:
74     Link                aFileHdlLink;   // Link zum FileSelect-Handler
75     Link                aFilterHdlLink; // Link zum FilterSelect-Handler
76 
77 public:
78                         FileDialog( Window* pParent, WinBits nWinStyle );
79                         ~FileDialog();
80 
81     virtual void        FileSelect();
82     virtual void        FilterSelect();
83 
SetDefaultExt(const UniString & rExt)84     void                SetDefaultExt( const UniString& rExt ) { aDfltExt = rExt; }
GetDefaultExt() const85     const UniString&        GetDefaultExt() const { return aDfltExt; }
86     void                AddFilter( const UniString& rFilter, const UniString& rType );
87     void                RemoveFilter( const UniString& rFilter );
88     void                RemoveAllFilter();
89     void                SetCurFilter( const UniString& rFilter );
90     UniString               GetCurFilter() const;
91     sal_uInt16              GetFilterCount() const;
92     UniString               GetFilterName( sal_uInt16 nPos ) const;
93     UniString               GetFilterType( sal_uInt16 nPos ) const;
94 
SetFileSelectHdl(const Link & rLink)95     void                SetFileSelectHdl( const Link& rLink ) { aFileHdlLink = rLink; }
GetFileSelectHdl() const96     const Link&         GetFileSelectHdl() const { return aFileHdlLink; }
SetFilterSelectHdl(const Link & rLink)97     void                SetFilterSelectHdl( const Link& rLink ) { aFilterHdlLink = rLink; }
GetFilterSelectHdl() const98     const Link&         GetFilterSelectHdl() const { return aFilterHdlLink; }
99 
100     void                SetOkButtonText( const UniString& rText );
101     void                SetCancelButtonText( const UniString& rText );
102 };
103 
104 #endif  // _FILEDLG_HXX
105