1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef REPORTDESIGN_API_GROUP_HXX 24 #define REPORTDESIGN_API_GROUP_HXX 25 26 #include <com/sun/star/report/XGroup.hpp> 27 #include <cppuhelper/compbase2.hxx> 28 #include <comphelper/broadcasthelper.hxx> 29 #include <comphelper/sequence.hxx> 30 #include <cppuhelper/propertysetmixin.hxx> 31 #include <com/sun/star/uno/XComponentContext.hpp> 32 #include "GroupProperties.hxx" 33 #include <comphelper/uno3.hxx> 34 #include <com/sun/star/lang/XServiceInfo.hpp> 35 36 namespace reportdesign 37 { 38 typedef ::cppu::WeakComponentImplHelper2< com::sun::star::report::XGroup 39 , ::com::sun::star::lang::XServiceInfo> GroupBase; 40 typedef ::cppu::PropertySetMixin< com::sun::star::report::XGroup> GroupPropertySet; 41 42 /** \class OGroup Defines the implementation of a \interface com:::sun::star::report::XGroup 43 * \ingroup reportdesign_api 44 * 45 */ 46 class OGroup : public comphelper::OMutexAndBroadcastHelper 47 ,public GroupBase 48 ,public GroupPropertySet 49 { 50 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; 51 ::com::sun::star::uno::WeakReference< ::com::sun::star::report::XGroups > m_xParent; 52 ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> m_xHeader; 53 ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> m_xFooter; 54 ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunctions > m_xFunctions; 55 ::rptshared::GroupProperties m_aProps; 56 57 private: 58 OGroup& operator=(const OGroup&); 59 OGroup(const OGroup&); 60 set(const::rtl::OUString & _sProperty,const T & _Value,T & _member)61 template <typename T> void set( const ::rtl::OUString& _sProperty 62 ,const T& _Value 63 ,T& _member) 64 { 65 BoundListeners l; 66 { 67 ::osl::MutexGuard aGuard(m_aMutex); 68 if ( _member != _Value ) 69 { 70 prepareSet(_sProperty, ::com::sun::star::uno::makeAny(_member), ::com::sun::star::uno::makeAny(_Value), &l); 71 _member = _Value; 72 } 73 } 74 l.notify(); 75 } 76 void setSection( const ::rtl::OUString& _sProperty 77 ,const sal_Bool& _bOn 78 ,const ::rtl::OUString& _sName 79 ,::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _member); 80 protected: 81 // TODO: VirtualFunctionFinder: This is virtual function! 82 // 83 virtual ~OGroup(); 84 85 /** this function is called upon disposing the component 86 */ 87 // TODO: VirtualFunctionFinder: This is virtual function! 88 // 89 virtual void SAL_CALL disposing(); 90 public: 91 OGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups >& _xParent 92 ,const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& context); 93 94 void copyGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xSource); 95 96 DECLARE_XINTERFACE( ) 97 // ::com::sun::star::lang::XServiceInfo 98 virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); 99 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 100 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); 101 102 static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException ); 103 104 // com::sun::star::beans::XPropertySet 105 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); 106 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); 107 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); 108 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); 109 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); 110 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); 111 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); 112 113 // XGroup 114 virtual ::sal_Bool SAL_CALL getSortAscending() throw (::com::sun::star::uno::RuntimeException); 115 virtual void SAL_CALL setSortAscending( ::sal_Bool _sortascending ) throw (::com::sun::star::uno::RuntimeException); 116 virtual ::sal_Bool SAL_CALL getHeaderOn() throw (::com::sun::star::uno::RuntimeException); 117 virtual void SAL_CALL setHeaderOn( ::sal_Bool _headeron ) throw (::com::sun::star::uno::RuntimeException); 118 virtual ::sal_Bool SAL_CALL getFooterOn() throw (::com::sun::star::uno::RuntimeException); 119 virtual void SAL_CALL setFooterOn( ::sal_Bool _footeron ) throw (::com::sun::star::uno::RuntimeException); 120 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); 121 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); 122 virtual ::sal_Int16 SAL_CALL getGroupOn() throw (::com::sun::star::uno::RuntimeException); 123 virtual void SAL_CALL setGroupOn( ::sal_Int16 _groupon ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 124 virtual ::sal_Int32 SAL_CALL getGroupInterval() throw (::com::sun::star::uno::RuntimeException); 125 virtual void SAL_CALL setGroupInterval( ::sal_Int32 _groupinterval ) throw (::com::sun::star::uno::RuntimeException); 126 virtual ::sal_Int16 SAL_CALL getKeepTogether() throw (::com::sun::star::uno::RuntimeException); 127 virtual void SAL_CALL setKeepTogether( ::sal_Int16 _keeptogether ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 128 virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups > SAL_CALL getGroups() throw (::com::sun::star::uno::RuntimeException); 129 virtual ::rtl::OUString SAL_CALL getExpression() throw (::com::sun::star::uno::RuntimeException); 130 virtual void SAL_CALL setExpression( const ::rtl::OUString& _expression ) throw (::com::sun::star::uno::RuntimeException); 131 virtual ::sal_Bool SAL_CALL getStartNewColumn() throw (::com::sun::star::uno::RuntimeException); 132 virtual void SAL_CALL setStartNewColumn( ::sal_Bool _startnewcolumn ) throw (::com::sun::star::uno::RuntimeException); 133 virtual ::sal_Bool SAL_CALL getResetPageNumber() throw (::com::sun::star::uno::RuntimeException); 134 virtual void SAL_CALL setResetPageNumber( ::sal_Bool _resetpagenumber ) throw (::com::sun::star::uno::RuntimeException); 135 136 //XFunctionsSupplier 137 virtual ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunctions > SAL_CALL getFunctions() throw (::com::sun::star::uno::RuntimeException); 138 139 // XChild 140 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException); 141 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); 142 143 // XComponent 144 virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); addEventListener(const::com::sun::star::uno::Reference<::com::sun::star::lang::XEventListener> & aListener)145 virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException) 146 { 147 cppu::WeakComponentImplHelperBase::addEventListener(aListener); 148 } removeEventListener(const::com::sun::star::uno::Reference<::com::sun::star::lang::XEventListener> & aListener)149 virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException) 150 { 151 cppu::WeakComponentImplHelperBase::removeEventListener(aListener); 152 } 153 getContext()154 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext(){ return m_xContext; } 155 }; 156 // ============================================================================= 157 } // namespace reportdesign 158 // ============================================================================= 159 #endif // 160