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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svtools.hxx"
26
27 #include <svtools/filedlg.hxx>
28 #include <filedlg2.hxx>
29
PathDialog(Window * _pParent,WinBits nStyle,sal_Bool bCreateDir)30 PathDialog::PathDialog( Window* _pParent, WinBits nStyle, sal_Bool bCreateDir ) :
31 ModalDialog( _pParent, WB_STDMODAL | nStyle )
32 {
33 pImpFileDlg = new ImpSvFileDlg;
34 pImpFileDlg->CreateDialog( this, nStyle, WINDOW_PATHDIALOG, bCreateDir );
35 }
36
~PathDialog()37 PathDialog::~PathDialog()
38 {
39 delete pImpFileDlg;
40 }
41
Execute()42 short PathDialog::Execute()
43 {
44 pImpFileDlg->GetDialog()->PreExecute();
45 short n = ModalDialog::Execute();
46 return n;
47 }
48
GetPath() const49 UniString PathDialog::GetPath() const
50 {
51 return pImpFileDlg->GetDialog()->GetPath();
52 }
53
SetPath(const UniString & rPath)54 void PathDialog::SetPath( const UniString& rPath )
55 {
56 pImpFileDlg->GetDialog()->SetPath( rPath );
57 }
58
SetPath(const Edit & rEdit)59 void PathDialog::SetPath( const Edit& rEdit )
60 {
61 pImpFileDlg->GetDialog()->SetPath( rEdit );
62 }
63
OK()64 long PathDialog::OK()
65 {
66 if( aOKHdlLink.IsSet() )
67 return aOKHdlLink.Call( this );
68 else
69 return sal_True;
70 }
71
72
FileDialog(Window * _pParent,WinBits nStyle)73 FileDialog::FileDialog( Window* _pParent, WinBits nStyle ) :
74 PathDialog( _pParent, WB_STDMODAL | nStyle )
75 {
76 // Dadurch dass hier bei VCL nicht der CTOR mit ResType verwendet wird,
77 // wurde im PathDialog-CTOR leider ein ImpPathDialog angelegt...
78 // So zwar scheisse, aber der Dialog ist eh' nur ein Hack:
79 pImpFileDlg->CreateDialog( this, nStyle, WINDOW_FILEDIALOG, sal_False );
80 }
81
~FileDialog()82 FileDialog::~FileDialog()
83 {
84 }
85
AddFilter(const UniString & rFilter,const UniString & rMask)86 void FileDialog::AddFilter( const UniString& rFilter, const UniString& rMask )
87 {
88 ((ImpFileDialog*)pImpFileDlg->GetDialog())->AddFilter( rFilter, rMask );
89 }
90
RemoveFilter(const UniString & rFilter)91 void FileDialog::RemoveFilter( const UniString& rFilter )
92 {
93 ((ImpFileDialog*)pImpFileDlg->GetDialog())->RemoveFilter( rFilter );
94 }
95
RemoveAllFilter()96 void FileDialog::RemoveAllFilter()
97 {
98 ((ImpFileDialog*)pImpFileDlg->GetDialog())->RemoveAllFilter();
99 }
100
SetCurFilter(const UniString & rFilter)101 void FileDialog::SetCurFilter( const UniString& rFilter )
102 {
103 ((ImpFileDialog*)pImpFileDlg->GetDialog())->SetCurFilter( rFilter );
104 }
105
GetCurFilter() const106 UniString FileDialog::GetCurFilter() const
107 {
108 return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetCurFilter();
109 }
110
FileSelect()111 void FileDialog::FileSelect()
112 {
113 aFileHdlLink.Call( this );
114 }
115
FilterSelect()116 void FileDialog::FilterSelect()
117 {
118 aFilterHdlLink.Call( this );
119 }
120
GetFilterCount() const121 sal_uInt16 FileDialog::GetFilterCount() const
122 {
123 return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterCount();
124 }
125
GetFilterName(sal_uInt16 nPos) const126 UniString FileDialog::GetFilterName( sal_uInt16 nPos ) const
127 {
128 return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterName( nPos );
129 }
130
GetFilterType(sal_uInt16 nPos) const131 UniString FileDialog::GetFilterType( sal_uInt16 nPos ) const
132 {
133 return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterType( nPos );
134 }
135
SetOkButtonText(const UniString & rText)136 void FileDialog::SetOkButtonText( const UniString& rText )
137 {
138 pImpFileDlg->SetOkButtonText( rText );
139 }
140
SetCancelButtonText(const UniString & rText)141 void FileDialog::SetCancelButtonText( const UniString& rText )
142 {
143 pImpFileDlg->SetCancelButtonText( rText );
144 }
145