Blame SOURCES/0281-sw-tiled-rendering-initial-annotation-support.patch

135360
From 610c160a9762e222182af0de12972fa0924954fd Mon Sep 17 00:00:00 2001
135360
From: Miklos Vajna <vmiklos@collabora.co.uk>
135360
Date: Thu, 5 Nov 2015 15:58:55 +0100
135360
Subject: [PATCH 281/398] sw tiled rendering: initial annotation support
135360
135360
(cherry picked from commit d54aaea33bf2dab86c0ead4bd142c593d017f930)
135360
135360
Change-Id: I4fcb05f8a58965341cf44a1b7e2367b5cbff981d
135360
---
135360
 sw/inc/PostItMgr.hxx                         |  3 ++-
135360
 sw/inc/SidebarWin.hxx                        |  3 ++-
135360
 sw/source/core/view/viewsh.cxx               |  3 +++
135360
 sw/source/uibase/docvw/PostItMgr.cxx         | 15 +++++++++++++++
135360
 sw/source/uibase/docvw/SidebarTxtControl.cxx | 20 +++++++++++++++++---
135360
 sw/source/uibase/docvw/SidebarTxtControl.hxx |  3 ++-
135360
 sw/source/uibase/docvw/SidebarWin.cxx        | 22 +++++++++++++++++++++-
135360
 7 files changed, 62 insertions(+), 7 deletions(-)
135360
135360
diff --git a/sw/inc/PostItMgr.hxx b/sw/inc/PostItMgr.hxx
135360
index 8d1ddd0d65f8..f306f57ba86c 100644
135360
--- a/sw/inc/PostItMgr.hxx
135360
+++ b/sw/inc/PostItMgr.hxx
135360
@@ -287,7 +287,8 @@ class SwPostItMgr: public SfxListener
135360
             void GetAllSidebarWinForFrm( const SwFrm& rFrm,
135360
                                          std::vector< vcl::Window* >* pChildren );
135360
 
135360
-            void DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage);
135360
+        void DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage);
135360
+        void PaintTile(OutputDevice& rRenderContext, const Rectangle& rRect);
135360
 };
135360
 
135360
 #endif
135360
diff --git a/sw/inc/SidebarWin.hxx b/sw/inc/SidebarWin.hxx
135360
index 9514ac0eca90..d21d50d5d7d5 100644
135360
--- a/sw/inc/SidebarWin.hxx
135360
+++ b/sw/inc/SidebarWin.hxx
135360
@@ -177,7 +177,8 @@ class SwSidebarWin : public vcl::Window
135360
         void ChangeSidebarItem( SwSidebarItem& rSidebarItem );
135360
         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
135360
 
135360
-        virtual void    Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) SAL_OVERRIDE;
135360
+        virtual void    Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) override;
135360
+        void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
135360
 
135360
     protected:
135360
         virtual void    DataChanged( const DataChangedEvent& aEvent) SAL_OVERRIDE;
135360
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
135360
index 92480b242089..fad9dc3552db 100644
135360
--- a/sw/source/core/view/viewsh.cxx
135360
+++ b/sw/source/core/view/viewsh.cxx
135360
@@ -1895,6 +1895,9 @@ void SwViewShell::PaintTile(VirtualDevice &rDevice, int contextWidth, int contex
135360
     // draw - works in logic coordinates
135360
     Paint(rDevice, aOutRect);
135360
 
135360
+    if (SwPostItMgr* pPostItMgr = GetPostItMgr())
135360
+        pPostItMgr->PaintTile(rDevice, aOutRect);
135360
+
135360
     // SwViewShell's output device tear down
135360
     mpOut = pSaveOut;
135360
     mbInLibreOfficeKitCallback = false;
135360
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
135360
index 98a98964dbd9..b6bc52c253d0 100644
135360
--- a/sw/source/uibase/docvw/PostItMgr.cxx
135360
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
135360
@@ -847,6 +847,21 @@ void SwPostItMgr::DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage)
135360
     }
135360
 }
135360
 
135360
+void SwPostItMgr::PaintTile(OutputDevice& rRenderContext, const Rectangle& /*rRect*/)
135360
+{
135360
+    for (SwSidebarItem* pItem : mvPostItFields)
135360
+    {
135360
+        SwSidebarWin* pPostIt = pItem->pPostIt;
135360
+        if (!pPostIt)
135360
+            continue;
135360
+
135360
+        Point aPoint(mpEditWin->PixelToLogic(pPostIt->GetPosPixel()));
135360
+        Size aSize(pPostIt->PixelToLogic(pPostIt->GetSizePixel()));
135360
+        Rectangle aRectangle(aPoint, aSize);
135360
+        pPostIt->PaintTile(rRenderContext, aRectangle);
135360
+    }
135360
+}
135360
+
135360
 void SwPostItMgr::Scroll(const long lScroll,const unsigned long aPage)
