tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / extensions / source / propctrlr / propeventtranslation.cxx
blob736c1e06fca258216c697b275a984f0dd77e2eef
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>
25 namespace pcr
29 using ::com::sun::star::beans::PropertyChangeEvent;
30 using ::com::sun::star::uno::RuntimeException;
31 using ::com::sun::star::lang::EventObject;
32 using ::com::sun::star::uno::Reference;
33 using ::com::sun::star::beans::XPropertyChangeListener;
34 using ::com::sun::star::uno::XInterface;
35 using ::com::sun::star::lang::DisposedException;
38 //= PropertyEventTranslation
41 PropertyEventTranslation::PropertyEventTranslation( const Reference< XPropertyChangeListener >& _rxDelegator,
42 const Reference< XInterface >& _rxTranslatedEventSource )
43 :m_xDelegator( _rxDelegator )
44 ,m_xTranslatedEventSource( _rxTranslatedEventSource )
46 if ( !m_xDelegator.is() )
47 throw RuntimeException();
51 void SAL_CALL PropertyEventTranslation::propertyChange( const PropertyChangeEvent& evt )
53 if ( !m_xDelegator.is() )
54 throw DisposedException();
56 if ( !m_xTranslatedEventSource.is() )
57 m_xDelegator->propertyChange( evt );
58 else
60 PropertyChangeEvent aTranslatedEvent( evt );
61 aTranslatedEvent.Source = m_xTranslatedEventSource;
62 m_xDelegator->propertyChange( aTranslatedEvent );
67 void SAL_CALL PropertyEventTranslation::disposing( const EventObject& Source )
69 if ( !m_xDelegator.is() )
70 throw DisposedException();
72 if ( !m_xTranslatedEventSource.is() )
73 m_xDelegator->disposing( Source );
74 else
76 EventObject aTranslatedEvent( Source );
77 aTranslatedEvent.Source = m_xTranslatedEventSource;
78 m_xDelegator->disposing( aTranslatedEvent );
81 m_xDelegator.clear();
82 m_xTranslatedEventSource.clear();
86 } // namespace pcr
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */