LibreOffice Module fpicker (master) 1
VistaFilePickerImpl.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 "platform_vista.h"
23
24#include <shobjidl.h>
25
26#include "requests.hxx"
27#include "vistatypes.h"
28#include "FilterContainer.hxx"
31#include "resourceprovider.hxx"
32
34#include <osl/thread.hxx>
35#include <osl/conditn.hxx>
36#include <rtl/ustring.hxx>
37
38namespace fpicker{
39namespace win32{
40namespace vista{
41
42
43// types, const etcpp
44
45
46const ::sal_Int32 FEATURE_AUTOEXTENSION = 1;
47const ::sal_Int32 FEATURE_PASSWORD = 2;
48const ::sal_Int32 FEATURE_FILTEROPTIONS = 4;
49const ::sal_Int32 FEATURE_SELECTION = 8;
50const ::sal_Int32 FEATURE_TEMPLATE = 16;
51const ::sal_Int32 FEATURE_LINK = 32;
52const ::sal_Int32 FEATURE_PREVIEW = 64;
53const ::sal_Int32 FEATURE_IMAGETEMPLATE = 128;
54const ::sal_Int32 FEATURE_PLAY = 256;
55const ::sal_Int32 FEATURE_READONLY = 512;
56const ::sal_Int32 FEATURE_VERSION = 1024;
57const ::sal_Int32 FEATURE_GPGPASSWORD = 2048;
58const ::sal_Int32 FEATURE_IMAGEANCHOR = 4096;
59
60inline constexpr OUStringLiteral PROP_PICKER_LISTENER(u"picker_listener" ); // [XFilePickerListenert]
61inline constexpr OUStringLiteral PROP_DIALOG_SHOW_RESULT(u"dialog_show_result" ); // [sal_Bool] true=OK, false=CANCEL
62inline constexpr OUStringLiteral PROP_SELECTED_FILES(u"selected_files" ); // [seq< OUString >] contains all user selected files (can be empty!)
63inline constexpr OUStringLiteral PROP_MULTISELECTION_MODE(u"multiselection_mode"); // [sal_Bool] true=ON, false=OFF
64inline constexpr OUStringLiteral PROP_TITLE(u"title" ); // [OUString]
65inline constexpr OUStringLiteral PROP_FILENAME(u"filename" ); // [OUString]
66inline constexpr OUStringLiteral PROP_DIRECTORY(u"directory" ); // [OUString]
67inline constexpr OUStringLiteral PROP_FEATURES(u"features" ); // [sal_Int32]
68inline constexpr OUStringLiteral PROP_TEMPLATE_DESCR(u"templatedescription"); // [sal_Int32]
69inline constexpr OUStringLiteral PROP_FILTER_TITLE(u"filter_title" ); // [OUString]
70inline constexpr OUStringLiteral PROP_FILTER_VALUE(u"filter_value" ); // [OUString]
71inline constexpr OUStringLiteral PROP_FILTER_GROUP(u"filter-group" ); // [seq< css:beans::StringPair >] contains a group of filters
72
73inline constexpr OUStringLiteral PROP_CONTROL_ID(u"control_id" ); // [sal_Int16]
74inline constexpr OUStringLiteral PROP_CONTROL_ACTION(u"control_action" ); // [sal_Int16]
75inline constexpr OUStringLiteral PROP_CONTROL_VALUE(u"control_value" ); // [Any]
76inline constexpr OUStringLiteral PROP_CONTROL_LABEL(u"control_label" ); // [OUString]
77inline constexpr OUStringLiteral PROP_CONTROL_ENABLE(u"control_enable" ); // [sal_Bool] true=ON, false=OFF
78inline constexpr OUStringLiteral PROP_PARENT_WINDOW(u"ParentWindow"); //[css::awt::XWindow] preferred parent window
79inline constexpr OUStringLiteral STRING_SEPARATOR(u"------------------------------------------" );
80
81class TDialogImplBase;
82
89{
90 public:
91
92 // Workaround made to get input in Template Listbox
93 css::uno::Sequence< OUString > m_lItems;
98 {
122 };
123
124 public:
125
126
127 // ctor/dtor - nothing special
128
130 virtual ~VistaFilePickerImpl();
131
132
133 // RequestHandler
134
135 void doRequest(Request& rRequest);
136
137
138 // IVistaFilePickerInternalNotify
139
140 virtual void onAutoExtensionChanged (bool bChecked) override;
141 virtual bool onFileTypeChanged( UINT nTypeIndex ) override;
142 virtual void onDirectoryChanged() override;
143
144 private:
145 OUString GetDirectory();
146
149
150
153
154
156 void impl_sta_appendFilter(Request& rRequest);
157
158
160 void impl_sta_appendFilterGroup(Request& rRequest);
161
162
164 void impl_sta_setCurrentFilter(Request& rRequest);
165
166
168 void impl_sta_getCurrentFilter(Request& rRequest);
169
170
172 void impl_sta_CreateOpenDialog(Request& rRequest);
173
174
176 void impl_sta_CreateSaveDialog(Request& rRequest);
177
178
180 void impl_sta_CreateFolderPicker(Request& rRequest);
181
182
185
186
188 void impl_sta_SetTitle(Request& rRequest);
189
190
192 void impl_sta_SetFileName(Request& rRequest);
193
194
196 void impl_sta_SetDirectory(Request& rRequest);
197
198
200 void impl_sta_GetDirectory(Request& rRequest);
201
202
204 void impl_sta_SetDefaultName(Request& rRequest);
205
206
208 void impl_sta_getSelectedFiles(Request& rRequest);
209
210
212 void impl_sta_ShowDialogModal(Request& rRequest);
213
214
216 void impl_sta_SetControlValue(Request& rRequest);
217
218
220 void impl_sta_GetControlValue(Request& rRequest);
221
222
224 void impl_sta_SetControlLabel(Request& rRequest);
225
226
228 static void impl_sta_GetControlLabel(Request& rRequest);
229
230
232 void impl_sta_EnableControl(Request& rRequest);
233
251 void impl_sta_enableFeatures(::sal_Int32 nFeatures, ::sal_Int32 nTemplate);
252
253
265
266
269
270 void impl_SetDefaultExtension( const OUString& currentFilter );
271
272 private:
273 template <class TDialogImplClass> void impl_sta_CreateDialog();
274 void impl_sta_InitDialog(Request& rRequest, DWORD nOrFlags);
275
276
278 std::shared_ptr<TDialogImplBase> m_pDialog;
279
280
283
284
289
290
293
295
296 // handle to parent window
298
299
300 OUString m_sDirectory;
301
302
303 OUString m_sFilename;
304};
305
306} // namespace vista
307} // namespace win32
308} // namespace fpicker
309
310/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
native implementation of the file picker on Vista and upcoming windows versions.
void impl_sta_enableFeatures(::sal_Int32 nFeatures, ::sal_Int32 nTemplate)
create all needed (optional!) UI controls addressed by the field nFeatures.
void impl_sta_SetDefaultName(Request &rRequest)
implementation of request E_SET_DEFAULT_NAME
void impl_sta_CreateOpenDialog(Request &rRequest)
implementation of request E_CREATE_OPEN_DIALOG
void impl_sta_appendFilterGroup(Request &rRequest)
implementation of request E_APPEND_FILTERGROUP
void impl_sta_removeFilePickerListener(Request &rRequest)
implementation of request E_REMOVE_FILEPICKER_LISTENER
void impl_sta_setCurrentFilter(Request &rRequest)
implementation of request E_SET_CURRENT_FILTER
void impl_sta_SetControlLabel(Request &rRequest)
implementation of request E_SET_CONTROL_LABEL
TFileDialogCustomize impl_getCustomizeInterface()
returns an interface, which can be used to customize the internally used COM dialog.
void impl_sta_SetControlValue(Request &rRequest)
implementation of request E_SET_CONTROL_VALUE
static void impl_sta_GetControlLabel(Request &rRequest)
implementation of request E_GET_CONTROL_LABEL
virtual void onAutoExtensionChanged(bool bChecked) override
virtual bool onFileTypeChanged(UINT nTypeIndex) override
void impl_sta_ShowDialogModal(Request &rRequest)
implementation of request E_SHOW_DIALOG_MODAL
void impl_sta_SetTitle(Request &rRequest)
implementation of request E_SET_TITLE
void impl_sta_appendFilter(Request &rRequest)
implementation of request E_APPEND_FILTER
void impl_sta_GetControlValue(Request &rRequest)
implementation of request E_GET_CONTROL_VALUE
void impl_sta_addFilePickerListener(Request &rRequest)
implementation of request E_ADD_FILEPICKER_LISTENER
void impl_sta_InitDialog(Request &rRequest, DWORD nOrFlags)
void impl_sta_getSelectedFiles(Request &rRequest)
implementation of request E_GET_SELECTED_FILES
void impl_sta_CreateSaveDialog(Request &rRequest)
implementation of request E_CREATE_SAVE_DIALOG
void impl_sta_GetDirectory(Request &rRequest)
implementation of request E_GET_DIRECTORY
void impl_sta_EnableControl(Request &rRequest)
implementation of request E_ENABLE_CONTROL
void impl_SetDefaultExtension(const OUString &currentFilter)
void impl_sta_getCurrentFilter(Request &rRequest)
implementation of request E_GET_CURRENT_FILTER
void impl_sta_SetDirectory(Request &rRequest)
implementation of request E_SET_DIRECTORY
void impl_sta_setFiltersOnDialog()
fill filter list of internal used dialog.
std::shared_ptr< TDialogImplBase > m_pDialog
object representing a file dialog
void impl_sta_SetMultiSelectionMode(Request &rRequest)
implementation of request E_SET_MULTISELECTION_MODE
void impl_sta_CreateFolderPicker(Request &rRequest)
implementation of request E_CREATE_FOLDER_PICKER
void impl_sta_SetFileName(Request &rRequest)
implementation of request E_SET_FILENAME
TFileDialogEvents m_iEventHandler
help us to handle dialog events and provide them to interested office listener.
const OUStringLiteral PROP_PICKER_LISTENER
const ::sal_Int32 FEATURE_READONLY
constexpr OUStringLiteral PROP_FILTER_GROUP(u"filter-group")
const ::sal_Int32 FEATURE_PREVIEW
constexpr OUStringLiteral PROP_CONTROL_VALUE(u"control_value")
constexpr OUStringLiteral PROP_FILTER_TITLE(u"filter_title")
const ::sal_Int32 FEATURE_VERSION
constexpr OUStringLiteral PROP_FILTER_VALUE(u"filter_value")
const ::sal_Int32 FEATURE_SELECTION
sal::systools::COMReference< IFileDialogCustomize > TFileDialogCustomize
Definition: vistatypes.h:37
const ::sal_Int32 FEATURE_TEMPLATE
constexpr OUStringLiteral PROP_FEATURES(u"features")
constexpr OUStringLiteral PROP_TITLE(u"title")
const ::sal_Int32 FEATURE_FILTEROPTIONS
constexpr OUStringLiteral PROP_CONTROL_LABEL(u"control_label")
const ::sal_Int32 FEATURE_PLAY
constexpr OUStringLiteral PROP_PARENT_WINDOW(u"ParentWindow")
const ::sal_Int32 FEATURE_LINK
constexpr OUStringLiteral PROP_SELECTED_FILES(u"selected_files")
sal::systools::COMReference< IFileDialog > TFileDialog
Definition: vistatypes.h:33
constexpr OUStringLiteral PROP_FILENAME(u"filename")
const ::sal_Int32 FEATURE_IMAGETEMPLATE
constexpr OUStringLiteral STRING_SEPARATOR(u"------------------------------------------")
sal::systools::COMReference< IFileDialogEvents > TFileDialogEvents
Definition: vistatypes.h:36
const ::sal_Int32 FEATURE_AUTOEXTENSION
constexpr OUStringLiteral PROP_TEMPLATE_DESCR(u"templatedescription")
constexpr OUStringLiteral PROP_DIALOG_SHOW_RESULT(u"dialog_show_result")
const ::sal_Int32 FEATURE_PASSWORD
const ::sal_Int32 FEATURE_IMAGEANCHOR
constexpr OUStringLiteral PROP_CONTROL_ACTION(u"control_action")
const OUStringLiteral PROP_CONTROL_ID
constexpr OUStringLiteral PROP_MULTISELECTION_MODE(u"multiselection_mode")
const ::sal_Int32 FEATURE_GPGPASSWORD
constexpr OUStringLiteral PROP_DIRECTORY(u"directory")
constexpr OUStringLiteral PROP_CONTROL_ENABLE(u"control_enable")