[Libreoffice-commits] core.git: 2 commits - cui/source desktop/source include/vcl svx/source vcl/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Thu Oct 20 10:53:41 UTC 2016


 cui/source/dialogs/SpellDialog.cxx                    |   28 ---------
 cui/source/inc/SpellDialog.hxx                        |    1 
 cui/source/inc/optlingu.hxx                           |    2 
 cui/source/options/optlingu.cxx                       |   54 ------------------
 desktop/source/app/app.cxx                            |    5 +
 desktop/source/app/appinit.cxx                        |    3 -
 desktop/source/deployment/gui/dp_gui_dialog2.cxx      |   18 ------
 desktop/source/deployment/gui/dp_gui_dialog2.hxx      |    2 
 desktop/source/deployment/gui/dp_gui_extlistbox.cxx   |    3 -
 desktop/source/deployment/gui/dp_gui_extlistbox.hxx   |    3 -
 desktop/source/deployment/gui/dp_gui_updatedialog.cxx |   24 --------
 desktop/source/deployment/gui/dp_gui_updatedialog.hxx |    1 
 include/vcl/fixedhyper.hxx                            |    2 
 svx/source/dialog/SafeModeDialog.cxx                  |   31 ----------
 svx/source/dialog/SafeModeDialog.hxx                  |    1 
 vcl/source/control/fixedhyper.cxx                     |   35 +++++++++++
 16 files changed, 45 insertions(+), 168 deletions(-)

New commits:
commit 11f6c6d59128be73e722441012cffb47cdf0058c
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Thu Oct 20 12:47:40 2016 +0200

    Check for enable safe mode earlier
    
    Change-Id: I50e48472bb840c70e9a7c11dd84f33c64d6e1422

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index c3bd15c..44598da 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -556,6 +556,11 @@ void Desktop::Init()
         SetBootstrapError( BE_UNO_SERVICEMANAGER, e.Message );
     }
 
+    // Check whether safe mode is enabled
+    CommandLineArgs& rCmdLine = GetCommandLineArgs();
+    if (rCmdLine.IsSafeMode() || sfx2::SafeMode::hasFlag())
+        Application::EnableSafeMode();
+
     // When we are in SafeMode we need to do changes before the configuration
     // gets read (langselect::prepareLocale() by UNO API -> Components::Components)
     // This may prepare SafeMode or restore from it by moving data in
diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx
index 3ea2482..6e6f56b 100644
--- a/desktop/source/app/appinit.cxx
+++ b/desktop/source/app/appinit.cxx
@@ -97,9 +97,6 @@ void Desktop::RegisterServices(Reference< XComponentContext > const & context)
         // interpret command line arguments
         CommandLineArgs& rCmdLine = GetCommandLineArgs();
 
-        if (rCmdLine.IsSafeMode() || sfx2::SafeMode::hasFlag())
-            Application::EnableSafeMode();
-
         // Headless mode for FAT Office, auto cancels any dialogs that popup
         if (rCmdLine.IsEventTesting())
             Application::EnableEventTestingMode();
commit f0006e79c4112b06b65c098722729b9a3f3301c7
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Thu Oct 20 10:49:24 2016 +0200

    Handle link click directly in FixedHyperlink
    
    Change-Id: I5b5f0648b6e6432b0928351a17d285df8c9da811

diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index a08ec75..7d76879 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -39,8 +39,6 @@
 #include <com/sun/star/lang/XServiceDisplayName.hpp>
 #include <com/sun/star/linguistic2/SpellFailure.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
-#include <com/sun/star/system/SystemShellExecute.hpp>
 #include <sfx2/app.hxx>
 #include <vcl/help.hxx>
 #include <vcl/graph.hxx>
@@ -308,8 +306,6 @@ void SpellDialog::Init_Impl()
 
     m_pLanguageLB->SetSelectHdl(LINK( this, SpellDialog, LanguageSelectHdl ) );
 
-    m_pExplainLink->SetClickHdl( LINK( this, SpellDialog, HandleHyperlink ) );
-
     // initialize language ListBox
     m_pLanguageLB->SetLanguageList( SvxLanguageListFlags::SPELL_USED, false, false, true );
 
@@ -2053,28 +2049,4 @@ void  SentenceEditWindow_Impl::SetUndoEditMode(bool bSet)
     pSpellDialog->m_pChangePB->Enable();
 }
 
-IMPL_LINK( SpellDialog, HandleHyperlink, FixedHyperlink&, rHyperlink, void )
-{
-    OUString sURL=rHyperlink.GetURL();
-    OUString sTitle=GetText();
-
-    if ( sURL.isEmpty() ) // Nothing to do, when the URL is empty
-        return;
-    try
-    {
-        uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute(
-            css::system::SystemShellExecute::create(::comphelper::getProcessComponentContext()) );
-        xSystemShellExecute->execute( sURL, OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY );
-    }
-    catch ( uno::Exception& )
-    {
-        uno::Any exc( ::cppu::getCaughtException() );
-        OUString msg( ::comphelper::anyToString( exc ) );
-        const SolarMutexGuard guard;
-        ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, msg);
-        aErrorBox->SetText(sTitle);
-        aErrorBox->Execute();
-    }
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx
index 0dc32c1..b268706 100644
--- a/cui/source/inc/SpellDialog.hxx
+++ b/cui/source/inc/SpellDialog.hxx
@@ -192,7 +192,6 @@ private:
     DECL_LINK( AddToDictClickHdl, Button*, void );
     DECL_LINK( LanguageSelectHdl, ListBox&, void );
     DECL_LINK( DialogUndoHdl, SpellUndoAction_Impl&, void );
-    DECL_LINK( HandleHyperlink, FixedHyperlink&, void );
 
     DECL_LINK( InitHdl, void*, void );
 
diff --git a/cui/source/inc/optlingu.hxx b/cui/source/inc/optlingu.hxx
index 3742d52..e192d36 100644
--- a/cui/source/inc/optlingu.hxx
+++ b/cui/source/inc/optlingu.hxx
@@ -81,7 +81,6 @@ class SvxEditModulesDlg : public ModalDialog
     DECL_LINK( LangSelectListBoxHdl_Impl, ListBox&, void );
     DECL_LINK( BoxCheckButtonHdl_Impl2, SvLBoxButtonData*, void );
     DECL_LINK( BoxCheckButtonHdl_Impl, SvTreeListBox*, void );
-    DECL_LINK( OpenURLHdl_Impl, FixedHyperlink&, void );
     void LangSelectHdl_Impl(ListBox*);
 
 public:
@@ -143,7 +142,6 @@ private:
     DECL_LINK( BoxDoubleClickHdl_Impl, SvTreeListBox*, bool );
     DECL_LINK( BoxCheckButtonHdl_Impl, SvTreeListBox*, void );
     DECL_LINK( PostDblClickHdl_Impl, void *, void);
-    DECL_LINK( OpenURLHdl_Impl, FixedHyperlink&, void );
 
     void                UpdateModulesBox_Impl();
     void                UpdateDicBox_Impl();
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 1901cc6..2b374b1 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -46,8 +46,6 @@
 #include <com/sun/star/linguistic2/XDictionaryList.hpp>
 #include <com/sun/star/frame/XStorable.hpp>
 #include <com/sun/star/ucb/CommandAbortedException.hpp>
-#include <com/sun/star/system/SystemShellExecute.hpp>
-#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
 #include <unotools/extendedsecurityoptions.hxx>
 #include <svtools/treelistbox.hxx>
 #include "svtools/treelistentry.hxx"
@@ -128,28 +126,6 @@ static sal_Int32 lcl_SeqGetEntryPos(
     return i < nLen ? i : -1;
 }
 
