summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-18 11:42:51 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-18 15:55:00 +0900
commite7a3eb586423af674599aa228ca88313fe2d2bae (patch)
treeed20dc6ecc2079cb2d4a689b05ec5606d75409f8 /reportdesign
parent22fd5e08067eaeb08bf99b6c0146734a19810d98 (diff)
refactor remaining reportdesign classes to use RenderContext
Change-Id: I23d7a2153bfc0446a972651a892eba8f6dc2bc54
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/source/ui/inc/StartMarker.hxx25
-rw-r--r--reportdesign/source/ui/report/EndMarker.cxx19
-rw-r--r--reportdesign/source/ui/report/ReportSection.cxx36
-rw-r--r--reportdesign/source/ui/report/StartMarker.cxx49
4 files changed, 70 insertions, 59 deletions
diff --git a/reportdesign/source/ui/inc/StartMarker.hxx b/reportdesign/source/ui/inc/StartMarker.hxx
index 61a03fdf406d..0fe0bc64bd99 100644
--- a/reportdesign/source/ui/inc/StartMarker.hxx
+++ b/reportdesign/source/ui/inc/StartMarker.hxx
@@ -39,12 +39,15 @@ namespace rptui
static Image* s_pDefExpanded;
static oslInterlockedCount s_nImageRefCount; /// When 0 all static images will be destroyed
- bool m_bShowRuler;
+ bool m_bShowRuler;
void changeImage();
void initDefaultNodeImages();
void setColor();
+
virtual void ImplInitSettings() SAL_OVERRIDE;
+ virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE;
+
OStartMarker(OStartMarker&) SAL_DELETED_FUNCTION;
void operator =(OStartMarker&) SAL_DELETED_FUNCTION;
public:
@@ -53,26 +56,26 @@ namespace rptui
virtual void dispose() SAL_OVERRIDE;
// SfxListener
- virtual void Notify(SfxBroadcaster & rBc, SfxHint const & rHint) SAL_OVERRIDE;
+ virtual void Notify(SfxBroadcaster & rBc, SfxHint const & rHint) SAL_OVERRIDE;
// Window overrides
- virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
- virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
- virtual void Resize() SAL_OVERRIDE;
- virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
+ virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
+ virtual void MouseButtonUp(const MouseEvent& rMEvt) SAL_OVERRIDE;
+ virtual void Resize() SAL_OVERRIDE;
+ virtual void RequestHelp(const HelpEvent& rHEvt) SAL_OVERRIDE;
using Window::Notify;
- void setTitle(const OUString& _sTitle);
- sal_Int32 getMinHeight() const;
+ void setTitle(const OUString& _sTitle);
+ sal_Int32 getMinHeight() const;
/** shows or hides the ruler.
*/
- void showRuler(bool _bShow);
+ void showRuler(bool _bShow);
- virtual void setCollapsed(bool _bCollapsed) SAL_OVERRIDE;
+ virtual void setCollapsed(bool _bCollapsed) SAL_OVERRIDE;
/** zoom the ruler and view windows
*/
- void zoom(const Fraction& _aZoom);
+ void zoom(const Fraction& _aZoom);
};
}
#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_STARTMARKER_HXX
diff --git a/reportdesign/source/ui/report/EndMarker.cxx b/reportdesign/source/ui/report/EndMarker.cxx
index f840d7902648..a1ebc7a1f45b 100644
--- a/reportdesign/source/ui/report/EndMarker.cxx
+++ b/reportdesign/source/ui/report/EndMarker.cxx
@@ -43,10 +43,10 @@ OEndMarker::~OEndMarker()
{
}
-void OEndMarker::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& /*rRect*/ )
+void OEndMarker::Paint(vcl::RenderContext& rRenderContext, const Rectangle& /*rRect*/)
{
Fraction aCornerSpace(long(CORNER_SPACE));
- aCornerSpace *= GetMapMode().GetScaleX();
+ aCornerSpace *= rRenderContext.GetMapMode().GetScaleX();
const long nCornerSpace = aCornerSpace;
Size aSize = GetSizePixel();
@@ -63,16 +63,17 @@ void OEndMarker::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle&
aStartColor.RGBtoHSB(nHue, nSat, nBri);
nSat += 40;
Color aEndColor(Color::HSBtoRGB(nHue, nSat, nBri));
- Gradient aGradient(GradientStyle_LINEAR,aStartColor,aEndColor);
+ Gradient aGradient(GradientStyle_LINEAR, aStartColor, aEndColor);
aGradient.SetSteps(static_cast<sal_uInt16>(aSize.Height()));
- DrawGradient(PixelToLogic(aPoly) ,aGradient);
- if ( m_bMarked )
+ rRenderContext.DrawGradient(PixelToLogic(aPoly), aGradient);
+ if (m_bMarked)
{
- Rectangle aRect( Point(-nCornerSpace,nCornerSpace),
- Size(aSize.Width()- nCornerSpace,aSize.Height() - nCornerSpace- nCornerSpace));
- ColorChanger aColors( this, COL_WHITE, COL_WHITE );
- DrawPolyLine(Polygon(PixelToLogic(aRect)),LineInfo(LINE_SOLID,2));
+ Rectangle aRect(Point(-nCornerSpace, nCornerSpace),
+ Size(aSize.Width() - nCornerSpace,
+ aSize.Height() - nCornerSpace - nCornerSpace));
+ ColorChanger aColors(this, COL_WHITE, COL_WHITE);
+ rRenderContext.DrawPolyLine(Polygon(PixelToLogic(aRect)), LineInfo(LINE_SOLID, 2));
}
}
diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx
index ae97c8ef5fa2..237109010c9c 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -76,23 +76,23 @@ sal_Int32 lcl_getOverlappedControlColor(/*const uno::Reference <lang::XMultiServ
}
OReportSection::OReportSection(OSectionWindow* _pParent,const uno::Reference< report::XSection >& _xSection)
-: Window(_pParent,WB_DIALOGCONTROL)
-, ::comphelper::OPropertyChangeListener(m_aMutex)
-, DropTargetHelper(this)
-,m_pPage(NULL)
-,m_pView(NULL)
-,m_pParent(_pParent)
-,m_pMulti(NULL)
-,m_pReportListener(NULL)
-,m_xSection(_xSection)
-,m_nPaintEntranceCount(0)
-,m_eMode(RPTUI_SELECT)
-,m_bDialogModelChanged(false)
+ : Window(_pParent,WB_DIALOGCONTROL)
+ , ::comphelper::OPropertyChangeListener(m_aMutex)
+ , DropTargetHelper(this)
+ , m_pPage(NULL)
+ , m_pView(NULL)
+ , m_pParent(_pParent)
+ , m_pMulti(NULL)
+ , m_pReportListener(NULL)
+ , m_xSection(_xSection)
+ , m_nPaintEntranceCount(0)
+ , m_eMode(RPTUI_SELECT)
+ , m_bDialogModelChanged(false)
{
//EnableChildTransparentMode();
SetHelpId(HID_REPORTSECTION);
- SetMapMode( MapMode( MAP_100TH_MM ) );
- SetParentClipMode( PARENTCLIPMODE_CLIP );
+ SetMapMode(MapMode(MAP_100TH_MM));
+ SetParentClipMode(PARENTCLIPMODE_CLIP);
EnableChildTransparentMode( false );
SetPaintTransparent( false );
@@ -149,7 +149,7 @@ void OReportSection::Paint( vcl::RenderContext& rRenderContext, const Rectangle&
SdrPaintWindow* pTargetPaintWindow = 0;
// mark repaint start
- if(pPgView)
+ if (pPgView)
{
pTargetPaintWindow = pPgView->GetView().BeginDrawLayers(this, aPaintRectRegion);
OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
@@ -161,11 +161,11 @@ void OReportSection::Paint( vcl::RenderContext& rRenderContext, const Rectangle&
// do paint (unbuffered) and mark repaint end
if(pPgView)
{
- pPgView->DrawLayer(0, this);
- pPgView->GetView().EndDrawLayers(*pTargetPaintWindow, true);
+ pPgView->DrawLayer(0, &rRenderContext);
+ pPgView->GetView().EndDrawLayers(*pTargetPaintWindow, &rRenderContext);
}
- m_pView->CompleteRedraw(this,aPaintRectRegion);
+ m_pView->CompleteRedraw(&rRenderContext, aPaintRectRegion);
--m_nPaintEntranceCount;
}
}
diff --git a/reportdesign/source/ui/report/StartMarker.cxx b/reportdesign/source/ui/report/StartMarker.cxx
index 789269807384..cba5aae711e3 100644
--- a/reportdesign/source/ui/report/StartMarker.cxx
+++ b/reportdesign/source/ui/report/StartMarker.cxx
@@ -99,33 +99,33 @@ void OStartMarker::dispose()
sal_Int32 OStartMarker::getMinHeight() const
{
- Fraction aExtraWidth(long(2*REPORT_EXTRA_SPACE));
+ Fraction aExtraWidth(long(2 * REPORT_EXTRA_SPACE));
aExtraWidth *= GetMapMode().GetScaleX();
- return LogicToPixel(Size(0,m_aText->GetTextHeight())).Height() + (long)aExtraWidth;
+ return LogicToPixel(Size(0, m_aText->GetTextHeight())).Height() + long(aExtraWidth);
}
-void OStartMarker::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect )
+void OStartMarker::Paint(vcl::RenderContext& rRenderContext, const Rectangle& /*rRect*/)
{
- (void)rRect;
- Size aSize = GetOutputSizePixel();
+ Size aSize = rRenderContext.GetOutputSizePixel();
long nSize = aSize.Width();
- const long nCornerWidth = long(CORNER_SPACE * (double)GetMapMode().GetScaleX());
+ const long nCornerWidth = long(CORNER_SPACE * double(GetMapMode().GetScaleX()));
- if ( isCollapsed() )
+ if (isCollapsed())
{
- SetClipRegion();
+ rRenderContext.SetClipRegion();
}
else
{
const long nVRulerWidth = m_aVRuler->GetSizePixel().Width();
nSize = aSize.Width() - nVRulerWidth;
aSize.Width() += nCornerWidth;
- SetClipRegion(vcl::Region(PixelToLogic(Rectangle(Point(),Size(nSize,aSize.Height())))));
+ rRenderContext.SetClipRegion(vcl::Region(rRenderContext.PixelToLogic(Rectangle(Point(),
+ Size(nSize, aSize.Height())))));
}
- Rectangle aWholeRect(Point(),aSize);
+ Rectangle aWholeRect(Point(), aSize);
{
- const ColorChanger aColors( this, m_nTextBoundaries, m_nColor );
+ const ColorChanger aColors(&rRenderContext, m_nTextBoundaries, m_nColor);
tools::PolyPolygon aPoly;
aPoly.Insert(Polygon(aWholeRect,nCornerWidth,nCornerWidth));
@@ -140,15 +140,17 @@ void OStartMarker::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangl
Gradient aGradient(GradientStyle_LINEAR,aStartColor,aEndColor);
aGradient.SetSteps(static_cast<sal_uInt16>(aSize.Height()));
- DrawGradient(PixelToLogic(aPoly) ,aGradient);
+ rRenderContext.DrawGradient(PixelToLogic(aPoly) ,aGradient);
}
- if ( m_bMarked )
+ if (m_bMarked)
{
- const long nCornerHeight = long(CORNER_SPACE * (double)GetMapMode().GetScaleY());
- Rectangle aRect( Point(nCornerWidth,nCornerHeight),
- Size(aSize.Width() - nCornerWidth - nCornerWidth,aSize.Height() - nCornerHeight - nCornerHeight));
- ColorChanger aColors( this, COL_WHITE, COL_WHITE );
- DrawPolyLine(Polygon(PixelToLogic(aRect)),LineInfo(LINE_SOLID,2 ));
+ const long nCornerHeight = long(CORNER_SPACE * double(GetMapMode().GetScaleY()));
+ Rectangle aRect(Point(nCornerWidth, nCornerHeight),
+ Size(aSize.Width() - nCornerWidth - nCornerWidth,
+ aSize.Height() - nCornerHeight - nCornerHeight));
+ ColorChanger aColors(&rRenderContext, COL_WHITE, COL_WHITE);
+ rRenderContext.DrawPolyLine(Polygon(rRenderContext.PixelToLogic(aRect)),
+ LineInfo(LINE_SOLID, 2));
}
}
@@ -209,13 +211,18 @@ void OStartMarker::initDefaultNodeImages()
m_aText->SetMouseTransparent(true);
}
-void OStartMarker::ImplInitSettings()
+void OStartMarker::ApplySettings(vcl::RenderContext& rRenderContext)
{
- SetBackground( );
- SetFillColor( Application::GetSettings().GetStyleSettings().GetDialogColor() );
+ rRenderContext.SetBackground();
+ rRenderContext.SetFillColor(Application::GetSettings().GetStyleSettings().GetDialogColor());
setColor();
}
+void OStartMarker::ImplInitSettings()
+{
+ ApplySettings(*this);
+}
+
void OStartMarker::Resize()
{
const Size aOutputSize( GetOutputSizePixel() );