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

Krisztian Pinter pin.terminator at gmail.com
Tue Sep 3 03:26:56 PDT 2013


 include/sfx2/thumbnailview.hxx        |    5 +++++
 sfx2/source/control/thumbnailview.cxx |   32 +++++++++++++++++++++++++++++++-
 sfx2/source/dialog/backingwindow.cxx  |    2 ++
 3 files changed, 38 insertions(+), 1 deletion(-)

New commits:
commit 48d00430e2b1ceb16a0c377c4aa6c40b733eb529
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date:   Mon Sep 2 15:46:23 2013 +0200

    startcenter: Add tooltips for thumbnails with long filenames
    
    Change-Id: Id9bab881f74b40691cb3e7364af78758d769a8a6
    Reviewed-on: https://gerrit.libreoffice.org/5756
    Reviewed-by: Krisztian Pinter <pin.terminator at gmail.com>
    Tested-by: Krisztian Pinter <pin.terminator at gmail.com>

diff --git a/include/sfx2/thumbnailview.hxx b/include/sfx2/thumbnailview.hxx
index 823e6ad..30037a6 100644
--- a/include/sfx2/thumbnailview.hxx
+++ b/include/sfx2/thumbnailview.hxx
@@ -186,6 +186,8 @@ public:
 
     virtual ~ThumbnailView ();
 
+    virtual void        MouseMove( const MouseEvent& rMEvt );
+
     void AppendItem (ThumbnailViewItem *pItem);
 
     void RemoveItem( sal_uInt16 nItemId );
@@ -230,6 +232,8 @@ public:
 
     OUString GetItemText( sal_uInt16 nItemId ) const;
 
+    void ShowTooltips( bool bShowTooltips );
+
     void SetColor( const Color& rColor );
 
     void SetColor() { SetColor( Color( COL_TRANSPARENT ) ); }
@@ -328,6 +332,7 @@ protected:
     bool mbScroll : 1;
     bool mbIsTransientChildrenDisabled : 1;
     bool mbHasVisibleItems : 1;
+    bool mbShowTooltips : 1;
     Color maColor;
 
     Link maItemStateHdl;
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index b80086b..18d14a1 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -83,6 +83,30 @@ ThumbnailView::~ThumbnailView()
     ImplDeleteItems();
 }
 
+void ThumbnailView::MouseMove( const MouseEvent& rMEvt )
+{
+    if ( !mbShowTooltips )
+        return;
+
+    (void) rMEvt; // unused parameter
+    ThumbnailViewItem *pItem;
+    size_t      nItemCount = mFilteredItemList.size();
+    bool        bFound = false;
+    Point       aPoint = GetPointerState().maPos;
+
+    for ( size_t i = 0; i < nItemCount && !bFound; i++ )
+    {
+        pItem = mFilteredItemList[i];
+        if ( pItem->mbVisible && pItem->getDrawArea().IsInside(aPoint) )
+            bFound = true;
+    }
+
+    if ( bFound )
+        SetQuickHelpText(pItem->maTitle);
+    else
+        SetQuickHelpText("");
+}
+
 void ThumbnailView::AppendItem(ThumbnailViewItem *pItem)
 {
     if (maFilterFunc(pItem))
@@ -110,7 +134,7 @@ void ThumbnailView::ImplInit()
     mnHeaderHeight      = 0;
     mnItemWidth         = 0;
     mnItemHeight        = 0;
-    mnItemPadding = 0;
+    mnItemPadding       = 0;
     mnVisLines          = 0;
     mnLines             = 0;
     mnFirstLine         = 0;
@@ -119,6 +143,7 @@ void ThumbnailView::ImplInit()
     mnSpacing           = 0;
     mbScroll            = false;
     mbHasVisibleItems   = false;
+    mbShowTooltips      = false;
     maFilterFunc = ViewFilterAll();
     maColor = GetSettings().GetStyleSettings().GetFieldColor();
     mpStartSelRange = mFilteredItemList.end();
@@ -1210,6 +1235,11 @@ OUString ThumbnailView::GetItemText( sal_uInt16 nItemId ) const
     return OUString();
 }
 
+void ThumbnailView::ShowTooltips( bool bShowTooltips )
+{
+    mbShowTooltips = bShowTooltips;
+}
+
 void ThumbnailView::SetColor( const Color& rColor )
 {
     maColor = rColor;
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 40d04d7..e951291 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -255,6 +255,7 @@ void BackingWindow::initControls()
     // of setupModuleTab. TYPE_OTHER is always added.
     mpAllRecentThumbnails->mnFileTypes |= TYPE_OTHER;
     mpAllRecentThumbnails->loadRecentDocs();
+    mpAllRecentThumbnails->ShowTooltips( true );
 
     setupButton( mpWriterButton );
     setupButton( mpDrawButton );
@@ -304,6 +305,7 @@ void BackingWindow::setupModuleTab(const OString& rTabName, RecentDocsView* pRec
         mpAllRecentThumbnails-> mnFileTypes |= nFileTypes;
         pRecView->mnFileTypes |= nFileTypes;
         pRecView->loadRecentDocs();
+        pRecView->ShowTooltips( true );
     }
 }
 


More information about the Libreoffice-commits mailing list