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