Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 : : *
5 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
6 : : *
7 : : * OpenOffice.org - a multi-platform office productivity suite
8 : : *
9 : : * This file is part of OpenOffice.org.
10 : : *
11 : : * OpenOffice.org is free software: you can redistribute it and/or modify
12 : : * it under the terms of the GNU Lesser General Public License version 3
13 : : * only, as published by the Free Software Foundation.
14 : : *
15 : : * OpenOffice.org is distributed in the hope that it will be useful,
16 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 : : * GNU Lesser General Public License version 3 for more details
19 : : * (a copy is included in the LICENSE file that accompanied this code).
20 : : *
21 : : * You should have received a copy of the GNU Lesser General Public License
22 : : * version 3 along with OpenOffice.org. If not, see
23 : : * <http://www.openoffice.org/license.html>
24 : : * for a copy of the LGPLv3 License.
25 : : *
26 : : ************************************************************************/
27 : :
28 : :
29 : : #include "dummypanel.hxx"
30 : : #include "toolpanelcollection.hxx"
31 : : #include "paneldecklisteners.hxx"
32 : : #include "toolpaneldeckpeer.hxx"
33 : : #include "svtools/toolpanel/toolpaneldeck.hxx"
34 : : #include "svtools/toolpanel/tablayouter.hxx"
35 : : #include "svtools/toolpanel/drawerlayouter.hxx"
36 : :
37 : : #include <com/sun/star/accessibility/XAccessible.hpp>
38 : : #include <com/sun/star/accessibility/AccessibleRole.hpp>
39 : :
40 : : #include <tools/diagnose_ex.h>
41 : :
42 : : #include <boost/optional.hpp>
43 : :
44 : : //........................................................................
45 : : namespace svt
46 : : {
47 : : //........................................................................
48 : :
49 : : /** === begin UNO using === **/
50 : : using ::com::sun::star::uno::Reference;
51 : : using ::com::sun::star::accessibility::XAccessible;
52 : : using ::com::sun::star::awt::XWindowPeer;
53 : : using ::com::sun::star::uno::UNO_SET_THROW;
54 : : /** === end UNO using === **/
55 : : namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole;
56 : :
57 : : enum DeckAction
58 : : {
59 : : /// activates the first panel
60 : : ACTION_ACTIVATE_FIRST,
61 : : // activates the panel after the currently active panel
62 : : ACTION_ACTIVATE_NEXT,
63 : : // activates the panel before the currently active panel
64 : : ACTION_ACTIVATE_PREV,
65 : : // activates the last panel
66 : : ACTION_ACTIVATE_LAST,
67 : :
68 : : // toggles the focus between the active panel and the panel selector
69 : : ACTION_TOGGLE_FOCUS,
70 : : };
71 : :
72 : : //====================================================================
73 : : //= ToolPanelDeck_Impl
74 : : //====================================================================
75 : : class ToolPanelDeck_Impl : public IToolPanelDeckListener
76 : : {
77 : : public:
78 : 26 : ToolPanelDeck_Impl( ToolPanelDeck& i_rDeck )
79 : : :m_rDeck( i_rDeck )
80 : : ,m_aPanelAnchor( &i_rDeck, WB_DIALOGCONTROL | WB_CHILDDLGCTRL )
81 : : ,m_aPanels()
82 [ + - ]: 26 : ,m_pDummyPanel( new DummyPanel )
83 : : ,m_pLayouter()
84 : : ,m_bInDtor( false )
85 [ + - ][ + - ]: 52 : ,m_pAccessibleParent( NULL )
[ + - ][ + - ]
[ + - ][ + - ]
86 : : {
87 [ + - ]: 26 : m_aPanels.AddListener( *this );
88 [ + - ]: 26 : m_aPanelAnchor.Show();
89 [ + - ]: 26 : m_aPanelAnchor.SetAccessibleRole( AccessibleRole::PANEL );
90 : 26 : }
91 : :
92 : 52 : virtual ~ToolPanelDeck_Impl()
93 [ + - ][ + - ]: 26 : {
[ + - ][ + - ]
[ + - ]
94 : 26 : m_bInDtor = true;
95 [ - + ]: 52 : }
96 : :
97 : 52 : PDeckLayouter GetLayouter() const { return m_pLayouter; }
98 : : void SetLayouter( const PDeckLayouter& i_pNewLayouter );
99 : :
100 : 64 : Window& GetPanelWindowAnchor() { return m_aPanelAnchor; }
101 : : const Window& GetPanelWindowAnchor() const { return m_aPanelAnchor; }
102 : :
103 : 0 : bool IsDead() const { return m_bInDtor; }
104 : :
105 : : /// notifies our listeners that we're going to die. Only to be called from with our anti-impl's destructor
106 : 26 : void NotifyDying()
107 : : {
108 : 26 : m_aPanels.RemoveListener( *this );
109 : 26 : m_aListeners.Dying();
110 : 26 : }
111 : :
112 : : // IToolPanelDeck equivalents
113 : : size_t GetPanelCount() const;
114 : : PToolPanel GetPanel( const size_t i_nPos ) const;
115 : : ::boost::optional< size_t >
116 : : GetActivePanel() const;
117 : : void ActivatePanel( const ::boost::optional< size_t >& i_rPanel );
118 : : size_t InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition );
119 : : PToolPanel RemovePanel( const size_t i_nPosition );
120 : : void AddListener( IToolPanelDeckListener& i_rListener );
121 : : void RemoveListener( IToolPanelDeckListener& i_rListener );
122 : :
123 : : /// re-layouts everything
124 : 218 : void LayoutAll() { ImplDoLayout(); }
125 : :
126 : : void DoAction( const DeckAction i_eAction );
127 : :
128 : : bool FocusActivePanel();
129 : :
130 : : void SetAccessibleParentWindow( Window* i_pAccessibleParent );
131 : 0 : Window* GetAccessibleParentWindow() const { return m_pAccessibleParent; }
132 : :
133 : : protected:
134 : : // IToolPanelDeckListener
135 : : virtual void PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition );
136 : : virtual void PanelRemoved( const size_t i_nPosition );
137 : : virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
138 : : virtual void LayouterChanged( const PDeckLayouter& i_rNewLayouter );
139 : : virtual void Dying();
140 : :
141 : : private:
142 : : void ImplDoLayout();
143 : : PToolPanel GetActiveOrDummyPanel_Impl();
144 : :
145 : : private:
146 : : ToolPanelDeck& m_rDeck;
147 : : Window m_aPanelAnchor;
148 : : ToolPanelCollection m_aPanels;
149 : : PToolPanel m_pDummyPanel;
150 : : PanelDeckListeners m_aListeners;
151 : : PDeckLayouter m_pLayouter;
152 : : bool m_bInDtor;
153 : : Window* m_pAccessibleParent;
154 : : };
155 : :
156 : : //--------------------------------------------------------------------
157 : 244 : PToolPanel ToolPanelDeck_Impl::GetActiveOrDummyPanel_Impl()
158 : : {
159 [ + - ]: 244 : ::boost::optional< size_t > aActivePanel( m_aPanels.GetActivePanel() );
160 [ + - ][ + + ]: 244 : if ( !aActivePanel )
161 [ + - ]: 201 : return m_pDummyPanel;
162 [ + - ][ + - ]: 244 : return m_aPanels.GetPanel( *aActivePanel );
[ + - ]
163 : : }
164 : :
165 : : //--------------------------------------------------------------------
166 : 26 : void ToolPanelDeck_Impl::SetLayouter( const PDeckLayouter& i_pNewLayouter )
167 : : {
168 [ - + ]: 52 : ENSURE_OR_RETURN_VOID( i_pNewLayouter.get(), "invalid layouter" );
169 : :
170 [ - + ]: 26 : if ( m_pLayouter.get() )
171 : 0 : m_pLayouter->Destroy();
172 : :
173 : 26 : m_pLayouter = i_pNewLayouter;
174 : :
175 : 26 : ImplDoLayout();
176 : :
177 : 26 : m_aListeners.LayouterChanged( m_pLayouter );
178 : : }
179 : :
180 : : //--------------------------------------------------------------------
181 : 1073 : size_t ToolPanelDeck_Impl::GetPanelCount() const
182 : : {
183 : 1073 : return m_aPanels.GetPanelCount();
184 : : }
185 : :
186 : : //--------------------------------------------------------------------
187 : 621 : PToolPanel ToolPanelDeck_Impl::GetPanel( const size_t i_nPos ) const
188 : : {
189 : 621 : return m_aPanels.GetPanel( i_nPos );
190 : : }
191 : :
192 : : //--------------------------------------------------------------------
193 : 250 : ::boost::optional< size_t > ToolPanelDeck_Impl::GetActivePanel() const
194 : : {
195 : 250 : return m_aPanels.GetActivePanel();
196 : : }
197 : :
198 : : //--------------------------------------------------------------------
199 : 48 : void ToolPanelDeck_Impl::ActivatePanel( const ::boost::optional< size_t >& i_rPanel )
200 : : {
201 : 48 : m_aPanels.ActivatePanel( i_rPanel );
202 : 48 : }
203 : :
204 : : //--------------------------------------------------------------------
205 : 130 : size_t ToolPanelDeck_Impl::InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition )
206 : : {
207 : 130 : return m_aPanels.InsertPanel( i_pPanel, i_nPosition );
208 : : }
209 : :
210 : : //--------------------------------------------------------------------
211 : 0 : PToolPanel ToolPanelDeck_Impl::RemovePanel( const size_t i_nPosition )
212 : : {
213 : 0 : return m_aPanels.RemovePanel( i_nPosition );
214 : : }
215 : :
216 : : //--------------------------------------------------------------------
217 : 244 : void ToolPanelDeck_Impl::ImplDoLayout()
218 : : {
219 [ + - ]: 244 : const Rectangle aDeckPlayground( Point(), m_rDeck.GetOutputSizePixel() );
220 : :
221 : : // ask the layouter what is left for our panel, and position the panel container window appropriately
222 : 244 : Rectangle aPlaygroundArea( aDeckPlayground );
223 : : OSL_ENSURE( m_pLayouter.get(), "ToolPanelDeck_Impl::ImplDoLayout: no layouter!" );
224 [ + - ]: 244 : if ( m_pLayouter.get() )
225 : : {
226 [ + - ]: 244 : aPlaygroundArea = m_pLayouter->Layout( aDeckPlayground );
227 : : }
228 [ + - ][ + - ]: 244 : m_aPanelAnchor.SetPosSizePixel( aPlaygroundArea.TopLeft(), aPlaygroundArea.GetSize() );
229 : :
230 : : // position the active panel
231 [ + - ]: 244 : const PToolPanel pActive( GetActiveOrDummyPanel_Impl() );
232 [ + - ][ + - ]: 244 : pActive->SetSizePixel( m_aPanelAnchor.GetOutputSizePixel() );
233 : 244 : }
234 : :
235 : : //--------------------------------------------------------------------
236 : 78 : void ToolPanelDeck_Impl::AddListener( IToolPanelDeckListener& i_rListener )
237 : : {
238 : 78 : m_aListeners.AddListener( i_rListener );
239 : 78 : }
240 : :
241 : : //--------------------------------------------------------------------
242 : 104 : void ToolPanelDeck_Impl::RemoveListener( IToolPanelDeckListener& i_rListener )
243 : : {
244 : 104 : m_aListeners.RemoveListener( i_rListener );
245 : 104 : }
246 : :
247 : : //--------------------------------------------------------------------
248 : 0 : void ToolPanelDeck_Impl::DoAction( const DeckAction i_eAction )
249 : : {
250 [ # # ]: 0 : const size_t nPanelCount( m_aPanels.GetPanelCount() );
251 [ # # ]: 0 : ::boost::optional< size_t > aActivatePanel;
252 [ # # ]: 0 : ::boost::optional< size_t > aCurrentPanel( GetActivePanel() );
253 : :
254 [ # # # # : 0 : switch ( i_eAction )
# # ]
255 : : {
256 : : case ACTION_ACTIVATE_FIRST:
257 [ # # ]: 0 : if ( nPanelCount > 0 )
258 [ # # ]: 0 : aActivatePanel = 0;
259 : 0 : break;
260 : : case ACTION_ACTIVATE_PREV:
261 [ # # ][ # # ]: 0 : if ( !aCurrentPanel && ( nPanelCount > 0 ) )
[ # # ][ # # ]
262 [ # # ]: 0 : aActivatePanel = nPanelCount - 1;
263 : : else
264 [ # # ][ # # ]: 0 : if ( !!aCurrentPanel && ( *aCurrentPanel > 0 ) )
[ # # ][ # # ]
[ # # ]
265 [ # # ][ # # ]: 0 : aActivatePanel = *aCurrentPanel - 1;
266 : 0 : break;
267 : : case ACTION_ACTIVATE_NEXT:
268 [ # # ][ # # ]: 0 : if ( !aCurrentPanel && ( nPanelCount > 0 ) )
[ # # ][ # # ]
269 [ # # ]: 0 : aActivatePanel = 0;
270 : : else
271 [ # # ][ # # ]: 0 : if ( !!aCurrentPanel && ( *aCurrentPanel < nPanelCount - 1 ) )
[ # # ][ # # ]
[ # # ]
272 [ # # ][ # # ]: 0 : aActivatePanel = *aCurrentPanel + 1;
273 : 0 : break;
274 : : case ACTION_ACTIVATE_LAST:
275 [ # # ]: 0 : if ( nPanelCount > 0 )
276 [ # # ]: 0 : aActivatePanel = nPanelCount - 1;
277 : 0 : break;
278 : : case ACTION_TOGGLE_FOCUS:
279 : : {
280 [ # # ]: 0 : PToolPanel pActivePanel( GetActiveOrDummyPanel_Impl() );
281 [ # # ][ # # ]: 0 : if ( !m_aPanelAnchor.HasChildPathFocus() )
282 [ # # ]: 0 : pActivePanel->GrabFocus();
283 : : else
284 [ # # ][ # # ]: 0 : GetLayouter()->SetFocusToPanelSelector();
[ # # ][ # # ]
285 : : }
286 : 0 : break;
287 : : }
288 : :
289 [ # # ][ # # ]: 0 : if ( !!aActivatePanel )
290 : : {
291 [ # # ]: 0 : ActivatePanel( aActivatePanel );
292 [ # # ][ # # ]: 0 : }
293 : 0 : }
294 : :
295 : : //--------------------------------------------------------------------
296 : 0 : bool ToolPanelDeck_Impl::FocusActivePanel()
297 : : {
298 [ # # ]: 0 : ::boost::optional< size_t > aActivePanel( m_aPanels.GetActivePanel() );
299 [ # # ][ # # ]: 0 : if ( !aActivePanel )
300 : 0 : return false;
301 : :
302 [ # # ][ # # ]: 0 : PToolPanel pActivePanel( m_aPanels.GetPanel( *aActivePanel ) );
303 [ # # ]: 0 : pActivePanel->GrabFocus();
304 [ # # ][ # # ]: 0 : return true;
305 : : }
306 : :
307 : : //--------------------------------------------------------------------
308 : 130 : void ToolPanelDeck_Impl::PanelInserted( const PToolPanel& i_pPanel, const size_t i_nPosition )
309 : : {
310 : : // multiplex to our own listeners
311 : 130 : m_aListeners.PanelInserted( i_pPanel, i_nPosition );
312 : 130 : }
313 : :
314 : : //--------------------------------------------------------------------
315 : 0 : void ToolPanelDeck_Impl::PanelRemoved( const size_t i_nPosition )
316 : : {
317 : : // multiplex to our own listeners
318 : 0 : m_aListeners.PanelRemoved( i_nPosition );
319 : 0 : }
320 : :
321 : : //--------------------------------------------------------------------
322 : 32 : void ToolPanelDeck_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
323 : : {
324 : : // hide the old panel
325 [ + - ][ + + ]: 32 : if ( !!i_rOldActive )
326 : : {
327 [ + - ][ + - ]: 6 : const PToolPanel pOldActive( m_aPanels.GetPanel( *i_rOldActive ) );
328 [ + - ][ + - ]: 6 : pOldActive->Deactivate();
329 : : }
330 : :
331 : : // position and show the new panel
332 [ + - ][ - + ]: 32 : const PToolPanel pNewActive( !i_rNewActive ? m_pDummyPanel : m_aPanels.GetPanel( *i_rNewActive ) );
[ # # ][ + - ]
[ + - ]
333 [ + - ]: 32 : pNewActive->Activate( m_aPanelAnchor );
334 [ + - ]: 32 : pNewActive->GrabFocus();
335 : :
336 : : // resize the panel (cannot guarantee it has ever been resized before
337 [ + - ]: 32 : pNewActive->SetSizePixel( m_aPanelAnchor.GetOutputSizePixel() );
338 : :
339 : : // multiplex to our own listeners
340 [ + - ][ + - ]: 32 : m_aListeners.ActivePanelChanged( i_rOldActive, i_rNewActive );
341 : 32 : }
342 : :
343 : : //--------------------------------------------------------------------
344 : 0 : void ToolPanelDeck_Impl::LayouterChanged( const PDeckLayouter& i_rNewLayouter )
345 : : {
346 : : // not interested in
347 : : (void)i_rNewLayouter;
348 : 0 : }
349 : :
350 : : //--------------------------------------------------------------------
351 : 0 : void ToolPanelDeck_Impl::Dying()
352 : : {
353 : : // not interested in. Since the ToolPanelCollection is our member, this just means we ourself
354 : : // are dying, and we already sent this notification in our dtor.
355 : 0 : }
356 : :
357 : : //--------------------------------------------------------------------
358 : 26 : void ToolPanelDeck_Impl::SetAccessibleParentWindow( Window* i_pAccessibleParent )
359 : : {
360 : 26 : m_pAccessibleParent = i_pAccessibleParent;
361 : 26 : }
362 : :
363 : : //====================================================================
364 : : //= ToolPanelDeck
365 : : //====================================================================
366 : : //--------------------------------------------------------------------
367 : 26 : ToolPanelDeck::ToolPanelDeck( Window& i_rParent, const WinBits i_nStyle )
368 : : :Control( &i_rParent, i_nStyle )
369 [ + - ][ + - ]: 26 : ,m_pImpl( new ToolPanelDeck_Impl( *this ) )
370 : : {
371 : : // use a default layouter
372 : : // SetLayouter( PDeckLayouter( new TabDeckLayouter( *this, *this, TABS_RIGHT, TABITEM_IMAGE_AND_TEXT ) ) );
373 [ + - ][ + - ]: 26 : SetLayouter( PDeckLayouter( new DrawerDeckLayouter( *this, *this ) ) );
[ + - ][ + - ]
[ + - ][ + - ]
374 : 26 : }
375 : :
376 : : //--------------------------------------------------------------------
377 [ + - ]: 26 : ToolPanelDeck::~ToolPanelDeck()
378 : : {
379 [ + - ]: 26 : m_pImpl->NotifyDying();
380 [ + - ][ + - ]: 26 : GetLayouter()->Destroy();
[ + - ]
381 : :
382 [ + - ]: 26 : Hide();
383 [ + - ][ + + ]: 156 : for ( size_t i=0; i<GetPanelCount(); ++i )
384 : : {
385 [ + - ]: 130 : PToolPanel pPanel( GetPanel( i ) );
386 [ + - ]: 130 : pPanel->Dispose();
387 [ + - ]: 130 : }
388 [ - + ]: 26 : }
389 : :
390 : : //--------------------------------------------------------------------
391 : 1073 : size_t ToolPanelDeck::GetPanelCount() const
392 : : {
393 : 1073 : return m_pImpl->GetPanelCount();
394 : : }
395 : :
396 : : //--------------------------------------------------------------------
397 : 621 : PToolPanel ToolPanelDeck::GetPanel( const size_t i_nPos ) const
398 : : {
399 : 621 : return m_pImpl->GetPanel( i_nPos );
400 : : }
401 : :
402 : : //--------------------------------------------------------------------
403 : 250 : ::boost::optional< size_t > ToolPanelDeck::GetActivePanel() const
404 : : {
405 : 250 : return m_pImpl->GetActivePanel();
406 : : }
407 : :
408 : : //--------------------------------------------------------------------
409 : 48 : void ToolPanelDeck::ActivatePanel( const ::boost::optional< size_t >& i_rPanel )
410 : : {
411 : 48 : m_pImpl->ActivatePanel( i_rPanel );
412 : 48 : }
413 : :
414 : : //--------------------------------------------------------------------
415 : 130 : size_t ToolPanelDeck::InsertPanel( const PToolPanel& i_pPanel, const size_t i_nPosition )
416 : : {
417 : 130 : return m_pImpl->InsertPanel( i_pPanel, i_nPosition );
418 : : }
419 : :
420 : : //--------------------------------------------------------------------
421 : 0 : PToolPanel ToolPanelDeck::RemovePanel( const size_t i_nPosition )
422 : : {
423 : 0 : return m_pImpl->RemovePanel( i_nPosition );
424 : : }
425 : :
426 : : //--------------------------------------------------------------------
427 : 52 : PDeckLayouter ToolPanelDeck::GetLayouter() const
428 : : {
429 : 52 : return m_pImpl->GetLayouter();
430 : : }
431 : :
432 : : //--------------------------------------------------------------------
433 : 26 : void ToolPanelDeck::SetLayouter( const PDeckLayouter& i_pNewLayouter )
434 : : {
435 : 26 : return m_pImpl->SetLayouter( i_pNewLayouter );
436 : : }
437 : :
438 : : //--------------------------------------------------------------------
439 : 78 : void ToolPanelDeck::AddListener( IToolPanelDeckListener& i_rListener )
440 : : {
441 : 78 : m_pImpl->AddListener( i_rListener );
442 : 78 : }
443 : :
444 : : //--------------------------------------------------------------------
445 : 104 : void ToolPanelDeck::RemoveListener( IToolPanelDeckListener& i_rListener )
446 : : {
447 : 104 : m_pImpl->RemoveListener( i_rListener );
448 : 104 : }
449 : :
450 : : //--------------------------------------------------------------------
451 : 64 : Window& ToolPanelDeck::GetPanelWindowAnchor()
452 : : {
453 : 64 : return m_pImpl->GetPanelWindowAnchor();
454 : : }
455 : :
456 : : //--------------------------------------------------------------------
457 : 0 : const Window& ToolPanelDeck::GetPanelWindowAnchor() const
458 : : {
459 : 0 : return m_pImpl->GetPanelWindowAnchor();
460 : : }
461 : :
462 : : //--------------------------------------------------------------------
463 : 218 : void ToolPanelDeck::Resize()
464 : : {
465 : 218 : Control::Resize();
466 : 218 : m_pImpl->LayoutAll();
467 : 218 : }
468 : :
469 : : //--------------------------------------------------------------------
470 : 727 : long ToolPanelDeck::Notify( NotifyEvent& i_rNotifyEvent )
471 : : {
472 : 727 : bool bHandled = false;
473 [ - + ]: 727 : if ( i_rNotifyEvent.GetType() == EVENT_KEYINPUT )
474 : : {
475 : 0 : const KeyEvent* pEvent = i_rNotifyEvent.GetKeyEvent();
476 : 0 : const KeyCode& rKeyCode = pEvent->GetKeyCode();
477 [ # # ]: 0 : if ( rKeyCode.GetModifier() == KEY_MOD1 )
478 : : {
479 : 0 : bHandled = true;
480 [ # # # # : 0 : switch ( rKeyCode.GetCode() )
# ]
481 : : {
482 : : case KEY_HOME:
483 : 0 : m_pImpl->DoAction( ACTION_ACTIVATE_FIRST );
484 : 0 : break;
485 : : case KEY_PAGEUP:
486 : 0 : m_pImpl->DoAction( ACTION_ACTIVATE_PREV );
487 : 0 : break;
488 : : case KEY_PAGEDOWN:
489 : 0 : m_pImpl->DoAction( ACTION_ACTIVATE_NEXT );
490 : 0 : break;
491 : : case KEY_END:
492 : 0 : m_pImpl->DoAction( ACTION_ACTIVATE_LAST );
493 : 0 : break;
494 : : default:
495 : 0 : bHandled = false;
496 : 0 : break;
497 : : }
498 : : }
499 [ # # ]: 0 : else if ( rKeyCode.GetModifier() == ( KEY_MOD1 | KEY_SHIFT ) )
500 : : {
501 [ # # ]: 0 : if ( rKeyCode.GetCode() == KEY_E )
502 : : {
503 : 0 : m_pImpl->DoAction( ACTION_TOGGLE_FOCUS );
504 : 0 : bHandled = true;
505 : : }
506 : : }
507 : : }
508 : :
509 [ - + ]: 727 : if ( bHandled )
510 : 0 : return 1;
511 : :
512 : 727 : return Control::Notify( i_rNotifyEvent );
513 : : }
514 : :
515 : : //--------------------------------------------------------------------
516 : 0 : void ToolPanelDeck::GetFocus()
517 : : {
518 : 0 : Control::GetFocus();
519 [ # # ]: 0 : if ( m_pImpl->IsDead() )
520 : 0 : return;
521 [ # # ]: 0 : if ( !m_pImpl->FocusActivePanel() )
522 : : {
523 [ # # ]: 0 : PDeckLayouter pLayouter( GetLayouter() );
524 [ # # ]: 0 : ENSURE_OR_RETURN_VOID( pLayouter.get(), "ToolPanelDeck::GetFocus: no layouter?!" );
525 [ # # ][ # # ]: 0 : pLayouter->SetFocusToPanelSelector();
[ # # ]
526 : : }
527 : : }
528 : :
529 : : //--------------------------------------------------------------------
530 : 26 : void ToolPanelDeck::SetAccessibleParentWindow( Window* i_pAccessibleParent )
531 : : {
532 : 26 : m_pImpl->SetAccessibleParentWindow( i_pAccessibleParent );
533 : 26 : }
534 : :
535 : : //--------------------------------------------------------------------
536 : 0 : Window* ToolPanelDeck::GetAccessibleParentWindow() const
537 : : {
538 : 0 : Window* pAccessibleParent( m_pImpl->GetAccessibleParentWindow() );
539 [ # # ]: 0 : if ( !pAccessibleParent )
540 : 0 : pAccessibleParent = Window::GetAccessibleParentWindow();
541 : 0 : return pAccessibleParent;
542 : : }
543 : :
544 : : //--------------------------------------------------------------------
545 : 26 : Reference< XWindowPeer > ToolPanelDeck::GetComponentInterface( sal_Bool i_bCreate )
546 : : {
547 : 26 : Reference< XWindowPeer > xWindowPeer( Control::GetComponentInterface( sal_False ) );
548 [ + - ][ + - ]: 26 : if ( !xWindowPeer.is() && i_bCreate )
[ + - ]
549 : : {
550 [ + - ][ + - ]: 26 : xWindowPeer.set( new ToolPanelDeckPeer( *this ) );
[ + - ]
551 [ + - ]: 26 : SetComponentInterface( xWindowPeer );
552 : : }
553 : 26 : return xWindowPeer;
554 : : }
555 : :
556 : : //........................................................................
557 : : } // namespace svt
558 : : //........................................................................
559 : :
560 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|