diff options
-rw-r--r-- | include/svx/measctrl.hxx | 16 | ||||
-rw-r--r-- | include/svx/pagectrl.hxx | 236 | ||||
-rw-r--r-- | svx/source/dialog/measctrl.cxx | 83 | ||||
-rw-r--r-- | svx/source/dialog/pagectrl.cxx | 174 | ||||
-rw-r--r-- | sw/source/uibase/frmdlg/colex.cxx | 106 | ||||
-rw-r--r-- | sw/source/uibase/inc/colex.hxx | 25 |
6 files changed, 320 insertions, 320 deletions
diff --git a/include/svx/measctrl.hxx b/include/svx/measctrl.hxx index 347e0f5faaa7..8edb17986ce0 100644 --- a/include/svx/measctrl.hxx +++ b/include/svx/measctrl.hxx @@ -22,23 +22,17 @@ #include <vcl/ctrl.hxx> #include <svx/svxdllapi.h> - class SfxItemSet; class SdrMeasureObj; class SdrModel; -/************************************************************************* -|* -|* SvxXMeasurePreview -|* -\************************************************************************/ class SVX_DLLPUBLIC SvxXMeasurePreview : public Control { friend class SvxMeasurePage; private: - SdrMeasureObj* pMeasureObj; - SdrModel* pModel; + SdrMeasureObj* pMeasureObj; + SdrModel* pModel; public: SvxXMeasurePreview(vcl::Window* pParent, WinBits nStyle); @@ -47,12 +41,12 @@ public: virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) 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; - 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 diff --git a/include/svx/pagectrl.hxx b/include/svx/pagectrl.hxx index 6f0c3575a5b5..e0ec05b2884d 100644 --- a/include/svx/pagectrl.hxx +++ b/include/svx/pagectrl.hxx @@ -23,38 +23,36 @@ #include <svx/svxdllapi.h> #include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> -// forward --------------------------------------------------------------- class SvxBoxItem; -// class SvxPageWindow --------------------------------------------------- class SVX_DLLPUBLIC SvxPageWindow : public vcl::Window { using Window::GetBorder; private: - Size aWinSize; - Size aSize; - - long nTop; - long nBottom; - long nLeft; - long nRight; - - SvxBoxItem* pBorder; - bool bResetBackground; - bool bFrameDirection; - sal_Int32 nFrameDirection; - - long nHdLeft; - long nHdRight; - long nHdDist; - long nHdHeight; + Size aWinSize; + Size aSize; + + long nTop; + long nBottom; + long nLeft; + long nRight; + + SvxBoxItem* pBorder; + bool bResetBackground; + bool bFrameDirection; + sal_Int32 nFrameDirection; + + long nHdLeft; + long nHdRight; + long nHdDist; + long nHdHeight; SvxBoxItem* pHdBorder; - long nFtLeft; - long nFtRight; - long nFtDist; - long nFtHeight; + long nFtLeft; + long nFtRight; + long nFtDist; + long nFtHeight; SvxBoxItem* pFtBorder; //UUUU @@ -62,106 +60,128 @@ private: drawinglayer::attribute::SdrAllFillAttributesHelperPtr maFooterFillAttributes; drawinglayer::attribute::SdrAllFillAttributesHelperPtr maPageFillAttributes; - bool bFooter :1; - bool bHeader :1; - bool bTable :1; - bool bHorz :1; - bool bVert :1; + bool bFooter : 1; + bool bHeader : 1; + bool bTable : 1; + bool bHorz : 1; + bool bVert : 1; - sal_uInt16 eUsage; + sal_uInt16 eUsage; - OUString aLeftText; - OUString aRightText; + OUString aLeftText; + OUString aRightText; protected: - virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE; + virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE; - virtual void DrawPage( const Point& rPoint, - const bool bSecond, - const bool bEnabled ); + virtual void DrawPage(vcl::RenderContext& rRenderContext, const Point& rPoint, + const bool bSecond, const bool bEnabled); //UUUU - void drawFillAttributes( - const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, - const Rectangle& rPaintRange, - const Rectangle& rDefineRange); + void drawFillAttributes(vcl::RenderContext& rRenderContext, + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, + const Rectangle& rPaintRange, const Rectangle& rDefineRange); public: - SvxPageWindow( vcl::Window* pParent ); + SvxPageWindow(vcl::Window* pParent); virtual ~SvxPageWindow(); virtual void dispose() SAL_OVERRIDE; //UUUU - void setHeaderFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) { maHeaderFillAttributes = rFillAttributes; } - void setFooterFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) { maFooterFillAttributes = rFillAttributes; } - void setPageFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) { maPageFillAttributes = rFillAttributes; } - const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& getPageFillAttributes() const { return maPageFillAttributes; } - - void SetWidth(long nW) { aSize.Width() = nW; } - void SetHeight(long nH) { aSize.Height() = nH; } - - void SetSize(const Size& rSz) { aSize = rSz; } - const Size& GetSize() const { return aSize; } - - void SetTop(long nNew) { nTop = nNew; } - void SetBottom(long nNew) { nBottom = nNew; } - void SetLeft(long nNew) { nLeft = nNew; } - void SetRight(long nNew) { nRight = nNew; } - void SetBorder(const SvxBoxItem& rNew); - - long GetTop() const { return nTop; } - long GetBottom() const { return nBottom; } - long GetLeft() const { return nLeft; } - long GetRight() const { return nRight; } - - const SvxBoxItem& GetBorder() const; - - void SetHdLeft(long nNew) { nHdLeft = nNew; } - void SetHdRight(long nNew) { nHdRight = nNew; } - void SetHdDist(long nNew) { nHdDist = nNew; } - void SetHdHeight(long nNew) { nHdHeight = nNew; } - void SetHdBorder(const SvxBoxItem& rNew); - - long GetHdLeft() const { return nHdLeft; } - long GetHdRight() const { return nHdRight; } - long GetHdDist() const { return nHdDist; } - long GetHdHeight() const { return nHdHeight; } - - const SvxBoxItem& GetHdBorder() const { return *pHdBorder; } - - void SetFtLeft(long nNew) { nFtLeft = nNew; } - void SetFtRight(long nNew) { nFtRight = nNew; } - void SetFtDist(long nNew) { nFtDist = nNew; } - void SetFtHeight(long nNew) { nFtHeight = nNew; } - void SetFtBorder(const SvxBoxItem& rNew); - - long GetFtLeft() const { return nFtLeft; } - long GetFtRight() const { return nFtRight; } - long GetFtDist() const { return nFtDist; } - long GetFtHeight() const { return nFtHeight; } - - const SvxBoxItem& GetFtBorder() const { return *pFtBorder; } - - void SetUsage(sal_uInt16 eU) { eUsage = eU; } - sal_uInt16 GetUsage() const { return eUsage; } - - void SetHeader( bool bNew ) { bHeader = bNew; } - bool GetHeader() const { return bHeader;} - void SetFooter( bool bNew ) { bFooter = bNew; } - bool GetFooter() const { return bFooter;} - - void SetTable( bool bNew ) { bTable = bNew; } - bool GetTable() const { return bTable;} - void SetHorz( bool bNew ) { bHorz = bNew; } - bool GetHorz() const { return bHorz;} - void SetVert( bool bNew ) { bVert = bNew; } - bool GetVert() const { return bVert;} - - void EnableFrameDirection(bool bEnable); + void setHeaderFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) + { + maHeaderFillAttributes = rFillAttributes; + } + void setFooterFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) + { + maFooterFillAttributes = rFillAttributes; + } + void setPageFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes) + { + maPageFillAttributes = rFillAttributes; + } + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& getPageFillAttributes() const + { + return maPageFillAttributes; + } + + void SetWidth(long nWidth) + { + aSize.Width() = nWidth; + } + void SetHeight(long nHeight) + { + aSize.Height() = nHeight; + } + + void SetSize(const Size& rSize) + { + aSize = rSize; + } + const Size& GetSize() const + { + return aSize; + } + + void SetTop(long nNew) { nTop = nNew; } + void SetBottom(long nNew) { nBottom = nNew; } + void SetLeft(long nNew) { nLeft = nNew; } + void SetRight(long nNew) { nRight = nNew; } + void SetBorder(const SvxBoxItem& rNew); + + long GetTop() const { return nTop; } + long GetBottom() const { return nBottom; } + long GetLeft() const { return nLeft; } + long GetRight() const { return nRight; } + + const SvxBoxItem& GetBorder() const; + + void SetHdLeft(long nNew) { nHdLeft = nNew; } + void SetHdRight(long nNew) { nHdRight = nNew; } + void SetHdDist(long nNew) { nHdDist = nNew; } + void SetHdHeight(long nNew) { nHdHeight = nNew; } + void SetHdBorder(const SvxBoxItem& rNew); + + long GetHdLeft() const { return nHdLeft; } + long GetHdRight() const { return nHdRight; } + long GetHdDist() const { return nHdDist; } + long GetHdHeight() const { return nHdHeight; } + + const SvxBoxItem& GetHdBorder() const { return *pHdBorder; } + + void SetFtLeft(long nNew) { nFtLeft = nNew; } + void SetFtRight(long nNew) { nFtRight = nNew; } + void SetFtDist(long nNew) { nFtDist = nNew; } + void SetFtHeight(long nNew) { nFtHeight = nNew; } + void SetFtBorder(const SvxBoxItem& rNew); + + long GetFtLeft() const { return nFtLeft; } + long GetFtRight() const { return nFtRight; } + long GetFtDist() const { return nFtDist; } + long GetFtHeight() const { return nFtHeight; } + + const SvxBoxItem& GetFtBorder() const { return *pFtBorder; } + + void SetUsage(sal_uInt16 eU) { eUsage = eU; } + sal_uInt16 GetUsage() const { return eUsage; } + + void SetHeader( bool bNew ) { bHeader = bNew; } + bool GetHeader() const { return bHeader;} + void SetFooter( bool bNew ) { bFooter = bNew; } + bool GetFooter() const { return bFooter;} + + void SetTable( bool bNew ) { bTable = bNew; } + bool GetTable() const { return bTable;} + void SetHorz( bool bNew ) { bHorz = bNew; } + bool GetHorz() const { return bHorz;} + void SetVert( bool bNew ) { bVert = bNew; } + bool GetVert() const { return bVert;} + + void EnableFrameDirection(bool bEnable); //uses enum SvxFrameDirection - void SetFrameDirection(sal_Int32 nDirection); + void SetFrameDirection(sal_Int32 nDirection); - void ResetBackground(); + void ResetBackground(); virtual Size GetOptimalSize() const SAL_OVERRIDE; }; diff --git a/svx/source/dialog/measctrl.cxx b/svx/source/dialog/measctrl.cxx index e272f4e53f7e..19b666fc4ba8 100644 --- a/svx/source/dialog/measctrl.cxx +++ b/svx/source/dialog/measctrl.cxx @@ -27,26 +27,27 @@ #include <vcl/settings.hxx> #include <boost/scoped_ptr.hpp> -SvxXMeasurePreview::SvxXMeasurePreview( vcl::Window* pParent, WinBits nStyle) +SvxXMeasurePreview::SvxXMeasurePreview(vcl::Window* pParent, WinBits nStyle) : Control(pParent, nStyle) { - SetMapMode( MAP_100TH_MM ); + SetMapMode(MAP_100TH_MM); // Scale: 1:2 MapMode aMapMode = GetMapMode(); - aMapMode.SetScaleX( Fraction( 1, 2 ) ); - aMapMode.SetScaleY( Fraction( 1, 2 ) ); - SetMapMode( aMapMode ); + aMapMode.SetScaleX(Fraction(1, 2)); + aMapMode.SetScaleY(Fraction(1, 2)); + SetMapMode(aMapMode); Size aSize = GetOutputSize(); - Point aPt1 = Point( aSize.Width() / 5, (long) ( aSize.Height() / 2 ) ); - Point aPt2 = Point( aSize.Width() * 4 / 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)); - pMeasureObj = new SdrMeasureObj( aPt1, aPt2 ); + pMeasureObj = new SdrMeasureObj(aPt1, aPt2); 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(); } @@ -56,9 +57,9 @@ void SvxXMeasurePreview::Resize() Control::Resize(); 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); - 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); } @@ -94,80 +95,80 @@ void SvxXMeasurePreview::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); Invalidate(); } -void SvxXMeasurePreview::MouseButtonDown( const MouseEvent& rMEvt ) +void SvxXMeasurePreview::MouseButtonDown(const MouseEvent& rMEvt) { bool bZoomIn = rMEvt.IsLeft() && !rMEvt.IsShift(); bool bZoomOut = rMEvt.IsRight() || rMEvt.IsShift(); bool bCtrl = rMEvt.IsMod1(); - if( bZoomIn || bZoomOut ) + if (bZoomIn || bZoomOut) { MapMode aMapMode = GetMapMode(); Fraction aXFrac = aMapMode.GetScaleX(); Fraction aYFrac = aMapMode.GetScaleY(); boost::scoped_ptr<Fraction> pMultFrac; - if( bZoomIn ) + if (bZoomIn) { - if( bCtrl ) - pMultFrac.reset(new Fraction( 3, 2 )); + if (bCtrl) + pMultFrac.reset(new Fraction(3, 2)); else - pMultFrac.reset(new Fraction( 11, 10 )); + pMultFrac.reset(new Fraction(11, 10)); } else { - if( bCtrl ) - pMultFrac.reset(new Fraction( 2, 3 )); + if (bCtrl) + pMultFrac.reset(new Fraction(2, 3)); else - pMultFrac.reset(new Fraction( 10, 11 )); + pMultFrac.reset(new Fraction(10, 11)); } aXFrac *= *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.SetScaleY( aYFrac ); - SetMapMode( aMapMode ); + aMapMode.SetScaleX(aXFrac); + aMapMode.SetScaleY(aYFrac); + SetMapMode(aMapMode); - Size aOutSize( GetOutputSize() ); + Size aOutSize(GetOutputSize()); - Point aPt( aMapMode.GetOrigin() ); - 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 ); - aPt.X() += nX; - aPt.Y() += nY; + Point aPt(aMapMode.GetOrigin()); + 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); + aPt.X() += nX; + aPt.Y() += nY; - aMapMode.SetOrigin( aPt ); - SetMapMode( aMapMode ); + aMapMode.SetOrigin(aPt); + SetMapMode(aMapMode); Invalidate(); } } } - - void SvxXMeasurePreview::DataChanged( const DataChangedEvent& 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); } } diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx index 574e32ff0473..6f8a35612540 100644 --- a/svx/source/dialog/pagectrl.cxx +++ b/svx/source/dialog/pagectrl.cxx @@ -102,11 +102,11 @@ void SvxPageWindow::dispose() VCL_BUILDER_FACTORY(SvxPageWindow) -void SvxPageWindow::Paint(vcl::RenderContext& /*rRenderContext*/, const Rectangle&) +void SvxPageWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) { - Fraction aXScale(aWinSize.Width(),std::max((long)(aSize.Width() * 2 + aSize.Width() / 8),1L)); - Fraction aYScale(aWinSize.Height(),std::max(aSize.Height(),1L)); - MapMode aMapMode(GetMapMode()); + Fraction aXScale(aWinSize.Width(), std::max(long(aSize.Width() * 2 + aSize.Width() / 8), 1L)); + Fraction aYScale(aWinSize.Height(), std::max(aSize.Height(), 1L)); + MapMode aMapMode(rRenderContext.GetMapMode()); if(aYScale < aXScale) { @@ -118,11 +118,11 @@ void SvxPageWindow::Paint(vcl::RenderContext& /*rRenderContext*/, const Rectangl aMapMode.SetScaleX(aXScale); aMapMode.SetScaleY(aXScale); } - SetMapMode(aMapMode); - Size aSz(PixelToLogic(GetSizePixel())); + rRenderContext.SetMapMode(aMapMode); + Size aSz(rRenderContext.PixelToLogic(GetSizePixel())); long nYPos = (aSz.Height() - aSize.Height()) / 2; - if(eUsage == SVX_PAGE_ALL) + if (eUsage == SVX_PAGE_ALL) { // all pages are equal -> draw one page if (aSize.Width() > aSize.Height()) @@ -135,61 +135,62 @@ void SvxPageWindow::Paint(vcl::RenderContext& /*rRenderContext*/, const Rectangl aY *= a2; aMapMode.SetScaleX(aX); aMapMode.SetScaleY(aY); - SetMapMode(aMapMode); - aSz = PixelToLogic(GetSizePixel()); + rRenderContext.SetMapMode(aMapMode); + aSz = rRenderContext.PixelToLogic(GetSizePixel()); nYPos = (aSz.Height() - aSize.Height()) / 2; long nXPos = (aSz.Width() - aSize.Width()) / 2; - DrawPage(Point(nXPos,nYPos),true,true); + DrawPage(rRenderContext, Point(nXPos,nYPos),true,true); } else // Portrait - DrawPage(Point((aSz.Width() - aSize.Width()) / 2,nYPos),true,true); + DrawPage(rRenderContext, Point((aSz.Width() - aSize.Width()) / 2,nYPos),true,true); } else { // Left and right page are different -> draw two pages if possible - DrawPage(Point(0,nYPos),false,(eUsage & SVX_PAGE_LEFT) != 0); - DrawPage(Point(aSize.Width() + aSize.Width() / 8,nYPos),true, - (eUsage & SVX_PAGE_RIGHT) != 0); + DrawPage(rRenderContext, Point(0, nYPos), false, (eUsage & SVX_PAGE_LEFT) != 0); + DrawPage(rRenderContext, Point(aSize.Width() + aSize.Width() / 8, nYPos), true, (eUsage & SVX_PAGE_RIGHT) != 0); } } -void SvxPageWindow::DrawPage(const Point& rOrg, const bool bSecond, const bool bEnabled) +void SvxPageWindow::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOrg, const bool bSecond, const bool bEnabled) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); const Color& rFieldColor = rStyleSettings.GetFieldColor(); const Color& rFieldTextColor = rStyleSettings.GetFieldTextColor(); const Color& rDisableColor = rStyleSettings.GetDisableColor(); const Color& rDlgColor = rStyleSettings.GetDialogColor(); // background - if(!bSecond || bResetBackground) + if (!bSecond || bResetBackground) { - SetLineColor(Color(COL_TRANSPARENT)); - SetFillColor(rDlgColor); - Size winSize(GetOutputSize()); - DrawRect(Rectangle(Point(0,0),winSize)); + rRenderContext.SetLineColor(Color(COL_TRANSPARENT)); + rRenderContext.SetFillColor(rDlgColor); + Size winSize(rRenderContext.GetOutputSize()); + rRenderContext.DrawRect(Rectangle(Point(0,0), winSize)); - if(bResetBackground) + if (bResetBackground) bResetBackground = false; } - SetLineColor(rFieldTextColor); + rRenderContext.SetLineColor(rFieldTextColor); + // Shadow Size aTempSize = aSize; + // Page - if(!bEnabled) + if (!bEnabled) { - SetFillColor(rDisableColor); - DrawRect(Rectangle(rOrg,aTempSize)); + rRenderContext.SetFillColor(rDisableColor); + rRenderContext.DrawRect(Rectangle(rOrg, aTempSize)); return; } - SetFillColor(rFieldColor); - DrawRect(Rectangle(rOrg,aTempSize)); + rRenderContext.SetFillColor(rFieldColor); + rRenderContext.DrawRect(Rectangle(rOrg, aTempSize)); long nL = nLeft; long nR = nRight; - if(eUsage == SVX_PAGE_MIRROR && !bSecond) + if (eUsage == SVX_PAGE_MIRROR && !bSecond) { // turn for mirrored nL = nRight; @@ -206,17 +207,17 @@ void SvxPageWindow::DrawPage(const Point& rOrg, const bool bSecond, const bool b Rectangle aHdRect(aRect); Rectangle aFtRect(aRect); - if(bHeader || bFooter) + if (bHeader || bFooter) { //UUUU Header and/or footer used - const Color aLineColor(GetLineColor()); + const Color aLineColor(rRenderContext.GetLineColor()); //UUUU draw PageFill first and on the whole page, no outline - SetLineColor(); - drawFillAttributes(maPageFillAttributes, aRect, aRect); - SetLineColor(aLineColor); + rRenderContext.SetLineColor(); + drawFillAttributes(rRenderContext, maPageFillAttributes, aRect, aRect); + rRenderContext.SetLineColor(aLineColor); - if(bHeader) + if (bHeader) { // show headers if possible aHdRect.Left() += nHdLeft; @@ -225,10 +226,10 @@ void SvxPageWindow::DrawPage(const Point& rOrg, const bool bSecond, const bool b aRect.Top() += nHdHeight + nHdDist; // draw header over PageFill, plus outline - drawFillAttributes(maHeaderFillAttributes, aHdRect, aHdRect); + drawFillAttributes(rRenderContext, maHeaderFillAttributes, aHdRect, aHdRect); } - if(bFooter) + if (bFooter) { // show footer if possible aFtRect.Left() += nFtLeft; @@ -237,31 +238,31 @@ void SvxPageWindow::DrawPage(const Point& rOrg, const bool bSecond, const bool b aRect.Bottom() -= nFtHeight + nFtDist; // draw footer over PageFill, plus outline - drawFillAttributes(maFooterFillAttributes, aFtRect, aFtRect); + drawFillAttributes(rRenderContext, maFooterFillAttributes, aFtRect, aFtRect); } // draw page's reduced outline, only outline - drawFillAttributes(drawinglayer::attribute::SdrAllFillAttributesHelperPtr(), aRect, aRect); + drawFillAttributes(rRenderContext, drawinglayer::attribute::SdrAllFillAttributesHelperPtr(), aRect, aRect); } else { //UUUU draw PageFill and outline - drawFillAttributes(maPageFillAttributes, aRect, aRect); + drawFillAttributes(rRenderContext, maPageFillAttributes, aRect, aRect); } - if(bFrameDirection && !bTable) + if (bFrameDirection && !bTable) { Point aPos; - vcl::Font aFont(GetFont()); + vcl::Font aFont(rRenderContext.GetFont()); const Size aSaveSize = aFont.GetSize(); Size aDrawSize(0,aRect.GetHeight() / 6); aFont.SetSize(aDrawSize); - SetFont(aFont); + rRenderContext.SetFont(aFont); OUString sText("ABC"); - Point aMove(1, GetTextHeight()); + Point aMove(1, rRenderContext.GetTextHeight()); sal_Unicode cArrow = 0x2193; - long nAWidth = GetTextWidth(sText.copy(0,1)); - switch(nFrameDirection) + long nAWidth = rRenderContext.GetTextWidth(sText.copy(0,1)); + switch (nFrameDirection) { case FRMDIR_HORI_LEFT_TOP: aPos = aRect.TopLeft(); @@ -278,7 +279,7 @@ void SvxPageWindow::DrawPage(const Point& rOrg, const bool bSecond, const bool b break; case FRMDIR_VERT_TOP_LEFT: aPos = aRect.TopLeft(); - aPos.X() += PixelToLogic(Point(1,1)).X(); + aPos.X() += rRenderContext.PixelToLogic(Point(1,1)).X(); aMove.X() = 0; break; case FRMDIR_VERT_TOP_RIGHT: @@ -288,19 +289,19 @@ void SvxPageWindow::DrawPage(const Point& rOrg, const bool bSecond, const bool b break; } sText += OUString(cArrow); - for(sal_uInt16 i = 0; i < sText.getLength(); i++) + for (sal_uInt16 i = 0; i < sText.getLength(); i++) { OUString sDraw(sText.copy(i,1)); long nHDiff = 0; long nCharWidth = GetTextWidth(sDraw); bool bHorizontal = 0 == aMove.Y(); - if(!bHorizontal) + if (!bHorizontal) { nHDiff = (nAWidth - nCharWidth) / 2; aPos.X() += nHDiff; } - DrawText(aPos,sDraw); - if(bHorizontal) + rRenderContext.DrawText(aPos,sDraw); + if (bHorizontal) { aPos.X() += aMove.X() < 0 ? -nCharWidth : nCharWidth; } @@ -311,42 +312,44 @@ void SvxPageWindow::DrawPage(const Point& rOrg, const bool bSecond, const bool b } } aFont.SetSize(aSaveSize); - SetFont(aFont); + rRenderContext.SetFont(aFont); } - if(bTable) + if (bTable) { // Paint Table, if necessary center it - SetLineColor(Color(COL_LIGHTGRAY)); + rRenderContext.SetLineColor(Color(COL_LIGHTGRAY)); - long nW = aRect.GetWidth(),nH = aRect.GetHeight(); - long nTW = CELL_WIDTH * 3,nTH = CELL_HEIGHT * 3; + long nW = aRect.GetWidth(); + long nH = aRect.GetHeight(); + long nTW = CELL_WIDTH * 3; + long nTH = CELL_HEIGHT * 3; long _nLeft = bHorz ? aRect.Left() + ((nW - nTW) / 2) : aRect.Left(); long _nTop = bVert ? aRect.Top() + ((nH - nTH) / 2) : aRect.Top(); - Rectangle aCellRect(Point(_nLeft,_nTop),Size(CELL_WIDTH,CELL_HEIGHT)); + Rectangle aCellRect(Point(_nLeft, _nTop),Size(CELL_WIDTH, CELL_HEIGHT)); - for(sal_uInt16 i = 0; i < 3; ++i) + for (sal_uInt16 i = 0; i < 3; ++i) { aCellRect.Left() = _nLeft; aCellRect.Right() = _nLeft + CELL_WIDTH; if(i > 0) aCellRect.Move(0,CELL_HEIGHT); - for(sal_uInt16 j = 0; j < 3; ++j) + for (sal_uInt16 j = 0; j < 3; ++j) { - if(j > 0) + if (j > 0) aCellRect.Move(CELL_WIDTH,0); - DrawRect(aCellRect); + rRenderContext.DrawRect(aCellRect); } } } } //UUUU -void SvxPageWindow::drawFillAttributes( - const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, - const Rectangle& rPaintRange, - const Rectangle& rDefineRange) +void SvxPageWindow::drawFillAttributes(vcl::RenderContext& rRenderContext, + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes, + const Rectangle& rPaintRange, + const Rectangle& rDefineRange) { const basegfx::B2DRange aPaintRange( rPaintRange.Left(), @@ -355,8 +358,8 @@ void SvxPageWindow::drawFillAttributes( rPaintRange.Bottom()); if(!aPaintRange.isEmpty() && - !basegfx::fTools::equalZero(aPaintRange.getWidth()) && - !basegfx::fTools::equalZero(aPaintRange.getHeight())) + !basegfx::fTools::equalZero(aPaintRange.getWidth()) && + !basegfx::fTools::equalZero(aPaintRange.getHeight())) { const basegfx::B2DRange aDefineRange( rDefineRange.Left(), @@ -368,45 +371,34 @@ void SvxPageWindow::drawFillAttributes( drawinglayer::primitive2d::Primitive2DSequence aSequence; // create fill geometry if there is something to fill - if(rFillAttributes.get() && rFillAttributes->isUsed()) + if (rFillAttributes.get() && rFillAttributes->isUsed()) { - aSequence = rFillAttributes->getPrimitive2DSequence( - aPaintRange, - aDefineRange); + aSequence = rFillAttributes->getPrimitive2DSequence(aPaintRange, aDefineRange); } // create line geometry if a LineColor is set at the target device - if(IsLineColor()) + if (rRenderContext.IsLineColor()) { const drawinglayer::primitive2d::Primitive2DReference xOutline( new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( - basegfx::tools::createPolygonFromRect(aPaintRange), - GetLineColor().getBColor())); + basegfx::tools::createPolygonFromRect(aPaintRange), GetLineColor().getBColor())); - drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence( - aSequence, - xOutline); + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aSequence, xOutline); } // draw that if we have something to draw - if(aSequence.getLength()) + if (aSequence.getLength()) { const drawinglayer::geometry::ViewInformation2D aViewInformation2D( - basegfx::B2DHomMatrix(), - GetViewTransformation(), - aPaintRange, - 0, - 0.0, - com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >()); - drawinglayer::processor2d::BaseProcessor2D* pProcessor = drawinglayer::processor2d::createProcessor2DFromOutputDevice( - *this, - aViewInformation2D); - - if(pProcessor) + basegfx::B2DHomMatrix(), GetViewTransformation(), aPaintRange, 0, + 0.0, css::uno::Sequence<css::beans::PropertyValue >()); + + std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor; + pProcessor.reset(drawinglayer::processor2d::createProcessor2DFromOutputDevice(rRenderContext, aViewInformation2D)); + + if (pProcessor) { pProcessor->process(aSequence); - - delete pProcessor; } } } diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx index 790f0b34d152..f4e7454b48ba 100644 --- a/sw/source/uibase/frmdlg/colex.cxx +++ b/sw/source/uibase/frmdlg/colex.cxx @@ -206,33 +206,30 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet ) Invalidate(); } -void SwColExample::DrawPage( const Point& rOrg, - const bool bSecond, - const bool bEnabled ) +void SwColExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOrg, + const bool bSecond, const bool bEnabled) { - SwPageExample::DrawPage( rOrg, bSecond, bEnabled ); + SwPageExample::DrawPage(rRenderContext, rOrg, bSecond, bEnabled); sal_uInt16 nColumnCount; - if( pColMgr && 0 != (nColumnCount = pColMgr->GetCount())) + if (pColMgr && 0 != (nColumnCount = pColMgr->GetCount())) { long nL = GetLeft(); long nR = GetRight(); - if ( GetUsage() == SVX_PAGE_MIRROR && !bSecond ) + if (GetUsage() == SVX_PAGE_MIRROR && !bSecond) { // rotate for mirrored nL = GetRight(); nR = GetLeft(); } - SetFillColor( Color( COL_LIGHTGRAY ) ); + rRenderContext.SetFillColor(Color(COL_LIGHTGRAY)); Rectangle aRect; aRect.Right() = rOrg.X() + GetSize().Width() - nR; aRect.Left() = rOrg.X() + nL; - aRect.Top() = rOrg.Y() + GetTop() - + GetHdHeight() + GetHdDist(); - aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom() - - GetFtHeight() - GetFtDist(); - DrawRect(aRect); + aRect.Top() = rOrg.Y() + GetTop() + GetHdHeight() + GetHdDist(); + aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom() - GetFtHeight() - GetFtDist(); + rRenderContext.DrawRect(aRect); //UUUU const Rectangle aDefineRect(aRect); @@ -240,54 +237,53 @@ void SwColExample::DrawPage( const Point& rOrg, //UUUU 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 - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); const Color& rFieldColor = rStyleSettings.GetFieldColor(); setPageFillAttributes( drawinglayer::attribute::SdrAllFillAttributesHelperPtr( - new drawinglayer::attribute::SdrAllFillAttributesHelper( - rFieldColor))); + new drawinglayer::attribute::SdrAllFillAttributesHelper(rFieldColor))); } // #97495# make sure that the automatic column width's are always equal bool bAutoWidth = pColMgr->IsAutoWidth(); sal_Int32 nAutoColWidth = 0; - if(bAutoWidth) + if (bAutoWidth) { sal_Int32 nColumnWidthSum = 0; sal_uInt16 i; - for(i = 0; i < nColumnCount; ++i) + for (i = 0; i < nColumnCount; ++i) nColumnWidthSum += pColMgr->GetColWidth( i ); nAutoColWidth = nColumnWidthSum / nColumnCount; } sal_uInt16 i; - for( i = 0; i < nColumnCount; i++) + for (i = 0; i < nColumnCount; i++) { - if(!bAutoWidth) - nAutoColWidth = pColMgr->GetColWidth( i ); + if (!bAutoWidth) + nAutoColWidth = pColMgr->GetColWidth(i); aRect.Right() = aRect.Left() + nAutoColWidth; //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); } - if(pColMgr->HasLine()) + if (pColMgr->HasLine()) { - Point aUp( rOrg.X() + nL, rOrg.Y() + GetTop() ); - Point aDown( rOrg.X() + nL, rOrg.Y() + GetSize().Height() - - GetBottom() - GetFtHeight() - GetFtDist() ); + Point aUp(rOrg.X() + nL, rOrg.Y() + GetTop()); + Point aDown(rOrg.X() + nL, + rOrg.Y() + GetSize().Height() - GetBottom() - GetFtHeight() - GetFtDist()); - if( pColMgr->GetLineHeightPercent() != 100 ) + if (pColMgr->GetLineHeightPercent() != 100) { long nLength = aDown.Y() - aUp.Y(); nLength -= nLength * pColMgr->GetLineHeightPercent() / 100; - switch(pColMgr->GetAdjust()) + switch (pColMgr->GetAdjust()) { case COLADJ_BOTTOM: aUp.Y() += nLength; break; case COLADJ_TOP: aDown.Y() -= nLength; break; @@ -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 nDist = pColMgr->GetColWidth( i ) + nGutter; - nDist -= (i == 0) ? - nGutter/2 : - 0; + nDist -= (i == 0) ? nGutter / 2 : 0; aUp.X() += nDist; aDown.X() += nDist; - DrawLine( aUp, aDown ); - + rRenderContext.DrawLine(aUp, aDown); } } } @@ -491,25 +484,24 @@ void SwPageGridExample::dispose() SwPageExample::dispose(); } -void SwPageGridExample::DrawPage( const Point& rOrg, - const bool bSecond, - const bool bEnabled ) +void SwPageGridExample::DrawPage(vcl::RenderContext& rRenderContext, const Point& rOrg, + const bool bSecond, const bool bEnabled) { - SwPageExample::DrawPage(rOrg, bSecond, bEnabled); - if(pGridItem && pGridItem->GetGridType()) + SwPageExample::DrawPage(rRenderContext, rOrg, bSecond, bEnabled); + if (pGridItem && pGridItem->GetGridType()) { //paint the grid now Color aLineColor = pGridItem->GetColor(); - if(aLineColor.GetColor() == COL_AUTO) + if (aLineColor.GetColor() == COL_AUTO) { - aLineColor = GetFillColor(); + aLineColor = rRenderContext.GetFillColor(); aLineColor.Invert(); } - SetLineColor(aLineColor); + rRenderContext.SetLineColor(aLineColor); long nL = GetLeft(); long nR = GetRight(); - if ( GetUsage() == SVX_PAGE_MIRROR && !bSecond ) + if (GetUsage() == SVX_PAGE_MIRROR && !bSecond) { // rotate for mirrored nL = GetRight(); @@ -519,10 +511,8 @@ void SwPageGridExample::DrawPage( const Point& rOrg, Rectangle aRect; aRect.Right() = rOrg.X() + GetSize().Width() - nR; aRect.Left() = rOrg.X() + nL; - aRect.Top() = rOrg.Y() + GetTop() - + GetHdHeight() + GetHdDist(); - aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom() - - GetFtHeight() - GetFtDist(); + aRect.Top() = rOrg.Y() + GetTop() + GetHdHeight() + GetHdDist(); + aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom() - GetFtHeight() - GetFtDist(); //increase the values to get a 'viewable' preview sal_Int32 nBaseHeight = pGridItem->GetBaseHeight() * 3; @@ -542,19 +532,19 @@ void SwPageGridExample::DrawPage( const Point& rOrg, //detect count of rectangles sal_Int32 nLines = (m_bVertical ? aRect.GetWidth(): aRect.GetHeight()) / nLineHeight; - if(nLines > pGridItem->GetLines()) + if (nLines > pGridItem->GetLines()) nLines = pGridItem->GetLines(); // 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); aCharRect.Move(nXStart, 0); } 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); aCharRect.Move(0, nYStart); } @@ -566,20 +556,20 @@ void SwPageGridExample::DrawPage( const Point& rOrg, //vertical lines 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 nYMove = m_bVertical ? 0 : nLineHeight; - for(sal_Int32 nLine = 0; nLine < nLines; nLine++) + for (sal_Int32 nLine = 0; nLine < nLines; nLine++) { - DrawRect(aRubyRect); - DrawRect(aCharRect); - if(bBothLines) + rRenderContext.DrawRect(aRubyRect); + rRenderContext.DrawRect(aCharRect); + if (bBothLines) { Point aStart = aCharRect.TopLeft(); Point aEnd = m_bVertical ? aCharRect.TopRight() : aCharRect.BottomLeft(); while(m_bVertical ? aStart.Y() < aRect.Bottom(): aStart.X() < aRect.Right()) { - DrawLine(aStart, aEnd); + rRenderContext.DrawLine(aStart, aEnd); if(m_bVertical) aStart.Y() = aEnd.Y() += nBaseHeight; else diff --git a/sw/source/uibase/inc/colex.hxx b/sw/source/uibase/inc/colex.hxx index 39a677bae422..35a2809b7af8 100644 --- a/sw/source/uibase/inc/colex.hxx +++ b/sw/source/uibase/inc/colex.hxx @@ -47,14 +47,16 @@ class SW_DLLPUBLIC SwPageGridExample : public SwPageExample SwTextGridItem* pGridItem; bool m_bVertical; protected: - virtual void DrawPage( const Point& rPoint, - const bool bSecond, - const bool bEnabled ) SAL_OVERRIDE; + virtual void DrawPage(vcl::RenderContext& rRenderContext, + const Point& rPoint, + const bool bSecond, + const bool bEnabled) SAL_OVERRIDE; public: - SwPageGridExample(vcl::Window* pPar) : - SwPageExample(pPar), - pGridItem(0), - m_bVertical(false){} + SwPageGridExample(vcl::Window* pPar) + : SwPageExample(pPar) + , pGridItem(0) + , m_bVertical(false) + {} virtual ~SwPageGridExample(); virtual void dispose() SAL_OVERRIDE; @@ -68,9 +70,10 @@ class SW_DLLPUBLIC SwColExample : public SwPageExample using SwPageExample::UpdateExample; protected: - virtual void DrawPage( const Point& rPoint, - const bool bSecond, - const bool bEnabled ) SAL_OVERRIDE; + virtual void DrawPage(vcl::RenderContext& rRenderContext, + const Point& rPoint, + const bool bSecond, + const bool bEnabled) SAL_OVERRIDE; public: SwColExample(vcl::Window* pPar) @@ -95,7 +98,7 @@ private: SwFmtCol m_aCols; protected: - virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE; + virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE; public: SwColumnOnlyExample(vcl::Window*); |