LibreOffice Module reportdesign (master)  1
Group.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_GROUP_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_GROUP_HXX
21 
22 #include <com/sun/star/report/XGroup.hpp>
23 #include <cppuhelper/compbase.hxx>
26 #include <com/sun/star/uno/XComponentContext.hpp>
27 #include <GroupProperties.hxx>
28 #include <comphelper/uno3.hxx>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 
31 namespace reportdesign
32 {
33  typedef ::cppu::WeakComponentImplHelper< css::report::XGroup
34  , css::lang::XServiceInfo> GroupBase;
35  typedef ::cppu::PropertySetMixin< css::report::XGroup> GroupPropertySet;
36 
42  ,public GroupBase
43  ,public GroupPropertySet
44  {
45  css::uno::Reference< css::uno::XComponentContext > m_xContext;
46  css::uno::WeakReference< css::report::XGroups > m_xParent;
47  css::uno::Reference< css::report::XSection> m_xHeader;
48  css::uno::Reference< css::report::XSection> m_xFooter;
49  css::uno::Reference< css::report::XFunctions > m_xFunctions;
51 
52  private:
53  OGroup& operator=(const OGroup&) = delete;
54  OGroup(const OGroup&) = delete;
55 
56  template <typename T> void set( const OUString& _sProperty
57  ,const T& Value
58  ,T& _member)
59  {
60  BoundListeners l;
61  {
62  ::osl::MutexGuard aGuard(m_aMutex);
63  if ( _member != Value )
64  {
65  prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
66  _member = Value;
67  }
68  }
69  l.notify();
70  }
71  void set( const OUString& _sProperty
72  ,bool Value
73  ,bool& _member)
74  {
75  BoundListeners l;
76  {
77  ::osl::MutexGuard aGuard(m_aMutex);
78  if ( _member != Value )
79  {
80  prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
81  _member = Value;
82  }
83  }
84  l.notify();
85  }
86  void setSection( const OUString& _sProperty
87  ,bool _bOn
88  ,const OUString& _sName
89  ,css::uno::Reference< css::report::XSection>& _member);
90  protected:
91  // TODO: VirtualFunctionFinder: This is virtual function!
92 
93  virtual ~OGroup() override;
94 
97  // TODO: VirtualFunctionFinder: This is virtual function!
98 
99  virtual void SAL_CALL disposing() override;
100  public:
101  OGroup(const css::uno::Reference< css::report::XGroups >& _xParent
102  ,const css::uno::Reference< css::uno::XComponentContext >& context);
103 
105  // css::lang::XServiceInfo
106  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
107  virtual OUString SAL_CALL getImplementationName( ) override;
108  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
109 
111  static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
112 
113  // css::beans::XPropertySet
114  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
115  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
116  virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
117  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
118  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
119  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
120  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
121 
122  // XGroup
123  virtual sal_Bool SAL_CALL getSortAscending() override;
124  virtual void SAL_CALL setSortAscending( sal_Bool _sortascending ) override;
125  virtual sal_Bool SAL_CALL getHeaderOn() override;
126  virtual void SAL_CALL setHeaderOn( sal_Bool _headeron ) override;
127  virtual sal_Bool SAL_CALL getFooterOn() override;
128  virtual void SAL_CALL setFooterOn( sal_Bool _footeron ) override;
129  virtual css::uno::Reference< css::report::XSection > SAL_CALL getHeader() override;
130  virtual css::uno::Reference< css::report::XSection > SAL_CALL getFooter() override;
131  virtual ::sal_Int16 SAL_CALL getGroupOn() override;
132  virtual void SAL_CALL setGroupOn( ::sal_Int16 _groupon ) override;
133  virtual ::sal_Int32 SAL_CALL getGroupInterval() override;
134  virtual void SAL_CALL setGroupInterval( ::sal_Int32 _groupinterval ) override;
135  virtual ::sal_Int16 SAL_CALL getKeepTogether() override;
136  virtual void SAL_CALL setKeepTogether( ::sal_Int16 _keeptogether ) override;
137  virtual css::uno::Reference< css::report::XGroups > SAL_CALL getGroups() override;
138  virtual OUString SAL_CALL getExpression() override;
139  virtual void SAL_CALL setExpression( const OUString& _expression ) override;
140  virtual sal_Bool SAL_CALL getStartNewColumn() override;
141  virtual void SAL_CALL setStartNewColumn( sal_Bool _startnewcolumn ) override;
142  virtual sal_Bool SAL_CALL getResetPageNumber() override;
143  virtual void SAL_CALL setResetPageNumber( sal_Bool _resetpagenumber ) override;
144 
145  //XFunctionsSupplier
146  virtual css::uno::Reference< css::report::XFunctions > SAL_CALL getFunctions() override;
147 
148  // XChild
149  virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
150  virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
151 
152  // XComponent
153  virtual void SAL_CALL dispose() override;
154  virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
155  {
156  cppu::WeakComponentImplHelperBase::addEventListener(aListener);
157  }
158  virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
159  {
160  cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
161  }
162  };
163 
164 } // namespace reportdesign
165 
166 #endif
167 
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
implementation of a
Definition: Group.hxx:41
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
Definition: Group.cxx:246
::rptshared::GroupProperties m_aProps
Definition: Group.hxx:50
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: Group.cxx:71
::cppu::WeakComponentImplHelper< css::report::XGroup, css::lang::XServiceInfo > GroupBase
Definition: Group.hxx:34
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: Group.cxx:76
css::uno::Reference< css::report::XSection > m_xHeader
Definition: Group.hxx:47
virtual sal_Bool SAL_CALL getHeaderOn() override
Definition: Group.cxx:109
virtual void SAL_CALL setStartNewColumn(sal_Bool _startnewcolumn) override
Definition: Group.cxx:228
virtual void SAL_CALL dispose() override
Definition: Group.cxx:81
static css::uno::Sequence< OUString > getSupportedServiceNames_Static()
Definition: Group.cxx:65
virtual css::uno::Reference< css::report::XSection > SAL_CALL getHeader() override
Definition: Group.cxx:139
void setSection(const OUString &_sProperty, bool _bOn, const OUString &_sName, css::uno::Reference< css::report::XSection > &_member)
Definition: Group.cxx:291
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: Group.cxx:271
css::uno::WeakReference< css::report::XGroups > m_xParent
Definition: Group.hxx:46
virtual sal_Bool SAL_CALL getStartNewColumn() override
Definition: Group.cxx:222
virtual css::uno::Reference< css::report::XGroups > SAL_CALL getGroups() override
Definition: Group.cxx:206
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: Group.cxx:256
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: Group.cxx:276
virtual void SAL_CALL setResetPageNumber(sal_Bool _resetpagenumber) override
Definition: Group.cxx:240
virtual ::sal_Int32 SAL_CALL getGroupInterval() override
Definition: Group.cxx:180
virtual OUString SAL_CALL getImplementationName() override
Definition: Group.cxx:60
virtual css::uno::Reference< css::report::XFunctions > SAL_CALL getFunctions() override
Definition: Group.cxx:313
virtual sal_Bool SAL_CALL getFooterOn() override
Definition: Group.cxx:124
::cppu::PropertySetMixin< css::report::XGroup > GroupPropertySet
Definition: Group.hxx:35
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
Definition: Group.cxx:251
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: Group.hxx:45
unsigned char sal_Bool
virtual OUString SAL_CALL getExpression() override
Definition: Group.cxx:211
OGroup(const OGroup &)=delete
virtual void SAL_CALL setHeaderOn(sal_Bool _headeron) override
Definition: Group.cxx:115
virtual void SAL_CALL setExpression(const OUString &_expression) override
Definition: Group.cxx:217
virtual void SAL_CALL disposing() override
this function is called upon disposing the component
Definition: Group.cxx:89
virtual void SAL_CALL setGroupInterval(::sal_Int32 _groupinterval) override
Definition: Group.cxx:186
css::uno::Reference< css::report::XSection > m_xFooter
Definition: Group.hxx:48
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: Group.cxx:286
virtual css::uno::Reference< css::report::XSection > SAL_CALL getFooter() override
Definition: Group.cxx:152
virtual ::sal_Int16 SAL_CALL getKeepTogether() override
Definition: Group.cxx:191
void prepareSet(rtl::OUString const &propertyName, css::uno::Any const &oldValue, css::uno::Any const &newValue, BoundListeners *boundListeners)
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: Group.cxx:281
OGroup & operator=(const OGroup &)=delete
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: Group.hxx:154
virtual void SAL_CALL setKeepTogether(::sal_Int16 _keeptogether) override
Definition: Group.cxx:197
void set(const OUString &_sProperty, const T &Value, T &_member)
Definition: Group.hxx:56
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: Group.cxx:261
css::uno::Reference< css::report::XFunctions > m_xFunctions
Definition: Group.hxx:49
virtual void SAL_CALL setFooterOn(sal_Bool _footeron) override
Definition: Group.cxx:130
void set(const OUString &_sProperty, bool Value, bool &_member)
Definition: Group.hxx:71
virtual sal_Bool SAL_CALL getResetPageNumber() override
Definition: Group.cxx:234
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Definition: Group.hxx:158
struct for the group properties
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: Group.cxx:266
virtual void SAL_CALL setSortAscending(sal_Bool _sortascending) override
Definition: Group.cxx:104
virtual void SAL_CALL setGroupOn(::sal_Int16 _groupon) override
Definition: Group.cxx:171
virtual sal_Bool SAL_CALL getSortAscending() override
Definition: Group.cxx:98
virtual ::sal_Int16 SAL_CALL getGroupOn() override
Definition: Group.cxx:165
virtual ~OGroup() override
Definition: Group.cxx:54
#define DECLARE_XINTERFACE()