summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2017-05-11 13:08:02 +0200
committerJan Holesovsky <kendy@collabora.com>2017-05-11 17:59:11 +0200
commit108ea1dcf1d92bd87f8154d58458bf39c6965947 (patch)
tree9d8bce01308290bec624b77afcad8fb5e6a4e42e /sw
parentfa1872e682ad842918ed9d5eeb8462181ab6adc0 (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> (cherry picked from commit b973b184a0870ad70e2db4e0e3842cf208b87abf) Reviewed-on: https://gerrit.libreoffice.org/37514 Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/docredln.cxx54
1 files changed, 54 insertions, 0 deletions
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 2f18017842e6..9a4f4a583cb2 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;