include/vcl/builder.hxx       |    4 ++--
 vcl/source/window/builder.cxx |    8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit c88cd599d445b3d5ee3c867a14ea14c67d18e9e9
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Sun Nov 10 20:35:08 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon Nov 11 01:50:22 2024 +0100

    VClBuilder: Avoid casting by using PopupMenu directly
    
    Now that GtkMenuBar support was dropped in
    
        Change-Id: I550c83c6d5d13a5e45dc9332e981bae8b0f0a9a3
    
        commit fa245e4eea218b3c707998e597c526b9d1fdb508
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Sun Nov 10 20:24:11 2024 +0100
    
            tdf#130857 VclBuilder: Drop unused "GtkMenuBar" support
    
    , use PopupMenu directly in MenuAndId instead of just the
    Menu base class, which makes it unnecessary to cast when
    a PopupMenu is wanted.
    
    Change-Id: I51a44f219970f29a12aa15ee58e8512c62fca43e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176358
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx
index 10e908894e85..9c26c0890e3a 100644
--- a/include/vcl/builder.hxx
+++ b/include/vcl/builder.hxx
@@ -134,8 +134,8 @@ private:
     struct MenuAndId
     {
         OUString m_sID;
-        VclPtr<Menu> m_pMenu;
-        MenuAndId(OUString sId, Menu *pMenu);
+        VclPtr<PopupMenu> m_pMenu;
+        MenuAndId(OUString sId, PopupMenu *pMenu);
     };
     std::vector<MenuAndId> m_aMenus;
 
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index d7d293fe7cb7..f90efaf34772 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -3013,7 +3013,7 @@ std::vector<ComboBoxTextItem> 
BuilderBase::handleItems(xmlreader::XmlReader& rea
 
 void VclBuilder::handleMenu(xmlreader::XmlReader& reader, const OUString& rID)
 {
-    VclPtr<Menu> pCurrentMenu = VclPtr<PopupMenu>::Create();
+    VclPtr<PopupMenu> pCurrentMenu = VclPtr<PopupMenu>::Create();
     pCurrentMenu->set_id(rID);
 
     int nLevel = 1;
@@ -3147,7 +3147,7 @@ void VclBuilder::handleMenuObject(Menu *pParent, 
xmlreader::XmlReader &reader)
                 handleChild(nullptr, &aAtkProperties, reader);
                 bool bSubMenuInserted = m_aMenus.size() > nChildMenuIdx;
                 if (bSubMenuInserted)
-                    pSubMenu = 
dynamic_cast<PopupMenu*>(m_aMenus[nChildMenuIdx].m_pMenu.get());
+                    pSubMenu = m_aMenus[nChildMenuIdx].m_pMenu.get();
             }
             else
             {
@@ -3871,7 +3871,7 @@ PopupMenu *VclBuilder::get_menu(std::u16string_view sID)
     for (auto const& menu : m_aMenus)
     {
         if (menu.m_sID == sID)
-            return dynamic_cast<PopupMenu*>(menu.m_pMenu.get());
+            return menu.m_pMenu.get();
     }
 
     return nullptr;
@@ -4195,7 +4195,7 @@ VclBuilder::VclParserState::VclParserState()
     , m_nLastMenuItemId(0)
 {}
 
-VclBuilder::MenuAndId::MenuAndId(OUString aId, Menu *pMenu)
+VclBuilder::MenuAndId::MenuAndId(OUString aId, PopupMenu *pMenu)
     : m_sID(std::move(aId))
     , m_pMenu(pMenu)
 {}

Reply via email to