2010-10-12 15:57:08 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-10-04 11:25:41 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2017-06-13 11:19:58 +02:00
|
|
|
#include <sal/config.h>
|
|
|
|
|
2018-11-12 20:55:41 +01:00
|
|
|
#include <osl/diagnose.h>
|
2018-07-25 15:47:54 +01:00
|
|
|
#include <comphelper/lok.hxx>
|
2009-10-31 00:36:06 +01:00
|
|
|
#include <unotools/viewoptions.hxx>
|
2017-10-23 22:43:01 +02:00
|
|
|
#include <cuihyperdlg.hxx>
|
|
|
|
#include <hlinettp.hxx>
|
|
|
|
#include <hlmailtp.hxx>
|
|
|
|
#include <hldoctp.hxx>
|
|
|
|
#include <hldocntp.hxx>
|
2019-07-13 08:13:32 +02:00
|
|
|
#include <sfx2/app.hxx>
|
2019-06-23 19:51:15 +01:00
|
|
|
#include <sfx2/viewfrm.hxx>
|
2019-07-13 08:13:32 +02:00
|
|
|
#include <svl/eitem.hxx>
|
2013-10-22 15:58:57 +03:00
|
|
|
#include <svx/svxids.hrc>
|
2018-03-17 23:35:08 +01:00
|
|
|
#include <dialmgr.hxx>
|
2017-10-23 22:43:01 +02:00
|
|
|
#include <strings.hrc>
|
2016-03-18 11:09:04 +05:30
|
|
|
#include <vector>
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
using ::com::sun::star::uno::Reference;
|
|
|
|
using ::com::sun::star::frame::XFrame;
|
|
|
|
|
2014-02-25 18:04:51 +01:00
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
//# #
|
|
|
|
//# Childwindow-Wrapper-Class #
|
|
|
|
//# #
|
2014-02-25 18:04:51 +01:00
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2011-01-14 12:41:27 +01:00
|
|
|
SvxHlinkCtrl::SvxHlinkCtrl( sal_uInt16 _nId, SfxBindings & rBindings, SvxHpLinkDlg* pDlg )
|
2015-05-06 11:54:24 +01:00
|
|
|
: SfxControllerItem ( _nId, rBindings )
|
|
|
|
, aRdOnlyForwarder ( SID_READONLY_MODE, *this )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
pParent = pDlg;
|
|
|
|
}
|
|
|
|
|
2015-05-29 16:50:50 +02:00
|
|
|
void SvxHlinkCtrl::dispose()
|
|
|
|
{
|
2019-06-23 19:51:15 +01:00
|
|
|
pParent = nullptr;
|
2015-05-29 16:50:50 +02:00
|
|
|
aRdOnlyForwarder.dispose();
|
|
|
|
::SfxControllerItem::dispose();
|
|
|
|
}
|
|
|
|
|
2021-06-17 10:17:25 +02:00
|
|
|
void SvxHlinkCtrl::StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState,
|
2009-10-31 00:36:06 +01:00
|
|
|
const SfxPoolItem* pState )
|
|
|
|
{
|
2020-04-17 14:48:19 +02:00
|
|
|
if (!(eState == SfxItemState::DEFAULT && pParent))
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch ( nSID )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2020-04-17 14:48:19 +02:00
|
|
|
case SID_HYPERLINK_GETLINK :
|
|
|
|
{
|
|
|
|
pParent->SetPage( static_cast<const SvxHyperlinkItem*>(pState) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SID_READONLY_MODE :
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2020-04-17 14:48:19 +02:00
|
|
|
pParent->SetReadOnlyMode( static_cast<const SfxBoolItem*>(pState)->GetValue() );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
2020-04-17 14:48:19 +02:00
|
|
|
break;
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-03 17:01:10 +02:00
|
|
|
// tdf#90496 - remember last used view in hyperlink dialog
|
|
|
|
OUString SvxHpLinkDlg::msRememberedPageId("internet");
|
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
//# #
|
|
|
|
//# Hyperlink - Dialog #
|
|
|
|
//# #
|
2019-06-23 19:51:15 +01:00
|
|
|
SvxHpLinkDlg::SvxHpLinkDlg(SfxBindings* pBindings, SfxChildWindow* pChild, weld::Window* pParent)
|
|
|
|
: SfxModelessDialogController(pBindings, pChild, pParent, "cui/ui/hyperlinkdialog.ui", "HyperlinkDialog")
|
2019-06-23 20:01:05 +01:00
|
|
|
, pSet ( nullptr )
|
|
|
|
, maCtrl ( SID_HYPERLINK_GETLINK, *pBindings, this )
|
|
|
|
, mbIsHTMLDoc ( false )
|
2019-10-09 12:09:36 +01:00
|
|
|
, m_xIconCtrl(m_xBuilder->weld_notebook("tabcontrol"))
|
2019-06-23 19:51:15 +01:00
|
|
|
, m_xOKBtn(m_xBuilder->weld_button("ok"))
|
|
|
|
, m_xApplyBtn(m_xBuilder->weld_button("apply"))
|
|
|
|
, m_xCancelBtn(m_xBuilder->weld_button("cancel"))
|
|
|
|
, m_xHelpBtn(m_xBuilder->weld_button("help"))
|
|
|
|
, m_xResetBtn(m_xBuilder->weld_button("reset"))
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2019-06-23 19:51:15 +01:00
|
|
|
m_xIconCtrl->connect_enter_page( LINK ( this, SvxHpLinkDlg, ChosePageHdl_Impl ) );
|
|
|
|
m_xIconCtrl->show();
|
2019-06-23 20:01:05 +01:00
|
|
|
|
|
|
|
// ItemSet
|
|
|
|
if ( pSet )
|
|
|
|
{
|
2021-05-11 09:51:23 +02:00
|
|
|
pExampleSet.reset(new SfxItemSet( *pSet ));
|
2019-06-23 20:01:05 +01:00
|
|
|
pOutSet.reset(new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() ));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Buttons
|
2019-06-23 19:51:15 +01:00
|
|
|
m_xOKBtn->show();
|
|
|
|
m_xApplyBtn->show();
|
|
|
|
m_xCancelBtn->show();
|
|
|
|
m_xHelpBtn->show();
|
|
|
|
m_xResetBtn->show();
|
2019-06-23 20:01:05 +01:00
|
|
|
|
2014-04-16 11:39:08 +02:00
|
|
|
mbGrabFocus = true;
|
2014-06-24 09:43:30 +01:00
|
|
|
|
|
|
|
// set OK/Cancel - button
|
2021-11-26 01:01:47 +02:00
|
|
|
m_xCancelBtn->set_label(CuiResId(RID_CUISTR_HYPDLG_CLOSEBUT));
|
2009-10-31 00:36:06 +01:00
|
|
|
|
|
|
|
// create itemset for tabpages
|
2021-10-08 06:39:31 +02:00
|
|
|
mpItemSet = std::make_unique<SfxItemSetFixed<SID_HYPERLINK_GETLINK,
|
|
|
|
SID_HYPERLINK_SETLINK>>( SfxGetpApp()->GetPool());
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2016-04-23 20:23:29 +02:00
|
|
|
SvxHyperlinkItem aItem(SID_HYPERLINK_GETLINK);
|
|
|
|
mpItemSet->Put(aItem);
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2017-06-13 11:19:58 +02:00
|
|
|
SetInputSet (mpItemSet.get());
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2019-06-23 19:51:15 +01:00
|
|
|
// insert pages
|
|
|
|
AddTabPage("internet", SvxHyperlinkInternetTp::Create);
|
|
|
|
AddTabPage("mail", SvxHyperlinkMailTp::Create);
|
|
|
|
if (!comphelper::LibreOfficeKit::isActive())
|
|
|
|
{
|
|
|
|
AddTabPage("document", SvxHyperlinkDocTp::Create);
|
|
|
|
AddTabPage("newdocument", SvxHyperlinkNewDocTp::Create);
|
|
|
|
}
|
|
|
|
|
2023-04-26 10:37:40 +02:00
|
|
|
// tdf#90496 - remember last used view in hyperlink dialog
|
2023-05-03 17:01:10 +02:00
|
|
|
SetCurPageId(msRememberedPageId);
|
2014-06-24 09:43:30 +01:00
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
// Init Dialog
|
2016-03-14 13:41:38 +02:00
|
|
|
Start();
|
2009-10-31 00:36:06 +01:00
|
|
|
|
Reliably set up controls of hyperlink dialog in constructor
The recently added test_insert_hyperlink in
sw/qa/uitest/writer_tests3/hyperlinkdialog.py (UITest_writer_tests3) has often
failed on slow builds like <https://ci.libreoffice.org/job/lo_ubsan/>, by
hitting the assert in rtl_uString_newFromSubString as described at
<https://lists.freedesktop.org/archives/libreoffice/2020-July/085594.html> "Race
with SwEditWinUIObject::get_state during UITest_writer_tests3?" However, it
turns out that the actual race is rather different from what was assumed there:
The initial content of the dialog's controls like "target" and "indication" were
only set during the first SvxHlinkCtrl::StateChanged(SID_HYERLINK_GETLINK),
which is called from the SfxBindings machinery based on a timer. When that
happens, any text that has already been typed into those controls by the user
would be overwritten again. But in normal GUI operations, the timer fires so
quickly that the user has not yet typed anything into those controls. On the
other hand, for a typical (fast) execution of test_insert_hyperlink, the whole
test has already been executed when the timer fires, so the overwriting is not
noticed.
But for a slow execution of the test, the timer may e.g. fire after the
"indication" control's content ("link") has been typed in (which
SvxHlinkCtrl::StateChanged will reset to the empty string) and before the dialog
is closed (so instead of "link", the empty string will be added to the Writer
document, and obtaining the text selection of length 4 will crash as described
in the email). (Also, the two calls to wait_until_property_is_updated added
with 27798238ecb200e0753b013c79df0e6c014c7a7a "uitest : Avoid any timing issue
in test_insert_hyperlink" and 1cdda798def040fe778348061c0e18b28aa0e6bd "Further
timing issues with test_insert_hyperlink" probably just address other symptoms
caused by the same underlying issue, and should no longer be necessary with this
fix. But cleaning that up is left for a follow-up commit.)
The solution is to set up the controls' initial content already in the
constructor, so when the SfxBindings timer fires for the first time, it no
longer calls StateChanged because that state has already been recorded.
However, that caused the focus no longer to be set to the "target" control when
the dialog is opened, at least for the gen and svp VCL backends (which caused
the .uno:HyperlinkDialog-related tests in
desktop/qa/desktop_lib/test_desktop_lib.cxx, CppunitTest_desktop_lib, to fail
because GetFocusControl returned null): The first call to
SvxHlinkCtrl::StateChanged -> SvxHplinkDlg::SetPage now happens during the
constructor, before the dialog is shown, so the request to grab the focus in
SetInitFocus was ignored. The solution to that problem is to shift setting the
initial focus to the first call of SvxHpLInkDlg::Activate, which is called
whenever the dialog gains focus.
Change-Id: Ib4d5e06dfc21014ccec546565426fa2d27e63ce1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99903
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-07-31 22:38:09 +02:00
|
|
|
GetBindings().Update(SID_HYPERLINK_GETLINK);
|
2019-06-23 19:51:15 +01:00
|
|
|
GetBindings().Update(SID_READONLY_MODE);
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2019-06-23 19:51:15 +01:00
|
|
|
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 ) );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2019-06-23 19:51:15 +01:00
|
|
|
SvxHpLinkDlg::~SvxHpLinkDlg()
|
2015-01-15 15:47:39 +02:00
|
|
|
{
|
2021-04-05 20:02:37 +01:00
|
|
|
mbGrabFocus = false; // don't do any grab if tear-down moves focus around during destruction
|
|
|
|
|
2019-06-23 19:51:15 +01:00
|
|
|
// delete config item, so the base class (SfxModelessDialogController) can not load it on the next start
|
2017-03-29 08:43:55 +02:00
|
|
|
SvtViewOptions aViewOpt( EViewType::TabDialog, OUString::number(SID_HYPERLINK_DIALOG) );
|
2009-10-31 00:36:06 +01:00
|
|
|
aViewOpt.Delete();
|
|
|
|
|
2017-06-13 11:19:58 +02:00
|
|
|
mpItemSet.reset();
|
2015-03-02 22:02:19 +00:00
|
|
|
|
2015-05-06 11:54:24 +01:00
|
|
|
maCtrl.dispose();
|
|
|
|
|
2019-06-23 20:01:05 +01:00
|
|
|
maPageList.clear();
|
|
|
|
|
|
|
|
pRanges.reset();
|
|
|
|
pOutSet.reset();
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
Reliably set up controls of hyperlink dialog in constructor
The recently added test_insert_hyperlink in
sw/qa/uitest/writer_tests3/hyperlinkdialog.py (UITest_writer_tests3) has often
failed on slow builds like <https://ci.libreoffice.org/job/lo_ubsan/>, by
hitting the assert in rtl_uString_newFromSubString as described at
<https://lists.freedesktop.org/archives/libreoffice/2020-July/085594.html> "Race
with SwEditWinUIObject::get_state during UITest_writer_tests3?" However, it
turns out that the actual race is rather different from what was assumed there:
The initial content of the dialog's controls like "target" and "indication" were
only set during the first SvxHlinkCtrl::StateChanged(SID_HYERLINK_GETLINK),
which is called from the SfxBindings machinery based on a timer. When that
happens, any text that has already been typed into those controls by the user
would be overwritten again. But in normal GUI operations, the timer fires so
quickly that the user has not yet typed anything into those controls. On the
other hand, for a typical (fast) execution of test_insert_hyperlink, the whole
test has already been executed when the timer fires, so the overwriting is not
noticed.
But for a slow execution of the test, the timer may e.g. fire after the
"indication" control's content ("link") has been typed in (which
SvxHlinkCtrl::StateChanged will reset to the empty string) and before the dialog
is closed (so instead of "link", the empty string will be added to the Writer
document, and obtaining the text selection of length 4 will crash as described
in the email). (Also, the two calls to wait_until_property_is_updated added
with 27798238ecb200e0753b013c79df0e6c014c7a7a "uitest : Avoid any timing issue
in test_insert_hyperlink" and 1cdda798def040fe778348061c0e18b28aa0e6bd "Further
timing issues with test_insert_hyperlink" probably just address other symptoms
caused by the same underlying issue, and should no longer be necessary with this
fix. But cleaning that up is left for a follow-up commit.)
The solution is to set up the controls' initial content already in the
constructor, so when the SfxBindings timer fires for the first time, it no
longer calls StateChanged because that state has already been recorded.
However, that caused the focus no longer to be set to the "target" control when
the dialog is opened, at least for the gen and svp VCL backends (which caused
the .uno:HyperlinkDialog-related tests in
desktop/qa/desktop_lib/test_desktop_lib.cxx, CppunitTest_desktop_lib, to fail
because GetFocusControl returned null): The first call to
SvxHlinkCtrl::StateChanged -> SvxHplinkDlg::SetPage now happens during the
constructor, before the dialog is shown, so the request to grab the focus in
SetInitFocus was ignored. The solution to that problem is to shift setting the
initial focus to the first call of SvxHpLInkDlg::Activate, which is called
whenever the dialog gains focus.
Change-Id: Ib4d5e06dfc21014ccec546565426fa2d27e63ce1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99903
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-07-31 22:38:09 +02:00
|
|
|
void SvxHpLinkDlg::Activate() {
|
|
|
|
if (mbGrabFocus) {
|
|
|
|
static_cast<SvxHyperlinkTabPageBase *>(GetTabPage(GetCurPageId()))->SetInitFocus();
|
|
|
|
mbGrabFocus = false;
|
|
|
|
}
|
|
|
|
SfxModelessDialogController::Activate();
|
|
|
|
}
|
|
|
|
|
2019-06-23 19:51:15 +01:00
|
|
|
void SvxHpLinkDlg::Close()
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2019-06-23 19:51:15 +01:00
|
|
|
if (IsClosing())
|
|
|
|
return;
|
2022-12-15 20:17:37 +00:00
|
|
|
if (SfxViewFrame* pViewFrame = SfxViewFrame::Current())
|
2019-06-23 19:51:15 +01:00
|
|
|
pViewFrame->ToggleChildWindow(SID_HYPERLINK_DIALOG);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
2022-01-14 21:01:34 +01:00
|
|
|
void SvxHpLinkDlg::Apply()
|
2014-08-17 13:34:20 +02:00
|
|
|
{
|
2021-09-26 18:42:37 +02:00
|
|
|
SfxItemSetFixed<SID_HYPERLINK_GETLINK, SID_HYPERLINK_SETLINK> aItemSet( SfxGetpApp()->GetPool() );
|
2014-08-17 13:34:20 +02:00
|
|
|
|
2014-10-21 14:08:19 +02:00
|
|
|
SvxHyperlinkTabPageBase* pCurrentPage = static_cast<SvxHyperlinkTabPageBase*>(
|
|
|
|
GetTabPage( GetCurPageId() ) );
|
2014-08-17 13:34:20 +02:00
|
|
|
|
2022-01-14 21:01:34 +01:00
|
|
|
pCurrentPage->FillItemSet( &aItemSet );
|
2014-08-17 13:34:20 +02:00
|
|
|
|
2022-01-14 21:01:34 +01:00
|
|
|
const SvxHyperlinkItem *aItem = aItemSet.GetItem(SID_HYPERLINK_SETLINK);
|
|
|
|
if ( !aItem->GetURL().isEmpty() )
|
|
|
|
GetDispatcher()->ExecuteList(SID_HYPERLINK_SETLINK,
|
|
|
|
SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, { aItem });
|
2014-08-17 13:34:20 +02:00
|
|
|
|
2022-01-14 21:01:34 +01:00
|
|
|
static_cast<SvxHyperlinkTabPageBase*>( GetTabPage( GetCurPageId() ) )->DoApply();
|
2014-08-17 13:34:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Click on OK button
|
2019-06-23 19:51:15 +01:00
|
|
|
IMPL_LINK_NOARG(SvxHpLinkDlg, ClickOkHdl_Impl, weld::Button&, void)
|
2014-08-17 13:34:20 +02:00
|
|
|
{
|
2022-01-14 21:01:34 +01:00
|
|
|
Apply();
|
2019-06-23 19:51:15 +01:00
|
|
|
m_xDialog->response(RET_OK);
|
2014-08-17 13:34:20 +02:00
|
|
|
}
|
|
|
|
|
2009-10-31 00:36:06 +01:00
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2014-02-26 11:48:56 +01:00
|
|
|
|* Click on Apply-button
|
2009-10-31 00:36:06 +01:00
|
|
|
|*
|
|
|
|
|************************************************************************/
|
2019-06-23 19:51:15 +01:00
|
|
|
IMPL_LINK_NOARG(SvxHpLinkDlg, ClickApplyHdl_Impl, weld::Button&, void)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2022-01-14 21:01:34 +01:00
|
|
|
Apply();
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Set Page
|
|
|
|
|*
|
|
|
|
|************************************************************************/
|
2017-07-31 15:13:12 +02:00
|
|
|
void SvxHpLinkDlg::SetPage ( SvxHyperlinkItem const * pItem )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2023-04-02 01:18:42 +03:00
|
|
|
OUString sPageId("internet");
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2013-09-30 11:03:58 +01:00
|
|
|
OUString aStrURL(pItem->GetURL());
|
|
|
|
INetURLObject aURL(aStrURL);
|
2009-10-31 00:36:06 +01:00
|
|
|
INetProtocol eProtocolTyp = aURL.GetProtocol();
|
|
|
|
|
|
|
|
switch ( eProtocolTyp )
|
|
|
|
{
|
2015-04-02 18:32:36 +02:00
|
|
|
case INetProtocol::Http :
|
|
|
|
case INetProtocol::Ftp :
|
2019-06-23 19:51:15 +01:00
|
|
|
sPageId = "internet";
|
2009-10-31 00:36:06 +01:00
|
|
|
break;
|
2015-04-02 18:32:36 +02:00
|
|
|
case INetProtocol::File :
|
2019-06-23 19:51:15 +01:00
|
|
|
sPageId = "document";
|
2009-10-31 00:36:06 +01:00
|
|
|
break;
|
2015-04-02 18:32:36 +02:00
|
|
|
case INetProtocol::Mailto :
|
2019-06-23 19:51:15 +01:00
|
|
|
sPageId = "mail";
|
2009-10-31 00:36:06 +01:00
|
|
|
break;
|
|
|
|
default :
|
2014-02-04 15:06:48 +01:00
|
|
|
if (aStrURL.startsWith("#"))
|
2019-06-23 19:51:15 +01:00
|
|
|
sPageId = "document";
|
2009-10-31 00:36:06 +01:00
|
|
|
else
|
|
|
|
{
|
2016-04-18 11:03:43 +02:00
|
|
|
// not valid
|
2019-06-23 19:51:15 +01:00
|
|
|
sPageId = GetCurPageId();
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-06-23 19:51:15 +01:00
|
|
|
ShowPage (sPageId);
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2019-06-23 19:51:15 +01:00
|
|
|
SvxHyperlinkTabPageBase* pCurrentPage = static_cast<SvxHyperlinkTabPageBase*>(GetTabPage( sPageId ));
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2015-04-24 12:25:14 +02:00
|
|
|
mbIsHTMLDoc = (pItem->GetInsertMode() & HLINK_HTMLMODE) != 0;
|
2009-10-31 00:36:06 +01:00
|
|
|
|
2019-06-23 19:51:15 +01:00
|
|
|
IconChoicePage* pPage = GetTabPage (sPageId);
|
2014-06-22 12:24:33 +02:00
|
|
|
if(pPage)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2017-06-03 21:14:19 +02:00
|
|
|
SfxItemSet& aPageSet = const_cast<SfxItemSet&>(pPage->GetItemSet ());
|
2014-06-22 12:24:33 +02:00
|
|
|
aPageSet.Put ( *pItem );
|
|
|
|
|
|
|
|
pCurrentPage->Reset( aPageSet );
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Enable/Disable ReadOnly mode
|
|
|
|
|*
|
|
|
|
|************************************************************************/
|
2014-04-16 11:39:08 +02:00
|
|
|
void SvxHpLinkDlg::SetReadOnlyMode( bool bRdOnly )
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
2019-12-12 16:57:30 +02:00
|
|
|
m_xOKBtn->set_sensitive(!bRdOnly);
|
2009-10-31 00:36:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* late-initialization of newly created pages
|
|
|
|
|*
|
|
|
|
|************************************************************************/
|
2020-11-16 10:50:19 +02:00
|
|
|
void SvxHpLinkDlg::PageCreated(IconChoicePage& rPage)
|
2009-10-31 00:36:06 +01:00
|
|
|
{
|
|
|
|
SvxHyperlinkTabPageBase& rHyperlinkPage = dynamic_cast< SvxHyperlinkTabPageBase& >( rPage );
|
2019-06-23 19:51:15 +01:00
|
|
|
Reference< XFrame > xDocumentFrame = GetBindings().GetActiveFrame();
|
2009-10-31 00:36:06 +01:00
|
|
|
OSL_ENSURE( xDocumentFrame.is(), "SvxHpLinkDlg::PageCreated: macro assignment functionality won't work with a proper frame!" );
|
|
|
|
rHyperlinkPage.SetDocumentFrame( xDocumentFrame );
|
|
|
|
}
|
2010-10-12 15:57:08 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|