[Libreoffice-commits] core.git: cui/source cui/uiconfig filter/source include/svtools sc/source svtools/source svx/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Mar 11 21:23:45 UTC 2019


 cui/source/options/dbregister.cxx                 |   10 -
 cui/source/options/doclinkdialog.cxx              |  114 +++++++++-------------
 cui/source/options/doclinkdialog.hxx              |   35 ++----
 cui/uiconfig/ui/databaselinkdialog.ui             |   20 ++-
 filter/source/xsltdialog/xmlfiltertabpagexslt.cxx |    8 -
 include/svtools/inettbc.hxx                       |   12 +-
 include/svtools/urlcontrol.hxx                    |    2 
 sc/source/ui/miscdlgs/datastreamdlg.cxx           |    4 
 sc/source/ui/miscdlgs/linkarea.cxx                |    8 -
 svtools/source/control/inettbc.cxx                |   37 ++++++-
 svx/source/form/datanavi.cxx                      |    2 
 svx/source/inc/datanavi.hxx                       |    6 -
 12 files changed, 139 insertions(+), 119 deletions(-)

New commits:
commit 5f9368a35d641c5b611fab9945969e92a0f368a1
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Mar 11 15:55:24 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Mar 11 22:23:21 2019 +0100

    weld ODocumentLinkDialog
    
    Change-Id: I9dd3a25e68da00acff24f5ccfafbfc97d9efcf54
    Reviewed-on: https://gerrit.libreoffice.org/69058
    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/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