135360
 {
135360
     OSL_ENSURE((lScroll % GetScrollSize() )==0,"SwPostItMgr::Scroll: scrolling by wrong value");
135360
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
135360
index e9e1e34afdfe..06dcfea58ff6 100644
135360
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
135360
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
135360
@@ -53,6 +53,8 @@
135360
 #include <shellres.hxx>
135360
 #include <SwRewriter.hxx>
135360
 #include <boost/scoped_ptr.hpp>
135360
+#include <memory>
135360
+#include <comphelper/lok.hxx>
135360
 
135360
 namespace sw { namespace sidebarwindows {
135360
 
135360
@@ -151,25 +153,37 @@ void SidebarTextControl::Draw(OutputDevice* pDev, const Point& rPt, const Size&
135360
     }
135360
 }
135360
 
135360
+void SidebarTextControl::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
135360
+{
135360
+    Paint(rRenderContext, rRect);
135360
+}
135360
+
135360
 void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
135360
 {
135360
+    Point aPoint(0, 0);
135360
+    if (comphelper::LibreOfficeKit::isActive())
135360
+        aPoint = rRect.TopLeft();
135360
+
135360
     if (!rRenderContext.GetSettings().GetStyleSettings().GetHighContrastMode())
135360
     {
135360
         if (mrSidebarWin.IsMouseOverSidebarWin() || HasFocus())
135360
         {
135360
-            rRenderContext.DrawGradient(Rectangle(Point(0,0), rRenderContext.PixelToLogic(GetSizePixel())),
135360
+            rRenderContext.DrawGradient(Rectangle(aPoint, rRenderContext.PixelToLogic(GetSizePixel())),
135360
                                         Gradient(GradientStyle_LINEAR, mrSidebarWin.ColorDark(), mrSidebarWin.ColorDark()));
135360
         }
135360
         else
135360
         {
135360
-            rRenderContext.DrawGradient(Rectangle(Point(0,0), rRenderContext.PixelToLogic(GetSizePixel())),
135360
+            rRenderContext.DrawGradient(Rectangle(aPoint, rRenderContext.PixelToLogic(GetSizePixel())),
135360
                            Gradient(GradientStyle_LINEAR, mrSidebarWin.ColorLight(), mrSidebarWin.ColorDark()));
135360
         }
135360
     }
135360
 
135360
     if (GetTextView())
135360
     {
135360
-        GetTextView()->Paint(rRect, &rRenderContext);
135360
+        if (comphelper::LibreOfficeKit::isActive())
135360
+            GetTextView()->GetOutliner()->Draw(&rRenderContext, rRect);
135360
+        else
135360
+            GetTextView()->Paint(rRect, &rRenderContext);
135360
     }
135360
 
135360
     if (mrSidebarWin.GetLayoutStatus() == SwPostItHelper::DELETED)
135360
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.hxx b/sw/source/uibase/docvw/SidebarTxtControl.hxx
135360
index 1a6d6677cd43..df732434ecf5 100644
135360
--- a/sw/source/uibase/docvw/SidebarTxtControl.hxx
135360
+++ b/sw/source/uibase/docvw/SidebarTxtControl.hxx
135360
@@ -68,7 +68,8 @@ class SidebarTextControl : public Control
135360
 
135360
         virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
135360
 
135360
-        virtual void Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) SAL_OVERRIDE;
135360
+        virtual void Draw(OutputDevice* pDev, const Point&, const Size&, sal_uLong) override;
135360
+        void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
135360
 };
135360
 
135360
 } } // end of namespace sw::sidebarwindows
135360
diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx
135360
index 9825839ecf33..45916b03f797 100644
135360
--- a/sw/source/uibase/docvw/SidebarWin.cxx
135360
+++ b/sw/source/uibase/docvw/SidebarWin.cxx
135360
@@ -80,6 +80,8 @@
135360
 #include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
135360
 #include <drawinglayer/primitive2d/shadowprimitive2d.hxx>
135360
 #include <boost/scoped_ptr.hpp>
135360
+#include <memory>
135360
+#include <comphelper/lok.hxx>
135360
 
135360
 namespace sw { namespace sidebarwindows {
135360
 
135360
@@ -230,7 +232,25 @@ void SwSidebarWin::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rR
135360
                              Size(GetMetaButtonAreaWidth(),
135360
                                   mpMetadataAuthor->GetSizePixel().Height() + mpMetadataDate->GetSizePixel().Height()));
135360
 
135360
-        rRenderContext.DrawRect(PixelToLogic(aRectangle));
135360
+        if (comphelper::LibreOfficeKit::isActive())
135360
+            aRectangle = rRect;
135360
+        else
135360
+            aRectangle = PixelToLogic(aRectangle);
135360
+        rRenderContext.DrawRect(aRectangle);
135360
+    }
135360
+}
135360
+
135360
+void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
135360
+{
135360
+    Paint(rRenderContext, rRect);
135360
+
135360
+    for (sal_uInt16 i = 0; i < GetChildCount(); ++i)
135360
+    {
135360
+        vcl::Window* pChild = GetChild(i);
135360
+        if (pChild == mpSidebarTextControl.get())
135360
+            mpSidebarTextControl->PaintTile(rRenderContext, rRect);
135360
+        else
135360
+            SAL_WARN("sw.uibase", "SwSidebarWin::PaintTile: unhandled child " << pChild);
135360
     }
135360
 }
135360
 
135360
-- 
135360
2.12.0
135360