[Libreoffice-commits] core.git: include/sfx2 sfx2/source

Akshay Deep akshaydeepiitr at gmail.com
Thu Jun 9 12:42:31 UTC 2016


 include/sfx2/templateabstractview.hxx        |    4 +--
 include/sfx2/templatedlg.hxx                 |    2 -
 sfx2/source/control/templateabstractview.cxx |   24 +++++++++++++++++--
 sfx2/source/control/templatesearchview.cxx   |   33 ++++++++++++++++++++++++---
 sfx2/source/dialog/backingwindow.cxx         |    4 +--
 sfx2/source/dialog/backingwindow.hxx         |    2 -
 sfx2/source/doc/templatedlg.cxx              |    6 ++--
 sfx2/source/inc/templatesearchview.hxx       |    6 +++-
 8 files changed, 64 insertions(+), 17 deletions(-)

New commits:
commit 40ca34340e4b387bdce92b86cb572556c5437c7d
Author: Akshay Deep <akshaydeepiitr at gmail.com>
Date:   Thu Jun 9 08:51:50 2016 +0530

    tdf#100260 Template Manager: Cannot open context menu without mouse
    
    Change-Id: I900cc79e2834c1942840ee9fb1a8ab680b646c92
    Reviewed-on: https://gerrit.libreoffice.org/26082
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/include/sfx2/templateabstractview.hxx b/include/sfx2/templateabstractview.hxx
index a220f5a..79ec353 100644
--- a/include/sfx2/templateabstractview.hxx
+++ b/include/sfx2/templateabstractview.hxx
@@ -97,7 +97,7 @@ public:
 
     void setOpenRegionHdl(const Link<void*,void> &rLink);
 
-    void setRightClickHdl(const Link<ThumbnailViewItem*,void> &rLink);
+    void setCreateContextMenuHdl(const Link<ThumbnailViewItem*,void> &rLink);
 
     void setOpenTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
 
@@ -140,7 +140,7 @@ protected:
     Point maPosition;
 
     Link<void*,void>              maOpenRegionHdl;
-    Link<ThumbnailViewItem*,void> maRightClickHdl;
+    Link<ThumbnailViewItem*,void> maCreateContextMenuHdl;
     Link<ThumbnailViewItem*,void> maOpenTemplateHdl;
     Link<ThumbnailViewItem*,void> maEditTemplateHdl;
     Link<ThumbnailViewItem*,void> maDeleteTemplateHdl;
diff --git a/include/sfx2/templatedlg.hxx b/include/sfx2/templatedlg.hxx
index 26e6959..3b7f2b9 100644
--- a/include/sfx2/templatedlg.hxx
+++ b/include/sfx2/templatedlg.hxx
@@ -81,7 +81,7 @@ protected:
     DECL_LINK_TYPED(DefaultTemplateMenuSelectHdl, Menu*, bool);
 
     DECL_LINK_TYPED(OpenRegionHdl, void*, void);
-    DECL_LINK_TYPED(RightClickHdl, ThumbnailViewItem*, void);
+    DECL_LINK_TYPED(CreateContextMenuHdl, ThumbnailViewItem*, void);
     DECL_LINK_TYPED(OpenTemplateHdl, ThumbnailViewItem*, void);
     DECL_LINK_TYPED(EditTemplateHdl, ThumbnailViewItem*, void);
     DECL_LINK_TYPED(DeleteTemplateHdl, ThumbnailViewItem*, void);
diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx
index e19621d..536acdf 100644
--- a/sfx2/source/control/templateabstractview.cxx
+++ b/sfx2/source/control/templateabstractview.cxx
@@ -167,7 +167,7 @@ void TemplateAbstractView::MouseButtonDown( const MouseEvent& rMEvt )
         if(pViewItem)
         {
             maSelectedItem = dynamic_cast<TemplateViewItem*>(pItem);
-            maRightClickHdl.Call(pItem);
+            maCreateContextMenuHdl.Call(pItem);
         }
     }
 
@@ -193,6 +193,24 @@ void TemplateAbstractView::KeyInput( const KeyEvent& rKEvt )
             Invalidate();
         return;
     }
+    else if(aKeyCode == (KEY_SHIFT | KEY_F10 ))
+    {
+        for (ThumbnailViewItem* pItem : mFilteredItemList)
+        {
+            //create context menu for the first selected item
+            if (pItem->isSelected())
+            {
+                deselectItems();
+                pItem->setSelection(true);
+                maItemStateHdl.Call(pItem);
+                Rectangle aRect = pItem->getDrawArea();
+                maPosition = aRect.Center();
+                maSelectedItem = dynamic_cast<TemplateViewItem*>(pItem);
+                maCreateContextMenuHdl.Call(pItem);
+                break;
+            }
+        }
+    }
 
     ThumbnailView::KeyInput(rKEvt);
 }
@@ -203,9 +221,9 @@ void TemplateAbstractView::setOpenRegionHdl(const Link<void*,void> &rLink)
     maOpenRegionHdl = rLink;
 }
 
-void TemplateAbstractView::setRightClickHdl(const Link<ThumbnailViewItem*,void> &rLink)
+void TemplateAbstractView::setCreateContextMenuHdl(const Link<ThumbnailViewItem*,void> &rLink)
 {
-    maRightClickHdl = rLink;
+    maCreateContextMenuHdl = rLink;
 }
 
 void TemplateAbstractView::setOpenTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink)
diff --git a/sfx2/source/control/templatesearchview.cxx b/sfx2/source/control/templatesearchview.cxx
index ab2f489..f30c98d 100644
--- a/sfx2/source/control/templatesearchview.cxx
+++ b/sfx2/source/control/templatesearchview.cxx
@@ -46,13 +46,40 @@ void TemplateSearchView::MouseButtonDown( const MouseEvent& rMEvt )
         if(pViewItem)
         {
             maSelectedItem = dynamic_cast<TemplateViewItem*>(pItem);
-            maRightClickHdl.Call(pItem);
+            maCreateContextMenuHdl.Call(pItem);
         }
     }
 
     ThumbnailView::MouseButtonDown(rMEvt);
 }
 
+
+void TemplateSearchView::KeyInput( const KeyEvent& rKEvt )
+{
+    vcl::KeyCode aKeyCode = rKEvt.GetKeyCode();
+
+    if(aKeyCode == (KEY_SHIFT | KEY_F10 ))
+    {
+        for (ThumbnailViewItem* pItem : mFilteredItemList)
+        {
+            //create context menu for the first selected item
+            if (pItem->isSelected())
+            {
+                deselectItems();
+                pItem->setSelection(true);
+                maItemStateHdl.Call(pItem);
+                Rectangle aRect = pItem->getDrawArea();
+                maPosition = aRect.Center();
+                maSelectedItem = dynamic_cast<TemplateViewItem*>(pItem);
+                maCreateContextMenuHdl.Call(pItem);
+                break;
+            }
+        }
+    }
+
+    ThumbnailView::KeyInput(rKEvt);
+}
+
 void TemplateSearchView::createContextMenu( const bool bIsDefault)
 {
     std::unique_ptr<PopupMenu> pItemMenu(new PopupMenu);
@@ -98,9 +125,9 @@ IMPL_LINK_TYPED(TemplateSearchView, ContextMenuSelectHdl, Menu*, pMenu, bool)
     return false;
 }
 
-void TemplateSearchView::setRightClickHdl(const Link<ThumbnailViewItem*,void> &rLink)
+void TemplateSearchView::setCreateContextMenuHdl(const Link<ThumbnailViewItem*,void> &rLink)
 {
-    maRightClickHdl = rLink;
+    maCreateContextMenuHdl = rLink;
 }
 
 void TemplateSearchView::setOpenTemplateHdl(const Link<ThumbnailViewItem*, void> &rLink)
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 20e97a7..3c45106 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -262,7 +262,7 @@ void BackingWindow::initControls()
     mpTemplateButton->SetMenuMode( MENUBUTTON_MENUMODE_TIMED );
 
     //set handlers
-    mpLocalView->setRightClickHdl(LINK(this, BackingWindow, RightClickHdl));
+    mpLocalView->setCreateContextMenuHdl(LINK(this, BackingWindow, CreateContextMenuHdl));
     mpLocalView->setOpenTemplateHdl(LINK(this, BackingWindow, OpenTemplateHdl));
     mpLocalView->setEditTemplateHdl(LINK(this, BackingWindow, EditTemplateHdl));
 
@@ -625,7 +625,7 @@ IMPL_LINK_TYPED( BackingWindow, MenuSelectHdl, MenuButton*, pButton, void )
     mpLocalView->GrabFocus();
 }
 
