diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-06-23 19:51:15 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-06-25 13:36:53 +0200 |
commit | 1942182a3d1817bc539229d7fda3af69f7e295b8 (patch) | |
tree | 1c7291efb486d4789c580671ef0ea2133251c92c | |
parent | 2f00a7c61fff9c091f08b6aaa4f829cd34fb3745 (diff) |
weld HyperLink Dialog
Change-Id: Ic861b0a593505828a900fe2163125d6f5584a956
Reviewed-on: https://gerrit.libreoffice.org/74634
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
41 files changed, 1431 insertions, 1180 deletions
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 ); - DECL_LINK (ClickCloseHdl_Impl, Button *, void ); + std::unique_ptr<weld::Notebook> m_xIconCtrl; + std::unique_ptr<weld::Button> m_xOKBtn; + std::unique_ptr<weld::Button> m_xApplyBtn; + std::unique_ptr<weld::Button> m_xCancelBtn; + std::unique_ptr<weld::Button> m_xHelpBtn; + std::unique_ptr<weld::Button> m_xResetBtn; - static void ShowPageImpl ( IconChoicePageData const * pData ); - static void HidePageImpl ( IconChoicePageData const * pData ); + DECL_LINK( ChosePageHdl_Impl, const OString&, void ); - IconChoicePage* GetTabPage( HyperLinkPageType nPageId ) - { return ( GetPageData (nPageId)->pPage ? GetPageData (nPageId)->pPage.get() : nullptr); } + IconChoicePageData* GetPageData ( const OString& rId ); + void Start_Impl(); + bool OK_Impl(); + + void SwitchPage( const OString& rId ); + + DECL_LINK( ResetHdl, weld::Button&, void) ; + DECL_LINK (ClickOkHdl_Impl, weld::Button&, void ); + DECL_LINK (ClickApplyHdl_Impl, weld::Button&, void ); + + IconChoicePage* GetTabPage( const OString& rPageId ) + { return GetPageData(rPageId)->xPage.get(); } void ActivatePageImpl (); void DeActivatePageImpl (); @@ -131,45 +119,38 @@ private: void Ok(); - virtual bool Close() override; - virtual void Move() override; + virtual void Close() override; void Apply(); public: - SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings ); + SvxHpLinkDlg(SfxBindings* pBindings, SfxChildWindow* pChild, weld::Window* pParent); virtual ~SvxHpLinkDlg () override; - virtual void dispose() override; // interface - SvxIconChoiceCtrlEntry* AddTabPage( - HyperLinkPageType nId, const OUString& rIconText, const Image& rChoiceIcon, - CreatePage pCreateFunc /* != NULL */ ); + void AddTabPage(const OString &rId, CreatePage pCreateFunc /* != NULL */); - void SetCurPageId( HyperLinkPageType nId ) { mnCurrentPageId = nId; FocusOnIcon( nId ); } - HyperLinkPageType GetCurPageId() const { return mnCurrentPageId; } - void ShowPage( HyperLinkPageType nId ); + void SetCurPageId( const OString& rId ) { msCurrentPageId = rId; SwitchPage(rId ); } + OString GetCurPageId() const { return msCurrentPageId; } + void ShowPage( const OString& rId ); /// gives via map converted local slots if applicable const sal_uInt16* GetInputRanges( const SfxItemPool& ); void SetInputSet( const SfxItemSet* pInSet ); - OKButton& GetOKButton() { return *m_pOKBtn; } - PushButton& GetApplyButton() { return *m_pApplyBtn; } - CancelButton& GetCancelButton() { return *m_pCancelBtn; } + weld::Button& GetOKButton() { return *m_xOKBtn; } + weld::Button& GetApplyButton() { return *m_xApplyBtn; } + weld::Button& GetCancelButton() { return *m_xCancelBtn; } - short Execute() override; void Start(); bool QueryClose(); - void SetCtrlStyle(); - - void PageCreated( HyperLinkPageType nId, IconChoicePage& rPage ); + void PageCreated(const OString& rId, IconChoicePage& rPage); void SetPage( SvxHyperlinkItem const * pItem ); void SetReadOnlyMode( bool bReadOnly ); - bool IsHTMLDoc() const { return mbIsHTMLDoc; } + bool IsHTMLDoc() const { return mbIsHTMLDoc; } - SfxDispatcher* GetDispatcher() const { return mpBindings->GetDispatcher(); } + SfxDispatcher* GetDispatcher() const { return GetBindings().GetDispatcher(); } }; diff --git a/cui/source/inc/hldocntp.hxx b/cui/source/inc/hldocntp.hxx index 933677028e67..719968853643 100644 --- a/cui/source/inc/hldocntp.hxx +++ b/cui/source/inc/hldocntp.hxx @@ -26,20 +26,19 @@ |* Tabpage : Hyperlink - New Document |* \************************************************************************/ - class SvxHyperlinkNewDocTp : public SvxHyperlinkTabPageBase { private: - VclPtr<RadioButton> m_pRbtEditNow; - VclPtr<RadioButton> m_pRbtEditLater; - VclPtr<SvxHyperURLBox> m_pCbbPath; - VclPtr<PushButton> m_pBtCreate; - VclPtr<ListBox> m_pLbDocTypes; + std::unique_ptr<weld::RadioButton> m_xRbtEditNow; + std::unique_ptr<weld::RadioButton> m_xRbtEditLater; + std::unique_ptr<SvxHyperURLBox> m_xCbbPath; + std::unique_ptr<weld::Button> m_xBtCreate; + std::unique_ptr<weld::TreeView> m_xLbDocTypes; bool ImplGetURLObject( const OUString& rPath, const OUString& rBase, INetURLObject& aURLObject ) const; void FillDocumentList (); - DECL_LINK (ClickNewHdl_Impl, Button*, void ); + DECL_LINK (ClickNewHdl_Impl, weld::Button&, void ); DECL_STATIC_LINK(SvxHyperlinkNewDocTp, DispatchDocument, void*, void); protected: @@ -49,11 +48,10 @@ protected: SvxLinkInsertMode& eMode ) override; public: - SvxHyperlinkNewDocTp ( vcl::Window *pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); + SvxHyperlinkNewDocTp(weld::Container* pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); virtual ~SvxHyperlinkNewDocTp () override; - virtual void dispose() override; - static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet ); + static std::unique_ptr<IconChoicePage> Create(weld::Container* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); virtual bool AskApply () override; virtual void DoApply () override; @@ -61,7 +59,6 @@ public: virtual void SetInitFocus() override; }; - #endif // INCLUDED_CUI_SOURCE_INC_HLDOCNTP_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/hldoctp.hxx b/cui/source/inc/hldoctp.hxx index 25a6e0d23d5d..53f302204bf0 100644 --- a/cui/source/inc/hldoctp.hxx +++ b/cui/source/inc/hldoctp.hxx @@ -26,28 +26,26 @@ |* Tabpage : Hyperlink - Document |* \************************************************************************/ - class SvxHyperlinkDocTp final : public SvxHyperlinkTabPageBase { private: - VclPtr<SvxHyperURLBox> m_pCbbPath; - VclPtr<PushButton> m_pBtFileopen; - - VclPtr<Edit> m_pEdTarget; - VclPtr<FixedText> m_pFtFullURL; - VclPtr<PushButton> m_pBtBrowse; + std::unique_ptr<SvxHyperURLBox> m_xCbbPath; + std::unique_ptr<weld::Button> m_xBtFileopen; + std::unique_ptr<weld::Entry> m_xEdTarget; + std::unique_ptr<weld::Label> m_xFtFullURL; + std::unique_ptr<weld::Button> m_xBtBrowse; OUString maStrURL; - bool mbMarkWndOpen; + bool m_bMarkWndOpen; - DECL_LINK (ClickFileopenHdl_Impl, Button*, void ); - DECL_LINK (ClickTargetHdl_Impl , Button*, void ); + DECL_LINK (ClickFileopenHdl_Impl, weld::Button&, void ); + DECL_LINK (ClickTargetHdl_Impl, weld::Button&, void ); - DECL_LINK (ModifiedPathHdl_Impl , Edit&, void ); ///< Contents of combobox "Path" modified - DECL_LINK (ModifiedTargetHdl_Impl, Edit&, void ); ///< Contents of editfield "Target" modified + DECL_LINK (ModifiedPathHdl_Impl, weld::ComboBox&, void ); ///< Contents of combobox "Path" modified + DECL_LINK (ModifiedTargetHdl_Impl, weld::Entry&, void ); ///< Contents of editfield "Target" modified - DECL_LINK( LostFocusPathHdl_Impl, Control&, void ); ///< Combobox "path" lost its focus + DECL_LINK( LostFocusPathHdl_Impl, weld::Widget&, void ); ///< Combobox "path" lost its focus DECL_LINK( TimeoutHdl_Impl, Timer *, void ); ///< Handler for timer -timeout @@ -58,23 +56,21 @@ private: void GetCurentItemData ( OUString& rStrURL, OUString& aStrName, OUString& aStrIntName, OUString& aStrFrame, SvxLinkInsertMode& eMode ) override; - virtual bool ShouldOpenMarkWnd () override {return mbMarkWndOpen;} - virtual void SetMarkWndShouldOpen (bool bOpen) override {mbMarkWndOpen=bOpen;} + virtual bool ShouldOpenMarkWnd () override {return m_bMarkWndOpen;} + virtual void SetMarkWndShouldOpen (bool bOpen) override {m_bMarkWndOpen=bOpen;} OUString GetCurrentURL (); public: - SvxHyperlinkDocTp ( vcl::Window *pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); + SvxHyperlinkDocTp(weld::Container* pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); virtual ~SvxHyperlinkDocTp() override; - virtual void dispose() override; - static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet ); + static std::unique_ptr<IconChoicePage> Create(weld::Container* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); virtual void SetMarkStr ( const OUString& aStrMark ) override; virtual void SetInitFocus() override; }; - #endif // INCLUDED_CUI_SOURCE_INC_HLDOCTP_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cui/source/inc/hlinettp.hxx b/cui/source/inc/hlinettp.hxx index eabd11b1938d..30fb8f8d230a 100644 --- a/cui/source/inc/hlinettp.hxx +++ b/cui/source/inc/hlinettp.hxx @@ -32,25 +32,25 @@ class SvxHyperlinkInternetTp : public SvxHyperlinkTabPageBase { private: - VclPtr<RadioButton > m_pRbtLinktypInternet; - VclPtr<RadioButton> m_pRbtLinktypFTP; - VclPtr<SvxHyperURLBox> m_pCbbTarget; - VclPtr<FixedText> m_pFtLogin; - VclPtr<Edit> m_pEdLogin; - VclPtr<FixedText> m_pFtPassword; - VclPtr<Edit> m_pEdPassword; - VclPtr<CheckBox> m_pCbAnonymous; - OUString maStrOldUser; OUString maStrOldPassword; - bool mbMarkWndOpen; + bool m_bMarkWndOpen; + + std::unique_ptr<weld::RadioButton> m_xRbtLinktypInternet; + std::unique_ptr<weld::RadioButton> m_xRbtLinktypFTP; + std::unique_ptr<SvxHyperURLBox> m_xCbbTarget; + std::unique_ptr<weld::Label> m_xFtLogin; + std::unique_ptr<weld::Entry> m_xEdLogin; + std::unique_ptr<weld::Label> m_xFtPassword; + std::unique_ptr<weld::Entry> m_xEdPassword; + std::unique_ptr<weld::CheckButton> m_xCbAnonymous; - DECL_LINK( Click_SmartProtocol_Impl , Button*, void ); ///< Radiobutton clicked: Type HTTP or FTP - DECL_LINK( ClickAnonymousHdl_Impl , Button*, void ); ///< Checkbox : Anonymous User - DECL_LINK( ModifiedLoginHdl_Impl , Edit&, void ); ///< Contents of editfield "Login" modified - DECL_LINK( LostFocusTargetHdl_Impl, Control&, void ); ///< Combobox "Target" lost its focus - DECL_LINK( ModifiedTargetHdl_Impl , Edit&, void ); ///< Contents of editfield "Target" modified + DECL_LINK( Click_SmartProtocol_Impl, weld::Button&, void ); ///< Radiobutton clicked: Type HTTP or FTP + DECL_LINK( ClickAnonymousHdl_Impl, weld::Button&, void ); ///< Checkbox : Anonymous User + DECL_LINK( ModifiedLoginHdl_Impl, weld::Entry&, void ); ///< Contents of editfield "Login" modified + DECL_LINK( LostFocusTargetHdl_Impl, weld::Widget&, void ); ///< Combobox "Target" lost its focus + DECL_LINK( ModifiedTargetHdl_Impl, weld::ComboBox&, void ); ///< Contents of editfield "Target" modified DECL_LINK( TimeoutHdl_Impl, Timer *, void); ///< Handler for timer -timeout @@ -71,15 +71,14 @@ protected: virtual void GetCurentItemData ( OUString& rStrURL, OUString& aStrName, OUString& aStrIntName, OUString& aStrFrame, SvxLinkInsertMode& eMode ) override; - virtual bool ShouldOpenMarkWnd () override {return ( mbMarkWndOpen && m_pRbtLinktypInternet->IsChecked() );} - virtual void SetMarkWndShouldOpen (bool bOpen) override {mbMarkWndOpen=bOpen;} + virtual bool ShouldOpenMarkWnd () override {return ( m_bMarkWndOpen && m_xRbtLinktypInternet->get_active() );} + virtual void SetMarkWndShouldOpen (bool bOpen) override {m_bMarkWndOpen=bOpen;} public: - SvxHyperlinkInternetTp ( vcl::Window *pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); + SvxHyperlinkInternetTp(weld::Container* pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); virtual ~SvxHyperlinkInternetTp() override; - virtual void dispose() override; - static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet ); + static std::unique_ptr<IconChoicePage> Create(weld::Container* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); virtual void SetMarkStr ( const OUString& aStrMark ) override; diff --git a/cui/source/inc/hlmailtp.hxx b/cui/source/inc/hlmailtp.hxx index ebadf85f3b84..c137a3cf1cfa 100644 --- a/cui/source/inc/hlmailtp.hxx +++ b/cui/source/inc/hlmailtp.hxx @@ -30,14 +30,14 @@ class SvxHyperlinkMailTp : public SvxHyperlinkTabPageBase { private: - VclPtr<SvxHyperURLBox> m_pCbbReceiver; - VclPtr<PushButton> m_pBtAdrBook; - VclPtr<FixedText> m_pFtSubject; - VclPtr<Edit> m_pEdSubject; + std::unique_ptr<SvxHyperURLBox> m_xCbbReceiver; + std::unique_ptr<weld::Button> m_xBtAdrBook; + std::unique_ptr<weld::Label> m_xFtSubject; + std::unique_ptr<weld::Entry> m_xEdSubject; - DECL_STATIC_LINK(SvxHyperlinkMailTp, ClickAdrBookHdl_Impl, Button*, void); + DECL_STATIC_LINK(SvxHyperlinkMailTp, ClickAdrBookHdl_Impl, weld::Button&, void); ///< Button : Address book - DECL_LINK (ModifiedReceiverHdl_Impl, Edit&, void ); ///< Combobox "receiver" modified + DECL_LINK (ModifiedReceiverHdl_Impl, weld::ComboBox&, void ); ///< Combobox "receiver" modified void SetScheme(const OUString& rScheme); void RemoveImproperProtocol(const OUString& aProperScheme); @@ -51,11 +51,10 @@ protected: SvxLinkInsertMode& eMode ) override; public: - SvxHyperlinkMailTp ( vcl::Window *pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); + SvxHyperlinkMailTp(weld::Container* pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); virtual ~SvxHyperlinkMailTp() override; - virtual void dispose() override; - static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet ); + static std::unique_ptr<IconChoicePage> Create(weld::Container* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); virtual void SetInitFocus() override; }; diff --git a/cui/source/inc/hlmarkwn.hxx b/cui/source/inc/hlmarkwn.hxx index c24c093a1d72..3932e05ac3d8 100644 --- a/cui/source/inc/hlmarkwn.hxx +++ b/cui/source/inc/hlmarkwn.hxx @@ -34,7 +34,7 @@ class SvxHlinkDlgMarkWnd : public weld::GenericDialogController private: friend class SvxHlmarkTreeLBox; - VclPtr<SvxHyperlinkTabPageBase> mpParent; + SvxHyperlinkTabPageBase* mpParent; sal_uInt16 mnError; diff --git a/cui/source/inc/hltpbase.hxx b/cui/source/inc/hltpbase.hxx index 1bc51f7d77bd..fae49a54baf6 100644 --- a/cui/source/inc/hltpbase.hxx +++ b/cui/source/inc/hltpbase.hxx @@ -21,11 +21,6 @@ #include <sfx2/app.hxx> #include <sfx2/tabdlg.hxx> -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/combobox.hxx> -#include <vcl/edit.hxx> -#include <vcl/lstbox.hxx> #include <svl/stritem.hxx> #include <svl/eitem.hxx> #include <vcl/transfer.hxx> @@ -33,6 +28,7 @@ #include <sfx2/fcontnr.hxx> #include <svtools/inettbc.hxx> #include <vcl/timer.hxx> +#include <vcl/waitobj.hxx> #include <sfx2/docfile.hxx> #include <com/sun/star/frame/XFrame.hpp> @@ -42,26 +38,27 @@ #include "iconcdlg.hxx" /// ComboBox-Control for URL's with History and Autocompletion -class SvxHyperURLBox : public SvtURLBox, public DropTargetHelper +class SvxHyperURLBox : public URLBox, public DropTargetHelper { protected: virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; public: - SvxHyperURLBox( vcl::Window* pParent, INetProtocol eSmart ); - + SvxHyperURLBox(std::unique_ptr<weld::ComboBox> xWidget); }; /// Tabpage : Basisclass class SvxHyperlinkTabPageBase : public IconChoicePage { private: - VclPtr<ComboBox> mpCbbFrame; - VclPtr<ListBox> mpLbForm; - VclPtr<Edit> mpEdIndication; - VclPtr<Edit> mpEdText; - VclPtr<PushButton> mpBtScript; + std::unique_ptr<weld::ComboBox> mxCbbFrame; + std::unique_ptr<weld::ComboBox> mxLbForm; + std::unique_ptr<weld::Entry> mxEdIndication; + std::unique_ptr<weld::Entry> mxEdText; + std::unique_ptr<weld::Button> mxBtScript; + std::unique_ptr<weld::Label> mxFormLabel; + std::unique_ptr<weld::Label> mxFrameLabel; bool mbIsCloseDisabled; @@ -69,7 +66,7 @@ private: mxDocumentFrame; protected: - VclPtr<vcl::Window> mpDialog; + SvxHpLinkDlg* mpDialog; bool mbStdControlsInit; @@ -77,6 +74,8 @@ protected: Timer maTimer; + TopLevelWindowLocker maBusy; + std::shared_ptr<SvxHlinkDlgMarkWnd> mxMarkWnd; void InitStdControls (); @@ -90,22 +89,21 @@ protected: OUString& aStrIntName, OUString& aStrFrame, SvxLinkInsertMode& eMode ); - DECL_LINK (ClickScriptHdl_Impl, Button*, void ); ///< Button : Script + DECL_LINK (ClickScriptHdl_Impl, weld::Button&, void ); ///< Button : Script static OUString GetSchemeFromURL( const OUString& rStrURL ); - void DisableClose( bool _bDisable ) { mbIsCloseDisabled = _bDisable; } + void DisableClose( bool _bDisable ); public: SvxHyperlinkTabPageBase ( - vcl::Window *pParent, + weld::Container* pParent, SvxHpLinkDlg* pDlg, - const OString& rID, const OUString& rUIXMLDescription, + const OString& rID, const SfxItemSet* pItemSet ); virtual ~SvxHyperlinkTabPageBase () override; - virtual void dispose() override; void SetDocumentFrame( const css::uno::Reference< css::frame::XFrame >& rxDocumentFrame ) @@ -126,8 +124,6 @@ public: Size GetSizeExtraWnd() { return mxMarkWnd->getDialog()->get_size(); } void MoveToExtraWnd ( Point aNewPos ); - using TabPage::ActivatePage; - using TabPage::DeactivatePage; virtual bool QueryClose() override; protected: diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx index c403bb1358e2..a5db9706917e 100644 --- a/cui/source/inc/iconcdlg.hxx +++ b/cui/source/inc/iconcdlg.hxx @@ -39,27 +39,29 @@ class SfxItemSet; enum class HyperLinkPageType; // Create-Function -typedef VclPtr<IconChoicePage> (*CreatePage)(vcl::Window *pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pAttrSet); +typedef std::unique_ptr<IconChoicePage> (*CreatePage)(weld::Container* pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pAttrSet); /// Data-structure for pages in dialog struct IconChoicePageData { - HyperLinkPageType nId; - CreatePage fnCreatePage; ///< pointer to the factory - VclPtr<IconChoicePage> pPage; ///< the TabPage itself + OString sId; + std::unique_ptr<IconChoicePage> xPage; ///< the TabPage itself bool bRefresh; ///< Flag: page has to be newly initialized // constructor - IconChoicePageData( HyperLinkPageType Id, CreatePage fnPage ) - : nId ( Id ), - fnCreatePage ( fnPage ), - pPage ( nullptr ), - bRefresh ( false ) + IconChoicePageData(const OString& rId, std::unique_ptr<IconChoicePage> xInPage) + : sId(rId) + , xPage(std::move(xInPage)) + , bRefresh(false) {} }; -class IconChoicePage : public TabPage +class IconChoicePage { +protected: + std::unique_ptr<weld::Builder> xBuilder; + std::unique_ptr<weld::Container> xContainer; + private: const SfxItemSet* pSet; bool bHasExchangeSupport; @@ -67,13 +69,13 @@ private: void ImplInitSettings(); protected: - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - IconChoicePage( vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription, const SfxItemSet* pItemSet ); + IconChoicePage(weld::Container* pParent, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet* pItemSet); public: - virtual ~IconChoicePage() override; + virtual ~IconChoicePage(); + + OString GetHelpId() const { return xContainer->get_help_id(); } const SfxItemSet& GetItemSet() const { return *pSet; } @@ -86,9 +88,6 @@ public: virtual void ActivatePage( const SfxItemSet& ); virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ); virtual bool QueryClose(); - - void StateChanged( StateChangedType nType ) override; - void DataChanged( const DataChangedEvent& rDCEvt ) override; }; #endif // INCLUDED_CUI_SOURCE_INC_ICONCDLG_HXX diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index 20028e16456b..c47a0bcc66d1 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -19,7 +19,6 @@ #include <i18nutil/unicode.hxx> #include <vcl/event.hxx> -#include <vcl/field.hxx> #include <vcl/keycodes.hxx> #include <vcl/settings.hxx> #include <sot/exchange.hxx> diff --git a/cui/uiconfig/ui/hyperlinkdialog.ui b/cui/uiconfig/ui/hyperlinkdialog.ui index de96c8d7e60c..59c1afa2af9b 100644 --- a/cui/uiconfig/ui/hyperlinkdialog.ui +++ b/cui/uiconfig/ui/hyperlinkdialog.ui @@ -1,15 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkDialog" id="HyperlinkDialog"> <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="hyperlinkdialog|HyperlinkDialog">Hyperlink</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> @@ -22,14 +26,11 @@ <property name="can_focus">False</property> <property name="layout_style">end</property> <child> - <object class="GtkButton" id="ok"> - <property name="label">gtk-ok</property> + <object class="GtkButton" id="reset"> + <property name="label" translatable="yes" context="hyperlinkdialog|reset">Reset</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> <property name="receives_default">True</property> - <property name="use_stock">True</property> </object> <packing> <property name="expand">False</property> @@ -51,10 +52,12 @@ </packing> </child> <child> - <object class="GtkButton" id="cancel"> - <property name="label">gtk-cancel</property> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -65,8 +68,8 @@ </packing> </child> <child> - <object class="GtkButton" id="help"> - <property name="label">gtk-help</property> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -76,20 +79,21 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">3</property> - <property name="secondary">True</property> </packing> </child> <child> - <object class="GtkButton" id="reset"> - <property name="label" translatable="yes" context="hyperlinkdialog|reset">Reset</property> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="use_stock">True</property> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> <property name="position">4</property> + <property name="secondary">True</property> </packing> </child> </object> @@ -101,43 +105,300 @@ </packing> </child> <child> - <object class="GtkBox" id="box1"> + <object class="GtkNotebook" id="icon_control"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="spacing">6</property> + <property name="tab_pos">left</property> <child> - <object class="cuilo-SvtIconChoiceCtrl" id="icon_control"> - <property name="width_request">110</property> - <property name="height_request">400</property> + <object class="GtkGrid"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="vexpand">True</property> + <property name="can_focus">False</property> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + </child> + <child type="tab"> + <object class="GtkBox" id="internet"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkImage"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes" context="hyperlinkdialog|RID_SVXSTR_HYPERDLG_HLINETTP_HELP">This is where you create a hyperlink to a Web page or FTP server connection.</property> + <property name="icon_name">res/hlinettp.png</property> + <property name="icon_size">6</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="RID_SVXSTR_HYPERDLG_HLINETTP"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="hyperlinkdialog|RID_SVXSTR_HYPERDLG_HLINETTP">Internet</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> + <property name="tab_fill">False</property> </packing> </child> <child> - <object class="GtkBox" id="tab"> + <object class="GtkGrid"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="orientation">vertical</property> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> <child> <placeholder/> </child> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> <property name="position">1</property> </packing> </child> + <child type="tab"> + <object class="GtkBox" id="mail"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkImage"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes" context="hyperlinkdialog|RID_SVXSTR_HYPERDLG_HLMAILTP_HELP">This is where you create a hyperlink to an email address.</property> + <property name="icon_name">res/hlmailtp.png</property> + <property name="icon_size">6</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="RID_SVXSTR_HYPERDLG_HLMAILTP"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="hyperlinkdialog|RID_SVXSTR_HYPERDLG_HLMAILTP">Mail</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="position">1</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="position">2</property> + </packing> + </child> + <child type="tab"> + <object class="GtkBox" id="document"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkImage"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes" context="hyperlinkdialog|RID_SVXSTR_HYPERDLG_HLDOCTP_HELP">This is where you create a hyperlink to an existing document or a target within a document.</property> + <property name="icon_name">res/hldoctp.png</property> + <property name="icon_size">6</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="RID_SVXSTR_HYPERDLG_HLDOCTP"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="hyperlinkdialog|RID_SVXSTR_HYPERDLG_HLDOCTP">Document</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="position">2</property> + <property name="tab_fill">False</property> + </packing> + </child> + <child> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="position">3</property> + </packing> + </child> + <child type="tab"> + <object class="GtkBox" id="newdocument"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkImage"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_text" translatable="yes" context="hyperlinkdialog|RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP">This is where you create a new document to which the new link points.</property> + <property name="icon_name">res/hldocntp.png</property> + <property name="icon_size">6</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="RID_SVXSTR_HYPERDLG_HLDOCNTP"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="hyperlinkdialog|RID_SVXSTR_HYPERDLG_HLDOCNTP">New Document</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="position">3</property> + <property name="tab_fill">False</property> + </packing> + </child> </object> <packing> <property name="expand">True</property> @@ -148,11 +409,11 @@ </object> </child> <action-widgets> - <action-widget response="-5">ok</action-widget> + <action-widget response="101">reset</action-widget> <action-widget response="102">apply</action-widget> + <action-widget response="-5">ok</action-widget> <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> - <action-widget response="101">reset</action-widget> </action-widgets> </object> </interface> diff --git a/cui/uiconfig/ui/hyperlinkdocpage.ui b/cui/uiconfig/ui/hyperlinkdocpage.ui index 894e9e238ae9..45d8af5cd189 100644 --- a/cui/uiconfig/ui/hyperlinkdocpage.ui +++ b/cui/uiconfig/ui/hyperlinkdocpage.ui @@ -1,13 +1,23 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">res/target.png</property> + </object> + <object class="GtkImage" id="image2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">res/fileopen.png</property> + </object> <object class="GtkBox" id="HyperlinkDocPage"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> + <property name="border_width">6</property> <property name="orientation">vertical</property> <property name="spacing">24</property> <child> @@ -35,10 +45,10 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hyperlinkdocpage|path_label">_Path:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">path</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -46,26 +56,33 @@ </packing> </child> <child> - <object class="cuilo-SvxHyperURLBox" id="path"> + <object class="GtkButton" id="fileopen"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="hexpand">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes" context="hyperlinkdocpage|fileopen|tooltip_text">Open File</property> + <property name="image">image2</property> + <property name="always_show_image">True</property> </object> <packing> - <property name="left_attach">1</property> + <property name="left_attach">2</property> <property name="top_attach">0</property> </packing> </child> <child> - <object class="GtkButton" id="fileopen"> - <property name="label" translatable="yes" context="hyperlinkdocpage|fileopen">Open File</property> + <object class="GtkComboBoxText" id="path"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="tooltip_text" translatable="yes" context="hyperlinkdocpage|fileopen|tooltip_text">Open File</property> + <property name="hexpand">True</property> + <property name="has_entry">True</property> + <child internal-child="entry"> + <object class="GtkEntry"> + <property name="can_focus">False</property> + </object> + </child> </object> <packing> - <property name="left_attach">2</property> + <property name="left_attach">1</property> <property name="top_attach">0</property> </packing> </child> @@ -113,10 +130,10 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hyperlinkdocpage|target_label">Targ_et:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">target</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -128,9 +145,9 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hyperlinkdocpage|url_label">URL:</property> <property name="use_underline">True</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -139,11 +156,12 @@ </child> <child> <object class="GtkButton" id="browse"> - <property name="label" translatable="yes" context="hyperlinkdocpage|browse">Target in Document</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="tooltip_text" translatable="yes" context="hyperlinkdocpage|browse|tooltip_text">Target in Document</property> + <property name="image">image1</property> + <property name="always_show_image">True</property> </object> <packing> <property name="left_attach">2</property> @@ -222,10 +240,10 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hyperlinkdocpage|frame_label">F_rame:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">frame</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -237,10 +255,10 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hyperlinkdocpage|indication_label">Te_xt:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">indication</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -252,10 +270,10 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hyperlinkdocpage|name_label">N_ame:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">name</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -293,10 +311,10 @@ <object class="GtkLabel" id="form_label"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hyperlinkdocpage|form_label">F_orm:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">form</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -304,7 +322,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="form"> + <object class="GtkComboBoxText" id="form"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> @@ -320,6 +338,7 @@ <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="tooltip_text" translatable="yes" context="hyperlinkdocpage|script|tooltip_text">Events</property> + <property name="always_show_image">True</property> </object> <packing> <property name="left_attach">3</property> @@ -327,7 +346,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="frame"> + <object class="GtkComboBoxText" id="frame"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> diff --git a/cui/uiconfig/ui/hyperlinkinternetpage.ui b/cui/uiconfig/ui/hyperlinkinternetpage.ui index ae413e3c01a1..efebeedc2044 100644 --- a/cui/uiconfig/ui/hyperlinkinternetpage.ui +++ b/cui/uiconfig/ui/hyperlinkinternetpage.ui @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkBox" id="HyperlinkInternetPage"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> + <property name="border_width">6</property> <property name="orientation">vertical</property> <property name="spacing">24</property> <child> @@ -92,17 +92,6 @@ </packing> </child> <child> - <object class="cuilo-SvxHyperURLBox" id="target"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> <object class="GtkLabel" id="login_label"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -170,6 +159,23 @@ </packing> </child> <child> + <object class="GtkComboBoxText" id="target"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="has_entry">True</property> + <child internal-child="entry"> + <object class="GtkEntry"> + <property name="can_focus">False</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> <placeholder/> </child> <child> @@ -303,7 +309,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="form"> + <object class="GtkComboBoxText" id="form"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> @@ -319,6 +325,7 @@ <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="tooltip_text" translatable="yes" context="hyperlinkinternetpage|script|tooltip_text">Events</property> + <property name="always_show_image">True</property> </object> <packing> <property name="left_attach">3</property> @@ -326,7 +333,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="frame"> + <object class="GtkComboBoxText" id="frame"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> diff --git a/cui/uiconfig/ui/hyperlinkmailpage.ui b/cui/uiconfig/ui/hyperlinkmailpage.ui index 4e2ed8655db6..89c2c84472e2 100644 --- a/cui/uiconfig/ui/hyperlinkmailpage.ui +++ b/cui/uiconfig/ui/hyperlinkmailpage.ui @@ -1,13 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">res/adrbook.png</property> + </object> <object class="GtkBox" id="HyperlinkMailPage"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> + <property name="border_width">6</property> <property name="orientation">vertical</property> <property name="spacing">24</property> <child> @@ -35,10 +40,10 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hyperlinkmailpage|receiver_label">Re_cipient:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">receiver</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -46,23 +51,13 @@ </packing> </child> <child> - <object class="cuilo-SvxHyperURLBox" id="receiver"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> <object class="GtkButton" id="adressbook"> - <property name="label" translatable="yes" context="hyperlinkmailpage|adressbook">Data Sources…</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="tooltip_text" translatable="yes" context="hyperlinkmailpage|adressbook|tooltip_text">Data Sources...</property> + <property name="image">image1</property> + <property name="always_show_image">True</property> </object> <packing> <property name="left_attach">2</property> @@ -74,11 +69,11 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> <property name="ypad">1</property> <property name="label" translatable="yes" context="hyperlinkmailpage|subject_label">_Subject:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">subject</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -97,6 +92,26 @@ </packing> </child> <child> + <object class="GtkComboBoxText" id="receiver"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="has_entry">True</property> + <child internal-child="entry"> + <object class="GtkEntry"> + <property name="can_focus">False</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> <placeholder/> </child> <child> @@ -151,10 +166,10 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hyperlinkmailpage|frame_label">F_rame:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">frame</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -166,10 +181,10 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hyperlinkmailpage|indication_label">Te_xt:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">indication</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -181,10 +196,10 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hyperlinkmailpage|name_label">N_ame:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">name</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -222,10 +237,10 @@ <object class="GtkLabel" id="form_label"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hyperlinkmailpage|form_label">F_orm:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">form</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -233,7 +248,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="form"> + <object class="GtkComboBoxText" id="form"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> @@ -249,6 +264,7 @@ <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="tooltip_text" translatable="yes" context="hyperlinkmailpage|script|tooltip_text">Events</property> + <property name="always_show_image">True</property> </object> <packing> <property name="left_attach">3</property> @@ -256,7 +272,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="frame"> + <object class="GtkComboBoxText" id="frame"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> diff --git a/cui/uiconfig/ui/hyperlinknewdocpage.ui b/cui/uiconfig/ui/hyperlinknewdocpage.ui index 980c967b2f0e..d31411da48af 100644 --- a/cui/uiconfig/ui/hyperlinknewdocpage.ui +++ b/cui/uiconfig/ui/hyperlinknewdocpage.ui @@ -1,13 +1,26 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="cui"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">res/newdoc.png</property> + </object> + <object class="GtkTreeStore" id="liststore1"> + <columns> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gchararray"/> + </columns> + </object> <object class="GtkBox" id="HyperlinkNewDocPage"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> + <property name="border_width">6</property> <property name="orientation">vertical</property> <property name="spacing">24</property> <child> @@ -83,10 +96,10 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hyperlinknewdocpage|file_label">_File:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">path</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -94,23 +107,13 @@ </packing> </child> <child> - <object class="cuilo-SvxHyperURLBox" id="path"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hexpand">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> - </packing> - </child> - <child> <object class="GtkButton" id="create"> - <property name="label" translatable="yes" context="hyperlinknewdocpage|create">Select Path</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="tooltip_text" translatable="yes" context="hyperlinknewdocpage|create|tooltip_text">Select Path</property> + <property name="image">image1</property> + <property name="always_show_image">True</property> </object> <packing> <property name="left_attach">2</property> @@ -122,12 +125,12 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> - <property name="yalign">0</property> <property name="ypad">1</property> <property name="label" translatable="yes" context="hyperlinknewdocpage|types_label">File _type:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">types:border</property> + <property name="mnemonic_widget">types</property> + <property name="xalign">0</property> + <property name="yalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -135,13 +138,52 @@ </packing> </child> <child> - <object class="GtkTreeView" id="types:border"> + <object class="GtkComboBoxText" id="path"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="has_entry">True</property> + <child internal-child="entry"> + <object class="GtkEntry"> + <property name="can_focus">False</property> + </object> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="vexpand">True</property> - <property name="show_expanders">False</property> - <child internal-child="selection"> - <object class="GtkTreeSelection" id="treeview-selection1"/> + <property name="vexpand">False</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTreeView" id="types"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="vexpand">True</property> + <property name="model">liststore1</property> + <property name="headers_visible">False</property> + <property name="headers_clickable">False</property> + <property name="search_column">0</property> + <property name="show_expanders">False</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="treeview-selection1"/> + </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn1"> + <child> + <object class="GtkCellRendererText" id="cellrenderertext1"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + </child> + </object> </child> </object> <packing> @@ -204,10 +246,10 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hyperlinknewdocpage|frame_label">F_rame:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">frame</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -219,10 +261,10 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hyperlinknewdocpage|indication_label">Te_xt:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">indication</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -234,10 +276,10 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="hyperlinknewdocpage|name_label">N_ame:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">name</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -285,7 +327,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="form"> + <object class="GtkComboBoxText" id="form"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> @@ -301,6 +343,7 @@ <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="tooltip_text" translatable="yes" context="hyperlinknewdocpage|script|tooltip_text">Events</property> + <property name="always_show_image">True</property> </object> <packing> <property name="left_attach">3</property> @@ -308,7 +351,7 @@ </packing> </child> <child> - <object class="GtkComboBox" id="frame"> + <object class="GtkComboBoxText" id="frame"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index ed9f543a4c93..d96db17d9988 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -244,10 +244,6 @@ generic-name="LanguageBox" parent="VclComboBoxText" icon-name="widget-gtk-combobox"/> - <glade-widget-class title="URL Entry" name="cuilo-SvxHyperURLBox" - generic-name="URL Entry" parent="GtkEntry" - icon-name="widget-gtk-textentry"/> - <glade-widget-class title="Another NoSpace Edit" name="cuilo-SvxNoSpaceEdit" generic-name="Another NoSpace Edit" parent="GtkEntry" icon-name="widget-gtk-textentry"> @@ -330,10 +326,6 @@ generic-name="TypeSelectList" parent="GtkTreeView" icon-name="widget-gtk-treeview"/> - <glade-widget-class title="Icon Choice Control" name="cuilo-SvtIconChoiceCtrl" - generic-name="Icon Choice Control" parent="GtkIconView" - icon-name="widget-gtk-iconview"/> - <glade-widget-class title="Recent Documents View" name="sfxlo-RecentDocsView" generic-name="Icon View" parent="GtkIconView" icon-name="widget-gtk-iconview"/> diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx index 5a1b1ce16b28..948b52f94d5a 100644 --- a/include/sfx2/basedlgs.hxx +++ b/include/sfx2/basedlgs.hxx @@ -107,7 +107,7 @@ public: virtual void Deactivate() override; virtual void ChildWinDispose() override; virtual void FillInfo(SfxChildWinInfo&) const; - SfxBindings& GetBindings() { return *m_pBindings; } + SfxBindings& GetBindings() const { return *m_pBindings; } }; // class SfxFloatingWindow -------------------------------------------------- diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx index 0c19a983b2e0..3f00d75f2594 100644 --- a/include/svtools/inettbc.hxx +++ b/include/svtools/inettbc.hxx @@ -116,11 +116,12 @@ class SVT_DLLPUBLIC URLBox SVT_DLLPRIVATE void Init(); public: - URLBox(std::unique_ptr<weld::ComboBox> pWidget); + URLBox(std::unique_ptr<weld::ComboBox> xWidget); ~URLBox(); void set_entry_text(const OUString& rStr) { m_xWidget->set_entry_text(rStr); } - void Clear() { m_xWidget->clear(); } + void show() { m_xWidget->show(); } + void clear() { m_xWidget->clear(); } void connect_entry_activate(const Link<weld::ComboBox&, bool>& rLink) { m_xWidget->connect_entry_activate(rLink); } void connect_changed(const Link<weld::ComboBox&, void>& rLink) { aChangeHdl = rLink; } void connect_focus_out(const Link<weld::Widget&, void>& rLink) { aFocusOutHdl = rLink; } @@ -132,12 +133,13 @@ public: void EnableAutocomplete() { m_xWidget->set_entry_completion(true); } void SetBaseURL( const OUString& rURL ); + const OUString& GetBaseURL() const { return aBaseURL; } void SetSmartProtocol( INetProtocol eProt ); INetProtocol GetSmartProtocol() const { return eSmartProtocol; } OUString GetURL(); void DisableHistory(); - weld::Widget* getWidget() { return m_xWidget.get(); } + weld::ComboBox* getWidget() { return m_xWidget.get(); } static OUString ParseSmart( const OUString& aText, const OUString& aBaseURL ); diff --git a/include/svx/svxdlg.hxx b/include/svx/svxdlg.hxx index 781eafd506a3..b3aab075feae 100644 --- a/include/svx/svxdlg.hxx +++ b/include/svx/svxdlg.hxx @@ -237,7 +237,7 @@ class AbstractSvxHpLinkDlg : public VclAbstractDialog protected: virtual ~AbstractSvxHpLinkDlg() override = default; public: - virtual vcl::Window* GetWindow() = 0; + virtual std::shared_ptr<SfxDialogController> GetController() = 0; virtual bool QueryClose() = 0; }; @@ -407,7 +407,7 @@ public: virtual VclPtr<AbstractSvxObjectTitleDescDialog> CreateSvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle, const OUString& rDescription) = 0; virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxMultiPathDialog(weld::Window* pParent) = 0 ; virtual VclPtr<AbstractSvxMultiPathDialog> CreateSvxPathSelectDialog(weld::Window* pParent) = 0 ; - virtual VclPtr<AbstractSvxHpLinkDlg> CreateSvxHpLinkDlg(vcl::Window* pParent, SfxBindings* pBindings)=0; + virtual VclPtr<AbstractSvxHpLinkDlg> CreateSvxHpLinkDlg(SfxChildWindow* pChild, SfxBindings* pBindings, weld::Window* pParent) = 0; virtual VclPtr<AbstractFmSearchDialog> CreateFmSearchDialog(weld::Window* pParent, const OUString& strInitialText, const ::std::vector< OUString >& _rContexts, diff --git a/include/tools/wintypes.hxx b/include/tools/wintypes.hxx index f3ac3956d9ee..4fa4eab908f9 100644 --- a/include/tools/wintypes.hxx +++ b/include/tools/wintypes.hxx @@ -100,7 +100,8 @@ enum class WindowType : sal_uInt16 RULER , // 70 (374) CALCINPUTLINE , HEADERBAR , - LAST = HEADERBAR, + VERTICALTABCONTROL , + LAST = VERTICALTABCONTROL, // only used in vclxtoolkit.cxx TOOLKIT_FRAMEWINDOW = 0x1000, TOOLKIT_SYSTEMCHILDWINDOW = 0x1001, diff --git a/include/vcl/ivctrl.hxx b/include/vcl/ivctrl.hxx index cffbe03e9a90..e3c630a719b3 100644 --- a/include/vcl/ivctrl.hxx +++ b/include/vcl/ivctrl.hxx @@ -23,6 +23,7 @@ #include <memory> #include <vcl/dllapi.h> #include <vcl/ctrl.hxx> +#include <vcl/layout.hxx> #include <tools/link.hxx> #include <vcl/image.hxx> #include <o3tl/deleter.hxx> @@ -232,6 +233,8 @@ public: SvxIconChoiceCtrlEntry* InsertEntry( const OUString& rText, const Image& rImage); + void RemoveEntry(sal_Int32 nEntryListPos); + /** creates automatic mnemonics for all icon texts in the control @param _rUsedMnemonics @@ -276,6 +279,52 @@ public: virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; }; +struct VerticalTabPageData; + +class VerticalTabControl : public VclHBox +{ + VclPtr<SvtIconChoiceCtrl> m_xChooser; + VclPtr<VclVBox> m_xBox; + + std::vector<std::unique_ptr<VerticalTabPageData>> maPageList; + OString m_sCurrentPageId; + + Link<VerticalTabControl*,void> m_aActivateHdl; + Link<VerticalTabControl*,bool> m_aDeactivateHdl; + + DECL_LINK(ChosePageHdl_Impl, SvtIconChoiceCtrl*, void); + + void ActivatePage(); + bool DeactivatePage(); + + VerticalTabPageData* GetPageData(const OString& rId) const; + VerticalTabPageData* GetPageData(const SvxIconChoiceCtrlEntry* pEntry) const; + +public: + VerticalTabControl(vcl::Window* pParent); + virtual ~VerticalTabControl() override; + virtual void dispose() override; + + sal_uInt16 GetPageCount() const { return m_xChooser->GetEntryCount(); } + + OString GetCurPageId() const { return m_sCurrentPageId; } + void SetCurPageId(const OString& rId); + + sal_uInt16 GetPagePos(const OString& rPageId) const; + OString GetPageId(sal_uInt16 nIndex) const; + VclPtr<vcl::Window> GetPage(const OString& rPageId); + + void RemovePage(const OString& rPageId); + void InsertPage(const OString& rPageId, const OUString& rLabel, const Image& rImage, const OUString& rTooltip, VclPtr<vcl::Window> xPage); + + void SetActivatePageHdl( const Link<VerticalTabControl*,void>& rLink ) { m_aActivateHdl = rLink; } + void SetDeactivatePageHdl( const Link<VerticalTabControl*, bool>& rLink ) { m_aDeactivateHdl = rLink; } + + OUString GetPageText(const OString& rPageId) const; + + vcl::Window* GetPageParent() { return m_xBox.get(); } +}; + #endif // INCLUDED_VCL_IVCTRL_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 35e645af2467..d422c84193cc 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -351,6 +351,7 @@ public: virtual bool get_resizable() const = 0; virtual Size get_size() const = 0; virtual Point get_position() const = 0; + virtual tools::Rectangle get_monitor_workarea() const = 0; // center window on is parent // // bTrackGeometryRequests set to true tries to ensure the window will end diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index d8b940d9efa0..ae758442569b 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -493,7 +493,6 @@ custom_widgets = [ 'SvSimpleTableContainer', 'SvTreeListBox', 'SvtFileView', - 'SvtIconChoiceCtrl', 'SvtURLBox', 'Svx3DPreviewControl', 'SvxCharViewControl', @@ -503,7 +502,6 @@ custom_widgets = [ 'SvxFillAttrBox', 'SvxFillTypeBox', 'SvxFontPrevWindow', - 'SvxHyperURLBox', 'SvxLanguageBox', 'SvxLanguageComboBox', 'SvxLightCtl3D', diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index eff7b67fcb47..e0358e05c86c 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -579,7 +579,7 @@ IMPL_LINK_NOARG( MatchContext_Impl, Select_Impl, void*, void ) } // insert all completed strings into the listbox - pBox->Clear(); + pBox->clear(); for (auto const& completion : aCompletions) { diff --git a/svx/source/dialog/hyperdlg.cxx b/svx/source/dialog/hyperdlg.cxx index 20cb0dcecbd4..d08a17d6c06f 100644 --- a/svx/source/dialog/hyperdlg.cxx +++ b/svx/source/dialog/hyperdlg.cxx @@ -41,16 +41,18 @@ SvxHlinkDlgWrapper::SvxHlinkDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId, { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); - mpDlg = pFact->CreateSvxHpLinkDlg(_pParent, pBindings); - SetWindow( mpDlg->GetWindow() ); + mpDlg = pFact->CreateSvxHpLinkDlg(this, pBindings, _pParent->GetFrameWeld()); + SetController( mpDlg->GetController() ); SetVisible_Impl(false); vcl::Window* pTopWindow = nullptr; if ( pInfo->aSize.Width() != 0 && pInfo->aSize.Height() != 0 && (nullptr != (pTopWindow = SfxGetpApp()->GetTopWindow()))) { + weld::Dialog* pDialog = GetController()->getDialog(); + Size aParentSize( pTopWindow->GetSizePixel() ); - Size aDlgSize ( GetSizePixel () ); + Size aDlgSize(pDialog->get_size()); if( aParentSize.Width() < pInfo->aPos.X() ) pInfo->aPos.setX( aParentSize.Width()-aDlgSize.Width() < long(0.1*aParentSize.Width()) ? @@ -59,7 +61,7 @@ SvxHlinkDlgWrapper::SvxHlinkDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId, pInfo->aPos.setY( aParentSize.Height()-aDlgSize.Height() < long(0.1*aParentSize.Height()) ? long(0.1*aParentSize.Height()) : aParentSize.Height()-aDlgSize.Height() ); - GetWindow()->SetPosPixel( pInfo->aPos ); + pDialog->window_move(pInfo->aPos.X(), pInfo->aPos.Y()); } SetHideNotDelete( true ); diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index fc62bb6441e2..c1ec3fc2488e 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -46,6 +46,7 @@ #include <vcl/fixedhyper.hxx> #include <vcl/fmtfield.hxx> #include <vcl/headbar.hxx> +#include <vcl/ivctrl.hxx> #include <vcl/layout.hxx> #include <vcl/menubtn.hxx> #include <vcl/prgsbar.hxx> @@ -1094,6 +1095,11 @@ public: return m_xWindow->GetPosPixel(); } + virtual tools::Rectangle get_monitor_workarea() const override + { + return m_xWindow->GetDesktopRectPixel(); + } + virtual void set_centered_on_parent(bool /*bTrackGeometryRequests*/) override { if (vcl::Window* pParent = m_xWidget->GetParent()) @@ -1813,6 +1819,97 @@ IMPL_LINK_NOARG(SalInstanceNotebook, ActivatePageHdl, TabControl*, void) m_aEnterPageHdl.Call(get_current_page_ident()); } +class SalInstanceVerticalNotebook : public SalInstanceContainer, public virtual weld::Notebook +{ +private: + VclPtr<VerticalTabControl> m_xNotebook; + mutable std::vector<std::unique_ptr<SalInstanceContainer>> m_aPages; + + DECL_LINK(DeactivatePageHdl, VerticalTabControl*, bool); + DECL_LINK(ActivatePageHdl, VerticalTabControl*, void); + +public: + SalInstanceVerticalNotebook(VerticalTabControl* pNotebook, SalInstanceBuilder* pBuilder, bool bTakeOwnership) + : SalInstanceContainer(pNotebook, pBuilder, bTakeOwnership) + , m_xNotebook(pNotebook) + { + m_xNotebook->SetActivatePageHdl(LINK(this, SalInstanceVerticalNotebook, ActivatePageHdl)); + m_xNotebook->SetDeactivatePageHdl(LINK(this, SalInstanceVerticalNotebook, DeactivatePageHdl)); + } + + virtual int get_current_page() const override + { + return m_xNotebook->GetPagePos(m_xNotebook->GetCurPageId()); + } + + virtual OString get_current_page_ident() const override + { + return m_xNotebook->GetCurPageId(); + } + + virtual weld::Container* get_page(const OString& rIdent) const override + { + sal_uInt16 nPageIndex = m_xNotebook->GetPagePos(rIdent); + if (nPageIndex == TAB_PAGE_NOTFOUND) + return nullptr; + auto pChild = m_xNotebook->GetPage(rIdent); + if (m_aPages.size() < nPageIndex + 1U) + m_aPages.resize(nPageIndex + 1U); + if (!m_aPages[nPageIndex]) + m_aPages[nPageIndex].reset(new SalInstanceContainer(pChild, m_pBuilder, false)); + return m_aPages[nPageIndex].get(); + } + + virtual void set_current_page(int nPage) override + { + m_xNotebook->SetCurPageId(m_xNotebook->GetPageId(nPage)); + } + + virtual void set_current_page(const OString& rIdent) override + { + m_xNotebook->SetCurPageId(rIdent); + } + + virtual void remove_page(const OString& rIdent) override + { + m_xNotebook->RemovePage(rIdent); + } + + virtual void append_page(const OString& rIdent, const OUString& rLabel) override + { + VclPtrInstance<VclGrid> xGrid(m_xNotebook->GetPageParent()); + xGrid->set_hexpand(true); + xGrid->set_vexpand(true); + m_xNotebook->InsertPage(rIdent, rLabel, Image(), "", xGrid); + } + + virtual int get_n_pages() const override + { + return m_xNotebook->GetPageCount(); + } + + virtual OUString get_tab_label_text(const OString& rIdent) const override + { + return m_xNotebook->GetPageText(rIdent); + } + + virtual ~SalInstanceVerticalNotebook() override + { + m_xNotebook->SetActivatePageHdl(Link<VerticalTabControl*,void>()); + m_xNotebook->SetDeactivatePageHdl(Link<VerticalTabControl*,bool>()); + } +}; + +IMPL_LINK_NOARG(SalInstanceVerticalNotebook, DeactivatePageHdl, VerticalTabControl*, bool) +{ + return !m_aLeavePageHdl.IsSet() || m_aLeavePageHdl.Call(get_current_page_ident()); +} + +IMPL_LINK_NOARG(SalInstanceVerticalNotebook, ActivatePageHdl, VerticalTabControl*, void) +{ + m_aEnterPageHdl.Call(get_current_page_ident()); +} + class SalInstanceButton : public SalInstanceContainer, public virtual weld::Button { private: @@ -5228,8 +5325,12 @@ public: virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString &id, bool bTakeOwnership) override { - TabControl* pNotebook = m_xBuilder->get<TabControl>(id); - return pNotebook ? std::make_unique<SalInstanceNotebook>(pNotebook, this, bTakeOwnership) : nullptr; + vcl::Window* pNotebook = m_xBuilder->get<vcl::Window>(id); + if (pNotebook->GetType() == WindowType::TABCONTROL) + return std::make_unique<SalInstanceNotebook>(static_cast<TabControl*>(pNotebook), this, bTakeOwnership); + if (pNotebook->GetType() == WindowType::VERTICALTABCONTROL) + return std::make_unique<SalInstanceVerticalNotebook>(static_cast<VerticalTabControl*>(pNotebook), this, bTakeOwnership); + return nullptr; } virtual std::unique_ptr<weld::Button> weld_button(const OString &id, bool bTakeOwnership) override diff --git a/vcl/source/control/imivctl.hxx b/vcl/source/control/imivctl.hxx index 0875991d151d..0295ff9eabda 100644 --- a/vcl/source/control/imivctl.hxx +++ b/vcl/source/control/imivctl.hxx @@ -263,6 +263,7 @@ public: void SetStyle( WinBits nWinStyle ); WinBits GetStyle() const { return nWinBits; } void InsertEntry( std::unique_ptr<SvxIconChoiceCtrlEntry>, size_t nPos ); + void RemoveEntry( size_t nPos ); void CreateAutoMnemonics( MnemonicGenerator* _pGenerator ); void FontModified(); void SelectAll(); diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx index 5a3f88fa2922..333402bdeb5b 100644 --- a/vcl/source/control/imivctl1.cxx +++ b/vcl/source/control/imivctl1.cxx @@ -246,6 +246,13 @@ void SvxIconChoiceCtrl_Impl::InsertEntry( std::unique_ptr<SvxIconChoiceCtrlEntry InvalidateBoundingRect( pEntry->aRect ); } +void SvxIconChoiceCtrl_Impl::RemoveEntry(size_t nPos) +{ + pImpCursor->Clear(); + maEntries.erase(maEntries.begin() + nPos); + RecalcAllBoundingRectsSmart(); +} + void SvxIconChoiceCtrl_Impl::CreateAutoMnemonics( MnemonicGenerator* _pGenerator ) { std::unique_ptr< MnemonicGenerator > pAutoDeleteOwnGenerator; diff --git a/vcl/source/control/ivctrl.cxx b/vcl/source/control/ivctrl.cxx index 802cde299318..482993e55b62 100644 --- a/vcl/source/control/ivctrl.cxx +++ b/vcl/source/control/ivctrl.cxx @@ -22,10 +22,11 @@ #include "imivctl.hxx" #include <vcl/accessiblefactory.hxx> #include <vcl/bitmapex.hxx> +#include <vcl/commandevent.hxx> #include <vcl/controllayout.hxx> #include <vcl/mnemonic.hxx> #include <vcl/settings.hxx> -#include <vcl/commandevent.hxx> +#include <vcl/tabctrl.hxx> #include <vcl/vclevent.hxx> using namespace ::com::sun::star::accessibility; @@ -104,6 +105,11 @@ SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::InsertEntry( const OUString& rText, c return pEntry; } +void SvtIconChoiceCtrl::RemoveEntry(sal_Int32 nIndex) +{ + _pImpl->RemoveEntry(nIndex); +} + void SvtIconChoiceCtrl::DrawEntryImage( SvxIconChoiceCtrlEntry const * pEntry, const Point& rPos, OutputDevice& rDev ) { rDev.DrawImage( rPos, pEntry->GetImage() ); @@ -432,4 +438,183 @@ css::uno::Reference< XAccessible > SvtIconChoiceCtrl::CreateAccessible() return xAccessible; } +struct VerticalTabPageData +{ + OString sId; + SvxIconChoiceCtrlEntry* pEntry; + VclPtr<vcl::Window> xPage; ///< the TabPage itself +}; + +VerticalTabControl::VerticalTabControl(vcl::Window* pParent) + : VclHBox(pParent) + , m_xChooser(VclPtr<SvtIconChoiceCtrl>::Create(this, WB_3DLOOK | WB_ICON | WB_BORDER | + WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | + WB_NODRAGSELECTION | WB_TABSTOP | WB_CLIPCHILDREN | + WB_ALIGN_LEFT | WB_NOHSCROLL)) + , m_xBox(VclPtr<VclVBox>::Create(this)) +{ + SetType(WindowType::VERTICALTABCONTROL); + m_xChooser->SetClickHdl(LINK(this, VerticalTabControl, ChosePageHdl_Impl)); + m_xChooser->set_width_request(110); + m_xChooser->set_height_request(400); + m_xChooser->SetSizePixel(Size(110, 400)); + m_xBox->set_vexpand(true); + m_xBox->set_hexpand(true); + m_xBox->set_expand(true); + m_xBox->Show(); + m_xChooser->Show(); +} + +VerticalTabControl::~VerticalTabControl() +{ + disposeOnce(); +} + +void VerticalTabControl::dispose() +{ + m_xChooser.disposeAndClear(); + m_xBox.disposeAndClear(); + VclHBox::dispose(); +} + +IMPL_LINK_NOARG(VerticalTabControl, ChosePageHdl_Impl, SvtIconChoiceCtrl*, void) +{ + SvxIconChoiceCtrlEntry *pEntry = m_xChooser->GetSelectedEntry(); + if (!pEntry) + pEntry = m_xChooser->GetCursor(); + + VerticalTabPageData* pData = GetPageData(pEntry); + + if (pData->sId != m_sCurrentPageId) + SetCurPageId(pData->sId); +} + +void VerticalTabControl::ActivatePage() +{ + m_aActivateHdl.Call( this ); +} + +bool VerticalTabControl::DeactivatePage() +{ + return !m_aDeactivateHdl.IsSet() || m_aDeactivateHdl.Call(this); +} + +VerticalTabPageData* VerticalTabControl::GetPageData(const SvxIconChoiceCtrlEntry* pEntry) const +{ + VerticalTabPageData* pRet = nullptr; + for (auto & pData : maPageList) + { + if (pData->pEntry == pEntry) + { + pRet = pData.get(); + break; + } + } + return pRet; +} + +VerticalTabPageData* VerticalTabControl::GetPageData(const OString& rId) const +{ + VerticalTabPageData* pRet = nullptr; + for (auto & pData : maPageList) + { + if (pData->sId == rId) + { + pRet = pData.get(); + break; + } + } + return pRet; +} + +void VerticalTabControl::SetCurPageId(const OString& rId) +{ + OString sOldPageId = GetCurPageId(); + if (sOldPageId == rId) + return; + + VerticalTabPageData* pOldData = GetPageData(sOldPageId); + if (pOldData && pOldData->xPage) + { + if (!DeactivatePage()) + return; + pOldData->xPage->Hide(); + } + + m_sCurrentPageId = ""; + + VerticalTabPageData* pNewData = GetPageData(rId); + if (pNewData && pNewData->xPage) + { + m_sCurrentPageId = rId; + m_xChooser->SetCursor(pNewData->pEntry); + + ActivatePage(); + pNewData->xPage->Show(); + } +} + +OString VerticalTabControl::GetPageId(sal_uInt16 nIndex) const +{ + return maPageList[nIndex]->sId; +} + +void VerticalTabControl::InsertPage(const rtl::OString &rIdent, const rtl::OUString& rLabel, const Image& rImage, + const rtl::OUString& rTooltip, VclPtr<vcl::Window> xPage) +{ + SvxIconChoiceCtrlEntry* pEntry = m_xChooser->InsertEntry(rLabel, rImage); + pEntry->SetQuickHelpText(rTooltip); + m_xChooser->ArrangeIcons(); + maPageList.emplace_back(new VerticalTabPageData); + VerticalTabPageData* pNew = maPageList.back().get(); + pNew->sId = rIdent; + pNew->pEntry = pEntry; + pNew->xPage = xPage; + Size aOrigPrefSize(m_xBox->get_preferred_size()); + Size aPagePrefSize(xPage->get_preferred_size()); + m_xBox->set_width_request(std::max(aOrigPrefSize.Width(), aPagePrefSize.Width())); + m_xBox->set_height_request(std::max(aOrigPrefSize.Height(), aPagePrefSize.Height())); + pNew->xPage->Hide(); +} + +void VerticalTabControl::RemovePage(const rtl::OString &rPageId) +{ + for (auto it = maPageList.begin(), end = maPageList.end(); it != end; ++it) + { + VerticalTabPageData* pData = it->get(); + if (pData->sId == rPageId) + { + sal_Int32 nEntryListPos = m_xChooser->GetEntryListPos(pData->pEntry); + m_xChooser->RemoveEntry(nEntryListPos); + m_xChooser->ArrangeIcons(); + maPageList.erase(it); + break; + } + } +} + +sal_uInt16 VerticalTabControl::GetPagePos(const OString& rPageId) const +{ + VerticalTabPageData* pData = GetPageData(rPageId); + if (!pData) + return TAB_PAGE_NOTFOUND; + return m_xChooser->GetEntryListPos(pData->pEntry); +} + +VclPtr<vcl::Window> VerticalTabControl::GetPage(const OString& rPageId) +{ + VerticalTabPageData* pData = GetPageData(rPageId); + if (!pData) + return nullptr; + return pData->xPage; +} + +OUString VerticalTabControl::GetPageText(const OString& rPageId) const +{ + VerticalTabPageData* pData = GetPageData(rPageId); + if (!pData) + return OUString(); + return pData->pEntry->GetText(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 8e64c3a70881..344a22469aec 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -33,6 +33,7 @@ #include <vcl/fixedhyper.hxx> #include <vcl/headbar.hxx> #include <vcl/IPrioritable.hxx> +#include <vcl/ivctrl.hxx> #include <vcl/layout.hxx> #include <vcl/lstbox.hxx> #include <vcl/menubtn.hxx> @@ -928,6 +929,19 @@ namespace return bVertical; } + bool extractVerticalTabPos(VclBuilder::stringmap &rMap) + { + bool bVertical = false; + VclBuilder::stringmap::iterator aFind = rMap.find("tab-pos"); + if (aFind != rMap.end()) + { + bVertical = aFind->second.equalsIgnoreAsciiCase("left") || + aFind->second.equalsIgnoreAsciiCase("right"); + rMap.erase(aFind); + } + return bVertical; + } + bool extractInconsistent(VclBuilder::stringmap &rMap) { bool bInconsistent = false; @@ -1611,35 +1625,46 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & bool bIsPlaceHolder = name.isEmpty(); bool bVertical = false; - if (pParent && pParent->GetType() == WindowType::TABCONTROL) + if (pParent && (pParent->GetType() == WindowType::TABCONTROL || + pParent->GetType() == WindowType::VERTICALTABCONTROL)) { bool bTopLevel(name == "GtkDialog" || name == "GtkMessageDialog" || name == "GtkWindow" || name == "GtkPopover"); if (!bTopLevel) { - //We have to add a page - //make default pageid == position - TabControl *pTabControl = static_cast<TabControl*>(pParent); - sal_uInt16 nNewPageCount = pTabControl->GetPageCount()+1; - sal_uInt16 nNewPageId = nNewPageCount; - pTabControl->InsertPage(nNewPageId, OUString()); - pTabControl->SetCurPageId(nNewPageId); - SAL_WARN_IF(bIsPlaceHolder, "vcl.layout", "we should have no placeholders for tabpages"); - if (!bIsPlaceHolder) + if (pParent->GetType() == WindowType::TABCONTROL) { - VclPtrInstance<TabPage> pPage(pTabControl); - pPage->Show(); + //We have to add a page + //make default pageid == position + TabControl *pTabControl = static_cast<TabControl*>(pParent); + sal_uInt16 nNewPageCount = pTabControl->GetPageCount()+1; + sal_uInt16 nNewPageId = nNewPageCount; + pTabControl->InsertPage(nNewPageId, OUString()); + pTabControl->SetCurPageId(nNewPageId); + SAL_WARN_IF(bIsPlaceHolder, "vcl.layout", "we should have no placeholders for tabpages"); + if (!bIsPlaceHolder) + { + VclPtrInstance<TabPage> pPage(pTabControl); + pPage->Show(); - //Make up a name for it - OString sTabPageId = get_by_window(pParent) + - OString("-page") + - OString::number(nNewPageCount); - m_aChildren.emplace_back(sTabPageId, pPage, false); - pPage->SetHelpId(m_sHelpRoot + sTabPageId); + //Make up a name for it + OString sTabPageId = get_by_window(pParent) + + OString("-page") + + OString::number(nNewPageCount); + m_aChildren.emplace_back(sTabPageId, pPage, false); + pPage->SetHelpId(m_sHelpRoot + sTabPageId); - pParent = pPage; + pParent = pPage; - pTabControl->SetTabPage(nNewPageId, pPage); + pTabControl->SetTabPage(nNewPageId, pPage); + } + } + else + { + VerticalTabControl *pTabControl = static_cast<VerticalTabControl*>(pParent); + SAL_WARN_IF(bIsPlaceHolder, "vcl.layout", "we should have no placeholders for tabpages"); + if (!bIsPlaceHolder) + pParent = pTabControl->GetPageParent(); } } } @@ -2091,7 +2116,10 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString & } else if (name == "GtkNotebook") { - xWindow = VclPtr<TabControl>::Create(pParent, WB_STDTABCONTROL|WB_3DLOOK); + if (!extractVerticalTabPos(rMap)) + xWindow = VclPtr<TabControl>::Create(pParent, WB_STDTABCONTROL|WB_3DLOOK); + else + xWindow = VclPtr<VerticalTabControl>::Create(pParent); } else if (name == "GtkDrawingArea") { @@ -2627,7 +2655,7 @@ VclPtr<vcl::Window> VclBuilder::insertObject(vcl::Window *pParent, const OString void VclBuilder::handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &reader) { - OString sID; + std::vector<OString> sIDs; int nLevel = 1; stringmap aProperties; @@ -2651,7 +2679,7 @@ void VclBuilder::handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &read if (name.equals("id")) { name = reader.getAttributeValue(false); - sID = OString(name.begin, name.length); + OString sID = OString(name.begin, name.length); sal_Int32 nDelim = sID.indexOf(':'); if (nDelim != -1) { @@ -2659,6 +2687,7 @@ void VclBuilder::handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &read aProperties[OString("customproperty")] = OUString::fromUtf8(sPattern); sID = sID.copy(0, nDelim); } + sIDs.push_back(sID); } } } @@ -2685,21 +2714,39 @@ void VclBuilder::handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &read if (!pParent) return; - TabControl *pTabControl = static_cast<TabControl*>(pParent); + TabControl *pTabControl = pParent->GetType() == WindowType::TABCONTROL ? + static_cast<TabControl*>(pParent) : nullptr; + VerticalTabControl *pVerticalTabControl = pParent->GetType() == WindowType::VERTICALTABCONTROL ? + static_cast<VerticalTabControl*>(pParent) : nullptr; + assert(pTabControl || pVerticalTabControl); VclBuilder::stringmap::iterator aFind = aProperties.find(OString("label")); if (aFind != aProperties.end()) { - sal_uInt16 nPageId = pTabControl->GetCurPageId(); - pTabControl->SetPageText(nPageId, aFind->second); - pTabControl->SetPageName(nPageId, sID); - if (!context.empty()) + if (pTabControl) { - TabPage* pPage = pTabControl->GetTabPage(nPageId); - pPage->SetContext(context); + sal_uInt16 nPageId = pTabControl->GetCurPageId(); + pTabControl->SetPageText(nPageId, aFind->second); + pTabControl->SetPageName(nPageId, sIDs.back()); + if (!context.empty()) + { + TabPage* pPage = pTabControl->GetTabPage(nPageId); + pPage->SetContext(context); + } + } + else + { + OUString sLabel(aFind->second); + OUString sIconName(extractIconName(aProperties)); + OUString sTooltip(extractTooltipText(aProperties)); + pVerticalTabControl->InsertPage(sIDs.front(), sLabel, FixedImage::loadThemeImage(sIconName), sTooltip, + pVerticalTabControl->GetPageParent()->GetWindow(GetWindowType::LastChild)); } } else - pTabControl->RemovePage(pTabControl->GetCurPageId()); + { + if (pTabControl) + pTabControl->RemovePage(pTabControl->GetCurPageId()); + } } //so that tabbing between controls goes in a visually sensible sequence diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 712dd51b9ae6..50ebb17367c1 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -2731,6 +2731,15 @@ public: return Point(current_x, current_y); } + virtual tools::Rectangle get_monitor_workarea() const override + { + GdkScreen* pScreen = gtk_widget_get_screen(GTK_WIDGET(m_pWindow)); + gint nMonitor = gdk_screen_get_monitor_at_window(pScreen, gtk_widget_get_window(GTK_WIDGET(m_pWindow))); + GdkRectangle aRect; + gdk_screen_get_monitor_workarea(pScreen, nMonitor, &aRect); + return tools::Rectangle(aRect.x, aRect.y, aRect.x + aRect.width, aRect.y + aRect.height); + } + virtual void set_centered_on_parent(bool bTrackGeometryRequests) override { if (bTrackGeometryRequests) |