merge the formfield patch from ooo-build
[ooovba.git] / fpicker / source / win32 / filepicker / VistaFilePicker.hxx
blob11ef5554049e7e86317a7b9cad6243a8032bb643
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: VistaFilePicker.hxx,v $
10 * $Revision: 1.4 $
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 #ifndef FPICKER_WIN32_VISTA_FILEPICKER_HXX
32 #define FPICKER_WIN32_VISTA_FILEPICKER_HXX
34 //-----------------------------------------------------------------------------
35 // includes
36 //-----------------------------------------------------------------------------
38 #include "asyncrequests.hxx"
39 #include "VistaFilePickerImpl.hxx"
40 #include "VistaFilePickerEventHandler.hxx"
42 #include <com/sun/star/lang/XInitialization.hpp>
43 #include <com/sun/star/lang/XServiceInfo.hpp>
44 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
45 #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
46 #include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
47 #include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
48 #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
49 #include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp>
50 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
51 #include <com/sun/star/ui/dialogs/XFilePreview.hpp>
52 #include <com/sun/star/util/XCancellable.hpp>
54 #include <cppuhelper/compbase10.hxx>
55 #include <cppuhelper/basemutex.hxx>
56 #include <rtl/ustring.hxx>
58 //-----------------------------------------------------------------------------
59 // namespace
60 //-----------------------------------------------------------------------------
62 #ifdef css
63 #error "Clash on using CSS as namespace define."
64 #else
65 #define css ::com::sun::star
66 #endif
68 namespace fpicker{
69 namespace win32{
70 namespace vista{
72 //-----------------------------------------------------------------------------
73 // types
74 //-----------------------------------------------------------------------------
76 typedef ::cppu::WeakComponentImplHelper10<
77 css::ui::dialogs::XFilePicker2,
78 css::ui::dialogs::XFilterManager,
79 css::ui::dialogs::XFilterGroupManager,
80 css::ui::dialogs::XFilePickerControlAccess,
81 css::ui::dialogs::XFilePickerNotifier,
82 css::ui::dialogs::XFilePreview,
83 css::lang::XInitialization,
84 css::util::XCancellable,
85 css::lang::XEventListener,
86 css::lang::XServiceInfo > TVistaFilePickerBase;
88 //-----------------------------------------------------------------------------
89 /** Implements the XFilePicker & friends interface(s)
90 for Windos Vista and upcoming versions.
92 Note: This will be an UNO wrapper for the real file picker
93 implementation oly. The real implementation is done in class
94 VistaFilePickerImpl.
96 class VistaFilePicker : public ::cppu::BaseMutex
97 , public TVistaFilePickerBase
99 public:
101 //------------------------------------------------------------------------------------
102 // ctor/dtor
103 //------------------------------------------------------------------------------------
105 VistaFilePicker( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
106 virtual ~VistaFilePicker();
108 //------------------------------------------------------------------------------------
109 // XFilePickerNotifier
110 //------------------------------------------------------------------------------------
112 virtual void SAL_CALL addFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener )
113 throw( css::uno::RuntimeException );
115 virtual void SAL_CALL removeFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener )
116 throw( css::uno::RuntimeException );
118 //------------------------------------------------------------------------------------
119 // XExecutableDialog functions
120 //------------------------------------------------------------------------------------
122 virtual void SAL_CALL setTitle( const ::rtl::OUString& sTitle )
123 throw( css::uno::RuntimeException );
125 virtual sal_Int16 SAL_CALL execute( )
126 throw( css::uno::RuntimeException );
128 //------------------------------------------------------------------------------------
129 // XFilePicker functions
130 //------------------------------------------------------------------------------------
132 virtual void SAL_CALL setMultiSelectionMode( sal_Bool bMode )
133 throw( css::uno::RuntimeException );
135 virtual void SAL_CALL setDefaultName( const ::rtl::OUString& sName )
136 throw( css::uno::RuntimeException );
138 virtual void SAL_CALL setDisplayDirectory( const ::rtl::OUString& sDirectory )
139 throw (css::lang::IllegalArgumentException,
140 css::uno::RuntimeException );
142 virtual ::rtl::OUString SAL_CALL getDisplayDirectory( )
143 throw( css::uno::RuntimeException );
145 virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles( )
146 throw( css::uno::RuntimeException );
148 //------------------------------------------------------------------------------------
149 // XFilePicker2 functions
150 //------------------------------------------------------------------------------------
152 virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSelectedFiles( )
153 throw( css::uno::RuntimeException );
155 //------------------------------------------------------------------------------------
156 // XFilterManager functions
157 //------------------------------------------------------------------------------------
159 virtual void SAL_CALL appendFilter( const ::rtl::OUString& sTitle ,
160 const ::rtl::OUString& sFilter )
161 throw (css::lang::IllegalArgumentException,
162 css::uno::RuntimeException );
164 virtual void SAL_CALL setCurrentFilter( const ::rtl::OUString& sTitle )
165 throw (css::lang::IllegalArgumentException,
166 css::uno::RuntimeException );
168 virtual ::rtl::OUString SAL_CALL getCurrentFilter( )
169 throw( css::uno::RuntimeException );
171 //------------------------------------------------------------------------------------
172 // XFilterGroupManager functions
173 //------------------------------------------------------------------------------------
175 virtual void SAL_CALL appendFilterGroup( const ::rtl::OUString& sGroupTitle,
176 const css::uno::Sequence< css::beans::StringPair >& lFilters )
177 throw (css::lang::IllegalArgumentException,
178 css::uno::RuntimeException );
180 //------------------------------------------------------------------------------------
181 // XFilePickerControlAccess functions
182 //------------------------------------------------------------------------------------
184 virtual void SAL_CALL setValue( sal_Int16 nControlId ,
185 sal_Int16 nControlAction,
186 const css::uno::Any& aValue )
187 throw (css::uno::RuntimeException);
189 virtual css::uno::Any SAL_CALL getValue( sal_Int16 nControlId ,
190 sal_Int16 nControlAction )
191 throw (css::uno::RuntimeException);
193 virtual void SAL_CALL enableControl( sal_Int16 nControlId,
194 sal_Bool bEnable )
195 throw(css::uno::RuntimeException );
197 virtual void SAL_CALL setLabel( sal_Int16 nControlId,
198 const ::rtl::OUString& sLabel )
199 throw (css::uno::RuntimeException);
201 virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 nControlId )
202 throw (css::uno::RuntimeException);
204 //------------------------------------------------
205 // XFilePreview
206 //------------------------------------------------
208 virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( )
209 throw (css::uno::RuntimeException);
211 virtual sal_Int32 SAL_CALL getTargetColorDepth( )
212 throw (css::uno::RuntimeException);
214 virtual sal_Int32 SAL_CALL getAvailableWidth( )
215 throw (css::uno::RuntimeException);
217 virtual sal_Int32 SAL_CALL getAvailableHeight( )
218 throw (css::uno::RuntimeException);
220 virtual void SAL_CALL setImage( sal_Int16 nImageFormat,
221 const css::uno::Any& aImage )
222 throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
224 virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState )
225 throw (css::uno::RuntimeException);
227 virtual sal_Bool SAL_CALL getShowState( )
228 throw (css::uno::RuntimeException);
230 //------------------------------------------------
231 // XInitialization
232 //------------------------------------------------
234 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& lArguments )
235 throw(css::uno::Exception ,
236 css::uno::RuntimeException);
238 //------------------------------------------------
239 // XCancellable
240 //------------------------------------------------
242 virtual void SAL_CALL cancel( )
243 throw(css::uno::RuntimeException);
245 //------------------------------------------------
246 // XEventListener
247 //------------------------------------------------
249 virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent )
250 throw(css::uno::RuntimeException);
252 //------------------------------------------------
253 // XServiceInfo
254 //------------------------------------------------
256 virtual ::rtl::OUString SAL_CALL getImplementationName( )
257 throw(css::uno::RuntimeException);
259 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
260 throw(css::uno::RuntimeException);
262 virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
263 throw(css::uno::RuntimeException);
266 //------------------------------------------------------------------------------------
267 // FilePicker Event functions
268 //------------------------------------------------------------------------------------
270 void SAL_CALL fileSelectionChanged(const css::ui::dialogs::FilePickerEvent& aEvent );
271 void SAL_CALL directoryChanged(const css::ui::dialogs::FilePickerEvent& aEvent );
272 ::rtl::OUString SAL_CALL helpRequested(const css::ui::dialogs::FilePickerEvent& aEvent ) const;
273 void SAL_CALL controlStateChanged(const css::ui::dialogs::FilePickerEvent& aEvent );
274 void SAL_CALL dialogSizeChanged( );
276 bool startupEventNotification(bool bStartupSuspended);
277 void shutdownEventNotification();
278 void suspendEventNotification();
279 void resumeEventNotification();
282 private:
284 // prevent copy and assignment
285 VistaFilePicker( const VistaFilePicker& );
286 VistaFilePicker& operator=( const VistaFilePicker& );
288 using WeakComponentImplHelperBase::disposing;
290 private:
292 //---------------------------------------------------------------------
293 /// service manager to create own used uno services
294 css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
296 //---------------------------------------------------------------------
297 css::uno::Sequence< ::rtl::OUString > m_lLastFiles;
299 //---------------------------------------------------------------------
300 /** execute the COM dialog within a STA thread
301 * Must be used on the heap ... because it's implemented as OSL thread .-)
303 RequestHandlerRef m_rDialog;
304 AsyncRequests m_aAsyncExecute;
306 //---------------------------------------------------------------------
307 oslThreadIdentifier m_nFilePickerThreadId;
309 bool m_bInitialized;
312 } // namespace vista
313 } // namespace win32
314 } // namespace fpicker
316 #undef css
318 #endif // FPICKER_WIN32_VISTA_FILEPICKER_HXX