Kaydet (Commit) d85412e0 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

refactor SvxPageWindow & SvxXMeasurePreview to use RenderContext

Change-Id: Ic6f4d1238c0a4c8f4632cf26099ef406caf5dbda
üst 9a81ba66
...@@ -22,23 +22,17 @@ ...@@ -22,23 +22,17 @@
#include <vcl/ctrl.hxx> #include <vcl/ctrl.hxx>
#include <svx/svxdllapi.h> #include <svx/svxdllapi.h>
class SfxItemSet; class SfxItemSet;
class SdrMeasureObj; class SdrMeasureObj;
class SdrModel; class SdrModel;
/*************************************************************************
|*
|* SvxXMeasurePreview
|*
\************************************************************************/
class SVX_DLLPUBLIC SvxXMeasurePreview : public Control class SVX_DLLPUBLIC SvxXMeasurePreview : public Control
{ {
friend class SvxMeasurePage; friend class SvxMeasurePage;
private: private:
SdrMeasureObj* pMeasureObj; SdrMeasureObj* pMeasureObj;
SdrModel* pModel; SdrModel* pModel;
public: public:
SvxXMeasurePreview(vcl::Window* pParent, WinBits nStyle); SvxXMeasurePreview(vcl::Window* pParent, WinBits nStyle);
...@@ -47,12 +41,12 @@ public: ...@@ -47,12 +41,12 @@ public:
virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE; virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
virtual void Resize() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE;
virtual Size GetOptimalSize() const SAL_OVERRIDE; virtual Size GetOptimalSize() const SAL_OVERRIDE;
void SetAttributes( const SfxItemSet& rInAttrs ); void SetAttributes(const SfxItemSet& rInAttrs);
virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; virtual void DataChanged(const DataChangedEvent& rDCEvt) SAL_OVERRIDE;
}; };
#endif #endif
......
This diff is collapsed.
...@@ -27,26 +27,27 @@ ...@@ -27,26 +27,27 @@
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
SvxXMeasurePreview::SvxXMeasurePreview( vcl::Window* pParent, WinBits nStyle) SvxXMeasurePreview::SvxXMeasurePreview(vcl::Window* pParent, WinBits nStyle)
: Control(pParent, nStyle) : Control(pParent, nStyle)
{ {
SetMapMode( MAP_100TH_MM ); SetMapMode(MAP_100TH_MM);
// Scale: 1:2 // Scale: 1:2
MapMode aMapMode = GetMapMode(); MapMode aMapMode = GetMapMode();
aMapMode.SetScaleX( Fraction( 1, 2 ) ); aMapMode.SetScaleX(Fraction(1, 2));
aMapMode.SetScaleY( Fraction( 1, 2 ) ); aMapMode.SetScaleY(Fraction(1, 2));
SetMapMode( aMapMode ); SetMapMode(aMapMode);
Size aSize = GetOutputSize(); Size aSize = GetOutputSize();
Point aPt1 = Point( aSize.Width() / 5, (long) ( aSize.Height() / 2 ) ); Point aPt1 = Point(aSize.Width() / 5, (long) (aSize.Height() / 2));
Point aPt2 = Point( aSize.Width() * 4 / 5, (long) ( aSize.Height() / 2 ) ); Point aPt2 = Point(aSize.Width() * 4 / 5, (long) (aSize.Height() / 2));
pMeasureObj = new SdrMeasureObj( aPt1, aPt2 ); pMeasureObj = new SdrMeasureObj(aPt1, aPt2);
pModel = new SdrModel(); pModel = new SdrModel();
pMeasureObj->SetModel( pModel ); pMeasureObj->SetModel(pModel);
SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
SetDrawMode(bHighContrast ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR);
Invalidate(); Invalidate();
} }
...@@ -56,9 +57,9 @@ void SvxXMeasurePreview::Resize() ...@@ -56,9 +57,9 @@ void SvxXMeasurePreview::Resize()
Control::Resize(); Control::Resize();
Size aSize = GetOutputSize(); Size aSize = GetOutputSize();
Point aPt1 = Point( aSize.Width() / 5, (long) ( aSize.Height() / 2 ) ); Point aPt1 = Point(aSize.Width() / 5, (long) (aSize.Height() / 2));
pMeasureObj->SetPoint(aPt1, 0); pMeasureObj->SetPoint(aPt1, 0);
Point aPt2 = Point( aSize.Width() * 4 / 5, (long) ( aSize.Height() / 2 ) ); Point aPt2 = Point(aSize.Width() * 4 / 5, (long) (aSize.Height() / 2));
pMeasureObj->SetPoint(aPt2, 1); pMeasureObj->SetPoint(aPt2, 1);
} }
...@@ -94,80 +95,80 @@ void SvxXMeasurePreview::dispose() ...@@ -94,80 +95,80 @@ void SvxXMeasurePreview::dispose()
Control::dispose(); Control::dispose();
} }
void SvxXMeasurePreview::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& ) void SvxXMeasurePreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{ {
pMeasureObj->SingleObjectPainter(*this); pMeasureObj->SingleObjectPainter(rRenderContext);
} }
void SvxXMeasurePreview::SetAttributes( const SfxItemSet& rInAttrs ) void SvxXMeasurePreview::SetAttributes(const SfxItemSet& rInAttrs)
{ {
pMeasureObj->SetMergedItemSetAndBroadcast(rInAttrs); pMeasureObj->SetMergedItemSetAndBroadcast(rInAttrs);
Invalidate(); Invalidate();
} }
void SvxXMeasurePreview::MouseButtonDown( const MouseEvent& rMEvt ) void SvxXMeasurePreview::MouseButtonDown(const MouseEvent& rMEvt)
{ {
bool bZoomIn = rMEvt.IsLeft() && !rMEvt.IsShift(); bool bZoomIn = rMEvt.IsLeft() && !rMEvt.IsShift();
bool bZoomOut = rMEvt.IsRight() || rMEvt.IsShift(); bool bZoomOut = rMEvt.IsRight() || rMEvt.IsShift();
bool bCtrl = rMEvt.IsMod1(); bool bCtrl = rMEvt.IsMod1();
if( bZoomIn || bZoomOut ) if (bZoomIn || bZoomOut)
{ {
MapMode aMapMode = GetMapMode(); MapMode aMapMode = GetMapMode();
Fraction aXFrac = aMapMode.GetScaleX(); Fraction aXFrac = aMapMode.GetScaleX();
Fraction aYFrac = aMapMode.GetScaleY(); Fraction aYFrac = aMapMode.GetScaleY();
boost::scoped_ptr<Fraction> pMultFrac; boost::scoped_ptr<Fraction> pMultFrac;
if( bZoomIn ) if (bZoomIn)
{ {
if( bCtrl ) if (bCtrl)
pMultFrac.reset(new Fraction( 3, 2 )); pMultFrac.reset(new Fraction(3, 2));
else else
pMultFrac.reset(new Fraction( 11, 10 )); pMultFrac.reset(new Fraction(11, 10));
} }
else else
{ {
if( bCtrl ) if (bCtrl)
pMultFrac.reset(new Fraction( 2, 3 )); pMultFrac.reset(new Fraction(2, 3));
else else
pMultFrac.reset(new Fraction( 10, 11 )); pMultFrac.reset(new Fraction(10, 11));
} }
aXFrac *= *pMultFrac; aXFrac *= *pMultFrac;
aYFrac *= *pMultFrac; aYFrac *= *pMultFrac;
if( (double)aXFrac > 0.001 && (double)aXFrac < 1000.0 &&
(double)aYFrac > 0.001 && (double)aYFrac < 1000.0 ) if (double(aXFrac) > 0.001 && double(aXFrac) < 1000.0 &&
double(aYFrac) > 0.001 && double(aYFrac) < 1000.0)
{ {
aMapMode.SetScaleX( aXFrac ); aMapMode.SetScaleX(aXFrac);
aMapMode.SetScaleY( aYFrac ); aMapMode.SetScaleY(aYFrac);
SetMapMode( aMapMode ); SetMapMode(aMapMode);
Size aOutSize( GetOutputSize() ); Size aOutSize(GetOutputSize());
Point aPt( aMapMode.GetOrigin() ); Point aPt(aMapMode.GetOrigin());
long nX = (long)( ( (double)aOutSize.Width() - ( (double)aOutSize.Width() * (double)*pMultFrac ) ) / 2.0 + 0.5 ); long nX = long((double(aOutSize.Width()) - (double(aOutSize.Width()) * double(*pMultFrac))) / 2.0 + 0.5);
long nY = (long)( ( (double)aOutSize.Height() - ( (double)aOutSize.Height() * (double)*pMultFrac ) ) / 2.0 + 0.5 ); long nY = long((double(aOutSize.Height()) - (double(aOutSize.Height()) * double(*pMultFrac))) / 2.0 + 0.5);
aPt.X() += nX; aPt.X() += nX;
aPt.Y() += nY; aPt.Y() += nY;
aMapMode.SetOrigin( aPt ); aMapMode.SetOrigin(aPt);
SetMapMode( aMapMode ); SetMapMode(aMapMode);
Invalidate(); Invalidate();
} }
} }
} }
void SvxXMeasurePreview::DataChanged( const DataChangedEvent& rDCEvt ) void SvxXMeasurePreview::DataChanged( const DataChangedEvent& rDCEvt )
{ {
Control::DataChanged( rDCEvt ); Control::DataChanged( rDCEvt );
if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))
{ {
SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR ); bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
SetDrawMode(bHighContrast ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR);
} }
} }
......
This diff is collapsed.
...@@ -206,33 +206,30 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet ) ...@@ -206,33 +206,30 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet )
Invalidate(); Invalidate();
} }
void SwColExample::DrawPage( const Point& rOrg, void SwColExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOrg,
const bool bSecond, const bool bSecond, const bool bEnabled)
const bool bEnabled )
{ {
SwPageExample::DrawPage( rOrg, bSecond, bEnabled ); SwPageExample::DrawPage(rRenderContext, rOrg, bSecond, bEnabled);
sal_uInt16 nColumnCount; sal_uInt16 nColumnCount;
if( pColMgr && 0 != (nColumnCount = pColMgr->GetCount())) if (pColMgr && 0 != (nColumnCount = pColMgr->GetCount()))
{ {
long nL = GetLeft(); long nL = GetLeft();
long nR = GetRight(); long nR = GetRight();
if ( GetUsage() == SVX_PAGE_MIRROR && !bSecond ) if (GetUsage() == SVX_PAGE_MIRROR && !bSecond)
{ {
// rotate for mirrored // rotate for mirrored
nL = GetRight(); nL = GetRight();
nR = GetLeft(); nR = GetLeft();
} }
SetFillColor( Color( COL_LIGHTGRAY ) ); rRenderContext.SetFillColor(Color(COL_LIGHTGRAY));
Rectangle aRect; Rectangle aRect;
aRect.Right() = rOrg.X() + GetSize().Width() - nR; aRect.Right() = rOrg.X() + GetSize().Width() - nR;
aRect.Left() = rOrg.X() + nL; aRect.Left() = rOrg.X() + nL;
aRect.Top() = rOrg.Y() + GetTop() aRect.Top() = rOrg.Y() + GetTop() + GetHdHeight() + GetHdDist();
+ GetHdHeight() + GetHdDist(); aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom() - GetFtHeight() - GetFtDist();
aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom() rRenderContext.DrawRect(aRect);
- GetFtHeight() - GetFtDist();
DrawRect(aRect);
//UUUU //UUUU
const Rectangle aDefineRect(aRect); const Rectangle aDefineRect(aRect);
...@@ -240,54 +237,53 @@ void SwColExample::DrawPage( const Point& rOrg, ...@@ -240,54 +237,53 @@ void SwColExample::DrawPage( const Point& rOrg,
//UUUU //UUUU
const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes = getPageFillAttributes(); const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes = getPageFillAttributes();
if(!rFillAttributes.get() || !rFillAttributes->isUsed()) if (!rFillAttributes.get() || !rFillAttributes->isUsed())
{ {
//UUUU If there is no fill, use fallback color //UUUU If there is no fill, use fallback color
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
const Color& rFieldColor = rStyleSettings.GetFieldColor(); const Color& rFieldColor = rStyleSettings.GetFieldColor();
setPageFillAttributes( setPageFillAttributes(
drawinglayer::attribute::SdrAllFillAttributesHelperPtr( drawinglayer::attribute::SdrAllFillAttributesHelperPtr(
new drawinglayer::attribute::SdrAllFillAttributesHelper( new drawinglayer::attribute::SdrAllFillAttributesHelper(rFieldColor)));
rFieldColor)));
} }
// #97495# make sure that the automatic column width's are always equal // #97495# make sure that the automatic column width's are always equal
bool bAutoWidth = pColMgr->IsAutoWidth(); bool bAutoWidth = pColMgr->IsAutoWidth();
sal_Int32 nAutoColWidth = 0; sal_Int32 nAutoColWidth = 0;
if(bAutoWidth) if (bAutoWidth)
{ {
sal_Int32 nColumnWidthSum = 0; sal_Int32 nColumnWidthSum = 0;
sal_uInt16 i; sal_uInt16 i;
for(i = 0; i < nColumnCount; ++i) for (i = 0; i < nColumnCount; ++i)
nColumnWidthSum += pColMgr->GetColWidth( i ); nColumnWidthSum += pColMgr->GetColWidth( i );
nAutoColWidth = nColumnWidthSum / nColumnCount; nAutoColWidth = nColumnWidthSum / nColumnCount;
} }
sal_uInt16 i; sal_uInt16 i;
for( i = 0; i < nColumnCount; i++) for (i = 0; i < nColumnCount; i++)
{ {
if(!bAutoWidth) if (!bAutoWidth)
nAutoColWidth = pColMgr->GetColWidth( i ); nAutoColWidth = pColMgr->GetColWidth(i);
aRect.Right() = aRect.Left() + nAutoColWidth; aRect.Right() = aRect.Left() + nAutoColWidth;
//UUUU use primitive draw command //UUUU use primitive draw command
drawFillAttributes(getPageFillAttributes(), aRect, aDefineRect); drawFillAttributes(rRenderContext, getPageFillAttributes(), aRect, aDefineRect);
if(i < nColumnCount - 1) if (i < nColumnCount - 1)
aRect.Left() = aRect.Right() + pColMgr->GetGutterWidth(i); aRect.Left() = aRect.Right() + pColMgr->GetGutterWidth(i);
} }
if(pColMgr->HasLine()) if (pColMgr->HasLine())
{ {
Point aUp( rOrg.X() + nL, rOrg.Y() + GetTop() ); Point aUp(rOrg.X() + nL, rOrg.Y() + GetTop());
Point aDown( rOrg.X() + nL, rOrg.Y() + GetSize().Height() Point aDown(rOrg.X() + nL,
- GetBottom() - GetFtHeight() - GetFtDist() ); rOrg.Y() + GetSize().Height() - GetBottom() - GetFtHeight() - GetFtDist());
if( pColMgr->GetLineHeightPercent() != 100 ) if (pColMgr->GetLineHeightPercent() != 100)
{ {
long nLength = aDown.Y() - aUp.Y(); long nLength = aDown.Y() - aUp.Y();
nLength -= nLength * pColMgr->GetLineHeightPercent() / 100; nLength -= nLength * pColMgr->GetLineHeightPercent() / 100;
switch(pColMgr->GetAdjust()) switch (pColMgr->GetAdjust())
{ {
case COLADJ_BOTTOM: aUp.Y() += nLength; break; case COLADJ_BOTTOM: aUp.Y() += nLength; break;
case COLADJ_TOP: aDown.Y() -= nLength; break; case COLADJ_TOP: aDown.Y() -= nLength; break;
...@@ -299,17 +295,14 @@ void SwColExample::DrawPage( const Point& rOrg, ...@@ -299,17 +295,14 @@ void SwColExample::DrawPage( const Point& rOrg,
} }
} }
for( i = 0; i < nColumnCount - 1; i++) for (i = 0; i < nColumnCount - 1; i++)
{ {
int nGutter = pColMgr->GetGutterWidth(i); int nGutter = pColMgr->GetGutterWidth(i);
int nDist = pColMgr->GetColWidth( i ) + nGutter; int nDist = pColMgr->GetColWidth( i ) + nGutter;
nDist -= (i == 0) ? nDist -= (i == 0) ? nGutter / 2 : 0;
nGutter/2 :
0;
aUp.X() += nDist; aUp.X() += nDist;
aDown.X() += nDist; aDown.X() += nDist;
DrawLine( aUp, aDown ); rRenderContext.DrawLine(aUp, aDown);
} }
} }
} }
...@@ -491,25 +484,24 @@ void SwPageGridExample::dispose() ...@@ -491,25 +484,24 @@ void SwPageGridExample::dispose()
SwPageExample::dispose(); SwPageExample::dispose();
} }
void SwPageGridExample::DrawPage( const Point& rOrg, void SwPageGridExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOrg,
const bool bSecond, const bool bSecond, const bool bEnabled)
const bool bEnabled )
{ {
SwPageExample::DrawPage(rOrg, bSecond, bEnabled); SwPageExample::DrawPage(rRenderContext, rOrg, bSecond, bEnabled);
if(pGridItem && pGridItem->GetGridType()) if (pGridItem && pGridItem->GetGridType())
{ {
//paint the grid now //paint the grid now
Color aLineColor = pGridItem->GetColor(); Color aLineColor = pGridItem->GetColor();
if(aLineColor.GetColor() == COL_AUTO) if (aLineColor.GetColor() == COL_AUTO)
{ {
aLineColor = GetFillColor(); aLineColor = rRenderContext.GetFillColor();
aLineColor.Invert(); aLineColor.Invert();
} }
SetLineColor(aLineColor); rRenderContext.SetLineColor(aLineColor);
long nL = GetLeft(); long nL = GetLeft();
long nR = GetRight(); long nR = GetRight();
if ( GetUsage() == SVX_PAGE_MIRROR && !bSecond ) if (GetUsage() == SVX_PAGE_MIRROR && !bSecond)
{ {
// rotate for mirrored // rotate for mirrored
nL = GetRight(); nL = GetRight();
...@@ -519,10 +511,8 @@ void SwPageGridExample::DrawPage( const Point& rOrg, ...@@ -519,10 +511,8 @@ void SwPageGridExample::DrawPage( const Point& rOrg,
Rectangle aRect; Rectangle aRect;
aRect.Right() = rOrg.X() + GetSize().Width() - nR; aRect.Right() = rOrg.X() + GetSize().Width() - nR;
aRect.Left() = rOrg.X() + nL; aRect.Left() = rOrg.X() + nL;
aRect.Top() = rOrg.Y() + GetTop() aRect.Top() = rOrg.Y() + GetTop() + GetHdHeight() + GetHdDist();
+ GetHdHeight() + GetHdDist(); aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom() - GetFtHeight() - GetFtDist();
aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom()
- GetFtHeight() - GetFtDist();
//increase the values to get a 'viewable' preview //increase the values to get a 'viewable' preview
sal_Int32 nBaseHeight = pGridItem->GetBaseHeight() * 3; sal_Int32 nBaseHeight = pGridItem->GetBaseHeight() * 3;
...@@ -542,19 +532,19 @@ void SwPageGridExample::DrawPage( const Point& rOrg, ...@@ -542,19 +532,19 @@ void SwPageGridExample::DrawPage( const Point& rOrg,
//detect count of rectangles //detect count of rectangles
sal_Int32 nLines = (m_bVertical ? aRect.GetWidth(): aRect.GetHeight()) / nLineHeight; sal_Int32 nLines = (m_bVertical ? aRect.GetWidth(): aRect.GetHeight()) / nLineHeight;
if(nLines > pGridItem->GetLines()) if (nLines > pGridItem->GetLines())
nLines = pGridItem->GetLines(); nLines = pGridItem->GetLines();
// determine start position // determine start position
if(m_bVertical) if (m_bVertical)
{ {
sal_Int16 nXStart = static_cast< sal_Int16 >(aRect.GetWidth() / 2 - nLineHeight * nLines /2); sal_Int16 nXStart = static_cast<sal_Int16>(aRect.GetWidth() / 2 - nLineHeight * nLines /2);
aRubyRect.Move(nXStart, 0); aRubyRect.Move(nXStart, 0);
aCharRect.Move(nXStart, 0); aCharRect.Move(nXStart, 0);
} }
else else
{ {
sal_Int16 nYStart = static_cast< sal_Int16 >(aRect.GetHeight() / 2 - nLineHeight * nLines /2); sal_Int16 nYStart = static_cast<sal_Int16>(aRect.GetHeight() / 2 - nLineHeight * nLines /2);
aRubyRect.Move(0, nYStart); aRubyRect.Move(0, nYStart);
aCharRect.Move(0, nYStart); aCharRect.Move(0, nYStart);
} }
...@@ -566,20 +556,20 @@ void SwPageGridExample::DrawPage( const Point& rOrg, ...@@ -566,20 +556,20 @@ void SwPageGridExample::DrawPage( const Point& rOrg,
//vertical lines //vertical lines
bool bBothLines = pGridItem->GetGridType() == GRID_LINES_CHARS; bool bBothLines = pGridItem->GetGridType() == GRID_LINES_CHARS;
SetFillColor( Color( COL_TRANSPARENT ) ); rRenderContext.SetFillColor(Color(COL_TRANSPARENT));
sal_Int32 nXMove = m_bVertical ? nLineHeight : 0; sal_Int32 nXMove = m_bVertical ? nLineHeight : 0;
sal_Int32 nYMove = m_bVertical ? 0 : nLineHeight; sal_Int32 nYMove = m_bVertical ? 0 : nLineHeight;
for(sal_Int32 nLine = 0; nLine < nLines; nLine++) for (sal_Int32 nLine = 0; nLine < nLines; nLine++)
{ {
DrawRect(aRubyRect); rRenderContext.DrawRect(aRubyRect);
DrawRect(aCharRect); rRenderContext.DrawRect(aCharRect);
if(bBothLines) if (bBothLines)
{ {
Point aStart = aCharRect.TopLeft(); Point aStart = aCharRect.TopLeft();
Point aEnd = m_bVertical ? aCharRect.TopRight() : aCharRect.BottomLeft(); Point aEnd = m_bVertical ? aCharRect.TopRight() : aCharRect.BottomLeft();
while(m_bVertical ? aStart.Y() < aRect.Bottom(): aStart.X() < aRect.Right()) while(m_bVertical ? aStart.Y() < aRect.Bottom(): aStart.X() < aRect.Right())
{ {
DrawLine(aStart, aEnd); rRenderContext.DrawLine(aStart, aEnd);
if(m_bVertical) if(m_bVertical)
aStart.Y() = aEnd.Y() += nBaseHeight; aStart.Y() = aEnd.Y() += nBaseHeight;
else else
......
...@@ -47,14 +47,16 @@ class SW_DLLPUBLIC SwPageGridExample : public SwPageExample ...@@ -47,14 +47,16 @@ class SW_DLLPUBLIC SwPageGridExample : public SwPageExample
SwTextGridItem* pGridItem; SwTextGridItem* pGridItem;
bool m_bVertical; bool m_bVertical;
protected: protected:
virtual void DrawPage( const Point& rPoint, virtual void DrawPage(vcl::RenderContext& rRenderContext,
const bool bSecond, const Point& rPoint,
const bool bEnabled ) SAL_OVERRIDE; const bool bSecond,
const bool bEnabled) SAL_OVERRIDE;
public: public:
SwPageGridExample(vcl::Window* pPar) : SwPageGridExample(vcl::Window* pPar)
SwPageExample(pPar), : SwPageExample(pPar)
pGridItem(0), , pGridItem(0)
m_bVertical(false){} , m_bVertical(false)
{}
virtual ~SwPageGridExample(); virtual ~SwPageGridExample();
virtual void dispose() SAL_OVERRIDE; virtual void dispose() SAL_OVERRIDE;
...@@ -68,9 +70,10 @@ class SW_DLLPUBLIC SwColExample : public SwPageExample ...@@ -68,9 +70,10 @@ class SW_DLLPUBLIC SwColExample : public SwPageExample
using SwPageExample::UpdateExample; using SwPageExample::UpdateExample;
protected: protected:
virtual void DrawPage( const Point& rPoint, virtual void DrawPage(vcl::RenderContext& rRenderContext,
const bool bSecond, const Point& rPoint,
const bool bEnabled ) SAL_OVERRIDE; const bool bSecond,
const bool bEnabled) SAL_OVERRIDE;
public: public:
SwColExample(vcl::Window* pPar) SwColExample(vcl::Window* pPar)
...@@ -95,7 +98,7 @@ private: ...@@ -95,7 +98,7 @@ private:
SwFmtCol m_aCols; SwFmtCol m_aCols;
protected: protected:
virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE; virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
public: public:
SwColumnOnlyExample(vcl::Window*); SwColumnOnlyExample(vcl::Window*);
......
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