bump product version to 6.1.0.2
[LibreOffice.git] / fpicker / source / win32 / filepicker / VistaFilePicker.hxx
blob8f36f5438698e5dc956fab4d9aef7747c14bdc3e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_FPICKER_SOURCE_WIN32_FILEPICKER_VISTAFILEPICKER_HXX
21 #define INCLUDED_FPICKER_SOURCE_WIN32_FILEPICKER_VISTAFILEPICKER_HXX
23 #include "asyncrequests.hxx"
24 #include "VistaFilePickerImpl.hxx"
25 #include "VistaFilePickerEventHandler.hxx"
27 #include <com/sun/star/lang/XInitialization.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
30 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
31 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
32 #include <com/sun/star/ui/dialogs/XFilePreview.hpp>
34 #include <cppuhelper/compbase.hxx>
35 #include <cppuhelper/basemutex.hxx>
36 #include <rtl/ustring.hxx>
38 namespace fpicker{
39 namespace win32{
40 namespace vista{
43 // types
46 typedef ::cppu::WeakComponentImplHelper<
47 css::ui::dialogs::XFilePicker3,
48 css::ui::dialogs::XFilePickerControlAccess,
49 css::ui::dialogs::XFilePreview,
50 css::lang::XInitialization,
51 css::lang::XServiceInfo > TVistaFilePickerBase;
54 /** Implements the XFilePicker & friends interface(s)
55 for Windows Vista and upcoming versions.
57 Note: This will be an UNO wrapper for the real file picker
58 implementation only. The real implementation is done in class
59 VistaFilePickerImpl.
61 class VistaFilePicker : public ::cppu::BaseMutex
62 , public TVistaFilePickerBase
64 public:
67 // ctor/dtor
70 explicit VistaFilePicker( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
71 virtual ~VistaFilePicker() override;
74 // XFilePickerNotifier
77 virtual void SAL_CALL addFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener ) override;
79 virtual void SAL_CALL removeFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener ) override;
82 // XExecutableDialog functions
85 virtual void SAL_CALL setTitle( const OUString& sTitle ) override;
87 virtual sal_Int16 SAL_CALL execute( ) override;
90 // XFilePicker functions
93 virtual void SAL_CALL setMultiSelectionMode( sal_Bool bMode ) override;
95 virtual void SAL_CALL setDefaultName( const OUString& sName ) override;
97 virtual void SAL_CALL setDisplayDirectory( const OUString& sDirectory ) override;
99 virtual OUString SAL_CALL getDisplayDirectory( ) override;
101 virtual css::uno::Sequence< OUString > SAL_CALL getFiles( ) override;
103 // XFilePicker2 functions
104 virtual css::uno::Sequence< OUString > SAL_CALL getSelectedFiles( ) override;
107 // XFilterManager functions
110 virtual void SAL_CALL appendFilter( const OUString& sTitle ,
111 const OUString& sFilter ) override;
113 virtual void SAL_CALL setCurrentFilter( const OUString& sTitle ) override;
115 virtual OUString SAL_CALL getCurrentFilter( ) override;
118 // XFilterGroupManager functions
121 virtual void SAL_CALL appendFilterGroup( const OUString& sGroupTitle,
122 const css::uno::Sequence< css::beans::StringPair >& lFilters ) override;
125 // XFilePickerControlAccess functions
128 virtual void SAL_CALL setValue( sal_Int16 nControlId ,
129 sal_Int16 nControlAction,
130 const css::uno::Any& aValue ) override;
132 virtual css::uno::Any SAL_CALL getValue( sal_Int16 nControlId ,
133 sal_Int16 nControlAction ) override;
135 virtual void SAL_CALL enableControl( sal_Int16 nControlId,
136 sal_Bool bEnable ) override;
138 virtual void SAL_CALL setLabel( sal_Int16 nControlId,
139 const OUString& sLabel ) override;
141 virtual OUString SAL_CALL getLabel( sal_Int16 nControlId ) override;
144 // XFilePreview
147 virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( ) override;
149 virtual sal_Int32 SAL_CALL getTargetColorDepth( ) override;
151 virtual sal_Int32 SAL_CALL getAvailableWidth( ) override;
153 virtual sal_Int32 SAL_CALL getAvailableHeight( ) override;
155 virtual void SAL_CALL setImage( sal_Int16 nImageFormat,
156 const css::uno::Any& aImage ) override;
158 virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState ) override;
160 virtual sal_Bool SAL_CALL getShowState( ) override;
163 // XInitialization
166 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& lArguments ) override;
169 // XCancellable
172 virtual void SAL_CALL cancel( ) override;
175 // XEventListener
177 /// @throws css::uno::RuntimeException
178 virtual void disposing( const css::lang::EventObject& aEvent );
181 // XServiceInfo
184 virtual OUString SAL_CALL getImplementationName( ) override;
186 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
188 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
192 // FilePicker Event functions
195 void SAL_CALL fileSelectionChanged(const css::ui::dialogs::FilePickerEvent& aEvent );
196 void SAL_CALL directoryChanged(const css::ui::dialogs::FilePickerEvent& aEvent );
197 OUString SAL_CALL helpRequested(const css::ui::dialogs::FilePickerEvent& aEvent ) const;
198 void SAL_CALL controlStateChanged(const css::ui::dialogs::FilePickerEvent& aEvent );
199 void SAL_CALL dialogSizeChanged( );
201 bool startupEventNotification(bool bStartupSuspended);
202 void shutdownEventNotification();
203 void suspendEventNotification();
204 void resumeEventNotification();
207 private:
209 // prevent copy and assignment
210 VistaFilePicker( const VistaFilePicker& );
211 VistaFilePicker& operator=( const VistaFilePicker& );
213 using WeakComponentImplHelperBase::disposing;
215 void ensureInit();
217 private:
220 /// service manager to create own used uno services
221 css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
224 css::uno::Sequence< OUString > m_lLastFiles;
227 /** execute the COM dialog within a STA thread
228 * Must be used on the heap ... because it's implemented as OSL thread .-)
230 RequestHandlerRef m_rDialog;
231 AsyncRequests m_aAsyncExecute;
234 oslThreadIdentifier m_nFilePickerThreadId;
236 bool m_bInitialized;
239 } // namespace vista
240 } // namespace win32
241 } // namespace fpicker
243 #endif // INCLUDED_FPICKER_SOURCE_WIN32_FILEPICKER_VISTAFILEPICKER_HXX
245 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */