diff options
author | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2012-02-13 11:20:22 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2012-02-13 11:21:26 +0100 |
commit | beb8a85796c78d4cdcf6497b6725fce8f7141d75 (patch) | |
tree | f927f6cbd06f814c6bd0c784960bd6efefbf625a /sw/source/ui/docvw/HeaderFooterWin.cxx | |
parent | 492dbf9ceceea81edeb5d6c8d94aeed09e738176 (diff) |
Header/Footer, Page Break: don't show them in RO mode (fdo#45548)
Diffstat (limited to 'sw/source/ui/docvw/HeaderFooterWin.cxx')
-rw-r--r-- | sw/source/ui/docvw/HeaderFooterWin.cxx | 97 |
1 files changed, 46 insertions, 51 deletions
diff --git a/sw/source/ui/docvw/HeaderFooterWin.cxx b/sw/source/ui/docvw/HeaderFooterWin.cxx index 330c1ff4f6c6..32e876726ba9 100644 --- a/sw/source/ui/docvw/HeaderFooterWin.cxx +++ b/sw/source/ui/docvw/HeaderFooterWin.cxx @@ -148,7 +148,6 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag SwFrameControl( pEditWin, pPageFrm ), m_sLabel( ), m_bIsHeader( bHeader ), - m_bReadonly( false ), m_pPopupMenu( NULL ), m_pLine( NULL ), m_bIsAppearing( false ), @@ -329,57 +328,54 @@ void SwHeaderFooterWin::Paint( const Rectangle& ) com::sun::star::lang::Locale(), aLineColor ) ); - // Create the 'plus' or 'arrow' primitive if not readonly - if ( !m_bReadonly ) - { - B2DRectangle aSignArea( B2DPoint( aRect.Right() - BUTTON_WIDTH, 0.0 ), - B2DSize( aRect.Right(), aRect.getHeight() ) ); + // Create the 'plus' or 'arrow' primitive + B2DRectangle aSignArea( B2DPoint( aRect.Right() - BUTTON_WIDTH, 0.0 ), + B2DSize( aRect.Right(), aRect.getHeight() ) ); - B2DPolygon aSign; - if ( IsEmptyHeaderFooter( ) ) - { - // Create the + polygon - double nLeft = aSignArea.getMinX() + TEXT_PADDING; - double nRight = aSignArea.getMaxX() - TEXT_PADDING; - double nHalfW = ( nRight - nLeft ) / 2.0; - - double nTop = aSignArea.getCenterY() - nHalfW; - double nBottom = aSignArea.getCenterY() + nHalfW; - - aSign.append( B2DPoint( nLeft, aSignArea.getCenterY() - 1.0 ) ); - aSign.append( B2DPoint( aSignArea.getCenterX() - 1.0, aSignArea.getCenterY() - 1.0 ) ); - aSign.append( B2DPoint( aSignArea.getCenterX() - 1.0, nTop ) ); - aSign.append( B2DPoint( aSignArea.getCenterX() + 1.0, nTop ) ); - aSign.append( B2DPoint( aSignArea.getCenterX() + 1.0, aSignArea.getCenterY() - 1.0 ) ); - aSign.append( B2DPoint( nRight, aSignArea.getCenterY() - 1.0 ) ); - aSign.append( B2DPoint( nRight, aSignArea.getCenterY() + 1.0 ) ); - aSign.append( B2DPoint( aSignArea.getCenterX() + 1.0, aSignArea.getCenterY() + 1.0 ) ); - aSign.append( B2DPoint( aSignArea.getCenterX() + 1.0, nBottom ) ); - aSign.append( B2DPoint( aSignArea.getCenterX() - 1.0, nBottom ) ); - aSign.append( B2DPoint( aSignArea.getCenterX() - 1.0, aSignArea.getCenterY() + 1.0 ) ); - aSign.append( B2DPoint( nLeft, aSignArea.getCenterY() + 1.0 ) ); - aSign.setClosed( true ); - } - else - { - // Create the v polygon - B2DPoint aLeft( aSignArea.getMinX() + TEXT_PADDING, aSignArea.getCenterY() ); - B2DPoint aRight( aSignArea.getMaxX() - TEXT_PADDING, aSignArea.getCenterY() ); - B2DPoint aBottom( ( aLeft.getX() + aRight.getX() ) / 2.0, aLeft.getY() + 4.0 ); - aSign.append( aLeft ); - aSign.append( aRight ); - aSign.append( aBottom ); - aSign.setClosed( true ); - } + B2DPolygon aSign; + if ( IsEmptyHeaderFooter( ) ) + { + // Create the + polygon + double nLeft = aSignArea.getMinX() + TEXT_PADDING; + double nRight = aSignArea.getMaxX() - TEXT_PADDING; + double nHalfW = ( nRight - nLeft ) / 2.0; + + double nTop = aSignArea.getCenterY() - nHalfW; + double nBottom = aSignArea.getCenterY() + nHalfW; + + aSign.append( B2DPoint( nLeft, aSignArea.getCenterY() - 1.0 ) ); + aSign.append( B2DPoint( aSignArea.getCenterX() - 1.0, aSignArea.getCenterY() - 1.0 ) ); + aSign.append( B2DPoint( aSignArea.getCenterX() - 1.0, nTop ) ); + aSign.append( B2DPoint( aSignArea.getCenterX() + 1.0, nTop ) ); + aSign.append( B2DPoint( aSignArea.getCenterX() + 1.0, aSignArea.getCenterY() - 1.0 ) ); + aSign.append( B2DPoint( nRight, aSignArea.getCenterY() - 1.0 ) ); + aSign.append( B2DPoint( nRight, aSignArea.getCenterY() + 1.0 ) ); + aSign.append( B2DPoint( aSignArea.getCenterX() + 1.0, aSignArea.getCenterY() + 1.0 ) ); + aSign.append( B2DPoint( aSignArea.getCenterX() + 1.0, nBottom ) ); + aSign.append( B2DPoint( aSignArea.getCenterX() - 1.0, nBottom ) ); + aSign.append( B2DPoint( aSignArea.getCenterX() - 1.0, aSignArea.getCenterY() + 1.0 ) ); + aSign.append( B2DPoint( nLeft, aSignArea.getCenterY() + 1.0 ) ); + aSign.setClosed( true ); + } + else + { + // Create the v polygon + B2DPoint aLeft( aSignArea.getMinX() + TEXT_PADDING, aSignArea.getCenterY() ); + B2DPoint aRight( aSignArea.getMaxX() - TEXT_PADDING, aSignArea.getCenterY() ); + B2DPoint aBottom( ( aLeft.getX() + aRight.getX() ) / 2.0, aLeft.getY() + 4.0 ); + aSign.append( aLeft ); + aSign.append( aRight ); + aSign.append( aBottom ); + aSign.setClosed( true ); + } - BColor aSignColor = Color( COL_BLACK ).getBColor( ); - if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) - aSignColor = Color( COL_WHITE ).getBColor( ); + BColor aSignColor = Color( COL_BLACK ).getBColor( ); + if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) + aSignColor = Color( COL_WHITE ).getBColor( ); - aSeq.realloc( aSeq.getLength() + 1 ); - aSeq[ aSeq.getLength() - 1 ] = Primitive2DReference( new PolyPolygonColorPrimitive2D( - B2DPolyPolygon( aSign ), aSignColor ) ); - } + aSeq.realloc( aSeq.getLength() + 1 ); + aSeq[ aSeq.getLength() - 1 ] = Primitive2DReference( new PolyPolygonColorPrimitive2D( + B2DPolyPolygon( aSign ), aSignColor ) ); // Create the processor and process the primitives const drawinglayer::geometry::ViewInformation2D aNewViewInfos; @@ -495,8 +491,7 @@ void SwHeaderFooterWin::ExecuteCommand( sal_uInt16 nSlot ) void SwHeaderFooterWin::SetReadonly( bool bReadonly ) { - m_bReadonly = bReadonly; - Update(); + ShowAll( !bReadonly ); } void SwHeaderFooterWin::MouseButtonDown( const MouseEvent& rMEvt ) |