xref: /aoo42x/main/svtools/source/dialogs/filedlg.cxx (revision 5900e8ec)
1*5900e8ecSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*5900e8ecSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*5900e8ecSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*5900e8ecSAndrew Rist  * distributed with this work for additional information
6*5900e8ecSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*5900e8ecSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*5900e8ecSAndrew Rist  * "License"); you may not use this file except in compliance
9*5900e8ecSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*5900e8ecSAndrew Rist  *
11*5900e8ecSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*5900e8ecSAndrew Rist  *
13*5900e8ecSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*5900e8ecSAndrew Rist  * software distributed under the License is distributed on an
15*5900e8ecSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5900e8ecSAndrew Rist  * KIND, either express or implied.  See the License for the
17*5900e8ecSAndrew Rist  * specific language governing permissions and limitations
18*5900e8ecSAndrew Rist  * under the License.
19*5900e8ecSAndrew Rist  *
20*5900e8ecSAndrew Rist  *************************************************************/
21*5900e8ecSAndrew Rist 
22*5900e8ecSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svtools.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svtools/filedlg.hxx>
28cdf0e10cSrcweir #include <filedlg2.hxx>
29cdf0e10cSrcweir 
PathDialog(Window * _pParent,WinBits nStyle,sal_Bool bCreateDir)30cdf0e10cSrcweir PathDialog::PathDialog( Window* _pParent, WinBits nStyle, sal_Bool bCreateDir ) :
31cdf0e10cSrcweir 	ModalDialog( _pParent, WB_STDMODAL | nStyle )
32cdf0e10cSrcweir {
33cdf0e10cSrcweir 	pImpFileDlg = new ImpSvFileDlg;
34cdf0e10cSrcweir 	pImpFileDlg->CreateDialog( this, nStyle, WINDOW_PATHDIALOG, bCreateDir );
35cdf0e10cSrcweir }
36cdf0e10cSrcweir 
~PathDialog()37cdf0e10cSrcweir PathDialog::~PathDialog()
38cdf0e10cSrcweir {
39cdf0e10cSrcweir 	delete pImpFileDlg;
40cdf0e10cSrcweir }
41cdf0e10cSrcweir 
Execute()42cdf0e10cSrcweir short PathDialog::Execute()
43cdf0e10cSrcweir {
44cdf0e10cSrcweir 	pImpFileDlg->GetDialog()->PreExecute();
45cdf0e10cSrcweir 	short n = ModalDialog::Execute();
46cdf0e10cSrcweir 	return n;
47cdf0e10cSrcweir }
48cdf0e10cSrcweir 
GetPath() const49cdf0e10cSrcweir UniString PathDialog::GetPath() const
50cdf0e10cSrcweir {
51cdf0e10cSrcweir 	return pImpFileDlg->GetDialog()->GetPath();
52cdf0e10cSrcweir }
53cdf0e10cSrcweir 
SetPath(const UniString & rPath)54cdf0e10cSrcweir void PathDialog::SetPath( const UniString& rPath )
55cdf0e10cSrcweir {
56cdf0e10cSrcweir 	pImpFileDlg->GetDialog()->SetPath( rPath );
57cdf0e10cSrcweir }
58cdf0e10cSrcweir 
SetPath(const Edit & rEdit)59cdf0e10cSrcweir void PathDialog::SetPath( const Edit& rEdit )
60cdf0e10cSrcweir {
61cdf0e10cSrcweir   pImpFileDlg->GetDialog()->SetPath( rEdit );
62cdf0e10cSrcweir }
63cdf0e10cSrcweir 
OK()64cdf0e10cSrcweir long PathDialog::OK()
65cdf0e10cSrcweir {
66cdf0e10cSrcweir 	if( aOKHdlLink.IsSet() )
67cdf0e10cSrcweir 		return aOKHdlLink.Call( this );
68cdf0e10cSrcweir 	else
69cdf0e10cSrcweir 		return sal_True;
70cdf0e10cSrcweir }
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 
FileDialog(Window * _pParent,WinBits nStyle)73cdf0e10cSrcweir FileDialog::FileDialog( Window* _pParent, WinBits nStyle ) :
74cdf0e10cSrcweir 	PathDialog( _pParent, WB_STDMODAL | nStyle )
75cdf0e10cSrcweir {
76cdf0e10cSrcweir 	// Dadurch dass hier bei VCL nicht der CTOR mit ResType verwendet wird,
77cdf0e10cSrcweir 	// wurde im PathDialog-CTOR leider ein ImpPathDialog angelegt...
78cdf0e10cSrcweir 	// So zwar scheisse, aber der Dialog ist eh' nur ein Hack:
79cdf0e10cSrcweir 	pImpFileDlg->CreateDialog( this, nStyle, WINDOW_FILEDIALOG, sal_False );
80cdf0e10cSrcweir }
81cdf0e10cSrcweir 
~FileDialog()82cdf0e10cSrcweir FileDialog::~FileDialog()
83cdf0e10cSrcweir {
84cdf0e10cSrcweir }
85cdf0e10cSrcweir 
AddFilter(const UniString & rFilter,const UniString & rMask)86cdf0e10cSrcweir void FileDialog::AddFilter( const UniString& rFilter, const UniString& rMask )
87cdf0e10cSrcweir {
88cdf0e10cSrcweir 	((ImpFileDialog*)pImpFileDlg->GetDialog())->AddFilter( rFilter, rMask );
89cdf0e10cSrcweir }
90cdf0e10cSrcweir 
RemoveFilter(const UniString & rFilter)91cdf0e10cSrcweir void FileDialog::RemoveFilter( const UniString& rFilter )
92cdf0e10cSrcweir {
93cdf0e10cSrcweir 	((ImpFileDialog*)pImpFileDlg->GetDialog())->RemoveFilter( rFilter );
94cdf0e10cSrcweir }
95cdf0e10cSrcweir 
RemoveAllFilter()96cdf0e10cSrcweir void FileDialog::RemoveAllFilter()
97cdf0e10cSrcweir {
98cdf0e10cSrcweir 	((ImpFileDialog*)pImpFileDlg->GetDialog())->RemoveAllFilter();
99cdf0e10cSrcweir }
100cdf0e10cSrcweir 
SetCurFilter(const UniString & rFilter)101cdf0e10cSrcweir void FileDialog::SetCurFilter( const UniString& rFilter )
102cdf0e10cSrcweir {
103cdf0e10cSrcweir 	((ImpFileDialog*)pImpFileDlg->GetDialog())->SetCurFilter( rFilter );
104cdf0e10cSrcweir }
105cdf0e10cSrcweir 
GetCurFilter() const106cdf0e10cSrcweir UniString FileDialog::GetCurFilter() const
107cdf0e10cSrcweir {
108cdf0e10cSrcweir 	return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetCurFilter();
109cdf0e10cSrcweir }
110cdf0e10cSrcweir 
FileSelect()111cdf0e10cSrcweir void FileDialog::FileSelect()
112cdf0e10cSrcweir {
113cdf0e10cSrcweir 	aFileHdlLink.Call( this );
114cdf0e10cSrcweir }
115cdf0e10cSrcweir 
FilterSelect()116cdf0e10cSrcweir void FileDialog::FilterSelect()
117cdf0e10cSrcweir {
118cdf0e10cSrcweir 	aFilterHdlLink.Call( this );
119cdf0e10cSrcweir }
120cdf0e10cSrcweir 
GetFilterCount() const121cdf0e10cSrcweir sal_uInt16 FileDialog::GetFilterCount() const
122cdf0e10cSrcweir {
123cdf0e10cSrcweir   return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterCount();
124cdf0e10cSrcweir }
125cdf0e10cSrcweir 
GetFilterName(sal_uInt16 nPos) const126cdf0e10cSrcweir UniString FileDialog::GetFilterName( sal_uInt16 nPos ) const
127cdf0e10cSrcweir {
128cdf0e10cSrcweir   return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterName( nPos );
129cdf0e10cSrcweir }
130cdf0e10cSrcweir 
GetFilterType(sal_uInt16 nPos) const131cdf0e10cSrcweir UniString FileDialog::GetFilterType( sal_uInt16 nPos ) const
132cdf0e10cSrcweir {
133cdf0e10cSrcweir   return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterType( nPos );
134cdf0e10cSrcweir }
135cdf0e10cSrcweir 
SetOkButtonText(const UniString & rText)136cdf0e10cSrcweir void FileDialog::SetOkButtonText( const UniString& rText )
137cdf0e10cSrcweir {
138cdf0e10cSrcweir 	pImpFileDlg->SetOkButtonText( rText );
139cdf0e10cSrcweir }
140cdf0e10cSrcweir 
SetCancelButtonText(const UniString & rText)141cdf0e10cSrcweir void FileDialog::SetCancelButtonText( const UniString& rText )
142cdf0e10cSrcweir {
143cdf0e10cSrcweir 	pImpFileDlg->SetCancelButtonText( rText );
144cdf0e10cSrcweir }
145