Bump version to 6.4-15
[LibreOffice.git] / svx / source / form / fmtextcontrolfeature.cxx
blob9b7263408a7b363a0c8f7d896bf25acdcba62b70
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 <fmtextcontrolfeature.hxx>
21 #include <fmtextcontrolshell.hxx>
23 #include <osl/diagnose.h>
25 namespace svx
29 using namespace ::com::sun::star::uno;
30 using namespace ::com::sun::star::frame;
31 using namespace ::com::sun::star::lang;
32 using namespace ::com::sun::star::beans;
33 using namespace ::com::sun::star::util;
35 FmTextControlFeature::FmTextControlFeature( const Reference< XDispatch >& _rxDispatcher, const URL& _rFeatureURL, SfxSlotId _nSlotId, FmTextControlShell* _pInvalidator )
36 :m_xDispatcher ( _rxDispatcher )
37 ,m_aFeatureURL ( _rFeatureURL )
38 ,m_nSlotId ( _nSlotId )
39 ,m_pInvalidator ( _pInvalidator )
40 ,m_bFeatureEnabled( false )
42 OSL_ENSURE( _rxDispatcher.is(), "FmTextControlFeature::FmTextControlFeature: invalid dispatcher!" );
43 OSL_ENSURE( m_nSlotId, "FmTextControlFeature::FmTextControlFeature: invalid slot id!" );
44 OSL_ENSURE( m_pInvalidator, "FmTextControlFeature::FmTextControlFeature: invalid invalidator!" );
46 osl_atomic_increment( &m_refCount );
47 try
49 m_xDispatcher->addStatusListener( this, m_aFeatureURL );
51 catch( const Exception& )
53 OSL_FAIL( "FmTextControlFeature::FmTextControlFeature: caught an exception!" );
55 osl_atomic_decrement( &m_refCount );
59 FmTextControlFeature::~FmTextControlFeature( )
64 void FmTextControlFeature::dispatch() const
66 dispatch( Sequence< PropertyValue >( ) );
70 void FmTextControlFeature::dispatch( const Sequence< PropertyValue >& _rArgs ) const
72 try
74 if ( m_xDispatcher.is() )
75 m_xDispatcher->dispatch( m_aFeatureURL, _rArgs );
77 catch( const Exception& )
79 OSL_FAIL( "FmTextControlFeature::dispatch: caught an exception!" );
84 void SAL_CALL FmTextControlFeature::statusChanged( const FeatureStateEvent& _rState )
86 m_aFeatureState = _rState.State;
87 m_bFeatureEnabled = _rState.IsEnabled;
89 if ( m_pInvalidator )
90 m_pInvalidator->Invalidate( m_nSlotId );
94 void SAL_CALL FmTextControlFeature::disposing( const EventObject& /*Source*/ )
96 // nothing to do
100 void FmTextControlFeature::dispose()
104 m_xDispatcher->removeStatusListener( this, m_aFeatureURL );
105 m_xDispatcher.clear();
107 catch( const Exception& )
109 OSL_FAIL( "FmTextControlFeature::dispose: caught an exception!" );
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */