LibreOffice Module reportdesign (master) 1
Shape.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#ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SHAPE_HXX
20#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SHAPE_HXX
21
23#include <com/sun/star/report/XShape.hpp>
27#include <com/sun/star/lang/XServiceInfo.hpp>
30#include <memory>
31
32namespace reportdesign
33{
34 typedef ::cppu::PropertySetMixin< css::report::XShape > ShapePropertySet;
35 typedef ::cppu::WeakComponentImplHelper< css::report::XShape
36 ,css::lang::XServiceInfo > ShapeBase;
37
42 class OShape : public cppu::BaseMutex,
43 public ShapeBase,
44 public ShapePropertySet
45 {
46 friend class OShapeHelper;
47 ::std::unique_ptr< ::comphelper::OPropertyArrayAggregationHelper> m_pAggHelper;
49 css::drawing::HomogenMatrix3 m_Transformation;
50 sal_Int32 m_nZOrder;
52
56 css::uno::Sequence< css::beans::PropertyValue > m_CustomShapeGeometry;
57
58 private:
59 OShape(const OShape&) = delete;
60 OShape& operator=(const OShape&) = delete;
61
62 // internally, we store PROPERTY_PARAADJUST as css::style::ParagraphAdjust, but externally the property is visible as a sal_Int16
63 void set( const OUString& _sProperty
64 ,sal_Int16 Value
65 ,css::style::ParagraphAdjust& _member)
66 {
67 BoundListeners l;
68 {
69 ::osl::MutexGuard aGuard(m_aMutex);
70 if ( static_cast<sal_Int16>(_member) != Value )
71 {
72 prepareSet(_sProperty, css::uno::Any(static_cast<sal_Int16>(_member)), css::uno::Any(Value), &l);
73 _member = static_cast<css::style::ParagraphAdjust>(Value);
74 }
75 }
76 l.notify();
77 }
78 template <typename T> void set( const OUString& _sProperty
79 ,const T& Value
80 ,T& _member)
81 {
82 BoundListeners l;
83 {
84 ::osl::MutexGuard aGuard(m_aMutex);
85 if ( _member != Value )
86 {
87 prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l);
88 _member = Value;
89 }
90 }
91 l.notify();
92 }
93 void set( const OUString& _sProperty
94 ,bool Value
95 ,bool& _member)
96 {
97 BoundListeners l;
98 {
99 ::osl::MutexGuard aGuard(m_aMutex);
100 if ( _member != Value )
101 {
102 prepareSet(_sProperty, css::uno::Any(_member), css::uno::Any(Value), &l);
103 _member = Value;
104 }
105 }
106 l.notify();
107 }
109 protected:
110 virtual ~OShape() override;
111 public:
112 explicit OShape(css::uno::Reference< css::uno::XComponentContext > const & _xContext);
113 explicit OShape(css::uno::Reference< css::uno::XComponentContext > const & _xContext
114 ,const css::uno::Reference< css::lang::XMultiServiceFactory > & _xFactory
115 ,css::uno::Reference< css::drawing::XShape >& _xShape
116 ,OUString _sServiceName);
117
119 // css::lang::XServiceInfo
120 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
121 virtual OUString SAL_CALL getImplementationName( ) override;
122 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
123
125 static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
127 static OUString getImplementationName_Static();
128 static css::uno::Reference< css::uno::XInterface >
129 create(css::uno::Reference< css::uno::XComponentContext > const & xContext);
130 // css::beans::XPropertySet
131 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
132 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
133 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
134 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
135 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
136 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
137 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
138
139 // XReportComponent
141
142 // XShape
144
145 virtual OUString SAL_CALL getCustomShapeEngine() override;
146 virtual void SAL_CALL setCustomShapeEngine( const OUString& _customshapeengine ) override;
147 virtual OUString SAL_CALL getCustomShapeData() override;
148 virtual void SAL_CALL setCustomShapeData( const OUString& _customshapedata ) override;
149 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCustomShapeGeometry() override;
150 virtual void SAL_CALL setCustomShapeGeometry( const css::uno::Sequence< css::beans::PropertyValue >& _customshapegeometry ) override;
151
152 virtual sal_Bool SAL_CALL getOpaque() override;
153 virtual void SAL_CALL setOpaque( sal_Bool _opaque ) override;
154
155 // XShapeDescriptor
156 virtual OUString SAL_CALL getShapeType( ) override;
157
158 // XReportControlModel
160
161 // XReportControlFormat
163 // XShape
164 virtual ::sal_Int32 SAL_CALL getZOrder() override;
165 virtual void SAL_CALL setZOrder( ::sal_Int32 _zorder ) override;
166 virtual css::drawing::HomogenMatrix3 SAL_CALL getTransformation() override;
167 virtual void SAL_CALL setTransformation( const css::drawing::HomogenMatrix3& _transformation ) override;
168
169 // XCloneable
170 virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override;
171
172 // XComponent
173 virtual void SAL_CALL dispose() override;
174 virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
175 {
176 cppu::WeakComponentImplHelperBase::addEventListener(aListener);
177 }
178 virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
179 {
180 cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
181 }
182
183 // XChild
184 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
185 virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
186
187 // XContainer
188 virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
189 virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
190
191 // XElementAccess
192 virtual css::uno::Type SAL_CALL getElementType( ) override;
193 virtual sal_Bool SAL_CALL hasElements( ) override;
194
195 // XIndexReplace
196 virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override;
197
198 // XIndexContainer
199 virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override;
200 virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) override;
201
202 // XIndexAccess
203 virtual ::sal_Int32 SAL_CALL getCount( ) override;
204 virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override;
205 };
206}
207#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SHAPE_HXX
208
209/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
#define REPORTCONTROLMODEL_HEADER()
#define SHAPE_HEADER()
#define REPORTCONTROLFORMAT_HEADER()
#define REPORTCOMPONENT_HEADER()
mutable::osl::Mutex m_aMutex
void prepareSet(rtl::OUString const &propertyName, css::uno::Any const &oldValue, css::uno::Any const &newValue, BoundListeners *boundListeners)
implementation of a
Definition: Shape.hxx:45
virtual void SAL_CALL dispose() override
Definition: Shape.cxx:105
cppu::IPropertyArrayHelper & getInfoHelper()
Definition: Shape.cxx:183
static css::uno::Sequence< OUString > getSupportedServiceNames_Static()
Definition: Shape.cxx:128
virtual void SAL_CALL setCustomShapeData(const OUString &_customshapedata) override
Definition: Shape.cxx:472
OUString m_CustomShapeData
Definition: Shape.hxx:55
virtual void SAL_CALL removeByIndex(::sal_Int32 Index) override
Definition: Shape.cxx:359
virtual void SAL_CALL setZOrder(::sal_Int32 _zorder) override
Definition: Shape.cxx:419
virtual css::uno::Type SAL_CALL getElementType() override
Definition: Shape.cxx:343
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: Shape.cxx:145
virtual ::sal_Int32 SAL_CALL getCount() override
Definition: Shape.cxx:371
void set(const OUString &_sProperty, sal_Int16 Value, css::style::ParagraphAdjust &_member)
Definition: Shape.hxx:63
virtual void SAL_CALL setCustomShapeGeometry(const css::uno::Sequence< css::beans::PropertyValue > &_customshapegeometry) override
Definition: Shape.cxx:485
virtual void SAL_CALL removeContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
Definition: Shape.cxx:337
virtual void SAL_CALL insertByIndex(::sal_Int32 Index, const css::uno::Any &Element) override
Definition: Shape.cxx:354
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCustomShapeGeometry() override
Definition: Shape.cxx:478
virtual css::uno::Any SAL_CALL getByIndex(::sal_Int32 Index) override
Definition: Shape.cxx:376
OReportControlModel m_aProps
Definition: Shape.hxx:48
virtual sal_Bool SAL_CALL hasElements() override
Definition: Shape.cxx:348
OUString m_sServiceName
Definition: Shape.hxx:53
css::uno::Sequence< css::beans::PropertyValue > m_CustomShapeGeometry
Definition: Shape.hxx:56
static css::uno::Reference< css::uno::XInterface > create(css::uno::Reference< css::uno::XComponentContext > const &xContext)
Definition: Shape.cxx:111
virtual void SAL_CALL addContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
Definition: Shape.cxx:332
virtual void SAL_CALL setCustomShapeEngine(const OUString &_customshapeengine) override
Definition: Shape.cxx:459
css::drawing::HomogenMatrix3 m_Transformation
Definition: Shape.hxx:49
static OUString getImplementationName_Static()
Definition: Shape.cxx:117
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: Shape.cxx:196
::std::unique_ptr< ::comphelper::OPropertyArrayAggregationHelper > m_pAggHelper
Definition: Shape.hxx:47
virtual OUString SAL_CALL getCustomShapeData() override
Definition: Shape.cxx:465
virtual void SAL_CALL setTransformation(const css::drawing::HomogenMatrix3 &_transformation) override
Definition: Shape.cxx:445
OShape(const OShape &)=delete
virtual void SAL_CALL replaceByIndex(::sal_Int32 Index, const css::uno::Any &Element) override
Definition: Shape.cxx:365
virtual ::sal_Int32 SAL_CALL getZOrder() override
Definition: Shape.cxx:412
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: Shape.cxx:227
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: Shape.cxx:206
virtual OUString SAL_CALL getShapeType() override
Definition: Shape.cxx:404
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: Shape.hxx:178
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: Shape.cxx:176
sal_Int32 m_nZOrder
Definition: Shape.hxx:50
OShape & operator=(const OShape &)=delete
virtual void SAL_CALL setOpaque(sal_Bool _opaque) override
Definition: Shape.cxx:432
void set(const OUString &_sProperty, const T &Value, T &_member)
Definition: Shape.hxx:78
virtual css::drawing::HomogenMatrix3 SAL_CALL getTransformation() override
Definition: Shape.cxx:438
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: Shape.cxx:247
virtual OUString SAL_CALL getCustomShapeEngine() override
Definition: Shape.cxx:451
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
Definition: Shape.cxx:316
void set(const OUString &_sProperty, bool Value, bool &_member)
Definition: Shape.hxx:93
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: Shape.hxx:174
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: Shape.cxx:217
OUString m_CustomShapeEngine
Definition: Shape.hxx:54
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
Definition: Shape.cxx:321
OShape(css::uno::Reference< css::uno::XComponentContext > const &_xContext)
OShape(css::uno::Reference< css::uno::XComponentContext > const &_xContext, const css::uno::Reference< css::lang::XMultiServiceFactory > &_xFactory, css::uno::Reference< css::drawing::XShape > &_xShape, OUString _sServiceName)
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: Shape.cxx:237
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
Definition: Shape.cxx:292
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: Shape.cxx:133
virtual OUString SAL_CALL getImplementationName() override
Definition: Shape.cxx:123
virtual ~OShape() override
Definition: Shape.cxx:85
virtual sal_Bool SAL_CALL getOpaque() override
Definition: Shape.cxx:426
Value
::cppu::PropertySetMixin< css::report::XShape > ShapePropertySet
Definition: Shape.hxx:34
::cppu::WeakComponentImplHelper< css::report::XShape,css::lang::XServiceInfo > ShapeBase
Definition: Shape.hxx:36
unsigned char sal_Bool
#define DECLARE_XINTERFACE()