bump product version to 6.3.0.0.beta1
[LibreOffice.git] / reportdesign / source / core / inc / Section.hxx
blobfb4fe75172adae3247155d68e72ccd9eaa6192f5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SECTION_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SECTION_HXX
22 #include <com/sun/star/report/XSection.hpp>
23 #include <cppuhelper/compbase.hxx>
24 #include <comphelper/broadcasthelper.hxx>
25 #include <comphelper/uno3.hxx>
26 #include <comphelper/types.hxx>
27 #include <cppuhelper/propertysetmixin.hxx>
28 #include <comphelper/interfacecontainer2.hxx>
29 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <com/sun/star/drawing/XDrawPage.hpp>
31 #include <com/sun/star/drawing/XShapeGrouper.hpp>
32 #include <com/sun/star/drawing/XShapes.hpp>
33 #include <com/sun/star/form/XFormsSupplier2.hpp>
34 #include <com/sun/star/lang/XUnoTunnel.hpp>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
36 #include <rtl/ref.hxx>
38 namespace reportdesign
40 typedef ::cppu::WeakComponentImplHelper
41 < css::report::XSection
42 , css::lang::XServiceInfo
43 , css::lang::XUnoTunnel
44 // SvxDrawPage forward
45 , css::drawing::XDrawPage
46 , css::drawing::XShapeGrouper
47 // SvxFmDrawPage forward
48 , css::form::XFormsSupplier2
49 > SectionBase;
50 typedef ::cppu::PropertySetMixin<css::report::XSection> SectionPropertySet;
52 class OSection : public comphelper::OMutexAndBroadcastHelper,
53 public SectionBase,
54 public SectionPropertySet
56 ::comphelper::OInterfaceContainerHelper2 m_aContainerListeners;
57 css::uno::Reference< css::drawing::XDrawPage > m_xDrawPage;
58 css::uno::Reference< css::drawing::XShapeGrouper > m_xDrawPage_ShapeGrouper;
59 css::uno::Reference< css::form::XFormsSupplier2 > m_xDrawPage_FormSupplier;
60 css::uno::Reference< css::lang::XUnoTunnel > m_xDrawPage_Tunnel;
61 css::uno::WeakReference< css::report::XGroup > m_xGroup;
62 css::uno::WeakReference< css::report::XReportDefinition > m_xReportDefinition;
63 OUString m_sName;
64 OUString m_sConditionalPrintExpression;
65 ::sal_uInt32 m_nHeight;
66 ::sal_Int32 m_nBackgroundColor;
67 ::sal_Int16 m_nForceNewPage;
68 ::sal_Int16 m_nNewRowOrCol;
69 bool m_bKeepTogether;
70 bool m_bRepeatSection;
71 bool m_bVisible;
72 bool m_bBacktransparent;
73 bool m_bInRemoveNotify;
74 bool m_bInInsertNotify;
76 private:
77 OSection(const OSection&) = delete;
78 OSection& operator=(const OSection&) = delete;
80 template <typename T> void set( const OUString& _sProperty
81 ,const T& Value
82 ,T& _member)
84 BoundListeners l;
86 ::osl::MutexGuard aGuard(m_aMutex);
87 if ( _member != Value )
89 prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
90 _member = Value;
93 l.notify();
95 void set( const OUString& _sProperty
96 ,bool Value
97 ,bool& _member)
99 BoundListeners l;
101 ::osl::MutexGuard aGuard(m_aMutex);
102 if ( _member != Value )
104 prepareSet(_sProperty, css::uno::makeAny(_member), css::uno::makeAny(Value), &l);
105 _member = Value;
108 l.notify();
111 /** checks if this section is either the page header or footer and if so it throws an UnknownPropertyException
114 void checkNotPageHeaderFooter();
116 void init();
117 protected:
118 // TODO: VirtualFunctionFinder: This is virtual function!
120 virtual ~OSection() override;
122 /** this function is called upon disposing the component
124 // TODO: VirtualFunctionFinder: This is virtual function!
126 virtual void SAL_CALL disposing() override;
127 private:
128 OSection(const css::uno::Reference< css::report::XReportDefinition >& xParentDef
129 ,const css::uno::Reference< css::report::XGroup >& xParentGroup
130 ,const css::uno::Reference< css::uno::XComponentContext >& context,
131 css::uno::Sequence< OUString> const&);
132 public:
133 static css::uno::Reference< css::report::XSection>
134 createOSection(const css::uno::Reference< css::report::XReportDefinition >& _xParent
135 ,const css::uno::Reference< css::uno::XComponentContext >& context,bool _bPageSection=false);
136 static css::uno::Reference< css::report::XSection>
137 createOSection(const css::uno::Reference< css::report::XGroup >& _xParent
138 ,const css::uno::Reference< css::uno::XComponentContext >& context);
140 DECLARE_XINTERFACE( )
142 // css::lang::XServiceInfo
143 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
144 virtual OUString SAL_CALL getImplementationName( ) override;
145 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
147 /// @throws css::uno::RuntimeException
148 static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
149 // css::beans::XPropertySet
150 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
151 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
152 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
153 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
154 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
155 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
156 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
158 // XSection
159 virtual sal_Bool SAL_CALL getVisible() override;
160 virtual void SAL_CALL setVisible( sal_Bool _visible ) override;
161 virtual OUString SAL_CALL getName() override;
162 virtual void SAL_CALL setName( const OUString& _name ) override;
163 virtual ::sal_uInt32 SAL_CALL getHeight() override;
164 virtual void SAL_CALL setHeight( ::sal_uInt32 _height ) override;
165 virtual ::sal_Int32 SAL_CALL getBackColor() override;
166 virtual void SAL_CALL setBackColor( ::sal_Int32 _backgroundcolor ) override;
167 virtual sal_Bool SAL_CALL getBackTransparent() override;
168 virtual void SAL_CALL setBackTransparent( sal_Bool _backtransparent ) override;
169 virtual OUString SAL_CALL getConditionalPrintExpression() override;
170 virtual void SAL_CALL setConditionalPrintExpression( const OUString& _conditionalprintexpression ) override;
171 virtual ::sal_Int16 SAL_CALL getForceNewPage() override;
172 virtual void SAL_CALL setForceNewPage( ::sal_Int16 _forcenewpage ) override;
173 virtual ::sal_Int16 SAL_CALL getNewRowOrCol() override;
174 virtual void SAL_CALL setNewRowOrCol( ::sal_Int16 _newroworcol ) override;
175 virtual sal_Bool SAL_CALL getKeepTogether() override;
176 virtual void SAL_CALL setKeepTogether( sal_Bool _keeptogether ) override;
177 virtual sal_Bool SAL_CALL getCanGrow() override;
178 virtual void SAL_CALL setCanGrow( sal_Bool _cangrow ) override;
179 virtual sal_Bool SAL_CALL getCanShrink() override;
180 virtual void SAL_CALL setCanShrink( sal_Bool _canshrink ) override;
181 virtual sal_Bool SAL_CALL getRepeatSection() override;
182 virtual void SAL_CALL setRepeatSection( sal_Bool _repeatsection ) override;
183 virtual css::uno::Reference< css::report::XGroup > SAL_CALL getGroup() override;
184 virtual css::uno::Reference< css::report::XReportDefinition > SAL_CALL getReportDefinition() override;
186 // XChild
187 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
188 virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
189 // XContainer
190 virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
191 virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override;
192 // XElementAccess
193 virtual css::uno::Type SAL_CALL getElementType( ) override;
194 virtual sal_Bool SAL_CALL hasElements( ) override;
195 // XShapes
196 virtual void SAL_CALL add( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
197 virtual void SAL_CALL remove( const css::uno::Reference< css::drawing::XShape >& xShape ) override;
198 // XShapeGrouper
199 virtual css::uno::Reference< css::drawing::XShapeGroup > SAL_CALL group( const css::uno::Reference< css::drawing::XShapes >& xShapes ) override;
200 virtual void SAL_CALL ungroup( const css::uno::Reference< css::drawing::XShapeGroup >& aGroup ) override;
202 // XFormsSupplier
203 virtual css::uno::Reference< css::container::XNameContainer > SAL_CALL getForms() override;
204 // XFormsSupplier2
205 virtual sal_Bool SAL_CALL hasForms() override;
207 // XIndexAccess
208 virtual ::sal_Int32 SAL_CALL getCount( ) override;
209 virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override;
210 // XEnumerationAccess
211 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration( ) override;
213 // XComponent
214 virtual void SAL_CALL dispose() override;
215 virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
217 cppu::WeakComponentImplHelperBase::addEventListener(aListener);
219 virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > & aListener) override
221 cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
224 // css::lang::XUnoTunnel
225 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
226 static OSection* getImplementation( const css::uno::Reference< css::uno::XInterface >& _rxComponent );
227 static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
229 void notifyElementAdded(const css::uno::Reference< css::drawing::XShape >& xShape);
230 void notifyElementRemoved(const css::uno::Reference< css::drawing::XShape >& xShape);
233 #endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SECTION_HXX
235 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */