[Libreoffice-commits] core.git: cui/uiconfig include/sfx2 include/vcl sfx2/source sfx2/uiconfig sw/qa sw/uiconfig vcl/source vcl/unx

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 7 16:18:13 UTC 2018


 cui/uiconfig/ui/patterntabpage.ui            |    3 -
 cui/uiconfig/ui/transparencytabpage.ui       |   20 ++++----
 include/sfx2/mgetempl.hxx                    |    3 -
 include/vcl/weld.hxx                         |    2 
 sfx2/source/dialog/mgetempl.cxx              |   39 +++++++--------
 sfx2/uiconfig/ui/managestylepage.ui          |   67 ++++++---------------------
 sw/qa/uitest/writer_tests2/horizontalLine.py |    4 -
 sw/uiconfig/swriter/ui/footnoteareapage.ui   |    4 -
 sw/uiconfig/swriter/ui/textgridpage.ui       |    1 
 vcl/source/app/salvtables.cxx                |   15 ++++++
 vcl/unx/gtk3/gtk3gtkinst.cxx                 |   10 ++++
 11 files changed, 79 insertions(+), 89 deletions(-)

New commits:
commit 0593afe5606b6388a705f3e8b19e427fcbf7555b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Sep 6 17:32:45 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Sep 7 18:17:44 2018 +0200

    just edit Entry to readonly, instead of a shadow ro widget
    
    Change-Id: I28d6d3cceec5224a6b38bd44ec380974cd3bae12
    Reviewed-on: https://gerrit.libreoffice.org/60104
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/uiconfig/ui/patterntabpage.ui b/cui/uiconfig/ui/patterntabpage.ui
index 1d882b507029..836e9a5ee05f 100644
--- a/cui/uiconfig/ui/patterntabpage.ui
+++ b/cui/uiconfig/ui/patterntabpage.ui
@@ -178,9 +178,10 @@
                             <child>
                               <object class="GtkDrawingArea" id="CTL_PIXEL">
                                 <property name="visible">True</property>
-                                <property name="can_focus">False</property>
+                                <property name="can_focus">True</property>
                                 <property name="halign">start</property>
                                 <property name="valign">start</property>
+                                <property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
                                 <child internal-child="accessible">
                                   <object class="AtkObject" id="CTL_PIXEL-atkobject">
                                     <property name="AtkObject::accessible-name" translatable="yes" context="patterntabpage|CTL_PIXEL-atkobject">Pattern Editor</property>
diff --git a/cui/uiconfig/ui/transparencytabpage.ui b/cui/uiconfig/ui/transparencytabpage.ui
index f2c6ff5b77a3..4961059ec762 100644
--- a/cui/uiconfig/ui/transparencytabpage.ui
+++ b/cui/uiconfig/ui/transparencytabpage.ui
@@ -74,7 +74,7 @@
                       <object class="GtkRadioButton" id="RBT_TRANS_OFF">
                         <property name="label" translatable="yes" context="transparencytabpage|RBT_TRANS_OFF">_No transparency</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
                         <property name="use_underline">True</property>
                         <property name="xalign">0</property>
@@ -91,7 +91,7 @@
                       <object class="GtkRadioButton" id="RBT_TRANS_LINEAR">
                         <property name="label" translatable="yes" context="transparencytabpage|RBT_TRANS_LINEAR">_Transparency:</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
                         <property name="use_underline">True</property>
                         <property name="xalign">0</property>
@@ -111,7 +111,7 @@
                       <object class="GtkRadioButton" id="RBT_TRANS_GRADIENT">
                         <property name="label" translatable="yes" context="transparencytabpage|RBT_TRANS_GRADIENT">_Gradient</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
                         <property name="use_underline">True</property>
                         <property name="xalign">0</property>
@@ -126,7 +126,7 @@
                     <child>
                       <object class="GtkSpinButton" id="MTR_TRANSPARENT">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can_focus">True</property>
                         <property name="activates_default">True</property>
                         <property name="adjustment">adjustmentPercent</property>
                         <accessibility>
@@ -160,7 +160,7 @@
                     <child>
                       <object class="GtkSpinButton" id="MTR_TRGR_END_VALUE">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can_focus">True</property>
                         <property name="activates_default">True</property>
                         <property name="adjustment">adjustmentPercent5</property>
                       </object>
@@ -172,7 +172,7 @@
                     <child>
                       <object class="GtkSpinButton" id="MTR_TRGR_START_VALUE">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can_focus">True</property>
                         <property name="activates_default">True</property>
                         <property name="adjustment">adjustmentPercent4</property>
                       </object>
@@ -184,7 +184,7 @@
                     <child>
                       <object class="GtkSpinButton" id="MTR_TRGR_BORDER">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can_focus">True</property>
                         <property name="activates_default">True</property>
                         <property name="adjustment">adjustmentPercent3</property>
                       </object>
@@ -196,7 +196,7 @@
                     <child>
                       <object class="GtkSpinButton" id="MTR_TRGR_ANGLE">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can_focus">True</property>
                         <property name="activates_default">True</property>
                         <property name="adjustment">adjustmentDegrees</property>
                       </object>
@@ -208,7 +208,7 @@
                     <child>
                       <object class="GtkSpinButton" id="MTR_TRGR_CENTER_Y">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can_focus">True</property>
                         <property name="activates_default">True</property>
                         <property name="adjustment">adjustmentPercent2</property>
                       </object>
@@ -220,7 +220,7 @@
                     <child>
                       <object class="GtkSpinButton" id="MTR_TRGR_CENTER_X">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can_focus">True</property>
                         <property name="activates_default">True</property>
                         <property name="adjustment">adjustmentPercent1</property>
                       </object>
diff --git a/include/sfx2/mgetempl.hxx b/include/sfx2/mgetempl.hxx
index 238d662c33f5..d63b1a05ed0a 100644
--- a/include/sfx2/mgetempl.hxx
+++ b/include/sfx2/mgetempl.hxx
@@ -49,8 +49,7 @@ class SfxManageStyleSheetPage final : public SfxTabPage
     OUString aParent;
     SfxStyleSearchBits nFlags;
 
-    std::unique_ptr<weld::TextView> m_xNameRo;
-    std::unique_ptr<weld::Entry> m_xNameRw;
+    std::unique_ptr<weld::Entry> m_xName;
     std::unique_ptr<weld::CheckButton> m_xAutoCB;
     std::unique_ptr<weld::Label> m_xFollowFt;
     std::unique_ptr<weld::ComboBoxText> m_xFollowLb;
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 89a4bed797de..6ea83851ef85 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -44,6 +44,7 @@ public:
     virtual void set_visible(bool visible) = 0;
     virtual bool get_visible() const = 0; //if this widget visibility is true
     virtual bool is_visible() const = 0; //if this widget visibility and all parents is true
+    virtual void set_can_focus(bool bCanFocus) = 0;
     virtual void grab_focus() = 0;
     virtual bool has_focus() const = 0;
     virtual void set_has_default(bool has_default) = 0;
@@ -492,6 +493,7 @@ public:
     virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) = 0;
     virtual void set_position(int nCursorPos) = 0;
     virtual void set_editable(bool bEditable) = 0;
