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/implementationreference.hxx>
34 : #include <com/sun/star/lang/XUnoTunnel.hpp>
35 : #include <com/sun/star/lang/XServiceInfo.hpp>
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 : sal_Bool m_bKeepTogether;
70 : sal_Bool m_bCanGrow;
71 : sal_Bool m_bCanShrink;
72 : sal_Bool m_bRepeatSection;
73 : sal_Bool m_bVisible;
74 : sal_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 :
98 : /** checks if this section is eiter the page header or footer and if so it throws an UnknownPropertyException
99 : *
100 : */
101 : void checkNotPageHeaderFooter();
102 :
103 : void init();
104 : protected:
105 : // TODO: VirtualFunctionFinder: This is virtual function!
106 :
107 : virtual ~OSection();
108 :
109 : /** this function is called upon disposing the component
110 : */
111 : // TODO: VirtualFunctionFinder: This is virtual function!
112 :
113 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
114 : public:
115 : typedef ::comphelper::ImplementationReference< OSection ,::com::sun::star::report::XSection,::com::sun::star::uno::XWeak > TSection;
116 :
117 : private:
118 : OSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& xParentDef
119 : ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& xParentGroup
120 : ,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context,
121 : ::com::sun::star::uno::Sequence< OUString> const&);
122 : public:
123 : static ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>
124 : createOSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xParent
125 : ,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context,bool _bPageSection=false);
126 : static ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>
127 : createOSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xParent
128 : ,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context,bool _bPageSection=false);
129 :
130 : DECLARE_XINTERFACE( )
131 :
132 : // ::com::sun::star::lang::XServiceInfo
133 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 : virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
135 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
136 :
137 : static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
138 : // com::sun::star::beans::XPropertySet
139 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
140 : 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;
141 : 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;
142 : 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;
143 : 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;
144 : 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;
145 : 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;
146 :
147 : // XSection
148 : virtual sal_Bool SAL_CALL getVisible() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
149 : virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
150 : virtual OUString SAL_CALL getName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
151 : virtual void SAL_CALL setName( const OUString& _name ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
152 : virtual ::sal_uInt32 SAL_CALL getHeight() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
153 : virtual void SAL_CALL setHeight( ::sal_uInt32 _height ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
154 : virtual ::sal_Int32 SAL_CALL getBackColor() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
155 : virtual void SAL_CALL setBackColor( ::sal_Int32 _backgroundcolor ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
156 : virtual sal_Bool SAL_CALL getBackTransparent() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
157 : virtual void SAL_CALL setBackTransparent( sal_Bool _backtransparent ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
158 : virtual OUString SAL_CALL getConditionalPrintExpression() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
159 : virtual void SAL_CALL setConditionalPrintExpression( const OUString& _conditionalprintexpression ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
160 : virtual ::sal_Int16 SAL_CALL getForceNewPage() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
161 : 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;
162 : virtual ::sal_Int16 SAL_CALL getNewRowOrCol() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
163 : 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;
164 : virtual sal_Bool SAL_CALL getKeepTogether() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
165 : 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;
166 : virtual sal_Bool SAL_CALL getCanGrow() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
167 : 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;
168 : virtual sal_Bool SAL_CALL getCanShrink() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
169 : 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;
170 : virtual sal_Bool SAL_CALL getRepeatSection() throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
171 : 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;
172 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup > SAL_CALL getGroup() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
173 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition > SAL_CALL getReportDefinition() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
174 :
175 : 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);
176 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAvailableReportComponentNames( ) throw (::com::sun::star::uno::RuntimeException);
177 : // XChild
178 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
179 : 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;
180 : // XContainer
181 : 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;
182 : 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;
183 : // XElementAccess
184 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
185 : virtual sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
186 : // XShapes
187 : 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;
188 : 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;
189 : // XShapeGrouper
190 : 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;
191 : 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;
192 :
193 : // XFormsSupplier
194 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getForms() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
195 : // XFormsSupplier2
196 : virtual sal_Bool SAL_CALL hasForms() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
197 :
198 : // XIndexAccess
199 : virtual ::sal_Int32 SAL_CALL getCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
200 : 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;
201 : // XEnumerationAccess
202 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
203 :
204 : // XComponent
205 : virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
206 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
207 : {
208 0 : cppu::WeakComponentImplHelperBase::addEventListener(aListener);
209 0 : }
210 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
211 : {
212 0 : cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
213 0 : }
214 :
215 : // com::sun::star::lang::XUnoTunnel
216 : 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;
217 : static OSection* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
218 : static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
219 :
220 : static void lcl_copySection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSource
221 : ,::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xDest);
222 :
223 : void notifyElementAdded(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape);
224 : void notifyElementRemoved(const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape);
225 : };
226 : }
227 : #endif //REPORTDESIGN_API_SECTION_HXX
228 :
229 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|