Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "fmtextcontrolfeature.hxx"
30 : :
31 : : //........................................................................
32 : : namespace svx
33 : : {
34 : : //........................................................................
35 : :
36 : : using namespace ::com::sun::star::uno;
37 : : using namespace ::com::sun::star::frame;
38 : : using namespace ::com::sun::star::lang;
39 : : using namespace ::com::sun::star::beans;
40 : : using namespace ::com::sun::star::util;
41 : :
42 : : //====================================================================
43 : : //= FmTextControlFeature
44 : : //====================================================================
45 : : //--------------------------------------------------------------------
46 : 0 : FmTextControlFeature::FmTextControlFeature( const Reference< XDispatch >& _rxDispatcher, const URL& _rFeatureURL, SfxSlotId _nSlotId, ISlotInvalidator* _pInvalidator )
47 : : :m_xDispatcher ( _rxDispatcher )
48 : : ,m_aFeatureURL ( _rFeatureURL )
49 : : ,m_nSlotId ( _nSlotId )
50 : : ,m_pInvalidator ( _pInvalidator )
51 : 0 : ,m_bFeatureEnabled( false )
52 : : {
53 : : OSL_ENSURE( _rxDispatcher.is(), "FmTextControlFeature::FmTextControlFeature: invalid dispatcher!" );
54 : : OSL_ENSURE( m_nSlotId, "FmTextControlFeature::FmTextControlFeature: invalid slot id!" );
55 : : OSL_ENSURE( m_pInvalidator, "FmTextControlFeature::FmTextControlFeature: invalid invalidator!" );
56 : :
57 [ # # ]: 0 : osl_incrementInterlockedCount( &m_refCount );
58 : : try
59 : : {
60 [ # # ][ # # ]: 0 : m_xDispatcher->addStatusListener( this, m_aFeatureURL );
[ # # ][ # # ]
61 : : }
62 [ # # ]: 0 : catch( const Exception& )
63 : : {
64 : : OSL_FAIL( "FmTextControlFeature::FmTextControlFeature: caught an exception!" );
65 : : }
66 [ # # ]: 0 : osl_decrementInterlockedCount( &m_refCount );
67 : 0 : }
68 : :
69 : : //--------------------------------------------------------------------
70 : 0 : FmTextControlFeature::~FmTextControlFeature( )
71 : : {
72 [ # # ]: 0 : }
73 : :
74 : : //--------------------------------------------------------------------
75 : 0 : void FmTextControlFeature::dispatch() const SAL_THROW(())
76 : : {
77 [ # # ]: 0 : dispatch( Sequence< PropertyValue >( ) );
78 : 0 : }
79 : :
80 : : //--------------------------------------------------------------------
81 : 0 : void FmTextControlFeature::dispatch( const Sequence< PropertyValue >& _rArgs ) const SAL_THROW(())
82 : : {
83 : : try
84 : : {
85 [ # # ]: 0 : if ( m_xDispatcher.is() )
86 [ # # ][ # # ]: 0 : m_xDispatcher->dispatch( m_aFeatureURL, _rArgs );
87 : : }
88 : 0 : catch( const Exception& )
89 : : {
90 : : OSL_FAIL( "FmTextControlFeature::dispatch: caught an exception!" );
91 : : }
92 [ # # ]: 0 : }
93 : :
94 : : //--------------------------------------------------------------------
95 : 0 : void SAL_CALL FmTextControlFeature::statusChanged( const FeatureStateEvent& _rState ) throw (RuntimeException)
96 : : {
97 : 0 : m_aFeatureState = _rState.State;
98 : 0 : m_bFeatureEnabled = _rState.IsEnabled;
99 : :
100 [ # # ]: 0 : if ( m_pInvalidator )
101 : 0 : m_pInvalidator->Invalidate( m_nSlotId );
102 : 0 : }
103 : :
104 : : //--------------------------------------------------------------------
105 : 0 : void SAL_CALL FmTextControlFeature::disposing( const EventObject& /*Source*/ ) throw (RuntimeException)
106 : : {
107 : : // nothing to do
108 : 0 : }
109 : :
110 : : //--------------------------------------------------------------------
111 : 0 : void FmTextControlFeature::dispose() SAL_THROW(())
112 : : {
113 : : try
114 : : {
115 [ # # ][ # # ]: 0 : m_xDispatcher->removeStatusListener( this, m_aFeatureURL );
[ # # ][ # # ]
116 : 0 : m_xDispatcher.clear();
117 : : }
118 : 0 : catch( const Exception& )
119 : : {
120 : : OSL_FAIL( "FmTextControlFeature::dispose: caught an exception!" );
121 : : }
122 : 0 : }
123 : :
124 : : //........................................................................
125 : : } // namespace svx
126 : : //........................................................................
127 : :
128 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|