xref: /AOO41X/main/reportdesign/source/core/inc/Section.hxx (revision 9ee13d1351a4b51ae8bed78e67629c7bd5f4481e)
1*9ee13d13SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9ee13d13SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9ee13d13SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9ee13d13SAndrew Rist  * distributed with this work for additional information
6*9ee13d13SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9ee13d13SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9ee13d13SAndrew Rist  * "License"); you may not use this file except in compliance
9*9ee13d13SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*9ee13d13SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*9ee13d13SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9ee13d13SAndrew Rist  * software distributed under the License is distributed on an
15*9ee13d13SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9ee13d13SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9ee13d13SAndrew Rist  * specific language governing permissions and limitations
18*9ee13d13SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*9ee13d13SAndrew Rist  *************************************************************/
21*9ee13d13SAndrew Rist 
22*9ee13d13SAndrew Rist 
23cdf0e10cSrcweir #ifndef REPORTDESIGN_API_SECTION_HXX
24cdf0e10cSrcweir #define REPORTDESIGN_API_SECTION_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <com/sun/star/report/XSection.hpp>
27cdf0e10cSrcweir #include <cppuhelper/compbase3.hxx>
28cdf0e10cSrcweir #include <comphelper/broadcasthelper.hxx>
29cdf0e10cSrcweir #include <comphelper/uno3.hxx>
30cdf0e10cSrcweir #include <comphelper/types.hxx>
31cdf0e10cSrcweir #include <cppuhelper/propertysetmixin.hxx>
32cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
33cdf0e10cSrcweir #include <com/sun/star/drawing/XShapes.hpp>
34cdf0e10cSrcweir #include <com/sun/star/uno/XAggregation.hpp>
35cdf0e10cSrcweir #include <comphelper/stl_types.hxx>
36cdf0e10cSrcweir #include <comphelper/implementationreference.hxx>
37cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
38cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
39cdf0e10cSrcweir 
40cdf0e10cSrcweir namespace reportdesign
41cdf0e10cSrcweir {
42cdf0e10cSrcweir     typedef ::cppu::WeakComponentImplHelper3<   ::com::sun::star::report::XSection
43cdf0e10cSrcweir                                             ,   ::com::sun::star::lang::XServiceInfo
44cdf0e10cSrcweir                                             ,	::com::sun::star::lang::XUnoTunnel> SectionBase;
45cdf0e10cSrcweir 	typedef ::cppu::PropertySetMixin<com::sun::star::report::XSection> SectionPropertySet;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 	class OSection : public comphelper::OMutexAndBroadcastHelper,
48cdf0e10cSrcweir 					public SectionBase,
49cdf0e10cSrcweir 					public SectionPropertySet
50cdf0e10cSrcweir 	{
51cdf0e10cSrcweir         ::cppu::OInterfaceContainerHelper													m_aContainerListeners;
52cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >		m_xContext;
53cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >		        m_xDrawPage;
54cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >             m_xProxy;
55cdf0e10cSrcweir 		::com::sun::star::uno::WeakReference< ::com::sun::star::report::XGroup >			m_xGroup;
56cdf0e10cSrcweir 		::com::sun::star::uno::WeakReference< ::com::sun::star::report::XReportDefinition > m_xReportDefinition;
57cdf0e10cSrcweir 		::rtl::OUString 																	m_sName;
58cdf0e10cSrcweir 		::rtl::OUString 																	m_sConditionalPrintExpression;
59cdf0e10cSrcweir 		::sal_uInt32																		m_nHeight;
60cdf0e10cSrcweir 		::sal_Int32 																		m_nBackgroundColor;
61cdf0e10cSrcweir 		::sal_Int16 																		m_nForceNewPage;
62cdf0e10cSrcweir 		::sal_Int16 																		m_nNewRowOrCol;
63cdf0e10cSrcweir 		::sal_Bool 																			m_bKeepTogether;
64cdf0e10cSrcweir 		::sal_Bool 																			m_bCanGrow;
65cdf0e10cSrcweir 		::sal_Bool 																			m_bCanShrink;
66cdf0e10cSrcweir 		::sal_Bool 																			m_bRepeatSection;
67cdf0e10cSrcweir 		::sal_Bool																			m_bVisible;
68cdf0e10cSrcweir         ::sal_Bool																			m_bBacktransparent;
69cdf0e10cSrcweir         bool                                                                                m_bInRemoveNotify;
70cdf0e10cSrcweir         bool                                                                                m_bInInsertNotify;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 	private:
73cdf0e10cSrcweir 		OSection(const OSection&);
74cdf0e10cSrcweir 		OSection& operator=(const OSection&);
75cdf0e10cSrcweir 
set(const::rtl::OUString & _sProperty,const T & _Value,T & _member)76cdf0e10cSrcweir 		template <typename T> void set(	 const ::rtl::OUString& _sProperty
77cdf0e10cSrcweir 										,const T& _Value
78cdf0e10cSrcweir 										,T& _member)
79cdf0e10cSrcweir 		{
80cdf0e10cSrcweir 			BoundListeners l;
81cdf0e10cSrcweir 			{
82cdf0e10cSrcweir 				::osl::MutexGuard aGuard(m_aMutex);
83cdf0e10cSrcweir                 if ( _member != _Value )
84cdf0e10cSrcweir                 {
85cdf0e10cSrcweir 				    prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l);
86cdf0e10cSrcweir 				    _member = _Value;
87cdf0e10cSrcweir                 }
88cdf0e10cSrcweir 			}
89cdf0e10cSrcweir 			l.notify();
90cdf0e10cSrcweir 		}
91cdf0e10cSrcweir 
92cdf0e10cSrcweir         /** checks if this section is eiter the page header or footer and if so it throws an UnknownPropertyException
93cdf0e10cSrcweir         *
94cdf0e10cSrcweir         */
95cdf0e10cSrcweir         void checkNotPageHeaderFooter();
96cdf0e10cSrcweir 
97cdf0e10cSrcweir         void init();
98cdf0e10cSrcweir 	protected:
99cdf0e10cSrcweir         // TODO: VirtualFunctionFinder: This is virtual function!
100cdf0e10cSrcweir         //
101cdf0e10cSrcweir         virtual ~OSection();
102cdf0e10cSrcweir 
103cdf0e10cSrcweir         /** this function is called upon disposing the component
104cdf0e10cSrcweir         */
105cdf0e10cSrcweir         // TODO: VirtualFunctionFinder: This is virtual function!
106cdf0e10cSrcweir         //
107cdf0e10cSrcweir         virtual void SAL_CALL disposing();
108cdf0e10cSrcweir 	public:
109cdf0e10cSrcweir 		typedef ::comphelper::ImplementationReference< OSection	,::com::sun::star::report::XSection,::com::sun::star::uno::XWeak > TSection;
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 		OSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xParent
112cdf0e10cSrcweir 				,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context,bool _bPageSection=false);
113cdf0e10cSrcweir 		OSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xParent
114cdf0e10cSrcweir 				,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context,bool _bPageSection=false);
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 		DECLARE_XINTERFACE( )
117cdf0e10cSrcweir 
118cdf0e10cSrcweir 		// ::com::sun::star::lang::XServiceInfo
119cdf0e10cSrcweir 		virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
120cdf0e10cSrcweir 		virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
121cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 		static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
124cdf0e10cSrcweir 		// com::sun::star::beans::XPropertySet
125cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
126cdf0e10cSrcweir 		virtual void SAL_CALL setPropertyValue( const ::rtl::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);
127cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
128cdf0e10cSrcweir 		virtual void SAL_CALL addPropertyChangeListener( const ::rtl::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);
129cdf0e10cSrcweir 		virtual void SAL_CALL removePropertyChangeListener( const ::rtl::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);
130cdf0e10cSrcweir 		virtual void SAL_CALL addVetoableChangeListener( const ::rtl::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);
131cdf0e10cSrcweir 		virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::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);
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 		// XSection
134cdf0e10cSrcweir 		virtual ::sal_Bool SAL_CALL getVisible() throw (::com::sun::star::uno::RuntimeException);
135cdf0e10cSrcweir 		virtual void SAL_CALL setVisible( ::sal_Bool _visible ) throw (::com::sun::star::uno::RuntimeException);
136cdf0e10cSrcweir 		virtual ::rtl::OUString SAL_CALL getName() throw (::com::sun::star::uno::RuntimeException);
137cdf0e10cSrcweir 		virtual void SAL_CALL setName( const ::rtl::OUString& _name ) throw (::com::sun::star::uno::RuntimeException);
138cdf0e10cSrcweir 		virtual ::sal_uInt32 SAL_CALL getHeight() throw (::com::sun::star::uno::RuntimeException);
139cdf0e10cSrcweir 		virtual void SAL_CALL setHeight( ::sal_uInt32 _height ) throw (::com::sun::star::uno::RuntimeException);
140cdf0e10cSrcweir 		virtual ::sal_Int32 SAL_CALL getBackColor() throw (::com::sun::star::uno::RuntimeException);
141cdf0e10cSrcweir 		virtual void SAL_CALL setBackColor( ::sal_Int32 _backgroundcolor ) throw (::com::sun::star::uno::RuntimeException);
142cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL getBackTransparent() throw (::com::sun::star::uno::RuntimeException);
143cdf0e10cSrcweir         virtual void SAL_CALL setBackTransparent( ::sal_Bool _backtransparent ) throw (::com::sun::star::uno::RuntimeException);
144cdf0e10cSrcweir 		virtual ::rtl::OUString SAL_CALL getConditionalPrintExpression() throw (::com::sun::star::uno::RuntimeException);
145cdf0e10cSrcweir 		virtual void SAL_CALL setConditionalPrintExpression( const ::rtl::OUString& _conditionalprintexpression ) throw (::com::sun::star::uno::RuntimeException);
146cdf0e10cSrcweir 		virtual ::sal_Int16 SAL_CALL getForceNewPage() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
147cdf0e10cSrcweir 		virtual void SAL_CALL setForceNewPage( ::sal_Int16 _forcenewpage ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
148cdf0e10cSrcweir 		virtual ::sal_Int16 SAL_CALL getNewRowOrCol() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
149cdf0e10cSrcweir 		virtual void SAL_CALL setNewRowOrCol( ::sal_Int16 _newroworcol ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
150cdf0e10cSrcweir 		virtual ::sal_Bool SAL_CALL getKeepTogether() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
151cdf0e10cSrcweir 		virtual void SAL_CALL setKeepTogether( ::sal_Bool _keeptogether ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
152cdf0e10cSrcweir 		virtual ::sal_Bool SAL_CALL getCanGrow() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
153cdf0e10cSrcweir 		virtual void SAL_CALL setCanGrow( ::sal_Bool _cangrow ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
154cdf0e10cSrcweir 		virtual ::sal_Bool SAL_CALL getCanShrink() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
155cdf0e10cSrcweir 		virtual void SAL_CALL setCanShrink( ::sal_Bool _canshrink ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
156cdf0e10cSrcweir 		virtual ::sal_Bool SAL_CALL getRepeatSection() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
157cdf0e10cSrcweir 		virtual void SAL_CALL setRepeatSection( ::sal_Bool _repeatsection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
158cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup > SAL_CALL getGroup() throw (::com::sun::star::uno::RuntimeException);
159cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition > SAL_CALL getReportDefinition() throw (::com::sun::star::uno::RuntimeException);
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > SAL_CALL createReportComponent( const ::rtl::OUString& _sReportComponentSpecifier ) throw (::com::sun::star::uno::Exception, ::com::sun::star::lang::IllegalArgumentException,::com::sun::star::uno::RuntimeException);
162cdf0e10cSrcweir 	    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableReportComponentNames(  ) throw (::com::sun::star::uno::RuntimeException);
163cdf0e10cSrcweir 		// XChild
164cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent(  ) throw (::com::sun::star::uno::RuntimeException);
165cdf0e10cSrcweir 		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);
166cdf0e10cSrcweir 		// XContainer
167cdf0e10cSrcweir 		virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
168cdf0e10cSrcweir 		virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
169cdf0e10cSrcweir 		// XElementAccess
170cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Type SAL_CALL getElementType(  ) throw (::com::sun::star::uno::RuntimeException);
171cdf0e10cSrcweir 		virtual ::sal_Bool SAL_CALL hasElements(  ) throw (::com::sun::star::uno::RuntimeException);
172cdf0e10cSrcweir         // XShapes
173cdf0e10cSrcweir         virtual void SAL_CALL add( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException);
174cdf0e10cSrcweir         virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape ) throw (::com::sun::star::uno::RuntimeException);
175cdf0e10cSrcweir 		// XIndexAccess
176cdf0e10cSrcweir 		virtual ::sal_Int32 SAL_CALL getCount(  ) throw (::com::sun::star::uno::RuntimeException);
177cdf0e10cSrcweir 		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);
178cdf0e10cSrcweir 		// XEnumerationAccess
179cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(  ) throw (::com::sun::star::uno::RuntimeException);
180cdf0e10cSrcweir 
181cdf0e10cSrcweir         // XComponent
182cdf0e10cSrcweir 		virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
addEventListener(const::com::sun::star::uno::Reference<::com::sun::star::lang::XEventListener> & aListener)183cdf0e10cSrcweir 		virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException)
184cdf0e10cSrcweir 		{
185cdf0e10cSrcweir 			cppu::WeakComponentImplHelperBase::addEventListener(aListener);
186cdf0e10cSrcweir 		}
removeEventListener(const::com::sun::star::uno::Reference<::com::sun::star::lang::XEventListener> & aListener)187cdf0e10cSrcweir 		virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException)
188cdf0e10cSrcweir 		{
189cdf0e10cSrcweir 			cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
190cdf0e10cSrcweir 		}
191cdf0e10cSrcweir 
192cdf0e10cSrcweir         // com::sun::star::lang::XUnoTunnel
193cdf0e10cSrcweir 		virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
194cdf0e10cSrcweir         static OSection* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
195cdf0e10cSrcweir         static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 		static void lcl_copySection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSource
198cdf0e10cSrcweir 										 ,::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xDest);
199cdf0e10cSrcweir 
200cdf0e10cSrcweir         void notifyElementAdded(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape);
201cdf0e10cSrcweir         void notifyElementRemoved(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape);
202cdf0e10cSrcweir 	};
203cdf0e10cSrcweir }
204cdf0e10cSrcweir #endif //REPORTDESIGN_API_SECTION_HXX
205