LibreOffice Module fpicker (master) 1
VistaFilePickerEventHandler.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 <shobjidl.h>
23
24#include "vistatypes.h"
26
27#include <com/sun/star/ui/dialogs/XFilePickerListener.hpp>
28#include <com/sun/star/uno/Reference.hxx>
29
32#include <osl/interlck.h>
33
34namespace fpicker{
35namespace win32{
36namespace vista{
37
38
39// types, const etcpp.
40
41
45 , public IFileDialogEvents
46 , public IFileDialogControlEvents
47{
48 public:
49
50
51 // ctor/dtor
52
53
56
57
58 // IUnknown
59
60 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID rIID ,
61 void** ppObject) override;
62 virtual ULONG STDMETHODCALLTYPE AddRef() override;
63 virtual ULONG STDMETHODCALLTYPE Release() override;
64
65
66 // IFileDialogEvents
67
68
69 STDMETHODIMP OnFileOk(IFileDialog* pDialog) override;
70
71 STDMETHODIMP OnFolderChanging(IFileDialog* pDialog,
72 IShellItem* pFolder) override;
73
74 STDMETHODIMP OnFolderChange(IFileDialog* pDialog) override;
75
76 STDMETHODIMP OnSelectionChange(IFileDialog* pDialog) override;
77
78 STDMETHODIMP OnShareViolation(IFileDialog* pDialog ,
79 IShellItem* pItem ,
80 FDE_SHAREVIOLATION_RESPONSE* pResponse) override;
81
82 STDMETHODIMP OnTypeChange(IFileDialog* pDialog) override;
83
84 STDMETHODIMP OnOverwrite(IFileDialog* pDialog ,
85 IShellItem* pItem ,
86 FDE_OVERWRITE_RESPONSE* pResponse) override;
87
88
89 // IFileDialogControlEvents
90
91
92 STDMETHODIMP OnItemSelected(IFileDialogCustomize* pCustomize,
93 DWORD nIDCtl ,
94 DWORD nIDItem ) override;
95
96 STDMETHODIMP OnButtonClicked(IFileDialogCustomize* pCustomize,
97 DWORD nIDCtl ) override;
98
99 STDMETHODIMP OnCheckButtonToggled(IFileDialogCustomize* pCustomize,
100 DWORD nIDCtl ,
101 BOOL bChecked ) override;
102
103 STDMETHODIMP OnControlActivating(IFileDialogCustomize* pCustomize,
104 DWORD nIDCtl ) override;
105
106
107 // XFilePickerNotifier
108
110 virtual void addFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener );
111
113 virtual void removeFilePickerListener( const css::uno::Reference< css::ui::dialogs::XFilePickerListener >& xListener );
114
115
116 // native interface
117
118
131 void startListening( const TFileDialog& pBroadcaster );
132
133
140 void stopListening();
141
142 public:
143
145 {
151 };
152
153 private:
154
155
157 void impl_sendEvent( EEventType eEventType,
158 ::sal_Int16 nControlID);
159
160 private:
161
162
164 oslInterlockedCount m_nRefCount;
165
166
169
170
173
174
176
177
186};
187
188} // namespace vista
189} // namespace win32
190} // namespace fpicker
191
192/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
oslInterlockedCount m_nRefCount
ref count for AddRef/Release()
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID rIID, void **ppObject) override
virtual void addFilePickerListener(const css::uno::Reference< css::ui::dialogs::XFilePickerListener > &xListener)
virtual ULONG STDMETHODCALLTYPE Release() override
void stopListening()
stop listening for file picker events on the internally cached dialog COM object.
STDMETHODIMP OnItemSelected(IFileDialogCustomize *pCustomize, DWORD nIDCtl, DWORD nIDItem) override
virtual void removeFilePickerListener(const css::uno::Reference< css::ui::dialogs::XFilePickerListener > &xListener)
STDMETHODIMP OnFileOk(IFileDialog *pDialog) override
STDMETHODIMP OnFolderChanging(IFileDialog *pDialog, IShellItem *pFolder) override
comphelper::OMultiTypeInterfaceContainerHelper2 m_lListener
used to inform file picker listener asynchronously.
STDMETHODIMP OnControlActivating(IFileDialogCustomize *pCustomize, DWORD nIDCtl) override
STDMETHODIMP OnButtonClicked(IFileDialogCustomize *pCustomize, DWORD nIDCtl) override
void startListening(const TFileDialog &pBroadcaster)
start listening for file picker events on the given file open dialog COM object.
STDMETHODIMP OnSelectionChange(IFileDialog *pDialog) override
TFileDialog m_pDialog
cached file dialog instance (there we listen for events)
STDMETHODIMP OnCheckButtonToggled(IFileDialogCustomize *pCustomize, DWORD nIDCtl, BOOL bChecked) override
DWORD m_nListenerHandle
unique handle for this listener provided by the broadcaster on registration time
STDMETHODIMP OnTypeChange(IFileDialog *pDialog) override
VistaFilePickerEventHandler(IVistaFilePickerInternalNotify *pInternalNotify)
STDMETHODIMP OnFolderChange(IFileDialog *pDialog) override
STDMETHODIMP OnShareViolation(IFileDialog *pDialog, IShellItem *pItem, FDE_SHAREVIOLATION_RESPONSE *pResponse) override
void impl_sendEvent(EEventType eEventType, ::sal_Int16 nControlID)
STDMETHODIMP OnOverwrite(IFileDialog *pDialog, IShellItem *pItem, FDE_OVERWRITE_RESPONSE *pResponse) override
sal::systools::COMReference< IFileDialog > TFileDialog
Definition: vistatypes.h:33
const wchar_t *typedef BOOL