[Libreoffice-commits] .: Branch 'feature/template-dialog' - 3 commits - sfx2/inc sfx2/source

Rafael Dominguez rdominguez at kemper.freedesktop.org
Mon Jul 2 14:25:59 PDT 2012


 sfx2/inc/sfx2/thumbnailview.hxx       |    2 
 sfx2/source/control/thumbnailview.cxx |  132 +---------------------------------
 sfx2/source/doc/templatedlg.cxx       |    5 -
 3 files changed, 8 insertions(+), 131 deletions(-)

New commits:
commit 90256a112507998b89af8eecb678e6e12c5dfbd1
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Mon Jul 2 16:56:25 2012 -0430

    Change order of "New folder" entry in move menu.
    
    Change-Id: Icb12d893514b1f1505d6ff84aeaa6bbcef136eec

diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 12ddd1c..e35542b 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -338,18 +338,15 @@ IMPL_LINK(SfxTemplateManagerDlg, TBXDropdownHdl, ToolBox*, pBox)
         PopupMenu *pMoveMenu = new PopupMenu;
         pMoveMenu->SetSelectHdl(LINK(this,SfxTemplateManagerDlg,MoveMenuSelectHdl));
 
-        pMoveMenu->InsertItem(MNI_MOVE_NEW,SfxResId(STR_MOVE_NEW).toString());
-
         if (!aNames.empty())
         {
-            pMoveMenu->InsertSeparator();
-
             for (size_t i = 0, n = aNames.size(); i < n; ++i)
                 pMoveMenu->InsertItem(MNI_MOVE_FOLDER_BASE+i,aNames[i]);
         }
 
         pMoveMenu->InsertSeparator();
 
+        pMoveMenu->InsertItem(MNI_MOVE_NEW,SfxResId(STR_MOVE_NEW).toString());
         pMoveMenu->InsertItem(MNI_MOVE_DELETE,SfxResId(STR_MOVE_DELETE).toString());
 
         pMoveMenu->Execute(pBox,pBox->GetItemRect(TBI_TEMPLATE_MOVE),
commit 1fdbf7163a7934359b71ba2bc72778cfcb834e58
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Sun Jul 1 19:39:12 2012 -0430

    Dont support moving with the keyboard inside the view.
    
    Change-Id: I129243ed21a3fb0847d2cb6077f78bf074e515f8

diff --git a/sfx2/inc/sfx2/thumbnailview.hxx b/sfx2/inc/sfx2/thumbnailview.hxx
index 2d6bb20..1145af5 100644
--- a/sfx2/inc/sfx2/thumbnailview.hxx
+++ b/sfx2/inc/sfx2/thumbnailview.hxx
@@ -256,8 +256,6 @@ protected:
 
     virtual void Tracking( const TrackingEvent& rMEvt );
 
-    virtual void KeyInput( const KeyEvent& rKEvt );
-
     virtual void Command( const CommandEvent& rCEvt );
 
     virtual void Paint( const Rectangle& rRect );
diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 54d31be..7e0ec57 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -656,130 +656,6 @@ void ThumbnailView::Tracking( const TrackingEvent& rTEvt )
         ImplTracking( aMousePos, rTEvt.IsTrackingRepeat() );
 }
 
