diff options
Diffstat (limited to 'sw/source/core/layout/paintfrm.cxx')
-rw-r--r-- | sw/source/core/layout/paintfrm.cxx | 836 |
1 files changed, 377 insertions, 459 deletions
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 3a7b31e101fa..0ad768cd930b 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -32,7 +33,6 @@ #include <hintids.hxx> #include <vcl/sound.hxx> #include <tools/poly.hxx> -#define _SVSTDARR_LONGS #include <svl/svstdarr.hxx> #include <svx/xoutbmp.hxx> #include <sfx2/progress.hxx> @@ -44,7 +44,6 @@ #include <svx/framelink.hxx> #include <vcl/graph.hxx> #include <svx/svdpagv.hxx> -#include <hintids.hxx> #include <tgrditem.hxx> #include <switerator.hxx> #include <fmtsrnd.hxx> @@ -96,6 +95,17 @@ #define COL_NOTES_SIDEPANE_BORDER RGB_COLORDATA(200,200,200) #define COL_NOTES_SIDEPANE_SCROLLAREA RGB_COLORDATA(230,230,220) +#include <svtools/borderhelper.hxx> + +#include "pagefrm.hrc" +#include <drawinglayer/geometry/viewinformation2d.hxx> +#include <drawinglayer/processor2d/baseprocessor2d.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> +#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx> +#include <svx/sdr/contact/objectcontacttools.hxx> +#include <svx/unoapi.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> + using namespace ::com::sun::star; #define GETOBJSHELL() ((SfxObjectShell*)rSh.GetDoc()->GetDocShell()) @@ -136,16 +146,18 @@ using namespace ::com::sun::star; //----- Klassen zum Sammeln von Umrandungen und Hilfslinien --- class SwLineRect : public SwRect { - const Color *pColor; + Color aColor; + SvxBorderStyle nStyle; const SwTabFrm *pTab; sal_uInt8 nSubColor; //Hilfslinien einfaerben sal_Bool bPainted; //schon gepaintet? sal_uInt8 nLock; //Um die Linien zum Hell-Layer abzugrenzen. public: - SwLineRect( const SwRect &rRect, const Color *pCol, + SwLineRect( const SwRect &rRect, const Color *pCol, const SvxBorderStyle nStyle, const SwTabFrm *pT , const sal_uInt8 nSCol ); - const Color *GetColor() const { return pColor;} + const Color *GetColor() const { return &aColor;} + SvxBorderStyle GetStyle() const { return nStyle; } const SwTabFrm *GetTab() const { return pTab; } void SetPainted() { bPainted = sal_True; } void Lock( sal_Bool bLock ) { if ( bLock ) @@ -167,7 +179,7 @@ class SwLineRects : public SwLRects sal_uInt16 nLastCount; //unuetze Durchlaeufe im PaintLines verhindern. public: SwLineRects() : nLastCount( 0 ) {} - void AddLineRect( const SwRect& rRect, const Color *pColor, + void AddLineRect( const SwRect& rRect, const Color *pColor, const SvxBorderStyle nStyle, const SwTabFrm *pTab, const sal_uInt8 nSCol ); void ConnectEdges( OutputDevice *pOut ); void PaintLines ( OutputDevice *pOut ); @@ -217,7 +229,6 @@ static double aScaleY = 1.0; static double aMinDistScale = 0.73; static double aEdgeScale = 0.5; - //In pLines werden Umrandungen waehrend des Paint gesammelt und soweit //moeglich zusammengefasst. //In pSubsLines werden Hilfslinien gesammelt und zusammengefasst. Diese @@ -397,16 +408,17 @@ SwSavePaintStatics::~SwSavePaintStatics() SV_IMPL_VARARR( SwLRects, SwLineRect ); - -SwLineRect::SwLineRect( const SwRect &rRect, const Color *pCol, +SwLineRect::SwLineRect( const SwRect &rRect, const Color *pCol, const SvxBorderStyle nStyl, const SwTabFrm *pT, const sal_uInt8 nSCol ) : SwRect( rRect ), - pColor( pCol ), + nStyle( nStyl ), pTab( pT ), nSubColor( nSCol ), bPainted( sal_False ), nLock( 0 ) { + if ( pCol != NULL ) + aColor = *pCol; } sal_Bool SwLineRect::MakeUnion( const SwRect &rRect ) @@ -446,7 +458,7 @@ sal_Bool SwLineRect::MakeUnion( const SwRect &rRect ) return sal_False; } -void SwLineRects::AddLineRect( const SwRect &rRect, const Color *pCol, +void SwLineRects::AddLineRect( const SwRect &rRect, const Color *pCol, const SvxBorderStyle nStyle, const SwTabFrm *pTab, const sal_uInt8 nSCol ) { //Rueckwaerts durch, weil Linien die zusammengefasst werden koennen i.d.R. @@ -465,7 +477,7 @@ void SwLineRects::AddLineRect( const SwRect &rRect, const Color *pCol, return; } } - Insert( SwLineRect( rRect, pCol, pTab, nSCol ), Count() ); + Insert( SwLineRect( rRect, pCol, nStyle, pTab, nSCol ), Count() ); } void SwLineRects::ConnectEdges( OutputDevice *pOut ) @@ -572,7 +584,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut ) if ( !rL1.IsInside( aIns ) ) continue; const sal_uInt16 nTmpFree = Free(); - Insert( SwLineRect( aIns, rL1.GetColor(), + Insert( SwLineRect( aIns, rL1.GetColor(), SOLID, rL1.GetTab(), SUBCOL_TAB ), Count() ); if ( !nTmpFree ) { @@ -613,7 +625,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut ) if ( !rL1.IsInside( aIns ) ) continue; const sal_uInt16 nTmpFree = Free(); - Insert( SwLineRect( aIns, rL1.GetColor(), + Insert( SwLineRect( aIns, rL1.GetColor(), SOLID, rL1.GetTab(), SUBCOL_TAB ), Count() ); if ( !nTmpFree ) { @@ -643,7 +655,7 @@ inline void SwSubsRects::Ins( const SwRect &rRect, const sal_uInt8 nSCol ) //Linien die kuerzer als die breiteste Linienbreite sind werden //nicht aufgenommen. if ( rRect.Height() > DEF_LINE_WIDTH_4 || rRect.Width() > DEF_LINE_WIDTH_4 ) - Insert( SwLineRect( rRect, 0, 0, nSCol ), Count()); + Insert( SwLineRect( rRect, 0, SOLID, 0, nSCol ), Count()); } void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects ) @@ -684,12 +696,12 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects ) if ( rLine.IsLocked () ) continue; - if ( (!bVerticalSubs == (rLine.Height() > rLine.Width())) ) //gleiche Ausrichtung? + if ( !bVerticalSubs == ( rLine.Height() > rLine.Width() ) ) //same direction? continue; if ( aSubsRect.IsOver( rLine ) ) { - if ( bVerticalSubs ) //Vertikal? + if ( bVerticalSubs ) // Vertical? { if ( aSubsRect.Left() <= rLine.Right() && aSubsRect.Right() >= rLine.Left() ) @@ -699,7 +711,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects ) { SwRect aNewSubsRect( aSubsLineRect ); aNewSubsRect.Bottom( nTmp ); - Insert( SwLineRect( aNewSubsRect, 0, 0, + Insert( SwLineRect( aNewSubsRect, 0, aSubsLineRect.GetStyle(), 0, aSubsLineRect.GetSubColor() ), Count()); } nTmp = rLine.Bottom()+nPixelSzH+1; @@ -707,7 +719,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects ) { SwRect aNewSubsRect( aSubsLineRect ); aNewSubsRect.Top( nTmp ); - Insert( SwLineRect( aNewSubsRect, 0, 0, + Insert( SwLineRect( aNewSubsRect, 0, aSubsLineRect.GetStyle(), 0, aSubsLineRect.GetSubColor() ), Count()); } Remove( i, 1 ); @@ -725,7 +737,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects ) { SwRect aNewSubsRect( aSubsLineRect ); aNewSubsRect.Right( nTmp ); - Insert( SwLineRect( aNewSubsRect, 0, 0, + Insert( SwLineRect( aNewSubsRect, 0, aSubsLineRect.GetStyle(), 0, aSubsLineRect.GetSubColor() ), Count()); } nTmp = rLine.Right()+nPixelSzW+1; @@ -733,7 +745,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects ) { SwRect aNewSubsRect( aSubsLineRect ); aNewSubsRect.Left( nTmp ); - Insert( SwLineRect( aNewSubsRect, 0, 0, + Insert( SwLineRect( aNewSubsRect, 0, aSubsLineRect.GetStyle(), 0, aSubsLineRect.GetSubColor() ), Count()); } Remove( i, 1 ); @@ -752,6 +764,44 @@ void SwLineRects::LockLines( sal_Bool bLock ) operator[](i).Lock( bLock ); } +void lcl_DrawDashedRect( OutputDevice * pOut, SwLineRect & rLRect ) +{ + double nHalfLWidth = rLRect.Height( ); + if ( nHalfLWidth > 1 ) + { + nHalfLWidth = nHalfLWidth / 2; + } + else + { + nHalfLWidth = 1; + } + + long startX = rLRect.Left( ); + long startY = rLRect.Top( ) + nHalfLWidth; + long endX = rLRect.Left( ) + rLRect.Width( ); + long endY = rLRect.Top( ) + nHalfLWidth; + + if ( rLRect.Height( ) > rLRect.Width( ) ) + { + nHalfLWidth = rLRect.Width( ); + if ( nHalfLWidth > 1 ) + { + nHalfLWidth = nHalfLWidth / 2; + } + else + { + nHalfLWidth = 1; + } + startX = rLRect.Left( ) + nHalfLWidth; + startY = rLRect.Top( ); + endX = rLRect.Left( ) + nHalfLWidth; + endY = rLRect.Top( ) + rLRect.Height( ); + } + + svtools::DrawLine( *pOut, Point( startX, startY ), Point( endX, endY ), + sal_uInt32( nHalfLWidth * 2 ), rLRect.GetStyle( ) ); +} + void SwLineRects::PaintLines( OutputDevice *pOut ) { //Painten der Umrandungen. Leider muessen wir zweimal durch. @@ -765,6 +815,7 @@ void SwLineRects::PaintLines( OutputDevice *pOut ) // OD 2004-04-23 #116347# pOut->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR ); + pOut->SetFillColor(); pOut->SetLineColor(); ConnectEdges( pOut ); const Color *pLast = 0; @@ -823,11 +874,13 @@ void SwLineRects::PaintLines( OutputDevice *pOut ) Application::GetSettings().GetStyleSettings().GetHighContrastMode() ) pOut->SetDrawMode( 0 ); + pOut->SetLineColor( *pLast ); pOut->SetFillColor( *pLast ); pOut->SetDrawMode( nOldDrawMode ); } + if( !rLRect.IsEmpty() ) - pOut->DrawRect( rLRect.SVRect() ); + lcl_DrawDashedRect( pOut, rLRect ); rLRect.SetPainted(); } else @@ -861,7 +914,7 @@ void SwLineRects::PaintLines( OutputDevice *pOut ) pOut->SetDrawMode( nOldDrawMode ); } if( !rLRect.IsEmpty() ) - pOut->DrawRect( rLRect.SVRect() ); + lcl_DrawDashedRect( pOut, rLRect ); rLRect.SetPainted(); } nLastCount = nMinCount; @@ -889,7 +942,7 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut, SwLineRect &rLk = operator[](k); if ( rLi.SSize() == rLk.SSize() ) { - if ( (bVerticalSubs == (rLk.Height() > rLk.Width())) ) + if ( bVerticalSubs == ( rLk.Height() > rLk.Width() ) ) { if ( bVerticalSubs ) { @@ -922,7 +975,6 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut, } } - if ( pRects && pRects->Count() ) RemoveSuperfluousSubsidiaryLines( *pRects ); @@ -1176,7 +1228,6 @@ long MA_FASTCALL lcl_MinWidthDist( const long nDist ) return ::lcl_AlignWidth( Max( nDist, nMinDistPixelW )); } - //Ermittelt PrtArea plus Umrandung plus Schatten. void MA_FASTCALL lcl_CalcBorderRect( SwRect &rRect, const SwFrm *pFrm, const SwBorderAttrs &rAttrs, @@ -1296,7 +1347,6 @@ void MA_FASTCALL lcl_ExtendLeftAndRight( SwRect& _rRect, } } - void MA_FASTCALL lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage, const SwRect &rRect, SwRegionRects &rRegion ) { @@ -1341,13 +1391,12 @@ void MA_FASTCALL lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage, if ( pRetoucheFly && pRetoucheFly->IsLowerOf( pFly ) ) continue; - -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 //Flys, die innerhalb des eigenen verankert sind, muessen eine //groessere OrdNum haben oder Zeichengebunden sein. if ( pSelfFly && bLowerOfSelf ) { - ASSERT( pFly->IsFlyInCntFrm() || + OSL_ENSURE( pFly->IsFlyInCntFrm() || pSdrObj->GetOrdNumDirect() > pSelfFly->GetVirtDrawObj()->GetOrdNumDirect(), "Fly with wrong z-Order" ); } @@ -1467,16 +1516,6 @@ void MA_FASTCALL lcl_SubtractFlys( const SwFrm *pFrm, const SwPageFrm *pPage, pRetoucheFly = 0; } -// --> OD 2008-05-16 #i84659# - no longer needed -//inline sal_Bool IsShortCut( const SwRect &rRect, const SwRect &rFrmRect ) -//{ -// //Wenn der Frm vollstaendig rechts neben bzw. unter dem -// //Rect sitzt ist's genug mit Painten. -// return rFrmRect.Top() > rRect.Bottom(); -// // PAGES01 || (rFrmRect.Left() > rRect.Right()) ); -//} -// <-- - //---------------- Ausgabe fuer das BrushItem ---------------- /** lcl_DrawGraphicBackgrd - local help method to draw a background for a graphic @@ -1805,7 +1844,7 @@ void MA_FASTCALL DrawGraphic( const SvxBrushItem *pBrush, bDraw = sal_False; break; - default: ASSERT( !pOutDev, "new Graphic position?" ); + default: OSL_ENSURE( !pOutDev, "new Graphic position?" ); } /// OD 02.09.2002 #99657# @@ -2026,42 +2065,39 @@ void lcl_AdjustRectToPixelSize( SwRect& io_aSwRect, const OutputDevice &aOut ) io_aSwRect = SwRect( aSizedRect ); -#ifdef DBG_UTIL +#if OSL_DEBUG_LEVEL > 1 Rectangle aTestOrgPxRect = aOut.LogicToPixel( io_aSwRect.SVRect() ); Rectangle aTestNewPxRect = aOut.LogicToPixel( aSizedRect ); - ASSERT( aTestOrgPxRect == aTestNewPxRect, + OSL_ENSURE( aTestOrgPxRect == aTestNewPxRect, "Error in lcl_AlignRectToPixelSize(..): Adjusted rectangle has incorrect position or size"); -#if OSL_DEBUG_LEVEL > 1 Rectangle aTestNewRect( aSizedRect ); /// check Left() --aSizedRect.Left(); aTestNewPxRect = aOut.LogicToPixel( aSizedRect ); - ASSERT( aTestOrgPxRect.Left() >= (aTestNewPxRect.Left()+1), + OSL_ENSURE( aTestOrgPxRect.Left() >= (aTestNewPxRect.Left()+1), "Error in lcl_AlignRectToPixelSize(..): Left() not correct adjusted"); ++aSizedRect.Left(); /// check Right() ++aSizedRect.Right(); aTestNewPxRect = aOut.LogicToPixel( aSizedRect ); - ASSERT( aTestOrgPxRect.Right() <= (aTestNewPxRect.Right()-1), + OSL_ENSURE( aTestOrgPxRect.Right() <= (aTestNewPxRect.Right()-1), "Error in lcl_AlignRectToPixelSize(..): Right() not correct adjusted"); --aSizedRect.Right(); /// check Top() --aSizedRect.Top(); aTestNewPxRect = aOut.LogicToPixel( aSizedRect ); - ASSERT( aTestOrgPxRect.Top() >= (aTestNewPxRect.Top()+1), + OSL_ENSURE( aTestOrgPxRect.Top() >= (aTestNewPxRect.Top()+1), "Error in lcl_AlignRectToPixelSize(..): Top() not correct adjusted"); ++aSizedRect.Top(); /// check Bottom() ++aSizedRect.Bottom(); aTestNewPxRect = aOut.LogicToPixel( aSizedRect ); - ASSERT( aTestOrgPxRect.Bottom() <= (aTestNewPxRect.Bottom()-1), + OSL_ENSURE( aTestOrgPxRect.Bottom() <= (aTestNewPxRect.Bottom()-1), "Error in lcl_AlignRectToPixelSize(..): Bottom() not correct adjusted"); --aSizedRect.Bottom(); #endif -#endif } - // // FUNCTIONS USED FOR COLLAPSING TABLE BORDER LINES START // @@ -2271,7 +2307,7 @@ void SwTabFrmPainter::PaintLines( OutputDevice& rDev, const SwRect& rRect ) cons break; const SwLineEntrySet& rEntrySet = (*aIter).second; - SwLineEntrySetIter aSetIter = rEntrySet.begin(); + SwLineEntrySetConstIter aSetIter = rEntrySet.begin(); while ( aSetIter != rEntrySet.end() ) { const SwLineEntry& rEntry = *aSetIter; @@ -2319,7 +2355,7 @@ void SwTabFrmPainter::PaintLines( OutputDevice& rDev, const SwRect& rRect ) cons if ( 0 == aStyles[ 0 ].GetWidth() ) { if ( IS_SUBS_TABLE && pGlobalShell->GetWin() ) - aStyles[ 0 ].Set( rCol, 1, 0, 0 ); + aStyles[ 0 ].Set( rCol, rCol, rCol, false, 1, 0, 0 ); } else pTmpColor = pHCColor; @@ -2386,9 +2422,7 @@ void SwTabFrmPainter::PaintLines( OutputDevice& rDev, const SwRect& rRect ) cons // Here comes the painting stuff: Thank you, DR, great job!!! if ( bHori ) { - svx::frame::DrawHorFrameBorder - ( - rDev, + mrTabFrm.ProcessPrimitives( svx::frame::CreateBorderPrimitives( aPaintStart, aPaintEnd, aStyles[ 0 ], // current style @@ -2399,23 +2433,23 @@ void SwTabFrmPainter::PaintLines( OutputDevice& rDev, const SwRect& rRect ) cons aStyles[ 5 ], // aRFromR aStyles[ 6 ], // aRFromB pTmpColor + ) ); } else { - svx::frame::DrawVerFrameBorder - ( - rDev, - aPaintStart, + mrTabFrm.ProcessPrimitives( svx::frame::CreateBorderPrimitives( aPaintEnd, + aPaintStart, aStyles[ 0 ], // current style - aStyles[ 1 ], // aTFromL - aStyles[ 2 ], // aTFromT - aStyles[ 3 ], // aTFromR aStyles[ 4 ], // aBFromL aStyles[ 5 ], // aBFromB aStyles[ 6 ], // aBFromR + aStyles[ 1 ], // aTFromL + aStyles[ 2 ], // aTFromT + aStyles[ 3 ], // aTFromR pTmpColor + ) ); } } @@ -2447,7 +2481,7 @@ void SwTabFrmPainter::FindStylesForLine( const Point& rStartPoint, // pStyles[ 6 ] = bHori ? aRFromB : BFromR, SwLineEntryMapConstIter aMapIter = maVertLines.find( rStartPoint.X() ); - ASSERT( aMapIter != maVertLines.end(), "FindStylesForLine: Error" ) + OSL_ENSURE( aMapIter != maVertLines.end(), "FindStylesForLine: Error" ); const SwLineEntrySet& rVertSet = (*aMapIter).second; SwLineEntrySetConstIter aIter = rVertSet.begin(); @@ -2472,7 +2506,7 @@ void SwTabFrmPainter::FindStylesForLine( const Point& rStartPoint, } aMapIter = maHoriLines.find( rStartPoint.Y() ); - ASSERT( aMapIter != maHoriLines.end(), "FindStylesForLine: Error" ) + OSL_ENSURE( aMapIter != maHoriLines.end(), "FindStylesForLine: Error" ); const SwLineEntrySet& rHoriSet = (*aMapIter).second; aIter = rHoriSet.begin(); @@ -2499,7 +2533,7 @@ void SwTabFrmPainter::FindStylesForLine( const Point& rStartPoint, if ( bHori ) { aMapIter = maVertLines.find( rEndPoint.X() ); - ASSERT( aMapIter != maVertLines.end(), "FindStylesForLine: Error" ) + OSL_ENSURE( aMapIter != maVertLines.end(), "FindStylesForLine: Error" ); const SwLineEntrySet& rVertSet2 = (*aMapIter).second; aIter = rVertSet2.begin(); @@ -2516,7 +2550,7 @@ void SwTabFrmPainter::FindStylesForLine( const Point& rStartPoint, else { aMapIter = maHoriLines.find( rEndPoint.Y() ); - ASSERT( aMapIter != maHoriLines.end(), "FindStylesForLine: Error" ) + OSL_ENSURE( aMapIter != maHoriLines.end(), "FindStylesForLine: Error" ); const SwLineEntrySet& rHoriSet2 = (*aMapIter).second; aIter = rHoriSet2.begin(); @@ -2557,6 +2591,8 @@ void SwTabFrmPainter::Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem ) svx::frame::Style aT( rBoxItem.GetTop() ); svx::frame::Style aB( rBoxItem.GetBottom() ); + const SwTwips nHalfTopWidth = aT.GetWidth() / 2; + aR.MirrorSelf(); aB.MirrorSelf(); @@ -2568,10 +2604,10 @@ void SwTabFrmPainter::Insert( const SwFrm& rFrm, const SvxBoxItem& rBoxItem ) aT.SetRefMode( !bVert ? svx::frame::REFMODE_BEGIN : svx::frame::REFMODE_END ); aB.SetRefMode( !bVert ? svx::frame::REFMODE_BEGIN : svx::frame::REFMODE_END ); - SwLineEntry aLeft ( nLeft, nTop, nBottom, bVert ? aB : ( bR2L ? aR : aL ) ); - SwLineEntry aRight ( nRight, nTop, nBottom, bVert ? aT : ( bR2L ? aL : aR ) ); - SwLineEntry aTop ( nTop, nLeft, nRight, bVert ? aL : aT ); - SwLineEntry aBottom( nBottom, nLeft, nRight, bVert ? aR : aB ); + SwLineEntry aLeft ( nLeft, nTop + nHalfTopWidth, nBottom + nHalfTopWidth, bVert ? aB : ( bR2L ? aR : aL ) ); + SwLineEntry aRight ( nRight, nTop + nHalfTopWidth, nBottom + nHalfTopWidth, bVert ? aT : ( bR2L ? aL : aR ) ); + SwLineEntry aTop ( nTop + nHalfTopWidth, nLeft, nRight, bVert ? aL : aT ); + SwLineEntry aBottom( nBottom + nHalfTopWidth, nLeft, nRight, bVert ? aR : aB ); Insert( aLeft, false ); Insert( aRight, false ); @@ -2622,7 +2658,7 @@ void SwTabFrmPainter::Insert( SwLineEntry& rNew, bool bHori ) if ( SwLineEntry::OVERLAP1 == nOverlapType ) { - ASSERT( rNew.mnStartPos >= rOld.mnStartPos, "Overlap type 3? How this?" ) + OSL_ENSURE( rNew.mnStartPos >= rOld.mnStartPos, "Overlap type 3? How this?" ); // new left segment const SwLineEntry aLeft( nKey, rOld.mnStartPos, rNew.mnStartPos, rOldAttr ); @@ -2696,7 +2732,6 @@ void SwTabFrmPainter::Insert( SwLineEntry& rNew, bool bHori ) // FUNCTIONS USED FOR COLLAPSING TABLE BORDER LINES END // - /************************************************************************* |* |* SwRootFrm::Paint() @@ -2709,15 +2744,12 @@ void SwTabFrmPainter::Insert( SwLineEntry& rNew, bool bHori ) |* 3. Den Dokumentinhalt (Text) Painten. |* 4. Den Drawlayer der ueber dem Dokuemnt liegt painten. |* -|* Ersterstellung MA 01. Jun. 92 -|* Letzte Aenderung MA 10. Oct. 97 -|* |*************************************************************************/ void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const { - ASSERT( Lower() && Lower()->IsPageFrm(), "Lower der Root keine Seite." ); + OSL_ENSURE( Lower() && Lower()->IsPageFrm(), "Lower der Root keine Seite." ); PROTOCOL( this, PROT_FILE_INIT, 0, 0) @@ -2756,8 +2788,6 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const // --> OD 2008-10-07 #i92745# // Extend check on certain states of the 'current' <ViewShell> instance to // all existing <ViewShell> instances. -// if ( !pSh->IsInEndAction() && !pSh->IsPaintInProgress() && -// (!pSh->Imp()->IsAction() || !pSh->Imp()->GetLayAction().IsActionInProgress() ) ) bool bPerformLayoutAction( true ); { ViewShell* pTmpViewShell = pSh; @@ -2817,7 +2847,16 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const while ( pPage ) // <-- { - const bool bPaintRightShadow = !bBookMode || (pPage == Lower()) || (!bLTR && !pPage->OnRightPage()) || (bLTR && pPage->OnRightPage()); + // Paint right shadow in single page mode, or if we're on last page of + // the doc, or if ???Lower()??? or if we're on a page with no right + // sibling (OnRightPage should be renamed as OnEvenPage since it does + // not take reading direction into account) + const bool bPaintRightShadow = !bBookMode || (!pPage->GetNext()) || (pPage == Lower()) || (!bLTR && !pPage->OnRightPage()) || (bLTR && pPage->OnRightPage()); + // Have a full bottom shadow on side by side pages. + // TODO Do not draw full shadow if our sibling hasn't the + // same orientation + const bool bFullBottomShadow = bBookMode && pPage->GetPrev() && + ((!bLTR && !pPage->OnRightPage()) || (bLTR && pPage->OnRightPage())); const bool bRightSidebar = pPage->SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT; if ( !pPage->IsEmptyPage() ) @@ -2837,20 +2876,6 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const aPaintRect._Intersection( aRect ); - // --> OD 2007-11-14 #i82616# - // Invalidate area for extra data (line numbers or change tracking - // marks), if painting on a window and the paint is trigger by an - // end action. The inefficient and simple enlargement of the - // paint area is replaced by this invalidation. - // if ( bExtraData ) - // { - // //Ja, das ist grob, aber wie macht man es besser? - // SWRECTFN( pPage ) - // (aPaintRect.*fnRect->fnSetLeftAndWidth)( - // (pPage->Frm().*fnRect->fnGetLeft)(), - // (pPage->Frm().*fnRect->fnGetWidth)() ); - // aPaintRect._Intersection( pSh->VisArea() ); - // } if ( bExtraData && pSh->GetWin() && pSh->IsInEndAction() ) { @@ -2937,7 +2962,7 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const { // OD 12.02.2003 #i9719#, #105645# - use new method // <SwPageFrm::PaintBorderAndShadow(..)>. - SwPageFrm::PaintBorderAndShadow( pPage->Frm(), pSh, bPaintRightShadow, bRightSidebar ); + SwPageFrm::PaintBorderAndShadow( pPage->Frm(), pSh, bPaintRightShadow, bFullBottomShadow, bRightSidebar ); SwPageFrm::PaintNotesSidebar( pPage->Frm(), pSh, pPage->GetPhyPageNum(), bRightSidebar); } @@ -3029,7 +3054,7 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const // paint shadow and border for empty page // OD 19.02.2003 #107369# - use new method to paint page border and // shadow - SwPageFrm::PaintBorderAndShadow( aEmptyPageRect, pSh, bPaintRightShadow, bRightSidebar ); + SwPageFrm::PaintBorderAndShadow( aEmptyPageRect, pSh, bPaintRightShadow, bFullBottomShadow, bRightSidebar ); SwPageFrm::PaintNotesSidebar( aEmptyPageRect, pSh, pPage->GetPhyPageNum(), bRightSidebar); { @@ -3038,25 +3063,13 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const } } - ASSERT( !pPage->GetNext() || pPage->GetNext()->IsPageFrm(), + OSL_ENSURE( !pPage->GetNext() || pPage->GetNext()->IsPageFrm(), "Nachbar von Seite keine Seite." ); pPage = (SwPageFrm*)pPage->GetNext(); } DELETEZ( pLines ); -#ifdef FRANK_TEST - if ( pSh->GetWin() ) - { - Rectangle aRect( aFrm.SVRect() ); - pSh->GetWin()->Push( PUSH_FILLCOLOR|PUSH_LINECOLOR ); - pSh->GetWin()->SetFillColor(); - pSh->GetWin()->SetLineColor( COL_LIGHTRED ); - pSh->GetWin()->DrawRect( aRect ); - pSh->GetWin()->Pop(); - } -#endif - if ( bResetRootPaint ) SwRootFrm::bInPaint = sal_False; if ( pStatics ) @@ -3070,49 +3083,10 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const ((SwRootFrm*)this)->SetCallbackActionEnabled( bOldAction ); } -#ifdef LONG_TABLE_HACK - -/************************************************************************* -|* -|* SwRootFrm::HackPrepareLongTblPaint() -|* -|* Ersterstellung MA 27. Sep. 96 -|* Letzte Aenderung MA 18. Nov. 97 -|* -|*************************************************************************/ - -void SwRootFrm::HackPrepareLongTblPaint( int nMode ) -{ - switch ( nMode ) - { - case HACK_TABLEMODE_INIT : ASSERT( !pLines, "HackPrepare: already prepared" ); - pLines = new SwLineRects; - ASSERT( !pGlobalShell, "old GlobalShell lost" ); - pGlobalShell = GetCurrShell(); - bTableHack = sal_True; - break; - case HACK_TABLEMODE_LOCKLINES : pLines->LockLines( sal_True ); break; - case HACK_TABLEMODE_PAINTLINES : pLines->PaintLines( GetShell()->GetOut() ); - break; - case HACK_TABLEMODE_UNLOCKLINES: pLines->LockLines( sal_False ); break; - case HACK_TABLEMODE_EXIT : pLines->PaintLines( GetCurrShell()->GetOut() ); - DELETEZ( pLines ); - pGlobalShell = 0; - bTableHack = sal_False; - break; - } -} - -#endif - - /************************************************************************* |* |* SwLayoutFrm::Paint() |* -|* Ersterstellung MA 19. May. 92 -|* Letzte Aenderung MA 19. Apr. 95 -|* |*************************************************************************/ void MA_FASTCALL lcl_EmergencyFormatFtnCont( SwFtnContFrm *pCont ) @@ -3288,7 +3262,6 @@ void SwLayoutFrm::Paint(SwRect const& rRect, SwPrintData const*const) const } } - /** FlyFrm::IsBackgroundTransparent - for feature #99657# OD 12.08.2002 @@ -3363,9 +3336,6 @@ sal_Bool SwFlyFrm::IsShadowTransparent() const |* |* SwFlyFrm::IsPaint() |* -|* Ersterstellung MA 16. Jan. 97 -|* Letzte Aenderung MA 16. Jan. 97 -|* |*************************************************************************/ sal_Bool SwFlyFrm::IsPaint( SdrObject *pObj, const ViewShell *pSh ) @@ -3441,7 +3411,7 @@ sal_Bool SwFlyFrm::IsPaint( SdrObject *pObj, const ViewShell *pSh ) // OD 02.07.2003 #108784# - debug assert if ( !pObj->ISA(SdrObjGroup) ) { - ASSERT( false, "<SwFlyFrm::IsPaint(..)> - paint of drawing object without anchor frame!?" ); + OSL_FAIL( "<SwFlyFrm::IsPaint(..)> - paint of drawing object without anchor frame!?" ); } } } @@ -3472,9 +3442,6 @@ void SwCellFrm::Paint(SwRect const& rRect, SwPrintData const*const) const |* |* SwFlyFrm::Paint() |* -|* Ersterstellung MA ?? -|* Letzte Aenderung MA 16. Jan. 97 -|* |*************************************************************************/ //Weiter unten definiert @@ -3587,20 +3554,12 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)this ); const SwBorderAttrs &rAttrs = *aAccess.Get(); - // OD 06.08.2002 #99657# - paint border before painting background - // paint border - { - SwRect aTmp( rRect ); - PaintBorder( aTmp, pPage, rAttrs ); - } - // paint background { SwRegionRects aRegion( aRect ); // --> OD 2007-12-13 #i80822# // suppress painting of background in printing area for // non-transparent graphics. -// if ( bPaintMarginOnly ) if ( bPaintMarginOnly || ( pNoTxt && !bIsGraphicTransparent ) ) // <-- @@ -3618,7 +3577,6 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const // used in <SwNoTxtFrm::Paint(..)> to set the clip region // for painting the graphic/OLE. Thus, the clip region is // also applied for the PDF export. -// if ( !pOut->GetConnectMetaFile() || pOut->GetOutDevType() == OUTDEV_PRINTER ) ViewShell *pSh = getRootFrm()->GetCurrShell(); if ( !pOut->GetConnectMetaFile() || !pSh || !pSh->GetWin() ) // <-- @@ -3634,6 +3592,13 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const PaintBackground( aRegion[i], pPage, rAttrs, sal_False, sal_True ); } + // OD 06.08.2002 #99657# - paint border before painting background + // paint border + { + SwRect aTmp( rRect ); + PaintBorder( aTmp, pPage, rAttrs ); + } + pOut->Pop(); } } @@ -3711,9 +3676,6 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const |* |* SwTabFrm::Paint() |* -|* Ersterstellung MA 11. May. 93 -|* Letzte Aenderung MA 23. Mar. 95 -|* |*************************************************************************/ void SwTabFrm::Paint(SwRect const& rRect, SwPrintData const*const) const @@ -3764,8 +3726,6 @@ void SwTabFrm::Paint(SwRect const& rRect, SwPrintData const*const) const |* Der Schatten wird immer an den auesseren Rand des OutRect gemalt. |* Das OutRect wird ggf. so verkleinert, dass auf diesem das |* malen der Umrandung stattfinden kann. -|* Ersterstellung MA 21. Dec. 92 -|* Letzte Aenderung MA 29. May. 97 |* |*************************************************************************/ /// OD 23.08.2002 #99657# @@ -3924,7 +3884,7 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect, } break; default: - ASSERT( !this, "new ShadowLocation() ?" ) + OSL_ENSURE( !this, "new ShadowLocation() ?" ); break; } @@ -3973,15 +3933,13 @@ void SwFrm::PaintShadow( const SwRect& rRect, SwRect& rOutRect, |* |* SwFrm::PaintBorderLine() |* -|* Ersterstellung MA 22. Dec. 92 -|* Letzte Aenderung MA 22. Jan. 95 -|* |*************************************************************************/ void SwFrm::PaintBorderLine( const SwRect& rRect, const SwRect& rOutRect, const SwPageFrm *pPage, - const Color *pColor ) const + const Color *pColor, + const SvxBorderStyle nStyle ) const { if ( !rOutRect.IsOver( rRect ) ) return; @@ -4004,10 +3962,10 @@ void SwFrm::PaintBorderLine( const SwRect& rRect, SwRegionRects aRegion( aOut, 4, 1 ); ::lcl_SubtractFlys( this, pPage, aOut, aRegion ); for ( sal_uInt16 i = 0; i < aRegion.Count(); ++i ) - pLines->AddLineRect( aRegion[i], pColor, pTab, nSubCol ); + pLines->AddLineRect( aRegion[i], pColor, nStyle, pTab, nSubCol ); } else - pLines->AddLineRect( aOut, pColor, pTab, nSubCol ); + pLines->AddLineRect( aOut, pColor, nStyle, pTab, nSubCol ); } /************************************************************************* @@ -4015,8 +3973,6 @@ void SwFrm::PaintBorderLine( const SwRect& rRect, |* SwFrm::PaintBorderLines() |* |* Beschreibung Nur alle Linien einfach oder alle Linien doppelt!!!! -|* Ersterstellung MA 22. Dec. 92 -|* Letzte Aenderung MA 22. Mar. 95 |* |*************************************************************************/ @@ -4155,19 +4111,44 @@ void MA_FASTCALL lcl_SubLeftRight( SwRect& rRect, } } +sal_uInt16 lcl_GetLineWidth( const SvxBorderLine* pLine ) +{ + sal_uInt16 result = 0; + + if ( pLine != NULL ) + result = pLine->GetScaledWidth(); + + return result; +} + +double lcl_GetExtent( const SvxBorderLine* pSideLine, const SvxBorderLine* pOppositeLine ) +{ + double nExtent = 0.0; + + if ( pSideLine && !pSideLine->isEmpty() ) + nExtent = -lcl_GetLineWidth( pSideLine ) / 2.0; + else if ( pOppositeLine ) + nExtent = lcl_GetLineWidth( pOppositeLine ) / 2.0; + + return nExtent; +} + // OD 19.05.2003 #109667# - merge <lcl_PaintLeftLine> and <lcl_PaintRightLine> // into new method <lcl_PaintLeftRightLine(..)> void lcl_PaintLeftRightLine( const sal_Bool _bLeft, const SwFrm& _rFrm, - const SwPageFrm& _rPage, + const SwPageFrm& /*_rPage*/, const SwRect& _rOutRect, - const SwRect& _rRect, + const SwRect& /*_rRect*/, const SwBorderAttrs& _rAttrs, const SwRectFn& _rRectFn ) { const SvxBoxItem& rBox = _rAttrs.GetBox(); const sal_Bool bR2L = _rFrm.IsCellFrm() && _rFrm.IsRightToLeft(); const SvxBorderLine* pLeftRightBorder = 0; + const SvxBorderLine* pTopBorder = rBox.GetTop(); + const SvxBorderLine* pBottomBorder = rBox.GetBottom(); + if ( _bLeft ) { pLeftRightBorder = bR2L ? rBox.GetRight() : rBox.GetLeft(); @@ -4188,12 +4169,12 @@ void lcl_PaintLeftRightLine( const sal_Bool _bLeft, SwRect aRect( _rOutRect ); if ( _bLeft ) { - (aRect.*_rRectFn->fnAddRight)( ::lcl_AlignWidth( pLeftRightBorder->GetOutWidth() ) - + (aRect.*_rRectFn->fnAddRight)( ::lcl_AlignWidth( lcl_GetLineWidth( pLeftRightBorder ) ) - (aRect.*_rRectFn->fnGetWidth)() ); } else { - (aRect.*_rRectFn->fnSubLeft)( ::lcl_AlignWidth( pLeftRightBorder->GetOutWidth() ) - + (aRect.*_rRectFn->fnSubLeft)( ::lcl_AlignWidth( lcl_GetLineWidth( pLeftRightBorder ) ) - (aRect.*_rRectFn->fnGetWidth)() ); } @@ -4202,6 +4183,10 @@ void lcl_PaintLeftRightLine( const sal_Bool _bLeft, if ( bCnt ) { ::lcl_ExtendLeftAndRight( aRect, _rFrm, _rAttrs, _rRectFn ); + + // No Top / bottom borders for joint borders + if ( _rAttrs.JoinedWithPrev( _rFrm ) ) pTopBorder = NULL; + if ( _rAttrs.JoinedWithNext( _rFrm ) ) pBottomBorder = NULL; } // OD 06.05.2003 #107169# - adjustments for printer output device @@ -4277,69 +4262,40 @@ void lcl_PaintLeftRightLine( const sal_Bool _bLeft, ::lcl_SubTopBottom( aRect, rBox, _rAttrs, _rFrm, _rRectFn, bPrtOutputDev ); } - // OD 29.04.2003 #107169# - paint SwAligned-rectangle + // TODO Postpone the processing of the primitives + if ( lcl_GetLineWidth( pLeftRightBorder ) > 0 ) { - SwRect aPaintRect( aRect ); - ::SwAlignRect( aPaintRect, _rFrm.getRootFrm()->GetCurrShell() ); - // if <SwAlignRect> reveals rectangle with no width, adjust rectangle - // to the prior left postion with width of one twip. - if ( (aPaintRect.*_rRectFn->fnGetWidth)() == 0 ) - { - if ( _bLeft ) - { - (aPaintRect.*_rRectFn->fnSetLeft)( (aRect.*_rRectFn->fnGetLeft)() ); - (aPaintRect.*_rRectFn->fnSetRight)( (aRect.*_rRectFn->fnGetLeft)() ); - (aPaintRect.*_rRectFn->fnAddRight)( 1 ); - } - else - { - (aPaintRect.*_rRectFn->fnSetLeft)( (aRect.*_rRectFn->fnGetRight)() - 1 ); - (aPaintRect.*_rRectFn->fnSetRight)( (aRect.*_rRectFn->fnGetRight)() - 1 ); - (aPaintRect.*_rRectFn->fnAddRight)( 1 ); - } - } - _rFrm.PaintBorderLine( _rRect, aPaintRect, &_rPage, &pLeftRightBorder->GetColor() ); - } + drawinglayer::primitive2d::Primitive2DSequence aSequence( 1 ); - if ( pLeftRightBorder->GetInWidth() ) - { - const long nDist = ::lcl_MinWidthDist( pLeftRightBorder->GetDistance() ); - long nWidth = ::lcl_AlignWidth( pLeftRightBorder->GetInWidth() ); - if ( _bLeft ) - { - (aRect.*_rRectFn->fnAddRight)( nDist + nWidth ); - (aRect.*_rRectFn->fnSubLeft)( nWidth - (aRect.*_rRectFn->fnGetWidth)() ); - } - else - { - (aRect.*_rRectFn->fnSubLeft)( nDist + nWidth ); - (aRect.*_rRectFn->fnAddRight)( nWidth - (aRect.*_rRectFn->fnGetWidth)() ); - } - // OD 06.05.2003 #107169# - add 6th parameter - ::lcl_SubTopBottom( aRect, rBox, _rAttrs, _rFrm, _rRectFn, bPrtOutputDev ); - // OD 29.04.2003 #107169# - paint SwAligned-rectangle + double nExtentIS = lcl_GetExtent( pTopBorder, NULL ); + double nExtentIE = lcl_GetExtent( pBottomBorder, NULL ); + double nExtentOS = lcl_GetExtent( NULL, pTopBorder ); + double nExtentOE = lcl_GetExtent( NULL, pBottomBorder ); + + if ( !_bLeft ) { - SwRect aPaintRect( aRect ); - ::SwAlignRect( aPaintRect, _rFrm.getRootFrm()->GetCurrShell() ); - // if <SwAlignRect> reveals rectangle with no width, adjust - // rectangle to the prior left postion with width of one twip. - if ( (aPaintRect.*_rRectFn->fnGetWidth)() == 0 ) - { - if ( _bLeft ) - { - (aPaintRect.*_rRectFn->fnSetLeft)( (aRect.*_rRectFn->fnGetLeft)() ); - (aPaintRect.*_rRectFn->fnSetRight)( (aRect.*_rRectFn->fnGetLeft)() ); - (aPaintRect.*_rRectFn->fnAddRight)( 1 ); - } - else - { - (aPaintRect.*_rRectFn->fnSetLeft)( (aRect.*_rRectFn->fnGetRight)() - 1 ); - (aPaintRect.*_rRectFn->fnSetRight)( (aRect.*_rRectFn->fnGetRight)() - 1 ); - (aPaintRect.*_rRectFn->fnAddRight)( 1 ); - } - } - _rFrm.PaintBorderLine( _rRect, aPaintRect, &_rPage, &pLeftRightBorder->GetColor() ); + nExtentIS = lcl_GetExtent( NULL, pTopBorder ); + nExtentIE = lcl_GetExtent( NULL, pBottomBorder ); + nExtentOS = lcl_GetExtent( pTopBorder, NULL ); + nExtentOE = lcl_GetExtent( pBottomBorder, NULL ); } + + basegfx::B2DPoint aStart( aRect.Left() + aRect.Width() / 2.0, aRect.Top() + lcl_GetLineWidth( pTopBorder ) / 2.0 ); + basegfx::B2DPoint aEnd( aRect.Left() + aRect.Width() / 2.0, aRect.Bottom() - lcl_GetLineWidth( pBottomBorder ) / 2.0 ); + + double nLeftWidth = !_bLeft ? pLeftRightBorder->GetOutWidth() : pLeftRightBorder->GetInWidth( ); + double nRightWidth = !_bLeft ? pLeftRightBorder->GetInWidth() : pLeftRightBorder->GetOutWidth( ); + Color aLeftColor = _bLeft ? pLeftRightBorder->GetColorOut( _bLeft ) : pLeftRightBorder->GetColorIn( _bLeft ); + Color aRightColor = _bLeft ? pLeftRightBorder->GetColorIn( _bLeft ) : pLeftRightBorder->GetColorOut( _bLeft ); + + aSequence[0] = new drawinglayer::primitive2d::BorderLinePrimitive2D( + aStart, aEnd, nLeftWidth, pLeftRightBorder->GetDistance(), nRightWidth, + nExtentIS, nExtentIE, nExtentOS, nExtentOE, + aLeftColor.getBColor(), aRightColor.getBColor(), + pLeftRightBorder->GetColorGap().getBColor(), + pLeftRightBorder->HasGapColor(), pLeftRightBorder->GetStyle( ) ); + + _rFrm.ProcessPrimitives( aSequence ); } } @@ -4347,14 +4303,16 @@ void lcl_PaintLeftRightLine( const sal_Bool _bLeft, // into <lcl_PaintTopLine> void lcl_PaintTopBottomLine( const sal_Bool _bTop, const SwFrm& _rFrm, - const SwPageFrm& _rPage, + const SwPageFrm& /*_rPage*/, const SwRect& _rOutRect, - const SwRect& _rRect, + const SwRect& /*_rRect*/, const SwBorderAttrs& _rAttrs, const SwRectFn& _rRectFn ) { const SvxBoxItem& rBox = _rAttrs.GetBox(); const SvxBorderLine* pTopBottomBorder = 0; + const SvxBorderLine* pLeftBorder = rBox.GetLeft(); + const SvxBorderLine* pRightBorder = rBox.GetRight(); if ( _bTop ) { pTopBottomBorder = rBox.GetTop(); @@ -4372,81 +4330,52 @@ void lcl_PaintTopBottomLine( const sal_Bool _bTop, SwRect aRect( _rOutRect ); if ( _bTop ) { - (aRect.*_rRectFn->fnAddBottom)( ::lcl_AlignHeight( pTopBottomBorder->GetOutWidth() ) - + (aRect.*_rRectFn->fnAddBottom)( ::lcl_AlignHeight( lcl_GetLineWidth( pTopBottomBorder ) ) - (aRect.*_rRectFn->fnGetHeight)() ); } else { - (aRect.*_rRectFn->fnSubTop)( ::lcl_AlignHeight( pTopBottomBorder->GetOutWidth() ) - + (aRect.*_rRectFn->fnSubTop)( ::lcl_AlignHeight( lcl_GetLineWidth( pTopBottomBorder ) ) - (aRect.*_rRectFn->fnGetHeight)() ); } - // OD 29.04.2003 #107169# - paint SwAligned-rectangle + // TODO Postpone the processing of the primitives + if ( lcl_GetLineWidth( pTopBottomBorder ) > 0 ) { - SwRect aPaintRect( aRect ); - ::SwAlignRect( aPaintRect, _rFrm.getRootFrm()->GetCurrShell() ); - // if <SwAlignRect> reveals rectangle with no width, adjust rectangle - // to the prior top postion with width of one twip. - if ( (aPaintRect.*_rRectFn->fnGetHeight)() == 0 ) - { - if ( _bTop ) - { - (aPaintRect.*_rRectFn->fnSetTop)( (aRect.*_rRectFn->fnGetTop)() ); - (aPaintRect.*_rRectFn->fnSetBottom)( (aRect.*_rRectFn->fnGetTop)() ); - (aPaintRect.*_rRectFn->fnAddBottom)( 1 ); - } - else - { - (aPaintRect.*_rRectFn->fnSetTop)( (aRect.*_rRectFn->fnGetBottom)() - 1 ); - (aPaintRect.*_rRectFn->fnSetBottom)( (aRect.*_rRectFn->fnGetBottom)() - 1 ); - (aPaintRect.*_rRectFn->fnAddBottom)( 1 ); - } - } - _rFrm.PaintBorderLine( _rRect, aPaintRect, &_rPage, &pTopBottomBorder->GetColor() ); - } + drawinglayer::primitive2d::Primitive2DSequence aSequence( 1 ); - if ( pTopBottomBorder->GetInWidth() ) - { - const long nDist = ::lcl_MinHeightDist( pTopBottomBorder->GetDistance() ); - const long nHeight = ::lcl_AlignHeight( pTopBottomBorder->GetInWidth() ); - if ( _bTop ) - { - (aRect.*_rRectFn->fnAddBottom)( nDist + nHeight ); - (aRect.*_rRectFn->fnSubTop)( nHeight - (aRect.*_rRectFn->fnGetHeight)() ); - } - else - { - (aRect.*_rRectFn->fnSubTop)( nDist + nHeight ); - (aRect.*_rRectFn->fnAddBottom)( nHeight -(aRect.*_rRectFn->fnGetHeight)() ); - } - ::lcl_SubLeftRight( aRect, rBox, _rRectFn ); - // OD 29.04.2003 #107169# - paint SwAligned-rectangle + double nExtentIS = lcl_GetExtent( pRightBorder, NULL ); + double nExtentIE = lcl_GetExtent( pLeftBorder, NULL ); + double nExtentOS = lcl_GetExtent( NULL, pRightBorder ); + double nExtentOE = lcl_GetExtent( NULL, pLeftBorder ); + + if ( !_bTop ) { - SwRect aPaintRect( aRect ); - ::SwAlignRect( aPaintRect, _rFrm.getRootFrm()->GetCurrShell() ); - // if <SwAlignRect> reveals rectangle with no width, adjust - // rectangle to the prior top postion with width of one twip. - if ( (aPaintRect.*_rRectFn->fnGetHeight)() == 0 ) - { - if ( _bTop ) - { - (aPaintRect.*_rRectFn->fnSetTop)( (aRect.*_rRectFn->fnGetTop)() ); - (aPaintRect.*_rRectFn->fnSetBottom)( (aRect.*_rRectFn->fnGetTop)() ); - (aPaintRect.*_rRectFn->fnAddBottom)( 1 ); - } - else - { - (aPaintRect.*_rRectFn->fnSetTop)( (aRect.*_rRectFn->fnGetBottom)() - 1 ); - (aPaintRect.*_rRectFn->fnSetBottom)( (aRect.*_rRectFn->fnGetBottom)() - 1 ); - (aPaintRect.*_rRectFn->fnAddBottom)( 1 ); - } - } - _rFrm.PaintBorderLine( _rRect, aPaintRect, &_rPage, &pTopBottomBorder->GetColor() ); + nExtentIS = lcl_GetExtent( NULL, pRightBorder ); + nExtentIE = lcl_GetExtent( NULL, pLeftBorder ); + nExtentOS = lcl_GetExtent( pRightBorder, NULL ); + nExtentOE = lcl_GetExtent( pLeftBorder, NULL ); } + + basegfx::B2DPoint aStart( aRect.Right() - lcl_GetLineWidth( pRightBorder ) / 2.0, aRect.Top() + aRect.Height() / 2.0 ); + basegfx::B2DPoint aEnd( aRect.Left() + lcl_GetLineWidth( pLeftBorder ) / 2.0, aRect.Top() + aRect.Height() / 2.0 ); + + double nLeftWidth = !_bTop ? pTopBottomBorder->GetOutWidth() : pTopBottomBorder->GetInWidth( ); + double nRightWidth = !_bTop ? pTopBottomBorder->GetInWidth() : pTopBottomBorder->GetOutWidth( ); + Color aLeftColor = _bTop ? pTopBottomBorder->GetColorOut( _bTop ) : pTopBottomBorder->GetColorIn( _bTop ); + Color aRightColor = _bTop ? pTopBottomBorder->GetColorIn( _bTop ) : pTopBottomBorder->GetColorOut( _bTop ); + + aSequence[0] = new drawinglayer::primitive2d::BorderLinePrimitive2D( + aStart, aEnd, nLeftWidth, pTopBottomBorder->GetDistance(), nRightWidth, + nExtentIS, nExtentIE, nExtentOS, nExtentOE, + aLeftColor.getBColor(), aRightColor.getBColor(), + pTopBottomBorder->GetColorGap().getBColor(), + pTopBottomBorder->HasGapColor(), pTopBottomBorder->GetStyle( ) ); + + _rFrm.ProcessPrimitives( aSequence ); } } - /************************************************************************* |* |* const SwFrm* lcl_HasNextCell( const SwFrm& rFrm ) @@ -4457,8 +4386,8 @@ void lcl_PaintTopBottomLine( const sal_Bool _bTop, const SwFrm* lcl_HasNextCell( const SwFrm& rFrm ) { - ASSERT( rFrm.IsCellFrm(), - "lcl_HasNextCell( const SwFrm& rFrm ) should be called with SwCellFrm" ) + OSL_ENSURE( rFrm.IsCellFrm(), + "lcl_HasNextCell( const SwFrm& rFrm ) should be called with SwCellFrm" ); const SwFrm* pTmpFrm = &rFrm; do @@ -4473,14 +4402,11 @@ const SwFrm* lcl_HasNextCell( const SwFrm& rFrm ) return 0; } - /************************************************************************* |* |* SwFrm::PaintBorder() |* |* Beschreibung Malt Schatten und Umrandung -|* Ersterstellung MA 23.01.92 -|* Letzte Aenderung MA 29. Jul. 96 |* |*************************************************************************/ @@ -4491,7 +4417,6 @@ const SwFrm* lcl_HasNextCell( const SwFrm& rFrm ) @author OD - @param _pCellFrm input parameter - constant pointer to cell frame for which the cell frame for the border attributes has to be determined. @@ -4511,7 +4436,7 @@ const SwFrm* lcl_GetCellFrmForBorderAttrs( const SwFrm* _pCellFrm, const SwBorderAttrs& _rCellBorderAttrs, const bool _bTop ) { - ASSERT( _pCellFrm, "No cell frame available, dying soon" ) + OSL_ENSURE( _pCellFrm, "No cell frame available, dying soon" ); // determine, if cell frame is at bottom/top border of a table frame and // the table frame has/is a follow. @@ -4540,7 +4465,7 @@ const SwFrm* lcl_GetCellFrmForBorderAttrs( const SwFrm* _pCellFrm, } } } - ASSERT( pTmpFrm && pTmpFrm->IsRowFrm(), "No RowFrm available" ); + OSL_ENSURE( pTmpFrm && pTmpFrm->IsRowFrm(), "No RowFrm available" ); const SwLayoutFrm* pParentRowFrm = static_cast<const SwLayoutFrm*>(pTmpFrm); const SwTabFrm* pParentTabFrm = @@ -4606,7 +4531,7 @@ const SwFrm* lcl_GetCellFrmForBorderAttrs( const SwFrm* _pCellFrm, { pLowerCell = pLowerCell->GetLower(); } - ASSERT( pLowerCell && pLowerCell->IsCellFrm(), "No CellFrm available" ); + OSL_ENSURE( pLowerCell && pLowerCell->IsCellFrm(), "No CellFrm available" ); pRet = pLowerCell; } else if ( !_bTop && !_rCellBorderAttrs.GetBox().GetBottom() ) @@ -4638,7 +4563,7 @@ const SwFrm* lcl_GetCellFrmForBorderAttrs( const SwFrm* _pCellFrm, } pLowerCell = pLowerCell->GetLower(); } - ASSERT( pLowerCell && pLowerCell->IsCellFrm(), "No CellFrm available" ); + OSL_ENSURE( pLowerCell && pLowerCell->IsCellFrm(), "No CellFrm available" ); pRet = pLowerCell; } } @@ -4647,11 +4572,36 @@ const SwFrm* lcl_GetCellFrmForBorderAttrs( const SwFrm* _pCellFrm, return pRet; } +void SwFrm::ProcessPrimitives( const drawinglayer::primitive2d::Primitive2DSequence& rSequence ) const +{ + basegfx::B2DRange aViewRange; + + SdrPage *pDrawPage = getRootFrm()->GetCurrShell()->Imp()->GetPageView()->GetPage(); + const drawinglayer::geometry::ViewInformation2D aNewViewInfos( + basegfx::B2DHomMatrix( ), + getRootFrm()->GetCurrShell()->GetOut()->GetViewTransformation(), + aViewRange, + GetXDrawPageForSdrPage( pDrawPage ), + 0.0, + uno::Sequence< beans::PropertyValue >() ); + + drawinglayer::processor2d::BaseProcessor2D * pProcessor2D = + sdr::contact::createBaseProcessor2DFromOutputDevice( + *getRootFrm()->GetCurrShell()->GetOut(), + aNewViewInfos ); + + if ( pProcessor2D ) + { + pProcessor2D->process( rSequence ); + delete pProcessor2D; + } +} + void SwFrm::PaintBorder( const SwRect& rRect, const SwPageFrm *pPage, const SwBorderAttrs &rAttrs ) const { //fuer (Row,Body,Ftn,Root,Column,NoTxt) gibt's hier nix zu tun - if ( (GetType() & 0x90C5) || (Prt().SSize() == Frm().SSize()) ) + if ( (GetType() & 0x90C5) ) return; if ( (GetType() & 0x2000) && //Cell @@ -4743,9 +4693,6 @@ void SwFrm::PaintBorder( const SwRect& rRect, const SwPageFrm *pPage, { const SwFrm* pDirRefFrm = IsCellFrm() ? FindTabFrm() : this; SWRECTFN( pDirRefFrm ) - // OD 19.05.2003 #109667# - use new method <lcl_PaintLeftRightLine(..)> - //::lcl_PaintLeftLine ( this, pPage, aRect, rRect, rAttrs, fnRect ); - //::lcl_PaintRightLine ( this, pPage, aRect, rRect, rAttrs, fnRect ); ::lcl_PaintLeftRightLine ( sal_True, *(this), *(pPage), aRect, rRect, rAttrs, fnRect ); ::lcl_PaintLeftRightLine ( sal_False, *(this), *(pPage), aRect, rRect, rAttrs, fnRect ); if ( !IsCntntFrm() || rAttrs.GetTopLine( *(this) ) ) @@ -4758,14 +4705,10 @@ void SwFrm::PaintBorder( const SwRect& rRect, const SwPageFrm *pPage, SwBorderAttrAccess aAccess( SwFrm::GetCache(), pCellFrmForTopBorderAttrs ); const SwBorderAttrs &rTopAttrs = *aAccess.Get(); - // OD 19.05.2003 #109667# - use new method <lcl_PaintTopBottomLine(..)> - //::lcl_PaintTopLine( this, pPage, aRect, rRect, rTopAttrs, fnRect ); ::lcl_PaintTopBottomLine( sal_True, *(this), *(pPage), aRect, rRect, rTopAttrs, fnRect ); } else { - // OD 19.05.2003 #109667# - use new method <lcl_PaintTopBottomLine(..)> - //::lcl_PaintTopLine( this, pPage, aRect, rRect, rAttrs, fnRect ); ::lcl_PaintTopBottomLine( sal_True, *(this), *(pPage), aRect, rRect, rAttrs, fnRect ); } } @@ -4779,14 +4722,10 @@ void SwFrm::PaintBorder( const SwRect& rRect, const SwPageFrm *pPage, SwBorderAttrAccess aAccess( SwFrm::GetCache(), pCellFrmForBottomBorderAttrs ); const SwBorderAttrs &rBottomAttrs = *aAccess.Get(); - // OD 19.05.2003 #109667# - use new method <lcl_PaintTopBottomLine(..)> - //::lcl_PaintBottomLine(this, pPage, aRect, rRect, rBottomAttrs, fnRect); ::lcl_PaintTopBottomLine(sal_False, *(this), *(pPage), aRect, rRect, rBottomAttrs, fnRect); } else { - // OD 19.05.2003 #109667# - use new method <lcl_PaintTopBottomLine(..)> - //::lcl_PaintBottomLine(this, pPage, aRect, rRect, rAttrs, fnRect); ::lcl_PaintTopBottomLine(sal_False, *(this), *(pPage), aRect, rRect, rAttrs, fnRect); } } @@ -4801,8 +4740,6 @@ void SwFrm::PaintBorder( const SwRect& rRect, const SwPageFrm *pPage, |* Beschreibung Spezialimplementierung wg. der Fussnotenlinie. |* Derzeit braucht nur der obere Rand beruecksichtigt werden. |* Auf andere Linien und Schatten wird verzichtet. -|* Ersterstellung MA 27. Feb. 93 -|* Letzte Aenderung MA 08. Sep. 93 |* |*************************************************************************/ @@ -4821,8 +4758,6 @@ void SwFtnContFrm::PaintBorder( const SwRect& rRect, const SwPageFrm *pPage, |* SwFtnContFrm::PaintLine() |* |* Beschreibung Fussnotenline malen. -|* Ersterstellung MA 02. Mar. 93 -|* Letzte Aenderung MA 28. Mar. 94 |* |*************************************************************************/ @@ -4852,7 +4787,7 @@ void SwFtnContFrm::PaintLine( const SwRect& rRect, case FTNADJ_LEFT: /* do nothing */; break; default: - ASSERT( !this, "Neues Adjustment fuer Fussnotenlinie?" ); + OSL_ENSURE( !this, "Neues Adjustment fuer Fussnotenlinie?" ); } SwTwips nLineWidth = rInf.GetLineWidth(); const SwRect aLineRect = bVert ? @@ -4861,7 +4796,8 @@ void SwFtnContFrm::PaintLine( const SwRect& rRect, : SwRect( Point( nX, Frm().Pos().Y() + rInf.GetTopDist() ), Size( nWidth, rInf.GetLineWidth())); if ( aLineRect.HasArea() ) - PaintBorderLine( rRect, aLineRect , pPage, &rInf.GetLineColor() ); + PaintBorderLine( rRect, aLineRect , pPage, &rInf.GetLineColor(), + rInf.GetLineStyle() ); } /************************************************************************* @@ -4870,8 +4806,6 @@ void SwFtnContFrm::PaintLine( const SwRect& rRect, |* |* Beschreibung Painted die Trennlinien fuer die innenliegenden |* Spalten. -|* Ersterstellung MA 21. Jun. 93 -|* Letzte Aenderung MA 28. Mar. 94 |* |*************************************************************************/ @@ -4900,7 +4834,7 @@ void SwLayoutFrm::PaintColLines( const SwRect &rRect, const SwFmtCol &rFmtCol, case COLADJ_BOTTOM: break; default: - ASSERT( !this, "Neues Adjustment fuer Spaltenlinie?" ); + OSL_ENSURE( !this, "Neues Adjustment fuer Spaltenlinie?" ); } if( nTop ) @@ -4922,7 +4856,8 @@ void SwLayoutFrm::PaintColLines( const SwRect &rRect, const SwFmtCol &rFmtCol, (aLineRect.*fnRect->fnSetPosX) ( (pCol->Frm().*fnGetX)() - nPenHalf ); if ( aRect.IsOver( aLineRect ) ) - PaintBorderLine( aRect, aLineRect , pPage, &rFmtCol.GetLineColor()); + PaintBorderLine( aRect, aLineRect , pPage, &rFmtCol.GetLineColor(), + rFmtCol.GetLineStyle() ); pCol = pCol->GetNext(); } } @@ -5250,6 +5185,8 @@ void SwPageFrm::PaintMarginArea( const SwRect& _rOutputRect, { SwRect aPgRect = Frm(); aPgRect._Intersection( _rOutputRect ); + if(aPgRect.Height() < 0 || aPgRect.Width() <= 0) // No intersection + return; SwRegionRects aPgRegion( aPgRect ); aPgRegion -= aPgPrtRect; const SwPageFrm* pPage = static_cast<const SwPageFrm*>(this); @@ -5275,46 +5212,7 @@ void SwPageFrm::PaintMarginArea( const SwRect& _rOutputRect, } } -// ---------------------------------------------------------------------- -// -// const SwPageFrm::mnBorderPxWidth, const SwPageFrm::mnShadowPxWidth -// SwPageFrm::GetBorderRect (..), SwPageFrm::GetRightShadowRect(..), -// SwPageFrm::GetBottomShadowRect(..), -// SwPageFrm::PaintBorderAndShadow(..), -// SwPageFrm::GetBorderAndShadowBoundRect(..) -// -// OD 12.02.2003 for #i9719# and #105645# -// ---------------------------------------------------------------------- - -const sal_Int8 SwPageFrm::mnBorderPxWidth = 1; -const sal_Int8 SwPageFrm::mnShadowPxWidth = 2; - -/** determine rectangle for page border - - OD 12.02.2003 for #i9719# and #105645# - - @author OD -*/ -/*static*/ void SwPageFrm::GetBorderRect( const SwRect& _rPageRect, - ViewShell* _pViewShell, - SwRect& _orBorderRect, - bool bRightSidebar ) -{ - SwRect aAlignedPageRect( _rPageRect ); - ::SwAlignRect( aAlignedPageRect, _pViewShell ); - Rectangle aBorderPxRect = - _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() ); - - aBorderPxRect.Left() = aBorderPxRect.Left() - mnBorderPxWidth; - aBorderPxRect.Top() = aBorderPxRect.Top() - mnBorderPxWidth; - aBorderPxRect.Right() = aBorderPxRect.Right() + mnBorderPxWidth; - aBorderPxRect.Bottom() = aBorderPxRect.Bottom() + mnBorderPxWidth; - - AddSidebarBorders(aBorderPxRect,_pViewShell, bRightSidebar, true); - - _orBorderRect = - SwRect( _pViewShell->GetOut()->PixelToLogic( aBorderPxRect ) ); -} +const sal_Int8 SwPageFrm::mnShadowPxWidth = 10; /** determine rectangle for right page shadow @@ -5329,20 +5227,20 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 2; { SwRect aAlignedPageRect( _rPageRect ); ::SwAlignRect( aAlignedPageRect, _pViewShell ); - Rectangle aPagePxRect = + SwRect aPagePxRect = _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() ); + const SwPostItMgr *pMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0; - Rectangle aRightShadowPxRect( - aPagePxRect.Right() + mnShadowPxWidth, - aPagePxRect.Top() + 1, - aPagePxRect.Right() + mnBorderPxWidth + mnShadowPxWidth, - aPagePxRect.Bottom() + mnBorderPxWidth + mnShadowPxWidth ); + _orRightShadowRect.Chg( + Point( aPagePxRect.Right() + 1, aPagePxRect.Top() + mnShadowPxWidth + 1 ), + Size( mnShadowPxWidth, aPagePxRect.Height() - mnShadowPxWidth - 1 ) ); - if ( bRightSidebar ) - AddSidebarBorders(aRightShadowPxRect,_pViewShell, bRightSidebar, true); + if (bRightSidebar && pMgr && pMgr->ShowNotes() && pMgr->HasNotes()) + { + _orRightShadowRect.Pos(_orRightShadowRect.Left() + pMgr->GetSidebarWidth(true) + + pMgr->GetSidebarBorderWidth(true), _orRightShadowRect.Top()); + } - _orRightShadowRect = - SwRect( _pViewShell->GetOut()->PixelToLogic( aRightShadowPxRect ) ); } /** determine rectangle for bottom page shadow @@ -5354,23 +5252,31 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 2; /*static*/ void SwPageFrm::GetBottomShadowRect( const SwRect& _rPageRect, ViewShell* _pViewShell, SwRect& _orBottomShadowRect, + bool bFullBottomShadow, bool bRightSidebar ) { + const SwPostItMgr *pMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0; SwRect aAlignedPageRect( _rPageRect ); ::SwAlignRect( aAlignedPageRect, _pViewShell ); - Rectangle aPagePxRect = + SwRect aPagePxRect = _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() ); - Rectangle aBottomShadowPxRect( - aPagePxRect.Left() + 1, - aPagePxRect.Bottom() + mnShadowPxWidth, - aPagePxRect.Right() + mnBorderPxWidth + mnShadowPxWidth, - aPagePxRect.Bottom() + mnBorderPxWidth + mnShadowPxWidth ); + // Shadow is shifted when not full + long lShadowAdjustment = (bFullBottomShadow ? 0 : 1 + mnShadowPxWidth); - AddSidebarBorders(aBottomShadowPxRect,_pViewShell, bRightSidebar, true); + _orBottomShadowRect.Chg( + Point( aPagePxRect.Left() + lShadowAdjustment, aPagePxRect.Bottom() + 1 ), + Size( aPagePxRect.Width() - lShadowAdjustment, mnShadowPxWidth ) ); - _orBottomShadowRect = - SwRect( _pViewShell->GetOut()->PixelToLogic( aBottomShadowPxRect ) ); + if(pMgr && pMgr->ShowNotes() && pMgr->HasNotes()) + { + // Notes are displayed, we've to extend borders + SwTwips aSidebarTotalWidth = pMgr->GetSidebarWidth(true) + pMgr->GetSidebarBorderWidth(true); + if(bRightSidebar) + _orBottomShadowRect.Right( _orBottomShadowRect.Right() + aSidebarTotalWidth ); + else + _orBottomShadowRect.Left( _orBottomShadowRect.Left() - aSidebarTotalWidth ); + } } /** paint page border and shadow @@ -5383,40 +5289,70 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 2; /*static*/ void SwPageFrm::PaintBorderAndShadow( const SwRect& _rPageRect, ViewShell* _pViewShell, bool bPaintRightShadow, + bool bFullBottomShadow, bool bRightSidebar ) { + // No shadow in prefs + if( !SwViewOption::IsShadow() ) return; + // --> FME 2004-06-24 #i16816# tagged pdf support SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *_pViewShell->GetOut() ); // <-- - // get color for page border and shadow paint - const Color& rColor = SwViewOption::GetFontColor(); + static BitmapEx aPageTopRightShadow; + static BitmapEx aPageBottomRightShadow; + static BitmapEx aPageBottomLeftShadow; + static BitmapEx aPageBottomShadowBase; + static BitmapEx aPageRightShadowBase; + static Color aShadowColor; + + + if(aShadowColor != SwViewOption::GetShadowColor() ) { + aShadowColor = SwViewOption::GetShadowColor(); + AlphaMask aMask( SW_RES( BMP_PAGE_BOTTOM_RIGHT_SHADOW_MASK ) ); + Bitmap aFilledSquare( Size( mnShadowPxWidth, mnShadowPxWidth ), 24 ); + aFilledSquare.Erase( aShadowColor ); + + aPageBottomRightShadow = BitmapEx( aFilledSquare, aMask ); + aMask.Rotate( 900, 255 ); + aPageTopRightShadow = BitmapEx( aFilledSquare, aMask ); + aMask.Rotate( 1800, 255); + aPageBottomLeftShadow = BitmapEx( aFilledSquare, aMask ); - // save current fill and line color of output device - Color aFill( _pViewShell->GetOut()->GetFillColor() ); - Color aLine( _pViewShell->GetOut()->GetLineColor() ); + aFilledSquare = Bitmap( Size( 1, mnShadowPxWidth ), 24 ); + aFilledSquare.Erase( aShadowColor ); + aMask = Bitmap( SW_RES( BMP_PAGE_BOTTOM_SHADOW_MASK ) ); + aPageBottomShadowBase = BitmapEx( aFilledSquare, aMask ); + + aFilledSquare = Bitmap( Size( mnShadowPxWidth, 1 ), 24 ); + aFilledSquare.Erase( aShadowColor ); + aMask = Bitmap( SW_RES( BMP_PAGE_RIGHT_SHADOW_MASK ) ); + aPageRightShadowBase = BitmapEx( aFilledSquare, aMask ); + } - // paint page border - _pViewShell->GetOut()->SetFillColor(); // OD 20.02.2003 #107369# - no fill color - _pViewShell->GetOut()->SetLineColor( rColor ); SwRect aPaintRect; - SwPageFrm::GetBorderRect( _rPageRect, _pViewShell, aPaintRect, bRightSidebar ); - _pViewShell->GetOut()->DrawRect( aPaintRect.SVRect() ); + OutputDevice *pOut = _pViewShell->GetOut(); // paint right shadow if ( bPaintRightShadow ) { - _pViewShell->GetOut()->SetFillColor( rColor ); SwPageFrm::GetRightShadowRect( _rPageRect, _pViewShell, aPaintRect, bRightSidebar ); - _pViewShell->GetOut()->DrawRect( aPaintRect.SVRect() ); + BitmapEx aPageRightShadow = aPageRightShadowBase; + aPageRightShadow.Scale( 1, aPaintRect.Height() ); + pOut->DrawBitmapEx( pOut->PixelToLogic( aPaintRect.Pos() ), aPageRightShadow ); + pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Left(), aPaintRect.Top() - mnShadowPxWidth ) ), aPageTopRightShadow ); + pOut->DrawBitmapEx( pOut->PixelToLogic( aPaintRect.BottomLeft() ), aPageBottomRightShadow ); } // paint bottom shadow - SwPageFrm::GetBottomShadowRect( _rPageRect, _pViewShell, aPaintRect, bRightSidebar ); - _pViewShell->GetOut()->DrawRect( aPaintRect.SVRect() ); - - _pViewShell->GetOut()->SetFillColor( aFill ); - _pViewShell->GetOut()->SetLineColor( aLine ); + SwPageFrm::GetBottomShadowRect( _rPageRect, _pViewShell, aPaintRect, bFullBottomShadow, bRightSidebar ); + if(!bFullBottomShadow) + { + pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Left() - mnShadowPxWidth, aPaintRect.Top() ) ), aPageBottomLeftShadow ); + } + BitmapEx aPageBottomShadow = aPageBottomShadowBase; + aPageBottomShadow.Scale( aPaintRect.Width(), 1 ); + pOut->DrawBitmapEx( pOut->PixelToLogic( aPaintRect.Pos() ), aPageBottomShadow); } //mod #i6193# paint sidebar for notes @@ -5547,14 +5483,22 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 2; SwRect& _orBorderAndShadowBoundRect, bool bRightSidebar ) { + SwRect aAlignedPageRect( _rPageRect ); + ::SwAlignRect( aAlignedPageRect, _pViewShell ); + SwRect aPagePxRect = + _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() ); + SwRect aTmpRect; - SwPageFrm::GetBorderRect( _rPageRect, _pViewShell, _orBorderAndShadowBoundRect, bRightSidebar ); SwPageFrm::GetRightShadowRect( _rPageRect, _pViewShell, aTmpRect, bRightSidebar ); - _orBorderAndShadowBoundRect.Union( aTmpRect ); - SwPageFrm::GetBottomShadowRect( _rPageRect, _pViewShell, aTmpRect, bRightSidebar ); - _orBorderAndShadowBoundRect.Union( aTmpRect ); - AddSidebarBorders(_orBorderAndShadowBoundRect, _pViewShell, bRightSidebar, false); + aPagePxRect.Right( aTmpRect.Right() ); + + // Always ask for full shadow + SwPageFrm::GetBottomShadowRect( _rPageRect, _pViewShell, aTmpRect, true, bRightSidebar ); + aPagePxRect.Bottom( aTmpRect.Bottom() ); + aPagePxRect.Left( aTmpRect.Left() ); + + _orBorderAndShadowBoundRect = _pViewShell->GetOut()->PixelToLogic( aPagePxRect.SVRect() ); } /*static*/ void SwPageFrm::AddSidebarBorders(SwRect &aRect, ViewShell* _pViewShell, bool bRightSidebar, bool bPx) @@ -5592,9 +5536,6 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 2; |* |* SwFrm::PaintBaBo() |* -|* Ersterstellung MA 22. Oct. 93 -|* Letzte Aenderung MA 19. Jun. 96 -|* |*************************************************************************/ void SwFrm::PaintBaBo( const SwRect& rRect, const SwPageFrm *pPage, @@ -5624,6 +5565,11 @@ void SwFrm::PaintBaBo( const SwRect& rRect, const SwPageFrm *pPage, static_cast<const SwPageFrm*>(this)->PaintMarginArea( rRect, pGlobalShell ); } + // paint background + { + PaintBackground( rRect, pPage, rAttrs, sal_False, bLowerBorder ); + } + // OD 06.08.2002 #99657# - paint border before painting background // paint grid for page frame and paint border { @@ -5633,11 +5579,6 @@ void SwFrm::PaintBaBo( const SwRect& rRect, const SwPageFrm *pPage, PaintBorder( aRect, pPage, rAttrs ); } - // paint background - { - PaintBackground( rRect, pPage, rAttrs, sal_False, bLowerBorder ); - } - pOut->Pop(); } @@ -5645,9 +5586,6 @@ void SwFrm::PaintBaBo( const SwRect& rRect, const SwPageFrm *pPage, |* |* SwFrm::PaintBackground() |* -|* Ersterstellung MA 04. Jan. 93 -|* Letzte Aenderung MA 06. Feb. 97 -|* |*************************************************************************/ /// OD 05.09.2002 #102912# /// Do not paint background for fly frames without a background brush by @@ -5839,8 +5777,6 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage, |* SwPageFrm::RefreshSubsidiary() |* |* Beschreibung Erneuert alle Hilfslinien der Seite. -|* Ersterstellung MA 04. Nov. 92 -|* Letzte Aenderung MA 10. May. 95 |* |*************************************************************************/ @@ -5885,9 +5821,6 @@ void SwPageFrm::RefreshSubsidiary( const SwRect &rRect ) const |* |* SwLayoutFrm::RefreshLaySubsidiary() |* -|* Ersterstellung MA 04. Nov. 92 -|* Letzte Aenderung MA 22. Jan. 95 -|* |*************************************************************************/ void SwLayoutFrm::RefreshLaySubsidiary( const SwPageFrm *pPage, const SwRect &rRect ) const @@ -5963,8 +5896,6 @@ void SwLayoutFrm::RefreshLaySubsidiary( const SwPageFrm *pPage, |* |* Beschreibung Hilfslinien um die PrtAreas malen |* Nur die LayoutFrm's die direkt Cntnt enthalten. -|* Ersterstellung MA 21. May. 92 -|* Letzte Aenderung MA 22. Jan. 95 |* |*************************************************************************/ @@ -5987,7 +5918,7 @@ void MA_FASTCALL lcl_RefreshLine( const SwLayoutFrm *pLay, SwLineRects* _pSubsLines ) { //In welche Richtung gehts? Kann nur Horizontal oder Vertikal sein. - ASSERT( ((rP1.X() == rP2.X()) || (rP1.Y() == rP2.Y())), + OSL_ENSURE( ((rP1.X() == rP2.X()) || (rP1.Y() == rP2.Y())), "Schraege Hilfslinien sind nicht erlaubt." ); const PointPtr pDirPt = rP1.X() == rP2.X() ? pY : pX; const PointPtr pOthPt = pDirPt == pX ? pY : pX; @@ -6069,7 +6000,7 @@ void MA_FASTCALL lcl_RefreshLine( const SwLayoutFrm *pLay, SwRect aRect( aP1, aP2 ); // OD 18.11.2002 #99672# - use parameter <_pSubsLines> instead of // global variable <pSubsLines>. - _pSubsLines->AddLineRect( aRect, 0, 0, nSubColor ); + _pSubsLines->AddLineRect( aRect, 0, SOLID, 0, nSubColor ); } aP1 = aP2; aP1.*pDirPt += 1; @@ -6208,13 +6139,13 @@ void SwLayoutFrm::PaintSubsidiaryLines( const SwPageFrm *pPage, if ( aOriginal.Left() == aOut.Left() ) { const SwRect aRect( aOut.Pos(), aLB ); - pUsedSubsLines->AddLineRect( aRect, 0, 0, nSubColor ); + 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 ) { const SwRect aRect( aRT, aRB ); - pUsedSubsLines->AddLineRect( aRect, 0, 0, + pUsedSubsLines->AddLineRect( aRect, 0, SOLID, 0, (bBreak && bVert) ? SUBCOL_BREAK : nSubColor ); } } @@ -6225,13 +6156,13 @@ void SwLayoutFrm::PaintSubsidiaryLines( const SwPageFrm *pPage, { // OD 14.11.2002 #104821# - in horizontal layout set page/column break at top const SwRect aRect( aOut.Pos(), aRT ); - pUsedSubsLines->AddLineRect( aRect, 0, 0, + pUsedSubsLines->AddLineRect( aRect, 0, SOLID, 0, (bBreak && !bVert) ? SUBCOL_BREAK : nSubColor ); } if ( aOriginal.Bottom() == nBottom ) { const SwRect aRect( aLB, aRB ); - pUsedSubsLines->AddLineRect( aRect, 0, 0, nSubColor ); + pUsedSubsLines->AddLineRect( aRect, 0, SOLID, 0, nSubColor ); } } } @@ -6244,8 +6175,6 @@ void SwLayoutFrm::PaintSubsidiaryLines( const SwPageFrm *pPage, |* Beschreibung Erneuert alle Extradaten (Zeilennummern usw) der Seite. |* Grundsaetzlich sind nur diejenigen Objekte beruecksichtig, |* die in die seitliche Ausdehnung des Rects ragen. -|* Ersterstellung MA 20. Jan. 98 -|* Letzte Aenderung MA 18. Feb. 98 |* |*************************************************************************/ @@ -6371,8 +6300,6 @@ const Font& SwPageFrm::GetEmptyPageFont() |* Retouche wird nur dann durchgefuehrt, wenn der Frm der letzte seiner |* Kette ist. Der Gesamte Bereich des Upper unterhalb des Frm wird |* per PaintBackground gecleared. -|* Ersterstellung MA 13. Apr. 93 -|* Letzte Aenderung MA 25. Jul. 96 |* |*************************************************************************/ @@ -6381,8 +6308,8 @@ void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const if ( bFlyMetafile ) return; - ASSERT( GetUpper(), "Retoucheversuch ohne Upper." ); - ASSERT( getRootFrm()->GetCurrShell() && pGlobalShell->GetWin(), "Retouche auf dem Drucker?" ); + OSL_ENSURE( GetUpper(), "Retoucheversuch ohne Upper." ); + OSL_ENSURE( getRootFrm()->GetCurrShell() && pGlobalShell->GetWin(), "Retouche auf dem Drucker?" ); SwRect aRetouche( GetUpper()->PaintArea() ); aRetouche.Top( Frm().Top() + Frm().Height() ); @@ -6460,8 +6387,6 @@ void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const Upper vorgegeben, die erste Brush wird benutzt. Ist fuer keinen Frm eine Brush angegeben, so wird sal_False zurueck- geliefert. - Ersterstellung MA 23. Dec. 92 - Letzte Aenderung MA 04. Feb. 97 @param rpBrush output parameter - constant reference pointer the found background brush @@ -6479,10 +6404,6 @@ void SwFrm::Retouche( const SwPageFrm * pPage, const SwRect &rRect ) const input parameter - boolean indicating, if background brush should *not* be taken from parent. - @author MA - @change 20.08.2002 by OD - @docdate 20.08.2002 - @return true, if a background brush for the frame is found */ sal_Bool SwFrm::GetBackgroundBrush( const SvxBrushItem* & rpBrush, @@ -6587,9 +6508,6 @@ sal_Bool SwFrm::GetBackgroundBrush( const SvxBrushItem* & rpBrush, |* |* SwFrmFmt::GetGraphic() |* -|* Ersterstellung MA 23. Jul. 96 -|* Letzte Aenderung MA 23. Jul. 96 -|* |*************************************************************************/ void SetOutDevAndWin( ViewShell *pSh, OutputDevice *pO, @@ -6621,7 +6539,7 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap ) SFX_ITEM_SET != GetAttrSet().GetItemState( RES_URL, sal_True ); if( bNoteURL ) { - ASSERT( !pNoteURL, "MakeGraphic: pNoteURL already used? " ); + OSL_ENSURE( !pNoteURL, "MakeGraphic: pNoteURL already used? " ); pNoteURL = new SwNoteURL; } SwFlyFrm *pFly = (SwFlyFrm*)pFirst; @@ -6701,7 +6619,7 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap ) if( bNoteURL ) { - ASSERT( pNoteURL, "MakeGraphic: Good Bye, NoteURL." ); + OSL_ENSURE( pNoteURL, "MakeGraphic: Good Bye, NoteURL." ); pNoteURL->FillImageMap( pMap, pFly->Frm().Pos(), aMap ); delete pNoteURL; pNoteURL = NULL; @@ -6728,4 +6646,4 @@ Graphic SwDrawFrmFmt::MakeGraphic( ImageMap* ) return aRet; } - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |