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 : :
30 : : #include "navbarcontrol.hxx"
31 : : #include "frm_strings.hxx"
32 : : #include "frm_module.hxx"
33 : : #include "FormComponent.hxx"
34 : : #include "componenttools.hxx"
35 : : #include "navtoolbar.hxx"
36 : : #include "commandimageprovider.hxx"
37 : : #include "commanddescriptionprovider.hxx"
38 : :
39 : : #include <com/sun/star/awt/XView.hpp>
40 : : #include <com/sun/star/awt/PosSize.hpp>
41 : : #include <com/sun/star/form/runtime/FormFeature.hpp>
42 : : #include <com/sun/star/awt/XControlModel.hpp>
43 : : #include <com/sun/star/graphic/XGraphic.hpp>
44 : :
45 : : #include <tools/debug.hxx>
46 : : #include <tools/diagnose_ex.h>
47 : : #include <vcl/svapp.hxx>
48 : :
49 : : //--------------------------------------------------------------------------
50 : 30 : extern "C" void SAL_CALL createRegistryInfo_ONavigationBarControl()
51 : : {
52 [ + - ][ + - ]: 30 : static ::frm::OMultiInstanceAutoRegistration< ::frm::ONavigationBarControl > aAutoRegistration;
[ + - ][ # # ]
53 : 30 : }
54 : :
55 : : //.........................................................................
56 : : namespace frm
57 : : {
58 : : //.........................................................................
59 : :
60 : : using namespace ::com::sun::star::uno;
61 : : using namespace ::com::sun::star::beans;
62 : : using namespace ::com::sun::star::awt;
63 : : using namespace ::com::sun::star::lang;
64 : : using namespace ::com::sun::star::frame;
65 : : using namespace ::com::sun::star::graphic;
66 : : namespace FormFeature = ::com::sun::star::form::runtime::FormFeature;
67 : :
68 : : #define FORWARD_TO_PEER_1( unoInterface, method, param1 ) \
69 : : Reference< unoInterface > xTypedPeer( getPeer(), UNO_QUERY ); \
70 : : if ( xTypedPeer.is() ) \
71 : : { \
72 : : xTypedPeer->method( param1 ); \
73 : : }
74 : :
75 : : #define FORWARD_TO_PEER_1_RET( returnType, unoInterface, method, param1 ) \
76 : : returnType aReturn; \
77 : : Reference< unoInterface > xTypedPeer( getPeer(), UNO_QUERY ); \
78 : : if ( xTypedPeer.is() ) \
79 : : { \
80 : : aReturn = xTypedPeer->method( param1 ); \
81 : : } \
82 : : return aReturn;
83 : :
84 : : #define FORWARD_TO_PEER_3( unoInterface, method, param1, param2, param3 ) \
85 : : Reference< unoInterface > xTypedPeer( getPeer(), UNO_QUERY ); \
86 : : if ( xTypedPeer.is() ) \
87 : : { \
88 : : xTypedPeer->method( param1, param2, param3 ); \
89 : : }
90 : :
91 : : #define FORWARD_TO_PEER_3_RET( returnType, unoInterface, method, param1, param2, param3 ) \
92 : : returnType aReturn; \
93 : : Reference< unoInterface > xTypedPeer( getPeer(), UNO_QUERY ); \
94 : : if ( xTypedPeer.is() ) \
95 : : { \
96 : : aReturn = xTypedPeer->method( param1, param2, param3 ); \
97 : : } \
98 : : return aReturn;
99 : :
100 : : //==================================================================
101 : : // ONavigationBarControl
102 : : //==================================================================
103 : : DBG_NAME( ONavigationBarControl )
104 : : //------------------------------------------------------------------
105 : 18 : ONavigationBarControl::ONavigationBarControl( const Reference< XMultiServiceFactory >& _rxORB )
106 : 18 : :UnoControl( _rxORB )
107 : : {
108 : : DBG_CTOR( ONavigationBarControl, NULL );
109 : 18 : }
110 : :
111 : : //------------------------------------------------------------------
112 : 18 : ONavigationBarControl::~ONavigationBarControl()
113 : : {
114 : : DBG_DTOR( ONavigationBarControl, NULL );
115 [ - + ]: 36 : }
116 : :
117 : : //------------------------------------------------------------------
118 [ # # ][ # # ]: 0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( ONavigationBarControl, UnoControl, ONavigationBarControl_Base )
[ # # ]
119 : :
120 : : //------------------------------------------------------------------
121 : 1332 : Any SAL_CALL ONavigationBarControl::queryAggregation( const Type& _rType ) throw ( RuntimeException )
122 : : {
123 : 1332 : Any aReturn = UnoControl::queryAggregation( _rType );
124 : :
125 [ + + ]: 1332 : if ( !aReturn.hasValue() )
126 [ + - ]: 18 : aReturn = ONavigationBarControl_Base::queryInterface( _rType );
127 : :
128 : 1332 : return aReturn;
129 : : }
130 : :
131 : : //------------------------------------------------------------------
132 : : namespace
133 : : {
134 : : //..............................................................
135 : 36 : static WinBits lcl_getWinBits_nothrow( const Reference< XControlModel >& _rxModel )
136 : : {
137 : 36 : WinBits nBits = 0;
138 : : try
139 : : {
140 [ + - ]: 36 : Reference< XPropertySet > xProps( _rxModel, UNO_QUERY );
141 [ + - ]: 36 : if ( xProps.is() )
142 : : {
143 : 36 : sal_Int16 nBorder = 0;
144 [ + - ][ + - ]: 36 : xProps->getPropertyValue( PROPERTY_BORDER ) >>= nBorder;
[ + - ]
145 [ + + ]: 36 : if ( nBorder )
146 : 18 : nBits |= WB_BORDER;
147 : :
148 : 36 : sal_Bool bTabStop = sal_False;
149 [ + - ][ + - ]: 36 : if ( xProps->getPropertyValue( PROPERTY_TABSTOP ) >>= bTabStop )
[ + - ][ - + ]
150 [ # # ]: 36 : nBits |= ( bTabStop ? WB_TABSTOP : WB_NOTABSTOP );
151 [ # # ]: 36 : }
152 : : }
153 : 0 : catch( const Exception& )
154 : : {
155 : : DBG_UNHANDLED_EXCEPTION();
156 : : }
157 : 36 : return nBits;
158 : : }
159 : : }
160 : :
161 : : //------------------------------------------------------------------
162 : 38 : void SAL_CALL ONavigationBarControl::createPeer( const Reference< XToolkit >& /*_rToolkit*/, const Reference< XWindowPeer >& _rParentPeer ) throw( RuntimeException )
163 : : {
164 [ + - ]: 38 : SolarMutexGuard aGuard;
165 : :
166 [ + - ][ + + ]: 38 : if (!getPeer().is())
167 : : {
168 : 36 : mbCreatingPeer = sal_True;
169 : :
170 : : // determine the VLC window for the parent
171 : 36 : Window* pParentWin = NULL;
172 [ + - ]: 36 : if ( _rParentPeer.is() )
173 : : {
174 : 36 : VCLXWindow* pParentXWin = VCLXWindow::GetImplementation( _rParentPeer );
175 [ + - ]: 36 : if ( pParentXWin )
176 : 36 : pParentWin = pParentXWin->GetWindow();
177 : : DBG_ASSERT( pParentWin, "ONavigationBarControl::createPeer: could not obtain the VCL-level parent window!" );
178 : : }
179 : :
180 : : // create the peer
181 [ + - ][ + - ]: 36 : ONavigationBarPeer* pPeer = ONavigationBarPeer::Create( maContext.getLegacyServiceFactory(), pParentWin, getModel() );
[ + - ]
182 : : DBG_ASSERT( pPeer, "ONavigationBarControl::createPeer: invalid peer returned!" );
183 [ + - ]: 36 : if ( pPeer )
184 : : // by definition, the returned component is aquired once
185 : 36 : pPeer->release();
186 : :
187 : : // announce the peer to the base class
188 [ + - ][ + - ]: 36 : setPeer( pPeer );
[ + - ]
189 : :
190 : : // initialize ourself (and thus the peer) with the model properties
191 [ + - ]: 36 : updateFromModel();
192 : :
193 [ + - ][ + - ]: 36 : Reference< XView > xPeerView( getPeer(), UNO_QUERY );
194 [ + - ]: 36 : if ( xPeerView.is() )
195 : : {
196 [ + - ][ + - ]: 36 : xPeerView->setZoom( maComponentInfos.nZoomX, maComponentInfos.nZoomY );
197 [ + - ][ + - ]: 36 : xPeerView->setGraphics( mxGraphics );
198 : : }
199 : :
200 : : // a lot of initial settings from our component infos
201 [ + - ]: 36 : setPosSize( maComponentInfos.nX, maComponentInfos.nY, maComponentInfos.nWidth, maComponentInfos.nHeight, PosSize::POSSIZE );
202 : :
203 [ + - ][ - + ]: 36 : pPeer->setVisible ( maComponentInfos.bVisible && !mbDesignMode );
[ + - ]
204 [ + - ]: 36 : pPeer->setEnable ( maComponentInfos.bEnable );
205 [ + - ]: 36 : pPeer->setDesignMode( mbDesignMode );
206 : :
207 [ + - ]: 36 : peerCreated();
208 : :
209 : 36 : mbCreatingPeer = sal_False;
210 : :
211 [ + - ][ + - ]: 36 : OControl::initFormControlPeer( getPeer() );
212 [ + - ]: 38 : }
213 : 38 : }
214 : :
215 : : //------------------------------------------------------------------
216 : 0 : ::rtl::OUString SAL_CALL ONavigationBarControl::getImplementationName() throw( RuntimeException )
217 : : {
218 : 0 : return getImplementationName_Static();
219 : : }
220 : :
221 : : //------------------------------------------------------------------
222 : 0 : Sequence< ::rtl::OUString > SAL_CALL ONavigationBarControl::getSupportedServiceNames() throw( RuntimeException )
223 : : {
224 : 0 : return getSupportedServiceNames_Static();
225 : : }
226 : :
227 : : //------------------------------------------------------------------
228 : 60 : ::rtl::OUString SAL_CALL ONavigationBarControl::getImplementationName_Static()
229 : : {
230 : 60 : return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.form.ONavigationBarControl" ) );
231 : : }
232 : :
233 : : //------------------------------------------------------------------
234 : 30 : Sequence< ::rtl::OUString > SAL_CALL ONavigationBarControl::getSupportedServiceNames_Static()
235 : : {
236 : 30 : Sequence< ::rtl::OUString > aServices( 2 );
237 [ + - ][ + - ]: 30 : aServices[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControl" ) );
238 [ + - ][ + - ]: 30 : aServices[ 1 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.control.NavigationToolBar" ) );
239 : 30 : return aServices;
240 : : }
241 : :
242 : : //------------------------------------------------------------------
243 : 18 : Reference< XInterface > SAL_CALL ONavigationBarControl::Create( const Reference< XMultiServiceFactory >& _rxFactory )
244 : : {
245 [ + - ]: 18 : return *( new ONavigationBarControl( _rxFactory ) );
246 : : }
247 : :
248 : : //------------------------------------------------------------------
249 : 0 : void SAL_CALL ONavigationBarControl::registerDispatchProviderInterceptor( const Reference< XDispatchProviderInterceptor >& _rxInterceptor ) throw (RuntimeException)
250 : : {
251 [ # # ][ # # ]: 0 : FORWARD_TO_PEER_1( XDispatchProviderInterception, registerDispatchProviderInterceptor, _rxInterceptor );
[ # # ][ # # ]
[ # # ]
252 : 0 : }
253 : :
254 : : //------------------------------------------------------------------
255 : 0 : void SAL_CALL ONavigationBarControl::releaseDispatchProviderInterceptor( const Reference< XDispatchProviderInterceptor >& _rxInterceptor ) throw (RuntimeException)
256 : : {
257 [ # # ][ # # ]: 0 : FORWARD_TO_PEER_1( XDispatchProviderInterception, releaseDispatchProviderInterceptor, _rxInterceptor );
[ # # ][ # # ]
[ # # ]
258 : 0 : }
259 : :
260 : : //------------------------------------------------------------------
261 : 22 : void SAL_CALL ONavigationBarControl::setDesignMode( sal_Bool _bOn ) throw( RuntimeException )
262 : : {
263 [ + - ]: 22 : UnoControl::setDesignMode( _bOn );
264 [ + - ][ + - ]: 22 : FORWARD_TO_PEER_1( XVclWindowPeer, setDesignMode, _bOn );
[ + + ][ + - ]
[ + - ]
265 : 22 : }
266 : :
267 : : //==================================================================
268 : : // ONavigationBarPeer
269 : : //==================================================================
270 : : DBG_NAME( ONavigationBarPeer )
271 : : //------------------------------------------------------------------
272 : 36 : ONavigationBarPeer* ONavigationBarPeer::Create( const Reference< XMultiServiceFactory >& _rxORB,
273 : : Window* _pParentWindow, const Reference< XControlModel >& _rxModel )
274 : : {
275 : : DBG_TESTSOLARMUTEX();
276 : :
277 : : // the peer itself
278 [ + - ]: 36 : ONavigationBarPeer* pPeer = new ONavigationBarPeer( _rxORB );
279 : 36 : pPeer->acquire(); // by definition, the returned object is aquired once
280 : :
281 : : // the VCL control for the peer
282 [ + - ]: 36 : Reference< XModel > xContextDocument( getXModel( _rxModel ) );
283 : : NavigationToolBar* pNavBar = new NavigationToolBar(
284 : : _pParentWindow,
285 : : lcl_getWinBits_nothrow( _rxModel ),
286 : : createDocumentCommandImageProvider( _rxORB, xContextDocument ),
287 : : createDocumentCommandDescriptionProvider( _rxORB, xContextDocument )
288 [ + - ][ + - ]: 36 : );
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
289 : :
290 : : // some knittings
291 [ + - ][ + - ]: 36 : pNavBar->setDispatcher( pPeer );
292 [ + - ][ + - ]: 36 : pNavBar->SetComponentInterface( pPeer );
[ + - ]
293 : :
294 : : // we want a faster repeating rate for the slots in this
295 : : // toolbox
296 [ + - ]: 36 : AllSettings aSettings = pNavBar->GetSettings();
297 [ + - ]: 36 : MouseSettings aMouseSettings = aSettings.GetMouseSettings();
298 [ + - ]: 36 : aMouseSettings.SetButtonRepeat( 10 );
299 [ + - ]: 36 : aSettings.SetMouseSettings( aMouseSettings );
300 [ + - ]: 36 : pNavBar->SetSettings( aSettings, sal_True );
301 : :
302 : : // outta here
303 [ + - ][ + - ]: 36 : return pPeer;
304 : : }
305 : :
306 : : //------------------------------------------------------------------
307 : 36 : ONavigationBarPeer::ONavigationBarPeer( const Reference< XMultiServiceFactory >& _rxORB )
308 [ + - ]: 36 : :OFormNavigationHelper( _rxORB )
309 : : {
310 : : DBG_CTOR( ONavigationBarPeer, NULL );
311 : 36 : }
312 : :
313 : : //------------------------------------------------------------------
314 [ + - ]: 36 : ONavigationBarPeer::~ONavigationBarPeer()
315 : : {
316 : : DBG_DTOR( ONavigationBarPeer, NULL );
317 [ - + ]: 72 : }
318 : :
319 : : //------------------------------------------------------------------
320 [ - + ][ # # ]: 52456 : IMPLEMENT_FORWARD_XINTERFACE2( ONavigationBarPeer, VCLXWindow, OFormNavigationHelper )
321 : :
322 : : //------------------------------------------------------------------
323 [ # # ][ # # ]: 0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( ONavigationBarPeer, VCLXWindow, OFormNavigationHelper )
[ # # ]
324 : :
325 : : //------------------------------------------------------------------
326 : 72 : void SAL_CALL ONavigationBarPeer::dispose( ) throw( RuntimeException )
327 : : {
328 : 72 : VCLXWindow::dispose();
329 : 72 : OFormNavigationHelper::dispose();
330 : 72 : }
331 : :
332 : : //------------------------------------------------------------------
333 : 1902 : void SAL_CALL ONavigationBarPeer::setProperty( const ::rtl::OUString& _rPropertyName, const Any& _rValue ) throw( RuntimeException )
334 : : {
335 [ + - ]: 1902 : SolarMutexGuard aGuard;
336 : :
337 : 1902 : NavigationToolBar* pNavBar = static_cast< NavigationToolBar* >( GetWindow() );
338 [ - + ]: 1902 : if ( !pNavBar )
339 : : {
340 [ # # ]: 0 : VCLXWindow::setProperty( _rPropertyName, _rValue );
341 : 1902 : return;
342 : : }
343 : :
344 : 1902 : bool bVoid = !_rValue.hasValue();
345 : :
346 : 1902 : sal_Bool bBoolValue = sal_False;
347 : 1902 : sal_Int32 nColor = COL_TRANSPARENT;
348 : :
349 : : // TODO: more generic mechanisms for this (the grid control implementation,
350 : : // when used herein, will do the same stuff for lot of these)
351 : :
352 [ + + ][ + - ]: 1902 : if ( _rPropertyName.equals( PROPERTY_BACKGROUNDCOLOR ) )
353 : : {
354 [ + - ]: 36 : Wallpaper aTest = pNavBar->GetBackground();
355 [ + - ]: 36 : if ( bVoid )
356 : : {
357 [ + - ][ + - ]: 36 : pNavBar->SetBackground( pNavBar->GetSettings().GetStyleSettings().GetFaceColor() );
[ + - ]
358 [ + - ]: 36 : pNavBar->SetControlBackground();
359 : : }
360 : : else
361 : : {
362 : 0 : OSL_VERIFY( _rValue >>= nColor );
363 : 0 : Color aColor( nColor );
364 [ # # ][ # # ]: 0 : pNavBar->SetBackground( aColor );
[ # # ]
365 [ # # ]: 0 : pNavBar->SetControlBackground( aColor );
366 [ + - ]: 36 : }
367 : : }
368 [ + - ][ + + ]: 1866 : else if ( _rPropertyName.equals( PROPERTY_TEXTLINECOLOR ) )
369 : : {
370 [ + - ]: 36 : if ( bVoid )
371 : : {
372 [ + - ]: 36 : pNavBar->SetTextLineColor();
373 : : }
374 : : else
375 : : {
376 : 0 : OSL_VERIFY( _rValue >>= nColor );
377 : 0 : Color aColor( nColor );
378 [ # # ]: 0 : pNavBar->SetTextLineColor( nColor );
379 : : }
380 : : }
381 [ + - ][ + + ]: 1830 : else if ( _rPropertyName.equals( PROPERTY_ICONSIZE ) )
382 : : {
383 : 52 : sal_Int16 nInt16Value = 0;
384 : 52 : OSL_VERIFY( _rValue >>= nInt16Value );
385 [ + - ][ + + ]: 52 : pNavBar->SetImageSize( nInt16Value ? NavigationToolBar::eLarge : NavigationToolBar::eSmall );
386 : : }
387 [ + - ][ + + ]: 1778 : else if ( _rPropertyName.equals( PROPERTY_SHOW_POSITION ) )
388 : : {
389 : 52 : OSL_VERIFY( _rValue >>= bBoolValue );
390 [ + - ]: 52 : pNavBar->ShowFunctionGroup( NavigationToolBar::ePosition, bBoolValue );
391 : : }
392 [ + - ][ + + ]: 1726 : else if ( _rPropertyName.equals( PROPERTY_SHOW_NAVIGATION ) )
393 : : {
394 : 52 : OSL_VERIFY( _rValue >>= bBoolValue );
395 [ + - ]: 52 : pNavBar->ShowFunctionGroup( NavigationToolBar::eNavigation, bBoolValue );
396 : : }
397 [ + - ][ + + ]: 1674 : else if ( _rPropertyName.equals( PROPERTY_SHOW_RECORDACTIONS ) )
398 : : {
399 : 52 : OSL_VERIFY( _rValue >>= bBoolValue );
400 [ + - ]: 52 : pNavBar->ShowFunctionGroup( NavigationToolBar::eRecordActions, bBoolValue );
401 : : }
402 [ + - ][ + + ]: 1622 : else if ( _rPropertyName.equals( PROPERTY_SHOW_FILTERSORT ) )
403 : : {
404 : 52 : OSL_VERIFY( _rValue >>= bBoolValue );
405 [ + - ]: 52 : pNavBar->ShowFunctionGroup( NavigationToolBar::eFilterSort, bBoolValue );
406 : : }
407 : : else
408 : : {
409 [ + - ]: 1902 : VCLXWindow::setProperty( _rPropertyName, _rValue );
410 [ + - ][ + - ]: 1902 : }
411 : : }
412 : :
413 : : //------------------------------------------------------------------
414 : 0 : Any SAL_CALL ONavigationBarPeer::getProperty( const ::rtl::OUString& _rPropertyName ) throw( RuntimeException )
415 : : {
416 [ # # ]: 0 : SolarMutexGuard aGuard;
417 : :
418 : 0 : Any aReturn;
419 : 0 : NavigationToolBar* pNavBar = static_cast< NavigationToolBar* >( GetWindow() );
420 : :
421 [ # # ][ # # ]: 0 : if ( _rPropertyName.equals( PROPERTY_BACKGROUNDCOLOR ) )
422 : : {
423 [ # # ][ # # ]: 0 : aReturn <<= (sal_Int32)pNavBar->GetControlBackground().GetColor();
424 : : }
425 [ # # ][ # # ]: 0 : else if ( _rPropertyName.equals( PROPERTY_TEXTLINECOLOR ) )
426 : : {
427 [ # # ]: 0 : aReturn <<= (sal_Int32)pNavBar->GetTextLineColor().GetColor();
428 : : }
429 [ # # ][ # # ]: 0 : else if ( _rPropertyName.equals( PROPERTY_ICONSIZE ) )
430 : : {
431 : 0 : sal_Int16 nIconType = ( NavigationToolBar::eLarge == pNavBar->GetImageSize() )
432 [ # # ]: 0 : ? 1 : 0;
433 [ # # ]: 0 : aReturn <<= nIconType;
434 : : }
435 [ # # ][ # # ]: 0 : else if ( _rPropertyName.equals( PROPERTY_SHOW_POSITION ) )
436 : : {
437 [ # # ][ # # ]: 0 : aReturn <<= (sal_Bool)( pNavBar->IsFunctionGroupVisible( NavigationToolBar::ePosition ) );
438 : : }
439 [ # # ][ # # ]: 0 : else if ( _rPropertyName.equals( PROPERTY_SHOW_NAVIGATION ) )
440 : : {
441 [ # # ][ # # ]: 0 : aReturn <<= (sal_Bool)( pNavBar->IsFunctionGroupVisible( NavigationToolBar::eNavigation ) );
442 : : }
443 [ # # ][ # # ]: 0 : else if ( _rPropertyName.equals( PROPERTY_SHOW_RECORDACTIONS ) )
444 : : {
445 [ # # ][ # # ]: 0 : aReturn <<= (sal_Bool)( pNavBar->IsFunctionGroupVisible( NavigationToolBar::eRecordActions ) );
446 : : }
447 [ # # ][ # # ]: 0 : else if ( _rPropertyName.equals( PROPERTY_SHOW_FILTERSORT ) )
448 : : {
449 [ # # ][ # # ]: 0 : aReturn <<= (sal_Bool)( pNavBar->IsFunctionGroupVisible( NavigationToolBar::eFilterSort ) );
450 : : }
451 : : else
452 [ # # ]: 0 : aReturn = VCLXWindow::getProperty( _rPropertyName );
453 : :
454 [ # # ]: 0 : return aReturn;
455 : : }
456 : :
457 : : //------------------------------------------------------------------
458 : 0 : void ONavigationBarPeer::interceptorsChanged( )
459 : : {
460 [ # # ]: 0 : if ( isDesignMode() )
461 : : // not interested in if we're in design mode
462 : 0 : return;
463 : :
464 : 0 : OFormNavigationHelper::interceptorsChanged();
465 : : }
466 : :
467 : : //------------------------------------------------------------------
468 : 0 : void ONavigationBarPeer::featureStateChanged( sal_Int16 _nFeatureId, sal_Bool _bEnabled )
469 : : {
470 : : // enable this button on the toolbox
471 : 0 : NavigationToolBar* pNavBar = static_cast< NavigationToolBar* >( GetWindow() );
472 [ # # ]: 0 : if ( pNavBar )
473 : : {
474 : 0 : pNavBar->enableFeature( _nFeatureId, _bEnabled );
475 : :
476 : : // is it a feature with additional state information?
477 [ # # ]: 0 : if ( _nFeatureId == FormFeature::ToggleApplyFilter )
478 : : { // additional boolean state
479 : 0 : pNavBar->checkFeature( _nFeatureId, getBooleanState( _nFeatureId ) );
480 : : }
481 [ # # ]: 0 : else if ( _nFeatureId == FormFeature::TotalRecords )
482 : : {
483 [ # # ]: 0 : pNavBar->setFeatureText( _nFeatureId, getStringState( _nFeatureId ) );
484 : : }
485 [ # # ]: 0 : else if ( _nFeatureId == FormFeature::MoveAbsolute )
486 : : {
487 [ # # ]: 0 : pNavBar->setFeatureText( _nFeatureId, rtl::OUString::valueOf(getIntegerState(_nFeatureId)) );
488 : : }
489 : : }
490 : :
491 : : // base class
492 : 0 : OFormNavigationHelper::featureStateChanged( _nFeatureId, _bEnabled );
493 : 0 : }
494 : :
495 : : //------------------------------------------------------------------
496 : 416 : void ONavigationBarPeer::allFeatureStatesChanged( )
497 : : {
498 : : // force the control to update it's states
499 : 416 : NavigationToolBar* pNavBar = static_cast< NavigationToolBar* >( GetWindow() );
500 [ + + ]: 416 : if ( pNavBar )
501 : 344 : pNavBar->setDispatcher( this );
502 : :
503 : : // base class
504 : 416 : OFormNavigationHelper::allFeatureStatesChanged( );
505 : 416 : }
506 : :
507 : : //------------------------------------------------------------------
508 : 7980 : bool ONavigationBarPeer::isEnabled( sal_Int16 _nFeatureId ) const
509 : : {
510 [ + + ]: 7980 : if ( const_cast< ONavigationBarPeer* >( this )->isDesignMode() )
511 : 7182 : return false;
512 : :
513 : 7980 : return OFormNavigationHelper::isEnabled( _nFeatureId );
514 : : }
515 : :
516 : : //------------------------------------------------------------------
517 : 344 : void SAL_CALL ONavigationBarPeer::setDesignMode( sal_Bool _bOn ) throw( RuntimeException )
518 : : {
519 : 344 : VCLXWindow::setDesignMode( _bOn );
520 : :
521 [ + + ]: 344 : if ( _bOn )
522 : 342 : disconnectDispatchers();
523 : : else
524 : 2 : connectDispatchers();
525 : : // this will connect if not already connected and just update else
526 : 344 : }
527 : :
528 : : //------------------------------------------------------------------
529 : 0 : void SAL_CALL ONavigationBarPeer::disposing( const EventObject& _rSource ) throw (RuntimeException)
530 : : {
531 : 0 : VCLXWindow::disposing( _rSource );
532 : 0 : OFormNavigationHelper::disposing( _rSource );
533 : 0 : }
534 : :
535 : : //------------------------------------------------------------------
536 : 2 : void ONavigationBarPeer::getSupportedFeatures( ::std::vector< sal_Int16 >& _rFeatureIds )
537 : : {
538 : 2 : _rFeatureIds.push_back( FormFeature::MoveAbsolute );
539 : 2 : _rFeatureIds.push_back( FormFeature::TotalRecords );
540 : 2 : _rFeatureIds.push_back( FormFeature::MoveToFirst );
541 : 2 : _rFeatureIds.push_back( FormFeature::MoveToPrevious );
542 : 2 : _rFeatureIds.push_back( FormFeature::MoveToNext );
543 : 2 : _rFeatureIds.push_back( FormFeature::MoveToLast );
544 : 2 : _rFeatureIds.push_back( FormFeature::SaveRecordChanges );
545 : 2 : _rFeatureIds.push_back( FormFeature::UndoRecordChanges );
546 : 2 : _rFeatureIds.push_back( FormFeature::MoveToInsertRow );
547 : 2 : _rFeatureIds.push_back( FormFeature::DeleteRecord );
548 : 2 : _rFeatureIds.push_back( FormFeature::ReloadForm );
549 : 2 : _rFeatureIds.push_back( FormFeature::RefreshCurrentControl );
550 : 2 : _rFeatureIds.push_back( FormFeature::SortAscending );
551 : 2 : _rFeatureIds.push_back( FormFeature::SortDescending );
552 : 2 : _rFeatureIds.push_back( FormFeature::InteractiveSort );
553 : 2 : _rFeatureIds.push_back( FormFeature::AutoFilter );
554 : 2 : _rFeatureIds.push_back( FormFeature::InteractiveFilter );
555 : 2 : _rFeatureIds.push_back( FormFeature::ToggleApplyFilter );
556 : 2 : _rFeatureIds.push_back( FormFeature::RemoveFilterAndSort );
557 : 2 : }
558 : :
559 : : //.........................................................................
560 : : } // namespace frm
561 : : //.........................................................................
562 : :
563 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|