-void ThumbnailView::KeyInput( const KeyEvent& rKEvt )
-{
-    size_t nLastItem = mItemList.size();
-
-    if ( !nLastItem || !ImplGetFirstItem() )
-    {
-        Control::KeyInput( rKEvt );
-        return;
-    }
-
-    --nLastItem;
-    const size_t nCurPos = mnSelItemId ? GetItemPos( mnSelItemId ) : 0;
-    size_t nItemPos = THUMBNAILVIEW_ITEM_NOTFOUND;
-    size_t nVStep = mnCols;
-
-    switch ( rKEvt.GetKeyCode().GetCode() )
-    {
-        case KEY_HOME:
-            nItemPos = 0;
-            break;
-
-        case KEY_END:
-            nItemPos = nLastItem;
-            break;
-
-        case KEY_LEFT:
-            if (nCurPos != THUMBNAILVIEW_ITEM_NONEITEM)
-            {
-                if (nCurPos)
-                {
-                    nItemPos = nCurPos-1;
-                }
-            }
-            break;
-
-        case KEY_RIGHT:
-            if (nCurPos < nLastItem)
-                nItemPos = nCurPos+1;
-
-            break;
-
-        case KEY_PAGEUP:
-            if (rKEvt.GetKeyCode().IsShift() || rKEvt.GetKeyCode().IsMod1() || rKEvt.GetKeyCode().IsMod2())
-            {
-                Control::KeyInput( rKEvt );
-                return;
-            }
-            nVStep *= mnVisLines;
-            // intentional fall-through
-        case KEY_UP:
-            if (nCurPos != THUMBNAILVIEW_ITEM_NONEITEM)
-            {
-                if (nCurPos == nLastItem)
-                {
-                    const size_t nCol = nLastItem % mnCols;
-                    if (nCol < mnCurCol)
-                    {
-                        // Move to previous row/page, keeping the old column
-                        nVStep -= mnCurCol - nCol;
-                    }
-                }
-                if (nCurPos >= nVStep)
-                {
-                    // Go up of a whole page
-                    nItemPos = nCurPos-nVStep;
-                }
-                else if (nCurPos > mnCols)
-                {
-                    // Go to same column in first row
-                    nItemPos = nCurPos % mnCols;
-                }
-            }
-            break;
-
-        case KEY_PAGEDOWN:
-            if (rKEvt.GetKeyCode().IsShift() || rKEvt.GetKeyCode().IsMod1() || rKEvt.GetKeyCode().IsMod2())
-            {
-                Control::KeyInput( rKEvt );
-                return;
-            }
-            nVStep *= mnVisLines;
-            // intentional fall-through
-        case KEY_DOWN:
-            if (nCurPos != nLastItem)
-            {
-                if (nCurPos == THUMBNAILVIEW_ITEM_NONEITEM)
-                {
-                    nItemPos = nVStep-mnCols+mnCurCol;
-                }
-                else
-                {
-                    nItemPos = nCurPos+nVStep;
-                }
-                if (nItemPos > nLastItem)
-                {
-                    nItemPos = nLastItem;
-                }
-            }
-            break;
-            // intentional fall-through
-        default:
-            Control::KeyInput( rKEvt );
-            return;
-    }
-
-    // This point is reached only if key travelling was used,
-    // in which case selection mode should be switched off
-
-    if ( nItemPos != THUMBNAILVIEW_ITEM_NOTFOUND )
-    {
-        if ( nItemPos!=THUMBNAILVIEW_ITEM_NONEITEM && nItemPos<nLastItem )
-        {
-            // update current column only in case of a new position
-            // which is also not a "specially" handled one.
-            mnCurCol = nItemPos % mnCols;
-        }
-        const sal_uInt16 nItemId = (nItemPos != THUMBNAILVIEW_ITEM_NONEITEM) ? GetItemId( nItemPos ) : 0;
-        if ( nItemId != mnSelItemId )
-        {
-            SelectItem( nItemId );
-        }
-    }
-}
-
 void ThumbnailView::Command( const CommandEvent& rCEvt )
 {
     if ( (rCEvt.GetCommand() == COMMAND_WHEEL) ||
commit 0c1126ffd7c99e73dd5643484bcbe880196c3ea3
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Sun Jul 1 18:42:13 2012 -0430

    Make scrolling smoother.
    
    Change-Id: Ic0943497067228eebc7f746b8127a0a255d15646

diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index 4a5ebc4..54d31be 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -499,7 +499,13 @@ bool ThumbnailView::ImplHasAccessibleListeners()
 
 IMPL_LINK( ThumbnailView,ImplScrollHdl, ScrollBar*, pScrollBar )
 {
-    sal_uInt16 nNewFirstLine = (sal_uInt16)pScrollBar->GetThumbPos();
+    sal_uInt16 nNewFirstLine = mnFirstLine;
+
+    if (pScrollBar->GetDelta() > 0)
+        nNewFirstLine += 1;
+    else
+        nNewFirstLine -= 1;
+
     if ( nNewFirstLine != mnFirstLine )
     {
         mnFirstLine = nNewFirstLine;


More information about the Libreoffice-commits mailing list