index a30e059c7c10..e71fac5ccd80 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -403,15 +403,15 @@ void DbRegistrationOptionsPage::insertNewEntry( const OUString& _sName,const OUS
 
 void DbRegistrationOptionsPage::openLinkDialog(const OUString& _sOldName,const OUString& _sOldLocation,SvTreeListEntry const * _pEntry)
 {
-    ScopedVclPtrInstance< ODocumentLinkDialog > aDlg(this,_pEntry == nullptr);
+    ODocumentLinkDialog aDlg(GetDialogFrameWeld(), _pEntry == nullptr);
 
-    aDlg->setLink(_sOldName,_sOldLocation);
-    aDlg->setNameValidator(LINK( this, DbRegistrationOptionsPage, NameValidator ) );
+    aDlg.setLink(_sOldName,_sOldLocation);
+    aDlg.setNameValidator(LINK( this, DbRegistrationOptionsPage, NameValidator ) );
 
-    if ( aDlg->Execute() == RET_OK )
+    if (aDlg.run() == RET_OK)
     {
         OUString sNewName,sNewLocation;
-        aDlg->getLink(sNewName,sNewLocation);
+        aDlg.getLink(sNewName,sNewLocation);
         if ( _pEntry == nullptr || sNewName != _sOldName || sNewLocation != _sOldLocation )
         {
             if ( _pEntry )
diff --git a/cui/source/options/doclinkdialog.cxx b/cui/source/options/doclinkdialog.cxx
index 201cb18c7549..1baf362e778b 100644
--- a/cui/source/options/doclinkdialog.cxx
+++ b/cui/source/options/doclinkdialog.cxx
@@ -33,80 +33,60 @@
 
 namespace svx
 {
-
-
     using namespace ::com::sun::star;
     using namespace ::com::sun::star::uno;
     using namespace ::com::sun::star::ucb;
     using namespace ::svt;
 
-    ODocumentLinkDialog::ODocumentLinkDialog( vcl::Window* _pParent, bool _bCreateNew )
-        : ModalDialog(_pParent, "DatabaseLinkDialog",
-            "cui/ui/databaselinkdialog.ui")
+    ODocumentLinkDialog::ODocumentLinkDialog(weld::Window* pParent, bool _bCreateNew)
+        : GenericDialogController(pParent, "cui/ui/databaselinkdialog.ui", "DatabaseLinkDialog")
+        , m_xBrowseFile(m_xBuilder->weld_button("browse"))
+        , m_xName(m_xBuilder->weld_entry("name"))
+        , m_xOK(m_xBuilder->weld_button("ok"))
+        , m_xAltTitle(m_xBuilder->weld_label("alttitle"))
+        , m_xURL(new URLBox(m_xBuilder->weld_combo_box("url")))
     {
-        get(m_pURL, "url");
-        get(m_pOK, "ok");
-        get(m_pName, "name");
-        get(m_pBrowseFile, "browse");
-
         if (!_bCreateNew)
-            SetText(get<FixedText>("alttitle")->GetText());
+            m_xDialog->set_title(m_xAltTitle->get_label());
 
-        m_pURL->SetFilter("*.odb");
+        m_xURL->SetSmartProtocol(INetProtocol::File);
+        m_xURL->DisableHistory();
+        m_xURL->SetFilter("*.odb");
 
-        m_pName->SetModifyHdl( LINK(this, ODocumentLinkDialog, OnTextModified) );
-        m_pURL->SetModifyHdl( LINK(this, ODocumentLinkDialog, OnTextModified) );
-        m_pBrowseFile->SetClickHdl( LINK(this, ODocumentLinkDialog, OnBrowseFile) );
-        m_pOK->SetClickHdl( LINK(this, ODocumentLinkDialog, OnOk) );
-
-        m_pURL->SetDropDownLineCount(10);
+        m_xName->connect_changed( LINK(this, ODocumentLinkDialog, OnEntryModified) );
+        m_xURL->connect_changed( LINK(this, ODocumentLinkDialog, OnComboBoxModified) );
+        m_xBrowseFile->connect_clicked( LINK(this, ODocumentLinkDialog, OnBrowseFile) );
+        m_xOK->connect_clicked( LINK(this, ODocumentLinkDialog, OnOk) );
 
         validate();
-
-        m_pURL->SetDropDownLineCount( 5 );
     }
 
     ODocumentLinkDialog::~ODocumentLinkDialog()
     {
-        disposeOnce();
     }
 
-    void ODocumentLinkDialog::dispose()
+    void ODocumentLinkDialog::setLink(const OUString& rName, const OUString& rURL)
     {
-        m_pURL.clear();
-        m_pBrowseFile.clear();
-        m_pName.clear();
-        m_pOK.clear();
-        ModalDialog::dispose();
-    }
-
-
-    void ODocumentLinkDialog::setLink( const OUString& _rName, const OUString& _rURL )
-    {
-        m_pName->SetText(_rName);
-        m_pURL->SetText(_rURL);
+        m_xName->set_text(rName);
+        m_xURL->set_entry_text(rURL);
         validate();
     }
 
-
-    void ODocumentLinkDialog::getLink( OUString& _rName, OUString& _rURL ) const
+    void ODocumentLinkDialog::getLink(OUString& rName, OUString& rURL) const
     {
-        _rName = m_pName->GetText();
-        _rURL = m_pURL->GetText();
+        rName = m_xName->get_text();
+        rURL = m_xURL->get_active_text();
     }
 
-
     void ODocumentLinkDialog::validate( )
     {
-
-        m_pOK->Enable( ( !m_pName->GetText().isEmpty()) && ( !m_pURL->GetText().isEmpty() ) );
+        m_xOK->set_sensitive((!m_xName->get_text().isEmpty()) && (!m_xURL->get_active_text().isEmpty()));
     }
 
-
-    IMPL_LINK_NOARG(ODocumentLinkDialog, OnOk, Button*, void)
+    IMPL_LINK_NOARG(ODocumentLinkDialog, OnOk, weld::Button&, void)
     {
         // get the current URL
-        OUString sURL = m_pURL->GetText();
+        OUString sURL = m_xURL->get_active_text();
         OFileNotation aTransformer(sURL);
         sURL = aTransformer.get(OFileNotation::N_URL);
 
@@ -125,8 +105,8 @@ namespace svx
         if (!bFileExists)
         {
             OUString sMsg = CuiResId(STR_LINKEDDOC_DOESNOTEXIST);
-            sMsg = sMsg.replaceFirst("$file$", m_pURL->GetText());
-            std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+            sMsg = sMsg.replaceFirst("$file$", m_xURL->get_active_text());
+            std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_xDialog.get(),
                                                            VclMessageType::Warning, VclButtonsType::Ok, sMsg));
             xErrorBox->run();
             return;
@@ -135,37 +115,37 @@ namespace svx
         if ( aURL.GetProtocol() != INetProtocol::File )
         {
             OUString sMsg = CuiResId(STR_LINKEDDOC_NO_SYSTEM_FILE);
-            sMsg = sMsg.replaceFirst("$file$", m_pURL->GetText());
-            std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+            sMsg = sMsg.replaceFirst("$file$", m_xURL->get_active_text());
+            std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_xDialog.get(),
                                                            VclMessageType::Warning, VclButtonsType::Ok, sMsg));
             xErrorBox->run();
             return;
         }
 
-        OUString sCurrentText = m_pName->GetText();
+        OUString sCurrentText = m_xName->get_text();
         if ( m_aNameValidator.IsSet() )
         {
             if ( !m_aNameValidator.Call( sCurrentText ) )
             {
                 OUString sMsg = CuiResId(STR_NAME_CONFLICT);
                 sMsg = sMsg.replaceFirst("$file$", sCurrentText);
-                std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(GetFrameWeld(),
+                std::unique_ptr<weld::MessageDialog> xErrorBox(Application::CreateMessageDialog(m_xDialog.get(),
                                                                VclMessageType::Info, VclButtonsType::Ok, sMsg));
                 xErrorBox->run();
 
-                m_pName->SetSelection(Selection(0,sCurrentText.getLength()));
-                m_pName->GrabFocus();
+                m_xName->select_region(0, -1);
+                m_xName->grab_focus();
                 return;
             }
         }
 
-        EndDialog(RET_OK);
+        m_xDialog->response(RET_OK);
     }
 
-    IMPL_LINK_NOARG(ODocumentLinkDialog, OnBrowseFile, Button*, void)
+    IMPL_LINK_NOARG(ODocumentLinkDialog, OnBrowseFile, weld::Button&, void)
     {
         ::sfx2::FileDialogHelper aFileDlg(
-                ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, FileDialogFlags::NONE, GetFrameWeld());
+                ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, FileDialogFlags::NONE, m_xDialog.get());
         std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
         if ( pFilter )
         {
@@ -173,7 +153,7 @@ namespace svx
             aFileDlg.SetCurrentFilter(pFilter->GetUIName());
         }
 
-        OUString sPath = m_pURL->GetText();
+        OUString sPath = m_xURL->get_active_text();
         if (!sPath.isEmpty())
         {
             OFileNotation aTransformer( sPath, OFileNotation::N_SYSTEM );
@@ -183,35 +163,37 @@ namespace svx
         if (ERRCODE_NONE != aFileDlg.Execute())
             return;
 
-        if (m_pName->GetText().isEmpty())
+        if (m_xName->get_text().isEmpty())
         {   // default the name to the base of the chosen URL
             INetURLObject aParser;
 
             aParser.SetSmartProtocol(INetProtocol::File);
             aParser.SetSmartURL(aFileDlg.GetPath());
 
-            m_pName->SetText(aParser.getBase(INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset));
+            m_xName->set_text(aParser.getBase(INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset));
 
-            m_pName->SetSelection(Selection(0,m_pName->GetText().getLength()));
-            m_pName->GrabFocus();
+            m_xName->select_region(0, -1);
+            m_xName->grab_focus();
         }
         else
-            m_pURL->GrabFocus();
+            m_xURL->grab_focus();
 
         // get the path in system notation
         OFileNotation aTransformer(aFileDlg.GetPath(), OFileNotation::N_URL);
-        m_pURL->SetText(aTransformer.get(OFileNotation::N_SYSTEM));
+        m_xURL->set_entry_text(aTransformer.get(OFileNotation::N_SYSTEM));
 
         validate();
     }
 
-    IMPL_LINK_NOARG(ODocumentLinkDialog, OnTextModified, Edit&, void)
+    IMPL_LINK_NOARG(ODocumentLinkDialog, OnEntryModified, weld::Entry&, void)
     {
-        validate( );
+        validate();
     }
 
-
+    IMPL_LINK_NOARG(ODocumentLinkDialog, OnComboBoxModified, weld::ComboBox&, void)
+    {
+        validate();
+    }
 }
 
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/doclinkdialog.hxx b/cui/source/options/doclinkdialog.hxx
index 96a0577020e9..69e753f9828c 100644
--- a/cui/source/options/doclinkdialog.hxx
+++ b/cui/source/options/doclinkdialog.hxx
@@ -20,32 +20,27 @@
 #ifndef INCLUDED_CUI_SOURCE_OPTIONS_DOCLINKDIALOG_HXX
 #define INCLUDED_CUI_SOURCE_OPTIONS_DOCLINKDIALOG_HXX
 
-#include <vcl/dialog.hxx>
+#include <vcl/weld.hxx>
 #include <vcl/fixed.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/button.hxx>
 #include <svtools/inettbc.hxx>
-#include <svtools/urlcontrol.hxx>
-
 
 namespace svx
 {
-
     /** dialog for editing document links associated with data sources
     */
-    class ODocumentLinkDialog final : public ModalDialog
+    class ODocumentLinkDialog final : public weld::GenericDialogController
     {
-        VclPtr< ::svt::OFileURLControl> m_pURL;
-        VclPtr<PushButton>              m_pBrowseFile;
-        VclPtr<Edit>                    m_pName;
-        VclPtr<OKButton>                m_pOK;
-
         Link<const OUString&,bool>      m_aNameValidator;
 
+        std::unique_ptr<weld::Button> m_xBrowseFile;
+        std::unique_ptr<weld::Entry> m_xName;
+        std::unique_ptr<weld::Button> m_xOK;
+        std::unique_ptr<weld::Label> m_xAltTitle;
+        std::unique_ptr<URLBox> m_xURL;
+
     public:
-        ODocumentLinkDialog( vcl::Window* _pParent, bool _bCreateNew );
+        ODocumentLinkDialog(weld::Window* pParent, bool bCreateNew);
         virtual ~ODocumentLinkDialog() override;
-        virtual void dispose() override;
 
         // name validation has to be done by an external instance
         // the validator link gets a pointer to a String, and should return 0 if the string is not
@@ -56,17 +51,15 @@ namespace svx
         void    getLink(        OUString& _rName,         OUString& _rURL ) const;
 
     private:
-        DECL_LINK( OnTextModified, Edit&, void );
-        DECL_LINK( OnBrowseFile, Button*, void );
-        DECL_LINK( OnOk, Button*, void );
+        DECL_LINK( OnEntryModified, weld::Entry&, void );
+        DECL_LINK( OnComboBoxModified, weld::ComboBox&, void );
+        DECL_LINK( OnBrowseFile, weld::Button&, void );
+        DECL_LINK( OnOk, weld::Button&, void );
 
-        void validate( );
+        void validate();
     };
-
-
 }
 
-
 #endif // INCLUDED_CUI_SOURCE_OPTIONS_DOCLINKDIALOG_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/uiconfig/ui/databaselinkdialog.ui b/cui/uiconfig/ui/databaselinkdialog.ui
index a361d79c731c..f76432ee039e 100644
--- a/cui/uiconfig/ui/databaselinkdialog.ui
+++ b/cui/uiconfig/ui/databaselinkdialog.ui
@@ -1,13 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.18"/>
-  <requires lib="LibreOffice" version="1.0"/>
   <object class="GtkDialog" id="DatabaseLinkDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
     <property name="title" translatable="yes" context="databaselinkdialog|DatabaseLinkDialog">Create Database Link</property>
+    <property name="modal">True</property>
+    <property name="default_width">0</property>
+    <property name="default_height">0</property>
     <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
@@ -100,10 +105,10 @@
                   <object class="GtkLabel" id="label1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" context="databaselinkdialog|label1">_Database file:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">url</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -112,14 +117,16 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="svtlo-OFileURLControl" id="url">
+                  <object class="GtkComboBoxText" id="url">
                     <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" id="URLBox-entry1">
-                        <property name="can_focus">False</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="activates_default">True</property>
                       </object>
                     </child>
                   </object>
@@ -144,10 +151,10 @@
                   <object class="GtkLabel" id="label4">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" context="databaselinkdialog|label4">Registered _name:</property>
                     <property name="use_underline">True</property>
                     <property name="mnemonic_widget">name</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
@@ -159,6 +166,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
+                    <property name="activates_default">True</property>
                     <property name="width_chars">52</property>
                   </object>
                   <packing>
diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
index 51081a5d5063..5455ba82c738 100644
--- a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
+++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx
@@ -90,14 +90,14 @@ void XMLFilterTabPageXSLT::SetURL( URLBox& rURLBox, const OUString& rURL )
         osl::FileBase::getSystemPathFromFileURL( rURL, aPath );
 
         rURLBox.SetBaseURL( rURL );
-        rURLBox.SetText( aPath );
+        rURLBox.set_entry_text( aPath );
     }
     else if( rURL.matchIgnoreAsciiCase( "http://" ) ||
              rURL.matchIgnoreAsciiCase( "https://" ) ||
              rURL.matchIgnoreAsciiCase( "ftp://" ) )
     {
         rURLBox.SetBaseURL( rURL );
-        rURLBox.SetText( rURL );
+        rURLBox.set_entry_text( rURL );
     }
     else if( !rURL.isEmpty() )
     {
@@ -106,12 +106,12 @@ void XMLFilterTabPageXSLT::SetURL( URLBox& rURLBox, const OUString& rURL )
         osl::FileBase::getSystemPathFromFileURL( aURL, aPath );
 
         rURLBox.SetBaseURL( aURL );
-        rURLBox.SetText( aPath );
+        rURLBox.set_entry_text( aPath );
     }
     else
     {
         rURLBox.SetBaseURL( sInstPath );
-        rURLBox.SetText( "" );
+        rURLBox.set_entry_text( "" );
     }
 }
 
diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx
index c62754c6eb25..76858c3b9b1a 100644
--- a/include/svtools/inettbc.hxx
+++ b/include/svtools/inettbc.hxx
@@ -100,8 +100,11 @@ class SVT_DLLPUBLIC URLBox
     OUString                        aBaseURL;
     rtl::Reference< MatchContext_Impl > pCtx;
     std::unique_ptr<SvtURLBox_Impl> pImpl;
+    INetProtocol                    eSmartProtocol;
     bool                            bHistoryDisabled    : 1;
 
+    Link<weld::ComboBox&, void>     aChangeHdl;
+
     std::unique_ptr<weld::ComboBox> m_xWidget;
 
     DECL_DLLPRIVATE_LINK(           TryAutoComplete, Timer*, void);
@@ -115,21 +118,26 @@ public:
     URLBox(std::unique_ptr<weld::ComboBox> pWidget);
     ~URLBox();
 
-    void                            SetText(const OUString& rStr) { m_xWidget->set_entry_text(rStr); }
+    void                            set_entry_text(const OUString& rStr) { m_xWidget->set_entry_text(rStr); }
     void                            Clear() { m_xWidget->clear(); }
     void connect_entry_activate(const Link<weld::ComboBox&, bool>& rLink) { m_xWidget->connect_entry_activate(rLink); }
-    void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_xWidget->connect_changed(rLink); }
+    void connect_changed(const Link<weld::ComboBox&, void>& rLink) { aChangeHdl = rLink; }
     void                            append_text(const OUString& rStr) { m_xWidget->append_text(rStr); }
     OUString                        get_active_text() const { return m_xWidget->get_active_text(); }
+    void                            grab_focus() { m_xWidget->grab_focus(); }
     void                            EnableAutocomplete() { m_xWidget->set_entry_completion(true); }
 
     void                            SetBaseURL( const OUString& rURL );
+    void                            SetSmartProtocol( INetProtocol eProt );
+    INetProtocol                    GetSmartProtocol() const { return eSmartProtocol; }
     OUString                        GetURL();
     void                            DisableHistory();
 
     weld::Widget*                   getWidget() { return m_xWidget.get(); }
 
     static OUString                 ParseSmart( const OUString& aText, const OUString& aBaseURL );
+
+    void                            SetFilter(const OUString& _sFilter);
 };
 
 #endif
diff --git a/include/svtools/urlcontrol.hxx b/include/svtools/urlcontrol.hxx
index cdc830b2ef8b..6f001d3cbb71 100644
--- a/include/svtools/urlcontrol.hxx
+++ b/include/svtools/urlcontrol.hxx
@@ -27,7 +27,6 @@
 namespace svt
 {
 
-
     //= OFileURLControl
 
     class SVT_DLLPUBLIC OFileURLControl : public SvtURLBox
@@ -43,7 +42,6 @@ namespace svt
         virtual bool        EventNotify( NotifyEvent& rNEvt ) override;
     };
 
-
 }   // namespace svt
 
 
diff --git a/sc/source/ui/miscdlgs/datastreamdlg.cxx b/sc/source/ui/miscdlgs/datastreamdlg.cxx
index db07c124fdbd..de2fe23b3003 100644
--- a/sc/source/ui/miscdlgs/datastreamdlg.cxx
+++ b/sc/source/ui/miscdlgs/datastreamdlg.cxx
@@ -56,7 +56,7 @@ IMPL_LINK_NOARG(DataStreamDlg, BrowseHdl, weld::Button&, void)
     if ( aFileDialog.Execute() != ERRCODE_NONE )
         return;
 
-    m_xCbUrl->SetText( aFileDialog.GetPath() );
+    m_xCbUrl->set_entry_text(aFileDialog.GetPath());
     UpdateEnable();
 }
 
@@ -123,7 +123,7 @@ ScRange DataStreamDlg::GetStartRange()
 
 void DataStreamDlg::Init( const DataStream& rStrm )
 {
-    m_xCbUrl->SetText(rStrm.GetURL());
+    m_xCbUrl->set_entry_text(rStrm.GetURL());
     ScDocument& rDoc = m_pDocShell->GetDocument();
 
     ScRange aRange = rStrm.GetRange();
diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx
index 8e8d820ed52d..eedb528c704e 100644
--- a/sc/source/ui/miscdlgs/linkarea.cxx
+++ b/sc/source/ui/miscdlgs/linkarea.cxx
@@ -141,10 +141,10 @@ void ScLinkedAreaDlg::InitFromOldLink( const OUString& rFile, const OUString& rF
     if (m_pSourceShell)
     {
         SfxMedium* pMed = m_pSourceShell->GetMedium();
-        m_xCbUrl->SetText(pMed->GetName());
+        m_xCbUrl->set_entry_text(pMed->GetName());
     }
     else
-        m_xCbUrl->SetText(EMPTY_OUSTRING);
+        m_xCbUrl->set_entry_text(EMPTY_OUSTRING);
 
     UpdateSourceRanges();
 
@@ -217,7 +217,7 @@ IMPL_LINK( ScLinkedAreaDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg,
 
         if (!m_pSourceShell->GetError())                    // only errors
         {
-            m_xCbUrl->SetText(pMed->GetName());
+            m_xCbUrl->set_entry_text(pMed->GetName());
         }
         else
         {
@@ -225,7 +225,7 @@ IMPL_LINK( ScLinkedAreaDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg,
             m_pSourceShell = nullptr;
             aSourceRef.clear();
 
-            m_xCbUrl->SetText(EMPTY_OUSTRING);
+            m_xCbUrl->set_entry_text(EMPTY_OUSTRING);
         }
         pMed.release(); // DoLoad takes ownership
     }
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 460d0354123c..6869bf8c32e1 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -1151,11 +1151,12 @@ void MatchContext_Impl::doExecute()
     INetProtocol eBaseProt = INetURLObject::CompareProtocolScheme( pBox->aBaseURL );
     if ( pBox->aBaseURL.isEmpty() )
         eBaseProt = INetURLObject::CompareProtocolScheme( SvtPathOptions().GetWorkPath() );
+    INetProtocol eSmartProt = pBox->GetSmartProtocol();
 
     // if the user input is a valid URL, go on with it
     // otherwise it could be parsed smart with a predefined smart protocol
     // ( or if this is not set with the protocol of a predefined base URL )
-    if (eProt == INetProtocol::NotValid || eProt == eBaseProt)
+    if( eProt == INetProtocol::NotValid || eProt == eSmartProt || (eSmartProt == INetProtocol::NotValid && eProt == eBaseProt) )
     {
         // not stopped yet ?
         if( schedule() )
@@ -1264,7 +1265,7 @@ void MatchContext_Impl::doExecute()
     INetURLObject aCurObj;
     OUString aCurString, aCurMainURL;
     INetURLObject aObj;
-    aObj.SetSmartProtocol(INetProtocol::Http);
+    aObj.SetSmartProtocol( eSmartProt == INetProtocol::NotValid ? INetProtocol::Http : eSmartProt );
     for( ;; )
     {
         for(const auto& rPick : aPickList)
@@ -1279,6 +1280,9 @@ void MatchContext_Impl::doExecute()
             if( eProt != INetProtocol::NotValid && aCurObj.GetProtocol() != eProt )
                 continue;
 
+            if( eSmartProt != INetProtocol::NotValid && aCurObj.GetProtocol() != eSmartProt )
+                continue;
+
             switch( aCurObj.GetProtocol() )
             {
                 case INetProtocol::Http:
@@ -2013,7 +2017,8 @@ IMPL_LINK_NOARG(URLBox, TryAutoComplete, Timer *, void)
 }
 
 URLBox::URLBox(std::unique_ptr<weld::ComboBox> pWidget)
-    : bHistoryDisabled(false)
+    : eSmartProtocol(INetProtocol::NotValid)
+    , bHistoryDisabled(false)
     , m_xWidget(std::move(pWidget))
 {
     Init();
@@ -2044,9 +2049,20 @@ URLBox::~URLBox()
     }
 }
 
+void URLBox::SetSmartProtocol(INetProtocol eProt)
+{
+    if ( eSmartProtocol != eProt )
+    {
+        eSmartProtocol = eProt;
+        UpdatePicklistForSmartProtocol_Impl();
+    }
+}
+
 void URLBox::UpdatePicklistForSmartProtocol_Impl()
 {
     m_xWidget->clear();
+    if ( bHistoryDisabled )
+        return;
 
     if (bHistoryDisabled)
         return;
@@ -2071,6 +2087,12 @@ void URLBox::UpdatePicklistForSmartProtocol_Impl()
                 seqPropertySet[nProperty].Value >>= sURL;
                 aCurObj.SetURL( sURL );
 
+                if ( !sURL.isEmpty() && ( eSmartProtocol != INetProtocol::NotValid ) )
+                {
+                    if( aCurObj.GetProtocol() != eSmartProtocol )
+                        break;
+                }
+
                 OUString aURL( aCurObj.GetMainURL( INetURLObject::DecodeMechanism::WithCharset ) );
 
                 if ( !aURL.isEmpty() )
@@ -2102,6 +2124,7 @@ void URLBox::UpdatePicklistForSmartProtocol_Impl()
 
 IMPL_LINK_NOARG(URLBox, ChangedHdl, weld::ComboBox&, void)
 {
+    aChangeHdl.Call(*m_xWidget);
     aChangedIdle.Start(); //launch this to happen on idle after cursor position will have been set
 }
 
@@ -2152,6 +2175,8 @@ OUString URLBox::GetURL()
     {
         // no autocompletion for wildcards
         INetURLObject aTempObj;
+        if ( eSmartProtocol != INetProtocol::NotValid )
+            aTempObj.SetSmartProtocol( eSmartProtocol );
         if ( aTempObj.SetSmartURL( aText ) )
             return aTempObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
         else
@@ -2215,4 +2240,10 @@ void URLBox::DisableHistory()
     UpdatePicklistForSmartProtocol_Impl();
 }
 
+void URLBox::SetFilter(const OUString& _sFilter)
+{
+    pImpl->m_aFilters.clear();
+    FilterMatch::createWildCardFilterList(_sFilter,pImpl->m_aFilters);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx
index 7329be790087..c214352e1ea4 100644
--- a/svx/source/form/datanavi.cxx
+++ b/svx/source/form/datanavi.cxx
@@ -3319,7 +3319,7 @@ namespace svxform
         aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::DecodeMechanism::NONE ) );
 
         if (aDlg.Execute() == ERRCODE_NONE)
-            m_xURLED->SetText( aDlg.GetPath() );
+            m_xURLED->set_entry_text(aDlg.GetPath());
     }
 
     LinkedInstanceWarningBox::LinkedInstanceWarningBox(weld::Widget* pParent)
diff --git a/svx/source/inc/datanavi.hxx b/svx/source/inc/datanavi.hxx
index cf8a854affb1..431ad1c6a523 100644
--- a/svx/source/inc/datanavi.hxx
+++ b/svx/source/inc/datanavi.hxx
@@ -601,11 +601,11 @@ namespace svxform
         virtual ~AddInstanceDialog() override;
 
         OUString         GetName() const { return m_xNameED->get_text(); }
-        void             SetName( const OUString& _rName ) { m_xNameED->set_text( _rName );}
+        void             SetName( const OUString& rName ) { m_xNameED->set_text( rName );}
         OUString         GetURL() const { return m_xURLED->get_active_text(); }
-        void             SetURL( const OUString& _rURL ) { m_xURLED->SetText( _rURL );}
+        void             SetURL( const OUString& rURL ) { m_xURLED->set_entry_text( rURL );}
         bool             IsLinkInstance() const { return m_xLinkInstanceCB->get_active(); }
-        void             SetLinkInstance( bool _bLink ) { m_xLinkInstanceCB->set_active(_bLink); }
+        void             SetLinkInstance( bool bLink ) { m_xLinkInstanceCB->set_active(bLink); }
     };
 
     class LinkedInstanceWarningBox : public weld::MessageDialogController


More information about the Libreoffice-commits mailing list