Kaydet (Commit) 527397ab authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Jan Holesovsky

Support drawing custom widgets in headless backend

..and fallback the headless dawing also in gtk3 where needed

Change-Id: Ic5da8fa7a04089342db8e2f334ced69691a15217
üst 63f320f6
......@@ -599,6 +599,7 @@ SvpSalGraphics::SvpSalGraphics()
, m_ePaintMode(PaintMode::Over)
, m_aTextRenderImpl(*this)
{
m_pWidgetDraw.reset(new vcl::CustomWidgetDraw(*this));
}
SvpSalGraphics::~SvpSalGraphics()
......@@ -1893,6 +1894,62 @@ bool SvpSalGraphics::drawEPS( long, long, long, long, void*, sal_uLong )
return false;
}
/* Widget drawing */
bool SvpSalGraphics::IsNativeControlSupported(ControlType eType, ControlPart ePart)
{
if (hasWidgetDraw())
return m_pWidgetDraw->isNativeControlSupported(eType, ePart);
return false;
}
bool SvpSalGraphics::hitTestNativeControl(ControlType eType, ControlPart ePart,
const tools::Rectangle& rBoundingControlRegion,
const Point& rPosition, bool& rIsInside)
{
if (hasWidgetDraw())
{
return m_pWidgetDraw->hitTestNativeControl(eType, ePart, rBoundingControlRegion, rPosition, rIsInside);
}
return false;
}
bool SvpSalGraphics::drawNativeControl(ControlType eType, ControlPart ePart,
const tools::Rectangle& rControlRegion,
ControlState eState, const ImplControlValue& aValue,
const OUString& aCaptions)
{
if (hasWidgetDraw())
{
bool bReturn = m_pWidgetDraw->drawNativeControl(eType, ePart, rControlRegion,
eState, aValue, aCaptions);
return bReturn;
}
return false;
}
bool SvpSalGraphics::getNativeControlRegion(ControlType eType, ControlPart ePart,
const tools::Rectangle& rBoundingControlRegion,
ControlState eState,
const ImplControlValue& aValue,
const OUString& aCaption,
tools::Rectangle& rNativeBoundingRegion,
tools::Rectangle& rNativeContentRegion)
{
if (hasWidgetDraw())
{
return m_pWidgetDraw->getNativeControlRegion(eType, ePart, rBoundingControlRegion,
eState, aValue, aCaption,
rNativeBoundingRegion, rNativeContentRegion);
}
return false;
}
namespace
{
bool isCairoCompatible(const BitmapBuffer* pBuffer)
......
......@@ -33,6 +33,7 @@
#include <sallayout.hxx>
#include "svpcairotextrender.hxx"
#include <impfontmetricdata.hxx>
#include <headless/CustomWidgetDraw.hxx>
#include <cairo.h>
......@@ -259,6 +260,26 @@ public:
virtual SystemGraphicsData GetGraphicsData() const override;
// Native Widget Drawing interface
bool IsNativeControlSupported(ControlType eType, ControlPart ePart) override;
bool hitTestNativeControl(ControlType eType, ControlPart ePart,
const tools::Rectangle& rBoundingControlRegion,
const Point& rPosition, bool& rIsInside) override;
bool drawNativeControl(ControlType eType, ControlPart ePart,
const tools::Rectangle& rBoundingControlRegion,
ControlState eState, const ImplControlValue& aValue,
const OUString& aCaptions) override;
bool getNativeControlRegion(ControlType eType, ControlPart ePart,
const tools::Rectangle& rBoundingControlRegion,
ControlState eState,
const ImplControlValue& aValue,
const OUString& aCaption,
tools::Rectangle& rNativeBoundingRegion,
tools::Rectangle& rNativeContentRegion) override;
#if ENABLE_CAIRO_CANVAS
virtual bool SupportsCairo() const override;
virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
......
......@@ -21,9 +21,6 @@
bool SalGraphics::IsNativeControlSupported(ControlType eType, ControlPart ePart)
{
if (hasWidgetDraw())
return m_pWidgetDraw->isNativeControlSupported(eType, ePart);
return false;
}
......@@ -31,11 +28,6 @@ bool SalGraphics::hitTestNativeControl(ControlType eType, ControlPart ePart,
const tools::Rectangle& rBoundingControlRegion,
const Point& rPosition, bool& rIsInside)
{
if (hasWidgetDraw())
{
return m_pWidgetDraw->hitTestNativeControl(eType, ePart, rBoundingControlRegion, rPosition, rIsInside);
}
return false;
}
......@@ -44,12 +36,6 @@ bool SalGraphics::drawNativeControl(ControlType eType, ControlPart ePart,
ControlState eState, const ImplControlValue& aValue,
const OUString& aCaptions)
{
if (hasWidgetDraw())
{
return m_pWidgetDraw->drawNativeControl(eType, ePart, rBoundingControlRegion,
eState, aValue, aCaptions);
}
return false;
}
......@@ -61,13 +47,6 @@ bool SalGraphics::getNativeControlRegion(ControlType eType, ControlPart ePart,
tools::Rectangle& rNativeBoundingRegion,
tools::Rectangle& rNativeContentRegion)
{
if (hasWidgetDraw())
{
return m_pWidgetDraw->getNativeControlRegion(eType, ePart, rBoundingControlRegion,
eState, aValue, aCaption,
rNativeBoundingRegion, rNativeContentRegion);
}
return false;
}
......
......@@ -2172,8 +2172,8 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
{
if (m_pWidgetDraw)
{
bool bReturn = m_pWidgetDraw->drawNativeControl(nType, nPart, rControlRegion,
nState, rValue, aCaptions);
bool bReturn = SvpSalGraphics::drawNativeControl(nType, nPart, rControlRegion,
nState, rValue, aCaptions);
if (bReturn && !rControlRegion.IsEmpty())
mpFrame->damaged(rControlRegion.Left(), rControlRegion.Top(), rControlRegion.GetWidth(), rControlRegion.GetHeight());
......
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