sc/source/ui/cctrl/checklistmenu.cxx |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 9d90fc7593445d0cd2333a827840e1c993e7a9b5
Author: Kohei Yoshida <kohei.yosh...@gmail.com>
Date:   Fri Nov 2 14:51:35 2012 -0400

    Minor enhancements on the autofilter popup window.
    
    1) Launch pop-up right-aligned in case the cell is wider than the popup.
    Launching it always left-aligned will look weird especially when the column
    is very wide.
    
    2) Allow type-ahead search when launching the autofilter via keyboard.  This
    is achieved by making two small changes to the popup; first, the focus is 
set
    on the check list box upon launching, and second, the type-ahead search is
    enabled on the check list box control.
    
    Change-Id: I8a33a52afc6005b4a7428d5f7046eff986da80d2
    Reviewed-on: https://gerrit.libreoffice.org/997
    Reviewed-by: Radek Doulík <r...@novell.com>
    Tested-by: Radek Doulík <r...@novell.com>

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx 
b/sc/source/ui/cctrl/checklistmenu.cxx
index ca85f70..f3b07b2 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -915,6 +915,9 @@ ScCheckListMenuWindow::ScCheckListMenuWindow(Window* 
pParent, ScDocument* pDoc)
     maTabStopCtrls.push_back(&maBtnUnselectSingle);
     maTabStopCtrls.push_back(&maBtnOk);
     maTabStopCtrls.push_back(&maBtnCancel);
+
+    // Enable type-ahead search in the check list box.
+    maChecks.SetStyle(maChecks.GetStyle() | WB_QUICK_SEARCH);
 }
 
 ScCheckListMenuWindow::~ScCheckListMenuWindow()
@@ -1355,7 +1358,18 @@ void ScCheckListMenuWindow::launch(const Rectangle& 
rRect)
         // We need to have at least one member selected.
         maBtnOk.Enable(maChecks.GetCheckedEntryCount() != 0);
 
-    StartPopupMode(rRect, (FLOATWIN_POPUPMODE_DOWN | 
FLOATWIN_POPUPMODE_GRABFOCUS));
+    Rectangle aRect(rRect);
+    if (maWndSize.Width() < aRect.GetWidth())
+    {
+        // Target rectangle (i.e. cell width) is wider than the window.
+        // Simulate right-aligned launch by modifying the target rectangle
+        // size.
+        long nDiff = aRect.GetWidth() - maWndSize.Width();
+        aRect.Left() += nDiff;
+    }
+
+    StartPopupMode(aRect, (FLOATWIN_POPUPMODE_DOWN | 
FLOATWIN_POPUPMODE_GRABFOCUS));
+    cycleFocus(); // Set initial focus to the check list box.
 }
 
 void ScCheckListMenuWindow::close(bool bOK)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to