diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-06-23 20:01:05 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-06-24 09:59:03 +0200 |
commit | 66839a21da8d552f2a66fe0b323f9cee7b05de80 (patch) | |
tree | 04b06ba60991fc34f438f86b7645f0c61afe73e2 /cui | |
parent | a53768abccfa81d4dfb15629e02ea61072bfc905 (diff) |
merge IconChoiceDialog and SvxHpLinkDlg
Change-Id: I8ba8f2b589db8842da63a4ce6824d4f049081108
Reviewed-on: https://gerrit.libreoffice.org/74610
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/cuihyperdlg.cxx | 69 | ||||
-rw-r--r-- | cui/source/dialogs/hldocntp.cxx | 4 | ||||
-rw-r--r-- | cui/source/dialogs/hldoctp.cxx | 4 | ||||
-rw-r--r-- | cui/source/dialogs/hlinettp.cxx | 4 | ||||
-rw-r--r-- | cui/source/dialogs/hlmailtp.cxx | 4 | ||||
-rw-r--r-- | cui/source/dialogs/hltpbase.cxx | 2 | ||||
-rw-r--r-- | cui/source/dialogs/iconcdlg.cxx | 130 | ||||
-rw-r--r-- | cui/source/inc/cuihyperdlg.hxx | 78 | ||||
-rw-r--r-- | cui/source/inc/hldocntp.hxx | 4 | ||||
-rw-r--r-- | cui/source/inc/hldoctp.hxx | 4 | ||||
-rw-r--r-- | cui/source/inc/hlinettp.hxx | 4 | ||||
-rw-r--r-- | cui/source/inc/hlmailtp.hxx | 4 | ||||
-rw-r--r-- | cui/source/inc/hltpbase.hxx | 2 | ||||
-rw-r--r-- | cui/source/inc/iconcdlg.hxx | 85 |
14 files changed, 180 insertions, 218 deletions
diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx index 4e455c052978..8daedff44f49 100644 --- a/cui/source/dialogs/cuihyperdlg.cxx +++ b/cui/source/dialogs/cuihyperdlg.cxx @@ -82,11 +82,45 @@ void SvxHlinkCtrl::StateChanged( sal_uInt16 nSID, SfxItemState eState, //# # SvxHpLinkDlg::SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings) -: IconChoiceDialog( pParent, "HyperlinkDialog", "cui/ui/hyperlinkdialog.ui" ), - maCtrl ( SID_HYPERLINK_GETLINK, *pBindings, this ), - mpBindings ( pBindings ), - mbIsHTMLDoc ( false ) + : SfxModalDialog(pParent, "HyperlinkDialog", "cui/ui/hyperlinkdialog.ui") + , mnCurrentPageId(HyperLinkPageType::NONE) + , pSet ( nullptr ) + , pExampleSet ( nullptr ) + , maCtrl ( SID_HYPERLINK_GETLINK, *pBindings, this ) + , mpBindings ( pBindings ) + , mbIsHTMLDoc ( false ) { + 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 ); + + // ItemSet + if ( pSet ) + { + pExampleSet = new SfxItemSet( *pSet ); + pOutSet.reset(new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() )); + } + + // 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(); + mbGrabFocus = true; // insert pages OUString aStrTitle; @@ -158,7 +192,7 @@ SvxHpLinkDlg::~SvxHpLinkDlg () void SvxHpLinkDlg::dispose() { - // delete config item, so the base class (IconChoiceDialog) can not load it on the next start + // delete config item, so the base class (SfxModalDialog) can not load it on the next start SvtViewOptions aViewOpt( EViewType::TabDialog, OUString::number(SID_HYPERLINK_DIALOG) ); aViewOpt.Delete(); @@ -166,7 +200,30 @@ void SvxHpLinkDlg::dispose() maCtrl.dispose(); - IconChoiceDialog::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(); } /************************************************************************* diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx index 20f67d2e570d..65afc25c77d0 100644 --- a/cui/source/dialogs/hldocntp.cxx +++ b/cui/source/dialogs/hldocntp.cxx @@ -104,7 +104,7 @@ bool SvxHyperlinkNewDocTp::ImplGetURLObject( const OUString& rPath, const OUStri |* |************************************************************************/ -SvxHyperlinkNewDocTp::SvxHyperlinkNewDocTp ( vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet* pItemSet) +SvxHyperlinkNewDocTp::SvxHyperlinkNewDocTp ( vcl::Window *pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet) : SvxHyperlinkTabPageBase ( pParent, pDlg, "HyperlinkNewDocPage", "cui/ui/hyperlinknewdocpage.ui", pItemSet ) { get(m_pRbtEditNow, "editnow"); @@ -245,7 +245,7 @@ void SvxHyperlinkNewDocTp::GetCurentItemData ( OUString& rStrURL, OUString& aStr |* |************************************************************************/ -VclPtr<IconChoicePage> SvxHyperlinkNewDocTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet* pItemSet ) +VclPtr<IconChoicePage> SvxHyperlinkNewDocTp::Create( vcl::Window* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet ) { return VclPtr<SvxHyperlinkNewDocTp>::Create( pWindow, pDlg, pItemSet ); } diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx index 282e5ee4e722..ed4f6193772d 100644 --- a/cui/source/dialogs/hldoctp.cxx +++ b/cui/source/dialogs/hldoctp.cxx @@ -35,7 +35,7 @@ sal_Char const sFileScheme[] = INET_FILE_SCHEME; |* |************************************************************************/ -SvxHyperlinkDocTp::SvxHyperlinkDocTp ( vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet* pItemSet) +SvxHyperlinkDocTp::SvxHyperlinkDocTp ( vcl::Window *pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet) : SvxHyperlinkTabPageBase ( pParent, pDlg, "HyperlinkDocPage", "cui/ui/hyperlinkdocpage.ui", pItemSet ), mbMarkWndOpen ( false ) { @@ -166,7 +166,7 @@ void SvxHyperlinkDocTp::GetCurentItemData ( OUString& rStrURL, OUString& aStrNam |* |************************************************************************/ -VclPtr<IconChoicePage> SvxHyperlinkDocTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet* pItemSet ) +VclPtr<IconChoicePage> SvxHyperlinkDocTp::Create( vcl::Window* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet ) { return VclPtr<SvxHyperlinkDocTp>::Create( pWindow, pDlg, pItemSet ); } diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx index 29360b111f75..d5d404d3d0fc 100644 --- a/cui/source/dialogs/hlinettp.cxx +++ b/cui/source/dialogs/hlinettp.cxx @@ -34,7 +34,7 @@ sal_Char const sFTPScheme[] = INET_FTP_SCHEME; |************************************************************************/ SvxHyperlinkInternetTp::SvxHyperlinkInternetTp ( vcl::Window *pParent, - IconChoiceDialog* pDlg, + SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet) : SvxHyperlinkTabPageBase ( pParent, pDlg, "HyperlinkInternetPage", "cui/ui/hyperlinkinternetpage.ui", pItemSet ) , @@ -192,7 +192,7 @@ OUString SvxHyperlinkInternetTp::CreateAbsoluteURL() const |* |************************************************************************/ -VclPtr<IconChoicePage> SvxHyperlinkInternetTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet* pItemSet ) +VclPtr<IconChoicePage> SvxHyperlinkInternetTp::Create( vcl::Window* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet ) { return VclPtr<SvxHyperlinkInternetTp>::Create( pWindow, pDlg, pItemSet ); } diff --git a/cui/source/dialogs/hlmailtp.cxx b/cui/source/dialogs/hlmailtp.cxx index dda7b82b4565..93e1bc021512 100644 --- a/cui/source/dialogs/hlmailtp.cxx +++ b/cui/source/dialogs/hlmailtp.cxx @@ -37,7 +37,7 @@ using namespace ::com::sun::star; |* |************************************************************************/ -SvxHyperlinkMailTp::SvxHyperlinkMailTp ( vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet* pItemSet) +SvxHyperlinkMailTp::SvxHyperlinkMailTp ( vcl::Window *pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet) : SvxHyperlinkTabPageBase ( pParent, pDlg, "HyperlinkMailPage", "cui/ui/hyperlinkmailpage.ui", pItemSet ) { @@ -170,7 +170,7 @@ OUString SvxHyperlinkMailTp::CreateAbsoluteURL() const |* |************************************************************************/ -VclPtr<IconChoicePage> SvxHyperlinkMailTp::Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet* pItemSet ) +VclPtr<IconChoicePage> SvxHyperlinkMailTp::Create( vcl::Window* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet ) { return VclPtr<SvxHyperlinkMailTp>::Create( pWindow, pDlg, pItemSet ); } diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx index a6db4f1d8957..f7f48e065bfc 100644 --- a/cui/source/dialogs/hltpbase.cxx +++ b/cui/source/dialogs/hltpbase.cxx @@ -105,7 +105,7 @@ sal_Int8 SvxHyperURLBox::ExecuteDrop( const ExecuteDropEvent& rEvt ) //# Hyperlink-Dialog: Tabpages-Baseclass # SvxHyperlinkTabPageBase::SvxHyperlinkTabPageBase ( vcl::Window *pParent, - IconChoiceDialog* pDlg, + SvxHpLinkDlg* pDlg, const OString& rID, const OUString& rUIXMLDescription, const SfxItemSet* pItemSet ) diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx index 83bb944b1bb9..3f5e3937abc1 100644 --- a/cui/source/dialogs/iconcdlg.cxx +++ b/cui/source/dialogs/iconcdlg.cxx @@ -128,9 +128,6 @@ void IconChoicePage::DataChanged( const DataChangedEvent& rDCEvt ) } -// Class IconChoiceDialog - - /********************************************************************** | | Ctor / Dtor @@ -142,86 +139,13 @@ VCL_BUILDER_FACTORY_ARGS(SvtIconChoiceCtrl, WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | WB_NODRAGSELECTION | WB_TABSTOP); -IconChoiceDialog::IconChoiceDialog ( vcl::Window* pParent, const OUString& rID, - const OUString& rUIXMLDescription ) -: SfxModalDialog ( pParent, rID, rUIXMLDescription ), - mnCurrentPageId ( HyperLinkPageType::NONE ), - - pSet ( nullptr ), - pExampleSet ( nullptr ) -{ - 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, IconChoiceDialog , ChosePageHdl_Impl ) ); - m_pIconCtrl->Show(); - m_pIconCtrl->SetChoiceWithCursor(); - m_pIconCtrl->SetSelectionMode( SelectionMode::Single ); - - // ItemSet - if ( pSet ) - { - pExampleSet = new SfxItemSet( *pSet ); - pOutSet.reset(new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() )); - } - - // Buttons - m_pOKBtn->SetClickHdl ( LINK( this, IconChoiceDialog, OkHdl ) ); - m_pApplyBtn->SetClickHdl ( LINK( this, IconChoiceDialog, ApplyHdl ) ); - m_pResetBtn->SetClickHdl( LINK( this, IconChoiceDialog, ResetHdl ) ); - m_pOKBtn->Show(); - m_pApplyBtn->Show(); - m_pCancelBtn->Show(); - m_pHelpBtn->Show(); - m_pResetBtn->Show(); -} - -IconChoiceDialog ::~IconChoiceDialog () -{ - disposeOnce(); -} - -void IconChoiceDialog::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(); -} - /********************************************************************** | | add new page | \**********************************************************************/ -SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage( +SvxIconChoiceCtrlEntry* SvxHpLinkDlg::AddTabPage( HyperLinkPageType nId, const OUString& rIconText, const Image& rChoiceIcon, @@ -235,7 +159,7 @@ SvxIconChoiceCtrlEntry* IconChoiceDialog::AddTabPage( return pEntry; } -void IconChoiceDialog::SetCtrlStyle() +void SvxHpLinkDlg::SetCtrlStyle() { 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); @@ -248,20 +172,20 @@ void IconChoiceDialog::SetCtrlStyle() | \**********************************************************************/ -void IconChoiceDialog::ShowPageImpl ( IconChoicePageData const * pData ) +void SvxHpLinkDlg::ShowPageImpl ( IconChoicePageData const * pData ) { if ( pData->pPage ) pData->pPage->Show(); } -void IconChoiceDialog::HidePageImpl ( IconChoicePageData const * pData ) +void SvxHpLinkDlg::HidePageImpl ( IconChoicePageData const * pData ) { if ( pData->pPage ) pData->pPage->Hide(); } -void IconChoiceDialog::ShowPage(HyperLinkPageType nId) +void SvxHpLinkDlg::ShowPage(HyperLinkPageType nId) { HyperLinkPageType nOldPageId = GetCurPageId(); bool bInvalidate = nOldPageId != nId; @@ -288,7 +212,7 @@ void IconChoiceDialog::ShowPage(HyperLinkPageType nId) | select a page | \**********************************************************************/ -IMPL_LINK_NOARG(IconChoiceDialog , ChosePageHdl_Impl, SvtIconChoiceCtrl*, void) +IMPL_LINK_NOARG(SvxHpLinkDlg, ChosePageHdl_Impl, SvtIconChoiceCtrl*, void) { SvxIconChoiceCtrlEntry *pEntry = m_pIconCtrl->GetSelectedEntry(); if ( !pEntry ) @@ -308,7 +232,7 @@ IMPL_LINK_NOARG(IconChoiceDialog , ChosePageHdl_Impl, SvtIconChoiceCtrl*, void) | \**********************************************************************/ -IMPL_LINK_NOARG(IconChoiceDialog, OkHdl, Button*, void) +IMPL_LINK_NOARG(SvxHpLinkDlg, OkHdl, Button*, void) { if ( OK_Impl() ) { @@ -318,7 +242,7 @@ IMPL_LINK_NOARG(IconChoiceDialog, OkHdl, Button*, void) } -IMPL_LINK_NOARG(IconChoiceDialog, ApplyHdl, Button*, void) +IMPL_LINK_NOARG(SvxHpLinkDlg, ApplyHdl, Button*, void) { if ( OK_Impl() ) { @@ -327,7 +251,7 @@ IMPL_LINK_NOARG(IconChoiceDialog, ApplyHdl, Button*, void) } } -IMPL_LINK_NOARG(IconChoiceDialog, ResetHdl, Button*, void) +IMPL_LINK_NOARG(SvxHpLinkDlg, ResetHdl, Button*, void) { ResetPageImpl (); @@ -338,7 +262,7 @@ IMPL_LINK_NOARG(IconChoiceDialog, ResetHdl, Button*, void) } -IMPL_LINK_NOARG(IconChoiceDialog, CancelHdl, Button*, void) +IMPL_LINK_NOARG(SvxHpLinkDlg, CancelHdl, Button*, void) { Close(); } @@ -349,7 +273,7 @@ IMPL_LINK_NOARG(IconChoiceDialog, CancelHdl, Button*, void) | \**********************************************************************/ -void IconChoiceDialog::ActivatePageImpl () +void SvxHpLinkDlg::ActivatePageImpl () { DBG_ASSERT( !maPageList.empty(), "no Pages registered" ); IconChoicePageData* pData = GetPageData ( mnCurrentPageId ); @@ -378,7 +302,7 @@ void IconChoiceDialog::ActivatePageImpl () } -void IconChoiceDialog::DeActivatePageImpl () +void SvxHpLinkDlg::DeActivatePageImpl () { IconChoicePageData *pData = GetPageData ( mnCurrentPageId ); @@ -438,7 +362,7 @@ void IconChoiceDialog::DeActivatePageImpl () } -void IconChoiceDialog::ResetPageImpl () +void SvxHpLinkDlg::ResetPageImpl () { IconChoicePageData *pData = GetPageData ( mnCurrentPageId ); @@ -453,7 +377,7 @@ void IconChoiceDialog::ResetPageImpl () | \**********************************************************************/ -const sal_uInt16* IconChoiceDialog::GetInputRanges( const SfxItemPool& ) +const sal_uInt16* SvxHpLinkDlg::GetInputRanges( const SfxItemPool& ) { if ( pSet ) { @@ -471,7 +395,7 @@ const sal_uInt16* IconChoiceDialog::GetInputRanges( const SfxItemPool& ) } -void IconChoiceDialog::SetInputSet( const SfxItemSet* pInSet ) +void SvxHpLinkDlg::SetInputSet( const SfxItemSet* pInSet ) { bool bSet = ( pSet != nullptr ); @@ -485,19 +409,13 @@ void IconChoiceDialog::SetInputSet( const SfxItemSet* pInSet ) } -void IconChoiceDialog::PageCreated( HyperLinkPageType /*nId*/, IconChoicePage& /*rPage*/ ) -{ - // not interested in -} - - /********************************************************************** | | start dialog | \**********************************************************************/ -short IconChoiceDialog::Execute() +short SvxHpLinkDlg::Execute() { if ( maPageList.empty() ) return RET_CANCEL; @@ -508,15 +426,15 @@ short IconChoiceDialog::Execute() } -void IconChoiceDialog::Start() +void SvxHpLinkDlg::Start() { - m_pCancelBtn->SetClickHdl( LINK( this, IconChoiceDialog, CancelHdl ) ); + m_pCancelBtn->SetClickHdl( LINK( this, SvxHpLinkDlg, CancelHdl ) ); Start_Impl(); } -bool IconChoiceDialog::QueryClose() +bool SvxHpLinkDlg::QueryClose() { bool bRet = true; for (auto & pData : maPageList) @@ -530,7 +448,7 @@ bool IconChoiceDialog::QueryClose() return bRet; } -void IconChoiceDialog::Start_Impl() +void SvxHpLinkDlg::Start_Impl() { FocusOnIcon( mnCurrentPageId ); ActivatePageImpl(); @@ -542,7 +460,7 @@ void IconChoiceDialog::Start_Impl() | \**********************************************************************/ -IconChoicePageData* IconChoiceDialog::GetPageData ( HyperLinkPageType nId ) +IconChoicePageData* SvxHpLinkDlg::GetPageData ( HyperLinkPageType nId ) { IconChoicePageData *pRet = nullptr; for (auto & pData : maPageList) @@ -562,7 +480,7 @@ IconChoicePageData* IconChoiceDialog::GetPageData ( HyperLinkPageType nId ) | \**********************************************************************/ -bool IconChoiceDialog::OK_Impl() +bool SvxHpLinkDlg::OK_Impl() { IconChoicePage* pPage = GetPageData ( mnCurrentPageId )->pPage; @@ -593,7 +511,7 @@ bool IconChoiceDialog::OK_Impl() } -void IconChoiceDialog::Ok() +void SvxHpLinkDlg::Ok() { if ( !pOutSet ) { @@ -626,7 +544,7 @@ void IconChoiceDialog::Ok() } } -void IconChoiceDialog::FocusOnIcon( HyperLinkPageType nId ) +void SvxHpLinkDlg::FocusOnIcon( HyperLinkPageType nId ) { // set focus to icon for the current visible page for ( sal_Int32 i=0; i<m_pIconCtrl->GetEntryCount(); i++) diff --git a/cui/source/inc/cuihyperdlg.hxx b/cui/source/inc/cuihyperdlg.hxx index c832f17f7f49..ce799fc7f2ab 100644 --- a/cui/source/inc/cuihyperdlg.hxx +++ b/cui/source/inc/cuihyperdlg.hxx @@ -71,9 +71,43 @@ public: |* \************************************************************************/ -class SvxHpLinkDlg : public IconChoiceDialog +class SvxHpLinkDlg : public SfxModalDialog { private: + friend class IconChoicePage; + + std::vector< std::unique_ptr<IconChoicePageData> > maPageList; + + VclPtr<SvtIconChoiceCtrl> m_pIconCtrl; + + 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; @@ -85,7 +119,18 @@ private: DECL_LINK (ClickApplyHdl_Impl, Button *, void ); DECL_LINK (ClickCloseHdl_Impl, Button *, void ); -protected: + static void ShowPageImpl ( IconChoicePageData const * pData ); + static void HidePageImpl ( IconChoicePageData const * pData ); + + IconChoicePage* GetTabPage( HyperLinkPageType nPageId ) + { return ( GetPageData (nPageId)->pPage ? GetPageData (nPageId)->pPage.get() : nullptr); } + + void ActivatePageImpl (); + void DeActivatePageImpl (); + void ResetPageImpl (); + + void Ok(); + virtual bool Close() override; virtual void Move() override; void Apply(); @@ -95,10 +140,33 @@ public: virtual ~SvxHpLinkDlg () override; virtual void dispose() override; - virtual void PageCreated( HyperLinkPageType nId, IconChoicePage& rPage ) override; + // interface + SvxIconChoiceCtrlEntry* AddTabPage( + HyperLinkPageType nId, const OUString& rIconText, const Image& rChoiceIcon, + CreatePage pCreateFunc /* != NULL */ ); + + void SetCurPageId( HyperLinkPageType nId ) { mnCurrentPageId = nId; FocusOnIcon( nId ); } + HyperLinkPageType GetCurPageId() const { return mnCurrentPageId; } + void ShowPage( HyperLinkPageType nId ); + + /// 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; } + + short Execute() override; + void Start(); + bool QueryClose(); + + void SetCtrlStyle(); + + void PageCreated( HyperLinkPageType nId, IconChoicePage& rPage ); - void SetPage( SvxHyperlinkItem const * pItem ); - void SetReadOnlyMode( bool bReadOnly ); + void SetPage( SvxHyperlinkItem const * pItem ); + void SetReadOnlyMode( bool bReadOnly ); bool IsHTMLDoc() const { return mbIsHTMLDoc; } SfxDispatcher* GetDispatcher() const { return mpBindings->GetDispatcher(); } diff --git a/cui/source/inc/hldocntp.hxx b/cui/source/inc/hldocntp.hxx index 42466e5fbf0f..933677028e67 100644 --- a/cui/source/inc/hldocntp.hxx +++ b/cui/source/inc/hldocntp.hxx @@ -49,11 +49,11 @@ protected: SvxLinkInsertMode& eMode ) override; public: - SvxHyperlinkNewDocTp ( vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet* pItemSet); + SvxHyperlinkNewDocTp ( vcl::Window *pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); virtual ~SvxHyperlinkNewDocTp () override; virtual void dispose() override; - static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet* pItemSet ); + static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet ); virtual bool AskApply () override; virtual void DoApply () override; diff --git a/cui/source/inc/hldoctp.hxx b/cui/source/inc/hldoctp.hxx index 4bda2b78a5ad..25a6e0d23d5d 100644 --- a/cui/source/inc/hldoctp.hxx +++ b/cui/source/inc/hldoctp.hxx @@ -63,11 +63,11 @@ private: OUString GetCurrentURL (); public: - SvxHyperlinkDocTp ( vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet* pItemSet); + SvxHyperlinkDocTp ( vcl::Window *pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); virtual ~SvxHyperlinkDocTp() override; virtual void dispose() override; - static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet* pItemSet ); + static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet ); virtual void SetMarkStr ( const OUString& aStrMark ) override; diff --git a/cui/source/inc/hlinettp.hxx b/cui/source/inc/hlinettp.hxx index 79b0e0750e25..eabd11b1938d 100644 --- a/cui/source/inc/hlinettp.hxx +++ b/cui/source/inc/hlinettp.hxx @@ -75,11 +75,11 @@ protected: virtual void SetMarkWndShouldOpen (bool bOpen) override {mbMarkWndOpen=bOpen;} public: - SvxHyperlinkInternetTp ( vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet* pItemSet); + SvxHyperlinkInternetTp ( vcl::Window *pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); virtual ~SvxHyperlinkInternetTp() override; virtual void dispose() override; - static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet* pItemSet ); + static VclPtr<IconChoicePage> Create( vcl::Window* 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 77fef7a473f2..ebadf85f3b84 100644 --- a/cui/source/inc/hlmailtp.hxx +++ b/cui/source/inc/hlmailtp.hxx @@ -51,11 +51,11 @@ protected: SvxLinkInsertMode& eMode ) override; public: - SvxHyperlinkMailTp ( vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet* pItemSet); + SvxHyperlinkMailTp ( vcl::Window *pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet); virtual ~SvxHyperlinkMailTp() override; virtual void dispose() override; - static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, IconChoiceDialog* pDlg, const SfxItemSet* pItemSet ); + static VclPtr<IconChoicePage> Create( vcl::Window* pWindow, SvxHpLinkDlg* pDlg, const SfxItemSet* pItemSet ); virtual void SetInitFocus() override; }; diff --git a/cui/source/inc/hltpbase.hxx b/cui/source/inc/hltpbase.hxx index 61cdbb8cc331..1bc51f7d77bd 100644 --- a/cui/source/inc/hltpbase.hxx +++ b/cui/source/inc/hltpbase.hxx @@ -99,7 +99,7 @@ protected: public: SvxHyperlinkTabPageBase ( vcl::Window *pParent, - IconChoiceDialog* pDlg, + SvxHpLinkDlg* pDlg, const OString& rID, const OUString& rUIXMLDescription, const SfxItemSet* pItemSet diff --git a/cui/source/inc/iconcdlg.hxx b/cui/source/inc/iconcdlg.hxx index 7f13cbfe40e1..7d5693ce6719 100644 --- a/cui/source/inc/iconcdlg.hxx +++ b/cui/source/inc/iconcdlg.hxx @@ -32,14 +32,14 @@ // forward-declarations struct IconChoicePageData; -class IconChoiceDialog; +class SvxHpLinkDlg; class IconChoicePage; class SfxItemPool; class SfxItemSet; enum class HyperLinkPageType; // Create-Function -typedef VclPtr<IconChoicePage> (*CreatePage)(vcl::Window *pParent, IconChoiceDialog* pDlg, const SfxItemSet* pAttrSet); +typedef VclPtr<IconChoicePage> (*CreatePage)(vcl::Window *pParent, SvxHpLinkDlg* pDlg, const SfxItemSet* pAttrSet); /// Data-structure for pages in dialog struct IconChoicePageData @@ -91,87 +91,6 @@ public: void DataChanged( const DataChangedEvent& rDCEvt ) override; }; -class IconChoiceDialog : public SfxModalDialog -{ -private: - friend class IconChoicePage; - - std::vector< std::unique_ptr<IconChoicePageData> > maPageList; - - VclPtr<SvtIconChoiceCtrl> m_pIconCtrl; - - 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 ); - -protected: - static void ShowPageImpl ( IconChoicePageData const * pData ); - static void HidePageImpl ( IconChoicePageData const * pData ); - - virtual void PageCreated( HyperLinkPageType nId, IconChoicePage& rPage ); - IconChoicePage* GetTabPage( HyperLinkPageType nPageId ) - { return ( GetPageData (nPageId)->pPage ? GetPageData (nPageId)->pPage.get() : nullptr); } - - void ActivatePageImpl (); - void DeActivatePageImpl (); - void ResetPageImpl (); - - void Ok(); - -public: - - // the IconChoiceCtrl's could also be set in the Ctor - IconChoiceDialog ( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription ); - virtual ~IconChoiceDialog () override; - virtual void dispose() override; - - // interface - SvxIconChoiceCtrlEntry* AddTabPage( - HyperLinkPageType nId, const OUString& rIconText, const Image& rChoiceIcon, - CreatePage pCreateFunc /* != NULL */ ); - - void SetCurPageId( HyperLinkPageType nId ) { mnCurrentPageId = nId; FocusOnIcon( nId ); } - HyperLinkPageType GetCurPageId() const { return mnCurrentPageId; } - void ShowPage( HyperLinkPageType nId ); - - /// 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; } - - short Execute() override; - void Start(); - bool QueryClose(); - - void SetCtrlStyle(); -}; - #endif // INCLUDED_CUI_SOURCE_INC_ICONCDLG_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |