LibreOffice Module sfx2 (master) 1
Classes | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
sfx2::sidebar::FocusManager Class Reference

Concentrate all focus handling in this class. More...

#include <FocusManager.hxx>

Collaboration diagram for sfx2::sidebar::FocusManager:
[legend]

Classes

class  FocusLocation
 

Public Member Functions

 FocusManager (std::function< void(const Panel &)> aShowPanelFunctor)
 
 ~FocusManager ()
 
void Clear ()
 Forget all panels and buttons. More...
 
void GrabFocus ()
 Transfer the focus into the sidebar tree of windows. More...
 
void GrabFocusPanel ()
 
void SetDeck (Deck *pDeck)
 
void SetPanels (const SharedPanelContainer &rPanels)
 
void SetButtons (const std::vector< weld::Widget * > &rButtons)
 

Private Types

enum  PanelComponent {
  PC_DeckToolBox ,
  PC_PanelTitle ,
  PC_PanelToolBox ,
  PC_PanelContent ,
  PC_TabBar ,
  PC_None
}
 

Private Member Functions

 DECL_LINK (KeyInputHdl, const KeyEvent &, bool)
 Listen for key events for panels and buttons. More...
 
void ClearPanels ()
 
void ClearButtons ()
 
void RegisterWindow (weld::Widget &rWidget)
 Let the focus manager listen for window events for the given window. More...
 
void FocusDeckTitle ()
 
bool IsDeckTitleVisible () const
 
bool IsPanelTitleVisible (const sal_Int32 nPanelIndex) const
 
void FocusPanel (const sal_Int32 nPanelIndex, const bool bFallbackToDeckTitle)
 Set the focus to the title bar of the panel or, if the title bar is not visible, directly to the panel. More...
 
void FocusPanelContent (const sal_Int32 nPanelIndex)
 
void FocusButton (const sal_Int32 nButtonIndex)
 
void MoveFocusInsidePanel (const FocusLocation &rLocation, const sal_Int32 nDirection)
 
bool MoveFocusInsideDeckTitle (const FocusLocation &rLocation, const sal_Int32 nDirection)
 
bool HandleKeyEvent (const vcl::KeyCode &rKeyCode, const FocusLocation &rLocation)
 
FocusLocation GetFocusLocation () const
 

Static Private Member Functions

static void UnregisterWindow (weld::Widget &rWidget)
 

Private Attributes

VclPtr< DeckmxDeck
 
DeckTitleBarmpDeckTitleBar
 
SharedPanelContainer maPanels
 
std::vector< weld::Widget * > maButtons
 
const std::function< void(const Panel &)> maShowPanelFunctor
 

Detailed Description

Concentrate all focus handling in this class.

There is one ring of windows that accept the input focus which are cycled through with the arrow keys:

When the focus is in a panel title then focus travels over

Once the focus is in the panel content then focus cycles through all controls inside the panel but not back to the title bar of the panel. Escape places the focus back in the panel title.

Definition at line 50 of file FocusManager.hxx.

Member Enumeration Documentation

◆ PanelComponent

Enumerator
PC_DeckToolBox 
PC_PanelTitle 
PC_PanelToolBox 
PC_PanelContent 
PC_TabBar 
PC_None 

Definition at line 78 of file FocusManager.hxx.

Constructor & Destructor Documentation

◆ FocusManager()

sfx2::sidebar::FocusManager::FocusManager ( std::function< void(const Panel &)>  aShowPanelFunctor)

Definition at line 39 of file FocusManager.cxx.

◆ ~FocusManager()

sfx2::sidebar::FocusManager::~FocusManager ( )

Definition at line 45 of file FocusManager.cxx.

References Clear().

Member Function Documentation

◆ Clear()

void sfx2::sidebar::FocusManager::Clear ( )

◆ ClearButtons()

void sfx2::sidebar::FocusManager::ClearButtons ( )
private

Definition at line 84 of file FocusManager.cxx.

References maButtons, and UnregisterWindow().

Referenced by Clear(), and SetButtons().

◆ ClearPanels()

void sfx2::sidebar::FocusManager::ClearPanels ( )
private

Definition at line 67 of file FocusManager.cxx.

References maPanels, and UnregisterWindow().

Referenced by Clear(), and SetPanels().

◆ DECL_LINK()

sfx2::sidebar::FocusManager::DECL_LINK ( KeyInputHdl  ,
const KeyEvent ,
bool   
)
private

Listen for key events for panels and buttons.

◆ FocusButton()

void sfx2::sidebar::FocusManager::FocusButton ( const sal_Int32  nButtonIndex)
private

Definition at line 253 of file FocusManager.cxx.

References maButtons.

Referenced by HandleKeyEvent().

◆ FocusDeckTitle()

void sfx2::sidebar::FocusManager::FocusDeckTitle ( )
private

◆ FocusPanel()

void sfx2::sidebar::FocusManager::FocusPanel ( const sal_Int32  nPanelIndex,
const bool  bFallbackToDeckTitle 
)
private

Set the focus to the title bar of the panel or, if the title bar is not visible, directly to the panel.

