merge the formfield patch from ooo-build
[ooovba.git] / svtools / source / dialogs / filedlg.cxx
blob70ffe57201bbfe09f196b120bd3e68b9177e9274
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: filedlg.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svtools.hxx"
34 #include <filedlg.hxx>
35 #include <filedlg2.hxx>
37 PathDialog::PathDialog( Window* _pParent, WinBits nStyle, BOOL bCreateDir ) :
38 ModalDialog( _pParent, WB_STDMODAL | nStyle )
40 pImpFileDlg = new ImpSvFileDlg;
41 pImpFileDlg->CreateDialog( this, nStyle, WINDOW_PATHDIALOG, bCreateDir );
44 PathDialog::~PathDialog()
46 delete pImpFileDlg;
49 short PathDialog::Execute()
51 pImpFileDlg->GetDialog()->PreExecute();
52 short n = ModalDialog::Execute();
53 return n;
56 UniString PathDialog::GetPath() const
58 return pImpFileDlg->GetDialog()->GetPath();
61 void PathDialog::SetPath( const UniString& rPath )
63 pImpFileDlg->GetDialog()->SetPath( rPath );
66 void PathDialog::SetPath( const Edit& rEdit )
68 pImpFileDlg->GetDialog()->SetPath( rEdit );
71 long PathDialog::OK()
73 if( aOKHdlLink.IsSet() )
74 return aOKHdlLink.Call( this );
75 else
76 return TRUE;
80 FileDialog::FileDialog( Window* _pParent, WinBits nStyle ) :
81 PathDialog( _pParent, WB_STDMODAL | nStyle )
83 // Dadurch dass hier bei VCL nicht der CTOR mit ResType verwendet wird,
84 // wurde im PathDialog-CTOR leider ein ImpPathDialog angelegt...
85 // So zwar scheisse, aber der Dialog ist eh' nur ein Hack:
86 pImpFileDlg->CreateDialog( this, nStyle, WINDOW_FILEDIALOG, FALSE );
89 FileDialog::~FileDialog()
93 void FileDialog::AddFilter( const UniString& rFilter, const UniString& rMask )
95 ((ImpFileDialog*)pImpFileDlg->GetDialog())->AddFilter( rFilter, rMask );
98 void FileDialog::RemoveFilter( const UniString& rFilter )
100 ((ImpFileDialog*)pImpFileDlg->GetDialog())->RemoveFilter( rFilter );
103 void FileDialog::RemoveAllFilter()
105 ((ImpFileDialog*)pImpFileDlg->GetDialog())->RemoveAllFilter();
108 void FileDialog::SetCurFilter( const UniString& rFilter )
110 ((ImpFileDialog*)pImpFileDlg->GetDialog())->SetCurFilter( rFilter );
113 UniString FileDialog::GetCurFilter() const
115 return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetCurFilter();
118 void FileDialog::FileSelect()
120 aFileHdlLink.Call( this );
123 void FileDialog::FilterSelect()
125 aFilterHdlLink.Call( this );
128 USHORT FileDialog::GetFilterCount() const
130 return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterCount();
133 UniString FileDialog::GetFilterName( USHORT nPos ) const
135 return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterName( nPos );
138 UniString FileDialog::GetFilterType( USHORT nPos ) const
140 return ((ImpFileDialog*)pImpFileDlg->GetDialog())->GetFilterType( nPos );
143 void FileDialog::SetOkButtonText( const UniString& rText )
145 pImpFileDlg->SetOkButtonText( rText );
148 void FileDialog::SetCancelButtonText( const UniString& rText )
150 pImpFileDlg->SetCancelButtonText( rText );