1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 #ifndef FPICKER_WIN32_VISTA_FILEPICKER_HXX
29 #define FPICKER_WIN32_VISTA_FILEPICKER_HXX
31 //-----------------------------------------------------------------------------
33 //-----------------------------------------------------------------------------
35 #include "asyncrequests.hxx"
36 #include "VistaFilePickerImpl.hxx"
37 #include "VistaFilePickerEventHandler.hxx"
39 #include <com/sun/star/lang/XInitialization.hpp>
40 #include <com/sun/star/lang/XServiceInfo.hpp>
41 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
42 #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
43 #include <com/sun/star/ui/dialogs/XFilePicker2.hpp>
44 #include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp>
45 #include <com/sun/star/ui/dialogs/XFilterManager.hpp>
46 #include <com/sun/star/ui/dialogs/XFilterGroupManager.hpp>
47 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
48 #include <com/sun/star/ui/dialogs/XFilePreview.hpp>
49 #include <com/sun/star/util/XCancellable.hpp>
51 #include <cppuhelper/compbase10.hxx>
52 #include <cppuhelper/basemutex.hxx>
53 #include <rtl/ustring.hxx>
55 //-----------------------------------------------------------------------------
57 //-----------------------------------------------------------------------------
60 #error "Clash on using CSS as namespace define."
62 #define css ::com::sun::star
69 //-----------------------------------------------------------------------------
71 //-----------------------------------------------------------------------------
73 typedef ::cppu::WeakComponentImplHelper10
<
74 css::ui::dialogs::XFilePicker2
,
75 css::ui::dialogs::XFilterManager
,
76 css::ui::dialogs::XFilterGroupManager
,
77 css::ui::dialogs::XFilePickerControlAccess
,
78 css::ui::dialogs::XFilePickerNotifier
,
79 css::ui::dialogs::XFilePreview
,
80 css::lang::XInitialization
,
81 css::util::XCancellable
,
82 css::lang::XEventListener
,
83 css::lang::XServiceInfo
> TVistaFilePickerBase
;
85 //-----------------------------------------------------------------------------
86 /** Implements the XFilePicker & friends interface(s)
87 for Windos Vista and upcoming versions.
89 Note: This will be an UNO wrapper for the real file picker
90 implementation oly. The real implementation is done in class
93 class VistaFilePicker
: public ::cppu::BaseMutex
94 , public TVistaFilePickerBase
98 //------------------------------------------------------------------------------------
100 //------------------------------------------------------------------------------------
102 VistaFilePicker( const css::uno::Reference
< css::lang::XMultiServiceFactory
>& xSMGR
);
103 virtual ~VistaFilePicker();
105 //------------------------------------------------------------------------------------
106 // XFilePickerNotifier
107 //------------------------------------------------------------------------------------
109 virtual void SAL_CALL
addFilePickerListener( const css::uno::Reference
< css::ui::dialogs::XFilePickerListener
>& xListener
)
110 throw( css::uno::RuntimeException
);
112 virtual void SAL_CALL
removeFilePickerListener( const css::uno::Reference
< css::ui::dialogs::XFilePickerListener
>& xListener
)
113 throw( css::uno::RuntimeException
);
115 //------------------------------------------------------------------------------------
116 // XExecutableDialog functions
117 //------------------------------------------------------------------------------------
119 virtual void SAL_CALL
setTitle( const ::rtl::OUString
& sTitle
)
120 throw( css::uno::RuntimeException
);
122 virtual sal_Int16 SAL_CALL
execute( )
123 throw( css::uno::RuntimeException
);
125 //------------------------------------------------------------------------------------
126 // XFilePicker functions
127 //------------------------------------------------------------------------------------
129 virtual void SAL_CALL
setMultiSelectionMode( sal_Bool bMode
)
130 throw( css::uno::RuntimeException
);
132 virtual void SAL_CALL
setDefaultName( const ::rtl::OUString
& sName
)
133 throw( css::uno::RuntimeException
);
135 virtual void SAL_CALL
setDisplayDirectory( const ::rtl::OUString
& sDirectory
)
136 throw (css::lang::IllegalArgumentException
,
137 css::uno::RuntimeException
);
139 virtual ::rtl::OUString SAL_CALL
getDisplayDirectory( )
140 throw( css::uno::RuntimeException
);
142 virtual css::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getFiles( )
143 throw( css::uno::RuntimeException
);
145 //------------------------------------------------------------------------------------
146 // XFilePicker2 functions
147 //------------------------------------------------------------------------------------
149 virtual css::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSelectedFiles( )
150 throw( css::uno::RuntimeException
);
152 //------------------------------------------------------------------------------------
153 // XFilterManager functions
154 //------------------------------------------------------------------------------------
156 virtual void SAL_CALL
appendFilter( const ::rtl::OUString
& sTitle
,
157 const ::rtl::OUString
& sFilter
)
158 throw (css::lang::IllegalArgumentException
,
159 css::uno::RuntimeException
);
161 virtual void SAL_CALL
setCurrentFilter( const ::rtl::OUString
& sTitle
)
162 throw (css::lang::IllegalArgumentException
,
163 css::uno::RuntimeException
);
165 virtual ::rtl::OUString SAL_CALL
getCurrentFilter( )
166 throw( css::uno::RuntimeException
);
168 //------------------------------------------------------------------------------------
169 // XFilterGroupManager functions
170 //------------------------------------------------------------------------------------
172 virtual void SAL_CALL
appendFilterGroup( const ::rtl::OUString
& sGroupTitle
,
173 const css::uno::Sequence
< css::beans::StringPair
>& lFilters
)
174 throw (css::lang::IllegalArgumentException
,
175 css::uno::RuntimeException
);
177 //------------------------------------------------------------------------------------
178 // XFilePickerControlAccess functions
179 //------------------------------------------------------------------------------------
181 virtual void SAL_CALL
setValue( sal_Int16 nControlId
,
182 sal_Int16 nControlAction
,
183 const css::uno::Any
& aValue
)
184 throw (css::uno::RuntimeException
);
186 virtual css::uno::Any SAL_CALL
getValue( sal_Int16 nControlId
,
187 sal_Int16 nControlAction
)
188 throw (css::uno::RuntimeException
);
190 virtual void SAL_CALL
enableControl( sal_Int16 nControlId
,
192 throw(css::uno::RuntimeException
);
194 virtual void SAL_CALL
setLabel( sal_Int16 nControlId
,
195 const ::rtl::OUString
& sLabel
)
196 throw (css::uno::RuntimeException
);
198 virtual ::rtl::OUString SAL_CALL
getLabel( sal_Int16 nControlId
)
199 throw (css::uno::RuntimeException
);
201 //------------------------------------------------
203 //------------------------------------------------
205 virtual css::uno::Sequence
< sal_Int16
> SAL_CALL
getSupportedImageFormats( )
206 throw (css::uno::RuntimeException
);
208 virtual sal_Int32 SAL_CALL
getTargetColorDepth( )
209 throw (css::uno::RuntimeException
);
211 virtual sal_Int32 SAL_CALL
getAvailableWidth( )
212 throw (css::uno::RuntimeException
);
214 virtual sal_Int32 SAL_CALL
getAvailableHeight( )
215 throw (css::uno::RuntimeException
);
217 virtual void SAL_CALL
setImage( sal_Int16 nImageFormat
,
218 const css::uno::Any
& aImage
)
219 throw (css::lang::IllegalArgumentException
, css::uno::RuntimeException
);
221 virtual sal_Bool SAL_CALL
setShowState( sal_Bool bShowState
)
222 throw (css::uno::RuntimeException
);
224 virtual sal_Bool SAL_CALL
getShowState( )
225 throw (css::uno::RuntimeException
);
227 //------------------------------------------------
229 //------------------------------------------------
231 virtual void SAL_CALL
initialize( const css::uno::Sequence
< css::uno::Any
>& lArguments
)
232 throw(css::uno::Exception
,
233 css::uno::RuntimeException
);
235 //------------------------------------------------
237 //------------------------------------------------
239 virtual void SAL_CALL
cancel( )
240 throw(css::uno::RuntimeException
);
242 //------------------------------------------------
244 //------------------------------------------------
246 virtual void SAL_CALL
disposing( const css::lang::EventObject
& aEvent
)
247 throw(css::uno::RuntimeException
);
249 //------------------------------------------------
251 //------------------------------------------------
253 virtual ::rtl::OUString SAL_CALL
getImplementationName( )
254 throw(css::uno::RuntimeException
);
256 virtual sal_Bool SAL_CALL
supportsService( const ::rtl::OUString
& ServiceName
)
257 throw(css::uno::RuntimeException
);
259 virtual css::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames( )
260 throw(css::uno::RuntimeException
);
263 //------------------------------------------------------------------------------------
264 // FilePicker Event functions
265 //------------------------------------------------------------------------------------
267 void SAL_CALL fileSelectionChanged(const css::ui::dialogs::FilePickerEvent& aEvent );
268 void SAL_CALL directoryChanged(const css::ui::dialogs::FilePickerEvent& aEvent );
269 ::rtl::OUString SAL_CALL helpRequested(const css::ui::dialogs::FilePickerEvent& aEvent ) const;
270 void SAL_CALL controlStateChanged(const css::ui::dialogs::FilePickerEvent& aEvent );
271 void SAL_CALL dialogSizeChanged( );
273 bool startupEventNotification(bool bStartupSuspended);
274 void shutdownEventNotification();
275 void suspendEventNotification();
276 void resumeEventNotification();
281 // prevent copy and assignment
282 VistaFilePicker( const VistaFilePicker
& );
283 VistaFilePicker
& operator=( const VistaFilePicker
& );
285 using WeakComponentImplHelperBase::disposing
;
289 //---------------------------------------------------------------------
290 /// service manager to create own used uno services
291 css::uno::Reference
< css::lang::XMultiServiceFactory
> m_xSMGR
;
293 //---------------------------------------------------------------------
294 css::uno::Sequence
< ::rtl::OUString
> m_lLastFiles
;
296 //---------------------------------------------------------------------
297 /** execute the COM dialog within a STA thread
298 * Must be used on the heap ... because it's implemented as OSL thread .-)
300 RequestHandlerRef m_rDialog
;
301 AsyncRequests m_aAsyncExecute
;
303 //---------------------------------------------------------------------
304 oslThreadIdentifier m_nFilePickerThreadId
;
311 } // namespace fpicker
315 #endif // FPICKER_WIN32_VISTA_FILEPICKER_HXX