Parameters
nPanelIndexIndex of the panel to focus.
bFallbackToDeckTitleWhen the panel title bar is not visible then The fallback bias defines whether to focus the deck (true) or the panel content (false) will be focused instead.

Definition at line 207 of file FocusManager.cxx.

References FocusDeckTitle(), FocusPanelContent(), sfx2::sidebar::PanelTitleBar::GetExpander(), sfx2::sidebar::Panel::GetTitleBar(), sfx2::sidebar::TitleBar::GetVisible(), weld::Widget::grab_focus(), IsDeckTitleVisible(), o3tl::make_unsigned(), maPanels, maShowPanelFunctor, and sfx2::sidebar::Panel::SetExpanded().

Referenced by FocusDeckTitle(), GrabFocusPanel(), and HandleKeyEvent().

◆ FocusPanelContent()

void sfx2::sidebar::FocusManager::FocusPanelContent ( const sal_Int32  nPanelIndex)
private

◆ GetFocusLocation()

FocusManager::FocusLocation sfx2::sidebar::FocusManager::GetFocusLocation ( ) const
private

◆ GrabFocus()

void sfx2::sidebar::FocusManager::GrabFocus ( )

Transfer the focus into the sidebar tree of windows.

This is typically called from the SidebarChildWindow as result of pressing the F6 key.

Definition at line 50 of file FocusManager.cxx.

References FocusDeckTitle().

◆ GrabFocusPanel()

void sfx2::sidebar::FocusManager::GrabFocusPanel ( )

Definition at line 55 of file FocusManager.cxx.

References FocusPanel().

Referenced by sfx2::sidebar::Sidebar::ShowDeck(), and sfx2::sidebar::Sidebar::ShowPanel().

◆ HandleKeyEvent()

bool sfx2::sidebar::FocusManager::HandleKeyEvent ( const vcl::KeyCode rKeyCode,
const FocusLocation rLocation 
)
private

◆ IsDeckTitleVisible()

bool sfx2::sidebar::FocusManager::IsDeckTitleVisible ( ) const
private

Definition at line 191 of file FocusManager.cxx.

References sfx2::sidebar::TitleBar::GetVisible(), and mpDeckTitleBar.

Referenced by FocusPanel(), and HandleKeyEvent().

◆ IsPanelTitleVisible()

bool sfx2::sidebar::FocusManager::IsPanelTitleVisible ( const sal_Int32  nPanelIndex) const
private

◆ MoveFocusInsideDeckTitle()

bool sfx2::sidebar::FocusManager::MoveFocusInsideDeckTitle ( const FocusLocation rLocation,
const sal_Int32  nDirection 
)
private

◆ MoveFocusInsidePanel()

void sfx2::sidebar::FocusManager::MoveFocusInsidePanel ( const FocusLocation rLocation,
const sal_Int32  nDirection 
)
private

◆ RegisterWindow()

void sfx2::sidebar::FocusManager::RegisterWindow ( weld::Widget rWidget)
private

Let the focus manager listen for window events for the given window.

Definition at line 134 of file FocusManager.cxx.

References weld::Widget::connect_key_press(), LINK, and UnregisterWindow().

Referenced by SetButtons(), SetDeck(), and SetPanels().

◆ SetButtons()

void sfx2::sidebar::FocusManager::SetButtons ( const std::vector< weld::Widget * > &  rButtons)

Definition at line 124 of file FocusManager.cxx.

References ClearButtons(), maButtons, and RegisterWindow().

Referenced by sfx2::sidebar::TabBar::UpdateFocusManager().

◆ SetDeck()

void sfx2::sidebar::FocusManager::SetDeck ( Deck pDeck)

◆ SetPanels()

void sfx2::sidebar::FocusManager::SetPanels ( const SharedPanelContainer rPanels)

◆ UnregisterWindow()

void sfx2::sidebar::FocusManager::UnregisterWindow ( weld::Widget rWidget)
staticprivate

Definition at line 140 of file FocusManager.cxx.

References weld::Widget::connect_key_press().

Referenced by ClearButtons(), ClearPanels(), RegisterWindow(), and SetDeck().

Member Data Documentation

◆ maButtons

std::vector<weld::Widget*> sfx2::sidebar::FocusManager::maButtons
private

◆ maPanels

SharedPanelContainer sfx2::sidebar::FocusManager::maPanels
private

◆ maShowPanelFunctor

const std::function<void(const Panel&)> sfx2::sidebar::FocusManager::maShowPanelFunctor
private

Definition at line 76 of file FocusManager.hxx.

Referenced by FocusPanel().

◆ mpDeckTitleBar

DeckTitleBar* sfx2::sidebar::FocusManager::mpDeckTitleBar
private

Definition at line 73 of file FocusManager.hxx.

Referenced by FocusDeckTitle(), GetFocusLocation(), IsDeckTitleVisible(), and SetDeck().

◆ mxDeck

VclPtr<Deck> sfx2::sidebar::FocusManager::mxDeck
private

Definition at line 72 of file FocusManager.hxx.

Referenced by HandleKeyEvent(), and SetDeck().


The documentation for this class was generated from the following files: