include/svtools/inettbc.hxx                           |    2 
 reportdesign/uiconfig/dbreport/toolbar/Formatting.xml |    2 
 sc/source/ui/cctrl/cbnumberformat.cxx                 |    5 
 sc/source/ui/inc/cbnumberformat.hxx                   |    2 
 sd/source/ui/dlg/gluectrl.cxx                         |    5 
 sd/source/ui/inc/gluectrl.hxx                         |    2 
 sfx2/UIConfig_sfx.mk                                  |    1 
 sfx2/inc/inettbc.hxx                                  |   13 +-
 sfx2/source/inet/inettbc.cxx                          |  106 +++++++++++++-----
 sfx2/uiconfig/ui/urlbox.ui                            |   29 ++++
 svx/source/tbxctrls/tbunocontroller.cxx               |    3 
 sw/source/uibase/ribbar/workctrl.cxx                  |    9 +
 12 files changed, 147 insertions(+), 32 deletions(-)

New commits:
commit da7262415fb47710d5ff18fbc33e96a13412ae7b
Author:     Maxim Monastirsky <momonas...@gmail.com>
AuthorDate: Fri Feb 7 13:57:59 2020 +0200
Commit:     Maxim Monastirsky <momonas...@gmail.com>
CommitDate: Fri Feb 7 15:30:26 2020 +0100

    reportdesign: Use .uno:UnderlineSimple
    
    So we get a simple button, like it used to be before commit
    c81afdb5118536b2e2365a9a9af6b6e162c87aeb ("rework
    TextUnderlinePopup to be a PopupWindowController"). The
    dropdown doesn't work in reportdesign anyway.
    
    Change-Id: I9cec636ecc983a353b807624cea6523a9a2b92ad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88182
    Tested-by: Jenkins
    Reviewed-by: Maxim Monastirsky <momonas...@gmail.com>

diff --git a/reportdesign/uiconfig/dbreport/toolbar/Formatting.xml 
b/reportdesign/uiconfig/dbreport/toolbar/Formatting.xml
index 461bda940f01..7fdf1b3473c7 100644
--- a/reportdesign/uiconfig/dbreport/toolbar/Formatting.xml
+++ b/reportdesign/uiconfig/dbreport/toolbar/Formatting.xml
@@ -26,7 +26,7 @@
  <toolbar:toolbarseparator/>
  <toolbar:toolbaritem xlink:href=".uno:Bold"/>
  <toolbar:toolbaritem xlink:href=".uno:Italic"/>
- <toolbar:toolbaritem xlink:href=".uno:Underline"/>
+ <toolbar:toolbaritem xlink:href=".uno:UnderlineSimple"/>
  <toolbar:toolbarseparator/>
  <toolbar:toolbaritem xlink:href=".uno:LeftPara"/>
  <toolbar:toolbaritem xlink:href=".uno:CenterPara"/>
commit 91f54b1990153efd17ea5e33feffd1ec16b0387b
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Feb 7 11:57:21 2020 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Feb 7 15:30:15 2020 +0100

    weld URLBox ItemWindow
    
    Change-Id: I7dad000404a188e2f5588b90d73ea9b1236bd301
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88183
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx
index ac72b4d57bef..8625df7e935d 100644
--- a/include/svtools/inettbc.hxx
+++ b/include/svtools/inettbc.hxx
@@ -101,6 +101,7 @@ public:
     void                show() { m_xWidget->show(); }
     void                clear() { m_xWidget->clear(); }
     void                connect_entry_activate(const Link<weld::ComboBox&, 
bool>& rLink) { m_xWidget->connect_entry_activate(rLink); }
+    void                connect_key_press(const Link<const KeyEvent&, bool>& 
rLink) { m_xWidget->connect_key_press(rLink); }
     void                connect_changed(const Link<weld::ComboBox&, void>& 
rLink) { aChangeHdl = rLink; }
     void                trigger_changed() { aChangeHdl.Call(*m_xWidget); }
     void                connect_focus_in(const Link<weld::Widget&, void>& 
rLink) { aFocusInHdl = rLink; }
@@ -112,6 +113,7 @@ public:
     void                set_sensitive(bool bSensitive) { 
m_xWidget->set_sensitive(bSensitive); }
     void                set_help_id(const OString& rHelpId) { 
m_xWidget->set_help_id(rHelpId); }
     void                select_entry_region(int nStartPos, int nEndPos) { 
m_xWidget->select_entry_region(nStartPos, nEndPos); }
+    Size                get_preferred_size() const { return 
m_xWidget->get_preferred_size(); }
 
     void                EnableAutocomplete(bool bEnable = true) { 
m_xWidget->set_entry_completion(bEnable); }
     void                SetBaseURL( const OUString& rURL );
diff --git a/sc/source/ui/cctrl/cbnumberformat.cxx 
b/sc/source/ui/cctrl/cbnumberformat.cxx
index 830e24761d08..c02f342333df 100644
--- a/sc/source/ui/cctrl/cbnumberformat.cxx
+++ b/sc/source/ui/cctrl/cbnumberformat.cxx
@@ -58,6 +58,11 @@ ScNumberFormat::~ScNumberFormat()
     disposeOnce();
 }
 
+void ScNumberFormat::GetFocus()
+{
+    m_xWidget->grab_focus();
+}
+
 IMPL_STATIC_LINK(ScNumberFormat, NumFormatSelectHdl, weld::ComboBox&, rBox, 
void)
 {
     auto* pCurSh = SfxViewFrame::Current();
diff --git a/sc/source/ui/inc/cbnumberformat.hxx 
b/sc/source/ui/inc/cbnumberformat.hxx
index c2e2f40366bc..7edd3b7fe362 100644
--- a/sc/source/ui/inc/cbnumberformat.hxx
+++ b/sc/source/ui/inc/cbnumberformat.hxx
@@ -29,6 +29,8 @@ public:
     virtual void dispose() override;
     virtual ~ScNumberFormat() override;
 
+    virtual void GetFocus() override;
+
     void set_active(int nPos) { m_xWidget->set_active(nPos); }
 
 private:
diff --git a/sd/source/ui/dlg/gluectrl.cxx b/sd/source/ui/dlg/gluectrl.cxx
index 110d945055ee..0364aad81527 100644
--- a/sd/source/ui/dlg/gluectrl.cxx
+++ b/sd/source/ui/dlg/gluectrl.cxx
@@ -70,6 +70,11 @@ void GlueEscDirLB::dispose()
     InterimItemWindow::dispose();
 }
 
+void GlueEscDirLB::GetFocus()
+{
+    m_xWidget->grab_focus();
+}
+
 GlueEscDirLB::~GlueEscDirLB()
 {
     disposeOnce();
diff --git a/sd/source/ui/inc/gluectrl.hxx b/sd/source/ui/inc/gluectrl.hxx
index dcbd0f7fe97f..ebaf5b607d78 100644
--- a/sd/source/ui/inc/gluectrl.hxx
+++ b/sd/source/ui/inc/gluectrl.hxx
@@ -42,6 +42,8 @@ public:
     virtual void dispose() override;
     virtual ~GlueEscDirLB() override;
 
+    virtual void GetFocus() override;
+
     void set_active(int nPos) { m_xWidget->set_active(nPos); }
     void set_sensitive(bool bSensitive);
 
diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk
index af7247dd9e6d..15ccbcc24116 100644
--- a/sfx2/UIConfig_sfx.mk
+++ b/sfx2/UIConfig_sfx.mk
@@ -60,6 +60,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
        sfx2/uiconfig/ui/templatedlg \
        sfx2/uiconfig/ui/saveastemplatedlg \
        sfx2/uiconfig/ui/templatecategorydlg \
+       sfx2/uiconfig/ui/urlbox \
        sfx2/uiconfig/ui/versionsofdialog \
        sfx2/uiconfig/ui/versioncommentdialog \
        sfx2/uiconfig/ui/versionscmis \
diff --git a/sfx2/inc/inettbc.hxx b/sfx2/inc/inettbc.hxx
index 10bbf353fde3..d9c8f52a31c4 100644
--- a/sfx2/inc/inettbc.hxx
+++ b/sfx2/inc/inettbc.hxx
@@ -23,18 +23,21 @@
 #include <rtl/ustring.hxx>
 #include <sfx2/tbxctrl.hxx>
 
-class ComboBox;
-class SvtURLBox;
+namespace weld { class ComboBox; };
+class URLBoxItemWindow;
+class URLBox;
 
 class SfxURLToolBoxControl_Impl final : public SfxToolBoxControl
 {
 private:
+    bool                    m_bModified;
 
-    SvtURLBox*              GetURLBox() const;
+    URLBox*                 GetURLBox() const;
+    URLBoxItemWindow*       GetURLBoxItemWindow() const;
     void                    OpenURL( const OUString& rName ) const;
 
-    DECL_LINK(        OpenHdl, SvtURLBox*, void );
-    DECL_LINK(        SelectHdl, ComboBox&, void );
+    DECL_LINK(OpenHdl, weld::ComboBox&, bool);
+    DECL_LINK(SelectHdl, weld::ComboBox&, void);
 
     struct ExecuteInfo
     {
diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx
index c97e9d59bedf..283f0668cebd 100644
--- a/sfx2/source/inet/inettbc.cxx
+++ b/sfx2/source/inet/inettbc.cxx
@@ -34,6 +34,7 @@
 
 #include <svtools/inettbc.hxx>
 
+#include <sfx2/InterimItemWindow.hxx>
 #include <sfx2/sfxsids.hrc>
 
 using namespace ::com::sun::star::uno;
@@ -50,6 +51,7 @@ 
SFX_IMPL_TOOLBOX_CONTROL(SfxURLToolBoxControl_Impl,SfxStringItem)
 
 SfxURLToolBoxControl_Impl::SfxURLToolBoxControl_Impl( sal_uInt16 nSlotId, 
sal_uInt16 nId, ToolBox& rBox )
     : SfxToolBoxControl( nSlotId, nId, rBox )
+    , m_bModified(false)
 {
     addStatusListener( ".uno:CurrentURL");
 }
@@ -58,11 +60,64 @@ SfxURLToolBoxControl_Impl::~SfxURLToolBoxControl_Impl()
 {
 }
 
-SvtURLBox* SfxURLToolBoxControl_Impl::GetURLBox() const
+class URLBoxItemWindow final : public InterimItemWindow
 {
-    return static_cast<SvtURLBox*>(GetToolBox().GetItemWindow( GetId() ));
+private:
+    std::unique_ptr<URLBox> m_xWidget;
+
+    DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+public:
+    URLBoxItemWindow(vcl::Window* pParent)
+        : InterimItemWindow(pParent, "sfx/ui/urlbox.ui", "URLBox")
+        , m_xWidget(new URLBox(m_xBuilder->weld_combo_box("urlbox")))
+    {
+        m_xWidget->connect_key_press(LINK(this, URLBoxItemWindow, 
KeyInputHdl));
+
+        SetSizePixel(m_xWidget->get_preferred_size());
+    }
+
+    URLBox* GetURLBox()
+    {
+        return m_xWidget.get();
+    }
+
+    virtual void dispose() override
+    {
+        m_xWidget.reset();
+        InterimItemWindow::dispose();
+    }
+
+    virtual void GetFocus() override
+    {
+        m_xWidget->grab_focus();
+    }
+
+    void set_sensitive(bool bSensitive)
+    {
+        Enable(bSensitive);
+        m_xWidget->set_sensitive(bSensitive);
+    }
+
+    virtual ~URLBoxItemWindow() override
+    {
+        disposeOnce();
+    }
+};
+
+IMPL_LINK(URLBoxItemWindow, KeyInputHdl, const KeyEvent&, rKEvt, bool)
+{
+    return ChildKeyInput(rKEvt);
+}
+
+URLBoxItemWindow* SfxURLToolBoxControl_Impl::GetURLBoxItemWindow() const
+{
+    return static_cast<URLBoxItemWindow*>(GetToolBox().GetItemWindow(GetId()));
 }
 
+URLBox* SfxURLToolBoxControl_Impl::GetURLBox() const
+{
+    return GetURLBoxItemWindow()->GetURLBox();
+}
 
 void SfxURLToolBoxControl_Impl::OpenURL( const OUString& rName ) const
 {
@@ -132,27 +187,29 @@ IMPL_STATIC_LINK( SfxURLToolBoxControl_Impl, 
ExecuteHdl_Impl, void*, p, void )
     delete pExecuteInfo;
 }
 
-
 VclPtr<vcl::Window> SfxURLToolBoxControl_Impl::CreateItemWindow( vcl::Window* 
pParent )
 {
-    VclPtrInstance<SvtURLBox> pURLBox( pParent );
-    pURLBox->SetOpenHdl( LINK( this, SfxURLToolBoxControl_Impl, OpenHdl ) );
-    pURLBox->SetSelectHdl( LINK( this, SfxURLToolBoxControl_Impl, SelectHdl ) 
);
-    return pURLBox.get();
+    VclPtrInstance<URLBoxItemWindow> xURLBox(pParent);
+    URLBox* pURLBox = xURLBox->GetURLBox();
+    pURLBox->connect_changed(LINK(this, SfxURLToolBoxControl_Impl, SelectHdl));
+    pURLBox->connect_entry_activate(LINK(this, SfxURLToolBoxControl_Impl, 
OpenHdl));
+    return xURLBox;
 }
 
-IMPL_LINK_NOARG(SfxURLToolBoxControl_Impl, SelectHdl, ComboBox&, void)
+IMPL_LINK(SfxURLToolBoxControl_Impl, SelectHdl, weld::ComboBox&, rComboBox, 
void)
 {
-    SvtURLBox* pURLBox = GetURLBox();
+    m_bModified = true;
+
+    URLBox* pURLBox = GetURLBox();
     OUString aName( pURLBox->GetURL() );
 
-    if ( !pURLBox->IsTravelSelect() && !aName.isEmpty() )
+    if (rComboBox.changed_by_menu() && !aName.isEmpty())
         OpenURL( aName );
 }
 
-IMPL_LINK_NOARG(SfxURLToolBoxControl_Impl, OpenHdl, SvtURLBox*, void)
+IMPL_LINK_NOARG(SfxURLToolBoxControl_Impl, OpenHdl, weld::ComboBox&, bool)
 {
-    SvtURLBox* pURLBox = GetURLBox();
+    URLBox* pURLBox = GetURLBox();
     OpenURL( pURLBox->GetURL() );
 
     Reference< XDesktop2 > xDesktop = Desktop::create( m_xContext );
@@ -166,8 +223,9 @@ IMPL_LINK_NOARG(SfxURLToolBoxControl_Impl, OpenHdl, 
SvtURLBox*, void)
             pWin->ToTop( ToTopFlags::RestoreWhenMin );
         }
     }
-}
 
+    return true;
+}
 
 void SfxURLToolBoxControl_Impl::StateChanged
 (
@@ -179,21 +237,21 @@ void SfxURLToolBoxControl_Impl::StateChanged
     if ( nSID == SID_OPENURL )
     {
         // Disable URL box if command is disabled
-        GetURLBox()->Enable( SfxItemState::DISABLED != eState );
+        GetURLBoxItemWindow()->set_sensitive( SfxItemState::DISABLED != eState 
);
     }
 
-    if ( !GetURLBox()->IsEnabled() )
+    if ( !GetURLBoxItemWindow()->IsEnabled() )
         return;
 
     if( nSID == SID_FOCUSURLBOX )
     {
-        if ( GetURLBox()->IsVisible() )
-            GetURLBox()->GrabFocus();
+        if ( GetURLBoxItemWindow()->IsVisible() )
+            GetURLBoxItemWindow()->GrabFocus();
     }
-    else if ( !GetURLBox()->IsModified() && SfxItemState::DEFAULT == eState )
+    else if ( !m_bModified && SfxItemState::DEFAULT == eState )
     {
-        SvtURLBox* pURLBox = GetURLBox();
-        pURLBox->Clear();
+        URLBox* pURLBox = GetURLBox();
+        pURLBox->clear();
 
         const css::uno::Sequence< css::uno::Sequence< 
css::beans::PropertyValue > > lList = SvtHistoryOptions().GetList(ePICKLIST);
         for (const css::uno::Sequence< css::beans::PropertyValue >& lProps : 
lList)
@@ -212,9 +270,9 @@ void SfxURLToolBoxControl_Impl::StateChanged
                 OUString      sFile;
 
                 if (osl::FileBase::getSystemPathFromFileURL(sMainURL, sFile) 
== osl::FileBase::E_None)
-                    pURLBox->InsertEntry(sFile);
+                    pURLBox->append_text(sFile);
                 else
-                    pURLBox->InsertEntry(sMainURL);
+                    pURLBox->append_text(sMainURL);
             }
         }
 
@@ -224,10 +282,10 @@ void SfxURLToolBoxControl_Impl::StateChanged
         INetProtocol eProt = aURL.GetProtocol();
         if ( eProt == INetProtocol::File )
         {
-            pURLBox->SetText( aURL.PathToFileName() );
+            pURLBox->set_entry_text( aURL.PathToFileName() );
         }
         else
-            pURLBox->SetText( aURL.GetURLNoPass() );
+            pURLBox->set_entry_text( aURL.GetURLNoPass() );
     }
 }
 
diff --git a/sfx2/uiconfig/ui/urlbox.ui b/sfx2/uiconfig/ui/urlbox.ui
new file mode 100644
index 000000000000..75079a12149c
--- /dev/null
+++ b/sfx2/uiconfig/ui/urlbox.ui
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="sfx">
+  <requires lib="gtk+" version="3.18"/>
+  <object class="GtkBox" id="URLBox">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="hexpand">True</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkComboBoxText" id="urlbox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="has_entry">True</property>
+        <child internal-child="entry">
+          <object class="GtkEntry">
+            <property name="can_focus">True</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>
diff --git a/svx/source/tbxctrls/tbunocontroller.cxx 
b/svx/source/tbxctrls/tbunocontroller.cxx
index fc56a7d0e286..81c4b8e7bd73 100644
--- a/svx/source/tbxctrls/tbunocontroller.cxx
+++ b/svx/source/tbxctrls/tbunocontroller.cxx
@@ -86,7 +86,7 @@ class FontHeightToolBoxControl : public 
svt::ToolboxController,
         css::awt::FontDescriptor m_aCurrentFont;
 };
 
-class SvxFontSizeBox_Impl : public InterimItemWindow
+class SvxFontSizeBox_Impl final : public InterimItemWindow
 {
 public:
                         SvxFontSizeBox_Impl( vcl::Window* pParent,
@@ -101,7 +101,6 @@ public:
 
     virtual boost::property_tree::ptree DumpAsPropertyTree() override;
 
-protected:
     virtual void        DataChanged( const DataChangedEvent& rDCEvt ) override;
     virtual void        GetFocus() override;
 
diff --git a/sw/source/uibase/ribbar/workctrl.cxx 
b/sw/source/uibase/ribbar/workctrl.cxx
index 4a466ea722b5..70e5d4f73137 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -558,6 +558,11 @@ public:
         InterimItemWindow::dispose();
     }
 
+    virtual void GetFocus() override
+    {
+        m_xWidget->grab_focus();
+    }
+
     void save_value()
     {
         m_xWidget->save_value();
@@ -761,6 +766,10 @@ public:
         m_xWidget.reset();
         InterimItemWindow::dispose();
     }
+    virtual void GetFocus() override
+    {
+        m_xWidget->grab_focus();
+    }
     virtual ~SwJumpToSpecificBox_Impl() override
     {
         disposeOnce();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to