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

Header/Footer, Page Break: don't show them in RO mode (fdo#45548)

üst 492dbf9c
......@@ -3341,6 +3341,7 @@ void SwPageFrm::PaintBreak( ) const
{
if ( pGlobalShell->GetOut()->GetOutDevType() != OUTDEV_PRINTER &&
!pGlobalShell->GetViewOptions()->IsPDFExport() &&
!pGlobalShell->GetViewOptions()->IsReadonly() &&
!pGlobalShell->IsPreView() )
{
const SwFrm* pBodyFrm = Lower();
......@@ -3377,6 +3378,7 @@ void SwColumnFrm::PaintBreak( ) const
{
if ( pGlobalShell->GetOut()->GetOutDevType() != OUTDEV_PRINTER &&
!pGlobalShell->GetViewOptions()->IsPDFExport() &&
!pGlobalShell->GetViewOptions()->IsReadonly() &&
!pGlobalShell->IsPreView() )
{
const SwFrm* pBodyFrm = Lower();
......@@ -3486,6 +3488,7 @@ void SwPageFrm::PaintDecorators( ) const
if ( pGlobalShell->GetOut()->GetOutDevType() != OUTDEV_PRINTER &&
!pGlobalShell->GetViewOptions()->IsPDFExport() &&
!pGlobalShell->IsPreView() &&
!pGlobalShell->GetViewOptions()->IsReadonly() &&
( pGlobalShell->IsShowHeaderFooterSeparator( Header ) ||
pGlobalShell->IsShowHeaderFooterSeparator( Footer ) ) )
{
......
......@@ -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 )
......
......@@ -182,30 +182,26 @@ void SwPageBreakWin::Paint( const Rectangle& )
aSeq[2] = Primitive2DReference( new DiscreteBitmapPrimitive2D(
aImg.GetBitmapEx(), B2DPoint( nImgOfstX, 1.0 ) ) );
// Paint the symbol if not readonly button
if ( IsEnabled() )
{
double nTop = double( aRect.getHeight() ) / 2.0;
double nBottom = nTop + 4.0;
double nLeft = aRect.getWidth( ) - ARROW_WIDTH - 6.0;
if ( bRtl )
nLeft = ARROW_WIDTH - 2.0;
double nRight = nLeft + 8.0;
B2DPolygon aTriangle;
aTriangle.append( B2DPoint( nLeft, nTop ) );
aTriangle.append( B2DPoint( nRight, nTop ) );
aTriangle.append( B2DPoint( ( nLeft + nRight ) / 2.0, nBottom ) );
aTriangle.setClosed( true );
BColor aTriangleColor = Color( COL_BLACK ).getBColor( );
if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
aTriangleColor = Color( COL_WHITE ).getBColor( );
aSeq.realloc( aSeq.getLength() + 1 );
aSeq[ aSeq.getLength() - 1 ] = Primitive2DReference( new PolyPolygonColorPrimitive2D(
B2DPolyPolygon( aTriangle ), aTriangleColor ) );
}
double nTop = double( aRect.getHeight() ) / 2.0;
double nBottom = nTop + 4.0;
double nLeft = aRect.getWidth( ) - ARROW_WIDTH - 6.0;
if ( bRtl )
nLeft = ARROW_WIDTH - 2.0;
double nRight = nLeft + 8.0;
B2DPolygon aTriangle;
aTriangle.append( B2DPoint( nLeft, nTop ) );
aTriangle.append( B2DPoint( nRight, nTop ) );
aTriangle.append( B2DPoint( ( nLeft + nRight ) / 2.0, nBottom ) );
aTriangle.setClosed( true );
BColor aTriangleColor = Color( COL_BLACK ).getBColor( );
if ( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
aTriangleColor = Color( COL_WHITE ).getBColor( );
aSeq.realloc( aSeq.getLength() + 1 );
aSeq[ aSeq.getLength() - 1 ] = Primitive2DReference( new PolyPolygonColorPrimitive2D(
B2DPolyPolygon( aTriangle ), aTriangleColor ) );
Primitive2DSequence aGhostedSeq( 1 );
double nFadeRate = double( m_nFadeRate ) / 100.0;
......@@ -419,7 +415,7 @@ const SwPageFrm* SwPageBreakWin::GetPageFrame( )
void SwPageBreakWin::SetReadonly( bool bReadonly )
{
Enable( !bReadonly );
ShowAll( !bReadonly );
}
void SwPageBreakWin::Fade( bool bFadeIn )
......
......@@ -41,7 +41,6 @@ class SwHeaderFooterWin : public MenuButton, public SwFrameControl
{
rtl::OUString m_sLabel;
bool m_bIsHeader;
bool m_bReadonly;
PopupMenu* m_pPopupMenu;
Window* m_pLine;
bool m_bIsAppearing;
......
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