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