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

calc mapmode: Pass RenderContext as reference in DrawFrame

Change-Id: I6c9a476a8dea5266868c94d6a1203cfe840171cf
üst 8cfdd81b
...@@ -239,7 +239,7 @@ private: ...@@ -239,7 +239,7 @@ private:
double GetStretch(); double GetStretch();
void DrawRotatedFrame( const Color* pForceColor ); // pixel void DrawRotatedFrame(vcl::RenderContext& rRenderContext, const Color* pForceColor); // pixel
drawinglayer::processor2d::BaseProcessor2D* CreateProcessor2D( ); drawinglayer::processor2d::BaseProcessor2D* CreateProcessor2D( );
...@@ -307,7 +307,7 @@ public: ...@@ -307,7 +307,7 @@ public:
void DrawBackground(vcl::RenderContext& rRenderContext); void DrawBackground(vcl::RenderContext& rRenderContext);
void DrawShadow(); void DrawShadow();
void DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBottom); void DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBottom);
void DrawFrame(); void DrawFrame(vcl::RenderContext& rRenderContext);
// with logic MapMode set! // with logic MapMode set!
void DrawEdit(bool bPixelToLogic); void DrawEdit(bool bPixelToLogic);
......
...@@ -743,7 +743,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI ...@@ -743,7 +743,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
} }
aOutputData.DrawShadow(); aOutputData.DrawShadow();
aOutputData.DrawFrame(); aOutputData.DrawFrame(*pContentDev);
// Show Note Mark // Show Note Mark
if ( rOpts.GetOption( VOPT_NOTES ) ) if ( rOpts.GetOption( VOPT_NOTES ) )
......
...@@ -1286,9 +1286,9 @@ size_t lclGetArrayColFromCellInfoX( sal_uInt16 nCellInfoX, sal_uInt16 nCellInfoF ...@@ -1286,9 +1286,9 @@ size_t lclGetArrayColFromCellInfoX( sal_uInt16 nCellInfoX, sal_uInt16 nCellInfoF
return static_cast< size_t >( bRTL ? (nCellInfoLastX + 2 - nCellInfoX) : (nCellInfoX - nCellInfoFirstX) ); return static_cast< size_t >( bRTL ? (nCellInfoLastX + 2 - nCellInfoX) : (nCellInfoX - nCellInfoFirstX) );
} }
void ScOutputData::DrawFrame() void ScOutputData::DrawFrame(vcl::RenderContext& rRenderContext)
{ {
DrawModeFlags nOldDrawMode = mpDev->GetDrawMode(); DrawModeFlags nOldDrawMode = rRenderContext.GetDrawMode();
Color aSingleColor; Color aSingleColor;
bool bUseSingleColor = false; bool bUseSingleColor = false;
...@@ -1302,13 +1302,13 @@ void ScOutputData::DrawFrame() ...@@ -1302,13 +1302,13 @@ void ScOutputData::DrawFrame()
if ( ( nOldDrawMode & DrawModeFlags::WhiteFill ) && ( nOldDrawMode & DrawModeFlags::BlackLine ) ) if ( ( nOldDrawMode & DrawModeFlags::WhiteFill ) && ( nOldDrawMode & DrawModeFlags::BlackLine ) )
{ {
mpDev->SetDrawMode( nOldDrawMode & (~DrawModeFlags::WhiteFill) ); rRenderContext.SetDrawMode( nOldDrawMode & (~DrawModeFlags::WhiteFill) );
aSingleColor.SetColor( COL_BLACK ); aSingleColor.SetColor( COL_BLACK );
bUseSingleColor = true; bUseSingleColor = true;
} }
else if ( ( nOldDrawMode & DrawModeFlags::SettingsFill ) && ( nOldDrawMode & DrawModeFlags::SettingsLine ) ) else if ( ( nOldDrawMode & DrawModeFlags::SettingsFill ) && ( nOldDrawMode & DrawModeFlags::SettingsLine ) )
{ {
mpDev->SetDrawMode( nOldDrawMode & (~DrawModeFlags::SettingsFill) ); rRenderContext.SetDrawMode( nOldDrawMode & (~DrawModeFlags::SettingsFill) );
aSingleColor = rStyleSettings.GetWindowTextColor(); // same as used in VCL for DrawModeFlags::SettingsLine aSingleColor = rStyleSettings.GetWindowTextColor(); // same as used in VCL for DrawModeFlags::SettingsLine
bUseSingleColor = true; bUseSingleColor = true;
} }
...@@ -1321,12 +1321,12 @@ void ScOutputData::DrawFrame() ...@@ -1321,12 +1321,12 @@ void ScOutputData::DrawFrame()
const Color* pForceColor = bUseSingleColor ? &aSingleColor : 0; const Color* pForceColor = bUseSingleColor ? &aSingleColor : 0;
if (bAnyRotated) if (bAnyRotated)
DrawRotatedFrame( pForceColor ); // removes the lines that must not be painted here DrawRotatedFrame(rRenderContext, pForceColor); // removes the lines that must not be painted here
long nInitPosX = nScrX; long nInitPosX = nScrX;
if ( bLayoutRTL ) if ( bLayoutRTL )
{ {
Size aOnePixel = mpDev->PixelToLogic(Size(1,1)); Size aOnePixel = rRenderContext.PixelToLogic(Size(1,1));
long nOneX = aOnePixel.Width(); long nOneX = aOnePixel.Width();
nInitPosX += nMirrorW - nOneX; nInitPosX += nMirrorW - nOneX;
} }
...@@ -1343,12 +1343,12 @@ void ScOutputData::DrawFrame() ...@@ -1343,12 +1343,12 @@ void ScOutputData::DrawFrame()
// row 0 is not visible (dummy for borders from top) - subtract its height from initial position // row 0 is not visible (dummy for borders from top) - subtract its height from initial position
// subtract 1 unit more, because position 0 is first *in* cell, grid line is one unit before // subtract 1 unit more, because position 0 is first *in* cell, grid line is one unit before
long nOldPosY = nScrY - 1 - pRowInfo[ 0 ].nHeight; long nOldPosY = nScrY - 1 - pRowInfo[ 0 ].nHeight;
long nOldSnapY = lclGetSnappedY( *mpDev, nOldPosY, bSnapPixel ); long nOldSnapY = lclGetSnappedY( rRenderContext, nOldPosY, bSnapPixel );
rArray.SetYOffset( nOldSnapY ); rArray.SetYOffset( nOldSnapY );
for( size_t nRow = 0; nRow < nRowCount; ++nRow ) for( size_t nRow = 0; nRow < nRowCount; ++nRow )
{ {
long nNewPosY = nOldPosY + pRowInfo[ nRow ].nHeight; long nNewPosY = nOldPosY + pRowInfo[ nRow ].nHeight;
long nNewSnapY = lclGetSnappedY( *mpDev, nNewPosY, bSnapPixel ); long nNewSnapY = lclGetSnappedY( rRenderContext, nNewPosY, bSnapPixel );
rArray.SetRowHeight( nRow, nNewSnapY - nOldSnapY ); rArray.SetRowHeight( nRow, nNewSnapY - nOldSnapY );
nOldPosY = nNewPosY; nOldPosY = nNewPosY;
nOldSnapY = nNewSnapY; nOldSnapY = nNewSnapY;
...@@ -1359,7 +1359,7 @@ void ScOutputData::DrawFrame() ...@@ -1359,7 +1359,7 @@ void ScOutputData::DrawFrame()
// column nX1 is not visible (dummy for borders from left) - subtract its width from initial position // column nX1 is not visible (dummy for borders from left) - subtract its width from initial position
// subtract 1 unit more, because position 0 is first *in* cell, grid line is one unit above // subtract 1 unit more, because position 0 is first *in* cell, grid line is one unit above
long nOldPosX = nInitPosX - nLayoutSign * (1 + pRowInfo[ 0 ].pCellInfo[ nX1 ].nWidth); long nOldPosX = nInitPosX - nLayoutSign * (1 + pRowInfo[ 0 ].pCellInfo[ nX1 ].nWidth);
long nOldSnapX = lclGetSnappedX( *mpDev, nOldPosX, bSnapPixel ); long nOldSnapX = lclGetSnappedX( rRenderContext, nOldPosX, bSnapPixel );
// set X offset for left-to-right sheets; for right-to-left sheets this is done after for() loop // set X offset for left-to-right sheets; for right-to-left sheets this is done after for() loop
if( !bLayoutRTL ) if( !bLayoutRTL )
rArray.SetXOffset( nOldSnapX ); rArray.SetXOffset( nOldSnapX );
...@@ -1367,7 +1367,7 @@ void ScOutputData::DrawFrame() ...@@ -1367,7 +1367,7 @@ void ScOutputData::DrawFrame()
{ {
size_t nCol = lclGetArrayColFromCellInfoX( nInfoIdx, nX1, nX2, bLayoutRTL ); size_t nCol = lclGetArrayColFromCellInfoX( nInfoIdx, nX1, nX2, bLayoutRTL );
long nNewPosX = nOldPosX + pRowInfo[ 0 ].pCellInfo[ nInfoIdx ].nWidth * nLayoutSign; long nNewPosX = nOldPosX + pRowInfo[ 0 ].pCellInfo[ nInfoIdx ].nWidth * nLayoutSign;
long nNewSnapX = lclGetSnappedX( *mpDev, nNewPosX, bSnapPixel ); long nNewSnapX = lclGetSnappedX( rRenderContext, nNewPosX, bSnapPixel );
rArray.SetColWidth( nCol, std::abs( nNewSnapX - nOldSnapX ) ); rArray.SetColWidth( nCol, std::abs( nNewSnapX - nOldSnapX ) );
nOldPosX = nNewPosX; nOldPosX = nNewPosX;
nOldSnapX = nNewSnapX; nOldSnapX = nNewSnapX;
...@@ -1404,7 +1404,7 @@ void ScOutputData::DrawFrame() ...@@ -1404,7 +1404,7 @@ void ScOutputData::DrawFrame()
} }
pProcessor.reset(); pProcessor.reset();
mpDev->SetDrawMode(nOldDrawMode); rRenderContext.SetDrawMode(nOldDrawMode);
} }
// Line below the cell // Line below the cell
...@@ -1474,7 +1474,7 @@ static long lcl_getRotate( ScDocument* pDoc, SCTAB nTab, SCCOL nX, SCROW nY ) ...@@ -1474,7 +1474,7 @@ static long lcl_getRotate( ScDocument* pDoc, SCTAB nTab, SCCOL nX, SCROW nY )
return nRotate; return nRotate;
} }
void ScOutputData::DrawRotatedFrame( const Color* pForceColor ) void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext, const Color* pForceColor)
{ {
//! save nRotMax //! save nRotMax
SCCOL nRotMax = nX2; SCCOL nRotMax = nX2;
...@@ -1493,7 +1493,7 @@ void ScOutputData::DrawRotatedFrame( const Color* pForceColor ) ...@@ -1493,7 +1493,7 @@ void ScOutputData::DrawRotatedFrame( const Color* pForceColor )
long nInitPosX = nScrX; long nInitPosX = nScrX;
if ( bLayoutRTL ) if ( bLayoutRTL )
{ {
Size aOnePixel = mpDev->PixelToLogic(Size(1,1)); Size aOnePixel = rRenderContext.PixelToLogic(Size(1,1));
long nOneX = aOnePixel.Width(); long nOneX = aOnePixel.Width();
nInitPosX += nMirrorW - nOneX; nInitPosX += nMirrorW - nOneX;
} }
...@@ -1502,11 +1502,11 @@ void ScOutputData::DrawRotatedFrame( const Color* pForceColor ) ...@@ -1502,11 +1502,11 @@ void ScOutputData::DrawRotatedFrame( const Color* pForceColor )
Rectangle aClipRect( Point(nScrX, nScrY), Size(nScrW, nScrH) ); Rectangle aClipRect( Point(nScrX, nScrY), Size(nScrW, nScrH) );
if (bMetaFile) if (bMetaFile)
{ {
mpDev->Push(); rRenderContext.Push();
mpDev->IntersectClipRegion( aClipRect ); rRenderContext.IntersectClipRegion( aClipRect );
} }
else else
mpDev->SetClipRegion( vcl::Region( aClipRect ) ); rRenderContext.SetClipRegion( vcl::Region( aClipRect ) );
svx::frame::Array& rArray = mrTabInfo.maArray; svx::frame::Array& rArray = mrTabInfo.maArray;
boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(CreateProcessor2D( )); boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(CreateProcessor2D( ));
...@@ -1643,11 +1643,11 @@ void ScOutputData::DrawRotatedFrame( const Color* pForceColor ) ...@@ -1643,11 +1643,11 @@ void ScOutputData::DrawRotatedFrame( const Color* pForceColor )
// ohne Pen wird bei DrawPolygon rechts und unten // ohne Pen wird bei DrawPolygon rechts und unten
// ein Pixel weggelassen... // ein Pixel weggelassen...
if ( rColor.GetTransparency() == 0 ) if ( rColor.GetTransparency() == 0 )
mpDev->SetLineColor(rColor); rRenderContext.SetLineColor(rColor);
else else
mpDev->SetLineColor(); rRenderContext.SetLineColor();
mpDev->SetFillColor(rColor); rRenderContext.SetFillColor(rColor);
mpDev->DrawPolygon( aPoly ); rRenderContext.DrawPolygon( aPoly );
} }
} }
} }
...@@ -1659,11 +1659,11 @@ void ScOutputData::DrawRotatedFrame( const Color* pForceColor ) ...@@ -1659,11 +1659,11 @@ void ScOutputData::DrawRotatedFrame( const Color* pForceColor )
// ohne Pen wird bei DrawPolygon rechts und unten // ohne Pen wird bei DrawPolygon rechts und unten
// ein Pixel weggelassen... // ein Pixel weggelassen...
if ( pColor->GetTransparency() == 0 ) if ( pColor->GetTransparency() == 0 )
mpDev->SetLineColor(*pColor); rRenderContext.SetLineColor(*pColor);
else else
mpDev->SetLineColor(); rRenderContext.SetLineColor();
mpDev->SetFillColor(*pColor); rRenderContext.SetFillColor(*pColor);
mpDev->DrawPolygon( aPoly ); rRenderContext.DrawPolygon( aPoly );
} }
...@@ -1813,9 +1813,9 @@ void ScOutputData::DrawRotatedFrame( const Color* pForceColor ) ...@@ -1813,9 +1813,9 @@ void ScOutputData::DrawRotatedFrame( const Color* pForceColor )
pProcessor.reset(); pProcessor.reset();
if (bMetaFile) if (bMetaFile)
mpDev->Pop(); rRenderContext.Pop();
else else
mpDev->SetClipRegion(); rRenderContext.SetClipRegion();
} }
drawinglayer::processor2d::BaseProcessor2D* ScOutputData::CreateProcessor2D( ) drawinglayer::processor2d::BaseProcessor2D* ScOutputData::CreateProcessor2D( )
......
...@@ -549,8 +549,9 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr ...@@ -549,8 +549,9 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr
pDev->SetMapMode(aMode); pDev->SetMapMode(aMode);
aOutputData.DrawBackground(*pDev); aOutputData.DrawBackground(*pDev);
aOutputData.DrawShadow(); aOutputData.DrawShadow();
aOutputData.DrawFrame(); aOutputData.DrawFrame(*pDev);
aOutputData.DrawStrings(); aOutputData.DrawStrings();
if (!bMetaFile && pViewData) if (!bMetaFile && pViewData)
...@@ -1349,7 +1350,7 @@ void ScPrintFunc::DrawBorder( long nScrX, long nScrY, long nScrW, long nScrH, ...@@ -1349,7 +1350,7 @@ void ScPrintFunc::DrawBorder( long nScrX, long nScrY, long nScrW, long nScrH,
aOutputData.SetUseStyleColor( bUseStyleColor ); aOutputData.SetUseStyleColor( bUseStyleColor );
if (pBorderData) if (pBorderData)
aOutputData.DrawFrame(); aOutputData.DrawFrame(*pDev);
} }
} }
...@@ -1613,7 +1614,7 @@ void ScPrintFunc::PrintArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ...@@ -1613,7 +1614,7 @@ void ScPrintFunc::PrintArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
if( aTableParam.bCellContent ) if( aTableParam.bCellContent )
{ {
aOutputData.DrawExtraShadow( bShLeft, bShTop, bShRight, bShBottom ); aOutputData.DrawExtraShadow( bShLeft, bShTop, bShRight, bShBottom );
aOutputData.DrawFrame(); aOutputData.DrawFrame(*pDev);
aOutputData.DrawStrings(); aOutputData.DrawStrings();
aOutputData.DrawEdit(false); aOutputData.DrawEdit(false);
} }
......
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