[Libreoffice-commits] core.git: dbaccess/source dbaccess/uiconfig fpicker/source fpicker/uiconfig reportdesign/source reportdesign/uiconfig vcl/source

Maxim Monastirsky momonasmon at gmail.com
Wed Jan 17 00:43:48 UTC 2018


 dbaccess/source/ui/dlg/CollectionView.cxx         |    1 
 dbaccess/uiconfig/ui/collectionviewdialog.ui      |    1 
 fpicker/source/office/iodlg.cxx                   |    1 
 fpicker/uiconfig/ui/explorerfiledialog.ui         |    1 
 reportdesign/source/ui/dlg/Condition.cxx          |    5 ---
 reportdesign/uiconfig/dbreport/ui/conditionwin.ui |    4 ++
 vcl/source/window/builder.cxx                     |   32 +++++++++++++++++++---
 7 files changed, 35 insertions(+), 10 deletions(-)

New commits:
commit 1ec49f8a3917cec0ef82665d61f63e4b190fc298
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Tue Jan 16 01:44:51 2018 +0200

    Handle focus_on_click glade property for buttons
    
    It maps to our WB_NOPOINTERFOCUS.
    
    Change-Id: Ib00e696801b72de2c931e282ed8d50c972fa59fb
    Reviewed-on: https://gerrit.libreoffice.org/47990
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>

diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx
index 372a65f79598..ebdd01a8bd23 100644
--- a/dbaccess/source/ui/dlg/CollectionView.cxx
+++ b/dbaccess/source/ui/dlg/CollectionView.cxx
@@ -82,7 +82,6 @@ OCollectionView::OCollectionView( vcl::Window * pParent
     m_pName->SetText(_sDefaultName);
     m_pName->GrabFocus();
 
-    m_pNewFolder->SetStyle( m_pNewFolder->GetStyle() | WB_NOPOINTERFOCUS );
     m_pUp->SetModeImage(Image(BitmapEx(BMP_NAVIGATION_BTN_UP_SC)));
     m_pNewFolder->SetModeImage(Image(BitmapEx(BMP_NAVIGATION_CREATEFOLDER_SC)));
 
diff --git a/dbaccess/uiconfig/ui/collectionviewdialog.ui b/dbaccess/uiconfig/ui/collectionviewdialog.ui
index 7ffd69952459..96475b3063c0 100644
--- a/dbaccess/uiconfig/ui/collectionviewdialog.ui
+++ b/dbaccess/uiconfig/ui/collectionviewdialog.ui
@@ -113,6 +113,7 @@
                     <property name="use_action_appearance">False</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
+                    <property name="focus_on_click">False</property>
                     <property name="can_default">True</property>
                     <property name="has_default">True</property>
                     <property name="receives_default">True</property>
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 053f24a0e70b..333c384734f1 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -596,7 +596,6 @@ void SvtFileDialog::Init_Impl
     bool bSaveMode = ( FILEDLG_MODE_SAVE == pImpl->_eMode );
     pImpl->_pEdFileName->SetNoURLSelection( bSaveMode );
 
-    pImpl->_pBtnNewFolder->SetStyle( pImpl->_pBtnNewFolder->GetStyle() | WB_NOPOINTERFOCUS );
     pImpl->_pBtnUp->SetAccessibleName( pImpl->_pBtnUp->GetQuickHelpText() );
 
     if ( nStyle & PickerFlags::MultiSelection )
diff --git a/fpicker/uiconfig/ui/explorerfiledialog.ui b/fpicker/uiconfig/ui/explorerfiledialog.ui
index b533c06b4295..af3e8d9d0fc0 100644
--- a/fpicker/uiconfig/ui/explorerfiledialog.ui
+++ b/fpicker/uiconfig/ui/explorerfiledialog.ui
@@ -108,6 +108,7 @@
                         <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
+                        <property name="focus_on_click">False</property>
                         <property name="receives_default">True</property>
                         <property name="has_tooltip">True</property>
                         <property name="tooltip_text" translatable="yes" context="explorerfiledialog|new_folder|tooltip_text">Create New Folder</property>
diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx
index d1b890156b94..9a8df2a42e1f 100644
--- a/reportdesign/source/ui/dlg/Condition.cxx
+++ b/reportdesign/source/ui/dlg/Condition.cxx
@@ -146,11 +146,6 @@ Condition::Condition( vcl::Window* _pParent, IConditionalFormatAction& _rAction,
     m_pAddCondition->SetClickHdl( LINK( this, Condition, OnConditionAction ) );
     m_pRemoveCondition->SetClickHdl( LINK( this, Condition, OnConditionAction ) );
 
-    m_pMoveUp->SetStyle( m_pMoveUp->GetStyle() | WB_NOPOINTERFOCUS );
-    m_pMoveDown->SetStyle( m_pMoveDown->GetStyle() | WB_NOPOINTERFOCUS );
-    m_pAddCondition->SetStyle( m_pAddCondition->GetStyle() | WB_NOPOINTERFOCUS );
-    m_pRemoveCondition->SetStyle( m_pRemoveCondition->GetStyle() | WB_NOPOINTERFOCUS );
-
     vcl::Font aFont( m_pAddCondition->GetFont() );
     aFont.SetWeight( WEIGHT_BOLD );
     m_pAddCondition->SetFont( aFont );
diff --git a/reportdesign/uiconfig/dbreport/ui/conditionwin.ui b/reportdesign/uiconfig/dbreport/ui/conditionwin.ui
index b5bb144de770..0b8d21f4ea43 100644
--- a/reportdesign/uiconfig/dbreport/ui/conditionwin.ui
+++ b/reportdesign/uiconfig/dbreport/ui/conditionwin.ui
@@ -186,6 +186,7 @@
           <object class="GtkButton" id="upButton">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="focus_on_click">False</property>
             <property name="receives_default">True</property>
             <property name="image">image1</property>
           </object>
@@ -342,6 +343,7 @@
           <object class="GtkButton" id="downButton">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="focus_on_click">False</property>
             <property name="receives_default">True</property>
             <property name="valign">start</property>
             <property name="image">image2</property>
@@ -371,6 +373,7 @@
             <property name="label" translatable="yes" context="conditionwin|removeButton">-</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="focus_on_click">False</property>
             <property name="receives_default">True</property>
           </object>
           <packing>
@@ -385,6 +388,7 @@
             <property name="label" translatable="yes" context="conditionwin|addButton">+</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="focus_on_click">False</property>
             <property name="receives_default">True</property>
             <property name="halign">end</property>
           </object>
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index d0410235ad67..bde5585c26da 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -669,6 +669,18 @@ namespace
         return bIsStock;
     }
 
+    bool extractFocusOnClick(VclBuilder::stringmap &rMap)
+    {
+        bool bFocusOnClick = true;
+        VclBuilder::stringmap::iterator aFind = rMap.find(OString("focus-on-click"));
+        if (aFind != rMap.end())
+        {
+            bFocusOnClick = toBool(aFind->second);
+            rMap.erase(aFind);
+        }
+        return bFocusOnClick;
+    }
+
     WinBits extractRelief(VclBuilder::stringmap &rMap)
     {
         WinBits nBits = WB_3DLOOK;
@@ -780,12 +792,12 @@ namespace
         WinBits nBits = WB_CLIPCHILDREN|WB_CENTER|WB_VCENTER;
 
         nBits |= extractRelief(rMap);
-
-        bool bIsStock = extractStock(rMap);
+        if (!extractFocusOnClick(rMap))
+            nBits |= WB_NOPOINTERFOCUS;
 
         VclPtr<Button> xWindow;
 
-        if (bIsStock)
+        if (extractStock(rMap))
         {
             OUString sType = extractLabel(rMap);
             if (sType == "gtk-ok")
@@ -813,6 +825,8 @@ namespace
         WinBits nBits = WB_CLIPCHILDREN|WB_CENTER|WB_VCENTER|WB_3DLOOK;
 
         nBits |= extractRelief(rMap);
+        if (!extractFocusOnClick(rMap))
+            nBits |= WB_NOPOINTERFOCUS;
 
         VclPtr<Button> xWindow = VclPtr<MenuButton>::Create(pParent, nBits);
 
@@ -829,6 +843,8 @@ namespace
         WinBits nBits = WB_CLIPCHILDREN|WB_CENTER|WB_VCENTER|WB_3DLOOK;
 
         nBits |= extractRelief(rMap);
+        if (!extractFocusOnClick(rMap))
+            nBits |= WB_NOPOINTERFOCUS;
 
         VclPtr<Button> xWindow = VclPtr<MenuToggleButton>::Create(pParent, nBits);
 
@@ -1260,6 +1276,8 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
         OUString sWrap = BuilderUtils::extractCustomProperty(rMap);
         if (!sWrap.isEmpty())
             nBits |= WB_WORDBREAK;
+        if (!extractFocusOnClick(rMap))
+            nBits |= WB_NOPOINTERFOCUS;
         VclPtr<RadioButton> xButton = VclPtr<RadioButton>::Create(pParent, nBits);
         xButton->SetImageAlign(ImageAlign::Left); //default to left
         xWindow = xButton;
@@ -1275,6 +1293,8 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
         OUString sWrap = BuilderUtils::extractCustomProperty(rMap);
         if (!sWrap.isEmpty())
             nBits |= WB_WORDBREAK;
+        if (!extractFocusOnClick(rMap))
+            nBits |= WB_NOPOINTERFOCUS;
         //maybe always import as TriStateBox and enable/disable tristate
         bool bIsTriState = extractInconsistent(rMap);
         VclPtr<CheckBox> xCheckBox;
@@ -1656,12 +1676,18 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
                 VclPtr<vcl::Window> xParent(pParent);
                 pFunction(xWindow, xParent, rMap);
                 if (xWindow->GetType() == WindowType::PUSHBUTTON)
+                {
+                    if (!extractFocusOnClick(rMap))
+                        xWindow->SetStyle(xWindow->GetStyle() | WB_NOPOINTERFOCUS);
                     setupFromActionName(static_cast<Button*>(xWindow.get()), rMap, m_xFrame);
+                }
                 else if (xWindow->GetType() == WindowType::MENUBUTTON)
                 {
                     OUString sMenu = BuilderUtils::extractCustomProperty(rMap);
                     if (!sMenu.isEmpty())
                         m_pParserState->m_aButtonMenuMaps.emplace_back(id, sMenu);
+                    if (!extractFocusOnClick(rMap))
+                        xWindow->SetStyle(xWindow->GetStyle() | WB_NOPOINTERFOCUS);
                     setupFromActionName(static_cast<Button*>(xWindow.get()), rMap, m_xFrame);
                 }
             }


More information about the Libreoffice-commits mailing list