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

Rodolfo Ribeiro Gomes rodolforg at gmail.com
Thu Nov 7 20:21:46 CET 2013


 include/sfx2/recentdocsview.hxx        |    2 ++
 sfx2/source/control/recentdocsview.cxx |   27 ++++++++++++++++++++++++++-
 2 files changed, 28 insertions(+), 1 deletion(-)

New commits:
commit a29c9eff781fd6bceee5078669a53c52086b5664
Author: Rodolfo Ribeiro Gomes <rodolforg at gmail.com>
Date:   Thu Nov 7 13:59:42 2013 -0200

    single-click for open recent documents in new Start Center
    
    Change-Id: I34c6a5f9057707cdd1e2f4f82024818e7c8a6630
    Signed-off-by: Rodolfo Ribeiro Gomes <rodolforg at gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/6610
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/include/sfx2/recentdocsview.hxx b/include/sfx2/recentdocsview.hxx
index 0552636..2edace5 100644
--- a/include/sfx2/recentdocsview.hxx
+++ b/include/sfx2/recentdocsview.hxx
@@ -58,7 +58,9 @@ public:
     DECL_STATIC_LINK( RecentDocsView, ExecuteHdl_Impl, LoadRecentFile* );
 
 protected:
+    virtual void MouseButtonDown( const MouseEvent& rMEvt );
     virtual void OnItemDblClicked(ThumbnailViewItem *pItem);
+    void OpenItem( const ThumbnailViewItem *pItem );
 
     bool isAcceptedFile(const OUString &rURL) const;
 
diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx
index 5e3c796..706214e 100644
--- a/sfx2/source/control/recentdocsview.cxx
+++ b/sfx2/source/control/recentdocsview.cxx
@@ -175,9 +175,34 @@ void RecentDocsView::loadRecentDocs()
     Invalidate();
 }
 
+void RecentDocsView::MouseButtonDown( const MouseEvent& rMEvt )
+{
+    if ( rMEvt.IsLeft() )
+    {
+        size_t nPos = ImplGetItem(rMEvt.GetPosPixel());
+        ThumbnailViewItem* pItem = ImplGetItem(nPos);
+
+        if (pItem && pItem->isVisible())
+        {
+            Rectangle aRect(pItem->getDrawArea());
+            if (aRect.IsInside(rMEvt.GetPosPixel()))
+            {
+                OnItemDblClicked(pItem);
+                return;
+            }
+        }
+    }
+    ThumbnailView::MouseButtonDown( rMEvt );
+}
+
 void RecentDocsView::OnItemDblClicked(ThumbnailViewItem *pItem)
 {
-    RecentDocsViewItem* pRecentItem = dynamic_cast<RecentDocsViewItem*>(pItem);
+    OpenItem( pItem );
+}
+
+void RecentDocsView::OpenItem( const ThumbnailViewItem *pItem )
+{
+    const RecentDocsViewItem* pRecentItem = dynamic_cast<const RecentDocsViewItem*>(pItem);
 
     Reference< XDispatch >            xDispatch;
     Reference< XDispatchProvider >    xDispatchProvider;


More information about the Libreoffice-commits mailing list