Kaydet (Commit) 561cebee authored tarafından Krisztian Pinter's avatar Krisztian Pinter Kaydeden (comit) Jan Holesovsky

calc mapmode: Pass RenderContext as reference in DrawPagePreview

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