Page Break, Header/Footer: fixed the line color change if config changes

This commit is contained in:
Cédric Bosdonnat 2012-01-04 15:20:22 +01:00
parent 63ade823e2
commit dbd83924fb
4 changed files with 10 additions and 12 deletions

View file

@ -36,9 +36,9 @@
#include <svx/sdr/contact/objectcontacttools.hxx> #include <svx/sdr/contact/objectcontacttools.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
SwDashedLine::SwDashedLine( Window* pParent, const basegfx::BColor& rColor ) : SwDashedLine::SwDashedLine( Window* pParent, Color& ( *pColorFn )() ) :
FixedLine( pParent, WB_DIALOGCONTROL | WB_HORZ ), FixedLine( pParent, WB_DIALOGCONTROL | WB_HORZ ),
m_aColor( rColor ) m_pColorFn( pColorFn )
{ {
} }
@ -69,7 +69,7 @@ void SwDashedLine::Paint( const Rectangle& )
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
std::vector< double > aStrokePattern; std::vector< double > aStrokePattern;
basegfx::BColor aColor = m_aColor; basegfx::BColor aColor = m_pColorFn().getBColor();
if ( rSettings.GetHighContrastMode( ) ) if ( rSettings.GetHighContrastMode( ) )
{ {
// Only a solid line in high contrast mode // Only a solid line in high contrast mode
@ -103,7 +103,7 @@ void SwDashedLine::Paint( const Rectangle& )
drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D * pLine = drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D * pLine =
new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D ( new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D (
basegfx::B2DPolyPolygon( aPolygon ), basegfx::B2DPolyPolygon( aPolygon ),
drawinglayer::attribute::LineAttribute( m_aColor ), drawinglayer::attribute::LineAttribute( m_pColorFn().getBColor() ),
drawinglayer::attribute::StrokeAttribute( aStrokePattern ) ); drawinglayer::attribute::StrokeAttribute( aStrokePattern ) );
aSeq[ aSeq.getLength() - 1 ] = drawinglayer::primitive2d::Primitive2DReference( pLine ); aSeq[ aSeq.getLength() - 1 ] = drawinglayer::primitive2d::Primitive2DReference( pLine );

View file

@ -163,8 +163,7 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag
SetMapMode( MapMode ( MAP_PIXEL ) ); SetMapMode( MapMode ( MAP_PIXEL ) );
// Create the line control // Create the line control
basegfx::BColor aColor = SwViewOption::GetHeaderFooterMarkColor().getBColor(); m_pLine = new SwDashedLine( GetEditWin(), &SwViewOption::GetHeaderFooterMarkColor );
m_pLine = new SwDashedLine( GetEditWin(), aColor );
m_pLine->SetZOrder( this, WINDOW_ZORDER_BEFOR ); m_pLine->SetZOrder( this, WINDOW_ZORDER_BEFOR );
// Create and set the PopupMenu // Create and set the PopupMenu

View file

@ -120,8 +120,8 @@ namespace
SwPageBreakWin* m_pWin; SwPageBreakWin* m_pWin;
public: public:
SwBreakDashedLine( Window* pParent, const BColor& rColor, SwPageBreakWin* pWin ) : SwBreakDashedLine( Window* pParent, Color& ( *pColorFn )(), SwPageBreakWin* pWin ) :
SwDashedLine( pParent, rColor ), SwDashedLine( pParent, pColorFn ),
m_pWin( pWin ) {}; m_pWin( pWin ) {};
virtual void MouseMove( const MouseEvent& rMEvt ); virtual void MouseMove( const MouseEvent& rMEvt );
@ -171,8 +171,7 @@ SwPageBreakWin::SwPageBreakWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm )
SetMapMode( MapMode ( MAP_PIXEL ) ); SetMapMode( MapMode ( MAP_PIXEL ) );
// Create the line control // Create the line control
BColor aColor = SwViewOption::GetPageBreakColor().getBColor(); m_pLine = new SwBreakDashedLine( GetEditWin(), &SwViewOption::GetPageBreakColor, this );
m_pLine = new SwBreakDashedLine( GetEditWin(), aColor, this );
// Create the popup menu // Create the popup menu
m_pPopupMenu = new PopupMenu( SW_RES( MN_PAGEBREAK_BUTTON ) ); m_pPopupMenu = new PopupMenu( SW_RES( MN_PAGEBREAK_BUTTON ) );

View file

@ -35,10 +35,10 @@
*/ */
class SwDashedLine : public FixedLine class SwDashedLine : public FixedLine
{ {
basegfx::BColor m_aColor; Color& (*m_pColorFn)();
public: public:
SwDashedLine( Window* pParent, const basegfx::BColor& rColor ); SwDashedLine( Window* pParent, Color& ( *pColorFn )() );
~SwDashedLine( ); ~SwDashedLine( );
virtual void Paint( const Rectangle& rRect ); virtual void Paint( const Rectangle& rRect );