LibreOffice Module extensions (master) 1
propeventtranslation.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
21
22#include <com/sun/star/lang/DisposedException.hpp>
23
24
25namespace pcr
26{
27
28
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;
36
37
38 //= PropertyEventTranslation
39
40
41 PropertyEventTranslation::PropertyEventTranslation( const Reference< XPropertyChangeListener >& _rxDelegator,
42 const Reference< XInterface >& _rxTranslatedEventSource )
43 :m_xDelegator( _rxDelegator )
44 ,m_xTranslatedEventSource( _rxTranslatedEventSource )
45 {
46 if ( !m_xDelegator.is() )
47 throw RuntimeException();
48 }
49
50
51 void SAL_CALL PropertyEventTranslation::propertyChange( const PropertyChangeEvent& evt )
52 {
53 if ( !m_xDelegator.is() )
54 throw DisposedException();
55
56 if ( !m_xTranslatedEventSource.is() )
57 m_xDelegator->propertyChange( evt );
58 else
59 {
60 PropertyChangeEvent aTranslatedEvent( evt );
61 aTranslatedEvent.Source = m_xTranslatedEventSource;
62 m_xDelegator->propertyChange( aTranslatedEvent );
63 }
64 }
65
66
67 void SAL_CALL PropertyEventTranslation::disposing( const EventObject& Source )
68 {
69 if ( !m_xDelegator.is() )
70 throw DisposedException();
71
72 if ( !m_xTranslatedEventSource.is() )
73 m_xDelegator->disposing( Source );
74 else
75 {
76 EventObject aTranslatedEvent( Source );
77 aTranslatedEvent.Source = m_xTranslatedEventSource;
78 m_xDelegator->disposing( aTranslatedEvent );
79 }
80
81 m_xDelegator.clear();
82 m_xTranslatedEventSource.clear();
83 }
84
85
86} // namespace pcr
87
88
89/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PropertyEventTranslation(const css::uno::Reference< css::beans::XPropertyChangeListener > &_rxDelegator, const css::uno::Reference< css::uno::XInterface > &_rxTranslatedEventSource)
constructs the object
const Reference< form::runtime::XFormController > m_xDelegator
a property handler for any virtual string properties
Definition: browserline.cxx:39