diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-07-08 10:39:51 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-07-08 16:30:02 +0200 |
commit | 7a5d0c413f37e02356d0bd1e1da7a9445ee25fe8 (patch) | |
tree | 4dc24ebbc4ae5e300528626ec6ff8c8f51aa99d1 /sw/source/ui/fldui | |
parent | 71f0883939f5851ee69478ca1a022d63963f580f (diff) |
Resolves: tdf#161478 Insert button not updated on switch tabs
regression since:
commit fbd79c6125fd302dde9af2d76171dd5ca794af4d
Author: Caolán McNamara <caolanm@redhat.com>
Date: Wed Mar 20 11:56:03 2019 +0000
weld SwFieldDlg
Change-Id: Ifb4f107bb8d4d53ae81b8ce38a87c9774112b617
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170150
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sw/source/ui/fldui')
-rw-r--r-- | sw/source/ui/fldui/flddb.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/fldui/flddinf.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldfunc.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldpage.cxx | 25 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldpage.hxx | 3 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldref.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldtdlg.cxx | 7 | ||||
-rw-r--r-- | sw/source/ui/fldui/fldvar.cxx | 6 |
8 files changed, 34 insertions, 19 deletions
diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx index 0e6374e2b45e..99af2899746b 100644 --- a/sw/source/ui/fldui/flddb.cxx +++ b/sw/source/ui/fldui/flddb.cxx @@ -441,7 +441,7 @@ void SwFieldDBPage::CheckInsert() bInsert &= bHasValue; } - EnableInsert(bInsert); + EnableInsert(bInsert, IsCurrentPage()); } IMPL_LINK(SwFieldDBPage, TreeSelectHdl, weld::TreeView&, rBox, void) diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx index 24c81eb10edb..36743339ab56 100644 --- a/sw/source/ui/fldui/flddinf.cxx +++ b/sw/source/ui/fldui/flddinf.cxx @@ -401,7 +401,7 @@ sal_Int32 SwFieldDokInfPage::FillSelectionLB(sal_uInt16 nSubType) // fill Format-Listbox SwFieldTypesEnum nTypeId = SwFieldTypesEnum::DocumentInfo; - EnableInsert(nSubType != USHRT_MAX); + EnableInsert(nSubType != USHRT_MAX, IsCurrentPage()); if (nSubType == USHRT_MAX) // Info-Text nSubType = DI_SUBTYPE_BEGIN; diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx index 0a553522985c..98fac8e93515 100644 --- a/sw/source/ui/fldui/fldfunc.cxx +++ b/sw/source/ui/fldui/fldfunc.cxx @@ -377,7 +377,7 @@ IMPL_LINK_NOARG(SwFieldFuncPage, TypeHdl, weld::TreeView&, void) m_xValueGroup->set_sensitive(bValue); m_xMacroBT->set_sensitive(bMacro); - EnableInsert( bInsert ); + EnableInsert(bInsert, IsCurrentPage()); } IMPL_LINK_NOARG(SwFieldFuncPage, SelectHdl, weld::TreeView&, void) @@ -500,7 +500,7 @@ void SwFieldFuncPage::UpdateSubType() m_xNameED->set_text(GetFieldMgr().GetMacroName()); m_xValueGroup->set_sensitive(true); } - EnableInsert(bHasMacro); + EnableInsert(bHasMacro, IsCurrentPage()); } } @@ -605,7 +605,7 @@ IMPL_LINK_NOARG(SwFieldFuncPage, ModifyHdl, weld::Entry&, void) (!nLen || nLen > MAX_COMBINED_CHARACTERS )) bEnable = false; - EnableInsert( bEnable ); + EnableInsert(bEnable, IsCurrentPage()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx index 11923d34ee93..0bf3fa640dc0 100644 --- a/sw/source/ui/fldui/fldpage.cxx +++ b/sw/source/ui/fldui/fldpage.cxx @@ -98,7 +98,7 @@ void SwFieldPage::Init() // newly initialise page void SwFieldPage::Activate() { - EnableInsert(m_bInsert); + EnableInsert(m_bInsert, true); } // complete reset; edit new field @@ -318,18 +318,25 @@ void SwFieldPage::InsertHdl(weld::Widget* pBtn) } } +bool SwFieldPage::IsCurrentPage() const +{ + if (const SwFieldDlg *pDlg = dynamic_cast<const SwFieldDlg*>(GetDialogController())) + return pDlg->GetCurTabPage() == this; + return true; +} + // enable/disable "Insert"-Button -void SwFieldPage::EnableInsert(bool bEnable) +void SwFieldPage::EnableInsert(bool bEnable, bool bIsCurrentPage) { - if (SwFieldDlg *pDlg = dynamic_cast<SwFieldDlg*>(GetDialogController())) + if (bIsCurrentPage) { - if (pDlg->GetCurTabPage() == this) + if (SwFieldDlg *pDlg = dynamic_cast<SwFieldDlg*>(GetDialogController())) pDlg->EnableInsert(bEnable); - } - else - { - SwFieldEditDlg *pEditDlg = static_cast<SwFieldEditDlg*>(GetDialogController()); - pEditDlg->EnableInsert(bEnable); + else + { + SwFieldEditDlg *pEditDlg = static_cast<SwFieldEditDlg*>(GetDialogController()); + pEditDlg->EnableInsert(bEnable); + } } m_bInsert = bEnable; diff --git a/sw/source/ui/fldui/fldpage.hxx b/sw/source/ui/fldui/fldpage.hxx index fbfa8cf2ba53..aad057822b6b 100644 --- a/sw/source/ui/fldui/fldpage.hxx +++ b/sw/source/ui/fldui/fldpage.hxx @@ -58,7 +58,8 @@ protected: void Init(); void SavePos( const weld::TreeView& rLst1); void RestorePos( weld::TreeView& rLst1 ); - void EnableInsert(bool bEnable); + bool IsCurrentPage() const; + void EnableInsert(bool bEnable, bool bIsCurrentPage); bool IsFieldEdit() const { return m_bFieldEdit; } // insert field diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx index 672465d713d9..334f392f476f 100644 --- a/sw/source/ui/fldui/fldref.cxx +++ b/sw/source/ui/fldui/fldref.cxx @@ -1003,7 +1003,7 @@ IMPL_LINK_NOARG(SwFieldRefPage, ModifyHdl, weld::Entry&, void) nTypeId == REFFLDFLAG_BOOKMARK))) bEnable = false; - EnableInsert(bEnable); + EnableInsert(bEnable, IsCurrentPage()); m_xSelectionLB->select_text(aName); } diff --git a/sw/source/ui/fldui/fldtdlg.cxx b/sw/source/ui/fldui/fldtdlg.cxx index f649a24416b1..8b0d334f19fd 100644 --- a/sw/source/ui/fldui/fldtdlg.cxx +++ b/sw/source/ui/fldui/fldtdlg.cxx @@ -240,6 +240,13 @@ void SwFieldDlg::Activate() } } +void SwFieldDlg::ActivatePage(const OUString& rPage) +{ + SfxTabDialogController::ActivatePage(rPage); + if (SfxTabPage* pPage = GetTabPage(rPage)) + pPage->Activate(); +} + void SwFieldDlg::EnableInsert(bool bEnable) { if( bEnable ) diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx index a950a5054529..01be468828f1 100644 --- a/sw/source/ui/fldui/fldvar.cxx +++ b/sw/source/ui/fldui/fldvar.cxx @@ -408,7 +408,7 @@ void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox) else bFormat = false; - EnableInsert(bFormat || bNumFormat); + EnableInsert(bFormat || bNumFormat, IsCurrentPage()); } break; @@ -953,7 +953,7 @@ IMPL_LINK_NOARG(SwFieldVarPage, ModifyHdl, weld::Entry&, void) m_xNewPB->set_sensitive(bApply); m_xDelPB->set_sensitive(bDelete); - EnableInsert(bInsert); + EnableInsert(bInsert, IsCurrentPage()); } IMPL_LINK(SwFieldVarPage, TBClickHdl, weld::Button&, rBox, void) @@ -1123,7 +1123,7 @@ IMPL_LINK_NOARG(SwFieldVarPage, SeparatorHdl, weld::Entry&, void) { bool bEnable = !m_xSeparatorED->get_text().isEmpty() || m_xChapterLevelLB->get_active() == 0; - EnableInsert(bEnable); + EnableInsert(bEnable, IsCurrentPage()); } bool SwFieldVarPage::FillItemSet(SfxItemSet* ) |