tdf#87933: made pagebreak lines dashed
Change-Id: I0067ef7bc672e159b739d6fd588f1427827e91a8 Reviewed-on: https://gerrit.libreoffice.org/32779 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: jan iversen <jani@documentfoundation.org>
This commit is contained in:
parent
cb8b05eb48
commit
c695869fd8
@ -42,8 +42,8 @@ public:
|
||||
ScGridMerger( OutputDevice* pOutDev, long nOnePixelX, long nOnePixelY );
|
||||
~ScGridMerger();
|
||||
|
||||
void AddHorLine(bool bWorksInPixels, long nX1, long nX2, long nY);
|
||||
void AddVerLine(bool bWorksInPixels, long nX, long nY1, long nY2);
|
||||
void AddHorLine(bool bWorksInPixels, long nX1, long nX2, long nY, bool bDashed = false);
|
||||
void AddVerLine(bool bWorksInPixels, long nX, long nY1, long nY2, bool bDashed = false);
|
||||
void Flush();
|
||||
};
|
||||
|
||||
|
@ -21,6 +21,10 @@
|
||||
|
||||
#include "gridmerg.hxx"
|
||||
|
||||
#define PAGEBREAK_LINE_DISTANCE_PIXEL 5
|
||||
#define PAGEBREAK_LINE_DASH_LEN_PIXEL 5
|
||||
#define PAGEBREAK_LINE_DASH_COUNT 1
|
||||
|
||||
ScGridMerger::ScGridMerger( OutputDevice* pOutDev, long nOnePixelX, long nOnePixelY )
|
||||
: pDev(pOutDev)
|
||||
, nOneX(nOnePixelX)
|
||||
@ -86,9 +90,9 @@ void ScGridMerger::AddLine( long nStart, long nEnd, long nPos )
|
||||
}
|
||||
}
|
||||
|
||||
void ScGridMerger::AddHorLine(bool bWorksInPixels, long nX1, long nX2, long nY)
|
||||
void ScGridMerger::AddHorLine(bool bWorksInPixels, long nX1, long nX2, long nY, bool bDashed)
|
||||
{
|
||||
if (bWorksInPixels)
|
||||
if ( bWorksInPixels )
|
||||
{
|
||||
Point aPoint(pDev->PixelToLogic(Point(nX1, nY)));
|
||||
nX1 = aPoint.X();
|
||||
@ -96,7 +100,28 @@ void ScGridMerger::AddHorLine(bool bWorksInPixels, long nX1, long nX2, long nY)
|
||||
nX2 = pDev->PixelToLogic(Point(nX2, 0)).X();
|
||||
}
|
||||
|
||||
if ( bOptimize )
|
||||
if ( bDashed )
|
||||
{
|
||||
// If there are some unflushed lines they must be flushed since
|
||||
// new line is of different style
|
||||
if (bOptimize) {
|
||||
Flush();
|
||||
bVertical = false;
|
||||
}
|
||||
|
||||
LineInfo aLineInfo(LineStyle::Dash, 1);
|
||||
aLineInfo.SetDashCount( PAGEBREAK_LINE_DASH_COUNT );
|
||||
|
||||
// Calculating logic values of DashLen and Distance from fixed pixel values
|
||||
Size aDashDistanceLen( pDev->PixelToLogic( Size( PAGEBREAK_LINE_DISTANCE_PIXEL,
|
||||
PAGEBREAK_LINE_DASH_LEN_PIXEL )));
|
||||
|
||||
aLineInfo.SetDistance( aDashDistanceLen.Width() );
|
||||
aLineInfo.SetDashLen( aDashDistanceLen.Height() );
|
||||
|
||||
pDev->DrawLine( Point( nX1, nY ), Point( nX2, nY ), aLineInfo );
|
||||
}
|
||||
else if ( bOptimize )
|
||||
{
|
||||
if ( bVertical )
|
||||
{
|
||||
@ -109,7 +134,7 @@ void ScGridMerger::AddHorLine(bool bWorksInPixels, long nX1, long nX2, long nY)
|
||||
pDev->DrawLine( Point( nX1, nY ), Point( nX2, nY ) );
|
||||
}
|
||||
|
||||
void ScGridMerger::AddVerLine(bool bWorksInPixels, long nX, long nY1, long nY2)
|
||||
void ScGridMerger::AddVerLine(bool bWorksInPixels, long nX, long nY1, long nY2, bool bDashed)
|
||||
{
|
||||
if (bWorksInPixels)
|
||||
{
|
||||
@ -119,7 +144,28 @@ void ScGridMerger::AddVerLine(bool bWorksInPixels, long nX, long nY1, long nY2)
|
||||
nY2 = pDev->PixelToLogic(Point(0, nY2)).Y();
|
||||
}
|
||||
|
||||
if ( bOptimize )
|
||||
if ( bDashed )
|
||||
{
|
||||
// If there are some unflushed lines they must be flushed since
|
||||
// new line is of different style
|
||||
if (bOptimize) {
|
||||
Flush();
|
||||
bVertical = false;
|
||||
}
|
||||
|
||||
LineInfo aLineInfo(LineStyle::Dash, 1);
|
||||
aLineInfo.SetDashCount( PAGEBREAK_LINE_DASH_COUNT );
|
||||
|
||||
// Calculating logic values of DashLen and Distance from fixed pixel values
|
||||
Size aDashDistanceLen( pDev->PixelToLogic( Size( PAGEBREAK_LINE_DISTANCE_PIXEL,
|
||||
PAGEBREAK_LINE_DASH_LEN_PIXEL )));
|
||||
|
||||
aLineInfo.SetDistance( aDashDistanceLen.Width() );
|
||||
aLineInfo.SetDashLen( aDashDistanceLen.Height() );
|
||||
|
||||
pDev->DrawLine( Point( nX, nY1 ), Point( nX, nY2 ), aLineInfo);
|
||||
}
|
||||
else if ( bOptimize )
|
||||
{
|
||||
if ( !bVertical )
|
||||
{
|
||||
|
@ -318,6 +318,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool
|
||||
ScBreakType nBreakOld = ScBreakType::NONE;
|
||||
|
||||
bool bSingle;
|
||||
bool bDashed = false;
|
||||
Color aPageColor;
|
||||
Color aManualColor;
|
||||
|
||||
@ -404,8 +405,19 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool
|
||||
if (nBreak != nBreakOld)
|
||||
{
|
||||
aGrid.Flush();
|
||||
rRenderContext.SetLineColor( (nBreak & ScBreakType::Manual) ? aManualColor :
|
||||
nBreak != ScBreakType::NONE ? aPageColor : aGridColor );
|
||||
|
||||
if (static_cast<int>(nBreak))
|
||||
{
|
||||
rRenderContext.SetLineColor( (nBreak & ScBreakType::Manual) ? aManualColor :
|
||||
aPageColor );
|
||||
bDashed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
rRenderContext.SetLineColor( aGridColor );
|
||||
bDashed = false;
|
||||
}
|
||||
|
||||
nBreakOld = nBreak;
|
||||
}
|
||||
}
|
||||
@ -462,14 +474,14 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool
|
||||
|
||||
if (pThisRowInfo->bChanged && !bHOver)
|
||||
{
|
||||
aGrid.AddVerLine(bWorksInPixels, nPosX-nSignedOneX, nPosY, nNextY-nOneY);
|
||||
aGrid.AddVerLine(bWorksInPixels, nPosX-nSignedOneX, nPosY, nNextY-nOneY, bDashed);
|
||||
}
|
||||
nPosY = nNextY;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
aGrid.AddVerLine(bWorksInPixels, nPosX-nSignedOneX, nScrY, nScrY+nScrH-nOneY);
|
||||
aGrid.AddVerLine(bWorksInPixels, nPosX-nSignedOneX, nScrY, nScrY+nScrH-nOneY, bDashed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -510,8 +522,19 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool
|
||||
if (nBreakOld != nBreak)
|
||||
{
|
||||
aGrid.Flush();
|
||||
rRenderContext.SetLineColor( (nBreak & ScBreakType::Manual) ? aManualColor :
|
||||
(nBreak != ScBreakType::NONE) ? aPageColor : aGridColor );
|
||||
|
||||
if (static_cast<int>(nBreak))
|
||||
{
|
||||
rRenderContext.SetLineColor( (nBreak & ScBreakType::Manual) ? aManualColor :
|
||||
aPageColor );
|
||||
bDashed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
rRenderContext.SetLineColor( aGridColor );
|
||||
bDashed = false;
|
||||
}
|
||||
|
||||
nBreakOld = nBreak;
|
||||
}
|
||||
}
|
||||
@ -556,7 +579,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool
|
||||
}
|
||||
if (!bVOver)
|
||||
{
|
||||
aGrid.AddHorLine(bWorksInPixels, nPosX, nNextX-nSignedOneX, nPosY-nOneY);
|
||||
aGrid.AddHorLine(bWorksInPixels, nPosX, nNextX-nSignedOneX, nPosY-nOneY, bDashed);
|
||||
}
|
||||
}
|
||||
nPosX = nNextX;
|
||||
@ -564,7 +587,7 @@ void ScOutputData::DrawGrid(vcl::RenderContext& rRenderContext, bool bGrid, bool
|
||||
}
|
||||
else
|
||||
{
|
||||
aGrid.AddHorLine(bWorksInPixels, nScrX, nScrX+nScrW-nOneX, nPosY-nOneY);
|
||||
aGrid.AddHorLine(bWorksInPixels, nScrX, nScrX+nScrW-nOneX, nPosY-nOneY, bDashed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user