Kaydet (Commit) 053d4c9c authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat

Header/Footer: small painting improvements

The dashed line is now 1px wide and has smaller dashes. The separator
button has also smaller padding.
üst d996328c
...@@ -3275,8 +3275,6 @@ void SwLayoutFrm::Paint(SwRect const& rRect, SwPrintData const*const) const ...@@ -3275,8 +3275,6 @@ void SwLayoutFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
} }
} }
#define LINE_HALF_THICKNESS 10
drawinglayer::primitive2d::Primitive2DSequence lcl_CreateHeaderFooterSeparatorPrimitives( drawinglayer::primitive2d::Primitive2DSequence lcl_CreateHeaderFooterSeparatorPrimitives(
const SwPageFrm* pPageFrm, double nLineY ) const SwPageFrm* pPageFrm, double nLineY )
{ {
...@@ -3293,8 +3291,8 @@ drawinglayer::primitive2d::Primitive2DSequence lcl_CreateHeaderFooterSeparatorPr ...@@ -3293,8 +3291,8 @@ drawinglayer::primitive2d::Primitive2DSequence lcl_CreateHeaderFooterSeparatorPr
// Dashed line in twips // Dashed line in twips
std::vector< double > aStrokePattern; std::vector< double > aStrokePattern;
aStrokePattern.push_back( 110 ); aStrokePattern.push_back( 40 );
aStrokePattern.push_back( 110 ); aStrokePattern.push_back( 40 );
// Compute the dashed line primitive // Compute the dashed line primitive
...@@ -3302,11 +3300,10 @@ drawinglayer::primitive2d::Primitive2DSequence lcl_CreateHeaderFooterSeparatorPr ...@@ -3302,11 +3300,10 @@ drawinglayer::primitive2d::Primitive2DSequence lcl_CreateHeaderFooterSeparatorPr
aLinePolygon.append( aLeft ); aLinePolygon.append( aLeft );
aLinePolygon.append( aRight ); aLinePolygon.append( aRight );
double nThickness = double( LINE_HALF_THICKNESS ) * 2;
drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D * pLine = drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D * pLine =
new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D ( new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D (
basegfx::B2DPolyPolygon( aLinePolygon ), basegfx::B2DPolyPolygon( aLinePolygon ),
drawinglayer::attribute::LineAttribute( aLineColor, nThickness ), drawinglayer::attribute::LineAttribute( aLineColor ),
drawinglayer::attribute::StrokeAttribute( aStrokePattern ) ); drawinglayer::attribute::StrokeAttribute( aStrokePattern ) );
aSeq[0] = drawinglayer::primitive2d::Primitive2DReference( pLine ); aSeq[0] = drawinglayer::primitive2d::Primitive2DReference( pLine );
...@@ -3408,9 +3405,6 @@ void SwPageFrm::PaintDecorators( ) const ...@@ -3408,9 +3405,6 @@ void SwPageFrm::PaintDecorators( ) const
{ {
drawinglayer::processor2d::BaseProcessor2D* pProcessor = CreateProcessor2D(); drawinglayer::processor2d::BaseProcessor2D* pProcessor = CreateProcessor2D();
// Line thickness in px
long nHalfThickness = pGlobalShell->GetOut()->LogicToPixel( Point( 0, LINE_HALF_THICKNESS ) ).Y();
// Header // Header
const SwFrm* pHeaderFrm = Lower(); const SwFrm* pHeaderFrm = Lower();
if ( !pHeaderFrm->IsHeaderFrm() ) if ( !pHeaderFrm->IsHeaderFrm() )
...@@ -3420,7 +3414,7 @@ void SwPageFrm::PaintDecorators( ) const ...@@ -3420,7 +3414,7 @@ void SwPageFrm::PaintDecorators( ) const
long nXOff = std::min( aBodyRect.Right(), rVisArea.Right() ); long nXOff = std::min( aBodyRect.Right(), rVisArea.Right() );
long nHeaderYOff = aBodyRect.Top(); long nHeaderYOff = aBodyRect.Top();
Point nOutputOff = rEditWin.LogicToPixel( Point( nXOff, nHeaderYOff + nHalfThickness ) ); Point nOutputOff = rEditWin.LogicToPixel( Point( nXOff, nHeaderYOff ) );
rEditWin.SetHeaderFooterControl( this, true, nOutputOff ); rEditWin.SetHeaderFooterControl( this, true, nOutputOff );
pProcessor->process( lcl_CreateHeaderFooterSeparatorPrimitives( pProcessor->process( lcl_CreateHeaderFooterSeparatorPrimitives(
...@@ -3436,7 +3430,7 @@ void SwPageFrm::PaintDecorators( ) const ...@@ -3436,7 +3430,7 @@ void SwPageFrm::PaintDecorators( ) const
} }
long nFooterYOff = aBodyRect.Bottom(); long nFooterYOff = aBodyRect.Bottom();
nOutputOff = rEditWin.LogicToPixel( Point( nXOff, nFooterYOff - nHalfThickness ) ); nOutputOff = rEditWin.LogicToPixel( Point( nXOff, nFooterYOff ) );
rEditWin.SetHeaderFooterControl( this, false, nOutputOff ); rEditWin.SetHeaderFooterControl( this, false, nOutputOff );
pProcessor->process( lcl_CreateHeaderFooterSeparatorPrimitives( pProcessor->process( lcl_CreateHeaderFooterSeparatorPrimitives(
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
#include <vcl/menubtn.hxx> #include <vcl/menubtn.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#define TEXT_PADDING 7 #define TEXT_PADDING 5
#define BOX_DISTANCE 10 #define BOX_DISTANCE 10
#define BUTTON_WIDTH 18 #define BUTTON_WIDTH 18
......
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