[Libreoffice-commits] core.git: cui/inc cui/source cui/uiconfig extras/source include/sfx2 include/svtools include/svx include/tools include/vcl solenv/bin svtools/source svx/source vcl/source vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 25 11:37:39 UTC 2019
cui/inc/bitmaps.hlst | 8
cui/inc/strings.hrc | 8
cui/source/dialogs/cuihyperdlg.cxx | 249 ++++---------------
cui/source/dialogs/hldocntp.cxx | 133 ++++------
cui/source/dialogs/hldoctp.cxx | 122 +++------
cui/source/dialogs/hlinettp.cxx | 190 ++++++--------
cui/source/dialogs/hlmailtp.cxx | 79 ++----
cui/source/dialogs/hltpbase.cxx | 159 +++++-------
cui/source/dialogs/iconcdlg.cxx | 268 +++-----------------
cui/source/factory/dlgfact.cxx | 17 -
cui/source/factory/dlgfact.hxx | 19 -
cui/source/inc/cuihyperdlg.hxx | 87 ++----
cui/source/inc/hldocntp.hxx | 19 -
cui/source/inc/hldoctp.hxx | 34 +-
cui/source/inc/hlinettp.hxx | 39 +-
cui/source/inc/hlmailtp.hxx | 17 -
cui/source/inc/hlmarkwn.hxx | 2
cui/source/inc/hltpbase.hxx | 38 +-
cui/source/inc/iconcdlg.hxx | 33 +-
cui/source/tabpages/autocdlg.cxx | 1
cui/uiconfig/ui/hyperlinkdialog.ui | 327 ++++++++++++++++++++++---
cui/uiconfig/ui/hyperlinkdocpage.ui | 59 ++--
cui/uiconfig/ui/hyperlinkinternetpage.ui | 37 +-
cui/uiconfig/ui/hyperlinkmailpage.ui | 60 ++--
cui/uiconfig/ui/hyperlinknewdocpage.ui | 99 +++++--
extras/source/glade/libreoffice-catalog.xml.in | 8
include/sfx2/basedlgs.hxx | 2
include/svtools/inettbc.hxx | 8
include/svx/svxdlg.hxx | 4
include/tools/wintypes.hxx | 3
include/vcl/ivctrl.hxx | 49 +++
include/vcl/weld.hxx | 1
solenv/bin/native-code.py | 2
svtools/source/control/inettbc.cxx | 2
svx/source/dialog/hyperdlg.cxx | 10
vcl/source/app/salvtables.cxx | 105 +++++++-
vcl/source/control/imivctl.hxx | 1
vcl/source/control/imivctl1.cxx | 7
vcl/source/control/ivctrl.cxx | 187 ++++++++++++++
vcl/source/window/builder.cxx | 109 +++++---
vcl/unx/gtk3/gtk3gtkinst.cxx | 9
41 files changed, 1431 insertions(+), 1180 deletions(-)
New commits:
commit 1942182a3d1817bc539229d7fda3af69f7e295b8
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Jun 23 19:51:15 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Jun 25 13:36:53 2019 +0200
weld HyperLink Dialog
Change-Id: Ic861b0a593505828a900fe2163125d6f5584a956
Reviewed-on: https://gerrit.libreoffice.org/74634
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/inc/bitmaps.hlst b/cui/inc/bitmaps.hlst
index 8d506a6ae701..94d6227acb82 100644
--- a/cui/inc/bitmaps.hlst
+++ b/cui/inc/bitmaps.hlst
@@ -66,15 +66,7 @@
#define RID_CUIBMP_COLLAPSED "res/plus.png"
#define RID_CUIBMP_EXPANDED "res/minus.png"
-#define RID_SVXBMP_HLINETTP "res/hlinettp.png"
-#define RID_SVXBMP_HLMAILTP "res/hlmailtp.png"
-#define RID_SVXBMP_HLDOCTP "res/hldoctp.png"
-#define RID_SVXBMP_HLDOCNTP "res/hldocntp.png"
#define RID_SVXBMP_SCRIPT "res/script.png"
-#define RID_SVXBMP_ADRESSBOOK "res/adrbook.png"
-#define RID_SVXBMP_FILEOPEN "res/fileopen.png"
-#define RID_SVXBMP_TARGET "res/target.png"
-#define RID_SVXBMP_NEWDOC "res/newdoc.png"
#define RID_SVXBMP_COLLAPSEDNODE "res/sx18002.png"
#define RID_SVXBMP_EXPANDEDNODE "res/sx18003.png"
diff --git a/cui/inc/strings.hrc b/cui/inc/strings.hrc
index 9b302e439453..d79397b138a2 100644
--- a/cui/inc/strings.hrc
+++ b/cui/inc/strings.hrc
@@ -74,14 +74,6 @@
#define RID_SVXSTR_HYPDLG_MACROACT2 NC_("RID_SVXSTR_HYPDLG_MACROACT2", "Trigger hyperlink")
#define RID_SVXSTR_HYPDLG_MACROACT3 NC_("RID_SVXSTR_HYPDLG_MACROACT3", "Mouse leaves object")
#define RID_SVXSTR_HYPDLG_NOVALIDFILENAME NC_("RID_SVXSTR_HYPDLG_NOVALIDFILENAME", "Please type in a valid file name.")
-#define RID_SVXSTR_HYPERDLG_HLINETTP NC_("RID_SVXSTR_HYPERDLG_HLINETTP", "Internet")
-#define RID_SVXSTR_HYPERDLG_HLINETTP_HELP NC_("RID_SVXSTR_HYPERDLG_HLINETTP_HELP", "This is where you create a hyperlink to a Web page or FTP server connection.")
-#define RID_SVXSTR_HYPERDLG_HLMAILTP NC_("RID_SVXSTR_HYPERDLG_HLMAILTP", "Mail")
-#define RID_SVXSTR_HYPERDLG_HLMAILTP_HELP NC_("RID_SVXSTR_HYPERDLG_HLMAILTP_HELP", "This is where you create a hyperlink to an email address.")
-#define RID_SVXSTR_HYPERDLG_HLDOCTP NC_("RID_SVXSTR_HYPERDLG_HLDOCTP", "Document")
-#define RID_SVXSTR_HYPERDLG_HLDOCTP_HELP NC_("RID_SVXSTR_HYPERDLG_HLDOCTP_HELP", "This is where you create a hyperlink to an existing document or a target within a document.")
-#define RID_SVXSTR_HYPERDLG_HLDOCNTP NC_("RID_SVXSTR_HYPERDLG_HLDOCNTP", "New Document")
-#define RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP NC_("RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP", "This is where you create a new document to which the new link points.")
#define RID_SVXSTR_HYPERDLG_FORM_BUTTON NC_("RID_SVXSTR_HYPERDLG_FORM_BUTTON", "Button")
#define RID_SVXSTR_HYPERDLG_FROM_TEXT NC_("RID_SVXSTR_HYPERDLG_FROM_TEXT", "Text")
#define RID_SVXSTR_HYPERDLG_QUERYOVERWRITE NC_("RID_SVXSTR_HYPERDLG_QUERYOVERWRITE", "The file already exists. Overwrite?")
diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
index 8daedff44f49..65e6eaba89b4 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -29,6 +29,7 @@
#include <hldoctp.hxx>
#include <hldocntp.hxx>
#include <bitmaps.hlst>
+#include <sfx2/viewfrm.hxx>
#include <svx/svxids.hrc>
#include <dialmgr.hxx>
#include <strings.hrc>
@@ -52,6 +53,7 @@ SvxHlinkCtrl::SvxHlinkCtrl( sal_uInt16 _nId, SfxBindings & rBindings, SvxHpLinkD
void SvxHlinkCtrl::dispose()
{
+ pParent = nullptr;
aRdOnlyForwarder.dispose();
::SfxControllerItem::dispose();
}
@@ -59,7 +61,7 @@ void SvxHlinkCtrl::dispose()
void SvxHlinkCtrl::StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState )
{
- if ( eState == SfxItemState::DEFAULT && !pParent->IsDisposed() )
+ if (eState == SfxItemState::DEFAULT && pParent)
{
switch ( nSID )
{
@@ -80,29 +82,21 @@ void SvxHlinkCtrl::StateChanged( sal_uInt16 nSID, SfxItemState eState,
//# #
//# Hyperlink - Dialog #
//# #
-
-SvxHpLinkDlg::SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings)
- : SfxModalDialog(pParent, "HyperlinkDialog", "cui/ui/hyperlinkdialog.ui")
- , mnCurrentPageId(HyperLinkPageType::NONE)
+SvxHpLinkDlg::SvxHpLinkDlg(SfxBindings* pBindings, SfxChildWindow* pChild, weld::Window* pParent)
+ : SfxModelessDialogController(pBindings, pChild, pParent, "cui/ui/hyperlinkdialog.ui", "HyperlinkDialog")
, pSet ( nullptr )
, pExampleSet ( nullptr )
, maCtrl ( SID_HYPERLINK_GETLINK, *pBindings, this )
- , mpBindings ( pBindings )
, mbIsHTMLDoc ( false )
+ , m_xIconCtrl(m_xBuilder->weld_notebook("icon_control"))
+ , 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"))
{
- get(m_pOKBtn, "ok");
- get(m_pApplyBtn, "apply");
- get(m_pCancelBtn, "cancel");
- get(m_pHelpBtn, "help");
- get(m_pResetBtn, "reset");
- get(m_pIconCtrl, "icon_control");
- get(m_pTabContainer, "tab");
-
- SetCtrlStyle();
- m_pIconCtrl->SetClickHdl ( LINK ( this, SvxHpLinkDlg, ChosePageHdl_Impl ) );
- m_pIconCtrl->Show();
- m_pIconCtrl->SetChoiceWithCursor();
- m_pIconCtrl->SetSelectionMode( SelectionMode::Single );
+ m_xIconCtrl->connect_enter_page( LINK ( this, SvxHpLinkDlg, ChosePageHdl_Impl ) );
+ m_xIconCtrl->show();
// ItemSet
if ( pSet )
@@ -112,38 +106,16 @@ SvxHpLinkDlg::SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings)
}
// Buttons
- m_pOKBtn->SetClickHdl ( LINK( this, SvxHpLinkDlg, OkHdl ) );
- m_pApplyBtn->SetClickHdl ( LINK( this, SvxHpLinkDlg, ApplyHdl ) );
- m_pResetBtn->SetClickHdl( LINK( this, SvxHpLinkDlg, ResetHdl ) );
- m_pOKBtn->Show();
- m_pApplyBtn->Show();
- m_pCancelBtn->Show();
- m_pHelpBtn->Show();
- m_pResetBtn->Show();
+ m_xOKBtn->show();
+ m_xApplyBtn->show();
+ m_xCancelBtn->show();
+ m_xHelpBtn->show();
+ m_xResetBtn->show();
mbGrabFocus = true;
- // insert pages
- OUString aStrTitle;
- SvxIconChoiceCtrlEntry *pEntry;
-
- aStrTitle = CuiResId( RID_SVXSTR_HYPERDLG_HLINETTP );
- pEntry = AddTabPage ( HyperLinkPageType::Internet, aStrTitle, Image(StockImage::Yes, RID_SVXBMP_HLINETTP), SvxHyperlinkInternetTp::Create );
- pEntry->SetQuickHelpText( CuiResId( RID_SVXSTR_HYPERDLG_HLINETTP_HELP ) );
- aStrTitle = CuiResId( RID_SVXSTR_HYPERDLG_HLMAILTP );
- pEntry = AddTabPage ( HyperLinkPageType::Mail, aStrTitle, Image(StockImage::Yes, RID_SVXBMP_HLMAILTP), SvxHyperlinkMailTp::Create );
- pEntry->SetQuickHelpText( CuiResId( RID_SVXSTR_HYPERDLG_HLMAILTP_HELP ) );
- if (!comphelper::LibreOfficeKit::isActive())
- {
- aStrTitle = CuiResId( RID_SVXSTR_HYPERDLG_HLDOCTP );
- pEntry = AddTabPage ( HyperLinkPageType::Document, aStrTitle, Image(StockImage::Yes, RID_SVXBMP_HLDOCTP), SvxHyperlinkDocTp::Create );
- pEntry->SetQuickHelpText( CuiResId( RID_SVXSTR_HYPERDLG_HLDOCTP_HELP ) );
- aStrTitle = CuiResId( RID_SVXSTR_HYPERDLG_HLDOCNTP );
- pEntry = AddTabPage ( HyperLinkPageType::NewDocument, aStrTitle, Image(StockImage::Yes, RID_SVXBMP_HLDOCNTP), SvxHyperlinkNewDocTp::Create );
- pEntry->SetQuickHelpText( CuiResId( RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP ) );
- }
// set OK/Cancel - button
- GetCancelButton().SetText ( CuiResId(RID_SVXSTR_HYPDLG_CLOSEBUT) );
+ m_xCancelBtn->set_label(CuiResId(RID_SVXSTR_HYPDLG_CLOSEBUT));
// create itemset for tabpages
mpItemSet = std::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(), svl::Items<SID_HYPERLINK_GETLINK,
@@ -154,45 +126,30 @@ SvxHpLinkDlg::SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings)
SetInputSet (mpItemSet.get());
- //loop through the pages and get their max bounds and lock that down
- ShowPage(HyperLinkPageType::NewDocument);
- VclBox *pBox = get_content_area();
- Size aMaxPrefSize(pBox->get_preferred_size());
- ShowPage(HyperLinkPageType::Document);
- Size aSize(pBox->get_preferred_size());
- aMaxPrefSize.setWidth( std::max(aMaxPrefSize.Width(), aSize.Width()) );
- aMaxPrefSize.setHeight( std::max(aMaxPrefSize.Height(), aSize.Height()) );
- ShowPage(HyperLinkPageType::Mail);
- aSize = pBox->get_preferred_size();
- aMaxPrefSize.setWidth( std::max(aMaxPrefSize.Width(), aSize.Width()) );
- aMaxPrefSize.setHeight( std::max(aMaxPrefSize.Height(), aSize.Height()) );
- ShowPage(HyperLinkPageType::Internet);
- aSize = pBox->get_preferred_size();
- aMaxPrefSize.setWidth( std::max(aMaxPrefSize.Width(), aSize.Width()) );
- aMaxPrefSize.setHeight( std::max(aMaxPrefSize.Height(), aSize.Height()) );
- pBox->set_width_request(aMaxPrefSize.Width());
- pBox->set_height_request(aMaxPrefSize.Height());
-
- SetCurPageId(HyperLinkPageType::Internet);
+ // insert pages
+ AddTabPage("internet", SvxHyperlinkInternetTp::Create);
+ AddTabPage("mail", SvxHyperlinkMailTp::Create);
+ if (!comphelper::LibreOfficeKit::isActive())
+ {
+ AddTabPage("document", SvxHyperlinkDocTp::Create);
+ AddTabPage("newdocument", SvxHyperlinkNewDocTp::Create);
+ }
+
+ SetCurPageId("internet");
// Init Dialog
Start();
- pBindings->Update( SID_READONLY_MODE );
+ GetBindings().Update(SID_READONLY_MODE);
- GetOKButton().SetClickHdl ( LINK ( this, SvxHpLinkDlg, ClickOkHdl_Impl ) );
- GetApplyButton().SetClickHdl ( LINK ( this, SvxHpLinkDlg, ClickApplyHdl_Impl ) );
- GetCancelButton().SetClickHdl( LINK ( this, SvxHpLinkDlg, ClickCloseHdl_Impl ) );
+ 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 ) );
}
-SvxHpLinkDlg::~SvxHpLinkDlg ()
+SvxHpLinkDlg::~SvxHpLinkDlg()
{
- disposeOnce();
-}
-
-void SvxHpLinkDlg::dispose()
-{
- // delete config item, so the base class (SfxModalDialog) can not load it on the next start
+ // delete config item, so the base class (SfxModelessDialogController) can not load it on the next start
SvtViewOptions aViewOpt( EViewType::TabDialog, OUString::number(SID_HYPERLINK_DIALOG) );
aViewOpt.Delete();
@@ -200,44 +157,19 @@ void SvxHpLinkDlg::dispose()
maCtrl.dispose();
- // save configuration at INI-Manager
- // and remove pages
- //SvtViewOptions aTabDlgOpt( EViewType::TabDialog, rId );
- //aTabDlgOpt.SetWindowState(OStringToOUString(GetWindowState((WindowStateMask::X | WindowStateMask::Y | WindowStateMask::State | WindowStateMask::Minimized)), RTL_TEXTENCODING_ASCII_US));
- //aTabDlgOpt.SetPageID( mnCurrentPageId );
-
- for (std::unique_ptr<IconChoicePageData> & pData : maPageList)
- {
- if ( pData->pPage )
- pData->pPage.disposeAndClear();
- }
maPageList.clear();
pRanges.reset();
pOutSet.reset();
-
- m_pIconCtrl.clear();
- m_pOKBtn.clear();
- m_pApplyBtn.clear();
- m_pCancelBtn.clear();
- m_pHelpBtn.clear();
- m_pResetBtn.clear();
- m_pTabContainer.clear();
- SfxModalDialog::dispose();
}
-/*************************************************************************
-|*
-|* Close Dialog-Window
-|*
-|************************************************************************/
-
-bool SvxHpLinkDlg::Close()
+void SvxHpLinkDlg::Close()
{
- GetDispatcher()->Execute( SID_HYPERLINK_DIALOG,
- SfxCallMode::ASYNCHRON |
- SfxCallMode::RECORD);
- return true;
+ if (IsClosing())
+ return;
+ SfxViewFrame* pViewFrame = SfxViewFrame::Current();
+ if (pViewFrame)
+ pViewFrame->ToggleChildWindow(SID_HYPERLINK_DIALOG);
}
void SvxHpLinkDlg::Apply()
@@ -261,60 +193,11 @@ void SvxHpLinkDlg::Apply()
}
}
-/*************************************************************************
-|*
-|* When extra window is visible and its never moved by user, then move that
-|* window, too.
-|*
-|************************************************************************/
-
-void SvxHpLinkDlg::Move()
-{
- SvxHyperlinkTabPageBase* pCurrentPage = static_cast<SvxHyperlinkTabPageBase*>(
- GetTabPage ( GetCurPageId() ) );
-
- if( pCurrentPage->IsMarkWndVisible () )
- {
- // Pos&Size of this dialog-window
- Point aDlgPos ( GetPosPixel () );
- Size aDlgSize ( GetSizePixel () );
-
- // Size of Office-Main-Window
- Size aWindowSize( SfxGetpApp()->GetTopWindow()->GetSizePixel() );
-
- // Size of Extrawindow
- Size aExtraWndSize( pCurrentPage->GetSizeExtraWnd() );
-
- if( aDlgPos.X()+(1.02*aDlgSize.Width())+aExtraWndSize.Width() > aWindowSize.Width() )
- {
- if( aDlgPos.X() - ( 0.02*aDlgSize.Width() ) - aExtraWndSize.Width() < 0 )
- {
- // Pos Extrawindow anywhere
- pCurrentPage->MoveToExtraWnd( Point( 1, long(1.1*aDlgPos.Y()) ) );
- }
- else
- {
- // Pos Extrawindow on the left side of Dialog
- pCurrentPage->MoveToExtraWnd( aDlgPos -
- Point( long(0.02*aDlgSize.Width()), 0 ) -
- Point( aExtraWndSize.Width(), 0 ) );
- }
- }
- else
- {
- // Pos Extrawindow on the right side of Dialog
- pCurrentPage->MoveToExtraWnd ( aDlgPos + Point( long(1.02*aDlgSize.Width()), 0 ) );
- }
- }
-
- Window::Move();
-}
-
/// Click on OK button
-IMPL_LINK_NOARG(SvxHpLinkDlg, ClickOkHdl_Impl, Button*, void)
+IMPL_LINK_NOARG(SvxHpLinkDlg, ClickOkHdl_Impl, weld::Button&, void)
{
Apply();
- Close();
+ m_xDialog->response(RET_OK);
}
/*************************************************************************
@@ -322,32 +205,19 @@ IMPL_LINK_NOARG(SvxHpLinkDlg, ClickOkHdl_Impl, Button*, void)
|* Click on Apply-button
|*
|************************************************************************/
-
-IMPL_LINK_NOARG(SvxHpLinkDlg, ClickApplyHdl_Impl, Button*, void)
+IMPL_LINK_NOARG(SvxHpLinkDlg, ClickApplyHdl_Impl, weld::Button&, void)
{
Apply();
}
/*************************************************************************
|*
-|* Click on Close-button
-|*
-|************************************************************************/
-
-IMPL_LINK_NOARG(SvxHpLinkDlg, ClickCloseHdl_Impl, Button*, void)
-{
- Close();
-}
-
-/*************************************************************************
-|*
|* Set Page
|*
|************************************************************************/
-
void SvxHpLinkDlg::SetPage ( SvxHyperlinkItem const * pItem )
{
- HyperLinkPageType nPageId = HyperLinkPageType::Internet;
+ OString sPageId("internet");
OUString aStrURL(pItem->GetURL());
INetURLObject aURL(aStrURL);
@@ -357,32 +227,32 @@ void SvxHpLinkDlg::SetPage ( SvxHyperlinkItem const * pItem )
{
case INetProtocol::Http :
case INetProtocol::Ftp :
- nPageId = HyperLinkPageType::Internet;
+ sPageId = "internet";
break;
case INetProtocol::File :
- nPageId = HyperLinkPageType::Document;
+ sPageId = "document";
break;
case INetProtocol::Mailto :
- nPageId = HyperLinkPageType::Mail;
+ sPageId = "mail";
break;
default :
if (aStrURL.startsWith("#"))
- nPageId = HyperLinkPageType::Document;
+ sPageId = "document";
else
{
// not valid
- nPageId = GetCurPageId();
+ sPageId = GetCurPageId();
}
break;
}
- ShowPage (nPageId);
+ ShowPage (sPageId);
- SvxHyperlinkTabPageBase* pCurrentPage = static_cast<SvxHyperlinkTabPageBase*>(GetTabPage( nPageId ));
+ SvxHyperlinkTabPageBase* pCurrentPage = static_cast<SvxHyperlinkTabPageBase*>(GetTabPage( sPageId ));
mbIsHTMLDoc = (pItem->GetInsertMode() & HLINK_HTMLMODE) != 0;
- IconChoicePage* pPage = GetTabPage (nPageId);
+ IconChoicePage* pPage = GetTabPage (sPageId);
if(pPage)
{
SfxItemSet& aPageSet = const_cast<SfxItemSet&>(pPage->GetItemSet ());
@@ -402,13 +272,9 @@ void SvxHpLinkDlg::SetPage ( SvxHyperlinkItem const * pItem )
|* Enable/Disable ReadOnly mode
|*
|************************************************************************/
-
void SvxHpLinkDlg::SetReadOnlyMode( bool bRdOnly )
{
- if ( bRdOnly )
- GetOKButton().Disable();
- else
- GetOKButton().Enable();
+ GetOKButton().set_sensitive(!bRdOnly);
}
/*************************************************************************
@@ -416,13 +282,10 @@ void SvxHpLinkDlg::SetReadOnlyMode( bool bRdOnly )
|* late-initialization of newly created pages
|*
|************************************************************************/
-
-void SvxHpLinkDlg::PageCreated( HyperLinkPageType /*nId*/, IconChoicePage& rPage )
+void SvxHpLinkDlg::PageCreated(const OString& /*rId*/, IconChoicePage& rPage)
{
SvxHyperlinkTabPageBase& rHyperlinkPage = dynamic_cast< SvxHyperlinkTabPageBase& >( rPage );
- Reference< XFrame > xDocumentFrame;
- if ( mpBindings )
- xDocumentFrame = mpBindings->GetActiveFrame();
+ Reference< XFrame > xDocumentFrame = GetBindings().GetActiveFrame();
OSL_ENSURE( xDocumentFrame.is(), "SvxHpLinkDlg::PageCreated: macro assignment functionality won't work with a proper frame!" );
rHyperlinkPage.SetDocumentFrame( xDocumentFrame );
}
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index 65afc25c77d0..9ecb6f54d3b7 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -42,6 +42,7 @@
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <bitmaps.hlst>
+#include <cuihyperdlg.hxx>
#include <dialmgr.hxx>
#include <strings.hrc>
@@ -89,9 +90,9 @@ bool SvxHyperlinkNewDocTp::ImplGetURLObject( const OUString& rPath, const OUStri
}
if ( bIsValidURL )
{
- sal_Int32 nPos = m_pLbDocTypes->GetSelectedEntryPos();
- if ( nPos != LISTBOX_ENTRY_NOTFOUND )
- aURLObject.SetExtension( static_cast<DocumentTypeData*>(m_pLbDocTypes->GetEntryData( nPos ))->aStrExt );
+ sal_Int32 nPos = m_xLbDocTypes->get_selected_index();
+ if (nPos != -1)
+ aURLObject.SetExtension(reinterpret_cast<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos).toInt64())->aStrExt);
}
}
@@ -104,55 +105,40 @@ bool SvxHyperlinkNewDocTp::ImplGetURLObject( const OUString& rPath, const OUStri
|*
|************************************************************************/
-SvxHyperlinkNewDocTp::SvxHyperlinkNewDocTp ( vcl::Window *pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet)
-: SvxHyperlinkTabPageBase ( pParent, pDlg, "HyperlinkNewDocPage", "cui/ui/hyperlinknewdocpage.ui", pItemSet )
+SvxHyperlinkNewDocTp::SvxHyperlinkNewDocTp(weld::Container* pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet)
+ : SvxHyperlinkTabPageBase(pParent, pDlg, "cui/ui/hyperlinknewdocpage.ui", "HyperlinkNewDocPage", pItemSet)
+ , m_xRbtEditNow(xBuilder->weld_radio_button("editnow"))
+ , m_xRbtEditLater(xBuilder->weld_radio_button("editlater"))
+ , m_xCbbPath(new SvxHyperURLBox(xBuilder->weld_combo_box("path")))
+ , m_xBtCreate(xBuilder->weld_button("create"))
+ , m_xLbDocTypes(xBuilder->weld_tree_view("types"))
{
- get(m_pRbtEditNow, "editnow");
- get(m_pRbtEditLater, "editlater");
- get(m_pCbbPath, "path");
- m_pCbbPath->SetSmartProtocol(INetProtocol::File);
- get(m_pBtCreate, "create");
- m_pBtCreate->SetModeImage(Image(StockImage::Yes, RID_SVXBMP_NEWDOC));
- get(m_pLbDocTypes, "types");
- m_pLbDocTypes->set_height_request(m_pLbDocTypes->GetTextHeight() * 5);
-
- // Set HC bitmaps and disable display of bitmap names.
- m_pBtCreate->EnableTextDisplay (false);
+ m_xCbbPath->SetSmartProtocol(INetProtocol::File);
+ m_xLbDocTypes->set_size_request(-1, m_xLbDocTypes->get_height_rows(5));
InitStdControls();
SetExchangeSupport ();
- m_pCbbPath->Show();
- m_pCbbPath->SetBaseURL(SvtPathOptions().GetWorkPath());
+ m_xCbbPath->show();
+ m_xCbbPath->SetBaseURL(SvtPathOptions().GetWorkPath());
// set defaults
- m_pRbtEditNow->Check();
+ m_xRbtEditNow->set_active(true);
- m_pBtCreate->SetClickHdl ( LINK ( this, SvxHyperlinkNewDocTp, ClickNewHdl_Impl ) );
+ m_xBtCreate->connect_clicked(LINK(this, SvxHyperlinkNewDocTp, ClickNewHdl_Impl));
FillDocumentList ();
}
SvxHyperlinkNewDocTp::~SvxHyperlinkNewDocTp ()
{
- disposeOnce();
-}
-
-void SvxHyperlinkNewDocTp::dispose()
-{
- if (m_pLbDocTypes)
+ if (m_xLbDocTypes)
{
- for ( sal_Int32 n=0; n<m_pLbDocTypes->GetEntryCount(); n++ )
- delete static_cast<DocumentTypeData*>(m_pLbDocTypes->GetEntryData ( n ));
- m_pLbDocTypes = nullptr;
+ for (sal_Int32 n = 0, nEntryCount = m_xLbDocTypes->n_children(); n < nEntryCount; ++n)
+ delete reinterpret_cast<DocumentTypeData*>(m_xLbDocTypes->get_id(n).toInt64());
+ m_xLbDocTypes = nullptr;
}
- m_pRbtEditNow.clear();
- m_pRbtEditLater.clear();
- m_pCbbPath.clear();
- m_pBtCreate.clear();
- m_pLbDocTypes.clear();
- SvxHyperlinkTabPageBase::dispose();
}
/*************************************************************************
@@ -166,9 +152,9 @@ void SvxHyperlinkNewDocTp::FillDlgFields(const OUString& /*rStrURL*/)
{
}
-void SvxHyperlinkNewDocTp::FillDocumentList ()
+void SvxHyperlinkNewDocTp::FillDocumentList()
{
- EnterWait();
+ weld::WaitObject aWaitObj(mpDialog->getDialog());
uno::Sequence< uno::Sequence< beans::PropertyValue > >
aDynamicMenuEntries( SvtDynamicMenuOptions().GetMenu( EDynamicMenuType::NewMenu ) );
@@ -206,16 +192,14 @@ void SvxHyperlinkNewDocTp::FillDocumentList ()
// insert doc-name and image
OUString aTitleName = aTitle.replaceFirst( "~", "" );
- sal_Int16 nPos = m_pLbDocTypes->InsertEntry ( aTitleName );
- OUString aStrDefExt( pFilter->GetDefaultExtension () );
- DocumentTypeData *pTypeData = new DocumentTypeData ( aDocumentUrl, aStrDefExt.copy( 2 ) );
- m_pLbDocTypes->SetEntryData ( nPos, pTypeData );
+ OUString aStrDefExt(pFilter->GetDefaultExtension());
+ DocumentTypeData *pTypeData = new DocumentTypeData(aDocumentUrl, aStrDefExt.copy(2));
+ OUString sId(OUString::number(reinterpret_cast<sal_Int64>(pTypeData)));
+ m_xLbDocTypes->append(sId, aTitleName);
}
}
}
- m_pLbDocTypes->SelectEntryPos ( 0 );
-
- LeaveWait();
+ m_xLbDocTypes->select(0);
}
/*************************************************************************
@@ -229,9 +213,9 @@ void SvxHyperlinkNewDocTp::GetCurentItemData ( OUString& rStrURL, OUString& aStr
SvxLinkInsertMode& eMode )
{
// get data from dialog-controls
- rStrURL = m_pCbbPath->GetText();
+ rStrURL = m_xCbbPath->get_active_text();
INetURLObject aURL;
- if ( ImplGetURLObject( rStrURL, m_pCbbPath->GetBaseURL(), aURL ) )
+ if ( ImplGetURLObject( rStrURL, m_xCbbPath->GetBaseURL(), aURL ) )
{
rStrURL = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE );
}
@@ -245,9 +229,9 @@ void SvxHyperlinkNewDocTp::GetCurentItemData ( OUString& rStrURL, OUString& aStr
|*
|************************************************************************/
-VclPtr<IconChoicePage> SvxHyperlinkNewDocTp::Create( vcl::Window* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet )
+std::unique_ptr<IconChoicePage> SvxHyperlinkNewDocTp::Create(weld::Container* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet)
{
- return VclPtr<SvxHyperlinkNewDocTp>::Create( pWindow, pDlg, pItemSet );
+ return std::make_unique<SvxHyperlinkNewDocTp>(pWindow, pDlg, pItemSet);
}
/*************************************************************************
@@ -255,10 +239,9 @@ VclPtr<IconChoicePage> SvxHyperlinkNewDocTp::Create( vcl::Window* pWindow, SvxHp
|* Set initial focus
|*
|************************************************************************/
-
void SvxHyperlinkNewDocTp::SetInitFocus()
{
- m_pCbbPath->GrabFocus();
+ m_xCbbPath->grab_focus();
}
/*************************************************************************
@@ -266,14 +249,13 @@ void SvxHyperlinkNewDocTp::SetInitFocus()
|* Ask page whether an insert is possible
|*
\************************************************************************/
-
bool SvxHyperlinkNewDocTp::AskApply()
{
INetURLObject aINetURLObject;
- bool bRet = ImplGetURLObject( m_pCbbPath->GetText(), m_pCbbPath->GetBaseURL(), aINetURLObject );
+ bool bRet = ImplGetURLObject(m_xCbbPath->get_active_text(), m_xCbbPath->GetBaseURL(), aINetURLObject);
if ( !bRet )
{
- std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
+ std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(mpDialog->getDialog(),
VclMessageType::Warning, VclButtonsType::Ok,
CuiResId(RID_SVXSTR_HYPDLG_NOVALIDFILENAME)));
xWarn->run();
@@ -363,20 +345,19 @@ IMPL_STATIC_LINK(SvxHyperlinkNewDocTp, DispatchDocument, void*, p, void)
|* Any action to do after apply-button is pressed
|*
\************************************************************************/
-
-void SvxHyperlinkNewDocTp::DoApply ()
+void SvxHyperlinkNewDocTp::DoApply()
{
- EnterWait();
+ weld::WaitObject aWait(mpDialog->getDialog());
// get data from dialog-controls
- OUString aStrNewName = m_pCbbPath->GetText();
+ OUString aStrNewName = m_xCbbPath->get_active_text();
if ( aStrNewName.isEmpty() )
aStrNewName = maStrInitURL;
// create a real URL-String
INetURLObject aURL;
- if ( ImplGetURLObject( aStrNewName, m_pCbbPath->GetBaseURL(), aURL ) )
+ if ( ImplGetURLObject( aStrNewName, m_xCbbPath->GetBaseURL(), aURL ) )
{
// create Document
aStrNewName = aURL.GetURLPath( INetURLObject::DecodeMechanism::NONE );
@@ -392,7 +373,7 @@ void SvxHyperlinkNewDocTp::DoApply ()
if( bOk )
{
- std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(GetFrameWeld(),
+ std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(mpDialog->getDialog(),
VclMessageType::Warning, VclButtonsType::YesNo,
CuiResId(RID_SVXSTR_HYPERDLG_QUERYOVERWRITE)));
bCreate = xWarn->run() == RET_YES;
@@ -406,15 +387,14 @@ void SvxHyperlinkNewDocTp::DoApply ()
{
ExecuteInfo* pExecuteInfo = new ExecuteInfo;
- pExecuteInfo->bRbtEditLater = m_pRbtEditLater->IsChecked();
- pExecuteInfo->bRbtEditNow = m_pRbtEditNow->IsChecked();
+ pExecuteInfo->bRbtEditLater = m_xRbtEditLater->get_active();
+ pExecuteInfo->bRbtEditNow = m_xRbtEditNow->get_active();
// get private-url
- sal_Int32 nPos = m_pLbDocTypes->GetSelectedEntryPos();
- if( nPos == LISTBOX_ENTRY_NOTFOUND )
- nPos=0;
+ sal_Int32 nPos = m_xLbDocTypes->get_selected_index();
+ if (nPos == -1)
+ nPos = 0;
pExecuteInfo->aURL = aURL;
- pExecuteInfo->aStrDocName = static_cast<DocumentTypeData*>(
- m_pLbDocTypes->GetEntryData( nPos ))->aStrURL;
+ pExecuteInfo->aStrDocName = reinterpret_cast<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos).toInt64())->aStrURL;
// current document
pExecuteInfo->xFrame = GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface();
@@ -423,8 +403,6 @@ void SvxHyperlinkNewDocTp::DoApply ()
Application::PostUserEvent(LINK(nullptr, SvxHyperlinkNewDocTp, DispatchDocument), pExecuteInfo);
}
}
-
- LeaveWait();
}
/*************************************************************************
@@ -432,14 +410,14 @@ void SvxHyperlinkNewDocTp::DoApply ()
|* Click on imagebutton : new
|*
|************************************************************************/
-
-IMPL_LINK_NOARG(SvxHyperlinkNewDocTp, ClickNewHdl_Impl, Button*, void)
+IMPL_LINK_NOARG(SvxHyperlinkNewDocTp, ClickNewHdl_Impl, weld::Button&, void)
{
+ DisableClose( true );
uno::Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
uno::Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext);
OUString aStrURL;
- OUString aTempStrURL( m_pCbbPath->GetText() );
+ OUString aTempStrURL( m_xCbbPath->get_active_text() );
osl::FileBase::getFileURLFromSystemPath( aTempStrURL, aStrURL );
OUString aStrPath = aStrURL;
@@ -453,7 +431,6 @@ IMPL_LINK_NOARG(SvxHyperlinkNewDocTp, ClickNewHdl_Impl, Button*, void)
bHandleFileName = true;
xFolderPicker->setDisplayDirectory( aStrPath );
- DisableClose( true );
sal_Int16 nResult = xFolderPicker->execute();
DisableClose( false );
if( ExecutableDialogResults::OK == nResult )
@@ -465,7 +442,7 @@ IMPL_LINK_NOARG(SvxHyperlinkNewDocTp, ClickNewHdl_Impl, Button*, void)
if( bHandleFileName )
aStrName = bZeroPath? aTempStrURL : aURL.getName();
- m_pCbbPath->SetBaseURL( xFolderPicker->getDirectory() );
+ m_xCbbPath->SetBaseURL( xFolderPicker->getDirectory() );
OUString aStrTmp( xFolderPicker->getDirectory() );
if( aStrTmp[ aStrTmp.getLength() - 1 ] != sSlash[0] )
@@ -477,12 +454,12 @@ IMPL_LINK_NOARG(SvxHyperlinkNewDocTp, ClickNewHdl_Impl, Button*, void)
INetURLObject aNewURL( aStrTmp );
- if( !aStrName.isEmpty() && !aNewURL.getExtension().isEmpty() &&
- m_pLbDocTypes->GetSelectedEntryPos() != LISTBOX_ENTRY_NOTFOUND )
+ if (!aStrName.isEmpty() && !aNewURL.getExtension().isEmpty() &&
+ m_xLbDocTypes->get_selected_index() != -1)
{
// get private-url
- const sal_Int32 nPos = m_pLbDocTypes->GetSelectedEntryPos();
- aNewURL.setExtension( static_cast<DocumentTypeData*>(m_pLbDocTypes->GetEntryData( nPos ))->aStrExt );
+ const sal_Int32 nPos = m_xLbDocTypes->get_selected_index();
+ aNewURL.setExtension(reinterpret_cast<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos).toInt64())->aStrExt);
}
if( aNewURL.GetProtocol() == INetProtocol::File )
@@ -494,7 +471,7 @@ IMPL_LINK_NOARG(SvxHyperlinkNewDocTp, ClickNewHdl_Impl, Button*, void)
aStrTmp = aNewURL.GetMainURL( INetURLObject::DecodeMechanism::Unambiguous );
}
- m_pCbbPath->SetText ( aStrTmp );
+ m_xCbbPath->set_entry_text( aStrTmp );
}
}
diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx
index ed4f6193772d..57d3672bf5c8 100644
--- a/cui/source/dialogs/hldoctp.cxx
+++ b/cui/source/dialogs/hldoctp.cxx
@@ -35,54 +35,37 @@ sal_Char const sFileScheme[] = INET_FILE_SCHEME;
|*
|************************************************************************/
-SvxHyperlinkDocTp::SvxHyperlinkDocTp ( vcl::Window *pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet)
- : SvxHyperlinkTabPageBase ( pParent, pDlg, "HyperlinkDocPage", "cui/ui/hyperlinkdocpage.ui", pItemSet ),
- mbMarkWndOpen ( false )
+SvxHyperlinkDocTp::SvxHyperlinkDocTp(weld::Container* pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet)
+ : SvxHyperlinkTabPageBase(pParent, pDlg, "cui/ui/hyperlinkdocpage.ui", "HyperlinkDocPage", pItemSet)
+ , m_xCbbPath(new SvxHyperURLBox(xBuilder->weld_combo_box("path")))
+ , m_xBtFileopen(xBuilder->weld_button("fileopen"))
+ , m_xEdTarget(xBuilder->weld_entry("target"))
+ , m_xFtFullURL(xBuilder->weld_label("url"))
+ , m_xBtBrowse(xBuilder->weld_button("browse"))
+ , m_bMarkWndOpen(false)
{
- get(m_pCbbPath, "path");
- m_pCbbPath->SetSmartProtocol(INetProtocol::File);
- get(m_pBtFileopen, "fileopen");
- m_pBtFileopen->SetModeImage(Image(StockImage::Yes, RID_SVXBMP_FILEOPEN));
- get(m_pEdTarget, "target");
- get(m_pFtFullURL, "url");
- get(m_pBtBrowse, "browse");
- m_pBtBrowse->SetModeImage(Image(StockImage::Yes, RID_SVXBMP_TARGET));
-
- // Disable display of bitmap names.
- m_pBtBrowse->EnableTextDisplay (false);
- m_pBtFileopen->EnableTextDisplay (false);
+ m_xCbbPath->SetSmartProtocol(INetProtocol::File);
InitStdControls();
- m_pCbbPath->Show();
- m_pCbbPath->SetBaseURL(INET_FILE_SCHEME);
+ m_xCbbPath->show();
+ m_xCbbPath->SetBaseURL(INET_FILE_SCHEME);
- SetExchangeSupport ();
+ SetExchangeSupport();
// set handlers
- m_pBtFileopen->SetClickHdl ( LINK ( this, SvxHyperlinkDocTp, ClickFileopenHdl_Impl ) );
- m_pBtBrowse->SetClickHdl ( LINK ( this, SvxHyperlinkDocTp, ClickTargetHdl_Impl ) );
- m_pCbbPath->SetModifyHdl ( LINK ( this, SvxHyperlinkDocTp, ModifiedPathHdl_Impl ) );
- m_pEdTarget->SetModifyHdl ( LINK ( this, SvxHyperlinkDocTp, ModifiedTargetHdl_Impl ) );
+ m_xBtFileopen->connect_clicked( LINK ( this, SvxHyperlinkDocTp, ClickFileopenHdl_Impl ) );
+ m_xBtBrowse->connect_clicked( LINK ( this, SvxHyperlinkDocTp, ClickTargetHdl_Impl ) );
+ m_xCbbPath->connect_changed( LINK ( this, SvxHyperlinkDocTp, ModifiedPathHdl_Impl ) );
+ m_xEdTarget->connect_changed( LINK ( this, SvxHyperlinkDocTp, ModifiedTargetHdl_Impl ) );
- m_pCbbPath->SetLoseFocusHdl( LINK ( this, SvxHyperlinkDocTp, LostFocusPathHdl_Impl ) );
+ m_xCbbPath->connect_focus_out( LINK ( this, SvxHyperlinkDocTp, LostFocusPathHdl_Impl ) );
maTimer.SetInvokeHandler ( LINK ( this, SvxHyperlinkDocTp, TimeoutHdl_Impl ) );
}
SvxHyperlinkDocTp::~SvxHyperlinkDocTp()
{
- disposeOnce();
-}
-
-void SvxHyperlinkDocTp::dispose()
-{
- m_pCbbPath.clear();
- m_pBtFileopen.clear();
- m_pEdTarget.clear();
- m_pFtFullURL.clear();
- m_pBtBrowse.clear();
- SvxHyperlinkTabPageBase::dispose();
}
/*************************************************************************
@@ -90,20 +73,19 @@ void SvxHyperlinkDocTp::dispose()
|* Fill all dialog-controls except controls in groupbox "more..."
|*
|************************************************************************/
-
void SvxHyperlinkDocTp::FillDlgFields(const OUString& rStrURL)
{
sal_Int32 nPos = rStrURL.indexOf(sHash);
// path
- m_pCbbPath->SetText ( rStrURL.copy( 0, ( nPos == -1 ? rStrURL.getLength() : nPos ) ) );
+ m_xCbbPath->set_entry_text( rStrURL.copy( 0, ( nPos == -1 ? rStrURL.getLength() : nPos ) ) );
// set target in document at editfield
OUString aStrMark;
if ( nPos != -1 && nPos < rStrURL.getLength()-1 )
aStrMark = rStrURL.copy( nPos+1 );
- m_pEdTarget->SetText ( aStrMark );
+ m_xEdTarget->set_text( aStrMark );
- ModifiedPathHdl_Impl ( *m_pCbbPath );
+ ModifiedPathHdl_Impl(*m_xCbbPath->getWidget());
}
/*************************************************************************
@@ -111,13 +93,12 @@ void SvxHyperlinkDocTp::FillDlgFields(const OUString& rStrURL)
|* retrieve current url-string
|*
|************************************************************************/
-
OUString SvxHyperlinkDocTp::GetCurrentURL ()
{
// get data from dialog-controls
OUString aStrURL;
- OUString aStrPath ( m_pCbbPath->GetText() );
- OUString aStrMark( m_pEdTarget->GetText() );
+ OUString aStrPath( m_xCbbPath->get_active_text() );
+ OUString aStrMark( m_xEdTarget->get_text() );
if ( !aStrPath.isEmpty() )
{
@@ -146,7 +127,6 @@ OUString SvxHyperlinkDocTp::GetCurrentURL ()
|* retrieve and prepare data from dialog-fields
|*
|************************************************************************/
-
void SvxHyperlinkDocTp::GetCurentItemData ( OUString& rStrURL, OUString& aStrName,
OUString& aStrIntName, OUString& aStrFrame,
SvxLinkInsertMode& eMode )
@@ -165,10 +145,9 @@ void SvxHyperlinkDocTp::GetCurentItemData ( OUString& rStrURL, OUString& aStrNam
|* static method to create Tabpage
|*
|************************************************************************/
-
-VclPtr<IconChoicePage> SvxHyperlinkDocTp::Create( vcl::Window* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet )
+std::unique_ptr<IconChoicePage> SvxHyperlinkDocTp::Create(weld::Container* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet)
{
- return VclPtr<SvxHyperlinkDocTp>::Create( pWindow, pDlg, pItemSet );
+ return std::make_unique<SvxHyperlinkDocTp>(pWindow, pDlg, pItemSet);
}
/*************************************************************************
@@ -176,10 +155,9 @@ VclPtr<IconChoicePage> SvxHyperlinkDocTp::Create( vcl::Window* pWindow, SvxHpLin
|* Set initial focus
|*
|************************************************************************/
-
void SvxHyperlinkDocTp::SetInitFocus()
{
- m_pCbbPath->GrabFocus();
+ m_xCbbPath->grab_focus();
}
/*************************************************************************
@@ -187,13 +165,13 @@ void SvxHyperlinkDocTp::SetInitFocus()
|* Click on imagebutton : fileopen
|*
|************************************************************************/
-
-IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickFileopenHdl_Impl, Button*, void)
+IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickFileopenHdl_Impl, weld::Button&, void)
{
+ DisableClose( true );
// Open Fileopen-Dialog
sfx2::FileDialogHelper aDlg(
css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, FileDialogFlags::NONE,
- GetFrameWeld() );
+ mpDialog->getDialog() );
OUString aOldURL( GetCurrentURL() );
if( aOldURL.startsWithIgnoreAsciiCase( sFileScheme ) )
{
@@ -202,7 +180,6 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickFileopenHdl_Impl, Button*, void)
aDlg.SetDisplayFolder( aPath );
}
- DisableClose( true );
ErrCode nError = aDlg.Execute();
DisableClose( false );
@@ -213,11 +190,11 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickFileopenHdl_Impl, Button*, void)
osl::FileBase::getSystemPathFromFileURL(aURL, aPath);
- m_pCbbPath->SetBaseURL( aURL );
- m_pCbbPath->SetText( aPath );
+ m_xCbbPath->SetBaseURL( aURL );
+ m_xCbbPath->set_entry_text(aPath);
if ( aOldURL != GetCurrentURL() )
- ModifiedPathHdl_Impl(*m_pCbbPath);
+ ModifiedPathHdl_Impl(*m_xCbbPath->getWidget());
}
}
@@ -226,8 +203,7 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickFileopenHdl_Impl, Button*, void)
|* Click on imagebutton : target
|*
|************************************************************************/
-
-IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickTargetHdl_Impl, Button*, void)
+IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickTargetHdl_Impl, weld::Button&, void)
{
ShowMarkWnd();
@@ -238,14 +214,12 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickTargetHdl_Impl, Button*, void)
{
mxMarkWnd->SetError( LERR_NOERROR );
- EnterWait();
+ weld::WaitObject aWait(mpDialog->getDialog());
if ( maStrURL.equalsIgnoreAsciiCase( sFileScheme ) )
mxMarkWnd->RefreshTree ( "" );
else
mxMarkWnd->RefreshTree ( maStrURL );
-
- LeaveWait();
}
else
mxMarkWnd->SetError( LERR_DOCNOTOPEN );
@@ -256,15 +230,14 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickTargetHdl_Impl, Button*, void)
|* Contents of combobox "Path" modified
|*
|************************************************************************/
-
-IMPL_LINK_NOARG(SvxHyperlinkDocTp, ModifiedPathHdl_Impl, Edit&, void)
+IMPL_LINK_NOARG(SvxHyperlinkDocTp, ModifiedPathHdl_Impl, weld::ComboBox&, void)
{
maStrURL = GetCurrentURL();
maTimer.SetTimeout( 2500 );
maTimer.Start();
- m_pFtFullURL->SetText( maStrURL );
+ m_xFtFullURL->set_label( maStrURL );
}
/*************************************************************************
@@ -272,21 +245,18 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, ModifiedPathHdl_Impl, Edit&, void)
|* If path-field was modify, to browse the new doc after timeout
|*
|************************************************************************/
-
IMPL_LINK_NOARG(SvxHyperlinkDocTp, TimeoutHdl_Impl, Timer *, void)
{
if ( IsMarkWndVisible() && ( GetPathType( maStrURL )== EPathType::ExistsFile ||
maStrURL.isEmpty() ||
maStrURL.equalsIgnoreAsciiCase( sFileScheme ) ) )
{
- EnterWait();
+ weld::WaitObject aWait(mpDialog->getDialog());
if ( maStrURL.equalsIgnoreAsciiCase( sFileScheme ) )
mxMarkWnd->RefreshTree ( "" );
else
mxMarkWnd->RefreshTree ( maStrURL );
-
- LeaveWait();
}
}
@@ -295,15 +265,14 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, TimeoutHdl_Impl, Timer *, void)
|* Contents of editfield "Target" modified
|*
|************************************************************************/
-
-IMPL_LINK_NOARG(SvxHyperlinkDocTp, ModifiedTargetHdl_Impl, Edit&, void)
+IMPL_LINK_NOARG(SvxHyperlinkDocTp, ModifiedTargetHdl_Impl, weld::Entry&, void)
{
maStrURL = GetCurrentURL();
- if ( IsMarkWndVisible() )
- mxMarkWnd->SelectEntry ( m_pEdTarget->GetText() );
+ if (IsMarkWndVisible())
+ mxMarkWnd->SelectEntry(m_xEdTarget->get_text());
- m_pFtFullURL->SetText( maStrURL );
+ m_xFtFullURL->set_label( maStrURL );
}
/*************************************************************************
@@ -311,12 +280,11 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, ModifiedTargetHdl_Impl, Edit&, void)
|* editfield "Target" lost focus
|*
|************************************************************************/
-
-IMPL_LINK_NOARG(SvxHyperlinkDocTp, LostFocusPathHdl_Impl, Control&, void)
+IMPL_LINK_NOARG(SvxHyperlinkDocTp, LostFocusPathHdl_Impl, weld::Widget&, void)
{
maStrURL = GetCurrentURL();
- m_pFtFullURL->SetText( maStrURL );
+ m_xFtFullURL->set_label( maStrURL );
}
/*************************************************************************
@@ -324,12 +292,11 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, LostFocusPathHdl_Impl, Control&, void)
|* Get String from Bookmark-Wnd
|*
|************************************************************************/
-
void SvxHyperlinkDocTp::SetMarkStr ( const OUString& aStrMark )
{
- m_pEdTarget->SetText ( aStrMark );
+ m_xEdTarget->set_text(aStrMark);
- ModifiedTargetHdl_Impl ( *m_pEdTarget );
+ ModifiedTargetHdl_Impl ( *m_xEdTarget );
}
/*************************************************************************
@@ -337,7 +304,6 @@ void SvxHyperlinkDocTp::SetMarkStr ( const OUString& aStrMark )
|* retrieve kind of pathstr
|*
|************************************************************************/
-
SvxHyperlinkDocTp::EPathType SvxHyperlinkDocTp::GetPathType ( const OUString& rStrPath )
{
INetURLObject aURL( rStrPath, INetProtocol::File );
diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx
index d5d404d3d0fc..864c9beb10c0 100644
--- a/cui/source/dialogs/hlinettp.cxx
+++ b/cui/source/dialogs/hlinettp.cxx
@@ -32,62 +32,45 @@ sal_Char const sFTPScheme[] = INET_FTP_SCHEME;
|* Constructor / Destructor
|*
|************************************************************************/
-
-SvxHyperlinkInternetTp::SvxHyperlinkInternetTp ( vcl::Window *pParent,
- SvxHpLinkDlg* pDlg,
- const SfxItemSet* pItemSet)
-: SvxHyperlinkTabPageBase ( pParent, pDlg, "HyperlinkInternetPage", "cui/ui/hyperlinkinternetpage.ui",
- pItemSet ) ,
- mbMarkWndOpen ( false )
+SvxHyperlinkInternetTp::SvxHyperlinkInternetTp(weld::Container* pParent,
+ SvxHpLinkDlg* pDlg,
+ const SfxItemSet* pItemSet)
+ : SvxHyperlinkTabPageBase(pParent, pDlg, "cui/ui/hyperlinkinternetpage.ui", "HyperlinkInternetPage",
+ pItemSet)
+ , m_bMarkWndOpen(false)
+ , m_xRbtLinktypInternet(xBuilder->weld_radio_button("linktyp_internet"))
+ , m_xRbtLinktypFTP(xBuilder->weld_radio_button("linktyp_ftp"))
+ , m_xCbbTarget(new SvxHyperURLBox(xBuilder->weld_combo_box("target")))
+ , m_xFtLogin(xBuilder->weld_label("login_label"))
+ , m_xEdLogin(xBuilder->weld_entry("login"))
+ , m_xFtPassword(xBuilder->weld_label("password_label"))
+ , m_xEdPassword(xBuilder->weld_entry("password"))
+ , m_xCbAnonymous(xBuilder->weld_check_button("anonymous"))
{
- get(m_pRbtLinktypInternet, "linktyp_internet");
- get(m_pRbtLinktypFTP, "linktyp_ftp");
- get(m_pCbbTarget, "target");
- m_pCbbTarget->SetSmartProtocol(INetProtocol::Http);
- get(m_pFtLogin, "login_label");
- get(m_pEdLogin, "login");
- get(m_pFtPassword, "password_label");
- get(m_pEdPassword, "password");
- get(m_pCbAnonymous, "anonymous");
+ m_xCbbTarget->SetSmartProtocol(INetProtocol::Http);
InitStdControls();
- m_pCbbTarget->Show();
+ m_xCbbTarget->show();
SetExchangeSupport ();
-
// set defaults
- m_pRbtLinktypInternet->Check ();
-
+ m_xRbtLinktypInternet->set_active(true);
// set handlers
- Link<Button*, void> aLink( LINK ( this, SvxHyperlinkInternetTp, Click_SmartProtocol_Impl ) );
- m_pRbtLinktypInternet->SetClickHdl( aLink );
- m_pRbtLinktypFTP->SetClickHdl ( aLink );
- m_pCbAnonymous->SetClickHdl ( LINK ( this, SvxHyperlinkInternetTp, ClickAnonymousHdl_Impl ) );
- m_pEdLogin->SetModifyHdl ( LINK ( this, SvxHyperlinkInternetTp, ModifiedLoginHdl_Impl ) );
- m_pCbbTarget->SetLoseFocusHdl ( LINK ( this, SvxHyperlinkInternetTp, LostFocusTargetHdl_Impl ) );
- m_pCbbTarget->SetModifyHdl ( LINK ( this, SvxHyperlinkInternetTp, ModifiedTargetHdl_Impl ) );
- maTimer.SetInvokeHandler ( LINK ( this, SvxHyperlinkInternetTp, TimeoutHdl_Impl ) );
+ Link<weld::Button&, void> aLink( LINK ( this, SvxHyperlinkInternetTp, Click_SmartProtocol_Impl ) );
+ m_xRbtLinktypInternet->connect_clicked( aLink );
+ m_xRbtLinktypFTP->connect_clicked( aLink );
+ m_xCbAnonymous->connect_clicked( LINK ( this, SvxHyperlinkInternetTp, ClickAnonymousHdl_Impl ) );
+ m_xEdLogin->connect_changed( LINK ( this, SvxHyperlinkInternetTp, ModifiedLoginHdl_Impl ) );
+ m_xCbbTarget->connect_focus_out( LINK ( this, SvxHyperlinkInternetTp, LostFocusTargetHdl_Impl ) );
+ m_xCbbTarget->connect_changed( LINK ( this, SvxHyperlinkInternetTp, ModifiedTargetHdl_Impl ) );
+ maTimer.SetInvokeHandler ( LINK ( this, SvxHyperlinkInternetTp, TimeoutHdl_Impl ) );
}
SvxHyperlinkInternetTp::~SvxHyperlinkInternetTp()
{
- disposeOnce();
-}
-
-void SvxHyperlinkInternetTp::dispose()
-{
- m_pRbtLinktypInternet.clear();
- m_pRbtLinktypFTP.clear();
- m_pCbbTarget.clear();
- m_pFtLogin.clear();
- m_pEdLogin.clear();
- m_pFtPassword.clear();
- m_pEdPassword.clear();
- m_pCbAnonymous.clear();
- SvxHyperlinkTabPageBase::dispose();
}
/*************************************************************************
@@ -95,7 +78,6 @@ void SvxHyperlinkInternetTp::dispose()
|* Fill the all dialog-controls except controls in groupbox "more..."
|*
|************************************************************************/
-
void SvxHyperlinkInternetTp::FillDlgFields(const OUString& rStrURL)
{
INetURLObject aURL(rStrURL);
@@ -117,36 +99,36 @@ void SvxHyperlinkInternetTp::FillDlgFields(const OUString& rStrURL)
// set URL-field
// Show the scheme, #72740
if ( aURL.GetProtocol() != INetProtocol::NotValid )
- m_pCbbTarget->SetText( aURL.GetMainURL( INetURLObject::DecodeMechanism::Unambiguous ) );
+ m_xCbbTarget->set_entry_text( aURL.GetMainURL( INetURLObject::DecodeMechanism::Unambiguous ) );
else
- m_pCbbTarget->SetText(rStrURL);
+ m_xCbbTarget->set_entry_text(rStrURL);
SetScheme(aStrScheme);
}
void SvxHyperlinkInternetTp::setAnonymousFTPUser()
{
- m_pEdLogin->SetText(sAnonymous);
- SvAddressParser aAddress( SvtUserOptions().GetEmail() );
- m_pEdPassword->SetText( aAddress.Count() ? aAddress.GetEmailAddress(0) : OUString() );
-
- m_pFtLogin->Disable ();
- m_pFtPassword->Disable ();
- m_pEdLogin->Disable ();
- m_pEdPassword->Disable ();
- m_pCbAnonymous->Check();
+ m_xEdLogin->set_text(sAnonymous);
+ SvAddressParser aAddress(SvtUserOptions().GetEmail());
+ m_xEdPassword->set_text(aAddress.Count() ? aAddress.GetEmailAddress(0) : OUString());
+
+ m_xFtLogin->set_sensitive(false);
+ m_xFtPassword->set_sensitive(false);
+ m_xEdLogin->set_sensitive(false);
+ m_xEdPassword->set_sensitive(false);
+ m_xCbAnonymous->set_active(true);
}
void SvxHyperlinkInternetTp::setFTPUser(const OUString& rUser, const OUString& rPassword)
{
- m_pEdLogin->SetText ( rUser );
- m_pEdPassword->SetText ( rPassword );
-
- m_pFtLogin->Enable ();
- m_pFtPassword->Enable ();
- m_pEdLogin->Enable ();
- m_pEdPassword->Enable ();
- m_pCbAnonymous->Check(false);
+ m_xEdLogin->set_text(rUser);
+ m_xEdPassword->set_text(rPassword);
+
+ m_xFtLogin->set_sensitive(true);
+ m_xFtPassword->set_sensitive(true);
+ m_xEdLogin->set_sensitive(true);
+ m_xEdPassword->set_sensitive(true);
+ m_xCbAnonymous->set_active(false);
}
/*************************************************************************
@@ -166,7 +148,7 @@ void SvxHyperlinkInternetTp::GetCurentItemData ( OUString& rStrURL, OUString& aS
OUString SvxHyperlinkInternetTp::CreateAbsoluteURL() const
{
// erase leading and trailing whitespaces
- OUString aStrURL( m_pCbbTarget->GetText().trim() );
+ OUString aStrURL(m_xCbbTarget->get_active_text().trim());
INetURLObject aURL(aStrURL);
@@ -177,8 +159,8 @@ OUString SvxHyperlinkInternetTp::CreateAbsoluteURL() const
}
// username and password for ftp-url
- if( aURL.GetProtocol() == INetProtocol::Ftp && !m_pEdLogin->GetText().isEmpty() )
- aURL.SetUserAndPass ( m_pEdLogin->GetText(), m_pEdPassword->GetText() );
+ if( aURL.GetProtocol() == INetProtocol::Ftp && !m_xEdLogin->get_text().isEmpty() )
+ aURL.SetUserAndPass ( m_xEdLogin->get_text(), m_xEdPassword->get_text() );
if ( aURL.GetProtocol() != INetProtocol::NotValid )
return aURL.GetMainURL( INetURLObject::DecodeMechanism::ToIUri );
@@ -192,9 +174,9 @@ OUString SvxHyperlinkInternetTp::CreateAbsoluteURL() const
|*
|************************************************************************/
-VclPtr<IconChoicePage> SvxHyperlinkInternetTp::Create( vcl::Window* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet )
+std::unique_ptr<IconChoicePage> SvxHyperlinkInternetTp::Create(weld::Container* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet)
{
- return VclPtr<SvxHyperlinkInternetTp>::Create( pWindow, pDlg, pItemSet );
+ return std::make_unique<SvxHyperlinkInternetTp>(pWindow, pDlg, pItemSet);
}
/*************************************************************************
@@ -202,10 +184,9 @@ VclPtr<IconChoicePage> SvxHyperlinkInternetTp::Create( vcl::Window* pWindow, Svx
|* Set initial focus
|*
|************************************************************************/
-
void SvxHyperlinkInternetTp::SetInitFocus()
{
- m_pCbbTarget->GrabFocus();
+ m_xCbbTarget->grab_focus();
}
/*************************************************************************
@@ -213,10 +194,9 @@ void SvxHyperlinkInternetTp::SetInitFocus()
|* Contents of editfield "Target" modified
|*
|************************************************************************/
-
-IMPL_LINK_NOARG(SvxHyperlinkInternetTp, ModifiedTargetHdl_Impl, Edit&, void)
+IMPL_LINK_NOARG(SvxHyperlinkInternetTp, ModifiedTargetHdl_Impl, weld::ComboBox&, void)
{
- OUString aScheme = GetSchemeFromURL( m_pCbbTarget->GetText() );
+ OUString aScheme = GetSchemeFromURL( m_xCbbTarget->get_active_text() );
if( !aScheme.isEmpty() )
SetScheme( aScheme );
@@ -230,7 +210,6 @@ IMPL_LINK_NOARG(SvxHyperlinkInternetTp, ModifiedTargetHdl_Impl, Edit&, void)
|* If target-field was modify, to browse the new doc after timeout
|*
|************************************************************************/
-
IMPL_LINK_NOARG(SvxHyperlinkInternetTp, TimeoutHdl_Impl, Timer *, void)
{
RefreshMarkWindow();
@@ -241,14 +220,13 @@ IMPL_LINK_NOARG(SvxHyperlinkInternetTp, TimeoutHdl_Impl, Timer *, void)
|* Contents of editfield "Login" modified
|*
|************************************************************************/
-
-IMPL_LINK_NOARG(SvxHyperlinkInternetTp, ModifiedLoginHdl_Impl, Edit&, void)
+IMPL_LINK_NOARG(SvxHyperlinkInternetTp, ModifiedLoginHdl_Impl, weld::Entry&, void)
{
- OUString aStrLogin ( m_pEdLogin->GetText() );
+ OUString aStrLogin ( m_xEdLogin->get_text() );
if ( aStrLogin.equalsIgnoreAsciiCase( sAnonymous ) )
{
- m_pCbAnonymous->Check();
- ClickAnonymousHdl_Impl(nullptr);
+ m_xCbAnonymous->set_active(true);
+ ClickAnonymousHdl_Impl(*m_xCbAnonymous);
}
}
@@ -259,30 +237,30 @@ void SvxHyperlinkInternetTp::SetScheme(const OUString& rScheme)
bool bInternet = !bFTP;
//update protocol button selection:
- m_pRbtLinktypFTP->Check(bFTP);
- m_pRbtLinktypInternet->Check(bInternet);
+ m_xRbtLinktypFTP->set_active(bFTP);
+ m_xRbtLinktypInternet->set_active(bInternet);
//update target:
RemoveImproperProtocol(rScheme);
- m_pCbbTarget->SetSmartProtocol( GetSmartProtocolFromButtons() );
+ m_xCbbTarget->SetSmartProtocol( GetSmartProtocolFromButtons() );
//show/hide special fields for FTP:
- m_pFtLogin->Show( bFTP );
- m_pFtPassword->Show( bFTP );
- m_pEdLogin->Show( bFTP );
- m_pEdPassword->Show( bFTP );
- m_pCbAnonymous->Show( bFTP );
+ m_xFtLogin->set_visible( bFTP );
+ m_xFtPassword->set_visible( bFTP );
+ m_xEdLogin->set_visible( bFTP );
+ m_xEdPassword->set_visible( bFTP );
+ m_xCbAnonymous->set_visible( bFTP );
//update 'link target in document'-window and opening-button
if (rScheme.startsWith(INET_HTTP_SCHEME) || rScheme.isEmpty())
{
- if ( mbMarkWndOpen )
+ if ( m_bMarkWndOpen )
ShowMarkWnd ();
}
else
{
//disable for https and ftp
- if ( mbMarkWndOpen )
+ if ( m_bMarkWndOpen )
HideMarkWnd ();
}
}
@@ -295,28 +273,28 @@ void SvxHyperlinkInternetTp::SetScheme(const OUString& rScheme)
void SvxHyperlinkInternetTp::RemoveImproperProtocol(const OUString& aProperScheme)
{
- OUString aStrURL ( m_pCbbTarget->GetText() );
+ OUString aStrURL ( m_xCbbTarget->get_active_text() );
if ( !aStrURL.isEmpty() )
{
OUString aStrScheme(GetSchemeFromURL(aStrURL));
if ( !aStrScheme.isEmpty() && aStrScheme != aProperScheme )
{
aStrURL = aStrURL.copy( aStrScheme.getLength() );
- m_pCbbTarget->SetText ( aStrURL );
+ m_xCbbTarget->set_entry_text( aStrURL );
}
}
}
OUString SvxHyperlinkInternetTp::GetSchemeFromButtons() const
{
- if( m_pRbtLinktypFTP->IsChecked() )
+ if( m_xRbtLinktypFTP->get_active() )
return OUString(INET_FTP_SCHEME);
return OUString(INET_HTTP_SCHEME);
}
INetProtocol SvxHyperlinkInternetTp::GetSmartProtocolFromButtons() const
{
- if( m_pRbtLinktypFTP->IsChecked() )
+ if( m_xRbtLinktypFTP->get_active() )
{
return INetProtocol::Ftp;
}
@@ -328,8 +306,7 @@ INetProtocol SvxHyperlinkInternetTp::GetSmartProtocolFromButtons() const
|* Click on Radiobutton : Internet or FTP
|*
|************************************************************************/
-
-IMPL_LINK_NOARG(SvxHyperlinkInternetTp, Click_SmartProtocol_Impl, Button*, void)
+IMPL_LINK_NOARG(SvxHyperlinkInternetTp, Click_SmartProtocol_Impl, weld::Button&, void)
{
OUString aScheme = GetSchemeFromButtons();
SetScheme(aScheme);
@@ -340,21 +317,20 @@ IMPL_LINK_NOARG(SvxHyperlinkInternetTp, Click_SmartProtocol_Impl, Button*, void)
|* Click on Checkbox : Anonymous user
|*
|************************************************************************/
-
-IMPL_LINK_NOARG(SvxHyperlinkInternetTp, ClickAnonymousHdl_Impl, Button*, void)
+IMPL_LINK_NOARG(SvxHyperlinkInternetTp, ClickAnonymousHdl_Impl, weld::Button&, void)
{
// disable login-editfields if checked
- if ( m_pCbAnonymous->IsChecked() )
+ if ( m_xCbAnonymous->get_active() )
{
- if ( m_pEdLogin->GetText().toAsciiLowerCase().startsWith( sAnonymous ) )
+ if ( m_xEdLogin->get_text().toAsciiLowerCase().startsWith( sAnonymous ) )
{
maStrOldUser.clear();
maStrOldPassword.clear();
}
else
{
- maStrOldUser = m_pEdLogin->GetText();
- maStrOldPassword = m_pEdPassword->GetText();
+ maStrOldUser = m_xEdLogin->get_text();
+ maStrOldPassword = m_xEdPassword->get_text();
}
setAnonymousFTPUser();
@@ -368,25 +344,22 @@ IMPL_LINK_NOARG(SvxHyperlinkInternetTp, ClickAnonymousHdl_Impl, Button*, void)
|* Combobox Target lost the focus
|*
|************************************************************************/
-
-IMPL_LINK_NOARG(SvxHyperlinkInternetTp, LostFocusTargetHdl_Impl, Control&, void)
+IMPL_LINK_NOARG(SvxHyperlinkInternetTp, LostFocusTargetHdl_Impl, weld::Widget&, void)
{
RefreshMarkWindow();
}
void SvxHyperlinkInternetTp::RefreshMarkWindow()
{
- if ( m_pRbtLinktypInternet->IsChecked() && IsMarkWndVisible() )
+ if (m_xRbtLinktypInternet->get_active() && IsMarkWndVisible())
{
- EnterWait();
+ weld::WaitObject aWait(mpDialog->getDialog());
OUString aStrURL( CreateAbsoluteURL() );
if ( !aStrURL.isEmpty() )
mxMarkWnd->RefreshTree ( aStrURL );
else
mxMarkWnd->SetError( LERR_DOCNOTOPEN );
- LeaveWait();
}
-
}
/*************************************************************************
@@ -394,10 +367,9 @@ void SvxHyperlinkInternetTp::RefreshMarkWindow()
|* Get String from Bookmark-Wnd
|*
|************************************************************************/
-
void SvxHyperlinkInternetTp::SetMarkStr ( const OUString& aStrMark )
{
- OUString aStrURL ( m_pCbbTarget->GetText() );
+ OUString aStrURL(m_xCbbTarget->get_active_text());
const sal_Unicode sUHash = '#';
sal_Int32 nPos = aStrURL.lastIndexOf( sUHash );
@@ -407,7 +379,7 @@ void SvxHyperlinkInternetTp::SetMarkStr ( const OUString& aStrMark )
aStrURL += OUStringLiteral1(sUHash) + aStrMark;
- m_pCbbTarget->SetText ( aStrURL );
+ m_xCbbTarget->set_entry_text(aStrURL);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/hlmailtp.cxx b/cui/source/dialogs/hlmailtp.cxx
index 93e1bc021512..ea2eaa808da0 100644
--- a/cui/source/dialogs/hlmailtp.cxx
+++ b/cui/source/dialogs/hlmailtp.cxx
@@ -36,48 +36,32 @@ using namespace ::com::sun::star;
|* Constructor / Destructor
|*
|************************************************************************/
-
-SvxHyperlinkMailTp::SvxHyperlinkMailTp ( vcl::Window *pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet)
-: SvxHyperlinkTabPageBase ( pParent, pDlg, "HyperlinkMailPage", "cui/ui/hyperlinkmailpage.ui",
- pItemSet )
+SvxHyperlinkMailTp::SvxHyperlinkMailTp(weld::Container* pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet)
+ : SvxHyperlinkTabPageBase(pParent, pDlg, "cui/ui/hyperlinkmailpage.ui", "HyperlinkMailPage", pItemSet)
+ , m_xCbbReceiver(new SvxHyperURLBox(xBuilder->weld_combo_box("receiver")))
+ , m_xBtAdrBook(xBuilder->weld_button("adressbook"))
+ , m_xFtSubject(xBuilder->weld_label("subject_label"))
+ , m_xEdSubject(xBuilder->weld_entry("subject"))
{
- get(m_pCbbReceiver, "receiver");
- m_pCbbReceiver->SetSmartProtocol(INetProtocol::Mailto);
- get(m_pBtAdrBook, "adressbook");
- m_pBtAdrBook->SetModeImage(Image(StockImage::Yes, RID_SVXBMP_ADRESSBOOK));
- get(m_pFtSubject, "subject_label");
- get(m_pEdSubject, "subject");
-
- // Disable display of bitmap names.
- m_pBtAdrBook->EnableTextDisplay (false);
+ m_xCbbReceiver->SetSmartProtocol(INetProtocol::Mailto);
InitStdControls();
- m_pCbbReceiver->Show();
+ m_xCbbReceiver->show();
SetExchangeSupport ();
// set handlers
- m_pBtAdrBook->SetClickHdl ( LINK ( this, SvxHyperlinkMailTp, ClickAdrBookHdl_Impl ) );
- m_pCbbReceiver->SetModifyHdl ( LINK ( this, SvxHyperlinkMailTp, ModifiedReceiverHdl_Impl) );
+ m_xBtAdrBook->connect_clicked( LINK ( this, SvxHyperlinkMailTp, ClickAdrBookHdl_Impl ) );
+ m_xCbbReceiver->connect_changed( LINK ( this, SvxHyperlinkMailTp, ModifiedReceiverHdl_Impl) );
if ( !SvtModuleOptions().IsModuleInstalled( SvtModuleOptions::EModule::DATABASE ) ||
comphelper::LibreOfficeKit::isActive() )
- m_pBtAdrBook->Hide();
+ m_xBtAdrBook->hide();
}
SvxHyperlinkMailTp::~SvxHyperlinkMailTp()
{
- disposeOnce();
-}
-
-void SvxHyperlinkMailTp::dispose()
-{
- m_pCbbReceiver.clear();
- m_pBtAdrBook.clear();
- m_pFtSubject.clear();
- m_pEdSubject.clear();
- SvxHyperlinkTabPageBase::dispose();
}
/*************************************************************************
@@ -111,14 +95,14 @@ void SvxHyperlinkMailTp::FillDlgFields(const OUString& rStrURL)
if ( nPos != -1 )
aStrURLc = aStrURLc.copy( 0, nPos );
- m_pEdSubject->SetText ( aStrSubject );
+ m_xEdSubject->set_text( aStrSubject );
}
else
{
- m_pEdSubject->SetText ("");
+ m_xEdSubject->set_text("");
}
- m_pCbbReceiver->SetText ( aStrURLc );
+ m_xCbbReceiver->set_entry_text(aStrURLc);
SetScheme( aStrScheme );
}
@@ -128,7 +112,6 @@ void SvxHyperlinkMailTp::FillDlgFields(const OUString& rStrURL)
|* retrieve and prepare data from dialog-fields
|*
|************************************************************************/
-
void SvxHyperlinkMailTp::GetCurentItemData ( OUString& rStrURL, OUString& aStrName,
OUString& aStrIntName, OUString& aStrFrame,
SvxLinkInsertMode& eMode )
@@ -139,7 +122,7 @@ void SvxHyperlinkMailTp::GetCurentItemData ( OUString& rStrURL, OUString& aStrNa
OUString SvxHyperlinkMailTp::CreateAbsoluteURL() const
{
- OUString aStrURL = m_pCbbReceiver->GetText();
+ OUString aStrURL = m_xCbbReceiver->get_active_text();
INetURLObject aURL(aStrURL);
if( aURL.GetProtocol() == INetProtocol::NotValid )
@@ -151,9 +134,9 @@ OUString SvxHyperlinkMailTp::CreateAbsoluteURL() const
// subject for EMail-url
if( aURL.GetProtocol() == INetProtocol::Mailto )
{
- if ( !m_pEdSubject->GetText().isEmpty() )
+ if (!m_xEdSubject->get_text().isEmpty())
{
- OUString aQuery = "subject=" + m_pEdSubject->GetText();
+ OUString aQuery = "subject=" + m_xEdSubject->get_text();
aURL.SetParam(aQuery);
}
}
@@ -170,9 +153,9 @@ OUString SvxHyperlinkMailTp::CreateAbsoluteURL() const
|*
|************************************************************************/
-VclPtr<IconChoicePage> SvxHyperlinkMailTp::Create( vcl::Window* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet )
+std::unique_ptr<IconChoicePage> SvxHyperlinkMailTp::Create(weld::Container* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet)
{
- return VclPtr<SvxHyperlinkMailTp>::Create( pWindow, pDlg, pItemSet );
+ return std::make_unique<SvxHyperlinkMailTp>(pWindow, pDlg, pItemSet);
}
/*************************************************************************
@@ -180,24 +163,22 @@ VclPtr<IconChoicePage> SvxHyperlinkMailTp::Create( vcl::Window* pWindow, SvxHpLi
|* Set initial focus
|*
|************************************************************************/
-
void SvxHyperlinkMailTp::SetInitFocus()
{
- m_pCbbReceiver->GrabFocus();
+ m_xCbbReceiver->grab_focus();
}
/*************************************************************************
|************************************************************************/
-
void SvxHyperlinkMailTp::SetScheme(const OUString& rScheme)
{
//update target:
RemoveImproperProtocol(rScheme);
- m_pCbbReceiver->SetSmartProtocol( INetProtocol::Mailto );
+ m_xCbbReceiver->SetSmartProtocol( INetProtocol::Mailto );
//show/hide special fields for MAIL:
- m_pBtAdrBook->Enable();
- m_pEdSubject->Enable();
+ m_xBtAdrBook->set_sensitive(true);
+ m_xEdSubject->set_sensitive(true);
}
/*************************************************************************
@@ -205,17 +186,16 @@ void SvxHyperlinkMailTp::SetScheme(const OUString& rScheme)
|* Remove protocol if it does not fit to the current button selection
|*
|************************************************************************/
-
void SvxHyperlinkMailTp::RemoveImproperProtocol(const OUString& aProperScheme)
{
- OUString aStrURL ( m_pCbbReceiver->GetText() );
+ OUString aStrURL(m_xCbbReceiver->get_active_text());
if ( !aStrURL.isEmpty() )
{
OUString aStrScheme = GetSchemeFromURL( aStrURL );
if ( !aStrScheme.isEmpty() && aStrScheme != aProperScheme )
{
aStrURL = aStrURL.copy( aStrScheme.getLength() );
- m_pCbbReceiver->SetText ( aStrURL );
+ m_xCbbReceiver->set_entry_text(aStrURL);
}
}
}
@@ -225,10 +205,9 @@ void SvxHyperlinkMailTp::RemoveImproperProtocol(const OUString& aProperScheme)
|* Contents of editfield "receiver" modified
|*
|************************************************************************/
-
-IMPL_LINK_NOARG(SvxHyperlinkMailTp, ModifiedReceiverHdl_Impl, Edit&, void)
+IMPL_LINK_NOARG(SvxHyperlinkMailTp, ModifiedReceiverHdl_Impl, weld::ComboBox&, void)
{
- OUString aScheme = GetSchemeFromURL( m_pCbbReceiver->GetText() );
+ OUString aScheme = GetSchemeFromURL( m_xCbbReceiver->get_active_text() );
if(!aScheme.isEmpty())
SetScheme( aScheme );
}
@@ -238,8 +217,7 @@ IMPL_LINK_NOARG(SvxHyperlinkMailTp, ModifiedReceiverHdl_Impl, Edit&, void)
|* Click on imagebutton : addressbook
|*
|************************************************************************/
-
-IMPL_STATIC_LINK_NOARG(SvxHyperlinkMailTp, ClickAdrBookHdl_Impl, Button*, void)
+IMPL_STATIC_LINK_NOARG(SvxHyperlinkMailTp, ClickAdrBookHdl_Impl, weld::Button&, void)
{
SfxViewFrame* pViewFrame = SfxViewFrame::Current();
if( pViewFrame )
@@ -250,5 +228,4 @@ IMPL_STATIC_LINK_NOARG(SvxHyperlinkMailTp, ClickAdrBookHdl_Impl, Button*, void)
}
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index f7f48e065bfc..16816d7b7d1c 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -72,16 +72,14 @@ OUString CreateUiNameFromURL( const OUString& aStrURL )
}
-//# ComboBox-Control for URL's with History and Autocompletion #
-
-SvxHyperURLBox::SvxHyperURLBox( vcl::Window* pParent, INetProtocol eSmart )
-: SvtURLBox ( pParent, eSmart ),
- DropTargetHelper ( this )
+// ComboBox-Control for URL's with History and Autocompletion
+SvxHyperURLBox::SvxHyperURLBox(std::unique_ptr<weld::ComboBox> xControl)
+ : URLBox(std::move(xControl))
+ , DropTargetHelper(getWidget()->get_drop_target())
{
+ SetSmartProtocol(INetProtocol::Http);
}
-VCL_BUILDER_FACTORY_ARGS(SvxHyperURLBox, INetProtocol::Http)
-
sal_Int8 SvxHyperURLBox::AcceptDrop( const AcceptDropEvent& /* rEvt */ )
{
return IsDropFormatSupported( SotClipboardFormatId::STRING ) ? DND_ACTION_COPY : DND_ACTION_NONE;
@@ -95,7 +93,7 @@ sal_Int8 SvxHyperURLBox::ExecuteDrop( const ExecuteDropEvent& rEvt )
if( aDataHelper.GetString( SotClipboardFormatId::STRING, aString ) )
{
- SetText( aString );
+ set_entry_text(aString);
nRet = DND_ACTION_COPY;
}
@@ -104,17 +102,19 @@ sal_Int8 SvxHyperURLBox::ExecuteDrop( const ExecuteDropEvent& rEvt )
//# Hyperlink-Dialog: Tabpages-Baseclass #
-SvxHyperlinkTabPageBase::SvxHyperlinkTabPageBase ( vcl::Window *pParent,
- SvxHpLinkDlg* pDlg,
- const OString& rID,
- const OUString& rUIXMLDescription,
- const SfxItemSet* pItemSet )
- : IconChoicePage( pParent, rID, rUIXMLDescription, pItemSet )
- , mpCbbFrame( nullptr )
- , mpLbForm( nullptr )
- , mpEdIndication( nullptr )
- , mpEdText( nullptr )
- , mpBtScript( nullptr )
+SvxHyperlinkTabPageBase::SvxHyperlinkTabPageBase(weld::Container* pParent,
+ SvxHpLinkDlg* pDlg,
+ const OUString& rUIXMLDescription,
+ const OString& rID,
+ const SfxItemSet* pItemSet)
+ : IconChoicePage(pParent, rUIXMLDescription, rID, pItemSet)
+ , mxCbbFrame(xBuilder->weld_combo_box("frame"))
+ , mxLbForm(xBuilder->weld_combo_box("form"))
+ , mxEdIndication(xBuilder->weld_entry("indication"))
+ , mxEdText(xBuilder->weld_entry("name"))
+ , mxBtScript(xBuilder->weld_button("script"))
+ , mxFormLabel(xBuilder->weld_label("form_label"))
+ , mxFrameLabel(xBuilder->weld_label("frame_label"))
, mbIsCloseDisabled( false )
, mpDialog( pDlg )
, mbStdControlsInit( false )
@@ -124,23 +124,9 @@ SvxHyperlinkTabPageBase::SvxHyperlinkTabPageBase ( vcl::Window *pParent,
SvxHyperlinkTabPageBase::~SvxHyperlinkTabPageBase()
{
- disposeOnce();
-}
-
-void SvxHyperlinkTabPageBase::dispose()
-{
maTimer.Stop();
HideMarkWnd();
-
- mpCbbFrame.clear();
- mpLbForm.clear();
- mpEdIndication.clear();
- mpEdText.clear();
- mpBtScript.clear();
- mpDialog.clear();
-
- IconChoicePage::dispose();
}
bool SvxHyperlinkTabPageBase::QueryClose()
@@ -152,8 +138,6 @@ void SvxHyperlinkTabPageBase::InitStdControls ()
{
if ( !mbStdControlsInit )
{
- get(mpCbbFrame, "frame");
-
SfxDispatcher* pDispatch = GetDispatcher();
SfxViewFrame* pViewFrame = pDispatch ? pDispatch->GetFrame() : nullptr;
SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetFrame() : nullptr;
@@ -167,19 +151,14 @@ void SvxHyperlinkTabPageBase::InitStdControls ()
size_t i;
for ( i = 0; i < nCount; i++ )
{
- mpCbbFrame->InsertEntry( pList->at( i ) );
+ mxCbbFrame->append_text( pList->at( i ) );
}
}
}
- get(mpLbForm, "form");
- get(mpEdIndication, "indication");
- get(mpEdText, "name");
- get(mpBtScript, "script");
- mpBtScript->SetModeImage(Image(StockImage::Yes, RID_SVXBMP_SCRIPT));
+ mxBtScript->set_from_icon_name(RID_SVXBMP_SCRIPT);
- mpBtScript->SetClickHdl ( LINK ( this, SvxHyperlinkTabPageBase, ClickScriptHdl_Impl ) );
- mpBtScript->EnableTextDisplay (false);
+ mxBtScript->connect_clicked ( LINK ( this, SvxHyperlinkTabPageBase, ClickScriptHdl_Impl ) );
}
mbStdControlsInit = true;
@@ -200,15 +179,16 @@ void SvxHyperlinkTabPageBase::ShowMarkWnd()
return;
}
- mxMarkWnd = std::make_unique<SvxHlinkDlgMarkWnd>(GetFrameWeld(), this);
+ weld::Dialog* pDialog = mpDialog->getDialog();
+
+ mxMarkWnd = std::make_unique<SvxHlinkDlgMarkWnd>(pDialog, this);
// Size of dialog-window in screen pixels
- ::tools::Rectangle aDlgRect( mpDialog->GetWindowExtentsRelative( nullptr ) );
- Point aDlgPos ( aDlgRect.TopLeft() );
- Size aDlgSize ( mpDialog->GetSizePixel () );
+ Point aDlgPos(pDialog->get_position());
+ Size aDlgSize(pDialog->get_size());
// Absolute size of the screen
- ::tools::Rectangle aScreen( mpDialog->GetDesktopRectPixel() );
+ ::tools::Rectangle aScreen(pDialog->get_monitor_workarea());
// Size of Extrawindow
Size aExtraWndSize(mxMarkWnd->getDialog()->get_preferred_size());
@@ -254,9 +234,9 @@ void SvxHyperlinkTabPageBase::FillStandardDlgFields ( const SvxHyperlinkItem* pH
if (!comphelper::LibreOfficeKit::isActive())
{
// Frame
- sal_Int32 nPos = mpCbbFrame->GetEntryPos ( pHyperlinkItem->GetTargetFrame() );
- if ( nPos != COMBOBOX_ENTRY_NOTFOUND)
- mpCbbFrame->SetText ( pHyperlinkItem->GetTargetFrame() );
+ sal_Int32 nPos = mxCbbFrame->find_text(pHyperlinkItem->GetTargetFrame());
+ if (nPos != -1)
+ mxCbbFrame->set_active(nPos);
// Form
OUString aStrFormText = CuiResId( RID_SVXSTR_HYPERDLG_FROM_TEXT );
@@ -265,41 +245,37 @@ void SvxHyperlinkTabPageBase::FillStandardDlgFields ( const SvxHyperlinkItem* pH
if( pHyperlinkItem->GetInsertMode() & HLINK_HTMLMODE )
{
- mpLbForm->Clear();
- mpLbForm->InsertEntry( aStrFormText );
- mpLbForm->SelectEntryPos ( 0 );
+ mxLbForm->clear();
+ mxLbForm->append_text( aStrFormText );
+ mxLbForm->set_active( 0 );
}
else
{
- mpLbForm->Clear();
- mpLbForm->InsertEntry( aStrFormText );
- mpLbForm->InsertEntry( aStrFormButton );
- mpLbForm->SelectEntryPos ( pHyperlinkItem->GetInsertMode() == HLINK_BUTTON ? 1 : 0 );
+ mxLbForm->clear();
+ mxLbForm->append_text( aStrFormText );
+ mxLbForm->append_text( aStrFormButton );
+ mxLbForm->set_active( pHyperlinkItem->GetInsertMode() == HLINK_BUTTON ? 1 : 0 );
}
}
else
{
- mpCbbFrame->Hide();
- mpLbForm->Hide();
-
- VclPtr<FixedText> pLabel;
- get(pLabel, "form_label");
- pLabel->Hide();
- get(pLabel, "frame_label");
- pLabel->Hide();
+ mxCbbFrame->hide();
+ mxLbForm->hide();
+ mxFormLabel->hide();
+ mxFrameLabel->hide();
}
// URL
- mpEdIndication->SetText ( pHyperlinkItem->GetName() );
+ mxEdIndication->set_text( pHyperlinkItem->GetName() );
// Name
- mpEdText->SetText ( pHyperlinkItem->GetIntName() );
+ mxEdText->set_text( pHyperlinkItem->GetIntName() );
// Script-button
if ( pHyperlinkItem->GetMacroEvents() == HyperDialogEvent::NONE )
- mpBtScript->Disable();
+ mxBtScript->set_sensitive(false);
else
- mpBtScript->Enable();
+ mxBtScript->set_sensitive(true);
}
// Any action to do after apply-button is pressed
@@ -324,17 +300,26 @@ void SvxHyperlinkTabPageBase::SetMarkStr ( const OUString& /*aStrMark*/ )
// Set initial focus
void SvxHyperlinkTabPageBase::SetInitFocus()
{
- GrabFocus();
+ xContainer->grab_focus();
}
// retrieve dispatcher
SfxDispatcher* SvxHyperlinkTabPageBase::GetDispatcher() const
{
- return static_cast<SvxHpLinkDlg*>(mpDialog.get())->GetDispatcher();
+ return mpDialog->GetDispatcher();
+}
+
+void SvxHyperlinkTabPageBase::DisableClose(bool _bDisable)
+{
+ mbIsCloseDisabled = _bDisable;
+ if (mbIsCloseDisabled)
+ maBusy.incBusy(mpDialog->getDialog());
+ else
+ maBusy.decBusy();
}
// Click on imagebutton : Script
-IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, Button*, void)
+IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, weld::Button&, void)
{
SvxHyperlinkItem *pHyperlinkItem = const_cast<SvxHyperlinkItem*>(static_cast<const SvxHyperlinkItem *>(
GetItemSet().GetItem (SID_HYPERLINK_GETLINK)));
@@ -353,14 +338,9 @@ IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, Button*, void)
SID_ATTR_MACROITEM>{} ) );
pItemSet->Put ( aItem );
- /* disable HyperLinkDlg for input while the MacroAssignDlg is working
- because if no JAVA is installed an error box occurs and then it is possible
- to close the HyperLinkDlg before its child (MacroAssignDlg) -> GPF
- */
- bool bIsInputEnabled = GetParent()->IsInputEnabled();
- if ( bIsInputEnabled )
- GetParent()->EnableInput( false );
- SfxMacroAssignDlg aDlg(GetFrameWeld(), mxDocumentFrame, *pItemSet);
+ DisableClose( true );
+
+ SfxMacroAssignDlg aDlg(mpDialog->getDialog(), mxDocumentFrame, *pItemSet);
// add events
SfxMacroTabPage *pMacroPage = aDlg.GetTabPage();
@@ -374,11 +354,7 @@ IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, Button*, void)
if ( pHyperlinkItem->GetMacroEvents() & HyperDialogEvent::MouseOutObject )
pMacroPage->AddEvent( CuiResId(RID_SVXSTR_HYPDLG_MACROACT3),
SvMacroItemId::OnMouseOut);
-
- if ( bIsInputEnabled )
- GetParent()->EnableInput();
// execute dlg
- DisableClose( true );
short nRet = aDlg.run();
DisableClose( false );
if ( RET_OK == nRet )
@@ -444,23 +420,22 @@ OUString SvxHyperlinkTabPageBase::GetSchemeFromURL( const OUString& rStrURL )
return aStrScheme;
}
-
void SvxHyperlinkTabPageBase::GetDataFromCommonFields( OUString& aStrName,
OUString& aStrIntName, OUString& aStrFrame,
SvxLinkInsertMode& eMode )
{
- aStrIntName = mpEdText->GetText();
- aStrName = mpEdIndication->GetText();
- aStrFrame = mpCbbFrame->GetText();
+ aStrIntName = mxEdText->get_text();
+ aStrName = mxEdIndication->get_text();
+ aStrFrame = mxCbbFrame->get_active_text();
- sal_Int32 nPos = mpLbForm->GetSelectedEntryPos();
- if (nPos == LISTBOX_ENTRY_NOTFOUND)
+ sal_Int32 nPos = mxLbForm->get_active();
+ if (nPos == -1)
// This happens when FillStandardDlgFields() hides mpLbForm.
nPos = 0;
eMode = static_cast<SvxLinkInsertMode>(nPos + 1);
// Ask dialog whether the current doc is a HTML-doc
- if (static_cast<SvxHpLinkDlg*>(mpDialog.get())->IsHTMLDoc())
+ if (mpDialog->IsHTMLDoc())
eMode = static_cast<SvxLinkInsertMode>( sal_uInt16(eMode) | HLINK_HTMLMODE );
}
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index 3f5e3937abc1..0abb498efe9d 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -36,20 +36,18 @@
|
\**********************************************************************/
-IconChoicePage::IconChoicePage( vcl::Window *pParent, const OString& rID,
- const OUString& rUIXMLDescription,
- const SfxItemSet* pItemSet )
-: TabPage ( pParent, rID, rUIXMLDescription ),
- pSet ( pItemSet ),
- bHasExchangeSupport ( false )
+IconChoicePage::IconChoicePage(weld::Container* pParent,
+ const OUString& rUIXMLDescription, const OString& rID,
+ const SfxItemSet* pItemSet)
+ : xBuilder(Application::CreateBuilder(pParent, rUIXMLDescription))
+ , xContainer(xBuilder->weld_container(rID))
+ , pSet(pItemSet)
+ , bHasExchangeSupport(false)
{
- SetStyle ( GetStyle() | WB_DIALOGCONTROL | WB_HIDE );
}
-
IconChoicePage::~IconChoicePage()
{
- disposeOnce();
}
/**********************************************************************
@@ -75,95 +73,15 @@ bool IconChoicePage::QueryClose()
/**********************************************************************
|
-| window-methods
-|
-\**********************************************************************/
-
-void IconChoicePage::ImplInitSettings()
-{
- vcl::Window* pParent = GetParent();
- if ( pParent->IsChildTransparentModeEnabled() && !IsControlBackground() )
- {
- EnableChildTransparentMode();
- SetParentClipMode( ParentClipMode::NoClip );
- SetPaintTransparent( true );
- SetBackground();
- }
- else
- {
- EnableChildTransparentMode( false );
- SetParentClipMode();
- SetPaintTransparent( false );
-
- if ( IsControlBackground() )
- SetBackground( GetControlBackground() );
- else
- SetBackground( pParent->GetBackground() );
- }
-}
-
-
-void IconChoicePage::StateChanged( StateChangedType nType )
-{
- Window::StateChanged( nType );
-
- if ( nType == StateChangedType::ControlBackground )
- {
- ImplInitSettings();
- Invalidate();
- }
-}
-
-
-void IconChoicePage::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Window::DataChanged( rDCEvt );
-
- if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
- (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
- {
- ImplInitSettings();
- Invalidate();
- }
-}
-
-
-/**********************************************************************
-|
-| Ctor / Dtor
-|
-\**********************************************************************/
-
-VCL_BUILDER_FACTORY_ARGS(SvtIconChoiceCtrl,
- WB_3DLOOK | WB_ICON | WB_BORDER |
- WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME |
- WB_NODRAGSELECTION | WB_TABSTOP);
-
-/**********************************************************************
-|
| add new page
|
\**********************************************************************/
-
-SvxIconChoiceCtrlEntry* SvxHpLinkDlg::AddTabPage(
- HyperLinkPageType nId,
- const OUString& rIconText,
- const Image& rChoiceIcon,
- CreatePage pCreateFunc /* != 0 */
-)
-{
- maPageList.emplace_back( new IconChoicePageData ( nId, pCreateFunc ) );
-
- SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->InsertEntry( rIconText, rChoiceIcon );
- pEntry->SetUserData ( reinterpret_cast<void*>(nId) );
- return pEntry;
-}
-
-void SvxHpLinkDlg::SetCtrlStyle()
+void SvxHpLinkDlg::AddTabPage(const OString& rId, CreatePage pCreateFunc /* != 0 */)
{
- WinBits const aWinBits = WB_3DLOOK | WB_ICON | WB_BORDER | WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | WB_NODRAGSELECTION | WB_TABSTOP | WB_CLIPCHILDREN | WB_ALIGN_LEFT | WB_NOHSCROLL;
- m_pIconCtrl->SetStyle(aWinBits);
- m_pIconCtrl->ArrangeIcons();
+ weld::Container* pPage = m_xIconCtrl->get_page(rId);
+ maPageList.emplace_back(new IconChoicePageData(rId, pCreateFunc(pPage, this, pSet)));
+ maPageList.back()->xPage->Reset(*pSet);
+ PageCreated(rId, *maPageList.back()->xPage);
}
/**********************************************************************
@@ -171,40 +89,20 @@ void SvxHpLinkDlg::SetCtrlStyle()
| Show / Hide page or button
|
\**********************************************************************/
-
-void SvxHpLinkDlg::ShowPageImpl ( IconChoicePageData const * pData )
-{
- if ( pData->pPage )
- pData->pPage->Show();
-}
-
-
-void SvxHpLinkDlg::HidePageImpl ( IconChoicePageData const * pData )
-{
- if ( pData->pPage )
- pData->pPage->Hide();
-}
-
-void SvxHpLinkDlg::ShowPage(HyperLinkPageType nId)
+void SvxHpLinkDlg::ShowPage(const OString& rId)
{
- HyperLinkPageType nOldPageId = GetCurPageId();
- bool bInvalidate = nOldPageId != nId;
+ OString sOldPageId = GetCurPageId();
+ bool bInvalidate = sOldPageId != rId;
if (bInvalidate)
{
- IconChoicePageData* pOldData = GetPageData(nOldPageId);
- if (pOldData && pOldData->pPage)
+ IconChoicePageData* pOldData = GetPageData(sOldPageId);
+ if (pOldData && pOldData->xPage)
{
DeActivatePageImpl();
- HidePageImpl(pOldData);
}
-
- Invalidate();
}
- SetCurPageId(nId);
+ SetCurPageId(rId);
ActivatePageImpl();
- IconChoicePageData* pNewData = GetPageData(nId);
- if (pNewData && pNewData->pPage)
- ShowPageImpl(pNewData);
}
/**********************************************************************
@@ -212,17 +110,11 @@ void SvxHpLinkDlg::ShowPage(HyperLinkPageType nId)
| select a page
|
\**********************************************************************/
-IMPL_LINK_NOARG(SvxHpLinkDlg, ChosePageHdl_Impl, SvtIconChoiceCtrl*, void)
+IMPL_LINK(SvxHpLinkDlg, ChosePageHdl_Impl, const OString&, rId, void)
{
- SvxIconChoiceCtrlEntry *pEntry = m_pIconCtrl->GetSelectedEntry();
- if ( !pEntry )
- pEntry = m_pIconCtrl->GetCursor( );
-
- HyperLinkPageType nId = static_cast<HyperLinkPageType>(reinterpret_cast<sal_uIntPtr>(pEntry->GetUserData()));
-
- if( nId != mnCurrentPageId )
+ if (rId != msCurrentPageId)
{
- ShowPage(nId);
+ ShowPage(rId);
}
}
@@ -231,40 +123,14 @@ IMPL_LINK_NOARG(SvxHpLinkDlg, ChosePageHdl_Impl, SvtIconChoiceCtrl*, void)
| Button-handler
|
\**********************************************************************/
-
-IMPL_LINK_NOARG(SvxHpLinkDlg, OkHdl, Button*, void)
-{
- if ( OK_Impl() )
- {
- Ok();
- Close();
- }
-}
-
-
-IMPL_LINK_NOARG(SvxHpLinkDlg, ApplyHdl, Button*, void)
-{
- if ( OK_Impl() )
- {
- Ok();
- Close();
- }
-}
-
-IMPL_LINK_NOARG(SvxHpLinkDlg, ResetHdl, Button*, void)
+IMPL_LINK_NOARG(SvxHpLinkDlg, ResetHdl, weld::Button&, void)
{
ResetPageImpl ();
- IconChoicePageData* pData = GetPageData ( mnCurrentPageId );
+ IconChoicePageData* pData = GetPageData ( msCurrentPageId );
DBG_ASSERT( pData, "ID not known" );
- pData->pPage->Reset( *pSet );
-}
-
-
-IMPL_LINK_NOARG(SvxHpLinkDlg, CancelHdl, Button*, void)
-{
- Close();
+ pData->xPage->Reset( *pSet );
}
/**********************************************************************
@@ -272,45 +138,36 @@ IMPL_LINK_NOARG(SvxHpLinkDlg, CancelHdl, Button*, void)
| call page
|
\**********************************************************************/
-
-void SvxHpLinkDlg::ActivatePageImpl ()
+void SvxHpLinkDlg::ActivatePageImpl()
{
DBG_ASSERT( !maPageList.empty(), "no Pages registered" );
- IconChoicePageData* pData = GetPageData ( mnCurrentPageId );
+ IconChoicePageData* pData = GetPageData ( msCurrentPageId );
DBG_ASSERT( pData, "ID not known" );
if ( pData )
{
- if ( !pData->pPage )
- {
- pData->pPage = (pData->fnCreatePage)( m_pTabContainer, this, pSet );
- pData->pPage->Reset( *pSet );
- PageCreated( mnCurrentPageId, *pData->pPage );
- }
- else if ( pData->bRefresh )
+ if ( pData->bRefresh )
{
- pData->pPage->Reset( *pSet );
+ pData->xPage->Reset( *pSet );
+ pData->bRefresh = false;
}
- pData->bRefresh = false;
-
if ( pExampleSet )
- pData->pPage->ActivatePage( *pExampleSet );
- SetHelpId( pData->pPage->GetHelpId() );
+ pData->xPage->ActivatePage( *pExampleSet );
+ m_xDialog->set_help_id(pData->xPage->GetHelpId());
}
- m_pResetBtn->Show();
+ m_xResetBtn->show();
}
-
void SvxHpLinkDlg::DeActivatePageImpl ()
{
- IconChoicePageData *pData = GetPageData ( mnCurrentPageId );
+ IconChoicePageData *pData = GetPageData ( msCurrentPageId );
DeactivateRC nRet = DeactivateRC::LeavePage;
if ( pData )
{
- IconChoicePage * pPage = pData->pPage;
+ IconChoicePage * pPage = pData->xPage.get();
if ( !pExampleSet && pPage->HasExchangeSupport() && pSet )
pExampleSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() );
@@ -352,7 +209,7 @@ void SvxHpLinkDlg::DeActivatePageImpl ()
// flag all pages to be newly initialized
for (auto & pObj : maPageList)
{
- if ( pObj->pPage.get() != pPage )
+ if ( pObj->xPage.get() != pPage )
pObj->bRefresh = true;
else
pObj->bRefresh = false;
@@ -364,11 +221,11 @@ void SvxHpLinkDlg::DeActivatePageImpl ()
void SvxHpLinkDlg::ResetPageImpl ()
{
- IconChoicePageData *pData = GetPageData ( mnCurrentPageId );
+ IconChoicePageData *pData = GetPageData ( msCurrentPageId );
DBG_ASSERT( pData, "ID not known" );
- pData->pPage->Reset( *pSet );
+ pData->xPage->Reset( *pSet );
}
/**********************************************************************
@@ -408,38 +265,17 @@ void SvxHpLinkDlg::SetInputSet( const SfxItemSet* pInSet )
}
}
-
-/**********************************************************************
-|
-| start dialog
-|
-\**********************************************************************/
-
-short SvxHpLinkDlg::Execute()
-{
- if ( maPageList.empty() )
- return RET_CANCEL;
-
- Start_Impl();
-
- return Dialog::Execute();
-}
-
-
void SvxHpLinkDlg::Start()
{
- m_pCancelBtn->SetClickHdl( LINK( this, SvxHpLinkDlg, CancelHdl ) );
-
Start_Impl();
}
-
bool SvxHpLinkDlg::QueryClose()
{
bool bRet = true;
for (auto & pData : maPageList)
{
- if ( pData->pPage && !pData->pPage->QueryClose() )
+ if ( pData->xPage && !pData->xPage->QueryClose() )
{
bRet = false;
break;
@@ -450,7 +286,7 @@ bool SvxHpLinkDlg::QueryClose()
void SvxHpLinkDlg::Start_Impl()
{
- FocusOnIcon( mnCurrentPageId );
+ SwitchPage(msCurrentPageId);
ActivatePageImpl();
}
@@ -460,12 +296,12 @@ void SvxHpLinkDlg::Start_Impl()
|
\**********************************************************************/
-IconChoicePageData* SvxHpLinkDlg::GetPageData ( HyperLinkPageType nId )
+IconChoicePageData* SvxHpLinkDlg::GetPageData ( const OString& rId )
{
IconChoicePageData *pRet = nullptr;
for (auto & pData : maPageList)
{
- if ( pData->nId == nId )
+ if ( pData->sId == rId )
{
pRet = pData.get();
break;
@@ -482,7 +318,7 @@ IconChoicePageData* SvxHpLinkDlg::GetPageData ( HyperLinkPageType nId )
bool SvxHpLinkDlg::OK_Impl()
{
- IconChoicePage* pPage = GetPageData ( mnCurrentPageId )->pPage;
+ IconChoicePage* pPage = GetPageData ( msCurrentPageId )->xPage.get();
bool bEnd = !pPage;
if ( pPage )
@@ -523,9 +359,9 @@ void SvxHpLinkDlg::Ok()
for ( size_t i = 0, nCount = maPageList.size(); i < nCount; ++i )
{
- IconChoicePageData* pData = GetPageData ( maPageList[i]->nId );
+ IconChoicePageData* pData = GetPageData ( maPageList[i]->sId );
- IconChoicePage* pPage = pData->pPage;
+ IconChoicePage* pPage = pData->xPage.get();
if ( pPage )
{
@@ -544,21 +380,9 @@ void SvxHpLinkDlg::Ok()
}
}
-void SvxHpLinkDlg::FocusOnIcon( HyperLinkPageType nId )
+void SvxHpLinkDlg::SwitchPage( const OString& rId )
{
- // set focus to icon for the current visible page
- for ( sal_Int32 i=0; i<m_pIconCtrl->GetEntryCount(); i++)
- {
- SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry ( i );
- HyperLinkPageType nUserData = static_cast<HyperLinkPageType>(reinterpret_cast<sal_uIntPtr>(pEntry->GetUserData()));
-
- if ( nUserData == nId )
- {
- m_pIconCtrl->SetCursor( pEntry );
- break;
- }
- }
+ m_xIconCtrl->set_current_page(rId);
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx
index 4ad9e49084fe..e27ce6891b0d 100644
--- a/cui/source/factory/dlgfact.cxx
+++ b/cui/source/factory/dlgfact.cxx
@@ -234,7 +234,10 @@ short AbstractSvxPathSelectDialog_Impl::Execute()
return m_xDlg->run();
}
-IMPL_ABSTDLG_BASE(AbstractSvxHpLinkDlg_Impl);
+short AbstractSvxHpLinkDlg_Impl::Execute()
+{
+ return m_xDlg->run();
+}
short AbstractFmSearchDialog_Impl::Execute()
{
@@ -783,14 +786,14 @@ void AbstractSvxPathSelectDialog_Impl::SetTitle( const OUString& rNewTitle )
m_xDlg->SetTitle(rNewTitle);
}
-vcl::Window * AbstractSvxHpLinkDlg_Impl::GetWindow()
+std::shared_ptr<SfxDialogController> AbstractSvxHpLinkDlg_Impl::GetController()
{
- return static_cast<vcl::Window *>(pDlg);
+ return m_xDlg;
}
bool AbstractSvxHpLinkDlg_Impl::QueryClose()
{
- return pDlg->QueryClose();
+ return m_xDlg->QueryClose();
}
void AbstractFmSearchDialog_Impl::SetFoundHandler(const Link<FmFoundRecordInformation&,void>& lnk)
@@ -1231,11 +1234,9 @@ VclPtr<AbstractSvxMultiPathDialog> AbstractDialogFactory_Impl::CreateSvxPathSele
return VclPtr<AbstractSvxPathSelectDialog_Impl>::Create(std::make_unique<SvxPathSelectDialog>(pParent));
}
-VclPtr<AbstractSvxHpLinkDlg> AbstractDialogFactory_Impl::CreateSvxHpLinkDlg (vcl::Window* pParent,
- SfxBindings* pBindings)
+VclPtr<AbstractSvxHpLinkDlg> AbstractDialogFactory_Impl::CreateSvxHpLinkDlg(SfxChildWindow* pChild, SfxBindings* pBindings, weld::Window* pParent)
{
- VclPtrInstance<SvxHpLinkDlg> pDlg( pParent, pBindings );
- return VclPtr<AbstractSvxHpLinkDlg_Impl>::Create(pDlg);
+ return VclPtr<AbstractSvxHpLinkDlg_Impl>::Create(std::make_unique<SvxHpLinkDlg>(pBindings, pChild, pParent));
}
VclPtr<AbstractFmSearchDialog> AbstractDialogFactory_Impl::CreateFmSearchDialog(weld::Window* pParent,
diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx
index 2f83409d2644..94bb772fecbe 100644
--- a/cui/source/factory/dlgfact.hxx
+++ b/cui/source/factory/dlgfact.hxx
@@ -26,9 +26,7 @@
#include <tools/link.hxx>
#include <com/sun/star/frame/XFrame.hpp>
-class SfxModalDialog;
class SfxSingleTabDialogController;
-class Dialog;
class SfxItemPool;
class FmShowColsDialog;
class SvxZoomDialog;
@@ -487,10 +485,17 @@ public:
};
class SvxHpLinkDlg;
-class AbstractSvxHpLinkDlg_Impl :public AbstractSvxHpLinkDlg
+class AbstractSvxHpLinkDlg_Impl : public AbstractSvxHpLinkDlg
{
- DECL_ABSTDLG_BASE(AbstractSvxHpLinkDlg_Impl,SvxHpLinkDlg)
- virtual vcl::Window* GetWindow() override;
+protected:
+ std::shared_ptr<SvxHpLinkDlg> m_xDlg;
+public:
+ explicit AbstractSvxHpLinkDlg_Impl(std::unique_ptr<SvxHpLinkDlg> p)
+ : m_xDlg(std::move(p))
+ {
+ }
+ virtual short Execute() override;
+ virtual std::shared_ptr<SfxDialogController> GetController() override;
virtual bool QueryClose() override;
};
@@ -793,8 +798,8 @@ public:
virtual VclPtr<AbstractSvxObjectTitleDescDialog> CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription) override;
virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxMultiPathDialog(weld::Window* pParent) override;
virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxPathSelectDialog(weld::Window* pParent) override;
- virtual VclPtr<AbstractSvxHpLinkDlg> CreateSvxHpLinkDlg(vcl::Window* pParent, SfxBindings* pBindings) override;
- virtual VclPtr<AbstractFmSearchDialog> CreateFmSearchDialog(weld::Window* pParent,
+ virtual VclPtr<AbstractSvxHpLinkDlg> CreateSvxHpLinkDlg(SfxChildWindow* pChild, SfxBindings* pBindings, weld::Window* pParent) override;
+ virtual VclPtr<AbstractFmSearchDialog> CreateFmSearchDialog(weld::Window* pParent,
const OUString& strInitialText,
const std::vector< OUString >& _rContexts,
sal_Int16 nInitialContext,
diff --git a/cui/source/inc/cuihyperdlg.hxx b/cui/source/inc/cuihyperdlg.hxx
index ce799fc7f2ab..4f8d4c1c07f3 100644
--- a/cui/source/inc/cuihyperdlg.hxx
+++ b/cui/source/inc/cuihyperdlg.hxx
@@ -52,7 +52,7 @@ class SvxHpLinkDlg;
class SvxHlinkCtrl : public SfxControllerItem
{
private:
- VclPtr<SvxHpLinkDlg> pParent;
+ SvxHpLinkDlg* pParent;
SfxStatusForwarder aRdOnlyForwarder;
@@ -71,59 +71,47 @@ public:
|*
\************************************************************************/
-class SvxHpLinkDlg : public SfxModalDialog
+class SvxHpLinkDlg : public SfxModelessDialogController
{
private:
friend class IconChoicePage;
std::vector< std::unique_ptr<IconChoicePageData> > maPageList;
- VclPtr<SvtIconChoiceCtrl> m_pIconCtrl;
+ OString msCurrentPageId;
- HyperLinkPageType mnCurrentPageId;
-
- // Buttons
- VclPtr<OKButton> m_pOKBtn;
- VclPtr<PushButton> m_pApplyBtn;
- VclPtr<CancelButton> m_pCancelBtn;
- VclPtr<HelpButton> m_pHelpBtn;
- VclPtr<PushButton> m_pResetBtn;
-
- VclPtr<VclVBox> m_pTabContainer;
const SfxItemSet* pSet;
std::unique_ptr<SfxItemSet> pOutSet;
SfxItemSet* pExampleSet;
std::unique_ptr<sal_uInt16[]> pRanges;
- DECL_LINK( ChosePageHdl_Impl, SvtIconChoiceCtrl*, void );
- DECL_LINK( OkHdl, Button*, void );
- DECL_LINK( ApplyHdl, Button*, void) ;
- DECL_LINK( ResetHdl, Button*, void) ;
- DECL_LINK( CancelHdl, Button*, void );
-
- IconChoicePageData* GetPageData ( HyperLinkPageType nId );
- void Start_Impl();
- bool OK_Impl();
-
- void FocusOnIcon ( HyperLinkPageType nId );
-
-
SvxHlinkCtrl maCtrl; ///< Controller
- SfxBindings* mpBindings;
std::unique_ptr<SfxItemSet> mpItemSet;
bool mbGrabFocus : 1;
bool mbIsHTMLDoc : 1;
- DECL_LINK (ClickOkHdl_Impl, Button *, void );
- DECL_LINK (ClickApplyHdl_Impl, Button *, void );
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list