Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / fpicker / source / win32 / VistaFilePicker.hxx
blob71ccfd992ba98682501126f0c4dbc1aa226d3d8f
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>
33 #include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
35 #include <cppuhelper/compbase.hxx>
36 #include <cppuhelper/basemutex.hxx>
37 #include <rtl/ustring.hxx>
39 namespace fpicker{
40 namespace win32{
41 namespace vista{
44 // types
47 typedef ::cppu::WeakComponentImplHelper<
48 css::ui::dialogs::XFilePicker3,
49 css::ui::dialogs::XFilePickerControlAccess,
50 css::ui::dialogs::XFilePreview,
51 css::ui::dialogs::XFolderPicker2,
52 css::lang::XInitialization,
53 css::lang::XServiceInfo > TVistaFilePickerBase;
56 /** Implements the XFilePicker & friends interface(s)
57 for Windows Vista and upcoming versions.
59 Note: This will be a UNO wrapper for the real file picker
60 implementation only. The real implementation is done in class
61 VistaFilePickerImpl.
63 class VistaFilePicker : public ::cppu::BaseMutex
64 , public TVistaFilePickerBase
66 public:
69 // ctor/dtor
72 explicit VistaFilePicker( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR, bool bFolderPicker );
73 virtual ~VistaFilePicker() override;
76 // XFilePickerNotifier
79 virtual void SAL_CALL addFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener ) override;
81 virtual void SAL_CALL removeFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener ) override;
84 // XExecutableDialog functions
87 virtual void SAL_CALL setTitle( const OUString& sTitle ) override;
89 virtual sal_Int16 SAL_CALL execute( ) override;
92 // XFilePicker functions
95 virtual void SAL_CALL setMultiSelectionMode( sal_Bool bMode ) override;
97 virtual void SAL_CALL setDefaultName( const OUString& sName ) override;
99 virtual void SAL_CALL setDisplayDirectory( const OUString& sDirectory ) override;
101 virtual OUString SAL_CALL getDisplayDirectory( ) override;
103 virtual css::uno::Sequence< OUString > SAL_CALL getFiles( ) override;
105 // XFilePicker2 functions
106 virtual css::uno::Sequence< OUString > SAL_CALL getSelectedFiles( ) override;
109 // XFilterManager functions
112 virtual void SAL_CALL appendFilter( const OUString& sTitle ,
113 const OUString& sFilter ) override;
115 virtual void SAL_CALL setCurrentFilter( const OUString& sTitle ) override;
117 virtual OUString SAL_CALL getCurrentFilter( ) override;
120 // XFilterGroupManager functions
123 virtual void SAL_CALL appendFilterGroup( const OUString& sGroupTitle,
124 const css::uno::Sequence< css::beans::StringPair >& lFilters ) override;
127 // XFilePickerControlAccess functions
130 virtual void SAL_CALL setValue( sal_Int16 nControlId ,
131 sal_Int16 nControlAction,
132 const css::uno::Any& aValue ) override;
134 virtual css::uno::Any SAL_CALL getValue( sal_Int16 nControlId ,
135 sal_Int16 nControlAction ) override;
137 virtual void SAL_CALL enableControl( sal_Int16 nControlId,
138 sal_Bool bEnable ) override;
140 virtual void SAL_CALL setLabel( sal_Int16 nControlId,
141 const OUString& sLabel ) override;
143 virtual OUString SAL_CALL getLabel( sal_Int16 nControlId ) override;
146 // XFilePreview
149 virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( ) override;
151 virtual sal_Int32 SAL_CALL getTargetColorDepth( ) override;
153 virtual sal_Int32 SAL_CALL getAvailableWidth( ) override;
155 virtual sal_Int32 SAL_CALL getAvailableHeight( ) override;
157 virtual void SAL_CALL setImage( sal_Int16 nImageFormat,
158 const css::uno::Any& aImage ) override;
160 virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState ) override;
162 virtual sal_Bool SAL_CALL getShowState( ) override;
165 // XInitialization
168 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& lArguments ) override;
171 // XCancellable
174 virtual void SAL_CALL cancel( ) override;
177 // XEventListener
179 /// @throws css::uno::RuntimeException
180 virtual void disposing( const css::lang::EventObject& aEvent );
183 // XServiceInfo
186 virtual OUString SAL_CALL getImplementationName( ) override;
188 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
190 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
193 // XFolderPicker functions
196 virtual OUString SAL_CALL getDirectory( ) override;
198 virtual void SAL_CALL setDescription( const OUString& aDescription ) override;
201 private:
203 // prevent copy and assignment
204 VistaFilePicker( const VistaFilePicker& );
205 VistaFilePicker& operator=( const VistaFilePicker& );
207 using WeakComponentImplHelperBase::disposing;
209 void ensureInit();
211 private:
214 /// service manager to create own used uno services
215 css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
218 css::uno::Sequence< OUString > m_lLastFiles;
221 /** execute the COM dialog within a STA thread
222 * Must be used on the heap ... because it's implemented as OSL thread .-)
224 RequestHandlerRef m_rDialog;
225 AsyncRequests m_aAsyncExecute;
228 oslThreadIdentifier m_nFilePickerThreadId;
230 bool m_bInitialized;
231 const bool m_bFolderPicker;
234 } // namespace vista
235 } // namespace win32
236 } // namespace fpicker
238 #endif // INCLUDED_FPICKER_SOURCE_WIN32_FILEPICKER_VISTAFILEPICKER_HXX
240 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */