[Libreoffice-commits] core.git: 2 commits - include/formula include/vcl sc/source svx/source sw/inc vcl/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon May 13 11:13:10 UTC 2019


 include/formula/formula.hxx       |    5 --
 include/vcl/weld.hxx              |    1 
 sc/source/ui/inc/conflictsdlg.hxx |    2 -
 svx/source/dialog/imapwnd.cxx     |   65 ++++++++++++++++----------------------
 svx/source/dialog/imapwnd.hxx     |    4 +-
 sw/inc/pch/precompiled_sw.hxx     |    2 -
 vcl/source/app/salvtables.cxx     |    4 ++
 vcl/unx/gtk3/gtk3gtkinst.cxx      |   10 +++++
 8 files changed, 48 insertions(+), 45 deletions(-)

New commits:
commit fed7c693de1def5211992bac288c3e9936e863bc
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon May 13 09:20:00 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon May 13 13:12:34 2019 +0200

    weld imapmenu
    
    Change-Id: I0cc79534112ae8897a9887942238ff1236c4a3eb
    Reviewed-on: https://gerrit.libreoffice.org/72217
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 646daa1aeea7..e6a28cef778b 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1631,6 +1631,7 @@ public:
     virtual OString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect) = 0;
     virtual void set_sensitive(const OString& rIdent, bool bSensitive) = 0;
     virtual void set_active(const OString& rIdent, bool bActive) = 0;
+    virtual bool get_active(const OString& rIdent) const = 0;
     virtual void set_visible(const OString& rIdent, bool bVisible) = 0;
 
     virtual void insert(int pos, const OUString& rId, const OUString& rStr,
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index 504f93a4d93f..f1c19d230ec6 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -24,6 +24,7 @@
 #include <vcl/imaprect.hxx>
 #include <vcl/imapcirc.hxx>
 #include <vcl/imappoly.hxx>
+#include <vcl/svapp.hxx>
 #include <svl/urlbmk.hxx>
 
 #include <svx/xoutbmp.hxx>
@@ -491,20 +492,20 @@ void IMapWindow::Command(const CommandEvent& rCEvt)
 
     if ( rCEvt.GetCommand() == CommandEventId::ContextMenu )
     {
-        VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svx/ui/imapmenu.ui", "");
-        VclPtr<PopupMenu> aMenu(aBuilder.get_menu("menu"));
+        std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "svx/ui/imapmenu.ui"));
+        mxPopupMenu = xBuilder->weld_menu("menu");
         const SdrMarkList&  rMarkList = pView->GetMarkedObjectList();
         const size_t nMarked = rMarkList.GetMarkCount();
 
-        aMenu->EnableItem(aMenu->GetItemId("url"), false);
-        aMenu->EnableItem(aMenu->GetItemId("active"), false);
-        aMenu->EnableItem(aMenu->GetItemId("macro"), false);
-        aMenu->EnableItem(aMenu->GetItemId("selectall"), pModel->GetPage(0)->GetObjCount() != pView->GetMarkedObjectCount());
+        mxPopupMenu->set_sensitive("url", false);
+        mxPopupMenu->set_sensitive("active", false);
+        mxPopupMenu->set_sensitive("macro", false);
+        mxPopupMenu->set_sensitive("selectall", pModel->GetPage(0)->GetObjCount() != pView->GetMarkedObjectCount());
 
         if ( !nMarked )
         {
-            aMenu->EnableItem(aMenu->GetItemId("arrange"), false);
-            aMenu->EnableItem(aMenu->GetItemId("delete"), false);
+            mxPopupMenu->set_sensitive("arrange", false);
+            mxPopupMenu->set_sensitive("delete", false);
         }
         else
         {
@@ -512,18 +513,19 @@ void IMapWindow::Command(const CommandEvent& rCEvt)
             {
                 SdrObject*  pSdrObj = GetSelectedSdrObject();
 
-                aMenu->EnableItem(aMenu->GetItemId("url"));
-                aMenu->EnableItem(aMenu->GetItemId("active"));
-                aMenu->EnableItem(aMenu->GetItemId("macro"));
-                aMenu->CheckItem("active", GetIMapObj(pSdrObj)->IsActive());
+                mxPopupMenu->set_sensitive("url", true);
+                mxPopupMenu->set_sensitive("active", true);
+                mxPopupMenu->set_sensitive("macro", true);
+                mxPopupMenu->set_active("active", GetIMapObj(pSdrObj)->IsActive());
             }
 
-            aMenu->EnableItem(aMenu->GetItemId("arrange"));
-            aMenu->EnableItem(aMenu->GetItemId("delete"));
+            mxPopupMenu->set_sensitive("arrange", true);
+            mxPopupMenu->set_sensitive("delete", true);
         }
 
