include/vcl/menu.hxx | 4 ++-- vcl/source/window/menu.cxx | 25 +++++++++++++------------ vcl/source/window/syswin.cxx | 4 ++-- 3 files changed, 17 insertions(+), 16 deletions(-)
New commits: commit feca6f01456e3a01695ed61a79a791a5b0b6e5ba Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Apr 25 06:38:49 2025 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri Apr 25 09:17:01 2025 +0200 These methods should not be static Change-Id: Ie138b0a6248bae23acb40c07abdc3a8cf8eb7100 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184598 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx index 63e68b6b32fc..2d610d68ca8e 100644 --- a/include/vcl/menu.hxx +++ b/include/vcl/menu.hxx @@ -425,8 +425,8 @@ class VCL_DLLPUBLIC MenuBar final : public Menu friend class MenuBarWindow; friend class SystemWindow; - SAL_DLLPRIVATE static VclPtr<MenuBarWindow> ImplCreate(vcl::Window* pParent, MenuBarWindow* pWindow, MenuBar* pMenu); - SAL_DLLPRIVATE static void ImplDestroy(MenuBar* pMenu, bool bDelete); + SAL_DLLPRIVATE VclPtr<MenuBarWindow> ImplCreate(vcl::Window* pParent, MenuBarWindow* pWindow); + SAL_DLLPRIVATE void ImplDestroy(bool bDelete); SAL_DLLPRIVATE bool ImplHandleKeyEvent(const KeyEvent& rKEvent); SAL_DLLPRIVATE bool ImplHandleCmdEvent(const CommandEvent& rCEvent); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index bdb5bba774fa..8603eb183a11 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2452,7 +2452,7 @@ MenuBar::~MenuBar() void MenuBar::dispose() { - ImplDestroy( this, true ); + ImplDestroy(true); Menu::dispose(); } @@ -2508,7 +2508,7 @@ void MenuBar::SetDisplayable( bool bDisplayable ) } } -VclPtr<MenuBarWindow> MenuBar::ImplCreate(vcl::Window* pParent, MenuBarWindow* pWindow, MenuBar* pMenu) +VclPtr<MenuBarWindow> MenuBar::ImplCreate(vcl::Window* pParent, MenuBarWindow* pWindow) { VclPtr<MenuBarWindow> pMenuBarWindow = pWindow; if (!pMenuBarWindow) @@ -2516,14 +2516,14 @@ VclPtr<MenuBarWindow> MenuBar::ImplCreate(vcl::Window* pParent, MenuBarWindow* p pMenuBarWindow = VclPtr<MenuBarWindow>::Create(pParent); } - pMenu->pStartedFrom = nullptr; - pMenu->m_pWindow = pMenuBarWindow; - pMenuBarWindow->SetMenu(pMenu); - tools::Long nHeight = pMenu->ImplCalcSize(pMenuBarWindow).Height(); + pStartedFrom = nullptr; + m_pWindow = pMenuBarWindow; + pMenuBarWindow->SetMenu(this); + tools::Long nHeight = ImplCalcSize(pMenuBarWindow).Height(); // depending on the native implementation or the displayable flag // the menubar windows is suppressed (ie, height=0) - if (!pMenu->IsDisplayable() || (pMenu->ImplGetSalMenu() && pMenu->ImplGetSalMenu()->VisibleMenuBar())) + if (!IsDisplayable() || (ImplGetSalMenu() && ImplGetSalMenu()->VisibleMenuBar())) { nHeight = 0; } @@ -2532,17 +2532,18 @@ VclPtr<MenuBarWindow> MenuBar::ImplCreate(vcl::Window* pParent, MenuBarWindow* p return pMenuBarWindow; } -void MenuBar::ImplDestroy( MenuBar* pMenu, bool bDelete ) +void MenuBar::ImplDestroy(bool bDelete) { - MenuBarWindow* pMenuWin = pMenu->getMenuBarWindow(); + MenuBarWindow* pMenuWin = getMenuBarWindow(); if (pMenuWin && bDelete) { pMenuWin->KillActivePopup(); pMenuWin->disposeOnce(); } - pMenu->m_pWindow = nullptr; - if (pMenu->mpSalMenu) { - pMenu->mpSalMenu->ShowMenuBar(false); + m_pWindow = nullptr; + if (mpSalMenu) + { + mpSalMenu->ShowMenuBar(false); } } diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index f894d4910f3e..046a66aa1d56 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -877,7 +877,7 @@ void SystemWindow::SetMenuBar(MenuBar* pMenuBar) { SAL_WARN_IF( pMenuBar->m_pWindow, "vcl", "SystemWindow::SetMenuBar() - MenuBars can only set in one SystemWindow at time" ); - pNewWindow = MenuBar::ImplCreate(mpWindowImpl->mpBorderWindow, pOldWindow, pMenuBar); + pNewWindow = pMenuBar->ImplCreate(mpWindowImpl->mpBorderWindow, pOldWindow); static_cast<ImplBorderWindow*>(mpWindowImpl->mpBorderWindow.get())->SetMenuBarWindow(pNewWindow); CallEventListeners( VclEventId::WindowMenubarAdded, static_cast<void*>(pMenuBar) ); @@ -893,7 +893,7 @@ void SystemWindow::SetMenuBar(MenuBar* pMenuBar) if( mpImplData->mpTaskPaneList ) mpImplData->mpTaskPaneList->RemoveWindow( pOldWindow ); } - MenuBar::ImplDestroy( pOldMenuBar, bDelete ); + pOldMenuBar->ImplDestroy(bDelete); if( bDelete ) pOldWindow = nullptr; // will be deleted in MenuBar::ImplDestroy, }