diff options
author | rafaelhlima <rafael.palma.lima@gmail.com> | 2022-01-18 11:25:59 -0300 |
---|---|---|
committer | Rafael Lima <rafael.palma.lima@gmail.com> | 2022-01-24 18:16:09 +0100 |
commit | 2e1a38ceb6866248ec30f6fe58cd3adc1b910eec (patch) | |
tree | c00cd2f96a31995b04a16fcdf7adf1bf5783639f /svx/source/dialog | |
parent | 7679820af5739d3b6d5de0c4cb771d081407f406 (diff) |
tdf#146893 Rework Manage Changes dialog
This patch reworks the "Manage Changes" dialog (In Writer, Edit > Track Changes > Manage) so that the buttons "Accept", "Accept all", "Reject", "Reject all" and "Undo" only appear in the List tab, since they're not needed in the Filter tab.
A help button is also added and HID constants are defined for both tabs.
Change-Id: I12da7811635dfc142d5d0a66d3275d3d170692e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128563
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'svx/source/dialog')
-rw-r--r-- | svx/source/dialog/ctredlin.cxx | 62 |
1 files changed, 19 insertions, 43 deletions
diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx index 02046957ae5b..3ce4e81bb8e7 100644 --- a/svx/source/dialog/ctredlin.cxx +++ b/svx/source/dialog/ctredlin.cxx @@ -27,6 +27,8 @@ #include <svtools/ctrlbox.hxx> #include <unotools/textsearch.hxx> +#include <helpids.h> + #include <svx/ctredlin.hxx> #include <svx/dialmgr.hxx> #include <svx/strings.hrc> @@ -298,7 +300,7 @@ void SvxTPage::ActivatePage() { } -SvxTPView::SvxTPView(weld::Container* pParent, weld::Window* pDialog, weld::Builder* pTopLevel) +SvxTPView::SvxTPView(weld::Container* pParent) : SvxTPage(pParent, "svx/ui/redlineviewpage.ui", "RedlineViewPage") , bEnableAccept(true) , bEnableAcceptAll(true) @@ -307,18 +309,14 @@ SvxTPView::SvxTPView(weld::Container* pParent, weld::Window* pDialog, weld::Buil , bEnableUndo(true) , bEnableClearFormat(false) , bEnableClearFormatAll(false) - , m_pDialog(pDialog) - , m_xAccept(pTopLevel->weld_button("accept")) - , m_xReject(pTopLevel->weld_button("reject")) - , m_xAcceptAll(pTopLevel->weld_button("acceptall")) - , m_xRejectAll(pTopLevel->weld_button("rejectall")) - , m_xUndo(pTopLevel->weld_button("undo")) + , m_xAccept(m_xBuilder->weld_button("accept")) + , m_xReject(m_xBuilder->weld_button("reject")) + , m_xAcceptAll(m_xBuilder->weld_button("acceptall")) + , m_xRejectAll(m_xBuilder->weld_button("rejectall")) + , m_xUndo(m_xBuilder->weld_button("undo")) , m_xViewData(new SvxRedlinTable(m_xBuilder->weld_tree_view("writerchanges"), m_xBuilder->weld_tree_view("calcchanges"))) { - Size aControlSize(80, 65); - m_xViewData->set_size_request(aControlSize.Width(), aControlSize.Height()); - Link<weld::Button&,void> aLink=LINK( this, SvxTPView, PbClickHdl); m_xAccept->connect_clicked(aLink); @@ -366,6 +364,7 @@ void SvxRedlinTable::SetWriterView() o3tl::narrowing<int>(nDigitWidth * 20) }; pTreeView->set_column_fixed_widths(aWidths); + pTreeView->set_size_request(400, -1); } void SvxRedlinTable::SetCalcView() @@ -385,6 +384,7 @@ void SvxRedlinTable::SetCalcView() o3tl::narrowing<int>(nDigitWidth * 20) }; pTreeView->set_column_fixed_widths(aWidths); + pTreeView->set_size_request(400, -1); } void SvxTPView::EnableAccept(bool bFlag) @@ -411,40 +411,10 @@ void SvxTPView::EnableRejectAll(bool bFlag) m_xRejectAll->set_sensitive(bFlag); } -void SvxTPView::EnableClearFormatButton(weld::Button& rButton, bool bFlag) -{ - OUString sText = rButton.get_label(); - OUString sClearFormat = SvxResId(RID_SVXSTR_CLEARFORM); - sal_Int32 nPos = sText.indexOf(sClearFormat); - - // add or remove "Clear formatting" to get "Reject" or "Reject/Clear formatting" - if (bFlag) - { - if (nPos == -1) - { - rButton.set_label(sText + "/" + sClearFormat); - } - } - else - { - if (nPos > 0) - { - rButton.set_label(sText.copy(0, nPos - 1)); - } - } - - if (m_pDialog) - { - // tdf#127218 allow dialog to shrink - m_pDialog->resize_to_request(); - } -} - void SvxTPView::EnableClearFormat(bool bFlag) { if (bEnableClearFormat == bFlag) return; - EnableClearFormatButton(*m_xReject, bFlag); bEnableClearFormat = bFlag; } @@ -452,7 +422,6 @@ void SvxTPView::EnableClearFormatAll(bool bFlag) { if (bEnableClearFormatAll == bFlag) return; - EnableClearFormatButton(*m_xRejectAll, bFlag); bEnableClearFormatAll = bFlag; } @@ -991,7 +960,7 @@ IMPL_LINK_NOARG(SvxTPFilter, RefHandle, weld::Button&, void) aRefLink.Call(this); } -SvxAcceptChgCtr::SvxAcceptChgCtr(weld::Container* pParent, weld::Window* pDialog, weld::Builder* pTopLevel) +SvxAcceptChgCtr::SvxAcceptChgCtr(weld::Container* pParent) : m_xBuilder(Application::CreateBuilder(pParent, "svx/ui/redlinecontrol.ui")) , m_xTabCtrl(m_xBuilder->weld_notebook("tabcontrol")) { @@ -999,9 +968,10 @@ SvxAcceptChgCtr::SvxAcceptChgCtr(weld::Container* pParent, weld::Window* pDialog m_xTabCtrl->connect_leave_page(LINK(this, SvxAcceptChgCtr, DeactivatePageHdl)); m_xTPFilter.reset(new SvxTPFilter(m_xTabCtrl->get_page("filter"))); - m_xTPView.reset(new SvxTPView(m_xTabCtrl->get_page("view"), pDialog, pTopLevel)); + m_xTPView.reset(new SvxTPView(m_xTabCtrl->get_page("view"))); m_xTPFilter->SetRedlinTable(m_xTPView->GetTableControl()); m_xTabCtrl->set_current_page("view"); + m_xTabCtrl->set_help_id(HID_REDLINE_CTRL_VIEW); m_xTabCtrl->show(); } @@ -1019,9 +989,15 @@ void SvxAcceptChgCtr::ShowFilterPage() IMPL_LINK(SvxAcceptChgCtr, ActivatePageHdl, const OString&, rPage, void) { if (rPage == "filter") + { m_xTPFilter->ActivatePage(); + m_xTabCtrl->set_help_id(HID_REDLINE_CTRL_FILTER); + } else if (rPage == "view") + { m_xTPView->ActivatePage(); + m_xTabCtrl->set_help_id(HID_REDLINE_CTRL_VIEW); + } } IMPL_LINK(SvxAcceptChgCtr, DeactivatePageHdl, const OString&, rPage, bool) |