summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-12-02 14:20:20 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2024-12-02 19:27:56 +0100
commit185f7fa290d2d7e6f79b543acdc239323f727a5e (patch)
tree94a0f67cf2da64b91a12b62f7e81e233a7ca0504 /vcl
parent88a6a8eb9a0b30a25a6996cd8677b47a42f4822a (diff)
vcl: Switch MenuBar::ImplCreate param to MenuBarWindow*
This avoids the need to do a dynamic_cast and makes clear that this method always gets called with either a window of a proper type or nullptr. Change-Id: I8ca4020476c806ad423379c7c7ee6fdc6ceccd3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177697 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/menu.cxx4
-rw-r--r--vcl/source/window/syswin.cxx12
2 files changed, 9 insertions, 7 deletions
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index ff6581d207a9..6bc427ba28f3 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2483,9 +2483,9 @@ void MenuBar::SetDisplayable( bool bDisplayable )
}
}
-VclPtr<vcl::Window> MenuBar::ImplCreate(vcl::Window* pParent, vcl::Window* pWindow, MenuBar* pMenu)
+VclPtr<MenuBarWindow> MenuBar::ImplCreate(vcl::Window* pParent, MenuBarWindow* pWindow, MenuBar* pMenu)
{
- VclPtr<MenuBarWindow> pMenuBarWindow = dynamic_cast<MenuBarWindow*>(pWindow);
+ VclPtr<MenuBarWindow> pMenuBarWindow = pWindow;
if (!pMenuBarWindow)
{
pMenuBarWindow = VclPtr<MenuBarWindow>::Create(pParent);
diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index d4e1f9e51997..e92806e739fe 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -19,6 +19,8 @@
#include <memory>
+#include "menubarwindow.hxx"
+
#include <o3tl/safeint.hxx>
#include <sal/config.h>
#include <sal/log.hxx>
@@ -844,14 +846,14 @@ void SystemWindow::SetMenuBar(MenuBar* pMenuBar)
return;
MenuBar* pOldMenuBar = mpMenuBar;
- vcl::Window* pOldWindow = nullptr;
- VclPtr<vcl::Window> pNewWindow;
+ MenuBarWindow* pOldWindow = nullptr;
+ VclPtr<MenuBarWindow> pNewWindow;
mpMenuBar = pMenuBar;
if ( mpWindowImpl->mpBorderWindow && (mpWindowImpl->mpBorderWindow->GetType() == WindowType::BORDERWINDOW) )
{
if ( pOldMenuBar )
- pOldWindow = pOldMenuBar->GetWindow();
+ pOldWindow = pOldMenuBar->getMenuBarWindow();
else
pOldWindow = nullptr;
if ( pOldWindow )
@@ -888,9 +890,9 @@ void SystemWindow::SetMenuBar(MenuBar* pMenuBar)
else
{
if( pMenuBar )
- pNewWindow = pMenuBar->GetWindow();
+ pNewWindow = pMenuBar->getMenuBarWindow();
if( pOldMenuBar )
- pOldWindow = pOldMenuBar->GetWindow();
+ pOldWindow = pOldMenuBar->getMenuBarWindow();
}
// update taskpane list to make menubar accessible