[Libreoffice-commits] core.git: sc/source

Krisztian Pinter pin.terminator at gmail.com
Wed Jul 22 04:39:18 PDT 2015


 sc/source/ui/inc/gridwin.hxx   |    2 -
 sc/source/ui/view/gridwin4.cxx |   44 ++++++++++++++++++++---------------------
 2 files changed, 23 insertions(+), 23 deletions(-)

New commits:
commit 561cebeeba2155a7ebedbea885c9d7bf43102ec6
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date:   Tue Jun 16 18:10:47 2015 +0200

    calc mapmode: Pass RenderContext as reference in DrawPagePreview
    
    Change-Id: I8c4834914b2061c928f4d1172b48d79c2fc4d842
    Reviewed-on: https://gerrit.libreoffice.org/16348
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 0c940e9..c05cea9 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -265,7 +265,7 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou
     void            DrawAfterScroll();
     Rectangle       GetListValButtonRect( const ScAddress& rButtonPos );
 
-    void            DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, OutputDevice* pContentDev );
+    void            DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::RenderContext& rRenderContext);
 
     bool            GetEditUrl( const Point& rPos,
                                 OUString* pName=0, OUString* pUrl=0, OUString* pTarget=0 );
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 2a054d6..b2e76c4 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -737,7 +737,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
         // DrawPagePreview draws complete lines/page numbers, must always be clipped
         if ( aOutputData.SetChangedClip() )
         {
-            DrawPagePreview(nX1,nY1,nX2,nY2, pContentDev);
+            DrawPagePreview(nX1,nY1,nX2,nY2, *pContentDev);
             pContentDev->SetClipRegion();
         }
     }
@@ -1112,7 +1112,7 @@ void ScGridWindow::CheckNeedsRepaint()
     }
 }
 
-void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, OutputDevice* pContentDev )
+void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::RenderContext& rRenderContext)
 {
     ScPageBreakData* pPageData = pViewData->GetView()->GetPageBreakData();
     if (pPageData)
@@ -1147,7 +1147,7 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
         {
             //  use EditEngine to draw mixed-script string
             pEditEng.reset(new ScEditEngineDefaulter( EditEngine::CreatePool(), true ));
-            pEditEng->SetRefMapMode( pContentDev->GetMapMode() );
+            pEditEng->SetRefMapMode(rRenderContext.GetMapMode());
             SfxItemSet* pEditDefaults = new SfxItemSet( pEditEng->GetEmptyItemSet() );
             rDefPattern.FillEditItemSet( pEditDefaults );
             pEditDefaults->Put( SvxColorItem( Color( COL_LIGHTGRAY ), EE_CHAR_COLOR ) );
@@ -1165,11 +1165,11 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
                 // 3 pixel frame around the print area
                 //  (middle pixel on the grid lines)
 
-                pContentDev->SetLineColor();
+                rRenderContext.SetLineColor();
                 if (rData.IsAutomatic())
-                    pContentDev->SetFillColor( aAutomatic );
+                    rRenderContext.SetFillColor( aAutomatic );
                 else
-                    pContentDev->SetFillColor( aManual );
+                    rRenderContext.SetFillColor( aManual );
 
                 Point aStart = pViewData->GetScrPos(
                                     aRange.aStart.Col(), aRange.aStart.Row(), eWhich, true );
@@ -1186,10 +1186,10 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
                 if ( aEnd.Y() > aWinSize.Height() + 10 )
                     aEnd.Y() = aWinSize.Height() + 10;
 
-                pContentDev->DrawRect( Rectangle( aStart, Point(aEnd.X(),aStart.Y()+2) ) );
-                pContentDev->DrawRect( Rectangle( aStart, Point(aStart.X()+2,aEnd.Y()) ) );
-                pContentDev->DrawRect( Rectangle( Point(aStart.X(),aEnd.Y()-2), aEnd ) );
-                pContentDev->DrawRect( Rectangle( Point(aEnd.X()-2,aStart.Y()), aEnd ) );
+                rRenderContext.DrawRect( Rectangle( aStart, Point(aEnd.X(),aStart.Y()+2) ) );
+                rRenderContext.DrawRect( Rectangle( aStart, Point(aStart.X()+2,aEnd.Y()) ) );
+                rRenderContext.DrawRect( Rectangle( Point(aStart.X(),aEnd.Y()-2), aEnd ) );
+                rRenderContext.DrawRect( Rectangle( Point(aEnd.X()-2,aStart.Y()), aEnd ) );
 
                 // Page breakes
                 //! Display differently (dashed ????)
@@ -1204,12 +1204,12 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
                     {
                         //! Search for hidden
                         if (pDoc->HasColBreak(nBreak, nTab) & BREAK_MANUAL)
-                            pContentDev->SetFillColor( aManual );
+                            rRenderContext.SetFillColor( aManual );
                         else
-                            pContentDev->SetFillColor( aAutomatic );
+                            rRenderContext.SetFillColor( aAutomatic );
                         Point aBreak = pViewData->GetScrPos(
                                         nBreak, aRange.aStart.Row(), eWhich, true );
-                        pContentDev->DrawRect( Rectangle( aBreak.X()-1, aStart.Y(), aBreak.X(), aEnd.Y() ) );
+                        rRenderContext.DrawRect( Rectangle( aBreak.X()-1, aStart.Y(), aBreak.X(), aEnd.Y() ) );
                     }
                 }
 
@@ -1223,12 +1223,12 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
                     {
                         //! Search for hidden
                         if (pDoc->HasRowBreak(nBreak, nTab) & BREAK_MANUAL)
-                            pContentDev->SetFillColor( aManual );
+                            rRenderContext.SetFillColor( aManual );
                         else
-                            pContentDev->SetFillColor( aAutomatic );
+                            rRenderContext.SetFillColor( aAutomatic );
                         Point aBreak = pViewData->GetScrPos(
                                         aRange.aStart.Col(), nBreak, eWhich, true );
-                        pContentDev->DrawRect( Rectangle( aStart.X(), aBreak.Y()-1, aEnd.X(), aBreak.Y() ) );
+                        rRenderContext.DrawRect( Rectangle( aStart.X(), aBreak.Y()-1, aEnd.X(), aBreak.Y() ) );
                     }
                 }
 
