diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2018-03-05 04:47:34 +0100 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2018-03-05 07:08:56 +0100 |
commit | b687cebfb1488341853824de1a15c06175c94258 (patch) | |
tree | af3988a5308fe65349ea4a4d6e6eb026e6424f55 /sw/source | |
parent | ab63510e104c4b8e42982390357af1281c4b11a7 (diff) |
bccu#3100: Writer: Change tracking boxes aren't repositioned with editing
Emit a notification related to the node position change, so the track changes
comment box is repositioned when the text node changes it's position.
Change-Id: I34b5ec453b3dc43895865f15d71aaead46ae6f24
Reviewed-on: https://gerrit.libreoffice.org/50640
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/doc/docredln.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/inc/frame.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/inc/txtfrm.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/frmform.cxx | 21 |
4 files changed, 36 insertions, 1 deletions
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 2519c0e99850..bb1a5a9029c6 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -1083,6 +1083,18 @@ void MaybeNotifyRedlineModification(SwRangeRedline* pRedline, SwDoc* pDoc) } } +void SwRangeRedline::MaybeNotifyRedlinePositionModification(long nTop) +{ + if (!comphelper::LibreOfficeKit::isActive()) + return; + + if(!m_oLOKLastNodeTop || *m_oLOKLastNodeTop != nTop) + { + m_oLOKLastNodeTop = nTop; + SwRedlineTable::LOKRedlineNotification(RedlineNotification::Modify, this); + } +} + void SwRangeRedline::SetStart( const SwPosition& rPos, SwPosition* pSttPtr ) { if( !pSttPtr ) pSttPtr = Start(); diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 77c7b9802c80..379bf08f829a 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -426,7 +426,7 @@ protected: SwPageFrame *InsertPage( SwPageFrame *pSibling, bool bFootnote ); void PrepareMake(vcl::RenderContext* pRenderContext); void OptPrepareMake(); - void MakePos(); + virtual void MakePos(); // Format next frame of table frame to assure keeping attributes. // In case of nested tables method <SwFrame::MakeAll()> is called to // avoid formatting of superior table frame. diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx index be1c5e2c6273..d332122689d7 100644 --- a/sw/source/core/inc/txtfrm.hxx +++ b/sw/source/core/inc/txtfrm.hxx @@ -154,6 +154,8 @@ class SW_DLLPUBLIC SwTextFrame: public SwContentFrame // Formats the Follow and ensures disposing on orphans bool CalcFollow( const sal_Int32 nTextOfst ); + virtual void MakePos() override; + // Corrects the position from which we need to format static sal_Int32 FindBrk(const OUString &rText, const sal_Int32 nStart, const sal_Int32 nEnd); diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index c1300fd40938..54a8bea78782 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -52,6 +52,8 @@ #include "portab.hxx" #include <editeng/lrspitem.hxx> #include <editeng/tstpitem.hxx> +#include <redline.hxx> +#include <comphelper/lok.hxx> // Tolerance in formatting and text output #define SLOPPY_TWIPS 5 @@ -343,6 +345,25 @@ bool SwTextFrame::CalcFollow( const sal_Int32 nTextOfst ) return false; } +void SwTextFrame::MakePos() +{ + SwFrame::MakePos(); + // Inform LOK clients about change in position of redlines (if any) + if(comphelper::LibreOfficeKit::isActive()) + { + const SwTextNode& rTextNode = *GetTextNode(); + const SwRedlineTable& rTable = rTextNode.getIDocumentRedlineAccess().GetRedlineTable(); + for (SwRedlineTable::size_type nRedlnPos = 0; nRedlnPos < rTable.size(); ++nRedlnPos) + { + SwRangeRedline* pRedln = rTable[nRedlnPos]; + if (rTextNode.GetIndex() == pRedln->GetPoint()->nNode.GetNode().GetIndex()) + { + pRedln->MaybeNotifyRedlinePositionModification(getFrameArea().Top()); + } + } + } +} + void SwTextFrame::AdjustFrame( const SwTwips nChgHght, bool bHasToFit ) { vcl::RenderContext* pRenderContext = getRootFrame()->GetCurrShell()->GetOut(); |