1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include "requests.hxx"
23 #include "VistaFilePickerImpl.hxx"
24 #include "VistaFilePickerEventHandler.hxx"
26 #include <com/sun/star/lang/XInitialization.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 #include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
30 #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
31 #include <com/sun/star/ui/dialogs/XFilePreview.hpp>
32 #include <com/sun/star/ui/dialogs/XFolderPicker2.hpp>
34 #include <cppuhelper/compbase.hxx>
35 #include <cppuhelper/basemutex.hxx>
36 #include <rtl/ustring.hxx>
46 typedef ::cppu::WeakComponentImplHelper
<
47 css::ui::dialogs::XFilePicker3
,
48 css::ui::dialogs::XFilePickerControlAccess
,
49 css::ui::dialogs::XFilePreview
,
50 css::ui::dialogs::XFolderPicker2
,
51 css::lang::XInitialization
,
52 css::lang::XServiceInfo
> TVistaFilePickerBase
;
55 /** Implements the XFilePicker & friends interface(s)
56 for Windows Vista and upcoming versions.
58 Note: This will be a UNO wrapper for the real file picker
59 implementation only. The real implementation is done in class
62 class VistaFilePicker
: public ::cppu::BaseMutex
63 , public TVistaFilePickerBase
71 explicit VistaFilePicker( bool bFolderPicker
);
72 virtual ~VistaFilePicker() override
;
75 // XFilePickerNotifier
78 virtual void SAL_CALL
addFilePickerListener( const css::uno::Reference
< css::ui::dialogs::XFilePickerListener
>& xListener
) override
;
80 virtual void SAL_CALL
removeFilePickerListener( const css::uno::Reference
< css::ui::dialogs::XFilePickerListener
>& xListener
) override
;
83 // XExecutableDialog functions
86 virtual void SAL_CALL
setTitle( const OUString
& sTitle
) override
;
88 virtual sal_Int16 SAL_CALL
execute( ) override
;
91 // XFilePicker functions
94 virtual void SAL_CALL
setMultiSelectionMode( sal_Bool bMode
) override
;
96 virtual void SAL_CALL
setDefaultName( const OUString
& sName
) override
;
98 virtual void SAL_CALL
setDisplayDirectory( const OUString
& sDirectory
) override
;
100 virtual OUString SAL_CALL
getDisplayDirectory( ) override
;
102 virtual css::uno::Sequence
< OUString
> SAL_CALL
getFiles( ) override
;
104 // XFilePicker2 functions
105 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSelectedFiles( ) override
;
108 // XFilterManager functions
111 virtual void SAL_CALL
appendFilter( const OUString
& sTitle
,
112 const OUString
& sFilter
) override
;
114 virtual void SAL_CALL
setCurrentFilter( const OUString
& sTitle
) override
;
116 virtual OUString SAL_CALL
getCurrentFilter( ) override
;
119 // XFilterGroupManager functions
122 virtual void SAL_CALL
appendFilterGroup( const OUString
& sGroupTitle
,
123 const css::uno::Sequence
< css::beans::StringPair
>& lFilters
) override
;
126 // XFilePickerControlAccess functions
129 virtual void SAL_CALL
setValue( sal_Int16 nControlId
,
130 sal_Int16 nControlAction
,
131 const css::uno::Any
& aValue
) override
;
133 virtual css::uno::Any SAL_CALL
getValue( sal_Int16 nControlId
,
134 sal_Int16 nControlAction
) override
;
136 virtual void SAL_CALL
enableControl( sal_Int16 nControlId
,
137 sal_Bool bEnable
) override
;
139 virtual void SAL_CALL
setLabel( sal_Int16 nControlId
,
140 const OUString
& sLabel
) override
;
142 virtual OUString SAL_CALL
getLabel( sal_Int16 nControlId
) override
;
148 virtual css::uno::Sequence
< sal_Int16
> SAL_CALL
getSupportedImageFormats( ) override
;
150 virtual sal_Int32 SAL_CALL
getTargetColorDepth( ) override
;
152 virtual sal_Int32 SAL_CALL
getAvailableWidth( ) override
;
154 virtual sal_Int32 SAL_CALL
getAvailableHeight( ) override
;
156 virtual void SAL_CALL
setImage( sal_Int16 nImageFormat
,
157 const css::uno::Any
& aImage
) override
;
159 virtual sal_Bool SAL_CALL
setShowState( sal_Bool bShowState
) override
;
161 virtual sal_Bool SAL_CALL
getShowState( ) override
;
167 virtual void SAL_CALL
initialize( const css::uno::Sequence
< css::uno::Any
>& lArguments
) override
;
173 virtual void SAL_CALL
cancel( ) override
;
178 /// @throws css::uno::RuntimeException
179 virtual void disposing( const css::lang::EventObject
& aEvent
);
185 virtual OUString SAL_CALL
getImplementationName( ) override
;
187 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
189 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
192 // XFolderPicker functions
195 virtual OUString SAL_CALL
getDirectory( ) override
;
197 virtual void SAL_CALL
setDescription( const OUString
& aDescription
) override
;
202 // prevent copy and assignment
203 VistaFilePicker( const VistaFilePicker
& );
204 VistaFilePicker
& operator=( const VistaFilePicker
& );
206 using WeakComponentImplHelperBase::disposing
;
212 css::uno::Sequence
< OUString
> m_lLastFiles
;
214 VistaFilePickerImpl m_rDialog
;
217 const bool m_bFolderPicker
;
222 } // namespace fpicker
224 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */