framework/source/uielement/popuptoolbarcontroller.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
New commits: commit da2b2c9b3d2b3165f237cdde589f44e7d19a2bc0 Author: Maxim Monastirsky <momonas...@gmail.com> AuthorDate: Wed Jan 20 17:38:29 2021 +0200 Commit: Maxim Monastirsky <momonas...@gmail.com> CommitDate: Thu Jan 21 11:31:18 2021 +0100 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.tie...@documentfoundation.org> Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> 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 ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits