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

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