1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_svtools.hxx" 30 31 #include <svtools/filedlg.hxx> 32 #include <filedlg2.hxx> 33 34 PathDialog::PathDialog( Window* _pParent, WinBits nStyle, sal_Bool bCreateDir ) : 35 ModalDialog( _pParent, WB_STDMODAL | nStyle ) 36 { 37 pImpFileDlg = new ImpSvFileDlg; 38 pImpFileDlg->CreateDialog( this, nStyle, WINDOW_PATHDIALOG, bCreateDir ); 39 } 40 41 PathDialog::~PathDialog() 42 { 43 delete pImpFileDlg; 44 } 45 46 short PathDialog::Execute() 47 { 48 pImpFileDlg->GetDialog()->PreExecute(); 49 short n = ModalDialog::Execute(); 50 return n; 51 } 52 53 UniString PathDialog::GetPath() const 54 { 55 return pImpFileDlg->GetDialog()->GetPath(); 56 } 57 58 void PathDialog::SetPath( const UniString& rPath ) 59 { 60 pImpFileDlg->GetDialog()->SetPath( rPath ); 61 } 62 63 void PathDialog::SetPath( const Edit& rEdit ) 64 { 65 pImpFileDlg->GetDialog()->SetPath( rEdit ); 66 } 67 68 long PathDialog::OK() 69 { 70 if( aOKHdlLink.IsSet() ) 71 return aOKHdlLink.Call( this ); 72 else 73 return sal_True; 74 } 75 76 77 FileDialog::FileDialog( Window* _pParent, WinBits nStyle ) : 78 PathDialog( _pParent, WB_STDMODAL | nStyle ) 79 { 80 // Dadurch dass hier bei VCL nicht der CTOR mit ResType verwendet wird, 81 // wurde im PathDialog-CTOR leider ein ImpPathDialog angelegt... 82 // So zwar scheisse, aber der Dialog ist eh' nur ein Hack: 83 pImpFileDlg->CreateDialog( this, nStyle, WINDOW_FILEDIALOG, sal_False ); 84 } 85 86 FileDialog::~FileDialog() 87 { 88 } 89 90 void FileDialog::AddFilter( const UniString& rFilter, const UniString& rMask ) 91 { 92 ((ImpFileDialog*)pImpFileDlg->GetDialog())->AddFilter( rFilter, rMask ); 93 } 94 95 void FileDialog::RemoveFilter( const UniString& rFilter ) 96 { 97 ((ImpFileDialog*)pImpFileDlg->GetDialog())->RemoveFilter( rFilter ); 98 } 99 100 void FileDialog::RemoveAllFilter() 101 { 102 ((ImpFileDialog*)pImpFileDlg->GetDialog())->RemoveAllFilter(); 103 } 104 105 void FileDialog::SetCurFilter( const UniString& rFilter ) 106 { 107 ((ImpFileDialog*)pImpFileDlg->GetDialog())->SetCurFilter( rFilter ); 108 } 109 110 UniString FileDialog::GetCurFilter() const 111 { 112 return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetCurFilter(); 113 } 114 115 void FileDialog::FileSelect() 116 { 117 aFileHdlLink.Call( this ); 118 } 119 120 void FileDialog::FilterSelect() 121 { 122 aFilterHdlLink.Call( this ); 123 } 124 125 sal_uInt16 FileDialog::GetFilterCount() const 126 { 127 return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterCount(); 128 } 129 130 UniString FileDialog::GetFilterName( sal_uInt16 nPos ) const 131 { 132 return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterName( nPos ); 133 } 134 135 UniString FileDialog::GetFilterType( sal_uInt16 nPos ) const 136 { 137 return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterType( nPos ); 138 } 139 140 void FileDialog::SetOkButtonText( const UniString& rText ) 141 { 142 pImpFileDlg->SetOkButtonText( rText ); 143 } 144 145 void FileDialog::SetCancelButtonText( const UniString& rText ) 146 { 147 pImpFileDlg->SetCancelButtonText( rText ); 148 } 149