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

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


 sw/inc/SidebarWin.hxx                |    1 +
 sw/inc/postithelper.hxx              |    2 ++
 sw/source/uibase/docvw/PostItMgr.cxx |   27 ++++++++++++++++-----------
 3 files changed, 19 insertions(+), 11 deletions(-)

New commits:
commit 5596b3f86f753b7ae0a262ccea84c6a61bdc9ca2
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Fri Feb 3 17:00:51 2017 +0530

    lok: comments: emit add callback after layout finishes
    
    Change-Id: Ie6eba244dd5eb78813185f8c7aceed841d05d48b
    Reviewed-on: https://gerrit.libreoffice.org/33877
    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 4d114b8..de109fb 100644
--- a/sw/inc/SidebarWin.hxx
+++ b/sw/inc/SidebarWin.hxx
@@ -84,6 +84,7 @@ class SwSidebarWin : public vcl::Window
         inline const SwRect& GetAnchorRect() { return mAnchorRect; }
         inline const std::vector<basegfx::B2DRange>& GetAnnotationTextRanges() { return maAnnotationTextRanges; }
         SwEditWin& EditWin();
+        inline SwSidebarItem& GetSidebarItem() { return mrSidebarItem; }
 
         inline OutlinerView* GetOutlinerView() { return mpOutlinerView;}
         bool HasScrollbar() const;
diff --git a/sw/inc/postithelper.hxx b/sw/inc/postithelper.hxx
index 74857a1..2d89cbc 100644
--- a/sw/inc/postithelper.hxx
+++ b/sw/inc/postithelper.hxx
@@ -92,6 +92,7 @@ public:
     VclPtr<sw::sidebarwindows::SwSidebarWin> pPostIt;
     bool bShow;
     bool bFocus;
+    bool bPendingLayout;
 
     SwPostItHelper::SwLayoutStatus mLayoutStatus;
     SwLayoutInfo maLayoutInfo;
@@ -100,6 +101,7 @@ public:
         : pPostIt(nullptr)
         , bShow(true)
         , bFocus(aFocus)
+        , bPendingLayout(false)
         , mLayoutStatus( SwPostItHelper::INVISIBLE )
         , maLayoutInfo()
     {
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index 5e07b2e..4db1d62 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -355,17 +355,9 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
                     if (bEmpty && !mvPostItFields.empty())
                         PrepareView(true);
 
-                    // If LOK has disabled tiled annotations, emit annotation callbacks
-                    if (comphelper::LibreOfficeKit::isActive() && !comphelper::LibreOfficeKit::isTiledAnnotations())
-                    {
-                        CalcRects();
-                        Show();
-
-                        if (pItem && pItem->pPostIt)
-                        {
-                            lcl_CommentNotification(mpView, CommentNotificationType::Add, pItem, 0);
-                        }
-                    }
+                    // True until the layout of this post it finishes
+                    if (pItem)
+                        pItem->bPendingLayout = true;
                 }
                 else
                 {
@@ -874,6 +866,19 @@ void SwPostItMgr::LayoutPostIts()
                     pPage->bScrollbar = false;
                     bUpdate = (bOldScrollbar != pPage->bScrollbar) || bUpdate;
                 }
+
+                for(SwSidebarWin_iterator i = aVisiblePostItList.begin(); i != aVisiblePostItList.end() ; ++i)
+                {
+                    if (comphelper::LibreOfficeKit::isActive() && !comphelper::LibreOfficeKit::isTiledAnnotations())
+                    {
+                        if ((*i)->GetSidebarItem().bPendingLayout)
+                            lcl_CommentNotification(mpView, CommentNotificationType::Add, &(*i)->GetSidebarItem(), 0);
+                    }
+
+                    // Layout for this post it finished now
+                    (*i)->GetSidebarItem().bPendingLayout = false;
+                }
+
                 aVisiblePostItList.clear();
             }
             else


More information about the Libreoffice-commits mailing list