LibreOffice Module fpicker (master) 1
commonpicker.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
24#include <com/sun/star/ui/dialogs/XControlInformation.hpp>
25#include <com/sun/star/ui/dialogs/XControlAccess.hpp>
26#include <com/sun/star/awt/XWindow.hpp>
27#include <com/sun/star/util/XCancellable.hpp>
28#include <com/sun/star/lang/XInitialization.hpp>
31#include <comphelper/uno3.hxx>
32#include <tools/link.hxx>
33
35namespace weld { class Window; }
36struct ImplSVEvent;
37
38namespace svt
39{
40
41
42 typedef ::cppu::WeakComponentImplHelper < css::ui::dialogs::XControlAccess
43 , css::ui::dialogs::XControlInformation
44 , css::lang::XEventListener
45 , css::util::XCancellable
46 , css::lang::XInitialization
51 :public ::cppu::BaseMutex
52 ,public OCommonPicker_Base
54 ,public ::comphelper::OPropertyArrayUsageHelper< OCommonPicker >
55 {
56 private:
57 // <properties>
58 OUString m_sHelpURL;
59 css::uno::Reference< css::awt::XWindow > m_xWindow;
60 // </properties>
61
64
65 css::uno::Reference< css::awt::XWindow > m_xDialogParent;
66
67 css::uno::Reference< css::lang::XComponent > m_xWindowListenerAdapter;
68 css::uno::Reference< css::lang::XComponent > m_xParentListenerAdapter;
69
70 protected:
71 OUString m_aTitle;
73
74 protected:
75 std::shared_ptr<SvtFileDialog_Base> m_xDlg;
76
77 const ::cppu::OBroadcastHelper& GetBroadcastHelper() const { return OCommonPicker_Base::rBHelper; }
78 ::cppu::OBroadcastHelper& GetBroadcastHelper() { return OCommonPicker_Base::rBHelper; }
79
80 public:
82
83 protected:
84 virtual ~OCommonPicker() override;
85
86 // overridables
87
88 // will be called with locked SolarMutex
89 virtual std::shared_ptr<SvtFileDialog_Base> implCreateDialog( weld::Window* pParent ) = 0;
90 virtual sal_Int16 implExecutePicker( ) = 0;
91 // do NOT override XExecutableDialog::execute! We need to do some stuff there ourself ...
92
93 protected:
94
95 // disambiguate XInterface
96
98
99
100 // disambiguate XTypeProvider
101
102 DECLARE_XTYPEPROVIDER( )
103
104
105 // ComponentHelper/XComponent
106
107 virtual void SAL_CALL disposing() override;
108
109
110 // XEventListener
111
112 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
113
114
115 // property set related methods
116
117
118 // XPropertySet pure methods
119 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
120 // OPropertySetHelper pure methods
121 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
122 // OPropertyArrayUsageHelper pure methods
123 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
124
125 // OPropertySetHelper overridden methods
126 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
127 sal_Int32 _nHandle, const css::uno::Any& _rValue ) override;
128
129
130 // XExecutableDialog functions
131
133 virtual void SAL_CALL setTitle( const OUString& _rTitle );
135 virtual sal_Int16 SAL_CALL execute();
136
137
138 // XControlAccess functions
139
140 virtual void SAL_CALL setControlProperty( const OUString& aControlName, const OUString& aControlProperty, const css::uno::Any& aValue ) override;
141 virtual css::uno::Any SAL_CALL getControlProperty( const OUString& aControlName, const OUString& aControlProperty ) override;
142
143
144 // XControlInformation functions
145
146 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedControls( ) override;
147 virtual sal_Bool SAL_CALL isControlSupported( const OUString& aControlName ) override;
148 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedControlProperties( const OUString& aControlName ) override;
149 virtual sal_Bool SAL_CALL isControlPropertySupported( const OUString& aControlName, const OUString& aControlProperty ) override;
150
151
152 // XCancellable functions
153
154 virtual void SAL_CALL cancel( ) override;
155
156
157 // XInitialization functions
158
159
160 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
161
162
163 // misc
164
165 void checkAlive() const;
166
167 void prepareDialog();
168
169 protected:
170 bool createPicker();
171
177 const OUString& _rName,
178 const css::uno::Any& _rValue
179 );
180
181 private:
182 void stopWindowListening();
183
184 DECL_LINK( OnCancelPicker, void*, void );
185 };
186
187} // namespace svt
188
189
190/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
implements common functionality for the 2 UNO picker components
virtual void SAL_CALL setTitle(const OUString &_rTitle)
DECL_LINK(OnCancelPicker, void *, void)
const ::cppu::OBroadcastHelper & GetBroadcastHelper() const
css::uno::Reference< css::lang::XComponent > m_xParentListenerAdapter
std::shared_ptr< SvtFileDialog_Base > m_xDlg
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
virtual std::shared_ptr< SvtFileDialog_Base > implCreateDialog(weld::Window *pParent)=0
void checkAlive() const
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedControlProperties(const OUString &aControlName) override
virtual css::uno::Any SAL_CALL getControlProperty(const OUString &aControlName, const OUString &aControlProperty) override
virtual sal_Bool SAL_CALL isControlPropertySupported(const OUString &aControlName, const OUString &aControlProperty) override
css::uno::Reference< css::awt::XWindow > m_xDialogParent
css::uno::Reference< css::lang::XComponent > m_xWindowListenerAdapter
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const css::uno::Any &_rValue) override
OUString m_aDisplayDirectory
::cppu::OBroadcastHelper & GetBroadcastHelper()
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL disposing() override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedControls() override
virtual sal_Bool SAL_CALL isControlSupported(const OUString &aControlName) override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
virtual void SAL_CALL setControlProperty(const OUString &aControlName, const OUString &aControlProperty, const css::uno::Any &aValue) override
css::uno::Reference< css::awt::XWindow > m_xWindow
virtual sal_Int16 SAL_CALL execute()
virtual void SAL_CALL cancel() override
virtual ~OCommonPicker() override
virtual sal_Int16 implExecutePicker()=0
virtual bool implHandleInitializationArgument(const OUString &_rName, const css::uno::Any &_rValue)
handle a single argument from the XInitialization::initialize method
ImplSVEvent * m_nCancelEvent
::cppu::WeakComponentImplHelper< css::ui::dialogs::XControlAccess, css::ui::dialogs::XControlInformation, css::lang::XEventListener, css::util::XCancellable, css::lang::XInitialization > OCommonPicker_Base
unsigned char sal_Bool
#define DECLARE_XINTERFACE()