+    virtual bool get_editable() const = 0;
 
     virtual vcl::Font get_font() = 0;
     virtual void set_font(const vcl::Font& rFont) = 0;
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index 86cbaef7b9f5..b878329bcf63 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -54,8 +54,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(TabPageParent pParent, const Sf
     , aFollow(pStyle->GetFollow())
     , aParent(pStyle->GetParent())
     , nFlags(pStyle->GetMask())
-    , m_xNameRo(m_xBuilder->weld_text_view("namero"))
-    , m_xNameRw(m_xBuilder->weld_entry("namerw"))
+    , m_xName(m_xBuilder->weld_entry("name"))
     , m_xAutoCB(m_xBuilder->weld_check_button("autoupdate"))
     , m_xFollowFt(m_xBuilder->weld_label("nextstyleft"))
     , m_xFollowLb(m_xBuilder->weld_combo_box_text("nextstyle"))
@@ -68,7 +67,6 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(TabPageParent pParent, const Sf
     , m_xDescFt(m_xBuilder->weld_label("desc"))
     , m_xNameFt(m_xBuilder->weld_label("nameft"))
 {
-    m_xNameRo->set_size_request(m_xNameRw->get_preferred_size().Width(), -1);
     m_xFollowLb->make_sorted();
     const int nMaxWidth(m_xFollowLb->get_approximate_digit_width() * 50);
     m_xFollowLb->set_size_request(nMaxWidth , -1);
@@ -117,16 +115,14 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(TabPageParent pParent, const Sf
         aFollow = pStyle->GetFollow();
         aParent = pStyle->GetParent();
     }
-    m_xNameRw->set_text(pStyle->GetName());
+    m_xName->set_text(pStyle->GetName());
 
     // Set the field read-only if it is NOT an user-defined style
     // but allow selecting and copying
-    if (!pStyle->IsUserDefined())
+    if (pStyle->IsUserDefined())
     {
-        m_xNameRo->set_text(m_xNameRw->get_text());
-        m_xNameRw->hide();
-        m_xNameRo->show();
-        m_xNameFt->set_mnemonic_widget(m_xNameRo.get());
+        m_xName->set_can_focus(true);
+        m_xName->set_editable(true);
     }
 
     if ( pStyle->HasFollowSupport() && pPool )
@@ -227,9 +223,9 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(TabPageParent pParent, const Sf
 
     if (m_xFollowLb->get_sensitive() || m_xBaseLb->get_sensitive())
     {
-        m_xNameRw->connect_focus_in(
+        m_xName->connect_focus_in(
             LINK( this, SfxManageStyleSheetPage, GetFocusHdl ) );
-        m_xNameRw->connect_focus_out(
+        m_xName->connect_focus_out(
             LINK( this, SfxManageStyleSheetPage, LoseFocusHdl ) );
     }
     // It is a style with auto update? (SW only)
@@ -319,7 +315,7 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl()
 IMPL_LINK_NOARG(SfxManageStyleSheetPage, EditStyleSelectHdl_Impl, weld::ComboBoxText&, void)
 {
     OUString aTemplName(m_xFollowLb->get_active_text());
-    OUString aEditTemplName(m_xNameRo->get_text());
+    OUString aEditTemplName(m_xName->get_text());
     if (!( aTemplName == aEditTemplName))
         m_xEditStyleBtn->set_sensitive(true);
     else
@@ -468,8 +464,9 @@ void SfxManageStyleSheetPage::Reset( const SfxItemSet* /*rAttrSet*/ )
 
     if ( sCmp != aName )
         pStyle->SetName( aName );
-    m_xNameRw->set_text( aName );
-    m_xNameRw->select_region(0, -1);
+    m_xName->set_text( aName );
+    if (m_xName->get_editable())
+        m_xName->select_region(0, -1);
 
     if ( m_xFollowLb->get_sensitive() )
     {
@@ -547,7 +544,7 @@ void SfxManageStyleSheetPage::ActivatePage( const SfxItemSet& rSet)
          rSet.GetItemState( SID_ATTR_AUTO_STYLE_UPDATE, false, &pPoolItem ) )
         m_xAutoCB->set_active(static_cast<const SfxBoolItem*>(pPoolItem)->GetValue());
     m_xAutoCB->save_state();
-    m_xNameRw->save_value();
+    m_xName->save_value();
 }
 
 DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
@@ -569,20 +566,20 @@ DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
 {
     DeactivateRC nRet = DeactivateRC::LeavePage;
 
-    if (m_xNameRw->get_value_changed_from_saved())
+    if (m_xName->get_value_changed_from_saved())
     {
         // By pressing <Enter> LoseFocus() is not triggered through StarView
-        if (m_xNameRw->has_focus())
-            LoseFocusHdl( *m_xNameRw );
+        if (m_xName->has_focus())
+            LoseFocusHdl( *m_xName );
 
-        if (!pStyle->SetName(comphelper::string::stripStart(m_xNameRw->get_text(), ' ')))
+        if (!pStyle->SetName(comphelper::string::stripStart(m_xName->get_text(), ' ')))
         {
             std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
                                                                      VclMessageType::Info, VclButtonsType::Ok,
                                                                      SfxResId(STR_TABPAGE_INVALIDNAME)));
             xBox->run();
-            m_xNameRw->grab_focus();
-            m_xNameRw->select_region(0, -1);
+            m_xName->grab_focus();
+            m_xName->select_region(0, -1);
             return DeactivateRC::KeepPage;
         }
         bModified = true;
diff --git a/sfx2/uiconfig/ui/managestylepage.ui b/sfx2/uiconfig/ui/managestylepage.ui
index 30dbb6ddf707..54841c9c0c07 100644
--- a/sfx2/uiconfig/ui/managestylepage.ui
+++ b/sfx2/uiconfig/ui/managestylepage.ui
@@ -36,7 +36,7 @@
                     <property name="can_focus">False</property>
                     <property name="label" translatable="yes" context="managestylepage|nameft">_Name:</property>
                     <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">namerw</property>
+                    <property name="mnemonic_widget">name</property>
                     <property name="xalign">1</property>
                   </object>
                   <packing>
@@ -102,7 +102,7 @@
                   <object class="GtkButton" id="editstyle">
                     <property name="label" translatable="yes" context="managestylepage|editstyle">Edit Style</property>
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
                   </object>
                   <packing>
@@ -126,7 +126,7 @@
                   <object class="GtkButton" id="editlinkstyle">
                     <property name="label" translatable="yes" context="managestylepage|editlinkstyle">Edit Style</property>
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
                   </object>
                   <packing>
@@ -147,53 +147,6 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkGrid" id="grid2">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="column_spacing">12</property>
-                    <child>
-                      <object class="GtkEntry" id="namerw">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="valign">center</property>
-                        <property name="hexpand">True</property>
-                        <property name="width_chars">52</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkScrolledWindow" id="scrolledwindow1">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="hscrollbar_policy">never</property>
-                        <property name="vscrollbar_policy">never</property>
-                        <property name="shadow_type">in</property>
-                        <child>
-                          <object class="GtkTextView" id="namero">
-                            <property name="can_focus">True</property>
-                            <property name="no_show_all">True</property>
-                            <property name="valign">center</property>
-                            <property name="hexpand">True</property>
-                            <property name="editable">False</property>
-                            <property name="cursor_visible">False</property>
-                          </object>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="left_attach">1</property>
-                    <property name="top_attach">0</property>
-                  </packing>
-                </child>
-                <child>
                   <object class="GtkCheckButton" id="autoupdate">
                     <property name="label" translatable="yes" context="managestylepage|autoupdate">_AutoUpdate</property>
                     <property name="can_focus">True</property>
@@ -209,6 +162,20 @@
                   </packing>
                 </child>
                 <child>
+                  <object class="GtkEntry" id="name">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="valign">center</property>
+                    <property name="hexpand">True</property>
+                    <property name="editable">False</property>
+                    <property name="width_chars">52</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                  </packing>
+                </child>
+                <child>
                   <placeholder/>
                 </child>
                 <child>
diff --git a/sw/qa/uitest/writer_tests2/horizontalLine.py b/sw/qa/uitest/writer_tests2/horizontalLine.py
index 7a25d36ee19e..c102f603157d 100644
--- a/sw/qa/uitest/writer_tests2/horizontalLine.py
+++ b/sw/qa/uitest/writer_tests2/horizontalLine.py
@@ -23,7 +23,7 @@ class WriterInsertHorizontalLine(UITestCase):
 
         self.ui_test.execute_dialog_through_command(".uno:EditStyle")  #open style dialog
         xDialog = self.xUITest.getTopFocusWindow()
-        xStyleNametxt = xDialog.getChild("namerw")
+        xStyleNametxt = xDialog.getChild("name")
         self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name
         xCancBtn = xDialog.getChild("cancel")
         self.ui_test.close_dialog_through_button(xCancBtn)
@@ -33,7 +33,7 @@ class WriterInsertHorizontalLine(UITestCase):
 
         self.ui_test.execute_dialog_through_command(".uno:EditStyle")  #open style dialog
         xDialog = self.xUITest.getTopFocusWindow()
-        xStyleNametxt = xDialog.getChild("namerw")
+        xStyleNametxt = xDialog.getChild("name")
         self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line")  #check style name
         xCancBtn = xDialog.getChild("cancel")
         self.ui_test.close_dialog_through_button(xCancBtn)
diff --git a/sw/uiconfig/swriter/ui/footnoteareapage.ui b/sw/uiconfig/swriter/ui/footnoteareapage.ui
index 47c4db80c019..ec0e9c253d18 100644
--- a/sw/uiconfig/swriter/ui/footnoteareapage.ui
+++ b/sw/uiconfig/swriter/ui/footnoteareapage.ui
@@ -297,7 +297,7 @@
                 <child>
                   <object class="GtkMenuButton" id="style">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
                     <property name="halign">start</property>
                     <property name="hexpand">True</property>
@@ -314,7 +314,7 @@
                 <child>
                   <object class="GtkMenuButton" id="color">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
                     <property name="halign">start</property>
                     <property name="hexpand">True</property>
diff --git a/sw/uiconfig/swriter/ui/textgridpage.ui b/sw/uiconfig/swriter/ui/textgridpage.ui
index 76cc6d1435d0..811f68ee9a30 100644
--- a/sw/uiconfig/swriter/ui/textgridpage.ui
+++ b/sw/uiconfig/swriter/ui/textgridpage.ui
@@ -293,7 +293,6 @@
                         <property name="valign">start</property>
                         <property name="row_spacing">6</property>
                         <property name="column_spacing">12</property>
-                        <property name="row_homogeneous">True</property>
                         <child>
                           <object class="GtkSpinButton" id="spinMF_CHARWIDTH">
                             <property name="visible">True</property>
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 6eff8ea00b1e..4ad3fd6cf393 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -220,6 +220,16 @@ public:
         return m_xWidget->IsReallyVisible();
     }
 
+    virtual void set_can_focus(bool bCanFocus) override
+    {
+        auto nStyle = m_xWidget->GetStyle() & ~(WB_TABSTOP | WB_NOTABSTOP);
+        if (bCanFocus)
+            nStyle |= WB_TABSTOP;
+        else
+            nStyle |= WB_NOTABSTOP;
+        m_xWidget->SetStyle(nStyle);
+    }
+
     virtual void grab_focus() override
     {
         m_xWidget->GrabFocus();
@@ -1419,6 +1429,11 @@ public:
         m_xEntry->SetReadOnly(!bEditable);
     }
 
+    virtual bool get_editable() const override
+    {
+        return !m_xEntry->IsReadOnly();
+    }
+
     virtual vcl::Font get_font() override
     {
         return m_xEntry->GetFont();
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 762eeabc8911..8ebccbbf2cc4 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1232,6 +1232,11 @@ public:
         return gtk_widget_is_visible(m_pWidget);
     }
 
+    virtual void set_can_focus(bool bCanFocus) override
+    {
+        gtk_widget_set_can_focus(m_pWidget, bCanFocus);
+    }
+
     virtual void grab_focus() override
     {
         gtk_widget_grab_focus(m_pWidget);
@@ -3380,6 +3385,11 @@ public:
         gtk_editable_set_editable(GTK_EDITABLE(m_pEntry), bEditable);
     }
 
+    virtual bool get_editable() const override
+    {
+        return gtk_editable_get_editable(GTK_EDITABLE(m_pEntry));
+    }
+
     virtual void disable_notify_events() override
     {
         g_signal_handler_block(m_pEntry, m_nInsertTextSignalId);


More information about the Libreoffice-commits mailing list