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 #include "propeventtranslation.hxx"
31 /** === begin UNO includes === **/
32 #include <com/sun/star/lang/DisposedException.hpp>
33 #include <com/sun/star/lang/NullPointerException.hpp>
34 /** === end UNO includes === **/
36 //........................................................................
39 //........................................................................
41 /** === begin UNO using === **/
42 using ::com::sun::star::beans::PropertyChangeEvent
;
43 using ::com::sun::star::uno::RuntimeException
;
44 using ::com::sun::star::lang::EventObject
;
45 using ::com::sun::star::uno::Reference
;
46 using ::com::sun::star::beans::XPropertyChangeListener
;
47 using ::com::sun::star::uno::XInterface
;
48 using ::com::sun::star::beans::PropertyChangeEvent
;
49 using ::com::sun::star::lang::DisposedException
;
50 using ::com::sun::star::lang::NullPointerException
;
51 /** === end UNO using === **/
53 //====================================================================
54 //= PropertyEventTranslation
55 //====================================================================
56 //--------------------------------------------------------------------
57 PropertyEventTranslation::PropertyEventTranslation( const Reference
< XPropertyChangeListener
>& _rxDelegator
,
58 const Reference
< XInterface
>& _rxTranslatedEventSource
)
59 :m_xDelegator( _rxDelegator
)
60 ,m_xTranslatedEventSource( _rxTranslatedEventSource
)
62 if ( !m_xDelegator
.is() )
63 throw NullPointerException();
66 //--------------------------------------------------------------------
67 void SAL_CALL
PropertyEventTranslation::propertyChange( const PropertyChangeEvent
& evt
) throw (RuntimeException
)
69 if ( !m_xDelegator
.is() )
70 throw DisposedException();
72 if ( !m_xTranslatedEventSource
.is() )
73 m_xDelegator
->propertyChange( evt
);
76 PropertyChangeEvent
aTranslatedEvent( evt
);
77 aTranslatedEvent
.Source
= m_xTranslatedEventSource
;
78 m_xDelegator
->propertyChange( aTranslatedEvent
);
82 //--------------------------------------------------------------------
83 void SAL_CALL
PropertyEventTranslation::disposing( const EventObject
& Source
) throw (RuntimeException
)
85 if ( !m_xDelegator
.is() )
86 throw DisposedException();
88 if ( !m_xTranslatedEventSource
.is() )
89 m_xDelegator
->disposing( Source
);
92 EventObject
aTranslatedEvent( Source
);
93 aTranslatedEvent
.Source
= m_xTranslatedEventSource
;
94 m_xDelegator
->disposing( aTranslatedEvent
);
98 m_xTranslatedEventSource
.clear();
101 //........................................................................
103 //........................................................................
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */