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

sw lok annotations: paint all child window

And use map modes to get the painting to the correct position instead of
manually adjusting each and every Paint() method.

Change-Id: I66798321b8bbf2c7968d6ac1edebb1f8df60bce8
üst cc68b830
......@@ -855,10 +855,17 @@ void SwPostItMgr::PaintTile(OutputDevice& rRenderContext, const Rectangle& /*rRe
if (!pPostIt)
continue;
Point aPoint(mpEditWin->PixelToLogic(pPostIt->GetPosPixel()));
rRenderContext.Push(PushFlags::MAPMODE);
Point aOffset(mpEditWin->PixelToLogic(pPostIt->GetPosPixel()));
MapMode aMapMode(rRenderContext.GetMapMode());
aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset);
rRenderContext.SetMapMode(aMapMode);
Size aSize(pPostIt->PixelToLogic(pPostIt->GetSizePixel()));
Rectangle aRectangle(aPoint, aSize);
Rectangle aRectangle(Point(0, 0), aSize);
pPostIt->PaintTile(rRenderContext, aRectangle);
rRenderContext.Pop();
}
}
......
......@@ -53,7 +53,6 @@
#include <shellres.hxx>
#include <SwRewriter.hxx>
#include <memory>
#include <comphelper/lok.hxx>
namespace sw { namespace sidebarwindows {
......@@ -152,37 +151,25 @@ 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(aPoint, rRenderContext.PixelToLogic(GetSizePixel())),
rRenderContext.DrawGradient(Rectangle(Point(0,0), rRenderContext.PixelToLogic(GetSizePixel())),
Gradient(GradientStyle_LINEAR, mrSidebarWin.ColorDark(), mrSidebarWin.ColorDark()));
}
else
{
rRenderContext.DrawGradient(Rectangle(aPoint, rRenderContext.PixelToLogic(GetSizePixel())),
rRenderContext.DrawGradient(Rectangle(Point(0,0), rRenderContext.PixelToLogic(GetSizePixel())),
Gradient(GradientStyle_LINEAR, mrSidebarWin.ColorLight(), mrSidebarWin.ColorDark()));
}
}
if (GetTextView())
{
if (comphelper::LibreOfficeKit::isActive())
GetTextView()->GetOutliner()->Draw(&rRenderContext, rRect);
else
GetTextView()->Paint(rRect, &rRenderContext);
GetTextView()->Paint(rRect, &rRenderContext);
}
if (mrSidebarWin.GetLayoutStatus() == SwPostItHelper::DELETED)
......
......@@ -69,7 +69,6 @@ class SidebarTextControl : public Control
virtual css::uno::Reference< css::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
......
......@@ -246,10 +246,15 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle
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);
rRenderContext.Push(PushFlags::MAPMODE);
Point aOffset(PixelToLogic(pChild->GetPosPixel()));
MapMode aMapMode(rRenderContext.GetMapMode());
aMapMode.SetOrigin(aMapMode.GetOrigin() + aOffset);
rRenderContext.SetMapMode(aMapMode);
pChild->Paint(rRenderContext, rRect);
rRenderContext.Pop();
}
}
......
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