-static void lcl_OpenURL( const OUString& _sURL )
-{
-    if ( !_sURL.isEmpty() )
-    {
-        OUString sURL = _sURL;
-        localizeWebserviceURI(sURL);
-        try
-        {
-            uno::Reference< uno::XComponentContext > xContext =
-                ::comphelper::getProcessComponentContext();
-            uno::Reference< css::system::XSystemShellExecute > xSystemShell(
-                css::system::SystemShellExecute::create(xContext) );
-            xSystemShell->execute( sURL, OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY );
-        }
-        catch( const uno::Exception& e )
-        {
-             OSL_TRACE( "Caught exception: %s\n thread terminated.\n",
-                OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
-        }
-    }
-}
-
 bool KillFile_Impl( const OUString& rURL )
 {
     bool bRet = true;
@@ -1073,12 +1049,7 @@ SvxLinguTabPage::SvxLinguTabPage( vcl::Window* pParent, const SfxItemSet& rSet )
     m_pLinguOptionsCLB->SetSelectHdl( LINK( this, SvxLinguTabPage, SelectHdl_Impl ));
     m_pLinguOptionsCLB->SetDoubleClickHdl(LINK(this, SvxLinguTabPage, BoxDoubleClickHdl_Impl));
 
-    if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode()
-            != SvtExtendedSecurityOptions::OPEN_NEVER )
-    {
-        m_pMoreDictsLink->SetClickHdl( LINK( this, SvxLinguTabPage, OpenURLHdl_Impl ) );
-    }
-    else
+    if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode() == SvtExtendedSecurityOptions::OPEN_NEVER )
         m_pMoreDictsLink->Hide();
 
     xProp = LinguMgr::GetLinguPropertySet();
@@ -1513,13 +1484,6 @@ IMPL_LINK_NOARG(SvxLinguTabPage, PostDblClickHdl_Impl, void*, void)
 }
 
 
-IMPL_LINK_NOARG(SvxLinguTabPage, OpenURLHdl_Impl, FixedHyperlink&, void)
-{
-    OUString sURL( m_pMoreDictsLink->GetURL() );
-    lcl_OpenURL( sURL );
-}
-
-
 IMPL_LINK( SvxLinguTabPage, BoxCheckButtonHdl_Impl, SvTreeListBox *, pBox, void )
 {
     if (pBox == m_pLinguModulesCLB)
@@ -1832,15 +1796,8 @@ SvxEditModulesDlg::SvxEditModulesDlg(vcl::Window* pParent, SvxLinguData_Impl& rD
     m_pPrioUpPB->Enable( false );
     m_pPrioDownPB->Enable( false );
 
-    if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode()
-            != SvtExtendedSecurityOptions::OPEN_NEVER )
-    {
-        m_pMoreDictsLink->SetClickHdl( LINK( this, SvxEditModulesDlg, OpenURLHdl_Impl ) );
-    }
-    else
-    {
+    if ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode() == SvtExtendedSecurityOptions::OPEN_NEVER )
         m_pMoreDictsLink->Hide();
-    }
 
     //fill language box
     Sequence< sal_Int16 > aAvailLang;
@@ -2272,11 +2229,4 @@ IMPL_LINK_NOARG(SvxEditModulesDlg, BackHdl_Impl, Button*, void)
     LangSelectHdl_Impl(nullptr);
 }
 
-
-IMPL_LINK_NOARG(SvxEditModulesDlg, OpenURLHdl_Impl, FixedHyperlink&, void)
-{
-    OUString sURL( m_pMoreDictsLink->GetURL() );
-    lcl_OpenURL( sURL );
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index c753015..a2b7988 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -636,6 +636,7 @@ void DialogHelper::openWebBrowser( const OUString & sURL, const OUString &sTitle
     }
 }
 
+
 bool DialogHelper::installExtensionWarn( const OUString &rExtensionName ) const
 {
     const SolarMutexGuard guard;
@@ -700,12 +701,10 @@ ExtMgrDialog::ExtMgrDialog(vcl::Window *pParent, TheExtensionManager *pManager,
     get(m_pCancelBtn, "cancel");
 
     m_pExtensionBox->InitFromDialog(this);
-    m_pExtensionBox->SetHyperlinkHdl( LINK( this, ExtMgrDialog, HandleHyperlink ) );
 
     m_pAddBtn->SetClickHdl( LINK( this, ExtMgrDialog, HandleAddBtn ) );
     m_pCloseBtn->SetClickHdl( LINK( this, ExtMgrDialog, HandleCloseBtn ) );
 
-    m_pGetExtensions->SetClickHdl( LINK( this, ExtMgrDialog, HandleHyperlink ) );
     m_pCancelBtn->SetClickHdl( LINK( this, ExtMgrDialog, HandleCancelBtn ) );
 
     m_pBundledCbx->SetClickHdl( LINK( this, ExtMgrDialog, HandleExtTypeCbx ) );
@@ -1073,13 +1072,6 @@ IMPL_LINK_NOARG(ExtMgrDialog, HandleUpdateBtn, Button*, void)
 #endif
 }
 
-
-IMPL_LINK( ExtMgrDialog, HandleHyperlink, FixedHyperlink&, rHyperlink, void )
-{
-    openWebBrowser( rHyperlink.GetURL(), GetText() );
-}
-
-
 IMPL_LINK_NOARG(ExtMgrDialog, TimeOutHdl, Idle *, void)
 {
     if ( m_bStopProgress )
@@ -1199,8 +1191,6 @@ UpdateRequiredDialog::UpdateRequiredDialog(vcl::Window *pParent, TheExtensionMan
     get(m_pProgressText, "progresslabel");
     get(m_pProgressBar, "progress");
 
-    m_pExtensionBox->SetHyperlinkHdl( LINK( this, UpdateRequiredDialog, HandleHyperlink ) );
-
     m_pUpdateBtn->SetClickHdl( LINK( this, UpdateRequiredDialog, HandleUpdateBtn ) );
     m_pCloseBtn->SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCloseBtn ) );
     m_pCancelBtn->SetClickHdl( LINK( this, UpdateRequiredDialog, HandleCancelBtn ) );
@@ -1414,12 +1404,6 @@ IMPL_LINK_NOARG(UpdateRequiredDialog, HandleCloseBtn, Button*, void)
 }
 
 
-IMPL_LINK( UpdateRequiredDialog, HandleHyperlink, FixedHyperlink&, rHyperlink, void )
-{
-    openWebBrowser( rHyperlink.GetURL(), GetText() );
-}
-
-
 IMPL_LINK_NOARG(UpdateRequiredDialog, TimeOutHdl, Idle *, void)
 {
     if ( m_bStopProgress )
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
index 39c4065..fdd23d8 100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx
@@ -137,7 +137,6 @@ class ExtMgrDialog : public ModelessDialog,
     DECL_LINK( HandleCancelBtn, Button*, void );
     DECL_LINK( HandleCloseBtn, Button*, void );
     DECL_LINK( HandleExtTypeCbx, Button*, void );
-    DECL_LINK( HandleHyperlink, FixedHyperlink&, void );
     DECL_LINK(TimeOutHdl, Idle *, void);
     DECL_LINK( startProgress, void *, void );
     DECL_STATIC_LINK( ExtMgrDialog, Restart, void *, void );
@@ -204,7 +203,6 @@ class UpdateRequiredDialog : public ModalDialog,
     DECL_LINK( HandleCancelBtn, Button*, void );
     DECL_LINK(TimeOutHdl, Idle *, void);
     DECL_LINK( startProgress, void *, void );
-    DECL_LINK( HandleHyperlink, FixedHyperlink&, void );
 
     static bool     isEnabled( const css::uno::Reference< css::deployment::XPackage > &xPackage );
     static bool     checkDependencies( const css::uno::Reference< css::deployment::XPackage > &xPackage );
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index 2eaef29..df198dc 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -481,9 +481,6 @@ void ExtensionBox_Impl::DrawRow(vcl::RenderContext& rRenderContext, const Rectan
         rEntry->m_pPublisher->SetText(rEntry->m_sPublisher);
         Size aSize = FixedText::CalcMinimumTextSize(rEntry->m_pPublisher);
         rEntry->m_pPublisher->SetSizePixel(aSize);
-
-        if (m_aClickHdl.IsSet())
-            rEntry->m_pPublisher->SetClickHdl( m_aClickHdl );
     }
 
     // Get max title width
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
index 403311f..7543ad2 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
@@ -126,8 +126,6 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox
     Image m_aWarningImage;
     Image m_aDefaultImage;
 
-    Link<FixedHyperlink&,void> m_aClickHdl;
-
     VclPtr<ScrollBar>      m_pScrollBar;
 
     rtl::Reference<ExtensionRemovedListener> m_xRemoveListener;
@@ -185,7 +183,6 @@ public:
     long            PointToPos( const Point& rPos );
     void            SetScrollHdl( const Link<ScrollBar*,void>& rLink );
     void            DoScroll( long nDelta );
-    void            SetHyperlinkHdl( const Link<FixedHyperlink&,void>& rLink ){ m_aClickHdl = rLink; }
     virtual void    RecalcAll();
     void            RemoveUnlocked();
 
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 85ae2a0..cedfdbe 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -54,8 +54,6 @@
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
-#include <com/sun/star/system/SystemShellExecute.hpp>
 #include <com/sun/star/task/InteractionHandler.hpp>
 #include <com/sun/star/task/XAbortChannel.hpp>
 #include <com/sun/star/task/XJob.hpp>
@@ -911,10 +909,6 @@ void UpdateDialog::initDescription()
     m_pPublisherLink->Hide();
     m_pReleaseNotesLabel->Hide();
     m_pReleaseNotesLink->Hide();
-
-    Link<FixedHyperlink&,void> aLink = LINK( this, UpdateDialog, hyperlink_clicked );
-    m_pPublisherLink->SetClickHdl( aLink );
-    m_pReleaseNotesLink->SetClickHdl( aLink );
 }
 
 void UpdateDialog::clearDescription()
@@ -1308,22 +1302,4 @@ IMPL_LINK_NOARG(UpdateDialog, closeHandler, Button*, void)
     EndDialog();
 }
 
-IMPL_LINK( UpdateDialog, hyperlink_clicked, FixedHyperlink&, rHyperlink, void )
-{
-    OUString sURL = rHyperlink.GetURL();
-    if ( sURL.isEmpty() )
-        return;
-
-    try
-    {
-        uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute(
-            css::system::SystemShellExecute::create(m_context) );
-        //throws lang::IllegalArgumentException, system::SystemShellExecuteException
-        xSystemShellExecute->execute( sURL, OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY);
-    }
-    catch ( const uno::Exception& )
-    {
-    }
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
index 2662a41..96bb645 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx
@@ -163,7 +163,6 @@ private:
     DECL_LINK(allHandler, CheckBox&, void);
     DECL_LINK(okHandler, Button*, void);
     DECL_LINK(closeHandler, Button*, void);
-    DECL_LINK(hyperlink_clicked, FixedHyperlink&, void);
 
     css::uno::Reference< css::uno::XComponentContext >  m_context;
     VclPtr<FixedText> m_pchecking;
diff --git a/include/vcl/fixedhyper.hxx b/include/vcl/fixedhyper.hxx
index d98343c..98b5e15 100644
--- a/include/vcl/fixedhyper.hxx
+++ b/include/vcl/fixedhyper.hxx
@@ -40,6 +40,8 @@ class VCL_DLLPUBLIC FixedHyperlink : public FixedText
         /** is position X position hitting text */
         SAL_DLLPRIVATE bool ImplIsOverText(Point rPosition);
 
+        DECL_LINK(HandleClick, FixedHyperlink&, void);
+
     protected:
         /** overwrites Window::MouseMove().
 
diff --git a/svx/source/dialog/SafeModeDialog.cxx b/svx/source/dialog/SafeModeDialog.cxx
index b0f6ebe..ef97afb 100644
--- a/svx/source/dialog/SafeModeDialog.cxx
+++ b/svx/source/dialog/SafeModeDialog.cxx
@@ -67,8 +67,6 @@ SafeModeDialog::SafeModeDialog(vcl::Window* pParent)
     mpCBResetCustomizations->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl));
     mpCBResetWholeUserProfile->SetToggleHdl(LINK(this, SafeModeDialog, CheckBoxHdl));
 
-    mpBugLink->SetClickHdl(LINK(this, SafeModeDialog, HandleHyperlink));
-
     // Disable restart btn until some checkbox is active
     mpBtnRestart->Disable();
 
@@ -167,30 +165,6 @@ void SafeModeDialog::applyChanges()
         css::uno::Reference< css::task::XInteractionHandler >());
 }
 
-void SafeModeDialog::openWebBrowser(const OUString & sURL, const OUString &sTitle)
-{
-    if ( sURL.isEmpty() ) // Nothing to do, when the URL is empty
-        return;
-
-    try
-    {
-        uno::Reference< system::XSystemShellExecute > xSystemShellExecute(
-            system::SystemShellExecute::create(comphelper::getProcessComponentContext()));
-        //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException
-        xSystemShellExecute->execute( sURL, OUString(), system::SystemShellExecuteFlags::URIS_ONLY );
-    }
-    catch ( const uno::Exception& )
-    {
-        uno::Any exc(cppu::getCaughtException());
-        OUString msg(comphelper::anyToString(exc));
-        const SolarMutexGuard guard;
-        ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, msg);
-        aErrorBox->SetText( sTitle );
-        aErrorBox->Execute();
-    }
-}
-
-
 IMPL_LINK(SafeModeDialog, BtnHdl, Button*, pBtn, void)
 {
     if (pBtn == mpBtnContinue.get())
@@ -221,9 +195,4 @@ IMPL_LINK(SafeModeDialog, CheckBoxHdl, CheckBox&, /*pCheckBox*/, void)
     mpBtnRestart->Enable(bEnable);
 }
 
-IMPL_LINK( SafeModeDialog, HandleHyperlink, FixedHyperlink&, rHyperlink, void )
-{
-    SafeModeDialog::openWebBrowser( rHyperlink.GetURL(), GetText() );
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/dialog/SafeModeDialog.hxx b/svx/source/dialog/SafeModeDialog.hxx
index 815cb11..f385fc4 100644
--- a/svx/source/dialog/SafeModeDialog.hxx
+++ b/svx/source/dialog/SafeModeDialog.hxx
@@ -52,7 +52,6 @@ private:
 
     DECL_LINK(CheckBoxHdl, CheckBox&, void);
     DECL_LINK(BtnHdl, Button*, void);
-    DECL_LINK(HandleHyperlink, FixedHyperlink&, void);
 };
 
 #endif
diff --git a/vcl/source/control/fixedhyper.cxx b/vcl/source/control/fixedhyper.cxx
index 7f940dd2..51a12f6 100644
--- a/vcl/source/control/fixedhyper.cxx
+++ b/vcl/source/control/fixedhyper.cxx
@@ -19,6 +19,16 @@
 
 #include <vcl/fixedhyper.hxx>
 #include <vcl/svapp.hxx>
+#include <vcl/layout.hxx>
+#include <comphelper/anytostring.hxx>
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+
+#include <com/sun/star/system/XSystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <com/sun/star/system/SystemShellExecute.hpp>
+
+using namespace css;
 
 FixedHyperlink::FixedHyperlink(vcl::Window* pParent, WinBits nWinStyle)
     : FixedText(pParent, nWinStyle)
@@ -40,6 +50,8 @@ void FixedHyperlink::Initialize()
     SetControlForeground( Application::GetSettings().GetStyleSettings().GetLinkColor() );
     // calculates text len
     m_nTextLen = GetCtrlTextWidth( GetText() );
+
+    SetClickHdl(LINK(this, FixedHyperlink, HandleClick));
 }
 
 bool FixedHyperlink::ImplIsOverText(Point aPosition)
@@ -137,4 +149,27 @@ bool FixedHyperlink::set_property(const OString &rKey, const OString &rValue)
     return true;
 }
 
+IMPL_LINK(FixedHyperlink, HandleClick, FixedHyperlink&, rHyperlink, void)
+{
+    if ( rHyperlink.m_sURL.isEmpty() ) // Nothing to do, when the URL is empty
+        return;
+
+    try
+    {
+        uno::Reference< system::XSystemShellExecute > xSystemShellExecute(
+            system::SystemShellExecute::create(comphelper::getProcessComponentContext()));
+        //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException
+        xSystemShellExecute->execute( rHyperlink.m_sURL, OUString(), system::SystemShellExecuteFlags::URIS_ONLY );
+    }
+    catch ( const uno::Exception& )
+    {
+        uno::Any exc(cppu::getCaughtException());
+        OUString msg(comphelper::anyToString(exc));
+        const SolarMutexGuard guard;
+        ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, msg);
+        aErrorBox->SetText( rHyperlink.GetText() );
+        aErrorBox->Execute();
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list