summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2024-06-27 19:50:57 -0800
committerJim Raykowski <raykowj@gmail.com>2024-07-06 23:55:46 +0200
commitadad59c6f71532488b54804c09f0ecb7663b3a22 (patch)
tree4c37fde02e541b5bac1d6f77b6b7bab122e1c708
parentf960d27f158372d4f2d28cd84fee74742f7fbe4d (diff)
tdf#161717 Enhancement to identify click on tracked change in the
document by highlighting the corrosponding entry in the "Manage Changes" dialog and sidebar panel Change-Id: I1f31580a4fe764dd800c6db1e9a4e2024db14c6d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169692 Reviewed-by: Jim Raykowski <raykowj@gmail.com> Tested-by: Jenkins
-rw-r--r--include/svl/hint.hxx1
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx10
-rw-r--r--sw/source/uibase/inc/redlndlg.hxx4
-rw-r--r--sw/source/uibase/misc/redlndlg.cxx39
4 files changed, 53 insertions, 1 deletions
diff --git a/include/svl/hint.hxx b/include/svl/hint.hxx
index 3dd3db1763ea..fe636a89ec55 100644
--- a/include/svl/hint.hxx
+++ b/include/svl/hint.hxx
@@ -166,6 +166,7 @@ enum class SfxHintId {
SwRedlineDelText,
SwRedlineUnDelText,
SwMoveText,
+ SwRedlineContentAtPos,
ThisIsAnSdrHint,
ThisIsAnSfxEventHint
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 28339dde0d42..1abf300f3d86 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -5364,6 +5364,16 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
if (bCallBase)
Window::MouseButtonUp(rMEvt);
+ // tdf#161717 - Track changes: Clicking on change in document should highlight related change
+ // in "Manage Changes" window/sidebar
+ if (SwContentAtPos aRedlineContentAtPos(IsAttrAtPos::Redline);
+ rSh.GetContentAtPos(aDocPt, aRedlineContentAtPos))
+ {
+ SwDocShell* pDocSh = m_rView.GetDocShell();
+ if (pDocSh)
+ pDocSh->Broadcast(SfxHint(SfxHintId::SwRedlineContentAtPos));
+ }
+
if (!(pSdrView && rMEvt.GetClicks() == 1 && comphelper::LibreOfficeKit::isActive()))
return;
diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx
index 6330d194fb13..b0c53e00f350 100644
--- a/sw/source/uibase/inc/redlndlg.hxx
+++ b/sw/source/uibase/inc/redlndlg.hxx
@@ -53,7 +53,7 @@ struct SwRedlineDataParent
class SwRedlineDataParentSortArr : public o3tl::sorted_vector<SwRedlineDataParent*, o3tl::less_ptr_to > {};
-class SW_DLLPUBLIC SwRedlineAcceptDlg final
+class SW_DLLPUBLIC SwRedlineAcceptDlg final : public SfxListener
{
std::shared_ptr<weld::Window> m_xParentDlg;
std::vector<std::unique_ptr<SwRedlineDataParent>> m_RedlineParents;
@@ -124,6 +124,8 @@ public:
void FillInfo(OUString &rExtraData) const;
void Activate();
+
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
};
class SwModelessRedlineAcceptDlg final : public SfxModelessDialogController
diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index 9a5a144b4426..5efd064889ab 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -207,6 +207,9 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(std::shared_ptr<weld::Window> xParent, we
// avoid multiple selection of the same texts:
m_aSelectTimer.SetTimeout(100);
m_aSelectTimer.SetInvokeHandler(LINK(this, SwRedlineAcceptDlg, GotoHdl));
+
+ // we want to receive SfxHintId::SwRedlineContentAtPos
+ StartListening(*(SW_MOD()->GetView()->GetDocShell()));
}
SwRedlineAcceptDlg::~SwRedlineAcceptDlg()
@@ -495,6 +498,42 @@ void SwRedlineAcceptDlg::Activate()
InitAuthors();
}
+void SwRedlineAcceptDlg::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
+{
+ if (rHint.GetId() == SfxHintId::SwRedlineContentAtPos)
+ {
+ SwView* pView = GetActiveView();
+ if (!pView)
+ return;
+
+ SwWrtShell* pSh = pView->GetWrtShellPtr();
+ if (!pSh)
+ return;
+
+ const SwRangeRedline* pRangeRedline = pSh->GetCurrRedline();
+ if (!pRangeRedline)
+ return;
+
+ const SwRedlineData& rRedlineData = pRangeRedline->GetRedlineData();
+
+ weld::TreeView& rTreeView = m_pTable->GetWidget();
+ rTreeView.all_foreach([&rTreeView, &rRedlineData](weld::TreeIter& rIter) {
+ RedlinData* pRedlinData = weld::fromId<RedlinData*>(rTreeView.get_id(rIter));
+ const SwRedlineData* pRedlineData;
+ if (rTreeView.iter_has_child(rIter))
+ pRedlineData = static_cast<SwRedlineDataParent*>(pRedlinData->pData)->pData;
+ else
+ pRedlineData = static_cast<SwRedlineDataChild*>(pRedlinData->pData)->pChild;
+ if (pRedlineData == &rRedlineData)
+ {
+ rTreeView.set_cursor(rIter);
+ return true;
+ }
+ return false;
+ });
+ }
+}
+
SwRedlineTable::size_type SwRedlineAcceptDlg::CalcDiff(SwRedlineTable::size_type nStart, bool bChild)
{
if (!nStart || m_bHasTrackedColumn)