diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2017-05-11 13:08:02 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-05-11 17:55:01 +0200 |
commit | b973b184a0870ad70e2db4e0e3842cf208b87abf (patch) | |
tree | c749c88646c1e397cde5357c676db643e9f76aa9 | |
parent | 99c99e3c7546f98b3d21301e6160772ee9f47fc0 (diff) |
lok: sw: change tracking: deleted characters aren't deleted right away
Problem:
Start/open a document in CS Writer, and enable track changes.
- Type a few characters.
- Delete a couple of them with backspace or delete.
=> The deleted characters are still shown in the document (but not in
the tracking comment).
Findings:
In SwViewShell::ImplEndAction pRegion is 0, so no call to
SwRootFrame::Paint->vcl::Window::Invalidate occurs.
That is due to the fact that the call to SwLayAction::Action() does
not lead to populating *pRegion with rectangles
(SwViewShellImp::AddPaintRect).
In fact we stop at SwLayAction::TurboAction_ since pCnt->IsValid()
returns true and so SwLayAction::PaintContent() is never invoked.
SwFrame::IsValid() returns: mbValidPos && mbValidSize &&
mbValidPrtArea.
Here SwFrame::mbValidSize is the one that makes the difference: it is
true in Online and false in Desktop. (In our case the other 2 data
members are always true).
The reason is that the computation of the text range
(SwShellCursor::FillRects) in SwRedlineTable::LOKRedlineNotification,
which occurs just before collecting paint rectangles, leads to invoke
SwContentFrame::MakeAll which in turns set SwFrame::mbValidSize to
true.
Solution:
Call SwFrame::InvalidateSize() on any frame on which MakeAll is
invoked soon after we finish to compute the text range in
SwRedlineTable::LOKRedlineNotification.
Change-Id: Id5e29b06c044f14207722e67d6f5facbf786ffa6
Reviewed-on: https://gerrit.libreoffice.org/37508
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r-- | sw/source/core/doc/docredln.cxx | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index ae4f346a9c9e..0490bd63ff7e 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -58,6 +58,8 @@ #include <unoport.hxx> #include <wrtsh.hxx> +#include "flowfrm.hxx" + using namespace com::sun::star; #ifdef DBG_UTIL @@ -301,6 +303,56 @@ bool SwExtraRedlineTable::DeleteTableCellRedline( SwDoc* pDoc, const SwTableBox& return bChg; } +namespace +{ + +void lcl_LOKInvalidateFrames(const SwModify& rMod, const SwRootFrame* pLayout, + SwFrameType const nFrameType, const Point* pPoint) +{ + SwIterator<SwFrame,SwModify> aIter( rMod ); + + for (SwFrame* pTmpFrame = aIter.First(); pTmpFrame; pTmpFrame = aIter.Next() ) + { + if ((pTmpFrame->GetType() & nFrameType) && + (!pLayout || pLayout == pTmpFrame->getRootFrame()) && + (!pTmpFrame->IsFlowFrame() || !SwFlowFrame::CastFlowFrame( pTmpFrame )->IsFollow())) + { + if (pPoint) + { + pTmpFrame->InvalidateSize(); + } + } + } +} + +void lcl_LOKInvalidateStartEndFrames(SwShellCursor& rCursor) +{ + if (!(rCursor.HasMark() && + rCursor.GetPoint()->nNode.GetNode().IsContentNode() && + rCursor.GetPoint()->nNode.GetNode().GetContentNode()->getLayoutFrame(rCursor.GetShell()->GetLayout()) && + (rCursor.GetMark()->nNode == rCursor.GetPoint()->nNode || + (rCursor.GetMark()->nNode.GetNode().IsContentNode() && + rCursor.GetMark()->nNode.GetNode().GetContentNode()->getLayoutFrame(rCursor.GetShell()->GetLayout()))))) + { + return; + } + + + SwPosition *pStartPos = rCursor.Start(), + *pEndPos = rCursor.GetPoint() == pStartPos ? rCursor.GetMark() : rCursor.GetPoint(); + + + lcl_LOKInvalidateFrames(*(pStartPos->nNode.GetNode().GetContentNode()), + rCursor.GetShell()->GetLayout(), + FRM_CNTNT, &rCursor.GetSttPos()); + + lcl_LOKInvalidateFrames(*(pEndPos->nNode.GetNode().GetContentNode()), + rCursor.GetShell()->GetLayout(), + FRM_CNTNT, &rCursor.GetEndPos()); +} + +} // anonymous namespace + /// Emits LOK notification about one addition / removal of a redline item. void SwRedlineTable::LOKRedlineNotification(RedlineNotification nType, SwRangeRedline* pRedline) { @@ -339,6 +391,8 @@ void SwRedlineTable::LOKRedlineNotification(RedlineNotification nType, SwRangeRe const OString sRects = comphelper::string::join("; ", aRects); aRedline.put("textRange", sRects.getStr()); + + lcl_LOKInvalidateStartEndFrames(aCursor); } boost::property_tree::ptree aTree; |