LibreOffice Module fpicker (master) 1
VistaFilePicker.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include "requests.hxx"
25
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>
33
36#include <rtl/ustring.hxx>
37
38namespace fpicker{
39namespace win32{
40namespace vista{
41
42
43// types
44
45
46typedef ::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;
53
54
64{
65public:
66
67
68 // ctor/dtor
69
70
71 explicit VistaFilePicker( bool bFolderPicker );
72 virtual ~VistaFilePicker() override;
73
74
75 // XFilePickerNotifier
76
77
78 virtual void SAL_CALL addFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener ) override;
79
80 virtual void SAL_CALL removeFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener ) override;
81
82
83 // XExecutableDialog functions
84
85
86 virtual void SAL_CALL setTitle( const OUString& sTitle ) override;
87
88 virtual sal_Int16 SAL_CALL execute( ) override;
89
90
91 // XFilePicker functions
92
93
94 virtual void SAL_CALL setMultiSelectionMode( sal_Bool bMode ) override;
95
96 virtual void SAL_CALL setDefaultName( const OUString& sName ) override;
97
98 virtual void SAL_CALL setDisplayDirectory( const OUString& sDirectory ) override;
99
100 virtual OUString SAL_CALL getDisplayDirectory( ) override;
101
102 virtual css::uno::Sequence< OUString > SAL_CALL getFiles( ) override;
103
104 // XFilePicker2 functions
105 virtual css::uno::Sequence< OUString > SAL_CALL getSelectedFiles( ) override;
106
107
108 // XFilterManager functions
109
110
111 virtual void SAL_CALL appendFilter( const OUString& sTitle ,
112 const OUString& sFilter ) override;
113
114 virtual void SAL_CALL setCurrentFilter( const OUString& sTitle ) override;
115
116 virtual OUString SAL_CALL getCurrentFilter( ) override;
117
118
119 // XFilterGroupManager functions
120
121
122 virtual void SAL_CALL appendFilterGroup( const OUString& sGroupTitle,
123 const css::uno::Sequence< css::beans::StringPair >& lFilters ) override;
124
125
126 // XFilePickerControlAccess functions
127
128
129 virtual void SAL_CALL setValue( sal_Int16 nControlId ,
130 sal_Int16 nControlAction,
131 const css::uno::Any& aValue ) override;
132
133 virtual css::uno::Any SAL_CALL getValue( sal_Int16 nControlId ,
134 sal_Int16 nControlAction ) override;
135
136 virtual void SAL_CALL enableControl( sal_Int16 nControlId,
137 sal_Bool bEnable ) override;
138
139 virtual void SAL_CALL setLabel( sal_Int16 nControlId,
140 const OUString& sLabel ) override;
141
142 virtual OUString SAL_CALL getLabel( sal_Int16 nControlId ) override;
143
144
145 // XFilePreview
146
147
148 virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( ) override;
149
150 virtual sal_Int32 SAL_CALL getTargetColorDepth( ) override;
151
152 virtual sal_Int32 SAL_CALL getAvailableWidth( ) override;
153
154 virtual sal_Int32 SAL_CALL getAvailableHeight( ) override;
155
156 virtual void SAL_CALL setImage( sal_Int16 nImageFormat,
157 const css::uno::Any& aImage ) override;
158
159 virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState ) override;
160
161 virtual sal_Bool SAL_CALL getShowState( ) override;
162
163
164 // XInitialization
165
166
167 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& lArguments ) override;
168
169
170 // XCancellable
171
172
173 virtual void SAL_CALL cancel( ) override;
174
175
176 // XEventListener
177
179 virtual void disposing( const css::lang::EventObject& aEvent );
180
181
182 // XServiceInfo
183
184
185 virtual OUString SAL_CALL getImplementationName( ) override;
186
187 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
188
189 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
190
191
192 // XFolderPicker functions
193
194
195 virtual OUString SAL_CALL getDirectory( ) override;
196
197 virtual void SAL_CALL setDescription( const OUString& aDescription ) override;
198
199
200 private:
201
202 // prevent copy and assignment
205
206 using WeakComponentImplHelperBase::disposing;
207
208 void ensureInit();
209
210 private:
211
212 css::uno::Sequence< OUString > m_lLastFiles;
213
215
217 const bool m_bFolderPicker;
218};
219
220} // namespace vista
221} // namespace win32
222} // namespace fpicker
223
224/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int16 nControlId
AnyEventRef aEvent
native implementation of the file picker on Vista and upcoming windows versions.
Implements the XFilePicker & friends interface(s) for Windows Vista and upcoming versions.
virtual void SAL_CALL setValue(sal_Int16 nControlId, sal_Int16 nControlAction, const css::uno::Any &aValue) override
css::uno::Sequence< OUString > m_lLastFiles
virtual void SAL_CALL setMultiSelectionMode(sal_Bool bMode) override
virtual void SAL_CALL removeFilePickerListener(const css::uno::Reference< css::ui::dialogs::XFilePickerListener > &xListener) override
virtual css::uno::Sequence< OUString > SAL_CALL getFiles() override
virtual void SAL_CALL appendFilter(const OUString &sTitle, const OUString &sFilter) override
virtual OUString SAL_CALL getDirectory() override
virtual sal_Int16 SAL_CALL execute() override
virtual sal_Bool SAL_CALL getShowState() override
virtual void SAL_CALL cancel() override
VistaFilePicker(const VistaFilePicker &)
virtual sal_Int32 SAL_CALL getAvailableWidth() override
virtual sal_Bool SAL_CALL setShowState(sal_Bool bShowState) override
virtual sal_Int32 SAL_CALL getAvailableHeight() override
virtual void disposing(const css::lang::EventObject &aEvent)
virtual void SAL_CALL setDefaultName(const OUString &sName) override
virtual void SAL_CALL setDisplayDirectory(const OUString &sDirectory) override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &lArguments) override
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL setDescription(const OUString &aDescription) override
virtual void SAL_CALL enableControl(sal_Int16 nControlId, sal_Bool bEnable) override
virtual void SAL_CALL setImage(sal_Int16 nImageFormat, const css::uno::Any &aImage) override
virtual OUString SAL_CALL getCurrentFilter() override
virtual void SAL_CALL setTitle(const OUString &sTitle) override
virtual void SAL_CALL setCurrentFilter(const OUString &sTitle) override
virtual void SAL_CALL addFilePickerListener(const css::uno::Reference< css::ui::dialogs::XFilePickerListener > &xListener) override
virtual sal_Int32 SAL_CALL getTargetColorDepth() override
virtual void SAL_CALL setLabel(sal_Int16 nControlId, const OUString &sLabel) override
virtual void SAL_CALL appendFilterGroup(const OUString &sGroupTitle, const css::uno::Sequence< css::beans::StringPair > &lFilters) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getLabel(sal_Int16 nControlId) override
virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats() override
virtual OUString SAL_CALL getDisplayDirectory() override
virtual css::uno::Sequence< OUString > SAL_CALL getSelectedFiles() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Any SAL_CALL getValue(sal_Int16 nControlId, sal_Int16 nControlAction) override
VistaFilePicker & operator=(const VistaFilePicker &)
OUString sName
::cppu::WeakComponentImplHelper< css::ui::dialogs::XFilePicker3, css::ui::dialogs::XFilePickerControlAccess, css::ui::dialogs::XFilePreview, css::ui::dialogs::XFolderPicker2, css::lang::XInitialization, css::lang::XServiceInfo > TVistaFilePickerBase
unsigned char sal_Bool