Kaydet (Commit) 93a5544c 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.

(cherry picked from commit 177e375d)

Conflicts:
	sw/source/uibase/docvw/SidebarTxtControl.cxx
	sw/source/uibase/docvw/SidebarTxtControl.hxx

Change-Id: I66798321b8bbf2c7968d6ac1edebb1f8df60bce8
üst 266f8b8a
...@@ -855,10 +855,17 @@ void SwPostItMgr::PaintTile(OutputDevice& rRenderContext, const Rectangle& /*rRe ...@@ -855,10 +855,17 @@ void SwPostItMgr::PaintTile(OutputDevice& rRenderContext, const Rectangle& /*rRe
if (!pPostIt) if (!pPostIt)
continue; 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())); Size aSize(pPostIt->PixelToLogic(pPostIt->GetSizePixel()));
Rectangle aRectangle(aPoint, aSize); Rectangle aRectangle(Point(0, 0), aSize);
pPostIt->PaintTile(rRenderContext, aRectangle); pPostIt->PaintTile(rRenderContext, aRectangle);
rRenderContext.Pop();
} }
} }
......
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
#include <shellres.hxx> #include <shellres.hxx>
#include <SwRewriter.hxx> #include <SwRewriter.hxx>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <comphelper/lok.hxx>
namespace sw { namespace sidebarwindows { namespace sw { namespace sidebarwindows {
...@@ -152,37 +151,25 @@ void SidebarTextControl::Draw(OutputDevice* pDev, const Point& rPt, const Size& ...@@ -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) 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 (!rRenderContext.GetSettings().GetStyleSettings().GetHighContrastMode())
{ {
if (mrSidebarWin.IsMouseOverSidebarWin() || HasFocus()) 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())); Gradient(GradientStyle_LINEAR, mrSidebarWin.ColorDark(), mrSidebarWin.ColorDark()));
} }
else else
{ {
rRenderContext.DrawGradient(Rectangle(aPoint, rRenderContext.PixelToLogic(GetSizePixel())), rRenderContext.DrawGradient(Rectangle(Point(0,0), rRenderContext.PixelToLogic(GetSizePixel())),
Gradient(GradientStyle_LINEAR, mrSidebarWin.ColorLight(), mrSidebarWin.ColorDark())); Gradient(GradientStyle_LINEAR, mrSidebarWin.ColorLight(), mrSidebarWin.ColorDark()));
} }
} }
if (GetTextView()) if (GetTextView())
{ {
if (comphelper::LibreOfficeKit::isActive()) GetTextView()->Paint(rRect, &rRenderContext);
GetTextView()->GetOutliner()->Draw(&rRenderContext, rRect);
else
GetTextView()->Paint(rRect, &rRenderContext);
} }
if (mrSidebarWin.GetLayoutStatus() == SwPostItHelper::DELETED) if (mrSidebarWin.GetLayoutStatus() == SwPostItHelper::DELETED)
......
...@@ -69,7 +69,6 @@ class SidebarTextControl : public Control ...@@ -69,7 +69,6 @@ class SidebarTextControl : public Control
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE; 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) SAL_OVERRIDE;
void PaintTile(vcl::RenderContext& rRenderContext, const Rectangle& rRect);
}; };
} } // end of namespace sw::sidebarwindows } } // end of namespace sw::sidebarwindows
......
...@@ -246,10 +246,15 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle ...@@ -246,10 +246,15 @@ void SwSidebarWin::PaintTile(vcl::RenderContext& rRenderContext, const Rectangle
for (sal_uInt16 i = 0; i < GetChildCount(); ++i) for (sal_uInt16 i = 0; i < GetChildCount(); ++i)
{ {
vcl::Window* pChild = GetChild(i); vcl::Window* pChild = GetChild(i);
if (pChild == mpSidebarTextControl.get()) rRenderContext.Push(PushFlags::MAPMODE);
mpSidebarTextControl->PaintTile(rRenderContext, rRect); Point aOffset(PixelToLogic(pChild->GetPosPixel()));
else MapMode aMapMode(rRenderContext.GetMapMode());
SAL_WARN("sw.uibase", "SwSidebarWin::PaintTile: unhandled child " << pChild); 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