LibreOffice Module framework (master) 1
Static Public Member Functions | Private Member Functions | List of all members
framework::ToolBarMerger Class Reference

#include <toolbarmerger.hxx>

Static Public Member Functions

static bool IsCorrectContext (std::u16string_view aContext, std::u16string_view aModuleIdentifier)
 Check whether a module identifier is part of a context defined by a colon separated list of module identifier. More...
 
static void ConvertSeqSeqToVector (const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > &rSequence, AddonToolbarItemContainer &rContainer)
 Converts a sequence, sequence of property values to a vector of structs. More...
 
static void ConvertSequenceToValues (const css::uno::Sequence< css::beans::PropertyValue > &rSequence, OUString &rCommandURL, OUString &rLabel, OUString &rTarget, OUString &rContext, OUString &rControlType, sal_uInt16 &rWidth)
 Converts a sequence of property values to single values. More...
 
static ReferenceToolbarPathInfo FindReferencePoint (const ToolBox *pToolbar, sal_uInt16 nFirstItem, std::u16string_view rReferencePoint)
 Tries to find the reference point provided and delivers position and result of the search process. More...
 
static bool ProcessMergeOperation (ToolBox *pToolbar, ToolBox::ImplToolItems::size_type nPos, ToolBoxItemId &rItemId, CommandToInfoMap &rCommandMap, std::u16string_view rModuleIdentifier, std::u16string_view rMergeCommand, std::u16string_view rMergeCommandParameter, const AddonToolbarItemContainer &rItems)
 Processes a merge operation. More...
 
static bool ProcessMergeFallback (ToolBox *pToolbar, ToolBoxItemId &rItemId, CommandToInfoMap &rCommandMap, std::u16string_view rModuleIdentifier, std::u16string_view rMergeCommand, std::u16string_view rMergeFallback, const AddonToolbarItemContainer &rItems)
 Processes a merge fallback operation. More...
 
static void MergeItems (ToolBox *pToolbar, ToolBox::ImplToolItems::size_type nPos, sal_uInt16 nModIndex, ToolBoxItemId &rItemId, CommandToInfoMap &rCommandMap, std::u16string_view rModuleIdentifier, const AddonToolbarItemContainer &rAddonToolbarItems)
 Merges (adds) toolbar items into an existing toolbar. More...
 
static void ReplaceItem (ToolBox *pToolbar, ToolBox::ImplToolItems::size_type nPos, ToolBoxItemId &rItemId, CommandToInfoMap &rCommandMap, std::u16string_view rModuleIdentifier, const AddonToolbarItemContainer &rAddonToolbarItems)
 Replaces a toolbar item with new items for an existing toolbar. More...
 
static void RemoveItems (ToolBox *pToolbar, ToolBox::ImplToolItems::size_type nPos, std::u16string_view rMergeCommandParameter)
 Removes toolbar items from an existing toolbar. More...
 
static rtl::Reference<::cppu::OWeakObjectCreateController (const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::frame::XFrame > &xFrame, ToolBox *pToolbar, const OUString &rCommandURL, ToolBoxItemId nId, sal_uInt16 nWidth, std::u16string_view rControlType)
 Removes toolbar items from an existing toolbar. More...
 
static void CreateToolbarItem (ToolBox *pToolbox, ToolBox::ImplToolItems::size_type nPos, ToolBoxItemId nItemId, const AddonToolbarItem &rAddonToolbarItem)
 

Private Member Functions

 ToolBarMerger (const ToolBarMerger &)=delete
 
ToolBarMergeroperator= (const ToolBarMerger &)=delete
 

Detailed Description

Definition at line 62 of file toolbarmerger.hxx.

Constructor & Destructor Documentation

◆ ToolBarMerger()

framework::ToolBarMerger::ToolBarMerger ( const ToolBarMerger )
privatedelete

Member Function Documentation

◆ ConvertSeqSeqToVector()

void framework::ToolBarMerger::ConvertSeqSeqToVector ( const css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > &  rSequence,
AddonToolbarItemContainer rContainer 
)
static

Converts a sequence, sequence of property values to a vector of structs.

Parameters
rSequence

Provides a sequence, sequence of property values.

Parameters
rContainer

A vector of AddonToolbarItems which will hold the conversion from the rSequence argument.

Definition at line 117 of file toolbarmerger.cxx.

References framework::AddonToolbarItem::aCommandURL, framework::AddonToolbarItem::aContext, framework::AddonToolbarItem::aControlType, framework::AddonToolbarItem::aLabel, framework::AddonToolbarItem::aTarget, ConvertSequenceToValues(), i, and framework::AddonToolbarItem::nWidth.

◆ ConvertSequenceToValues()

void framework::ToolBarMerger::ConvertSequenceToValues ( const css::uno::Sequence< css::beans::PropertyValue > &  rSequence,
OUString &  rCommandURL,
OUString &  rLabel,
OUString &  rTarget,
OUString &  rContext,
OUString &  rControlType,
sal_uInt16 &  rWidth 
)
static

Converts a sequence of property values to single values.

Parameters
rSequence

Provides a sequence of property values.

Parameters
rCommandURL

Contains the value of the property with Name="CommandURL".

Parameters
rLabel

Contains the value of the property with Name="Title"

Parameters
rTarget

Contains the value of the property with Name="Target"

Parameters
rContext

Contains the value of the property with Name="Context"

Parameters
rControlType

Contains the value of the property with Name="ControlType"

Returns
All possible mapping between sequence of property values and the single values are done.

Definition at line 180 of file toolbarmerger.cxx.

References framework::MERGE_TOOLBAR_CONTEXT, framework::MERGE_TOOLBAR_CONTROLTYPE, framework::MERGE_TOOLBAR_TARGET, framework::MERGE_TOOLBAR_TITLE, framework::MERGE_TOOLBAR_URL, framework::MERGE_TOOLBAR_WIDTH, and rTarget.

Referenced by ConvertSeqSeqToVector().

◆ CreateController()

rtl::Reference<::cppu::OWeakObject > framework::ToolBarMerger::CreateController ( const css::uno::Reference< css::uno::XComponentContext > &  rxContext,
const css::uno::Reference< css::frame::XFrame > &  xFrame,
ToolBox pToolbar,
const OUString &  rCommandURL,
ToolBoxItemId  nId,
sal_uInt16  nWidth,
std::u16string_view  rControlType 
)
static

Removes toolbar items from an existing toolbar.

Parameters
pToolbar

A valid pointer to the toolbar where the merge fall back operation is applied to.

Parameters
nPos

The reference position of the toolbar item for the merge operation. Value must be between 0 and number of toolbar items - 1.

Parameters
rMergeCommandParameter.

An optional argument for the merge command.

Returns
Returns true for a successful operation otherwise false.

Definition at line 590 of file toolbarmerger.cxx.

References framework::ToggleButtonToolbarController::DropDownButton, nId, framework::ToggleButtonToolbarController::ToggleDropDownButton, framework::TOOLBARCONTROLLER_BUTTON, framework::TOOLBARCONTROLLER_COMBOBOX, framework::TOOLBARCONTROLLER_DROPDOWNBOX, framework::TOOLBARCONTROLLER_DROPDOWNBTN, framework::TOOLBARCONTROLLER_EDIT, framework::TOOLBARCONTROLLER_FIXEDIMAGE, framework::TOOLBARCONTROLLER_FIXEDTEXT, framework::TOOLBARCONTROLLER_IMGBUTTON, framework::TOOLBARCONTROLLER_SPINFIELD, framework::TOOLBARCONTROLLER_TOGGLEDDBTN, and xFrame.

◆ CreateToolbarItem()

void framework::ToolBarMerger::CreateToolbarItem ( ToolBox pToolbox,
ToolBox::ImplToolItems::size_type  nPos,
ToolBoxItemId  nItemId,
const AddonToolbarItem rAddonToolbarItem 
)
static

◆ FindReferencePoint()

ReferenceToolbarPathInfo framework::ToolBarMerger::FindReferencePoint ( const ToolBox pToolbar,
sal_uInt16  nFirstItem,
std::u16string_view  rReferencePoint 
)
static

Tries to find the reference point provided and delivers position and result of the search process.

Parameters
pToolbar

Must be a valid pointer to a toolbar with items which should be searched.

Parameters
nFirstItem

First toolbar item to search from.

Parameters
rReferencePoint

A command URL which should be the reference point for the coming merge operation.

Returns
Provides information about the search result, the position of the reference point and the toolbar used.

Definition at line 234 of file toolbarmerger.cxx.

References framework::ReferenceToolbarPathInfo::bResult, ToolBox::GetItemCommand(), ToolBox::GetItemCount(), ToolBox::GetItemId(), i, ToolBox::ITEM_NOTFOUND, and framework::ReferenceToolbarPathInfo::nPos.

◆ IsCorrectContext()

bool framework::ToolBarMerger::IsCorrectContext ( std::u16string_view  rContext,
std::u16string_view  rModuleIdentifier 
)
static

Check whether a module identifier is part of a context defined by a colon separated list of module identifier.

Parameters
rContext

Describes a context string list where all contexts are delimited by a colon. For more information about the module identifier used as context strings see the IDL description of css::frame::XModuleManager

Parameters
rModuleIdentifier

A string describing a module identifier. See IDL description of css::frame::XModuleManager.

Returns
The result is true if the rContext is an empty string or rModuleIdentifier is part of the context string.

Definition at line 95 of file toolbarmerger.cxx.

Referenced by MergeItems().

◆ MergeItems()

void framework::ToolBarMerger::MergeItems ( ToolBox pToolbar,
ToolBox::ImplToolItems::size_type  nPos,
sal_uInt16  nModIndex,
ToolBoxItemId rItemId,
CommandToInfoMap rCommandMap,
std::u16string_view  rModuleIdentifier,
const AddonToolbarItemContainer rAddonToolbarItems 
)
static

Merges (adds) toolbar items into an existing toolbar.

Parameters
pToolbar

A valid pointer to the toolbar where the merge fall back operation is applied to.

Parameters
nPos

The reference position of the toolbar item for the merge operation. Value must be between 0 and number of toolbar items - 1.

Parameters
rItemId

A unique item ID.

Parameters
rModuleIdentifier

The current application module context.

Parameters
rItems

Toolbar items which are associated to the merge command.

Definition at line 434 of file toolbarmerger.cxx.

References framework::AddonToolbarItem::aCommandURL, framework::AddonToolbarItem::aContext, ToolBox::APPEND, CreateToolbarItem(), ToolBox::GetItemCount(), i, ToolBox::InsertSeparator(), IsCorrectContext(), framework::CommandInfo::nId, nPos, and framework::TOOLBOXITEM_SEPARATOR_STR.

Referenced by ProcessMergeFallback(), ProcessMergeOperation(), and ReplaceItem().

◆ operator=()

ToolBarMerger & framework::ToolBarMerger::operator= ( const ToolBarMerger )
privatedelete

◆ ProcessMergeFallback()

bool framework::ToolBarMerger::ProcessMergeFallback ( ToolBox pToolbar,
ToolBoxItemId rItemId,
CommandToInfoMap rCommandMap,
std::u16string_view  rModuleIdentifier,
std::u16string_view  rMergeCommand,
std::u16string_view  rMergeFallback,
const AddonToolbarItemContainer rItems 
)
static

Processes a merge fallback operation.

Parameters
pToolbar

A valid pointer to the toolbar where the merge fall back operation is applied to.

Parameters
nPos

The reference position of the toolbar item for the merge operation. Value must be between 0 and number of toolbar items - 1.

Parameters
rItemId

A unique item ID.

Parameters
rModuleIdentifier

The current application module context.

Parameters
rMergeCommand

A merge command.

Parameters
rItems

Toolbar items which are associated to the merge command.

Returns
Returns true for a successful operation otherwise false.

Definition at line 372 of file toolbarmerger.cxx.

References ToolBox::APPEND, framework::MERGECOMMAND_ADDAFTER, framework::MERGECOMMAND_ADDBEFORE, framework::MERGECOMMAND_REMOVE, framework::MERGECOMMAND_REPLACE, framework::MERGEFALLBACK_ADDFIRST, framework::MERGEFALLBACK_ADDLAST, framework::MERGEFALLBACK_IGNORE, and MergeItems().

◆ ProcessMergeOperation()

bool framework::ToolBarMerger::ProcessMergeOperation ( ToolBox pToolbar,
ToolBox::ImplToolItems::size_type  nPos,
ToolBoxItemId rItemId,
CommandToInfoMap rCommandMap,
std::u16string_view  rModuleIdentifier,
std::u16string_view  rMergeCommand,
std::u16string_view  rMergeCommandParameter,
const AddonToolbarItemContainer rItems 
)
static

Processes a merge operation.

Parameters
pToolbar

A valid pointer to the toolbar where the merge operation is applied to.

Parameters
nPos

The reference position of the toolbar item for the merge operation. Value must be between 0 and number of toolbar items - 1.

Parameters
rItemId

A unique item ID.

Parameters
rModuleIdentifier

The current application module context.

Parameters
rMergeCommand

A merge command.

Parameters
rMergeCommandParameter.

An optional argument for the merge command.

Parameters
rItems

Toolbar items which are associated to the merge command.

Returns
Returns true for a successful operation otherwise false.

Definition at line 308 of file toolbarmerger.cxx.

References framework::MERGECOMMAND_ADDAFTER, framework::MERGECOMMAND_ADDBEFORE, framework::MERGECOMMAND_REMOVE, framework::MERGECOMMAND_REPLACE, MergeItems(), nPos, RemoveItems(), and ReplaceItem().

◆ RemoveItems()

void framework::ToolBarMerger::RemoveItems ( ToolBox pToolbar,
ToolBox::ImplToolItems::size_type  nPos,
std::u16string_view  rMergeCommandParameter 
)
static

Removes toolbar items from an existing toolbar.

Parameters
pToolbar

A valid pointer to the toolbar where the merge fall back operation is applied to.

Parameters
nPos

The reference position of the toolbar item for the merge operation. Value must be between 0 and number of toolbar items - 1.

Parameters
rMergeCommandParameter.

An optional argument for the merge command.

Definition at line 549 of file toolbarmerger.cxx.

References i, nCount, nPos, ToolBox::RemoveItem(), and o3tl::toInt32().

Referenced by ProcessMergeOperation().

◆ ReplaceItem()

void framework::ToolBarMerger::ReplaceItem ( ToolBox pToolbar,
ToolBox::ImplToolItems::size_type  nPos,
ToolBoxItemId rItemId,
CommandToInfoMap rCommandMap,
std::u16string_view  rModuleIdentifier,
const AddonToolbarItemContainer rAddonToolbarItems 
)
static

Replaces a toolbar item with new items for an existing toolbar.

Parameters
pToolbar

A valid pointer to the toolbar where the merge fall back operation is applied to.

Parameters
nPos

The reference position of the toolbar item for the merge operation. Value must be between 0 and number of toolbar items - 1.

Parameters
rItemId

A unique item ID.

Parameters
rModuleIdentifier

The current application module context.

Parameters
rItems

Toolbar items which are associated to the merge command.

Definition at line 516 of file toolbarmerger.cxx.

References MergeItems(), nPos, and ToolBox::RemoveItem().

Referenced by ProcessMergeOperation().


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