LibreOffice Module sd (master) 1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
sd::ToolBarManager Class Reference

Manage the set of visible tool bars (and object bars). More...

#include <ToolBarManager.hxx>

Inheritance diagram for sd::ToolBarManager:
[legend]
Collaboration diagram for sd::ToolBarManager:
[legend]

Classes

class  Implementation
 
class  UpdateLock
 Use this class to prevent the visible tool bars from being updated (and thus causing repaints and GUI rearrangements) when several tool bar operations are made in a row. More...
 

Public Types

enum class  ToolBarGroup {
  Permanent ,
  Function ,
  CommonTask ,
  MasterMode ,
  LAST = MasterMode
}
 The set of tool bar groups. More...
 

Public Member Functions

 ~ToolBarManager ()
 
void Shutdown ()
 Call this method prior to the destructor to prevent the ToolBarManager from accessing the ViewShellManager or the XLayoutManager when those are possibly not well and alive anymore (like during the destruction of the ViewShellBase.) More...
 
void MainViewShellChanged ()
 When the view in the center pane changes then this method sets up the initial set of tool bars for the new view. More...
 
void MainViewShellChanged (const ViewShell &rMainViewShell)
 
void SelectionHasChanged (const ViewShell &rViewShell, const SdrView &rView)
 Call this method when the selection has changed to update the more temporary tool bars (those in the ToolBarGroup::Function group.) More...
 
void ResetToolBars (ToolBarGroup eGroup)
 Reset the set of visible object bars in the specified group. More...
 
void ResetAllToolBars ()
 Reset all tool bars, regardless of the group they belong to. More...
 
void AddToolBar (ToolBarGroup eGroup, const OUString &rsToolBarName)
 Add the tool bar with the given name to the specified group of tool bars. More...
 
void AddToolBarShell (ToolBarGroup eGroup, ShellId nToolBarId)
 Add the tool bar shell to the shell stack. More...
 
void RemoveToolBar (ToolBarGroup eGroup, const OUString &rsToolBarName)
 Remove the tool bar with the given name from the specified group. More...
 
void SetToolBar (ToolBarGroup eGroup, const OUString &rsToolBarName)
 This is basically a shortcut for ResetToolBars(),AddToolBar(). More...
 
void SetToolBarShell (ToolBarGroup eGroup, ShellId nToolBarId)
 This is basically a shortcut for ResetToolBars(),AddToolBar(). More...
 
void PreUpdate ()
 
void RequestUpdate ()
 Request an update of the active tool bars. More...
 
void LockViewShellManager ()
 This is a hint for the ToolBarManager to improve the performance when it updates its tool bars when its own lock is released. More...
 
void ToolBarsDestroyed ()
 

Static Public Member Functions

static std::shared_ptr< ToolBarManagerCreate (ViewShellBase &rBase, const std::shared_ptr< tools::EventMultiplexer > &rpMultiplexer, const std::shared_ptr< ViewShellManager > &rpViewShellManager)
 Use this method instead of the constructor to create new objects of this class. More...
 

Static Public Attributes

static constexpr OUStringLiteral msToolBar = u"toolbar"
 The set of tool bars that are handled by this manager class. More...
 
static constexpr OUStringLiteral msOptionsToolBar = u"optionsbar"
 
static constexpr OUStringLiteral msCommonTaskToolBar = u"commontaskbar"
 
static constexpr OUStringLiteral msViewerToolBar = u"viewerbar"
 
static constexpr OUStringLiteral msSlideSorterToolBar = u"slideviewtoolbar"
 
static constexpr OUStringLiteral msSlideSorterObjectBar = u"slideviewobjectbar"
 
static constexpr OUStringLiteral msOutlineToolBar = u"outlinetoolbar"
 
static constexpr OUStringLiteral msMasterViewToolBar = u"masterviewtoolbar"
 
static constexpr OUStringLiteral msDrawingObjectToolBar = u"drawingobjectbar"
 
static constexpr OUStringLiteral msGluePointsToolBar = u"gluepointsobjectbar"
 
static constexpr OUStringLiteral msTextObjectBar = u"textobjectbar"
 
static constexpr OUStringLiteral msBezierObjectBar = u"bezierobjectbar"
 
