summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-02-03 17:02:26 +0530
committerpranavk <pranavk@collabora.co.uk>2017-02-06 03:43:12 +0000
commita51faf9ead8ab3797e9a70bf2e487f26643ce9d0 (patch)
treee294949bdd2b954ca4d78a74463f1253ae514f07
parent5596b3f86f753b7ae0a262ccea84c6a61bdc9ca2 (diff)
lok: Emit modify comment callback when anchor changes
Change-Id: Ibe4a66b93768eb446a04cab8cfdd4bdebee13d1f Reviewed-on: https://gerrit.libreoffice.org/33878 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: pranavk <pranavk@collabora.co.uk>
-rw-r--r--sw/inc/SidebarWin.hxx3
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx5
-rw-r--r--sw/source/uibase/docvw/SidebarWin.cxx3
3 files changed, 11 insertions, 0 deletions
diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx
index de109fb4b5c4..af4e5a41d4dc 100644
--- a/sw/inc/SidebarWin.hxx
+++ b/sw/inc/SidebarWin.hxx
@@ -82,6 +82,8 @@ class SwSidebarWin : public vcl::Window
inline Point GetAnchorPos() { return mAnchorRect.Pos(); }
inline const SwRect& GetAnchorRect() { return mAnchorRect; }
+ inline bool IsAnchorRectChanged() { return mbAnchorRectChanged; }
+ inline void ResetAnchorRectChanged() { mbAnchorRectChanged = false; }
inline const std::vector<basegfx::B2DRange>& GetAnnotationTextRanges() { return maAnnotationTextRanges; }
SwEditWin& EditWin();
inline SwSidebarItem& GetSidebarItem() { return mrSidebarItem; }
@@ -243,6 +245,7 @@ class SwSidebarWin : public vcl::Window
Rectangle mPosSize;
SwRect mAnchorRect;
long mPageBorder;
+ bool mbAnchorRectChanged;
std::vector<basegfx::B2DRange> maAnnotationTextRanges;
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 4db1d62a2a19..930948fafe74 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -873,6 +873,11 @@ void SwPostItMgr::LayoutPostIts()
{
if ((*i)->GetSidebarItem().bPendingLayout)
lcl_CommentNotification(mpView, CommentNotificationType::Add, &(*i)->GetSidebarItem(), 0);
+ else if ((*i)->IsAnchorRectChanged())
+ {
+ lcl_CommentNotification(mpView, CommentNotificationType::Modify, &(*i)->GetSidebarItem(), 0);
+ (*i)->ResetAnchorRectChanged();
+ }
}
// Layout for this post it finished now
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
index bf2523152c70..6ec2dc98e00d 100644
--- a/sw/source/uibase/docvw/SidebarWin.cxx
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
@@ -183,6 +183,7 @@ SwSidebarWin::SwSidebarWin(SwEditWin& rEditWin,
, mPosSize()
, mAnchorRect()
, mPageBorder(0)
+ , mbAnchorRectChanged(false)
, mbMouseOver(false)
, mLayoutStatus(SwPostItHelper::INVISIBLE)
, mbReadonly(false)
@@ -509,6 +510,8 @@ void SwSidebarWin::SetPosSizePixelRect(long nX, long nY, long nWidth, long nHeig
const SwRect& aAnchorRect, const long aPageBorder)
{
mPosSize = Rectangle(Point(nX,nY),Size(nWidth,nHeight));
+ if (!mAnchorRect.IsEmpty() && mAnchorRect != aAnchorRect)
+ mbAnchorRectChanged = true;
mAnchorRect = aAnchorRect;
mPageBorder = aPageBorder;
}