LibreOffice Module reportdesign (master) 1
Section.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_SECTION_HXX
20#define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SECTION_HXX
21
22#include <com/sun/star/report/XSection.hpp>
25#include <comphelper/uno3.hxx>
28#include <com/sun/star/uno/XComponentContext.hpp>
29#include <com/sun/star/drawing/XDrawPage.hpp>
30#include <com/sun/star/drawing/XShapeGrouper.hpp>
31#include <com/sun/star/drawing/XShapes.hpp>
32#include <com/sun/star/form/XFormsSupplier2.hpp>
33#include <com/sun/star/lang/XUnoTunnel.hpp>
34#include <com/sun/star/lang/XServiceInfo.hpp>
35
36namespace reportdesign
37{
38 typedef ::cppu::WeakComponentImplHelper
39 < css::report::XSection
40 , css::lang::XServiceInfo
41 , css::lang::XUnoTunnel
42 // SvxDrawPage forward
43 , css::drawing::XDrawPage
44 , css::drawing::XShapeGrouper
45 // SvxFmDrawPage forward
46 , css::form::XFormsSupplier2
48 typedef ::cppu::PropertySetMixin<css::report::XSection> SectionPropertySet;
49
51 public SectionBase,
53 {
55 css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage;
56 css::uno::Reference< css::drawing::XShapeGrouper > m_xDrawPage_ShapeGrouper;
57 css::uno::Reference< css::form::XFormsSupplier2 > m_xDrawPage_FormSupplier;
58 css::uno::Reference< css::lang::XUnoTunnel > m_xDrawPage_Tunnel;
59 css::uno::WeakReference< css::report::XGroup > m_xGroup;
60 css::uno::WeakReference< css::report::XReportDefinition > m_xReportDefinition;
61 OUString m_sName;
63 ::sal_uInt32 m_nHeight;
64 ::sal_Int32 m_nBackgroundColor;
65 ::sal_Int16 m_nForceNewPage;
66 ::sal_Int16 m_nNewRowOrCol;
73
74 private:
75 OSection(const OSection&) = delete;
76 OSection& operator=(const OSection&) = delete;
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 }
108
113
114 void init();
115 protected:
116 // TODO: VirtualFunctionFinder: This is virtual function!
117
118 virtual ~OSection() override;
119
122 // TODO: VirtualFunctionFinder: This is virtual function!
123
124 virtual void SAL_CALL disposing() override;
125 private:
126 OSection(const css::uno::Reference< css::report::XReportDefinition >& xParentDef
127 ,const css::uno::Reference< css::report::XGroup >& xParentGroup
128 ,const css::uno::Reference< css::uno::XComponentContext >& context,
129 css::uno::Sequence< OUString> const&);
130 public:
131 static css::uno::Reference< css::report::XSection>
132 createOSection(const css::uno::Reference< css::report::XReportDefinition >& _xParent
133 ,const css::uno::Reference< css::uno::XComponentContext >& context,bool _bPageSection=false);
134 static css::uno::Reference< css::report::XSection>
135 createOSection(const css::uno::Reference< css::report::XGroup >& _xParent
136 ,const css::uno::Reference< css::uno::XComponentContext >& context);
137
139
140 // css::lang::XServiceInfo
141 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
142 virtual OUString SAL_CALL getImplementationName( ) override;
143 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
144
146 static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
147 // css::beans::XPropertySet
148 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
149 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
150 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
151 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
152 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
153 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
154 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
155
156 // XSection
157 virtual sal_Bool SAL_CALL getVisible() override;
158 virtual void SAL_CALL setVisible( sal_Bool _visible ) override;
159 virtual OUString SAL_CALL getName() override;
160 virtual void SAL_CALL setName( const OUString& _name ) override;
161 virtual ::sal_uInt32 SAL_CALL getHeight() override;
162 virtual void SAL_CALL setHeight( ::sal_uInt32 _height ) override;
163 virtual ::sal_Int32 SAL_CALL getBackColor() override;
164 virtual void SAL_CALL setBackColor( ::sal_Int32 _backgroundcolor ) override;
165 virtual sal_Bool SAL_CALL getBackTransparent() override;
166 virtual void SAL_CALL setBackTransparent( sal_Bool _backtransparent ) override;
167 virtual OUString SAL_CALL getConditionalPrintExpression() override;
168 virtual void SAL_CALL setConditionalPrintExpression( const OUString& _conditionalprintexpression ) override;
169 virtual ::sal_Int16 SAL_CALL getForceNewPage() override;
170 virtual void SAL_CALL setForceNewPage( ::sal_Int16 _forcenewpage ) override;
171 virtual ::sal_Int16 SAL_CALL getNewRowOrCol() override;
172 virtual void SAL_CALL setNewRowOrCol( ::sal_Int16 _newroworcol ) override;
173 virtual sal_Bool SAL_CALL getKeepTogether() override;
174 virtual void SAL_CALL setKeepTogether( sal_Bool _keeptogether ) override;
175 virtual sal_Bool SAL_CALL getCanGrow() override;
176 virtual void SAL_CALL setCanGrow( sal_Bool _cangrow ) override;
177 virtual sal_Bool SAL_CALL getCanShrink() override;
178 virtual void SAL_CALL setCanShrink( sal_Bool _canshrink ) override;
179 virtual sal_Bool SAL_CALL getRepeatSection() override;
180 virtual void SAL_CALL setRepeatSection( sal_Bool _repeatsection ) override;
181 virtual css::uno::Reference< css::report::XGroup > SAL_CALL getGroup() override;
182 virtual css::uno::Reference< css::report::XReportDefinition > SAL_CALL getReportDefinition() override;
183
184 // XChild
185 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
186 virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
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 // XElementAccess
191 virtual css::uno::Type SAL_CALL getElementType( ) override;
192 virtual sal_Bool SAL_CALL hasElements( ) override;
193 // XShapes
194 virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
195 virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
196 // XShapeGrouper
197 virtual css::uno::Reference< css::drawing::XShapeGroup > SAL_CALL group( const css::uno::Reference< css::drawing::XShapes >& xShapes ) override;
198 virtual void SAL_CALL ungroup( const css::uno::Reference< css::drawing::XShapeGroup >& aGroup ) override;
199
200 // XFormsSupplier
201 virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getForms() override;
202 // XFormsSupplier2
203 virtual sal_Bool SAL_CALL hasForms() override;
204
205 // XIndexAccess
206 virtual ::sal_Int32 SAL_CALL getCount( ) override;
207 virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override;
208 // XEnumerationAccess
209 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) override;
210
211 // XComponent
212 virtual void SAL_CALL dispose() override;
213 virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
214 {
215 cppu::WeakComponentImplHelperBase::addEventListener(aListener);
216 }
217 virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
218 {
219 cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
220 }
221
222 // css::lang::XUnoTunnel
223 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
224 static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
225
226 void notifyElementAdded(const css::uno::Reference< css::drawing::XShape >& xShape);
227 void notifyElementRemoved(const css::uno::Reference< css::drawing::XShape >& xShape);
228 };
229}
230#endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SECTION_HXX
231
232/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
void prepareSet(rtl::OUString const &propertyName, css::uno::Any const &oldValue, css::uno::Any const &newValue, BoundListeners *boundListeners)
virtual ::sal_Int32 SAL_CALL getCount() override
Definition: Section.cxx:451
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: Section.cxx:495
virtual ::sal_Int16 SAL_CALL getForceNewPage() override
Definition: Section.cxx:295
virtual void SAL_CALL dispose() override
Definition: Section.cxx:142
virtual css::uno::Reference< css::report::XReportDefinition > SAL_CALL getReportDefinition() override
Definition: Section.cxx:394
virtual css::uno::Reference< css::report::XGroup > SAL_CALL getGroup() override
Definition: Section.cxx:388
css::uno::WeakReference< css::report::XReportDefinition > m_xReportDefinition
Definition: Section.hxx:60
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: Section.cxx:175
virtual void SAL_CALL setCanShrink(sal_Bool _canshrink) override
Definition: Section.cxx:363
css::uno::Reference< css::drawing::XShapeGrouper > m_xDrawPage_ShapeGrouper
Definition: Section.hxx:56
virtual OUString SAL_CALL getName() override
Definition: Section.cxx:222
virtual sal_Bool SAL_CALL getKeepTogether() override
Definition: Section.cxx:331
css::uno::WeakReference< css::report::XGroup > m_xGroup
Definition: Section.hxx:59
virtual sal_Bool SAL_CALL hasElements() override
Definition: Section.cxx:444
static css::uno::Reference< css::report::XSection > createOSection(const css::uno::Reference< css::report::XGroup > &_xParent, const css::uno::Reference< css::uno::XComponentContext > &context)
OUString m_sConditionalPrintExpression
Definition: Section.hxx:62
void checkNotPageHeaderFooter()
checks if this section is either the page header or footer and if so it throws an UnknownPropertyExce...
Definition: Section.cxx:282
css::uno::Reference< css::form::XFormsSupplier2 > m_xDrawPage_FormSupplier
Definition: Section.hxx:57
void set(const OUString &_sProperty, const T &Value, T &_member)
Definition: Section.hxx:78
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: Section.cxx:485
::sal_Int32 m_nBackgroundColor
Definition: Section.hxx:64
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: Section.cxx:180
OSection & operator=(const OSection &)=delete
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: Section.cxx:480
::sal_Int16 m_nNewRowOrCol
Definition: Section.hxx:66
virtual sal_Bool SAL_CALL hasForms() override
Definition: Section.cxx:556
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: Section.hxx:217
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
Definition: Section.cxx:422
virtual void SAL_CALL addContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
Definition: Section.cxx:428
virtual void SAL_CALL add(const css::uno::Reference< css::drawing::XShape > &xShape) override
Definition: Section.cxx:505
void set(const OUString &_sProperty, bool Value, bool &_member)
Definition: Section.hxx:93
virtual ::sal_Int16 SAL_CALL getNewRowOrCol() override
Definition: Section.cxx:313
virtual void SAL_CALL setName(const OUString &_name) override
Definition: Section.cxx:228
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: Section.cxx:490
virtual void SAL_CALL setHeight(::sal_uInt32 _height) override
Definition: Section.cxx:239
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: Section.cxx:475
virtual void SAL_CALL ungroup(const css::uno::Reference< css::drawing::XShapeGroup > &aGroup) override
Definition: Section.cxx:539
OSection(const css::uno::Reference< css::report::XReportDefinition > &xParentDef, const css::uno::Reference< css::report::XGroup > &xParentGroup, const css::uno::Reference< css::uno::XComponentContext > &context, css::uno::Sequence< OUString > const &)
static css::uno::Reference< css::report::XSection > createOSection(const css::uno::Reference< css::report::XReportDefinition > &_xParent, const css::uno::Reference< css::uno::XComponentContext > &context, bool _bPageSection=false)
virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getForms() override
Definition: Section.cxx:548
static css::uno::Sequence< OUString > getSupportedServiceNames_Static()
Definition: Section.cxx:169
virtual void SAL_CALL setConditionalPrintExpression(const OUString &_conditionalprintexpression) override
Definition: Section.cxx:277
virtual sal_Bool SAL_CALL getVisible() override
Definition: Section.cxx:211
virtual void SAL_CALL setVisible(sal_Bool _visible) override
Definition: Section.cxx:217
virtual void SAL_CALL setRepeatSection(sal_Bool _repeatsection) override
Definition: Section.cxx:377
::sal_uInt32 m_nHeight
Definition: Section.hxx:63
virtual void SAL_CALL setBackTransparent(sal_Bool _backtransparent) override
Definition: Section.cxx:264
void notifyElementAdded(const css::uno::Reference< css::drawing::XShape > &xShape)
Definition: Section.cxx:579
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: Section.hxx:213
virtual void SAL_CALL setForceNewPage(::sal_Int16 _forcenewpage) override
Definition: Section.cxx:303
virtual css::uno::Type SAL_CALL getElementType() override
Definition: Section.cxx:439
::comphelper::OInterfaceContainerHelper3< css::container::XContainerListener > m_aContainerListeners
Definition: Section.hxx:54
virtual ::sal_uInt32 SAL_CALL getHeight() override
Definition: Section.cxx:233
virtual css::uno::Any SAL_CALL getByIndex(::sal_Int32 Index) override
Definition: Section.cxx:457
virtual void SAL_CALL setKeepTogether(sal_Bool _keeptogether) override
Definition: Section.cxx:338
virtual void SAL_CALL disposing() override
this function is called upon disposing the component
Definition: Section.cxx:158
virtual ::sal_Int32 SAL_CALL getBackColor() override
Definition: Section.cxx:244
virtual sal_Bool SAL_CALL getBackTransparent() override
Definition: Section.cxx:258
::sal_Int16 m_nForceNewPage
Definition: Section.hxx:65
OSection(const OSection &)=delete
css::uno::Reference< css::lang::XUnoTunnel > m_xDrawPage_Tunnel
Definition: Section.hxx:58
css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage
Definition: Section.hxx:55
virtual void SAL_CALL removeContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
Definition: Section.cxx:433
virtual void SAL_CALL setBackColor(::sal_Int32 _backgroundcolor) override
Definition: Section.cxx:250
virtual css::uno::Reference< css::drawing::XShapeGroup > SAL_CALL group(const css::uno::Reference< css::drawing::XShapes > &xShapes) override
Definition: Section.cxx:531
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: Section.cxx:470
virtual void SAL_CALL setNewRowOrCol(::sal_Int16 _newroworcol) override
Definition: Section.cxx:320
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: Section.cxx:500
void notifyElementRemoved(const css::uno::Reference< css::drawing::XShape > &xShape)
Definition: Section.cxx:588
virtual sal_Bool SAL_CALL getRepeatSection() override
Definition: Section.cxx:368
virtual void SAL_CALL remove(const css::uno::Reference< css::drawing::XShape > &xShape) override
Definition: Section.cxx:517
virtual ~OSection() override
Definition: Section.cxx:122
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: Section.cxx:464
virtual OUString SAL_CALL getImplementationName() override
Definition: Section.cxx:164
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: Section.cxx:566
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
Definition: Section.cxx:410
virtual OUString SAL_CALL getConditionalPrintExpression() override
Definition: Section.cxx:271
virtual sal_Bool SAL_CALL getCanGrow() override
Definition: Section.cxx:348
virtual void SAL_CALL setCanGrow(sal_Bool _cangrow) override
Definition: Section.cxx:353
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: Section.cxx:573
virtual sal_Bool SAL_CALL getCanShrink() override
Definition: Section.cxx:358
Value
::cppu::PropertySetMixin< css::report::XSection > SectionPropertySet
Definition: Section.hxx:48
::cppu::WeakComponentImplHelper< css::report::XSection, css::lang::XServiceInfo, css::lang::XUnoTunnel, css::drawing::XDrawPage, css::drawing::XShapeGrouper, css::form::XFormsSupplier2 > SectionBase
Definition: Section.hxx:47
unsigned char sal_Bool
#define DECLARE_XINTERFACE()