bump product version to 5.0.4.1
[LibreOffice.git] / extensions / source / propctrlr / propeventtranslation.cxx
blob804e8c39ad88bdf9cf1581a49ff93fd5ca17e0c3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "propeventtranslation.hxx"
22 #include <com/sun/star/lang/DisposedException.hpp>
23 #include <com/sun/star/lang/NullPointerException.hpp>
26 namespace pcr
30 using ::com::sun::star::beans::PropertyChangeEvent;
31 using ::com::sun::star::uno::RuntimeException;
32 using ::com::sun::star::lang::EventObject;
33 using ::com::sun::star::uno::Reference;
34 using ::com::sun::star::beans::XPropertyChangeListener;
35 using ::com::sun::star::uno::XInterface;
36 using ::com::sun::star::lang::DisposedException;
37 using ::com::sun::star::lang::NullPointerException;
40 //= PropertyEventTranslation
43 PropertyEventTranslation::PropertyEventTranslation( const Reference< XPropertyChangeListener >& _rxDelegator,
44 const Reference< XInterface >& _rxTranslatedEventSource )
45 :m_xDelegator( _rxDelegator )
46 ,m_xTranslatedEventSource( _rxTranslatedEventSource )
48 if ( !m_xDelegator.is() )
49 throw RuntimeException();
53 void SAL_CALL PropertyEventTranslation::propertyChange( const PropertyChangeEvent& evt ) throw (RuntimeException, std::exception)
55 if ( !m_xDelegator.is() )
56 throw DisposedException();
58 if ( !m_xTranslatedEventSource.is() )
59 m_xDelegator->propertyChange( evt );
60 else
62 PropertyChangeEvent aTranslatedEvent( evt );
63 aTranslatedEvent.Source = m_xTranslatedEventSource;
64 m_xDelegator->propertyChange( aTranslatedEvent );
69 void SAL_CALL PropertyEventTranslation::disposing( const EventObject& Source ) throw (RuntimeException, std::exception)
71 if ( !m_xDelegator.is() )
72 throw DisposedException();
74 if ( !m_xTranslatedEventSource.is() )
75 m_xDelegator->disposing( Source );
76 else
78 EventObject aTranslatedEvent( Source );
79 aTranslatedEvent.Source = m_xTranslatedEventSource;
80 m_xDelegator->disposing( aTranslatedEvent );
83 m_xDelegator.clear();
84 m_xTranslatedEventSource.clear();
88 } // namespace pcr
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */