sw/inc/viewsh.hxx | 2 +- sw/source/core/txtnode/ndtxt.cxx | 2 +- sw/source/uibase/inc/wrtsh.hxx | 2 ++ sw/source/uibase/wrtsh/wrtsh3.cxx | 5 +++++ 4 files changed, 9 insertions(+), 2 deletions(-)
New commits: commit 93fe03c05987434df95d4dea2dcf45fd76020f63 Author: Michael Stahl <[email protected]> AuthorDate: Thu May 15 13:22:38 2025 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Fri May 16 16:10:29 2025 +0200 LOCRDT sw: fix multiple view shell problems CppunitTest_desktop_lib testCommentsCallbacksWriter uses 2 view shells to insert comments. The first problem is that SwTextNode::Update() avoids moving the wrong (i.e. current shell's) cursor, because it uses SwDocShell::m_pWrtShell to check if it's the current shell, but only DocumentLayoutManager::mpCurrentView has the correct value. The other problem is that SwViewShell::GetPostItMgr() also uses SwDocShell::m_pWrtShell and so doesn't return its own m_rView's one, hence a loop over all shells always uses the same SwPostItMgr. Change-Id: I043602f88f2f458532224554e5c13de7d37081c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185400 Reviewed-by: Michael Stahl <[email protected]> Tested-by: Jenkins diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 7fc852b75e6e..dc2b09f4440a 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -611,7 +611,7 @@ public: void DeleteReplacementBitmaps(); const SwPostItMgr* GetPostItMgr() const { return const_cast<SwViewShell*>(this)->GetPostItMgr(); } - SW_DLLPUBLIC SwPostItMgr* GetPostItMgr(); + SW_DLLPUBLIC virtual SwPostItMgr* GetPostItMgr(); /// Acts both for headers / footers, depending on the bShow(Header|Footer)Separator flags void ToggleHeaderFooterEdit(); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 2a0fb2e744ee..d9a2abf9f6e7 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1582,7 +1582,7 @@ void SwTextNode::Update( for (SwViewShell& rShell : pDocShell->GetWrtShell()->GetRingContainer()) { auto pWrtShell = dynamic_cast<SwWrtShell*>(&rShell); - if (!pWrtShell || pWrtShell == pDocShell->GetWrtShell()) + if (!pWrtShell || pWrtShell == dynamic_cast<SwWrtShell*>(GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell())) continue; SwShellCursor* pCursor = pWrtShell->GetCursor_(); diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index 5a760b1eca65..e7fb0e447817 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -491,6 +491,8 @@ typedef bool (SwWrtShell::*FNSimpleMove)(); const SwViewOption *pViewOpt); virtual ~SwWrtShell() override; + SW_DLLPUBLIC virtual SwPostItMgr* GetPostItMgr() override; + bool TryRemoveIndent(); // #i23725# OUString GetSelDescr() const; diff --git a/sw/source/uibase/wrtsh/wrtsh3.cxx b/sw/source/uibase/wrtsh/wrtsh3.cxx index b476e1ee088e..bafb1bd19957 100644 --- a/sw/source/uibase/wrtsh/wrtsh3.cxx +++ b/sw/source/uibase/wrtsh/wrtsh3.cxx @@ -389,4 +389,9 @@ bool SwWrtShell::GetURLFromButton( OUString& rURL, OUString& rDescr ) const return bRet; } +SwPostItMgr* SwWrtShell::GetPostItMgr() +{ + return m_rView.GetPostItMgr(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
