[Libreoffice-commits] core.git: sc/source

Dennis Francis dennis.francis at collabora.co.uk
Mon Aug 7 07:59:08 UTC 2017


 sc/source/ui/app/inputwin.cxx |   55 +++++++++++++++++++++++++++---------------
 1 file changed, 36 insertions(+), 19 deletions(-)

New commits:
commit 561cae8e81913940e4af86901ec46a484669c597
Author: Dennis Francis <dennis.francis at collabora.co.uk>
Date:   Tue Jul 25 17:11:47 2017 +0530

    tdf#71409: Pre-create sum/equal and ok/cancel buttons...
    
    in the sc formula bar at the start instead of adding/
    removing them to/from vcl ToolBox when required.
    To maintain the functionality, do hide/show and
    enable/disable the button pairs (sum/equal, ok/cancel)
    during mode switch. This solves the excess a11y events
    problem of tdf#71409 because this patch get rid of
    the usages of vcl's Toolbox::Remove() and its accessibility
    module dependencies which seems to be the root cause.
    
    Change-Id: Ib953fb64d25a4b83018eca6a88223c7236c2f72e
    Reviewed-on: https://gerrit.libreoffice.org/40479
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Dennis Francis <dennis.francis at collabora.co.uk>

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index eade695e1c20..7d0b7fa036fd 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -190,8 +190,10 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) :
     InsertItem      (SID_INPUT_FUNCTION, Image(BitmapEx(RID_BMP_INPUT_FUNCTION)), ToolBoxItemBits::NONE, 2);
     InsertItem      (SID_INPUT_SUM,      Image(BitmapEx(RID_BMP_INPUT_SUM)), ToolBoxItemBits::NONE, 3);
     InsertItem      (SID_INPUT_EQUAL,    Image(BitmapEx(RID_BMP_INPUT_EQUAL)), ToolBoxItemBits::NONE, 4);
-    InsertSeparator (5);
-    InsertWindow    (7, &aTextWindow, ToolBoxItemBits::NONE, 6);
+    InsertItem      (SID_INPUT_CANCEL,   Image(BitmapEx(RID_BMP_INPUT_CANCEL)), ToolBoxItemBits::NONE, 5);
+    InsertItem      (SID_INPUT_OK,       Image(BitmapEx(RID_BMP_INPUT_OK)), ToolBoxItemBits::NONE, 6);
+    InsertSeparator (7);
+    InsertWindow    (7, &aTextWindow, ToolBoxItemBits::NONE, 8);
 
     aWndPos   ->SetQuickHelpText(ScResId(SCSTR_QHELP_POSWND));
     aWndPos   ->SetHelpId       (HID_INSWIN_POS);
@@ -208,6 +210,18 @@ ScInputWindow::ScInputWindow( vcl::Window* pParent, SfxBindings* pBind ) :
     SetItemText (SID_INPUT_EQUAL, aTextEqual);
     SetHelpId   (SID_INPUT_EQUAL, HID_INSWIN_FUNC);
 
+    SetItemText ( SID_INPUT_CANCEL, aTextCancel );
+    SetHelpId   ( SID_INPUT_CANCEL, HID_INSWIN_CANCEL );
+
+    SetItemText ( SID_INPUT_OK, aTextOk );
+    SetHelpId   ( SID_INPUT_OK, HID_INSWIN_OK );
+
+    EnableItem( SID_INPUT_CANCEL, false );
+    EnableItem( SID_INPUT_OK, false );
+
+    HideItem( SID_INPUT_CANCEL );
+    HideItem( SID_INPUT_OK );
+
     SetHelpId( HID_SC_INPUTWIN ); // For the whole input row
 
     aWndPos   ->Show();
@@ -504,14 +518,16 @@ void ScInputWindow::SetOkCancelMode()
 
     if (!bIsOkCancelMode)
     {
-        RemoveItem( 3 ); // Remove SID_INPUT_SUM and SID_INPUT_EQUAL
-        RemoveItem( 3 );
-        InsertItem( SID_INPUT_CANCEL, Image(BitmapEx(RID_BMP_INPUT_CANCEL)), ToolBoxItemBits::NONE, 3 );
-        InsertItem( SID_INPUT_OK,     Image(BitmapEx(RID_BMP_INPUT_OK)),     ToolBoxItemBits::NONE, 4 );
-        SetItemText ( SID_INPUT_CANCEL, aTextCancel );
-        SetHelpId   ( SID_INPUT_CANCEL, HID_INSWIN_CANCEL );
-        SetItemText ( SID_INPUT_OK,     aTextOk );
-        SetHelpId   ( SID_INPUT_OK,     HID_INSWIN_OK );
+        EnableItem  ( SID_INPUT_SUM,   false );
+        EnableItem  ( SID_INPUT_EQUAL, false );
+        HideItem    ( SID_INPUT_SUM );
+        HideItem    ( SID_INPUT_EQUAL );
+
+        ShowItem    ( SID_INPUT_CANCEL, true );
+        ShowItem    ( SID_INPUT_OK,     true );
+        EnableItem  ( SID_INPUT_CANCEL, true );
+        EnableItem  ( SID_INPUT_OK,     true );
+
         bIsOkCancelMode = true;
     }
 }
@@ -524,15 +540,16 @@ void ScInputWindow::SetSumAssignMode()
 
     if (bIsOkCancelMode)
     {
-        // Remove SID_INPUT_CANCEL, and SID_INPUT_OK
-        RemoveItem( 3 );
-        RemoveItem( 3 );
-        InsertItem( SID_INPUT_SUM,   Image(BitmapEx(RID_BMP_INPUT_SUM)),   ToolBoxItemBits::NONE, 3 );
-        InsertItem( SID_INPUT_EQUAL, Image(BitmapEx(RID_BMP_INPUT_EQUAL)), ToolBoxItemBits::NONE, 4 );
-        SetItemText ( SID_INPUT_SUM,   aTextSum );
-        SetHelpId   ( SID_INPUT_SUM,   HID_INSWIN_SUMME );
-        SetItemText ( SID_INPUT_EQUAL, aTextEqual );
-        SetHelpId   ( SID_INPUT_EQUAL, HID_INSWIN_FUNC );
+        EnableItem  ( SID_INPUT_CANCEL, false );
+        EnableItem  ( SID_INPUT_OK,     false );
+        HideItem    ( SID_INPUT_CANCEL );
+        HideItem    ( SID_INPUT_OK );
+
+        ShowItem    ( SID_INPUT_SUM,    true );
+        ShowItem    ( SID_INPUT_EQUAL,  true );
+        EnableItem  ( SID_INPUT_SUM,    true );
+        EnableItem  ( SID_INPUT_EQUAL,  true );
+
         bIsOkCancelMode = false;
 
         SetFormulaMode(false); // No editing -> no formula


More information about the Libreoffice-commits mailing list