LibreOffice Module toolkit (master) 1
geometrycontrolmodel.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
26#include <cppuhelper/compbase2.hxx>
27#include <com/sun/star/util/XCloneable.hpp>
28#include <com/sun/star/script/XScriptEventsSupplier.hpp>
30#include <rtl/ref.hxx>
31
32namespace com::sun::star::resource { class XStringResourceResolver; }
33
34namespace com::sun::star {
35 namespace uno {
36 class XComponentContext;
37 }
38}
39
40
41// namespace toolkit
42// {
43
44
45 //= OGeometryControlModel_Base
46
47 typedef ::cppu::WeakAggComponentImplHelper2 < css::util::XCloneable
48 , css::script::XScriptEventsSupplier
52 ,public ::comphelper::OPropertySetAggregationHelper
54 ,public OGCM_Base
55 {
56 protected:
57 css::uno::Reference< css::uno::XAggregation >
59 css::uno::Reference< css::container::XNameContainer >
61
62 // <properties>
63 sal_Int32 m_nPosX;
64 sal_Int32 m_nPosY;
65 sal_Int32 m_nWidth;
66 sal_Int32 m_nHeight;
67 OUString m_aName;
68 sal_Int16 m_nTabIndex;
69 sal_Int32 m_nStep;
70 OUString m_aTag;
71 css::uno::Reference< css::resource::XStringResourceResolver > m_xStrResolver;
72 // </properties>
73
75
76 protected:
77 static css::uno::Any ImplGetDefaultValueByHandle(sal_Int32 nHandle);
78 css::uno::Any ImplGetPropertyValueByHandle(sal_Int32 nHandle) const;
79 void ImplSetPropertyValueByHandle(sal_Int32 nHandle, const css::uno::Any& aValue);
80
81 protected:
86 OGeometryControlModel_Base(css::uno::XAggregation* _pAggregateInstance);
87
93 OGeometryControlModel_Base(css::uno::Reference< css::util::XCloneable >& _rxAggregateInstance);
94
99 void releaseAggregation();
100
101 protected:
102 virtual ~OGeometryControlModel_Base() override;
103
104 // XAggregation
105 css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _aType ) override;
106
107 public:
108 // XInterface
109 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
110 virtual void SAL_CALL acquire( ) noexcept override;
111 virtual void SAL_CALL release( ) noexcept override;
112
113 protected:
114 // XTypeProvider
115 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
116
117 // OPropertySetHelper overridables
118 virtual sal_Bool SAL_CALL convertFastPropertyValue(
119 css::uno::Any& _rConvertedValue, css::uno::Any& _rOldValue,
120 sal_Int32 _nHandle, const css::uno::Any& _rValue ) override;
121
122 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
123 sal_Int32 _nHandle, const css::uno::Any& _rValue) override;
124
125 using comphelper::OPropertySetAggregationHelper::getFastPropertyValue;
126 virtual void SAL_CALL getFastPropertyValue(
127 css::uno::Any& _rValue, sal_Int32 _nHandle) const override;
128
129 // OPropertyStateHelper overridables
130 virtual css::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle) override;
131 virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle) override;
132 virtual css::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const override;
133
134 // XPropertySet
135 virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override;
136
137 // OPropertySetAggregationHelper overridables
138 using OPropertySetAggregationHelper::getInfoHelper;
139
140 // XCloneable
141 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override;
142
143 //XScriptEventsSupplier
144 virtual css::uno::Reference< css::container::XNameContainer >
145 SAL_CALL getEvents( ) override;
146
147 // XCloneable implementation - to be overwritten
149 css::uno::Reference< css::util::XCloneable >& _rxAggregateInstance) = 0;
150
151 // XComponent
152 using comphelper::OPropertySetAggregationHelper::disposing;
153 virtual void SAL_CALL disposing() override;
154
155 private:
156 void registerProperties();
157 };
158
159
160 //= OTemplateInstanceDisambiguation
161
162 template <class CONTROLMODEL>
164 {
165 };
166
167
168 //= OGeometryControlModel
169
170 /* example for usage:
171 Reference< XAggregation > xIFace = new ::toolkit::OGeometryControlModel< UnoControlButtonModel > ();
172 */
173 template <class CONTROLMODEL>
176 ,public ::comphelper::OAggregationArrayUsageHelper< OTemplateInstanceDisambiguation< CONTROLMODEL > >
177 {
178 public:
179 OGeometryControlModel( const css::uno::Reference< css::uno::XComponentContext >& i_factory );
180
181 private:
182 OGeometryControlModel(css::uno::Reference< css::util::XCloneable >& _rxAggregateInstance);
183
184 // OAggregationArrayUsageHelper overridables
185 virtual void fillProperties(
186 css::uno::Sequence< css::beans::Property >& _rProps,
187 css::uno::Sequence< css::beans::Property >& _rAggregateProps
188 ) const override;
189
190 // OPropertySetAggregationHelper overridables
191 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
192
193 // OGeometryControlModel_Base
195 css::uno::Reference< css::util::XCloneable >& _rxAggregateInstance) override;
196
197 // XTypeProvider
198 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
199 };
200
201
202 //= OCommonGeometryControlModel
203
209 ,public ::comphelper::OIdPropertyArrayUsageHelper< OCommonGeometryControlModel >
210 {
211 private:
212 OUString m_sServiceSpecifier; // the service specifier of our aggregate
213 sal_Int32 m_nPropertyMapId; // our unique property info id, used to look up in s_aAggregateProperties
214
215 public:
223 css::uno::Reference< css::util::XCloneable >& _rxAgg,
224 OUString _aServiceSpecifier
225 );
226
227 // OIdPropertyArrayUsageHelper overridables
228 virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const override;
229
230 // OPropertySetAggregationHelper overridables
231 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
232
233 // OGeometryControlModel_Base
235 css::uno::Reference< css::util::XCloneable >& _rxAggregateInstance) override;
236
237 // XTypeProvider
238 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
239
240 private:
241 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
242 sal_Int32 _nHandle, const css::uno::Any& _rValue) override;
243 };
244
246
247
248// } // namespace toolkit
249
250
251/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
allows to extend an arbitrary com.sun.star.awt::UnoControlModel with geometry information.
OGeometryControlModel_Base(css::uno::XAggregation *_pAggregateInstance)
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &_rConvertedValue, css::uno::Any &_rOldValue, sal_Int32 _nHandle, const css::uno::Any &_rValue) override
virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getEvents() override
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &_rValue, sal_Int32 _nHandle) const override
css::uno::Any ImplGetPropertyValueByHandle(sal_Int32 nHandle) const
virtual void SAL_CALL acquire() noexcept override
css::uno::Reference< css::resource::XStringResourceResolver > m_xStrResolver
static css::uno::Any ImplGetDefaultValueByHandle(sal_Int32 nHandle)
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual ~OGeometryControlModel_Base() override
OGeometryControlModel_Base(css::uno::Reference< css::util::XCloneable > &_rxAggregateInstance)
virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle) override
virtual void SAL_CALL release() noexcept override
virtual void SAL_CALL disposing() override
css::uno::Reference< css::container::XNameContainer > mxEventContainer
css::uno::Reference< css::uno::XAggregation > m_xAggregate
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual rtl::Reference< OGeometryControlModel_Base > createClone_Impl(css::uno::Reference< css::util::XCloneable > &_rxAggregateInstance)=0
css::uno::Any SAL_CALL queryAggregation(const css::uno::Type &_aType) override
void releaseAggregation()
releases the aggregation
void ImplSetPropertyValueByHandle(sal_Int32 nHandle, const css::uno::Any &aValue)
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const css::uno::Any &_rValue) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
virtual css::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const override
virtual css::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() SAL_OVERRIDE
::cppu::WeakAggComponentImplHelper2< css::util::XCloneable, css::script::XScriptEventsSupplier > OGCM_Base
Type
unsigned char sal_Bool