[Libreoffice-commits] .: sw/source
Cédric Bosdonnat
cbosdo at kemper.freedesktop.org
Mon Feb 13 02:21:33 PST 2012
sw/source/core/layout/paintfrm.cxx | 3 +
sw/source/ui/docvw/HeaderFooterWin.cxx | 97 +++++++++++++++------------------
sw/source/ui/docvw/PageBreakWin.cxx | 46 +++++++--------
sw/source/ui/inc/HeaderFooterWin.hxx | 1
4 files changed, 70 insertions(+), 77 deletions(-)
New commits:
commit beb8a85796c78d4cdcf6497b6725fce8f7141d75
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date: Mon Feb 13 11:20:22 2012 +0100
Header/Footer, Page Break: don't show them in RO mode (fdo#45548)
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 8aee0ec..74abd70 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -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 ) ) )
{
diff --git a/sw/source/ui/docvw/HeaderFooterWin.cxx b/sw/source/ui/docvw/HeaderFooterWin.cxx
index 330c1ff..32e8767 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 )
diff --git a/sw/source/ui/docvw/PageBreakWin.cxx b/sw/source/ui/docvw/PageBreakWin.cxx
index 0edeb61..0439bc3 100644
--- a/sw/source/ui/docvw/PageBreakWin.cxx
+++ b/sw/source/ui/docvw/PageBreakWin.cxx
@@ -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 )
diff --git a/sw/source/ui/inc/HeaderFooterWin.hxx b/sw/source/ui/inc/HeaderFooterWin.hxx
index 6075bb3..d94931f 100644
--- a/sw/source/ui/inc/HeaderFooterWin.hxx
+++ b/sw/source/ui/inc/HeaderFooterWin.hxx
@@ -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;
More information about the Libreoffice-commits
mailing list