diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/inc/bodyfrm.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/inc/layfrm.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/inc/pagefrm.hrc | 3 | ||||
-rw-r--r-- | sw/source/core/inc/pagefrm.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/layout/pagefrm.src | 7 | ||||
-rwxr-xr-x | sw/source/core/layout/paintfrm.cxx | 196 |
6 files changed, 116 insertions, 94 deletions
diff --git a/sw/source/core/inc/bodyfrm.hxx b/sw/source/core/inc/bodyfrm.hxx index 1513cc12b3d3..0f1116b9ef5c 100644 --- a/sw/source/core/inc/bodyfrm.hxx +++ b/sw/source/core/inc/bodyfrm.hxx @@ -46,6 +46,7 @@ public: virtual void Paint( const SwRect&, const SwPrintData *pPrintData = NULL ) const; virtual void PaintSubsidiaryLines( const SwPageFrm*, const SwRect& ) const; + virtual void PaintBreak() const; DECL_FIXEDMEMPOOL_NEWDEL(SwBodyFrm) }; diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx index a93903364833..5300ba8f46a3 100644 --- a/sw/source/core/inc/layfrm.hxx +++ b/sw/source/core/inc/layfrm.hxx @@ -169,6 +169,8 @@ public: const SwFrm* GetLastLower() const; inline SwFrm* GetLastLower(); + + virtual void PaintBreak() const{ }; }; //Um doppelte Implementierung zu sparen wird hier ein bischen gecasted diff --git a/sw/source/core/inc/pagefrm.hrc b/sw/source/core/inc/pagefrm.hrc index b334dc8ea1b9..381722e53111 100644 --- a/sw/source/core/inc/pagefrm.hrc +++ b/sw/source/core/inc/pagefrm.hrc @@ -33,10 +33,11 @@ // Bitmaps for page shadow #define BMP_PAGE_SHADOW_MASK RC_PAGEFRM_BEGIN + 0 #define STR_PAGE_BREAK RC_PAGEFRM_BEGIN + 1 +#define STR_COLUMN_BREAK RC_PAGEFRM_BEGIN + 2 // If you add resources, don't forget to update this -#define PAGEFRM_ACT_END STR_PAGE_BREAK +#define PAGEFRM_ACT_END STR_COLUMN_BREAK // Sanity check #if PAGEFRM_ACT_END > RC_PAGEFRM_END diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx index e2e7ef5a6e45..bc20f17a6e22 100644 --- a/sw/source/core/inc/pagefrm.hxx +++ b/sw/source/core/inc/pagefrm.hxx @@ -210,7 +210,6 @@ public: sal_Bool HasGrid() const { return bHasGrid; } void PaintDecorators( ) const; - void PaintBreak() const; //Zeilennummern usw malen void RefreshExtraData( const SwRect & ) const; diff --git a/sw/source/core/layout/pagefrm.src b/sw/source/core/layout/pagefrm.src index 4abb6891f997..01592174319c 100644 --- a/sw/source/core/layout/pagefrm.src +++ b/sw/source/core/layout/pagefrm.src @@ -7,5 +7,10 @@ Bitmap BMP_PAGE_SHADOW_MASK String STR_PAGE_BREAK { - Text [ en-US ] = "Manual page break" ; + Text [ en-US ] = "Manual Page Break" ; +}; + +String STR_COLUMN_BREAK +{ + Text [ en-US ] = "Manual Column Break" ; }; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 54d2e5deb338..9fa4aae31d90 100755 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -162,7 +162,6 @@ using namespace ::com::sun::star; //werden. #define SUBCOL_PAGE 0x01 //Helplines of the page -#define SUBCOL_BREAK 0x02 //Helpline for a page or column break #define SUBCOL_TAB 0x08 //Helplines inside tables #define SUBCOL_FLY 0x10 //Helplines inside fly frames #define SUBCOL_SECT 0x20 //Helplines inside sections @@ -1011,7 +1010,6 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut, case SUBCOL_FLY: pCol = &SwViewOption::GetObjectBoundariesColor(); break; case SUBCOL_TAB: pCol = &SwViewOption::GetTableBoundariesColor(); break; case SUBCOL_SECT: pCol = &SwViewOption::GetSectionBoundColor(); break; - case SUBCOL_BREAK: pCol = &SwViewOption::GetPageBreakColor(); break; } if ( pOut->GetFillColor() != *pCol ) @@ -2990,7 +2988,6 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const pPage->RefreshExtraData( aPaintRect ); pPage->PaintDecorators( ); - pPage->PaintBreak( ); if ( pSh->GetWin() ) { @@ -3336,77 +3333,90 @@ drawinglayer::primitive2d::Primitive2DSequence lcl_CreateHeaderFooterSeparatorPr return aSeq; } -void SwPageFrm::PaintBreak( ) const +void SwBodyFrm::PaintBreak( ) const { if ( !pGlobalShell->GetViewOptions()->IsPrinting() && !pGlobalShell->GetViewOptions()->IsPDFExport() && !pGlobalShell->IsPreView() ) { - const SwFrm* pBodyFrm = Lower(); - while ( pBodyFrm && !pBodyFrm->IsBodyFrm() ) - pBodyFrm = pBodyFrm->GetNext(); - - if ( pBodyFrm ) + const SwCntntFrm *pCnt = ContainsCntnt(); + if ( pCnt && ( pCnt->IsPageBreak( sal_True ) || pCnt->IsColBreak( sal_True ) ) ) { - const SwCntntFrm *pCnt = static_cast< const SwLayoutFrm* >( pBodyFrm )->ContainsCntnt(); - if ( pCnt && pCnt->IsPageBreak( sal_True )) + bool bPageBreak = pCnt->IsPageBreak( sal_True ); + + // Paint the break only if: + // * Not in header footer edition, to avoid conflicts with the + // header/footer marker + // * Non-printing characters are shown, as this is more consistent + // with other formatting marks + if ( !pGlobalShell->IsShowHeaderFooterSeparator() && + pGlobalShell->GetViewOptions( )->IsLineBreak( ) ) { - // Paint the break only if: - // * Not in header footer edition, to avoid conflicts with the - // header/footer marker - // * Non-printing characters are shown, as this is more consistent - // with other formatting marks - if ( !pGlobalShell->IsShowHeaderFooterSeparator() && - pGlobalShell->GetViewOptions( )->IsLineBreak( ) ) - { - SwRect aRect( pCnt->Prt() ); - aRect.Pos() += pCnt->Frm().Pos(); + SwRect aRect( pCnt->Prt() ); + aRect.Pos() += pCnt->Frm().Pos(); - // Draw the line - basegfx::B2DPolygon aLine; + // Draw the line + basegfx::B2DPolygon aLine; + double nWidth = aRect.Width(); + if ( !IsVertical( ) ) + { aLine.append( basegfx::B2DPoint( double( aRect.Left() ), double( aRect.Top() ) ) ); aLine.append( basegfx::B2DPoint( double( aRect.Right() ), double( aRect.Top() ) ) ); + } + else + { + aLine.append( basegfx::B2DPoint( double( aRect.Right() ), double( aRect.Top() ) ) ); + aLine.append( basegfx::B2DPoint( double( aRect.Right() ), double( aRect.Bottom() ) ) ); + nWidth = aRect.Height(); + } - basegfx::BColor aLineColor = SwViewOption::GetPageBreakColor().getBColor(); - - drawinglayer::primitive2d::PolygonHairlinePrimitive2D* pLine = - new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( - aLine, aLineColor ); - - drawinglayer::primitive2d::Primitive2DSequence aSeq( 2 ); - aSeq[0] = drawinglayer::primitive2d::Primitive2DReference( pLine ); - - // Add the text above - rtl::OUString aBreakText = ResId::toString( SW_RES( STR_PAGE_BREAK ) ); - - basegfx::B2DVector aFontSize; - OutputDevice* pOut = pGlobalShell->GetOut(); - Font aFont = pOut->GetSettings().GetStyleSettings().GetToolFont(); - aFont.SetHeight( 8 * 20 ); - pOut->SetFont( aFont ); - drawinglayer::attribute::FontAttribute aFontAttr = drawinglayer::primitive2d::getFontAttributeFromVclFont( - aFontSize, aFont, false, false ); - - Rectangle aTextRect; - pOut->GetTextBoundRect( aTextRect, String( aBreakText ) ); - long nTextXOff = ( aRect.Width() - aTextRect.GetWidth() ) / 2; - - basegfx::B2DHomMatrix aTextMatrix( basegfx::tools::createScaleTranslateB2DHomMatrix( - aFontSize.getX(), aFontSize.getY(), - aRect.Left() + nTextXOff, aRect.Top() ) ); - - drawinglayer::primitive2d::TextSimplePortionPrimitive2D * pText = - new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( - aTextMatrix, - aBreakText, 0, aBreakText.getLength(), - std::vector< double >(), - aFontAttr, - lang::Locale(), - aLineColor ); - aSeq[1] = drawinglayer::primitive2d::Primitive2DReference( pText ); - - ProcessPrimitives( aSeq ); + basegfx::BColor aLineColor = SwViewOption::GetPageBreakColor().getBColor(); + + drawinglayer::primitive2d::PolygonHairlinePrimitive2D* pLine = + new drawinglayer::primitive2d::PolygonHairlinePrimitive2D( + aLine, aLineColor ); + + drawinglayer::primitive2d::Primitive2DSequence aSeq( 2 ); + aSeq[0] = drawinglayer::primitive2d::Primitive2DReference( pLine ); + + // Add the text above + rtl::OUString aBreakText = ResId::toString( SW_RES( STR_PAGE_BREAK ) ); + if ( !bPageBreak ) + aBreakText = ResId::toString( SW_RES( STR_COLUMN_BREAK ) ); + + basegfx::B2DVector aFontSize; + OutputDevice* pOut = pGlobalShell->GetOut(); + Font aFont = pOut->GetSettings().GetStyleSettings().GetToolFont(); + aFont.SetHeight( 8 * 20 ); + pOut->SetFont( aFont ); + drawinglayer::attribute::FontAttribute aFontAttr = drawinglayer::primitive2d::getFontAttributeFromVclFont( + aFontSize, aFont, false, false ); + + Rectangle aTextRect; + pOut->GetTextBoundRect( aTextRect, String( aBreakText ) ); + long nTextOff = ( nWidth - aTextRect.GetWidth() ) / 2; + + basegfx::B2DHomMatrix aTextMatrix( basegfx::tools::createScaleTranslateB2DHomMatrix( + aFontSize.getX(), aFontSize.getY(), + aRect.Left() + nTextOff, aRect.Top() ) ); + if ( IsVertical() ) + { + aTextMatrix = basegfx::B2DHomMatrix( basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix ( + aFontSize.getX(), aFontSize.getY(), 0.0, M_PI_2, + aRect.Right(), aRect.Top() + nTextOff ) ); } + + drawinglayer::primitive2d::TextSimplePortionPrimitive2D * pText = + new drawinglayer::primitive2d::TextSimplePortionPrimitive2D( + aTextMatrix, + aBreakText, 0, aBreakText.getLength(), + std::vector< double >(), + aFontAttr, + lang::Locale(), + aLineColor ); + aSeq[1] = drawinglayer::primitive2d::Primitive2DReference( pText ); + + ProcessPrimitives( aSeq ); } } } @@ -6294,26 +6304,34 @@ drawinglayer::primitive2d::Primitive2DSequence lcl_CreatePageAreaDelimiterPrimit } void SwBodyFrm::PaintSubsidiaryLines( const SwPageFrm *pPage, - const SwRect &/*rRect*/ ) const + const SwRect & rRect ) const { - if ( !pGlobalShell->IsHeaderFooterEdit() ) + if ( IsPageBodyFrm() ) { - SwRect aArea( Frm() ); - - // TODO include the footnote area if any - const SwFrm* pLay = pPage->Lower(); - const SwFrm* pFtnCont = NULL; - while ( pLay->GetNext() && !pFtnCont ) + if ( !pGlobalShell->IsHeaderFooterEdit() ) { - if ( pLay->IsFtnContFrm( ) ) - pFtnCont = pLay; - pLay = pLay->GetNext(); - } + SwRect aArea( Frm() ); + + const SwFrm* pLay = pPage->Lower(); + const SwFrm* pFtnCont = NULL; + while ( pLay->GetNext() && !pFtnCont ) + { + if ( pLay->IsFtnContFrm( ) ) + pFtnCont = pLay; + pLay = pLay->GetNext(); + } - if ( pFtnCont ) - aArea.AddBottom( pFtnCont->Frm().Bottom() - aArea.Bottom() ); + if ( pFtnCont ) + aArea.AddBottom( pFtnCont->Frm().Bottom() - aArea.Bottom() ); - ProcessPrimitives( lcl_CreatePageAreaDelimiterPrimitives( aArea ) ); + ProcessPrimitives( lcl_CreatePageAreaDelimiterPrimitives( aArea ) ); + } + + PaintBreak(); + } + else + { + SwLayoutFrm::PaintSubsidiaryLines( pPage, rRect ); } } @@ -6439,19 +6457,15 @@ void SwLayoutFrm::PaintSubsidiaryLines( const SwPageFrm *pPage, ::lcl_RefreshLine( this, pPage, aOut.Pos(), aLB, nSubColor, pUsedSubsLines ); // OD 14.11.2002 #104821# - in vertical layout set page/column break at right - if ( aOriginal.Right() == nRight ) - ::lcl_RefreshLine( this, pPage, aRT, aRB, - (bBreak && bVert) ? SUBCOL_BREAK : nSubColor, - pUsedSubsLines ); + if ( aOriginal.Right() == nRight && ! ( bBreak && bVert ) ) + ::lcl_RefreshLine( this, pPage, aRT, aRB, nSubColor, pUsedSubsLines ); } // OD 14.11.2002 #104822# - adjust control for drawing top and bottom lines if ( !bCell || bNewTableModel || bVert ) { - if ( aOriginal.Top() == aOut.Top() ) + if ( aOriginal.Top() == aOut.Top() && !( bBreak && !bVert ) ) // OD 14.11.2002 #104821# - in horizontal layout set page/column break at top - ::lcl_RefreshLine( this, pPage, aOut.Pos(), aRT, - (bBreak && !bVert) ? SUBCOL_BREAK : nSubColor, - pUsedSubsLines ); + ::lcl_RefreshLine( this, pPage, aOut.Pos(), aRT, nSubColor, pUsedSubsLines ); if ( aOriginal.Bottom() == nBottom ) ::lcl_RefreshLine( this, pPage, aLB, aRB, nSubColor, pUsedSubsLines ); @@ -6468,22 +6482,20 @@ void SwLayoutFrm::PaintSubsidiaryLines( const SwPageFrm *pPage, pUsedSubsLines->AddLineRect( aRect, 0, SOLID, 0, nSubColor ); } // OD 14.11.2002 #104821# - in vertical layout set page/column break at right - if ( aOriginal.Right() == nRight ) + if ( aOriginal.Right() == nRight && ! ( bBreak && bVert ) ) { const SwRect aRect( aRT, aRB ); - pUsedSubsLines->AddLineRect( aRect, 0, SOLID, 0, - (bBreak && bVert) ? SUBCOL_BREAK : nSubColor ); + pUsedSubsLines->AddLineRect( aRect, 0, SOLID, 0, nSubColor ); } } // OD 14.11.2002 #104822# - adjust control for drawing top and bottom lines if ( !bCell || bNewTableModel || bVert ) { - if ( aOriginal.Top() == aOut.Top() ) + if ( aOriginal.Top() == aOut.Top() && ! ( bBreak && !bVert ) ) { // OD 14.11.2002 #104821# - in horizontal layout set page/column break at top const SwRect aRect( aOut.Pos(), aRT ); - pUsedSubsLines->AddLineRect( aRect, 0, SOLID, 0, - (bBreak && !bVert) ? SUBCOL_BREAK : nSubColor ); + pUsedSubsLines->AddLineRect( aRect, 0, SOLID, 0, nSubColor ); } if ( aOriginal.Bottom() == nBottom ) { @@ -6492,6 +6504,8 @@ void SwLayoutFrm::PaintSubsidiaryLines( const SwPageFrm *pPage, } } } + + PaintBreak(); } /************************************************************************* |