cui/source/dialogs/cuihyperdlg.cxx |   13 -------------
 cui/source/dialogs/iconcdlg.cxx    |    7 -------
 cui/source/inc/cuihyperdlg.hxx     |    1 -
 3 files changed, 21 deletions(-)

New commits:
commit 7f3ef22976c0c0a793e9c5f6855626b1c57f50dc
Author:     Maya Stephens <maya.steph...@collabora.com>
AuthorDate: Thu Aug 28 11:40:55 2025 +0000
Commit:     Michael Stahl <michael.st...@collabora.com>
CommitDate: Mon Sep 15 15:28:14 2025 +0200

    Remove redundant code when hyperlink dialog is created
    
    The code for creating the hyperlink dialog end up calling the same functions
    multiple times, more than we need to. Previously the code would:
     - Create an empty SID_HYPERLINK_GETLINK item
     - Create the tabs, resetting the fields on each based on this empty item
     - Swap to the last used tab
     - Switch to the active page, and reset it again
     - Get the data about the object that was clicked
     - Reset all the tabs again from having loaded a new link
     - ... and reset them all
    
    A lot of these calls can be removed. Now, we:
     - Create the tabs, but without calling reset on them
            (because we don't have the information yet)
     - Get information about the currently selected shape
            (This automatically calls reset on them, and
            selects the most appropriate tab to show)
    
    Change-Id: I6a6a6964c16e8b3ba447029b4cfe0f41090ae2a8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190805
    Reviewed-by: Michael Stahl <michael.st...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/cui/source/dialogs/cuihyperdlg.cxx 
b/cui/source/dialogs/cuihyperdlg.cxx
index 11f03e6c98d1..005361c829bc 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -129,7 +129,6 @@ SvxHpLinkDlg::SvxHpLinkDlg(SfxBindings* pBindings, 
SfxChildWindow* pChild, weld:
 
     SetInputSet (mpItemSet.get());
 
-    // insert pages
     AddTabPage(u"internet"_ustr, SvxHyperlinkInternetTp::Create);
     AddTabPage(u"mail"_ustr, SvxHyperlinkMailTp::Create);
     if (!comphelper::LibreOfficeKit::isActive())
@@ -138,21 +137,9 @@ SvxHpLinkDlg::SvxHpLinkDlg(SfxBindings* pBindings, 
SfxChildWindow* pChild, weld:
         AddTabPage(u"newdocument"_ustr, SvxHyperlinkNewDocTp::Create);
     }
 
-    // tdf#90496 - remember last used view in hyperlink dialog
-    SetCurPageId(msRememberedPageId);
-
-    // Init Dialog
-    Start();
-
     GetBindings().Update(SID_HYPERLINK_GETLINK);
     GetBindings().Update(SID_READONLY_MODE);
 
-    // Now that we have got the link data, we can reset
-    // all the pages with the correct information
-    for (std::unique_ptr<IconChoicePageData>& page: maPageList) {
-        page->xPage->Reset(*pSet);
-    }
-
     m_xResetBtn->connect_clicked( LINK( this, SvxHpLinkDlg, ResetHdl ) );
     m_xOKBtn->connect_clicked( LINK ( this, SvxHpLinkDlg, ClickOkHdl_Impl ) );
     m_xApplyBtn->connect_clicked ( LINK ( this, SvxHpLinkDlg, 
ClickApplyHdl_Impl ) );
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index 9bda9d215dcf..373e83cc3999 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -75,7 +75,6 @@ void SvxHpLinkDlg::AddTabPage(const OUString& rId, CreatePage 
pCreateFunc /* !=
 {
     weld::Container* pPage = m_xIconCtrl->get_page(rId);
     maPageList.emplace_back(new IconChoicePageData(rId, pCreateFunc(pPage, 
this, pSet)));
-    maPageList.back()->xPage->Reset(*pSet);
     PageCreated(*maPageList.back()->xPage);
 }
 
@@ -273,12 +272,6 @@ bool SvxHpLinkDlg::QueryClose()
     return bRet;
 }
 
-void SvxHpLinkDlg::Start()
-{
-    SwitchPage(msCurrentPageId);
-    ActivatePageImpl();
-}
-
 /**********************************************************************
 |
 | tool-methods
diff --git a/cui/source/inc/cuihyperdlg.hxx b/cui/source/inc/cuihyperdlg.hxx
index 0f2e8f1ab4bd..f142d4cdfdf8 100644
--- a/cui/source/inc/cuihyperdlg.hxx
+++ b/cui/source/inc/cuihyperdlg.hxx
@@ -124,7 +124,6 @@ public:
     WhichRangesContainer GetInputRanges( const SfxItemPool& );
     void                SetInputSet( const SfxItemSet* pInSet );
 
-    void                Start();
     bool                QueryClose();
 
     void                PageCreated(IconChoicePage& rPage);

Reply via email to