static constexpr OUStringLiteral msGraphicObjectBar = u"graphicobjectbar"
 
static constexpr OUStringLiteral msMediaObjectBar = u"mediaobjectbar"
 
static constexpr OUStringLiteral msTableObjectBar = u"tableobjectbar"
 

Private Member Functions

 ToolBarManager ()
 The ViewShellBase is used to get the XLayoutManager and to determine the plug in mode. More...
 
void LockUpdate ()
 
void UnlockUpdate ()
 

Private Attributes

std::unique_ptr< ImplementationmpImpl
 

Friends

class UpdateLock
 

Detailed Description

Manage the set of visible tool bars (and object bars).

Usually they belong to the current view in the center pane.

Tool bars are managed in groups. Each group can be set, reset, or modified independently of the others. This allows for instance to replace the toolbars associated with the current function independently from those associated with the main view.

The ToolBarManager has two high level methods which contain the knowledge about which tool bars to show in a specific context. When the view in the center pane changes then MainViewShellChanged() sets up the tool bars for the new view. On changes of the selection the SelectionHasChanged() method shows the tool bars for the new context.

The update of the actually visible tool bars to the set currently required by the main view shell and its functions is divided into two parts, PreUpdate() and PostUpdate(). This are to be called before respectively after the update of the view shell stack. The reason for this is to save time by not updating tool bars that will not be visible in a short time on a view shell switch.

Definition at line 59 of file ToolBarManager.hxx.

Member Enumeration Documentation

◆ ToolBarGroup

The set of tool bar groups.

Enumerator
Permanent 
Function 
CommonTask 
MasterMode 
LAST 

Definition at line 130 of file ToolBarManager.hxx.

Constructor & Destructor Documentation

◆ ~ToolBarManager()

sd::ToolBarManager::~ToolBarManager ( )

Definition at line 349 of file ToolBarManager.cxx.

◆ ToolBarManager()

sd::ToolBarManager::ToolBarManager ( )
private

The ViewShellBase is used to get the XLayoutManager and to determine the plug in mode.

Definition at line 345 of file ToolBarManager.cxx.

Referenced by Create().

Member Function Documentation

◆ AddToolBar()

void sd::ToolBarManager::AddToolBar ( ToolBarGroup  eGroup,
const OUString &  rsToolBarName 
)

Add the tool bar with the given name to the specified group of tool bars.

Parameters
rParentShellWhen this shell is not the main view then the method returns immediately.
eGroupThe new tool bar is added to this group.
rsToolBarNameThe base name of the tool bar. A proper prefix (like private:resource/toolbar/) is added. The name may be one of the ones defined above. Other names are allowed as well.

Definition at line 377 of file ToolBarManager.cxx.

References mpImpl.

◆ AddToolBarShell()

void sd::ToolBarManager::AddToolBarShell ( ToolBarGroup  eGroup,
ShellId  nToolBarId 
)

Add the tool bar shell to the shell stack.

This method basically forwards the call to the ViewShellManager. For some tool bar shells additional tool bars are made visible.

Parameters
rParentShellWhen this shell is not the main view then the method returns immediately.
eGroupThe group is used for the actual tool bars.
nToolBarIdId of the tool bar shell.

Definition at line 388 of file ToolBarManager.cxx.

References mpImpl.

◆ Create()

std::shared_ptr< ToolBarManager > sd::ToolBarManager::Create ( ViewShellBase rBase,
const std::shared_ptr< tools::EventMultiplexer > &  rpMultiplexer,
const std::shared_ptr< ViewShellManager > &  rpViewShellManager 
)
static

Use this method instead of the constructor to create new objects of this class.

Definition at line 334 of file ToolBarManager.cxx.

References ToolBarManager().

Referenced by sd::ViewShellBase::LateInit().

◆ LockUpdate()

void sd::ToolBarManager::LockUpdate ( )
private

Definition at line 452 of file ToolBarManager.cxx.

References mpImpl.

◆ LockViewShellManager()

void sd::ToolBarManager::LockViewShellManager ( )

This is a hint for the ToolBarManager to improve the performance when it updates its tool bars when its own lock is released.

Taking control of the release of the update lock of the ViewShellManager avoids some shell stack modifications and tool bar updates.

