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>
23 #include <cppuhelper/compbase.hxx>
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 
36 namespace 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,
52  public SectionPropertySet
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;
69  bool m_bVisible;
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::makeAny(_member), css::uno::makeAny(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::makeAny(_member), css::uno::makeAny(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 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: */
virtual void SAL_CALL setKeepTogether(sal_Bool _keeptogether) override
Definition: Section.cxx:339
virtual void SAL_CALL dispose() override
Definition: Section.cxx:143
::sal_Int32 m_nBackgroundColor
Definition: Section.hxx:64
::sal_uInt32 m_nHeight
Definition: Section.hxx:63
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: Section.cxx:501
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: Section.hxx:217
virtual sal_Bool SAL_CALL hasForms() override
Definition: Section.cxx:557
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: Section.hxx:213
virtual css::uno::Reference< css::report::XGroup > SAL_CALL getGroup() override
Definition: Section.cxx:389
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
Definition: Section.cxx:411
virtual void SAL_CALL disposing() override
this function is called upon disposing the component
Definition: Section.cxx:159
virtual sal_Bool SAL_CALL getCanShrink() override
Definition: Section.cxx:359
css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage
Definition: Section.hxx:55
virtual void SAL_CALL setNewRowOrCol(::sal_Int16 _newroworcol) override
Definition: Section.cxx:321
void notifyElementAdded(const css::uno::Reference< css::drawing::XShape > &xShape)
Definition: Section.cxx:581
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
Definition: Section.cxx:567
static css::uno::Sequence< OUString > getSupportedServiceNames_Static()
Definition: Section.cxx:170
virtual sal_Bool SAL_CALL hasElements() override
Definition: Section.cxx:445
virtual OUString SAL_CALL getName() override
Definition: Section.cxx:223
void notifyElementRemoved(const css::uno::Reference< css::drawing::XShape > &xShape)
Definition: Section.cxx:590
void checkNotPageHeaderFooter()
checks if this section is either the page header or footer and if so it throws an UnknownPropertyExce...
Definition: Section.cxx:283
virtual ::sal_Int16 SAL_CALL getForceNewPage() override
Definition: Section.cxx:296
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
Definition: Section.cxx:423
virtual void SAL_CALL add(const css::uno::Reference< css::drawing::XShape > &xShape) override
Definition: Section.cxx:506
virtual ::sal_uInt32 SAL_CALL getHeight() override
Definition: Section.cxx:234
virtual ~OSection() override
Definition: Section.cxx:123
virtual sal_Bool SAL_CALL getBackTransparent() override
Definition: Section.cxx:259
virtual ::sal_Int16 SAL_CALL getNewRowOrCol() override
Definition: Section.cxx:314
::comphelper::OInterfaceContainerHelper2 m_aContainerListeners
Definition: Section.hxx:54
static css::uno::Sequence< sal_Int8 > getUnoTunnelId()
Definition: Section.cxx:574
virtual ::sal_Int32 SAL_CALL getBackColor() override
Definition: Section.cxx:245
css::uno::Reference< css::drawing::XShapeGrouper > m_xDrawPage_ShapeGrouper
Definition: Section.hxx:56
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: Section.cxx:486
virtual void SAL_CALL setForceNewPage(::sal_Int16 _forcenewpage) override
Definition: Section.cxx:304
virtual OUString SAL_CALL getConditionalPrintExpression() override
Definition: Section.cxx:272
virtual void SAL_CALL addContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
Definition: Section.cxx:429
virtual css::uno::Any SAL_CALL getByIndex(::sal_Int32 Index) override
Definition: Section.cxx:458
css::uno::WeakReference< css::report::XGroup > m_xGroup
Definition: Section.hxx:59
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 void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: Section.cxx:491
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: Section.cxx:181
void set(const OUString &_sProperty, const T &Value, T &_member)
Definition: Section.hxx:78
virtual void SAL_CALL setName(const OUString &_name) override
Definition: Section.cxx:229
virtual sal_Bool SAL_CALL getKeepTogether() override
Definition: Section.cxx:332
::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
OSection & operator=(const OSection &)=delete
::sal_Int16 m_nForceNewPage
Definition: Section.hxx:65
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: Section.cxx:476
unsigned char sal_Bool
::cppu::PropertySetMixin< css::report::XSection > SectionPropertySet
Definition: Section.hxx:48
virtual void SAL_CALL setBackColor(::sal_Int32 _backgroundcolor) override
Definition: Section.cxx:251
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: Section.cxx:176
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: Section.cxx:465
OSection(const OSection &)=delete
virtual css::uno::Type SAL_CALL getElementType() override
Definition: Section.cxx:440
css::uno::WeakReference< css::report::XReportDefinition > m_xReportDefinition
Definition: Section.hxx:60
virtual sal_Bool SAL_CALL getVisible() override
Definition: Section.cxx:212
void prepareSet(rtl::OUString const &propertyName, css::uno::Any const &oldValue, css::uno::Any const &newValue, BoundListeners *boundListeners)
virtual void SAL_CALL setConditionalPrintExpression(const OUString &_conditionalprintexpression) override
Definition: Section.cxx:278
virtual void SAL_CALL setRepeatSection(sal_Bool _repeatsection) override
Definition: Section.cxx:378
OUString m_sConditionalPrintExpression
Definition: Section.hxx:62
virtual void SAL_CALL setVisible(sal_Bool _visible) override
Definition: Section.cxx:218
virtual void SAL_CALL setBackTransparent(sal_Bool _backtransparent) override
Definition: Section.cxx:265
virtual OUString SAL_CALL getImplementationName() override
Definition: Section.cxx:165
virtual sal_Bool SAL_CALL getCanGrow() override
Definition: Section.cxx:349
virtual void SAL_CALL ungroup(const css::uno::Reference< css::drawing::XShapeGroup > &aGroup) override
Definition: Section.cxx:540
void set(const OUString &_sProperty, bool Value, bool &_member)
Definition: Section.hxx:93
virtual void SAL_CALL setCanShrink(sal_Bool _canshrink) override
Definition: Section.cxx:364
virtual sal_Bool SAL_CALL getRepeatSection() override
Definition: Section.cxx:369
virtual void SAL_CALL setHeight(::sal_uInt32 _height) override
Definition: Section.cxx:240
css::uno::Reference< css::lang::XUnoTunnel > m_xDrawPage_Tunnel
Definition: Section.hxx:58
virtual void SAL_CALL remove(const css::uno::Reference< css::drawing::XShape > &xShape) override
Definition: Section.cxx:518
virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getForms() override
Definition: Section.cxx:549
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: Section.cxx:481
virtual void SAL_CALL removeContainerListener(const css::uno::Reference< css::container::XContainerListener > &xListener) override
Definition: Section.cxx:434
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: Section.cxx:471
virtual css::uno::Reference< css::drawing::XShapeGroup > SAL_CALL group(const css::uno::Reference< css::drawing::XShapes > &xShapes) override
Definition: Section.cxx:532
virtual css::uno::Reference< css::report::XReportDefinition > SAL_CALL getReportDefinition() override
Definition: Section.cxx:395
struct _ADOIndex Index
virtual ::sal_Int32 SAL_CALL getCount() override
Definition: Section.cxx:452
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: Section.cxx:496
css::uno::Reference< css::form::XFormsSupplier2 > m_xDrawPage_FormSupplier
Definition: Section.hxx:57
#define DECLARE_XINTERFACE()
::sal_Int16 m_nNewRowOrCol
Definition: Section.hxx:66
virtual void SAL_CALL setCanGrow(sal_Bool _cangrow) override
Definition: Section.cxx:354