xref: /trunk/main/reportdesign/source/core/inc/Group.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef REPORTDESIGN_API_GROUP_HXX
28 #define REPORTDESIGN_API_GROUP_HXX
29 
30 #include <com/sun/star/report/XGroup.hpp>
31 #include <cppuhelper/compbase2.hxx>
32 #include <comphelper/broadcasthelper.hxx>
33 #include <comphelper/sequence.hxx>
34 #include <cppuhelper/propertysetmixin.hxx>
35 #include <com/sun/star/uno/XComponentContext.hpp>
36 #include "GroupProperties.hxx"
37 #include <comphelper/uno3.hxx>
38 #include <com/sun/star/lang/XServiceInfo.hpp>
39 
40 namespace reportdesign
41 {
42     typedef ::cppu::WeakComponentImplHelper2< com::sun::star::report::XGroup
43                                          ,   ::com::sun::star::lang::XServiceInfo> GroupBase;
44     typedef ::cppu::PropertySetMixin< com::sun::star::report::XGroup> GroupPropertySet;
45 
46     /** \class OGroup Defines the implementation of a \interface com:::sun::star::report::XGroup
47      * \ingroup reportdesign_api
48      *
49      */
50     class OGroup :   public comphelper::OMutexAndBroadcastHelper
51                     ,public GroupBase
52                     ,public GroupPropertySet
53     {
54         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >    m_xContext;
55         ::com::sun::star::uno::WeakReference< ::com::sun::star::report::XGroups >       m_xParent;
56         ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>           m_xHeader;
57         ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>           m_xFooter;
58         ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunctions >        m_xFunctions;
59         ::rptshared::GroupProperties                                                    m_aProps;
60 
61     private:
62         OGroup& operator=(const OGroup&);
63         OGroup(const OGroup&);
64 
65         template <typename T> void set(  const ::rtl::OUString& _sProperty
66                                         ,const T& _Value
67                                         ,T& _member)
68         {
69             BoundListeners l;
70             {
71                 ::osl::MutexGuard aGuard(m_aMutex);
72                 if ( _member != _Value )
73                 {
74                     prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l);
75                     _member = _Value;
76                 }
77             }
78             l.notify();
79         }
80         void setSection(     const ::rtl::OUString& _sProperty
81                             ,const sal_Bool& _bOn
82                             ,const ::rtl::OUString& _sName
83                             ,::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _member);
84     protected:
85         // TODO: VirtualFunctionFinder: This is virtual function!
86         //
87         virtual ~OGroup();
88 
89         /** this function is called upon disposing the component
90         */
91         // TODO: VirtualFunctionFinder: This is virtual function!
92         //
93         virtual void SAL_CALL disposing();
94     public:
95         OGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups >& _xParent
96             ,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context);
97 
98         void copyGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xSource);
99 
100         DECLARE_XINTERFACE( )
101         // ::com::sun::star::lang::XServiceInfo
102         virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
103         virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
104         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
105 
106         static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
107 
108         // com::sun::star::beans::XPropertySet
109         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
110         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);
111         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);
112         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);
113         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);
114         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);
115         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);
116 
117         // XGroup
118         virtual ::sal_Bool SAL_CALL getSortAscending() throw (::com::sun::star::uno::RuntimeException);
119         virtual void SAL_CALL setSortAscending( ::sal_Bool _sortascending ) throw (::com::sun::star::uno::RuntimeException);
120         virtual ::sal_Bool SAL_CALL getHeaderOn() throw (::com::sun::star::uno::RuntimeException);
121         virtual void SAL_CALL setHeaderOn( ::sal_Bool _headeron ) throw (::com::sun::star::uno::RuntimeException);
122         virtual ::sal_Bool SAL_CALL getFooterOn() throw (::com::sun::star::uno::RuntimeException);
123         virtual void SAL_CALL setFooterOn( ::sal_Bool _footeron ) throw (::com::sun::star::uno::RuntimeException);
124         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);
125         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);
126         virtual ::sal_Int16 SAL_CALL getGroupOn() throw (::com::sun::star::uno::RuntimeException);
127         virtual void SAL_CALL setGroupOn( ::sal_Int16 _groupon ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
128         virtual ::sal_Int32 SAL_CALL getGroupInterval() throw (::com::sun::star::uno::RuntimeException);
129         virtual void SAL_CALL setGroupInterval( ::sal_Int32 _groupinterval ) throw (::com::sun::star::uno::RuntimeException);
130         virtual ::sal_Int16 SAL_CALL getKeepTogether() throw (::com::sun::star::uno::RuntimeException);
131         virtual void SAL_CALL setKeepTogether( ::sal_Int16 _keeptogether ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
132         virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups > SAL_CALL getGroups() throw (::com::sun::star::uno::RuntimeException);
133         virtual ::rtl::OUString SAL_CALL getExpression() throw (::com::sun::star::uno::RuntimeException);
134         virtual void SAL_CALL setExpression( const ::rtl::OUString& _expression ) throw (::com::sun::star::uno::RuntimeException);
135         virtual ::sal_Bool SAL_CALL getStartNewColumn() throw (::com::sun::star::uno::RuntimeException);
136         virtual void SAL_CALL setStartNewColumn( ::sal_Bool _startnewcolumn ) throw (::com::sun::star::uno::RuntimeException);
137         virtual ::sal_Bool SAL_CALL getResetPageNumber() throw (::com::sun::star::uno::RuntimeException);
138         virtual void SAL_CALL setResetPageNumber( ::sal_Bool _resetpagenumber ) throw (::com::sun::star::uno::RuntimeException);
139 
140         //XFunctionsSupplier
141         virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunctions > SAL_CALL getFunctions() throw (::com::sun::star::uno::RuntimeException);
142 
143         // XChild
144         virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent(  ) throw (::com::sun::star::uno::RuntimeException);
145         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);
146 
147         // XComponent
148         virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
149         virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException)
150         {
151             cppu::WeakComponentImplHelperBase::addEventListener(aListener);
152         }
153         virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException)
154         {
155             cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
156         }
157 
158         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext(){ return m_xContext; }
159     };
160 // =============================================================================
161 } // namespace reportdesign
162 // =============================================================================
163 #endif //
164