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 10*9ee13d13SAndrew Rist * 11*9ee13d13SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*9ee13d13SAndrew Rist * 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. 19*9ee13d13SAndrew Rist * 20*9ee13d13SAndrew Rist *************************************************************/ 21*9ee13d13SAndrew Rist 22*9ee13d13SAndrew Rist 23cdf0e10cSrcweir #ifndef RPTUI_PROPERTYSETFORWARD_HXX 24cdf0e10cSrcweir #define RPTUI_PROPERTYSETFORWARD_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "dllapi.h" 27cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp> 28cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 29cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySetInfo.hpp> 30cdf0e10cSrcweir #include <cppuhelper/compbase1.hxx> 31cdf0e10cSrcweir #include "cppuhelper/basemutex.hxx" 32cdf0e10cSrcweir #include "RptDef.hxx" 33cdf0e10cSrcweir 34cdf0e10cSrcweir 35cdf0e10cSrcweir //........................................................................ 36cdf0e10cSrcweir namespace rptui 37cdf0e10cSrcweir { 38cdf0e10cSrcweir //........................................................................ 39cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper1< ::com::sun::star::beans::XPropertyChangeListener 40cdf0e10cSrcweir > OPropertyForward_Base; 41cdf0e10cSrcweir 42cdf0e10cSrcweir /** \class OPropertyMediator 43cdf0e10cSrcweir * \brief This class ensures the communication between two XPropertySet instances. 44cdf0e10cSrcweir * Identical properties will be set at the other propertyset. 45cdf0e10cSrcweir * \ingroup reportdesign_source_ui_misc 46cdf0e10cSrcweir */ 47cdf0e10cSrcweir class REPORTDESIGN_DLLPUBLIC OPropertyMediator : public ::cppu::BaseMutex 48cdf0e10cSrcweir ,public OPropertyForward_Base 49cdf0e10cSrcweir { 50cdf0e10cSrcweir TPropertyNamePair m_aNameMap; 51cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xSource; 52cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> m_xSourceInfo; 53cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xDest; 54cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> m_xDestInfo; 55cdf0e10cSrcweir sal_Bool m_bInChange; 56cdf0e10cSrcweir OPropertyMediator(OPropertyMediator&); 57cdf0e10cSrcweir void operator =(OPropertyMediator&); 58cdf0e10cSrcweir protected: 59cdf0e10cSrcweir virtual ~OPropertyMediator(); 60cdf0e10cSrcweir 61cdf0e10cSrcweir /** this function is called upon disposing the component 62cdf0e10cSrcweir */ 63cdf0e10cSrcweir virtual void SAL_CALL disposing(); 64cdf0e10cSrcweir public: 65cdf0e10cSrcweir OPropertyMediator(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xSource 66cdf0e10cSrcweir ,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xDest 67cdf0e10cSrcweir ,const TPropertyNamePair& _aNameMap 68cdf0e10cSrcweir ,sal_Bool _bReverse = sal_False); 69cdf0e10cSrcweir 70cdf0e10cSrcweir // ::com::sun::star::beans::XPropertyChangeListener 71cdf0e10cSrcweir virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException); 72cdf0e10cSrcweir 73cdf0e10cSrcweir // ::com::sun::star::lang::XEventListener 74cdf0e10cSrcweir virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException); 75cdf0e10cSrcweir 76cdf0e10cSrcweir /** stop the listening mode. 77cdf0e10cSrcweir */ 78cdf0e10cSrcweir void stopListening(); 79cdf0e10cSrcweir 80cdf0e10cSrcweir /** starts the listening mode again. 81cdf0e10cSrcweir */ 82cdf0e10cSrcweir void startListening(); 83cdf0e10cSrcweir }; 84cdf0e10cSrcweir //........................................................................ 85cdf0e10cSrcweir } // namespace rptui 86cdf0e10cSrcweir //........................................................................ 87cdf0e10cSrcweir #endif // RPTUI_PROPERTYSETFORWARD_HXX 88cdf0e10cSrcweir 89