bump product version to 7.2.5.1
[LibreOffice.git] / svx / source / form / fmtextcontrolfeature.cxx
blob68bb8606a453f473552056e6db4ec4e39443ac6d
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>
24 #include <tools/diagnose_ex.h>
26 namespace svx
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::frame;
32 using namespace ::com::sun::star::lang;
33 using namespace ::com::sun::star::beans;
34 using namespace ::com::sun::star::util;
36 FmTextControlFeature::FmTextControlFeature( const Reference< XDispatch >& _rxDispatcher, const URL& _rFeatureURL, SfxSlotId _nSlotId, FmTextControlShell* _pInvalidator )
37 :m_xDispatcher ( _rxDispatcher )
38 ,m_aFeatureURL ( _rFeatureURL )
39 ,m_nSlotId ( _nSlotId )
40 ,m_pInvalidator ( _pInvalidator )
41 ,m_bFeatureEnabled( false )
43 OSL_ENSURE( _rxDispatcher.is(), "FmTextControlFeature::FmTextControlFeature: invalid dispatcher!" );
44 OSL_ENSURE( m_nSlotId, "FmTextControlFeature::FmTextControlFeature: invalid slot id!" );
45 OSL_ENSURE( m_pInvalidator, "FmTextControlFeature::FmTextControlFeature: invalid invalidator!" );
47 osl_atomic_increment( &m_refCount );
48 try
50 m_xDispatcher->addStatusListener( this, m_aFeatureURL );
52 catch( const Exception& )
54 TOOLS_WARN_EXCEPTION( "svx", "FmTextControlFeature::FmTextControlFeature" );
56 osl_atomic_decrement( &m_refCount );
60 FmTextControlFeature::~FmTextControlFeature( )
65 void FmTextControlFeature::dispatch() const
67 dispatch( Sequence< PropertyValue >( ) );
71 void FmTextControlFeature::dispatch( const Sequence< PropertyValue >& _rArgs ) const
73 try
75 if ( m_xDispatcher.is() )
76 m_xDispatcher->dispatch( m_aFeatureURL, _rArgs );
78 catch( const Exception& )
80 TOOLS_WARN_EXCEPTION( "svx", "FmTextControlFeature::dispatch" );
85 void SAL_CALL FmTextControlFeature::statusChanged( const FeatureStateEvent& _rState )
87 m_aFeatureState = _rState.State;
88 m_bFeatureEnabled = _rState.IsEnabled;
90 if ( m_pInvalidator )
91 m_pInvalidator->Invalidate( m_nSlotId );
95 void SAL_CALL FmTextControlFeature::disposing( const EventObject& /*Source*/ )
97 // nothing to do
101 void FmTextControlFeature::dispose()
105 m_xDispatcher->removeStatusListener( this, m_aFeatureURL );
106 m_xDispatcher.clear();
108 catch( const Exception& )
110 TOOLS_WARN_EXCEPTION( "svx", "FmTextControlFeature::dispose" );
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */