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