summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2011-06-29 10:47:12 +0200
committerCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2011-06-30 17:57:18 +0200
commitf7da7938c53f0ce185760e01e7de91cdf5268078 (patch)
treea1451fd4652112c4dbe087e875614eebe4cab1c4 /sw
parentd4b74188c87cdeb881aacbc053594a7c697ab1ca (diff)
n#676858: header, footer edition mode: updated paint methods
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/viewsh.hxx2
-rw-r--r--sw/source/core/doc/notxtfrm.cxx7
-rw-r--r--sw/source/core/inc/frame.hxx2
-rwxr-xr-xsw/source/core/layout/paintfrm.cxx11
-rw-r--r--sw/source/core/layout/wsfrm.cxx14
-rw-r--r--sw/source/core/text/frmpaint.cxx6
-rw-r--r--sw/source/core/view/viewsh.cxx7
7 files changed, 47 insertions, 2 deletions
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 85e019e1f01a..19f93f80ff6b 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -564,7 +564,7 @@ public:
const SwPostItMgr* GetPostItMgr() const { return (const_cast<ViewShell*>(this))->GetPostItMgr(); }
SwPostItMgr* GetPostItMgr();
- void ToggleHeaderFooterEdit( ) { bHeaderFooterEdit = !bHeaderFooterEdit; }
+ void ToggleHeaderFooterEdit( );
sal_Bool IsHeaderFooterEdit( ) const { return bHeaderFooterEdit; }
};
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 68c6f674d8b1..6cfc2d436fa6 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -248,6 +248,10 @@ void SwNoTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
return;
const ViewShell* pSh = getRootFrm()->GetCurrShell();
+ OutputDevice *pOut = pSh->GetOut();
+
+ sal_uInt64 nOldDrawMode = SetHeaderFooterEditMask( pOut );
+
if( !pSh->GetViewOptions()->IsGraphic() )
{
StopAnimation();
@@ -262,6 +266,7 @@ void SwNoTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
aTxt = FindFlyFrm()->GetFmt()->GetName();
lcl_PaintReplacement( Frm(), aTxt, *pSh, this, sal_False );
}
+ pOut->SetDrawMode( nOldDrawMode );
return;
}
@@ -272,7 +277,6 @@ void SwNoTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
SfxProgress::EnterLock(); //Keine Progress-Reschedules im Paint (SwapIn)
- OutputDevice *pOut = pSh->GetOut();
pOut->Push();
sal_Bool bClip = sal_True;
PolyPolygon aPoly;
@@ -329,6 +333,7 @@ void SwNoTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
pGrfNd->SetFrameInPaint( sal_False );
pOut->Pop();
+ pOut->SetDrawMode( nOldDrawMode );
SfxProgress::LeaveLock();
}
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 3b41dd650a02..4fcd152e2849 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -909,6 +909,8 @@ public:
virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer);
void dumpChildrenAsXml(xmlTextWriterPtr writer);
bool IsCollapse() const;
+
+ sal_uInt64 SetHeaderFooterEditMask( OutputDevice* pOut ) const;
};
inline sal_Bool SwFrm::IsInDocBody() const
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index fa8fbf2695e1..f9f609f2afa2 100755
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3486,6 +3486,8 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
aRect._Intersection( Frm() );
OutputDevice* pOut = pGlobalShell->GetOut();
+ sal_uInt64 nOldDrawMode = SetHeaderFooterEditMask( pOut );
+
pOut->Push( PUSH_CLIPREGION );
pOut->SetClipRegion();
const SwPageFrm* pPage = FindPageFrm();
@@ -3693,6 +3695,8 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
pOut->Pop();
+ pOut->SetDrawMode( nOldDrawMode );
+
if ( pProgress && pNoTxt )
pProgress->Reschedule();
}
@@ -3704,6 +3708,7 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
void SwTabFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
{
+ sal_uInt64 nOldDrawMode = SetHeaderFooterEditMask( pGlobalShell->GetOut() );
if ( pGlobalShell->GetViewOptions()->IsTable() )
{
// #i29550#
@@ -3740,6 +3745,8 @@ void SwTabFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
DrawRect( pGlobalShell->GetOut(), aTabOutRect, COL_LIGHTGRAY );
}
((SwTabFrm*)this)->ResetComplete();
+
+ pGlobalShell->GetOut()->SetDrawMode( nOldDrawMode );
}
/*************************************************************************
@@ -5779,6 +5786,9 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
aRect.Intersection( rRect );
OutputDevice *pOut = pSh->GetOut();
+ sal_uInt64 nOldDrawMode = pOut->GetDrawMode();
+ if ( !IsPageFrm() && !IsRootFrm() )
+ SetHeaderFooterEditMask( pOut );
if ( aRect.HasArea() )
{
@@ -5817,6 +5827,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
if( pCol )
delete pNewItem;
}
+ pOut->SetDrawMode( nOldDrawMode );
}
else
bLowMode = bLowerMode ? sal_True : sal_False;
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index de7417879a0c..fe83f3ce9d68 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -130,6 +130,20 @@ void SwFrm::RegisterToFormat( SwFmt& rFmt )
rFmt.Add( this );
}
+sal_uInt64 SwFrm::SetHeaderFooterEditMask( OutputDevice* pOut ) const
+{
+ ViewShell* pShell = getRootFrm()->GetCurrShell();
+ bool bInHdrFtr = FindFooterOrHeader( ) != NULL;
+ bool bEditHdrFtr = pShell->IsHeaderFooterEdit();
+ sal_uInt64 nOldDrawMode = pOut->GetDrawMode();
+ if ( ( bInHdrFtr && !bEditHdrFtr ) || ( !bInHdrFtr && bEditHdrFtr ) )
+ pOut->SetDrawMode( DRAWMODE_GHOSTEDLINE | DRAWMODE_GHOSTEDFILL |
+ DRAWMODE_GHOSTEDTEXT | DRAWMODE_GHOSTEDBITMAP |
+ DRAWMODE_GHOSTEDGRADIENT );
+
+ return nOldDrawMode;
+}
+
void SwFrm::CheckDir( sal_uInt16 nDir, sal_Bool bVert, sal_Bool bOnlyBiDi, sal_Bool bBrowse )
{
if( FRMDIR_ENVIRONMENT == nDir || ( bVert && bOnlyBiDi ) )
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index ccae7856dc20..eb1eaaa7b3e0 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -567,6 +567,7 @@ sal_Bool SwTxtFrm::PaintEmpty( const SwRect &rRect, sal_Bool bCheck ) const
// Don't show the paragraph mark for collapsed paragraphs, when they are hidden
if ( EmptyHeight( ) > 1 )
{
+ sal_uInt64 nOldDrawMode = SetHeaderFooterEditMask( pSh->GetOut() );
const XubString aTmp( CH_PAR );
SwDrawTextInfo aDrawInf( pSh, *pSh->GetOut(), 0, aTmp, 0, 1 );
aDrawInf.SetLeft( rRect.Left() );
@@ -582,6 +583,7 @@ sal_Bool SwTxtFrm::PaintEmpty( const SwRect &rRect, sal_Bool bCheck ) const
aDrawInf.SetSnapToGrid( sal_False );
pFnt->_DrawText( aDrawInf );
+ pSh->GetOut()->SetDrawMode( nOldDrawMode );
}
delete pClip;
}
@@ -697,6 +699,8 @@ void SwTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
OutputDevice* pOut = aInf.GetOut();
const sal_Bool bOnWin = pSh->GetWin() != 0;
+ sal_uInt64 nOldDrawMode = SetHeaderFooterEditMask( pOut );
+
SwSaveClip aClip( bOnWin || IsUndersized() ? pOut : 0 );
// Ausgabeschleife: Fuer jede Zeile ... (die noch zu sehen ist) ...
@@ -728,6 +732,8 @@ void SwTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
if( rRepaint.HasArea() )
rRepaint.Clear();
+ pOut->SetDrawMode( nOldDrawMode );
+
UNDO_SWAP( this )
(SwRect&)rRect = aOldRect;
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index b9415531fd95..92481ed8de10 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -77,6 +77,7 @@
#include "../../ui/inc/view.hxx"
#include <PostItMgr.hxx>
#include <vcl/virdev.hxx>
+#include <rootfrm.hxx>
#include <vcl/svapp.hxx>
@@ -96,6 +97,12 @@ TYPEINIT0(ViewShell);
using namespace ::com::sun::star;
+void ViewShell::ToggleHeaderFooterEdit( ) {
+ bHeaderFooterEdit = !bHeaderFooterEdit;
+ // Repaint everything to update the colors of the selected area
+ Paint( VisArea().SVRect() );
+}
+
//////////////////////////////////////////////////////////////////////////////
// #i72754# 2nd set of Pre/PostPaints
// This time it uses the lock counter (mPrePostPaintRegions empty/non-empty) to allow only one activation