xref: /AOO41X/main/fpicker/source/win32/filepicker/FilePicker.hxx (revision 10ce801889b00990ebdbcb412f4f91e2a9e6f21d)
1*10ce8018SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*10ce8018SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*10ce8018SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*10ce8018SAndrew Rist  * distributed with this work for additional information
6*10ce8018SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*10ce8018SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*10ce8018SAndrew Rist  * "License"); you may not use this file except in compliance
9*10ce8018SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*10ce8018SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*10ce8018SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*10ce8018SAndrew Rist  * software distributed under the License is distributed on an
15*10ce8018SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*10ce8018SAndrew Rist  * KIND, either express or implied.  See the License for the
17*10ce8018SAndrew Rist  * specific language governing permissions and limitations
18*10ce8018SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*10ce8018SAndrew Rist  *************************************************************/
21*10ce8018SAndrew Rist 
22*10ce8018SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _FILEPICKER_HXX_
25cdf0e10cSrcweir #define _FILEPICKER_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //_______________________________________________________________________________________________________________________
28cdf0e10cSrcweir //	includes of other projects
29cdf0e10cSrcweir //_______________________________________________________________________________________________________________________
30cdf0e10cSrcweir 
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #include <cppuhelper/compbase10.hxx>
33cdf0e10cSrcweir #include <osl/mutex.hxx>
34cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
35cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
36cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
37cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
38cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
39cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp>
40cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
41cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePreview.hpp>
42cdf0e10cSrcweir #include <com/sun/star/util/XCancellable.hpp>
43cdf0e10cSrcweir #include "asynceventnotifier.hxx"
44cdf0e10cSrcweir #include "eventnotification.hxx"
45cdf0e10cSrcweir 
46cdf0e10cSrcweir #include <memory>
47cdf0e10cSrcweir 
48cdf0e10cSrcweir //----------------------------------------------------------
49cdf0e10cSrcweir // Implementation class for the XFilePicker Interface
50cdf0e10cSrcweir //----------------------------------------------------------
51cdf0e10cSrcweir 
52cdf0e10cSrcweir //----------------------------------------------------------
53cdf0e10cSrcweir // forward declarations
54cdf0e10cSrcweir //----------------------------------------------------------
55cdf0e10cSrcweir 
56cdf0e10cSrcweir class CWinFileOpenImpl;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir //----------------------------------------------------------
59cdf0e10cSrcweir // class declaration
60cdf0e10cSrcweir //----------------------------------------------------------
61cdf0e10cSrcweir 
62cdf0e10cSrcweir class CFilePickerDummy
63cdf0e10cSrcweir {
64cdf0e10cSrcweir protected:
65cdf0e10cSrcweir 	osl::Mutex	m_aMutex;
66cdf0e10cSrcweir 	osl::Mutex	m_rbHelperMtx;
67cdf0e10cSrcweir };
68cdf0e10cSrcweir 
69cdf0e10cSrcweir class CFilePicker :
70cdf0e10cSrcweir 	public CFilePickerDummy,
71cdf0e10cSrcweir 	public cppu::WeakComponentImplHelper10<
72cdf0e10cSrcweir         ::com::sun::star::ui::dialogs::XFilterManager,
73cdf0e10cSrcweir         ::com::sun::star::ui::dialogs::XFilterGroupManager,
74cdf0e10cSrcweir         ::com::sun::star::ui::dialogs::XFilePickerControlAccess,
75cdf0e10cSrcweir         ::com::sun::star::ui::dialogs::XFilePickerNotifier,
76cdf0e10cSrcweir         ::com::sun::star::ui::dialogs::XFilePreview,
77cdf0e10cSrcweir         ::com::sun::star::ui::dialogs::XFilePicker2,
78cdf0e10cSrcweir 		::com::sun::star::lang::XInitialization,
79cdf0e10cSrcweir         ::com::sun::star::util::XCancellable,
80cdf0e10cSrcweir 		::com::sun::star::lang::XEventListener,
81cdf0e10cSrcweir 		::com::sun::star::lang::XServiceInfo >
82cdf0e10cSrcweir {
83cdf0e10cSrcweir public:
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	// ctor
86cdf0e10cSrcweir 	CFilePicker( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceMgr );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 	//------------------------------------------------------------------------------------
89cdf0e10cSrcweir 	// XFilePickerNotifier
90cdf0e10cSrcweir 	//------------------------------------------------------------------------------------
91cdf0e10cSrcweir 
92cdf0e10cSrcweir     virtual void SAL_CALL addFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener )
93cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
94cdf0e10cSrcweir     virtual void SAL_CALL removeFilePickerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XFilePickerListener >& xListener )
95cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	//------------------------------------------------------------------------------------
98cdf0e10cSrcweir 	// XExecutableDialog functions
99cdf0e10cSrcweir 	//------------------------------------------------------------------------------------
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 	virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle )
102cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 	virtual sal_Int16 SAL_CALL execute(  )
105cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 	//------------------------------------------------------------------------------------
108cdf0e10cSrcweir 	// XFilePicker functions
109cdf0e10cSrcweir 	//------------------------------------------------------------------------------------
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	virtual void SAL_CALL setMultiSelectionMode( sal_Bool bMode )
112cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
113cdf0e10cSrcweir 
114cdf0e10cSrcweir     virtual void SAL_CALL setDefaultName( const ::rtl::OUString& aName )
115cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
116cdf0e10cSrcweir 
117cdf0e10cSrcweir     virtual void SAL_CALL setDisplayDirectory( const ::rtl::OUString& aDirectory )
118cdf0e10cSrcweir 		throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getDisplayDirectory(  )
121cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFiles(  )
124cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 	//------------------------------------------------------------------------------------
127cdf0e10cSrcweir 	// XFilePicker2 functions
128cdf0e10cSrcweir 	//------------------------------------------------------------------------------------
129cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSelectedFiles(  )
130cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	//------------------------------------------------------------------------------------
133cdf0e10cSrcweir 	// XFilterManager functions
134cdf0e10cSrcweir 	//------------------------------------------------------------------------------------
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 	virtual void SAL_CALL appendFilter( const ::rtl::OUString& aTitle, const ::rtl::OUString& aFilter )
137cdf0e10cSrcweir         throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     virtual void SAL_CALL setCurrentFilter( const ::rtl::OUString& aTitle )
140cdf0e10cSrcweir 		throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
141cdf0e10cSrcweir 
142cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getCurrentFilter(  )
143cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     //------------------------------------------------------------------------------------
146cdf0e10cSrcweir 	// XFilterGroupManager functions
147cdf0e10cSrcweir 	//------------------------------------------------------------------------------------
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     virtual void SAL_CALL appendFilterGroup( const ::rtl::OUString& sGroupTitle, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aFilters )
150cdf0e10cSrcweir         throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	//------------------------------------------------------------------------------------
153cdf0e10cSrcweir 	// XFilePickerControlAccess functions
154cdf0e10cSrcweir 	//------------------------------------------------------------------------------------
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 	virtual void SAL_CALL setValue( sal_Int16 aControlId, sal_Int16 aControlAction, const ::com::sun::star::uno::Any& aValue )
157cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
158cdf0e10cSrcweir 
159cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL getValue( sal_Int16 aControlId, sal_Int16 aControlAction )
160cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
161cdf0e10cSrcweir 
162cdf0e10cSrcweir     virtual void SAL_CALL enableControl( sal_Int16 aControlId, sal_Bool bEnable )
163cdf0e10cSrcweir 		throw(::com::sun::star::uno::RuntimeException );
164cdf0e10cSrcweir 
165cdf0e10cSrcweir 	virtual void SAL_CALL setLabel( sal_Int16 aControlId, const ::rtl::OUString& aLabel )
166cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
167cdf0e10cSrcweir 
168cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getLabel( sal_Int16 aControlId )
169cdf0e10cSrcweir 		throw (::com::sun::star::uno::RuntimeException);
170cdf0e10cSrcweir 
171cdf0e10cSrcweir     //------------------------------------------------
172cdf0e10cSrcweir     // XFilePreview
173cdf0e10cSrcweir     //------------------------------------------------
174cdf0e10cSrcweir 
175cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats(  ) throw (::com::sun::star::uno::RuntimeException);
176cdf0e10cSrcweir 
177cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getTargetColorDepth(  ) throw (::com::sun::star::uno::RuntimeException);
178cdf0e10cSrcweir 
179cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAvailableWidth(  ) throw (::com::sun::star::uno::RuntimeException);
180cdf0e10cSrcweir 
181cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getAvailableHeight(  ) throw (::com::sun::star::uno::RuntimeException);
182cdf0e10cSrcweir 
183cdf0e10cSrcweir     virtual void SAL_CALL setImage( sal_Int16 aImageFormat, const ::com::sun::star::uno::Any& aImage ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
184cdf0e10cSrcweir 
185cdf0e10cSrcweir     virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState ) throw (::com::sun::star::uno::RuntimeException);
186cdf0e10cSrcweir 
187cdf0e10cSrcweir     virtual sal_Bool SAL_CALL getShowState(  ) throw (::com::sun::star::uno::RuntimeException);
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 	//------------------------------------------------
190cdf0e10cSrcweir 	// XInitialization
191cdf0e10cSrcweir 	//------------------------------------------------
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 	virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
194cdf0e10cSrcweir 		throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
195cdf0e10cSrcweir 
196cdf0e10cSrcweir     //------------------------------------------------
197cdf0e10cSrcweir 	// XCancellable
198cdf0e10cSrcweir 	//------------------------------------------------
199cdf0e10cSrcweir 
200cdf0e10cSrcweir     virtual void SAL_CALL cancel( )
201cdf0e10cSrcweir 		throw(::com::sun::star::uno::RuntimeException);
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 	//------------------------------------------------
204cdf0e10cSrcweir     // XEventListener
205cdf0e10cSrcweir     //------------------------------------------------
206cdf0e10cSrcweir 
207cdf0e10cSrcweir     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent )
208cdf0e10cSrcweir         throw(::com::sun::star::uno::RuntimeException);
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 	//------------------------------------------------
211cdf0e10cSrcweir 	// XServiceInfo
212cdf0e10cSrcweir 	//------------------------------------------------
213cdf0e10cSrcweir 
214cdf0e10cSrcweir 	virtual ::rtl::OUString SAL_CALL getImplementationName(	 )
215cdf0e10cSrcweir 		throw(::com::sun::star::uno::RuntimeException);
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
218cdf0e10cSrcweir 		throw(::com::sun::star::uno::RuntimeException);
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
221cdf0e10cSrcweir 		throw(::com::sun::star::uno::RuntimeException);
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 	//------------------------------------------------------------------------------------
224cdf0e10cSrcweir 	// FilePicker Event functions
225cdf0e10cSrcweir 	//------------------------------------------------------------------------------------
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 	void SAL_CALL fileSelectionChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent );
228cdf0e10cSrcweir 	void SAL_CALL directoryChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent );
229cdf0e10cSrcweir     rtl::OUString SAL_CALL helpRequested( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent ) const;
230cdf0e10cSrcweir 	void SAL_CALL controlStateChanged( ::com::sun::star::ui::dialogs::FilePickerEvent aEvent );
231cdf0e10cSrcweir     void SAL_CALL dialogSizeChanged( );
232cdf0e10cSrcweir 
233cdf0e10cSrcweir     bool startupEventNotification(bool bStartupSuspended);
234cdf0e10cSrcweir     void shutdownEventNotification();
235cdf0e10cSrcweir     void suspendEventNotification();
236cdf0e10cSrcweir     void resumeEventNotification();
237cdf0e10cSrcweir 
238cdf0e10cSrcweir private:
239cdf0e10cSrcweir 	// prevent copy and assignment
240cdf0e10cSrcweir 	CFilePicker( const CFilePicker& );
241cdf0e10cSrcweir 	CFilePicker& operator=( const CFilePicker& );
242cdf0e10cSrcweir 
243cdf0e10cSrcweir     using WeakComponentImplHelperBase::disposing;
244cdf0e10cSrcweir 
245cdf0e10cSrcweir private:
246cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceMgr;   // to instanciate own services
247cdf0e10cSrcweir     CAsyncEventNotifier				                                               m_aAsyncEventNotifier;
248cdf0e10cSrcweir 	std::auto_ptr<CWinFileOpenImpl>	    										   m_pImpl;
249cdf0e10cSrcweir };
250cdf0e10cSrcweir 
251cdf0e10cSrcweir #endif
252