xref: /trunk/main/reportdesign/source/core/inc/Group.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
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_GROUP_HXX
24cdf0e10cSrcweir #define REPORTDESIGN_API_GROUP_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <com/sun/star/report/XGroup.hpp>
27cdf0e10cSrcweir #include <cppuhelper/compbase2.hxx>
28cdf0e10cSrcweir #include <comphelper/broadcasthelper.hxx>
29cdf0e10cSrcweir #include <comphelper/sequence.hxx>
30cdf0e10cSrcweir #include <cppuhelper/propertysetmixin.hxx>
31cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
32cdf0e10cSrcweir #include "GroupProperties.hxx"
33cdf0e10cSrcweir #include <comphelper/uno3.hxx>
34cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir namespace reportdesign
37cdf0e10cSrcweir {
38cdf0e10cSrcweir     typedef ::cppu::WeakComponentImplHelper2< com::sun::star::report::XGroup
39cdf0e10cSrcweir                                          ,   ::com::sun::star::lang::XServiceInfo> GroupBase;
40cdf0e10cSrcweir     typedef ::cppu::PropertySetMixin< com::sun::star::report::XGroup> GroupPropertySet;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir     /** \class OGroup Defines the implementation of a \interface com:::sun::star::report::XGroup
43cdf0e10cSrcweir      * \ingroup reportdesign_api
44cdf0e10cSrcweir      *
45cdf0e10cSrcweir      */
46cdf0e10cSrcweir     class OGroup :   public comphelper::OMutexAndBroadcastHelper
47cdf0e10cSrcweir                     ,public GroupBase
48cdf0e10cSrcweir                     ,public GroupPropertySet
49cdf0e10cSrcweir     {
50cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >    m_xContext;
51cdf0e10cSrcweir         ::com::sun::star::uno::WeakReference< ::com::sun::star::report::XGroups >       m_xParent;
52cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>           m_xHeader;
53cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>           m_xFooter;
54cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunctions >        m_xFunctions;
55cdf0e10cSrcweir         ::rptshared::GroupProperties                                                    m_aProps;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir     private:
58cdf0e10cSrcweir         OGroup& operator=(const OGroup&);
59cdf0e10cSrcweir         OGroup(const OGroup&);
60cdf0e10cSrcweir 
set(const::rtl::OUString & _sProperty,const T & _Value,T & _member)61cdf0e10cSrcweir         template <typename T> void set(  const ::rtl::OUString& _sProperty
62cdf0e10cSrcweir                                         ,const T& _Value
63cdf0e10cSrcweir                                         ,T& _member)
64cdf0e10cSrcweir         {
65cdf0e10cSrcweir             BoundListeners l;
66cdf0e10cSrcweir             {
67cdf0e10cSrcweir                 ::osl::MutexGuard aGuard(m_aMutex);
68cdf0e10cSrcweir                 if ( _member != _Value )
69cdf0e10cSrcweir                 {
70cdf0e10cSrcweir                     prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l);
71cdf0e10cSrcweir                     _member = _Value;
72cdf0e10cSrcweir                 }
73cdf0e10cSrcweir             }
74cdf0e10cSrcweir             l.notify();
75cdf0e10cSrcweir         }
76cdf0e10cSrcweir         void setSection(     const ::rtl::OUString& _sProperty
77cdf0e10cSrcweir                             ,const sal_Bool& _bOn
78cdf0e10cSrcweir                             ,const ::rtl::OUString& _sName
79cdf0e10cSrcweir                             ,::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _member);
80cdf0e10cSrcweir     protected:
81cdf0e10cSrcweir         // TODO: VirtualFunctionFinder: This is virtual function!
82cdf0e10cSrcweir         //
83cdf0e10cSrcweir         virtual ~OGroup();
84cdf0e10cSrcweir 
85cdf0e10cSrcweir         /** this function is called upon disposing the component
86cdf0e10cSrcweir         */
87cdf0e10cSrcweir         // TODO: VirtualFunctionFinder: This is virtual function!
88cdf0e10cSrcweir         //
89cdf0e10cSrcweir         virtual void SAL_CALL disposing();
90cdf0e10cSrcweir     public:
91cdf0e10cSrcweir         OGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups >& _xParent
92cdf0e10cSrcweir             ,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context);
93cdf0e10cSrcweir 
94cdf0e10cSrcweir         void copyGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xSource);
95cdf0e10cSrcweir 
96cdf0e10cSrcweir         DECLARE_XINTERFACE( )
97cdf0e10cSrcweir         // ::com::sun::star::lang::XServiceInfo
98cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
99cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
100cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
101cdf0e10cSrcweir 
102cdf0e10cSrcweir         static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
103cdf0e10cSrcweir 
104cdf0e10cSrcweir         // com::sun::star::beans::XPropertySet
105cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
106cdf0e10cSrcweir         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);
107cdf0e10cSrcweir         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);
108cdf0e10cSrcweir         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);
109cdf0e10cSrcweir         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);
110cdf0e10cSrcweir         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);
111cdf0e10cSrcweir         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);
112cdf0e10cSrcweir 
113cdf0e10cSrcweir         // XGroup
114cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL getSortAscending() throw (::com::sun::star::uno::RuntimeException);
115cdf0e10cSrcweir         virtual void SAL_CALL setSortAscending( ::sal_Bool _sortascending ) throw (::com::sun::star::uno::RuntimeException);
116cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL getHeaderOn() throw (::com::sun::star::uno::RuntimeException);
117cdf0e10cSrcweir         virtual void SAL_CALL setHeaderOn( ::sal_Bool _headeron ) throw (::com::sun::star::uno::RuntimeException);
118cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL getFooterOn() throw (::com::sun::star::uno::RuntimeException);
119cdf0e10cSrcweir         virtual void SAL_CALL setFooterOn( ::sal_Bool _footeron ) throw (::com::sun::star::uno::RuntimeException);
120cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > SAL_CALL getHeader() throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
121cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > SAL_CALL getFooter() throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
122cdf0e10cSrcweir         virtual ::sal_Int16 SAL_CALL getGroupOn() throw (::com::sun::star::uno::RuntimeException);
123cdf0e10cSrcweir         virtual void SAL_CALL setGroupOn( ::sal_Int16 _groupon ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
124cdf0e10cSrcweir         virtual ::sal_Int32 SAL_CALL getGroupInterval() throw (::com::sun::star::uno::RuntimeException);
125cdf0e10cSrcweir         virtual void SAL_CALL setGroupInterval( ::sal_Int32 _groupinterval ) throw (::com::sun::star::uno::RuntimeException);
126cdf0e10cSrcweir         virtual ::sal_Int16 SAL_CALL getKeepTogether() throw (::com::sun::star::uno::RuntimeException);
127cdf0e10cSrcweir         virtual void SAL_CALL setKeepTogether( ::sal_Int16 _keeptogether ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
128cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups > SAL_CALL getGroups() throw (::com::sun::star::uno::RuntimeException);
129cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getExpression() throw (::com::sun::star::uno::RuntimeException);
130cdf0e10cSrcweir         virtual void SAL_CALL setExpression( const ::rtl::OUString& _expression ) throw (::com::sun::star::uno::RuntimeException);
131cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL getStartNewColumn() throw (::com::sun::star::uno::RuntimeException);
132cdf0e10cSrcweir         virtual void SAL_CALL setStartNewColumn( ::sal_Bool _startnewcolumn ) throw (::com::sun::star::uno::RuntimeException);
133cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL getResetPageNumber() throw (::com::sun::star::uno::RuntimeException);
134cdf0e10cSrcweir         virtual void SAL_CALL setResetPageNumber( ::sal_Bool _resetpagenumber ) throw (::com::sun::star::uno::RuntimeException);
135cdf0e10cSrcweir 
136cdf0e10cSrcweir         //XFunctionsSupplier
137cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunctions > SAL_CALL getFunctions() throw (::com::sun::star::uno::RuntimeException);
138cdf0e10cSrcweir 
139cdf0e10cSrcweir         // XChild
140cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent(  ) throw (::com::sun::star::uno::RuntimeException);
141cdf0e10cSrcweir         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);
142cdf0e10cSrcweir 
143cdf0e10cSrcweir         // XComponent
144cdf0e10cSrcweir         virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
addEventListener(const::com::sun::star::uno::Reference<::com::sun::star::lang::XEventListener> & aListener)145cdf0e10cSrcweir         virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException)
146cdf0e10cSrcweir         {
147cdf0e10cSrcweir             cppu::WeakComponentImplHelperBase::addEventListener(aListener);
148cdf0e10cSrcweir         }
removeEventListener(const::com::sun::star::uno::Reference<::com::sun::star::lang::XEventListener> & aListener)149cdf0e10cSrcweir         virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException)
150cdf0e10cSrcweir         {
151cdf0e10cSrcweir             cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
152cdf0e10cSrcweir         }
153cdf0e10cSrcweir 
getContext()154cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext(){ return m_xContext; }
155cdf0e10cSrcweir     };
156cdf0e10cSrcweir // =============================================================================
157cdf0e10cSrcweir } // namespace reportdesign
158cdf0e10cSrcweir // =============================================================================
159cdf0e10cSrcweir #endif //
160