diff options
author | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2011-09-20 15:22:02 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2011-09-20 17:01:19 +0200 |
commit | 589f754e7c2fa6d62fb8a8b566757c9cf5bea893 (patch) | |
tree | 8bed5616e930a193679bf8dd90d9c74477d91223 /sw/source/ui/docvw/HeaderFooterWin.cxx | |
parent | fbb48a21a8c2f4ba00f96544fafc8eb8e908aa10 (diff) |
Header/Footer: move the separator line painting to a Window control
This avoids drawing control things on the document OutputDevice and
helps keeping them properly refreshed without refreshing the whole
document layout.
Diffstat (limited to 'sw/source/ui/docvw/HeaderFooterWin.cxx')
-rw-r--r-- | sw/source/ui/docvw/HeaderFooterWin.cxx | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/sw/source/ui/docvw/HeaderFooterWin.cxx b/sw/source/ui/docvw/HeaderFooterWin.cxx index a7066398a602..f1eb77a430d4 100644 --- a/sw/source/ui/docvw/HeaderFooterWin.cxx +++ b/sw/source/ui/docvw/HeaderFooterWin.cxx @@ -33,6 +33,7 @@ #include <svtools/svtools.hrc> #include <cmdid.h> +#include <DashedLine.hxx> #include <docsh.hxx> #include <edtwin.hxx> #include <fmthdft.hxx> @@ -143,7 +144,8 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag m_pPageFrm( pPageFrm ), m_bIsHeader( bHeader ), m_bReadonly( false ), - m_pPopupMenu( NULL ) + m_pPopupMenu( NULL ), + m_pLine( NULL ) { // Define the readonly member const SwViewOption* pViewOpt = m_pEditWin->GetView().GetWrtShell().GetViewOptions(); @@ -163,6 +165,10 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag sal_Int32 nPos = m_sLabel.lastIndexOf( rtl::OUString::createFromAscii( "%1" ) ); m_sLabel = m_sLabel.replaceAt( nPos, 2, m_pPageFrm->GetPageDesc()->GetName() ); + // Create the line control + basegfx::BColor aColor = SwViewOption::GetHeaderFooterMarkColor().getBColor(); + m_pLine = new SwDashedLine( m_pEditWin, aColor ); + // Create and set the PopupMenu m_pPopupMenu = new PopupMenu( SW_RES( MN_HEADERFOOTER_BUTTON ) ); @@ -184,9 +190,10 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag SwHeaderFooterWin::~SwHeaderFooterWin( ) { delete m_pPopupMenu; + delete m_pLine; } -void SwHeaderFooterWin::SetOffset( Point aOffset ) +void SwHeaderFooterWin::SetOffset( Point aOffset, long nXLineStart, long nXLineEnd ) { // Compute the text size and get the box position & size from it Rectangle aTextRect; @@ -205,6 +212,19 @@ void SwHeaderFooterWin::SetOffset( Point aOffset ) // Set the position & Size of the window SetPosSizePixel( aBoxPos, aBoxSize ); + + double nYLinePos = aBoxPos.Y(); + if ( !m_bIsHeader ) + nYLinePos += aBoxSize.Height(); + Point aLinePos( nXLineStart, nYLinePos ); + Size aLineSize( nXLineEnd - nXLineStart, 1 ); + m_pLine->SetPosSizePixel( aLinePos, aLineSize ); +} + +void SwHeaderFooterWin::ShowAll( bool bShow ) +{ + Show( bShow ); + m_pLine->Show( bShow ); } void SwHeaderFooterWin::Paint( const Rectangle& ) |