Kaydet (Commit) d54aaea3 authored tarafından Miklos Vajna's avatar Miklos Vajna

sw tiled rendering: initial annotation support

Change-Id: I4fcb05f8a58965341cf44a1b7e2367b5cbff981d
üst eafd3ee3
......@@ -285,6 +285,7 @@ class SwPostItMgr: public SfxListener
std::vector< vcl::Window* >* pChildren );
void DrawNotesForPage(OutputDevice *pOutDev, sal_uInt32 nPage);
void PaintTile(OutputDevice& rRenderContext, const Rectangle& rRect);
};
#endif
......
......@@ -177,6 +177,7 @@ class SwSidebarWin : public vcl::Window
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() override;
virtual void Draw(OutputDevice* pDev, const Point&, const Size&, DrawFlags) override;
void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
protected:
virtual void DataChanged( const DataChangedEvent& aEvent) override;
......
......@@ -1900,6 +1900,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;
......
......@@ -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");
......
......@@ -53,6 +53,7 @@
#include <shellres.hxx>
#include <SwRewriter.hxx>
#include <memory>
#include <comphelper/lok.hxx>
namespace sw { namespace sidebarwindows {
......@@ -151,25 +152,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)
......
......@@ -69,6 +69,7 @@ class SidebarTextControl : public Control
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() override;
virtual void Draw(OutputDevice* pDev, const Point&, const Size&, DrawFlags) override;
void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
};
} } // end of namespace sw::sidebarwindows
......
......@@ -80,6 +80,7 @@
#include <drawinglayer/processor2d/processorfromoutputdevice.hxx>
#include <drawinglayer/primitive2d/shadowprimitive2d.hxx>
#include <memory>
#include <comphelper/lok.hxx>
namespace sw { namespace sidebarwindows {
......@@ -230,7 +231,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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment