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 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 37 PathDialog::~PathDialog() 38 { 39 delete pImpFileDlg; 40 } 41 42 short PathDialog::Execute() 43 { 44 pImpFileDlg->GetDialog()->PreExecute(); 45 short n = ModalDialog::Execute(); 46 return n; 47 } 48 49 UniString PathDialog::GetPath() const 50 { 51 return pImpFileDlg->GetDialog()->GetPath(); 52 } 53 54 void PathDialog::SetPath( const UniString& rPath ) 55 { 56 pImpFileDlg->GetDialog()->SetPath( rPath ); 57 } 58 59 void PathDialog::SetPath( const Edit& rEdit ) 60 { 61 pImpFileDlg->GetDialog()->SetPath( rEdit ); 62 } 63 64 long PathDialog::OK() 65 { 66 if( aOKHdlLink.IsSet() ) 67 return aOKHdlLink.Call( this ); 68 else 69 return sal_True; 70 } 71 72 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 82 FileDialog::~FileDialog() 83 { 84 } 85 86 void FileDialog::AddFilter( const UniString& rFilter, const UniString& rMask ) 87 { 88 ((ImpFileDialog*)pImpFileDlg->GetDialog())->AddFilter( rFilter, rMask ); 89 } 90 91 void FileDialog::RemoveFilter( const UniString& rFilter ) 92 { 93 ((ImpFileDialog*)pImpFileDlg->GetDialog())->RemoveFilter( rFilter ); 94 } 95 96 void FileDialog::RemoveAllFilter() 97 { 98 ((ImpFileDialog*)pImpFileDlg->GetDialog())->RemoveAllFilter(); 99 } 100 101 void FileDialog::SetCurFilter( const UniString& rFilter ) 102 { 103 ((ImpFileDialog*)pImpFileDlg->GetDialog())->SetCurFilter( rFilter ); 104 } 105 106 UniString FileDialog::GetCurFilter() const 107 { 108 return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetCurFilter(); 109 } 110 111 void FileDialog::FileSelect() 112 { 113 aFileHdlLink.Call( this ); 114 } 115 116 void FileDialog::FilterSelect() 117 { 118 aFilterHdlLink.Call( this ); 119 } 120 121 sal_uInt16 FileDialog::GetFilterCount() const 122 { 123 return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterCount(); 124 } 125 126 UniString FileDialog::GetFilterName( sal_uInt16 nPos ) const 127 { 128 return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterName( nPos ); 129 } 130 131 UniString FileDialog::GetFilterType( sal_uInt16 nPos ) const 132 { 133 return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterType( nPos ); 134 } 135 136 void FileDialog::SetOkButtonText( const UniString& rText ) 137 { 138 pImpFileDlg->SetOkButtonText( rText ); 139 } 140 141 void FileDialog::SetCancelButtonText( const UniString& rText ) 142 { 143 pImpFileDlg->SetCancelButtonText( rText ); 144 } 145