Definition at line 446 of file ToolBarManager.cxx.

References mpImpl.

◆ MainViewShellChanged() [1/2]

void sd::ToolBarManager::MainViewShellChanged ( )

When the view in the center pane changes then this method sets up the initial set of tool bars for the new view.

The ToolBarManager listens for view switching itself and then calls MainViewShellChanged(). Calling this method from the outside should not be necessary.

Parameters
nShellTypeThe type of the new main view shell.

Definition at line 464 of file ToolBarManager.cxx.

References mpImpl, and sd::ViewShell::ST_NONE.

◆ MainViewShellChanged() [2/2]

void sd::ToolBarManager::MainViewShellChanged ( const ViewShell rMainViewShell)

Definition at line 473 of file ToolBarManager.cxx.

References mpImpl.

◆ PreUpdate()

void sd::ToolBarManager::PreUpdate ( )

◆ RemoveToolBar()

void sd::ToolBarManager::RemoveToolBar ( ToolBarGroup  eGroup,
const OUString &  rsToolBarName 
)

Remove the tool bar with the given name from the specified group.

If the tool bar is not visible then nothing happens. If the tool bar is a member of another group then nothing happens either.

Definition at line 399 of file ToolBarManager.cxx.

References mpImpl.

◆ RequestUpdate()

void sd::ToolBarManager::RequestUpdate ( )

Request an update of the active tool bars.

The update is made asynchronously.

Definition at line 440 of file ToolBarManager.cxx.

References mpImpl.

◆ ResetAllToolBars()

void sd::ToolBarManager::ResetAllToolBars ( )

Reset all tool bars, regardless of the group they belong to.

Parameters
rParentShellWhen this shell is not the main view then the method returns immediately.

Definition at line 368 of file ToolBarManager.cxx.

References mpImpl.

Referenced by sd::ToolBarManager::Implementation::SetValid().

◆ ResetToolBars()

void sd::ToolBarManager::ResetToolBars ( ToolBarGroup  eGroup)

Reset the set of visible object bars in the specified group.

Tool bars in other groups are not affected.

Parameters
rParentShellWhen this shell is not the main view then the method returns immediately.
eGroupOnly the tool bars in this group are rest.

Definition at line 359 of file ToolBarManager.cxx.

References mpImpl.

Referenced by sd::ToolBarManager::Implementation::ResetAllToolBars().

◆ SelectionHasChanged()

void sd::ToolBarManager::SelectionHasChanged ( const ViewShell rViewShell,
const SdrView rView 
)

Call this method when the selection has changed to update the more temporary tool bars (those in the ToolBarGroup::Function group.)

Definition at line 482 of file ToolBarManager.cxx.

References mpImpl.

◆ SetToolBar()

void sd::ToolBarManager::SetToolBar ( ToolBarGroup  eGroup,
const OUString &  rsToolBarName 
)

This is basically a shortcut for ResetToolBars(),AddToolBar().

The main difference is, that all sub shells of the specified parent shell are deactivated as well.

Parameters
rParentShellWhen this shell is not the main view then the method returns immediately.
eGroupThe new tool bar is added to this group.
rsToolBarNameThe base name of the tool bar. A proper prefix (like private:resource/toolbar/) is added. The name may be one of the ones defined above. Other names are allowed as well.

Definition at line 410 of file ToolBarManager.cxx.

References mpImpl.

◆ SetToolBarShell()

void sd::ToolBarManager::SetToolBarShell ( ToolBarGroup  eGroup,
ShellId  nToolBarId 
)

This is basically a shortcut for ResetToolBars(),AddToolBar().

The main difference is, that all sub shells of the specified parent shell are deactivated as well.

Parameters
rParentShellWhen this shell is not the main view then the method returns immediately.
rParentShellWhen this shell is not the main view then the method returns immediately.
eGroupThe group is currently not used.
nToolBarIdId of the tool bar shell.

Definition at line 422 of file ToolBarManager.cxx.

References mpImpl.

◆ Shutdown()

void sd::ToolBarManager::Shutdown ( )

Call this method prior to the destructor to prevent the ToolBarManager from accessing the ViewShellManager or the XLayoutManager when those are possibly not well and alive anymore (like during the destruction of the ViewShellBase.)

