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