diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2021-01-20 17:38:29 +0200 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2021-01-21 11:31:18 +0100 |
commit | da2b2c9b3d2b3165f237cdde589f44e7d19a2bc0 (patch) | |
tree | 702fb106cf41810b0fd3038cd128cafa9b19481f /framework | |
parent | 2c96bd26ec488d865370fe9d394e7c4e228e05ab (diff) |
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>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/uielement/popuptoolbarcontroller.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index efe2eb82f12c..36ad65f19cc2 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -149,12 +149,13 @@ void SAL_CALL PopupMenuToolbarController::initialize( } SolarMutexGuard aSolarLock; - VclPtr< ToolBox > pToolBox = static_cast< ToolBox* >( VCLUnoHelper::GetWindow( getParent() ).get() ); - if ( pToolBox ) + ToolBox* pToolBox = nullptr; + sal_uInt16 nItemId = 0; + if ( getToolboxId( nItemId, &pToolBox ) ) { - ToolBoxItemBits nCurStyle( pToolBox->GetItemBits( m_nToolBoxId ) ); + ToolBoxItemBits nCurStyle( pToolBox->GetItemBits( nItemId ) ); ToolBoxItemBits nSetStyle( getDropDownStyle() ); - pToolBox->SetItemBits( m_nToolBoxId, + pToolBox->SetItemBits( nItemId, m_bHasController ? nCurStyle | nSetStyle : nCurStyle & ~nSetStyle ); |