Definition at line 353 of file ToolBarManager.cxx.

References mpImpl.

◆ ToolBarsDestroyed()

void sd::ToolBarManager::ToolBarsDestroyed ( )

Definition at line 490 of file ToolBarManager.cxx.

References mpImpl.

◆ UnlockUpdate()

void sd::ToolBarManager::UnlockUpdate ( )
private

Definition at line 458 of file ToolBarManager.cxx.

References mpImpl.

Friends And Related Function Documentation

◆ UpdateLock

friend class UpdateLock
friend

Definition at line 255 of file ToolBarManager.hxx.

Member Data Documentation

◆ mpImpl

std::unique_ptr<Implementation> sd::ToolBarManager::mpImpl
private

◆ msBezierObjectBar

constexpr OUStringLiteral sd::ToolBarManager::msBezierObjectBar = u"bezierobjectbar"
staticconstexpr

Definition at line 119 of file ToolBarManager.hxx.

◆ msCommonTaskToolBar

constexpr OUStringLiteral sd::ToolBarManager::msCommonTaskToolBar = u"commontaskbar"
staticconstexpr

Definition at line 103 of file ToolBarManager.hxx.

Referenced by sd::DrawViewShell::ChangeEditMode().

◆ msDrawingObjectToolBar

constexpr OUStringLiteral sd::ToolBarManager::msDrawingObjectToolBar = u"drawingobjectbar"
staticconstexpr

◆ msGluePointsToolBar

constexpr OUStringLiteral sd::ToolBarManager::msGluePointsToolBar = u"gluepointsobjectbar"
staticconstexpr

Definition at line 115 of file ToolBarManager.hxx.

Referenced by sd::FuEditGluePoints::DoExecute().

◆ msGraphicObjectBar

constexpr OUStringLiteral sd::ToolBarManager::msGraphicObjectBar = u"graphicobjectbar"
staticconstexpr

Definition at line 121 of file ToolBarManager.hxx.

◆ msMasterViewToolBar

constexpr OUStringLiteral sd::ToolBarManager::msMasterViewToolBar = u"masterviewtoolbar"
staticconstexpr

Definition at line 111 of file ToolBarManager.hxx.

Referenced by sd::DrawViewShell::ChangeEditMode().

◆ msMediaObjectBar

constexpr OUStringLiteral sd::ToolBarManager::msMediaObjectBar = u"mediaobjectbar"
staticconstexpr

Definition at line 123 of file ToolBarManager.hxx.

◆ msOptionsToolBar

constexpr OUStringLiteral sd::ToolBarManager::msOptionsToolBar = u"optionsbar"
staticconstexpr

Definition at line 101 of file ToolBarManager.hxx.

◆ msOutlineToolBar

constexpr OUStringLiteral sd::ToolBarManager::msOutlineToolBar = u"outlinetoolbar"
staticconstexpr

Definition at line 110 of file ToolBarManager.hxx.

◆ msSlideSorterObjectBar

constexpr OUStringLiteral sd::ToolBarManager::msSlideSorterObjectBar = u"slideviewobjectbar"
staticconstexpr

Definition at line 108 of file ToolBarManager.hxx.

◆ msSlideSorterToolBar

constexpr OUStringLiteral sd::ToolBarManager::msSlideSorterToolBar = u"slideviewtoolbar"
staticconstexpr

Definition at line 106 of file ToolBarManager.hxx.

◆ msTableObjectBar

constexpr OUStringLiteral sd::ToolBarManager::msTableObjectBar = u"tableobjectbar"
staticconstexpr

Definition at line 125 of file ToolBarManager.hxx.

◆ msTextObjectBar

constexpr OUStringLiteral sd::ToolBarManager::msTextObjectBar = u"textobjectbar"
staticconstexpr

Definition at line 117 of file ToolBarManager.hxx.

◆ msToolBar

constexpr OUStringLiteral sd::ToolBarManager::msToolBar = u"toolbar"
staticconstexpr

The set of tool bars that are handled by this manager class.

Definition at line 100 of file ToolBarManager.hxx.

◆ msViewerToolBar

constexpr OUStringLiteral sd::ToolBarManager::msViewerToolBar = u"viewerbar"
staticconstexpr

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