-        aMenu->SetSelectHdl( LINK( this, IMapWindow, MenuSelectHdl ) );
-        aMenu->Execute( this, rCEvt.GetMousePosPixel() );
+        MenuSelectHdl(mxPopupMenu->popup_at_rect(GetFrameWeld(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))));
+
+        mxPopupMenu.reset();
     }
     else
         Window::Command(rCEvt);
@@ -713,39 +715,30 @@ void IMapWindow::DoPropertyDialog()
     }
 }
 
-IMPL_LINK( IMapWindow, MenuSelectHdl, Menu*, pMenu, bool )
+void IMapWindow::MenuSelectHdl(const OString& rId)
 {
-    if (!pMenu)
-        return false;
-
-    OString sId = pMenu->GetCurItemIdent();
-
-    if (sId == "url")
+    if (rId == "url")
         DoPropertyDialog();
-    else if (sId == "macro")
+    else if (rId == "macro")
         DoMacroAssign();
-    else if (sId == "active")
+    else if (rId == "active")
     {
-        const sal_uInt16 nActiveId = pMenu->GetItemId(sId);
-        const bool bNewState = !pMenu->IsItemChecked(nActiveId);
-        pMenu->CheckItem(nActiveId, bNewState);
+        const bool bNewState = !mxPopupMenu->get_active(rId);
         SetCurrentObjState(bNewState);
         UpdateInfo( false );
     }
-    else if (sId == "front")
+    else if (rId == "front")
         pView->PutMarkedToTop();
-    else if (sId == "forward")
+    else if (rId == "forward")
         pView->MovMarkedToTop();
-    else if (sId == "backward")
+    else if (rId == "backward")
         pView->MovMarkedToBtm();
-    else if (sId == "back")
+    else if (rId == "back")
         pView->PutMarkedToBtm();
-    else if (sId == "selectall")
+    else if (rId == "selectall")
         pView->MarkAll();
-    else if (sId == "delete")
+    else if (rId == "delete")
         pView->DeleteMarked();
-
-    return false;
 }
 
 void IMapWindow::CreateDefaultObject()
diff --git a/svx/source/dialog/imapwnd.hxx b/svx/source/dialog/imapwnd.hxx
index 5a69d5593a7d..049eb88cea39 100644
--- a/svx/source/dialog/imapwnd.hxx
+++ b/svx/source/dialog/imapwnd.hxx
@@ -79,7 +79,9 @@ class IMapWindow final : public GraphCtrl, public DropTargetHelper
     css::uno::Reference< css::frame::XFrame >
                         mxDocumentFrame;
 
-                        DECL_LINK( MenuSelectHdl, Menu*, bool );
+    std::unique_ptr<weld::Menu> mxPopupMenu;
+
+    void                MenuSelectHdl(const OString& rId);
 
     // GraphCtrl
     virtual void        MouseButtonUp(const MouseEvent& rMEvt) override;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 16cdc0d37a5f..47cce4712db6 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -837,6 +837,10 @@ public:
     {
         m_xMenu->CheckItem(rIdent, bActive);
     }
+    virtual bool get_active(const OString& rIdent) const override
+    {
+        return m_xMenu->IsItemChecked(m_xMenu->GetItemId(rIdent));
+    }
     virtual void set_visible(const OString& rIdent, bool bShow) override
     {
         m_xMenu->ShowItem(m_xMenu->GetItemId(rIdent), bShow);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 1b4ab74b4c96..cf554c95f6f5 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2447,6 +2447,11 @@ public:
         enable_item_notify_events();
     }
 
+    bool get_item_active(const OString& rIdent) const
+    {
+        return gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(m_aMap.find(rIdent)->second));
+    }
+
     void set_item_label(const OString& rIdent, const OUString& rText)
     {
         gtk_menu_item_set_label(m_aMap[rIdent], MapToGtkAccelerator(rText).getStr());
@@ -5201,6 +5206,11 @@ public:
         set_item_active(rIdent, bActive);
     }
 
+    virtual bool get_active(const OString& rIdent) const override
+    {
+        return get_item_active(rIdent);
+    }
+
     virtual void set_visible(const OString& rIdent, bool bShow) override
     {
         set_item_visible(rIdent, bShow);
commit d67b8df027545b686f83c7bd9530758b133ab3d3
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun May 12 21:49:54 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon May 13 13:12:22 2019 +0200

    drop some more unneeded includes
    
    Change-Id: Iec71ca870db5f6aaf317e23db369dfc1fa04bcc1
    Reviewed-on: https://gerrit.libreoffice.org/72205
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/formula/formula.hxx b/include/formula/formula.hxx
index 5c1db3aca36b..c6a237ac9d59 100644
--- a/include/formula/formula.hxx
+++ b/include/formula/formula.hxx
@@ -31,16 +31,11 @@
 #include <sfx2/basedlgs.hxx>
 #include <tools/gen.hxx>
 #include <tools/link.hxx>
-#include <vcl/dialog.hxx>
 
 class NotifyEvent;
 class SfxBindings;
 class SfxChildWindow;
 
-namespace vcl {
-    class Window;
-}
-
 namespace formula
 {
 
diff --git a/sc/source/ui/inc/conflictsdlg.hxx b/sc/source/ui/inc/conflictsdlg.hxx
index 4f32a398d0de..6dd77521d815 100644
--- a/sc/source/ui/inc/conflictsdlg.hxx
+++ b/sc/source/ui/inc/conflictsdlg.hxx
@@ -20,8 +20,6 @@
 #ifndef INCLUDED_SC_SOURCE_UI_INC_CONFLICTSDLG_HXX
 #define INCLUDED_SC_SOURCE_UI_INC_CONFLICTSDLG_HXX
 
-#include <vcl/button.hxx>
-#include <vcl/dialog.hxx>
 #include <vcl/idle.hxx>
 #include <svx/ctredlin.hxx>
 
diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx
index e179ab653aad..3a3fa0f679b6 100644
--- a/sw/inc/pch/precompiled_sw.hxx
+++ b/sw/inc/pch/precompiled_sw.hxx
@@ -104,7 +104,6 @@
 #include <vcl/image.hxx>
 #include <vcl/imap.hxx>
 #include <vcl/imapobj.hxx>
-#include <vcl/lstbox.hxx>
 #include <vcl/mapmod.hxx>
 #include <vcl/metric.hxx>
 #include <vcl/outdev.hxx>
@@ -274,6 +273,7 @@
 #include <o3tl/any.hxx>
 #include <o3tl/cow_wrapper.hxx>
 #include <o3tl/safeint.hxx>
+#include <o3tl/sorted_vector.hxx>
 #include <o3tl/strong_int.hxx>
 #include <o3tl/typed_flags_set.hxx>
 #include <o3tl/underlyingenumvalue.hxx>


More information about the Libreoffice-commits mailing list