Line data Source code
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/compbase6.hxx>
24 : #include <comphelper/broadcasthelper.hxx>
25 : #include <comphelper/uno3.hxx>
26 : #include <comphelper/types.hxx>
27 : #include <cppuhelper/propertysetmixin.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 : #include <rtl/ref.hxx>
36 :
37 : namespace reportdesign
38 : {
39 : typedef ::cppu::WeakComponentImplHelper6
40 : < ::com::sun::star::report::XSection
41 : , ::com::sun::star::lang::XServiceInfo
42 : , ::com::sun::star::lang::XUnoTunnel
43 : // SvxDrawPage forward
44 : , ::com::sun::star::drawing::XDrawPage
45 : , ::com::sun::star::drawing::XShapeGrouper
46 : // SvxFmDrawPage forward
47 : , ::com::sun::star::form::XFormsSupplier2
48 : > SectionBase;
49 : typedef ::cppu::PropertySetMixin<com::sun::star::report::XSection> SectionPropertySet;
50 :
51 : class OSection : public comphelper::OMutexAndBroadcastHelper,
52 : public SectionBase,
53 : public SectionPropertySet
54 : {
55 : ::cppu::OInterfaceContainerHelper m_aContainerListeners;
56 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
57 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > m_xDrawPage;
58 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGrouper > m_xDrawPage_ShapeGrouper;
59 : ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormsSupplier2 > m_xDrawPage_FormSupplier;
60 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > m_xDrawPage_Tunnel;
61 : ::com::sun::star::uno::WeakReference< ::com::sun::star::report::XGroup > m_xGroup;
62 : ::com::sun::star::uno::WeakReference< ::com::sun::star::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_bCanGrow;
71 : bool m_bCanShrink;
72 : bool m_bRepeatSection;
73 : bool m_bVisible;
74 : bool m_bBacktransparent;
75 : bool m_bInRemoveNotify;
76 : bool m_bInInsertNotify;
77 :
78 : private:
79 : OSection(const OSection&);
80 : OSection& operator=(const OSection&);
81 :
82 0 : template <typename T> void set( const OUString& _sProperty
83 : ,const T& _Value
84 : ,T& _member)
85 : {
86 0 : BoundListeners l;
87 : {
88 0 : ::osl::MutexGuard aGuard(m_aMutex);
89 0 : if ( _member != _Value )
90 : {
91 0 : prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l);
92 0 : _member = _Value;
93 0 : }
94 : }
95 0 : l.notify();
96 0 : }
97 0 : void set( const OUString& _sProperty
98 : ,bool _Value
99 : ,bool& _member)
100 : {
101 0 : BoundListeners l;
102 : {
103 0 : ::osl::MutexGuard aGuard(m_aMutex);
104 0 : if ( _member != _Value )
105 : {
106 0 : prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l);
107 0 : _member = _Value;
108 0 : }
109 : }
110 0 : l.notify();
111 0 : }
112 :
113 : /** checks if this section is eiter the page header or footer and if so it throws an UnknownPropertyException
114 : *
115 : */
116 : void checkNotPageHeaderFooter();
117 :
118 : void init();
119 : protected:
120 : // TODO: VirtualFunctionFinder: This is virtual function!
121 :
122 : virtual ~OSection();
123 :
124 : /** this function is called upon disposing the component
125 : */
126 : // TODO: VirtualFunctionFinder: This is virtual function!
127 :
128 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
129 : public:
130 : typedef rtl::Reference<OSection> TSection;
131 :
132 : private:
133 : OSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& xParentDef
134 : ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& xParentGroup
135 : ,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context,
136 : ::com::sun::star::uno::Sequence< OUString> const&);
137 : public:
138 : static ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>
139 : createOSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xParent
140 : ,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context,bool _bPageSection=false);
141 : static ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>
142 : createOSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xParent
143 : ,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context,bool _bPageSection=false);
144 :
145 : DECLARE_XINTERFACE( )
146 :
147 : // ::com::sun::star::lang::XServiceInfo
148 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
149 : virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
150 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
151 :
152 : static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
153 : // com::sun::star::beans::XPropertySet
154 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
155 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
156 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
157 : virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
158 : virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
159 : virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
160 : virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
161 :
162 : // XSection
163 : virtual sal_Bool SAL_CALL getVisible() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
164 : virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
165 : virtual OUString SAL_CALL getName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
166 : virtual void SAL_CALL setName( const OUString& _name ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
167 : virtual ::sal_uInt32 SAL_CALL getHeight() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
168 : virtual void SAL_CALL setHeight( ::sal_uInt32 _height ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
169 : virtual ::sal_Int32 SAL_CALL getBackColor() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
170 : virtual void SAL_CALL setBackColor( ::sal_Int32 _backgroundcolor ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
171 : virtual sal_Bool SAL_CALL getBackTransparent() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
172 : virtual void SAL_CALL setBackTransparent( sal_Bool _backtransparent ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
173 : virtual OUString SAL_CALL getConditionalPrintExpression() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
174 : virtual void SAL_CALL setConditionalPrintExpression( const OUString& _conditionalprintexpression ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
175 : virtual ::sal_Int16 SAL_CALL getForceNewPage() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
176 : virtual void SAL_CALL setForceNewPage( ::sal_Int16 _forcenewpage ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
177 : virtual ::sal_Int16 SAL_CALL getNewRowOrCol() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
178 : virtual void SAL_CALL setNewRowOrCol( ::sal_Int16 _newroworcol ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
179 : virtual sal_Bool SAL_CALL getKeepTogether() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
180 : virtual void SAL_CALL setKeepTogether( sal_Bool _keeptogether ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
181 : virtual sal_Bool SAL_CALL getCanGrow() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
182 : virtual void SAL_CALL setCanGrow( sal_Bool _cangrow ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
183 : virtual sal_Bool SAL_CALL getCanShrink() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
184 : virtual void SAL_CALL setCanShrink( sal_Bool _canshrink ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
185 : virtual sal_Bool SAL_CALL getRepeatSection() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
186 : virtual void SAL_CALL setRepeatSection( sal_Bool _repeatsection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
187 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup > SAL_CALL getGroup() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
188 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition > SAL_CALL getReportDefinition() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
189 :
190 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > SAL_CALL createReportComponent( const OUString& _sReportComponentSpecifier ) throw (::com::sun::star::uno::Exception, ::com::sun::star::lang::IllegalArgumentException,::com::sun::star::uno::RuntimeException);
191 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAvailableReportComponentNames( ) throw (::com::sun::star::uno::RuntimeException);
192 : // XChild
193 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
194 : virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
195 : // XContainer
196 : virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
197 : virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
198 : // XElementAccess
199 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
200 : virtual sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
201 : // XShapes
202 : virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
203 : virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
204 : // XShapeGrouper
205 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup > SAL_CALL group( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& xShapes ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
206 : virtual void SAL_CALL ungroup( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapeGroup >& aGroup ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
207 :
208 : // XFormsSupplier
209 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getForms() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
210 : // XFormsSupplier2
211 : virtual sal_Bool SAL_CALL hasForms() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
212 :
213 : // XIndexAccess
214 : virtual ::sal_Int32 SAL_CALL getCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
215 : virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
216 : // XEnumerationAccess
217 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
218 :
219 : // XComponent
220 : virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
221 0 : virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
222 : {
223 0 : cppu::WeakComponentImplHelperBase::addEventListener(aListener);
224 0 : }
225 0 : virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
226 : {
227 0 : cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
228 0 : }
229 :
230 : // com::sun::star::lang::XUnoTunnel
231 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
232 : static OSection* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
233 : static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
234 :
235 : static void lcl_copySection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSource
236 : ,::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xDest);
237 :
238 : void notifyElementAdded(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape);
239 : void notifyElementRemoved(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape);
240 : };
241 : }
242 : #endif // INCLUDED_REPORTDESIGN_SOURCE_CORE_INC_SECTION_HXX
243 :
244 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|