@@ -1281,26 +1281,26 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
                                     Size aTextSize( pEditEng->CalcTextWidth(), pEditEng->GetTextHeight() );
                                     Point aPos( (aPageStart.X()+aPageEnd.X()-aTextSize.Width())/2,
                                                 (aPageStart.Y()+aPageEnd.Y()-aTextSize.Height())/2 );
-                                    pEditEng->Draw( pContentDev, aPos );
+                                    pEditEng->Draw( &rRenderContext, aPos );
                                 }
                                 else
                                 {
                                     //  find right font size for DrawText
                                     aFont.SetSize( Size( 0,100 ) );
-                                    pContentDev->SetFont( aFont );
-                                    Size aSize100( pContentDev->GetTextWidth( aThisPageStr ), pContentDev->GetTextHeight() );
+                                    rRenderContext.SetFont( aFont );
+                                    Size aSize100(rRenderContext.GetTextWidth( aThisPageStr ), rRenderContext.GetTextHeight() );
 
                                     //  40% of width or 60% of height
                                     long nSizeX = 40 * ( aPageEnd.X() - aPageStart.X() ) / aSize100.Width();
                                     long nSizeY = 60 * ( aPageEnd.Y() - aPageStart.Y() ) / aSize100.Height();
                                     aFont.SetSize( Size( 0,std::min(nSizeX,nSizeY) ) );
-                                    pContentDev->SetFont( aFont );
+                                    rRenderContext.SetFont( aFont );
 
                                     //  centered output with DrawText
-                                    Size aTextSize( pContentDev->GetTextWidth( aThisPageStr ), pContentDev->GetTextHeight() );
+                                    Size aTextSize(rRenderContext.GetTextWidth( aThisPageStr ), rRenderContext.GetTextHeight() );
                                     Point aPos( (aPageStart.X()+aPageEnd.X()-aTextSize.Width())/2,
                                                 (aPageStart.Y()+aPageEnd.Y()-aTextSize.Height())/2 );
-                                    pContentDev->DrawText( aPos, aThisPageStr );
+                                    rRenderContext.DrawText( aPos, aThisPageStr );
                                 }
                             }
                             nPrStartX = nPrEndX + 1;


More information about the Libreoffice-commits mailing list