-IMPL_LINK_TYPED(BackingWindow, RightClickHdl, ThumbnailViewItem*, pItem, void)
+IMPL_LINK_TYPED(BackingWindow, CreateContextMenuHdl, ThumbnailViewItem*, pItem, void)
 {
     const TemplateViewItem *pViewItem = dynamic_cast<TemplateViewItem*>(pItem);
 
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index 5b5194a..199302f 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -103,7 +103,7 @@ class BackingWindow : public vcl::Window, public VclBuilderContainer
     DECL_LINK_TYPED(ClickHdl, Button*, void);
     DECL_LINK_TYPED(MenuSelectHdl, MenuButton*, void);
     DECL_LINK_TYPED(ExtLinkClickHdl, Button*, void);
-    DECL_LINK_TYPED(RightClickHdl, ThumbnailViewItem*, void);
+    DECL_LINK_TYPED(CreateContextMenuHdl, ThumbnailViewItem*, void);
     DECL_LINK_TYPED(OpenTemplateHdl, ThumbnailViewItem*, void);
     DECL_LINK_TYPED(EditTemplateHdl, ThumbnailViewItem*, void);
 
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 77e78f0..67b338c 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -220,7 +220,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent)
                               TEMPLATE_ITEM_PADDING);
 
     mpLocalView->setItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVItemStateHdl));
-    mpLocalView->setRightClickHdl(LINK(this,SfxTemplateManagerDlg, RightClickHdl));
+    mpLocalView->setCreateContextMenuHdl(LINK(this,SfxTemplateManagerDlg, CreateContextMenuHdl));
     mpLocalView->setOpenRegionHdl(LINK(this,SfxTemplateManagerDlg, OpenRegionHdl));
     mpLocalView->setOpenTemplateHdl(LINK(this,SfxTemplateManagerDlg, OpenTemplateHdl));
     mpLocalView->setEditTemplateHdl(LINK(this,SfxTemplateManagerDlg, EditTemplateHdl));
@@ -245,7 +245,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent)
                                     TEMPLATE_ITEM_PADDING);
 
     mpSearchView->setItemStateHdl(LINK(this,SfxTemplateManagerDlg,TVItemStateHdl));
-    mpSearchView->setRightClickHdl(LINK(this,SfxTemplateManagerDlg, RightClickHdl));
+    mpSearchView->setCreateContextMenuHdl(LINK(this,SfxTemplateManagerDlg, CreateContextMenuHdl));
     mpSearchView->setOpenTemplateHdl(LINK(this,SfxTemplateManagerDlg,OpenTemplateHdl));
     mpSearchView->setEditTemplateHdl(LINK(this,SfxTemplateManagerDlg, EditTemplateHdl));
     mpSearchView->setDeleteTemplateHdl(LINK(this,SfxTemplateManagerDlg, DeleteTemplateHdl));
@@ -755,7 +755,7 @@ IMPL_LINK_NOARG_TYPED(SfxTemplateManagerDlg, OpenRegionHdl, void*, void)
     mpActionBar->Show();
 }
 
-IMPL_LINK_TYPED(SfxTemplateManagerDlg, RightClickHdl, ThumbnailViewItem*, pItem, void)
+IMPL_LINK_TYPED(SfxTemplateManagerDlg, CreateContextMenuHdl, ThumbnailViewItem*, pItem, void)
 {
     const TemplateViewItem *pViewItem = dynamic_cast<TemplateViewItem*>(pItem);
 
diff --git a/sfx2/source/inc/templatesearchview.hxx b/sfx2/source/inc/templatesearchview.hxx
index e6f75f4..1dda8c5 100644
--- a/sfx2/source/inc/templatesearchview.hxx
+++ b/sfx2/source/inc/templatesearchview.hxx
@@ -25,7 +25,7 @@ public:
 
     DECL_LINK_TYPED(ContextMenuSelectHdl, Menu*, bool);
 
-    void setRightClickHdl(const Link<ThumbnailViewItem*,void> &rLink);
+    void setCreateContextMenuHdl(const Link<ThumbnailViewItem*,void> &rLink);
 
     void setEditTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
 
@@ -46,13 +46,15 @@ protected:
 
     virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
 
+    virtual void KeyInput( const KeyEvent& rKEvt ) override;
+
 protected:
     TemplateViewItem *maSelectedItem;
 
     Point maPosition;
 
     Link<ThumbnailViewItem*, void> maOpenTemplateHdl;
-    Link<ThumbnailViewItem*, void> maRightClickHdl;
+    Link<ThumbnailViewItem*, void> maCreateContextMenuHdl;
     Link<ThumbnailViewItem*,void> maEditTemplateHdl;
     Link<ThumbnailViewItem*,void> maDeleteTemplateHdl;
     Link<ThumbnailViewItem*,void> maDefaultTemplateHdl;


More information about the Libreoffice-commits mailing list