merged tag LIBREOFFICE_3_2_99_3
[LibreOffice.git] / extensions / source / propctrlr / propeventtranslation.cxx
blob6ab21e547289340ba817157e3b496a9f30463e76
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 // MARKER(update_precomp.py): autogen include statement, do not remove
30 #include "precompiled_extensions.hxx"
31 #include "propeventtranslation.hxx"
33 /** === begin UNO includes === **/
34 #include <com/sun/star/lang/DisposedException.hpp>
35 #include <com/sun/star/lang/NullPointerException.hpp>
36 /** === end UNO includes === **/
38 //........................................................................
39 namespace pcr
41 //........................................................................
43 /** === begin UNO using === **/
44 using ::com::sun::star::beans::PropertyChangeEvent;
45 using ::com::sun::star::uno::RuntimeException;
46 using ::com::sun::star::lang::EventObject;
47 using ::com::sun::star::uno::Reference;
48 using ::com::sun::star::beans::XPropertyChangeListener;
49 using ::com::sun::star::uno::XInterface;
50 using ::com::sun::star::beans::PropertyChangeEvent;
51 using ::com::sun::star::lang::DisposedException;
52 using ::com::sun::star::lang::NullPointerException;
53 /** === end UNO using === **/
55 //====================================================================
56 //= PropertyEventTranslation
57 //====================================================================
58 //--------------------------------------------------------------------
59 PropertyEventTranslation::PropertyEventTranslation( const Reference< XPropertyChangeListener >& _rxDelegator,
60 const Reference< XInterface >& _rxTranslatedEventSource )
61 :m_xDelegator( _rxDelegator )
62 ,m_xTranslatedEventSource( _rxTranslatedEventSource )
64 if ( !m_xDelegator.is() )
65 throw NullPointerException();
68 //--------------------------------------------------------------------
69 void SAL_CALL PropertyEventTranslation::propertyChange( const PropertyChangeEvent& evt ) throw (RuntimeException)
71 if ( !m_xDelegator.is() )
72 throw DisposedException();
74 if ( !m_xTranslatedEventSource.is() )
75 m_xDelegator->propertyChange( evt );
76 else
78 PropertyChangeEvent aTranslatedEvent( evt );
79 aTranslatedEvent.Source = m_xTranslatedEventSource;
80 m_xDelegator->propertyChange( aTranslatedEvent );
84 //--------------------------------------------------------------------
85 void SAL_CALL PropertyEventTranslation::disposing( const EventObject& Source ) throw (RuntimeException)
87 if ( !m_xDelegator.is() )
88 throw DisposedException();
90 if ( !m_xTranslatedEventSource.is() )
91 m_xDelegator->disposing( Source );
92 else
94 EventObject aTranslatedEvent( Source );
95 aTranslatedEvent.Source = m_xTranslatedEventSource;
96 m_xDelegator->disposing( aTranslatedEvent );
99 m_xDelegator.clear();
100 m_xTranslatedEventSource.clear();
103 //........................................................................
104 } // namespace pcr
105 //........................................................................
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */