tdf#139696 Use getToolboxId to set item id
This code depends on ToolboxController::m_nToolBoxId being already set, which is the case for toolbars, as passed by ToolBarManager::CreateControllers via the "Identifier" property, but not for the notebookbar, as can be seen in sfx2::sidebar::ControllerFactory::CreateToolBarController. Avoid this problem by using getToolboxId, like in most other toolbar controls. Change-Id: I5dfb1bda0886ce3542274a422f8c9111e7fdcf7e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109722 Tested-by: Jenkins Tested-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
This commit is contained in:
@@ -149,12 +149,13 @@ void SAL_CALL PopupMenuToolbarController::initialize(
|
|||||||
}
|
}
|
||||||
|
|
||||||
SolarMutexGuard aSolarLock;
|
SolarMutexGuard aSolarLock;
|
||||||
VclPtr< ToolBox > pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() );
|
ToolBox* pToolBox = nullptr;
|
||||||
if ( pToolBox )
|
sal_uInt16 nItemId = 0;
|
||||||
|
if ( getToolboxId( nItemId, &pToolBox ) )
|
||||||
{
|
{
|
||||||
ToolBoxItemBits nCurStyle( pToolBox->GetItemBits( m_nToolBoxId ) );
|
ToolBoxItemBits nCurStyle( pToolBox->GetItemBits( nItemId ) );
|
||||||
ToolBoxItemBits nSetStyle( getDropDownStyle() );
|
ToolBoxItemBits nSetStyle( getDropDownStyle() );
|
||||||
pToolBox->SetItemBits( m_nToolBoxId,
|
pToolBox->SetItemBits( nItemId,
|
||||||
m_bHasController ?
|
m_bHasController ?
|
||||||
nCurStyle | nSetStyle :
|
nCurStyle | nSetStyle :
|
||||||
nCurStyle & ~nSetStyle );
|
nCurStyle & ~nSetStyle );
|
||||||
|
Reference in New Issue
Block a user