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_GROUP_HXX
20 : #define REPORTDESIGN_API_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 : void setSection( const OUString& _sProperty
73 : ,const sal_Bool& _bOn
74 : ,const OUString& _sName
75 : ,::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _member);
76 : protected:
77 : // TODO: VirtualFunctionFinder: This is virtual function!
78 :
79 : virtual ~OGroup();
80 :
81 : /** this function is called upon disposing the component
82 : */
83 : // TODO: VirtualFunctionFinder: This is virtual function!
84 :
85 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
86 : public:
87 : OGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups >& _xParent
88 : ,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context);
89 :
90 : void copyGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xSource);
91 :
92 : DECLARE_XINTERFACE( )
93 : // ::com::sun::star::lang::XServiceInfo
94 : virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
95 : virtual OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 :
98 : static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
99 :
100 : // com::sun::star::beans::XPropertySet
101 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 : 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;
103 : 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;
104 : 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;
105 : 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;
106 : 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;
107 : 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;
108 :
109 : // XGroup
110 : virtual sal_Bool SAL_CALL getSortAscending() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
111 : virtual void SAL_CALL setSortAscending( sal_Bool _sortascending ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 : virtual sal_Bool SAL_CALL getHeaderOn() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
113 : virtual void SAL_CALL setHeaderOn( sal_Bool _headeron ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
114 : virtual sal_Bool SAL_CALL getFooterOn() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
115 : virtual void SAL_CALL setFooterOn( sal_Bool _footeron ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 : 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;
117 : 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;
118 : virtual ::sal_Int16 SAL_CALL getGroupOn() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
119 : virtual void SAL_CALL setGroupOn( ::sal_Int16 _groupon ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 : virtual ::sal_Int32 SAL_CALL getGroupInterval() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121 : virtual void SAL_CALL setGroupInterval( ::sal_Int32 _groupinterval ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 : virtual ::sal_Int16 SAL_CALL getKeepTogether() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
123 : virtual void SAL_CALL setKeepTogether( ::sal_Int16 _keeptogether ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups > SAL_CALL getGroups() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
125 : virtual OUString SAL_CALL getExpression() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 : virtual void SAL_CALL setExpression( const OUString& _expression ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
127 : virtual sal_Bool SAL_CALL getStartNewColumn() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
128 : virtual void SAL_CALL setStartNewColumn( sal_Bool _startnewcolumn ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
129 : virtual sal_Bool SAL_CALL getResetPageNumber() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
130 : virtual void SAL_CALL setResetPageNumber( sal_Bool _resetpagenumber ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
131 :
132 : //XFunctionsSupplier
133 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunctions > SAL_CALL getFunctions() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 :
135 : // XChild
136 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
137 : 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;
138 :
139 : // XComponent
140 : virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
141 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
142 : {
143 0 : cppu::WeakComponentImplHelperBase::addEventListener(aListener);
144 0 : }
145 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
146 : {
147 0 : cppu::WeakComponentImplHelperBase::removeEventListener(aListener);
148 0 : }
149 :
150 0 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext(){ return m_xContext; }
151 : };
152 :
153 : } // namespace reportdesign
154 :
155 : #endif
156 :
157 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|