[Libreoffice-commits] core.git: sw/inc sw/source

Pranav Kant pranavk at collabora.co.uk
Mon Feb 6 03:43:59 UTC 2017


 sw/inc/SidebarWin.hxx                 |    3 +++
 sw/source/uibase/docvw/PostItMgr.cxx  |    5 +++++
 sw/source/uibase/docvw/SidebarWin.cxx |    3 +++
 3 files changed, 11 insertions(+)

New commits:
commit a51faf9ead8ab3797e9a70bf2e487f26643ce9d0
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Feb 3 17:02:26 2017 +0530

    lok: Emit modify comment callback when anchor changes
    
    Change-Id: Ibe4a66b93768eb446a04cab8cfdd4bdebee13d1f
    Reviewed-on: https://gerrit.libreoffice.org/33878
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: pranavk <pranavk at collabora.co.uk>

diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx
index de109fb..af4e5a4 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 4db1d62..930948f 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 bf25231..6ec2dc9 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;
 }


More information about the Libreoffice-commits mailing list