Hi list, Here is a complete patch for fdo#31251. It adds a smooth shadow to the page. During its development, I found that SwRect::_Intersection (used in page margin painting) returns negative height/width if the two rectangles do not overlap. I don't know if it is the expected behavior or a bug. If it's a bug I guess I can provide a patch. Regards Sebastien
From 4023f62b41d3a625a014ee1539506153057ad668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Le=20Ray?= <sebastien-libreoffice@orniz.org> Date: Tue, 1 Mar 2011 22:29:50 +0100 Subject: [PATCH 7/7] Correct some minor graphical glitches. SwRect::_Intersection() returns rectangles with negative height/width when there is no intersection which cause artifacts when drawing them... This bug has been present for a long time but wasn't so evident since margins were only 2 opaque black pixels. --- sw/source/core/layout/paintfrm.cxx | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index ff8395d..ec6a5d6 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -5192,6 +5192,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); -- 1.7.2.3
From aedfc3ec43536f1e137e4e04c63bab8443c11c15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Le=20Ray?= <sebastien-libreoffice@orniz.org> Date: Mon, 28 Feb 2011 23:04:30 +0100 Subject: [PATCH 6/7] Properly handle shadow when in book mode. --- sw/source/core/inc/pagefrm.hxx | 13 +++++++++ sw/source/core/layout/paintfrm.cxx | 42 ++++++++++++++++++++-------- sw/source/core/view/pagepreviewlayout.cxx | 4 +- 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx index 3c0c1cb..f1aa731 100644 --- a/sw/source/core/inc/pagefrm.hxx +++ b/sw/source/core/inc/pagefrm.hxx @@ -138,6 +138,7 @@ class SwPageFrm: public SwFtnBossFrm static void GetBottomShadowRect( const SwRect& _rPageRect, ViewShell* _pViewShell, SwRect& _orBottomShadowRect, + bool bFullBottomShadow, bool bRightSidebar ); /** adds the sidebar used for notes to right and left border @@ -314,10 +315,22 @@ public: @param _pViewShell input parameter - instance of the view shell, on which the output has to be generated. + + @param bPaintRightShadow + Should we paint shadow on the right or not (used in book mode) + + @param bFullBottomShadow + Should we have a bottom shadow of the same size as the pages or + not (for right pages in book mode in a LTR environment). + + @param bRightSidebar + Is the note sidebar on the right or not (used to adjust the + shadow with & position). */ static void PaintBorderAndShadow( const SwRect& _rPageRect, ViewShell* _pViewShell, bool bPaintRightShadow, + bool bFullBottomShadow, bool bRightSidebar ); /** get bound rectangle of border and shadow for repaints diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index d461d86..ff8395d 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2857,7 +2857,16 @@ void SwRootFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) con while ( pPage ) // <-- { + // 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() ) @@ -2963,7 +2972,7 @@ void SwRootFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) con { // 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); } @@ -3055,7 +3064,7 @@ void SwRootFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) con // 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); { @@ -5248,6 +5257,7 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10; /*static*/ void SwPageFrm::GetBottomShadowRect( const SwRect& _rPageRect, ViewShell* _pViewShell, SwRect& _orBottomShadowRect, + bool bFullBottomShadow, bool bRightSidebar ) { const SwPostItMgr *pMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0; @@ -5256,9 +5266,12 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10; SwRect aPagePxRect = _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() ); + // Shadow is shifted when not full + long lShadowAdjustment = (bFullBottomShadow ? 0 : 1 + mnShadowPxWidth); + _orBottomShadowRect.Chg( - Point( aPagePxRect.Left() + 1 + mnShadowPxWidth, aPagePxRect.Bottom() + 1 ), - Size( aPagePxRect.Width() - 1 - mnShadowPxWidth, mnShadowPxWidth ) ); + Point( aPagePxRect.Left() + lShadowAdjustment, aPagePxRect.Bottom() + 1 ), + Size( aPagePxRect.Width() - lShadowAdjustment, mnShadowPxWidth ) ); if(pMgr && pMgr->ShowNotes() && pMgr->HasNotes()) { @@ -5281,6 +5294,7 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10; /*static*/ void SwPageFrm::PaintBorderAndShadow( const SwRect& _rPageRect, ViewShell* _pViewShell, bool bPaintRightShadow, + bool bFullBottomShadow, bool bRightSidebar ) { // --> FME 2004-06-24 #i16816# tagged pdf support @@ -5288,10 +5302,6 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10; // <-- BitmapEx aPageBottomShadow( SW_RES( BMP_PAGE_BOTTOM_SHADOW ) ); - BitmapEx aPageRightShadow( SW_RES( BMP_PAGE_RIGHT_SHADOW ) ); - BitmapEx aPageTopRightShadow( SW_RES( BMP_PAGE_TOP_RIGHT_SHADOW ) ); - BitmapEx aPageBottomRightShadow( SW_RES( BMP_PAGE_BOTTOM_RIGHT_SHADOW ) ); - BitmapEx aPageBottomLeftShadow( SW_RES( BMP_PAGE_BOTTOM_LEFT_SHADOW ) ); SwRect aPaintRect; OutputDevice *pOut = _pViewShell->GetOut(); @@ -5299,6 +5309,9 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10; // paint right shadow if ( bPaintRightShadow ) { + BitmapEx aPageRightShadow( SW_RES( BMP_PAGE_RIGHT_SHADOW ) ); + BitmapEx aPageTopRightShadow( SW_RES( BMP_PAGE_TOP_RIGHT_SHADOW ) ); + BitmapEx aPageBottomRightShadow( SW_RES( BMP_PAGE_BOTTOM_RIGHT_SHADOW ) ); SwPageFrm::GetRightShadowRect( _rPageRect, _pViewShell, aPaintRect, bRightSidebar ); aPageRightShadow.Scale( 1, aPaintRect.Height() ); pOut->DrawBitmapEx( pOut->PixelToLogic( aPaintRect.Pos() ), aPageRightShadow ); @@ -5307,8 +5320,12 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10; } // paint bottom shadow - SwPageFrm::GetBottomShadowRect( _rPageRect, _pViewShell, aPaintRect, bRightSidebar ); - pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Left() - mnShadowPxWidth, aPaintRect.Top() ) ), aPageBottomLeftShadow ); + SwPageFrm::GetBottomShadowRect( _rPageRect, _pViewShell, aPaintRect, bFullBottomShadow, bRightSidebar ); + if(!bFullBottomShadow) + { + BitmapEx aPageBottomLeftShadow( SW_RES( BMP_PAGE_BOTTOM_LEFT_SHADOW ) ); + pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Left() - mnShadowPxWidth, aPaintRect.Top() ) ), aPageBottomLeftShadow ); + } aPageBottomShadow.Scale( aPaintRect.Width(), 1 ); pOut->DrawBitmapEx( pOut->PixelToLogic( aPaintRect.Pos() ), aPageBottomShadow); } @@ -5451,9 +5468,10 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10; aPagePxRect.Right( aTmpRect.Right() ); - SwPageFrm::GetBottomShadowRect( _rPageRect, _pViewShell, aTmpRect, bRightSidebar ); + // Always ask for full shadow + SwPageFrm::GetBottomShadowRect( _rPageRect, _pViewShell, aTmpRect, true, bRightSidebar ); aPagePxRect.Bottom( aTmpRect.Bottom() ); - aPagePxRect.Left( aTmpRect.Left() - mnShadowPxWidth - 1); + aPagePxRect.Left( aTmpRect.Left() ); _orBorderAndShadowBoundRect = _pViewShell->GetOut()->PixelToLogic( aPagePxRect.SVRect() ); } diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index 34e1675..c4ba173 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -1063,7 +1063,7 @@ bool SwPagePreviewLayout::Paint( const Rectangle _aOutRect ) const pOutputDev->SetFont( aOldFont ); // paint shadow and border for empty page // use new method to paint page border and shadow - SwPageFrm::PaintBorderAndShadow( aPageRect, &mrParentViewShell, true, true ); + SwPageFrm::PaintBorderAndShadow( aPageRect, &mrParentViewShell, true, false, true ); } else { @@ -1077,7 +1077,7 @@ bool SwPagePreviewLayout::Paint( const Rectangle _aOutRect ) const SwPageFrm::GetBorderAndShadowBoundRect( SwRect( aPageRect ), &mrParentViewShell, aPageBorderRect, true ); const Region aDLRegion(aPageBorderRect.SVRect()); mrParentViewShell.DLPrePaint2(aDLRegion); - SwPageFrm::PaintBorderAndShadow( aPageRect, &mrParentViewShell, true, true ); + SwPageFrm::PaintBorderAndShadow( aPageRect, &mrParentViewShell, true, false, true ); mrParentViewShell.DLPostPaint2(true); } } -- 1.7.2.3
From 99816d99a40c92e9be8973d51f0b5f5a323a8917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Le=20Ray?= <sebastien-libreoffice@orniz.org> Date: Sun, 27 Feb 2011 23:28:13 +0100 Subject: [PATCH 5/7] Paint right shadow on last page. --- sw/source/core/layout/paintfrm.cxx | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 9d319bd..d461d86 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2857,7 +2857,7 @@ void SwRootFrm::Paint( const SwRect& rRect, const SwPrtOptions *pPrintData ) con while ( pPage ) // <-- { - const bool bPaintRightShadow = !bBookMode || (pPage == Lower()) || (!bLTR && !pPage->OnRightPage()) || (bLTR && pPage->OnRightPage()); + const bool bPaintRightShadow = !bBookMode || (!pPage->GetNext()) || (pPage == Lower()) || (!bLTR && !pPage->OnRightPage()) || (bLTR && pPage->OnRightPage()); const bool bRightSidebar = pPage->SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT; if ( !pPage->IsEmptyPage() ) -- 1.7.2.3
From 684cd203440af8dec3f49a747258ffd4bf41af9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Le=20Ray?= <sebastien-libreoffice@orniz.org> Date: Sun, 27 Feb 2011 23:27:37 +0100 Subject: [PATCH 4/7] Code style --- sw/source/core/layout/layact.cxx | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 4479c93..c4989b8 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1450,7 +1450,7 @@ BOOL SwLayAction::FormatLayout( SwLayoutFrm *pLay, BOOL bAddRect ) // nothing to do break; } - aPaint.Bottom( aPaint.Bottom() + nShadowWidth); + aPaint.Bottom( aPaint.Bottom() + nShadowWidth ); } if ( pLay->IsPageFrm() && -- 1.7.2.3
From fd8c9fcb2aa6c714a640bf6b92399ca8b09cbafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Le=20Ray?= <sebastien-libreoffice@orniz.org> Date: Sun, 27 Feb 2011 22:20:09 +0100 Subject: [PATCH 3/7] Directly compute shadow rectangles --- sw/source/core/layout/paintfrm.cxx | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 2fa6b54..9d319bd 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -5250,6 +5250,7 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10; SwRect& _orBottomShadowRect, bool bRightSidebar ) { + const SwPostItMgr *pMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0; SwRect aAlignedPageRect( _rPageRect ); ::SwAlignRect( aAlignedPageRect, _pViewShell ); SwRect aPagePxRect = @@ -5259,8 +5260,15 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10; Point( aPagePxRect.Left() + 1 + mnShadowPxWidth, aPagePxRect.Bottom() + 1 ), Size( aPagePxRect.Width() - 1 - mnShadowPxWidth, mnShadowPxWidth ) ); - AddSidebarBorders( _orBottomShadowRect, _pViewShell, bRightSidebar, true); - + 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 -- 1.7.2.3
From 8e194f74a46b7f7b5412884a91c7dad88293b834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Le=20Ray?= <sebastien-libreoffice@orniz.org> Date: Sun, 27 Feb 2011 18:02:06 +0100 Subject: [PATCH 2/7] Draw smooth shadows around page and remove borders --- sw/source/core/inc/pagefrm.hxx | 29 --------- sw/source/core/layout/layact.cxx | 12 +--- sw/source/core/layout/paintfrm.cxx | 110 +++++++++++++---------------------- sw/source/core/view/viewsh.cxx | 11 +-- 4 files changed, 49 insertions(+), 113 deletions(-) diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx index e6b86b5..3c0c1cb 100644 --- a/sw/source/core/inc/pagefrm.hxx +++ b/sw/source/core/inc/pagefrm.hxx @@ -87,8 +87,6 @@ class SwPageFrm: public SwFtnBossFrm // is in progress. bool mbLayoutInProgress; - // #i9719# - static const sal_Int8 mnBorderPxWidth; static const sal_Int8 mnShadowPxWidth; void _UpdateAttr( SfxPoolItem*, SfxPoolItem*, BYTE &, @@ -97,28 +95,6 @@ class SwPageFrm: public SwFtnBossFrm // Anpassen der max. Fussnotenhoehen in den einzelnen Spalten void SetColMaxFtnHeight(); - /** determine rectangle for page border - - #i9719# - - @param _rPageRect - input parameter - constant instance reference of the page rectangle. - Generally, it's the frame area of the page, but for empty pages in print - preview, this parameter is useful. - - @param _pViewShell - input parameter - instance of the view shell, for which the rectangle - has to be generated. - - @param _orBorderRect - output parameter - instance reference of the border rectangle for - the given page rectangle - */ - static void GetBorderRect( const SwRect& _rPageRect, - ViewShell* _pViewShell, - SwRect& _orBorderRect, - bool bRightSidebar ); - /** determine rectangle for right page shadow #i9719# @@ -376,11 +352,6 @@ public: virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const; - // #i9719# - inline sal_Int8 BorderPxWidth() const - { - return mnBorderPxWidth; - } inline sal_Int8 ShadowPxWidth() const { return mnShadowPxWidth; diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 57af311..4479c93 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1427,8 +1427,6 @@ BOOL SwLayAction::FormatLayout( SwLayoutFrm *pLay, BOOL bAddRect ) if ( pLay->IsPageFrm() ) { SwPageFrm* pPageFrm = static_cast<SwPageFrm*>(pLay); - const int nBorderWidth = - pImp->GetShell()->GetOut()->PixelToLogic( Size( pPageFrm->BorderPxWidth(), 0 ) ).Width(); const int nShadowWidth = pImp->GetShell()->GetOut()->PixelToLogic( Size( pPageFrm->ShadowPxWidth(), 0 ) ).Width(); @@ -1439,22 +1437,20 @@ BOOL SwLayAction::FormatLayout( SwLayoutFrm *pLay, BOOL bAddRect ) { case sw::sidebarwindows::SIDEBAR_LEFT: { - aPaint.Left( aPaint.Left() - nBorderWidth - nSidebarWidth); - aPaint.Right( aPaint.Right() + nBorderWidth + nShadowWidth); + aPaint.Left( aPaint.Left() - nSidebarWidth); + aPaint.Right( aPaint.Right() + nShadowWidth); } break; case sw::sidebarwindows::SIDEBAR_RIGHT: { - aPaint.Left( aPaint.Left() - nBorderWidth ); - aPaint.Right( aPaint.Right() + nBorderWidth + nShadowWidth + nSidebarWidth); + aPaint.Right( aPaint.Right() + nShadowWidth + nSidebarWidth); } break; case sw::sidebarwindows::SIDEBAR_NONE: // nothing to do break; } - aPaint.Top( aPaint.Top() - nBorderWidth ); - aPaint.Bottom( aPaint.Bottom() + nBorderWidth + nShadowWidth); + aPaint.Bottom( aPaint.Bottom() + nShadowWidth); } if ( pLay->IsPageFrm() && diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 0b8fa8b..2fa6b54 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -111,6 +111,7 @@ #include <svtools/borderhelper.hxx> +#include "pagefrm.hrc" using namespace ::com::sun::star; @@ -5207,35 +5208,7 @@ void SwPageFrm::PaintMarginArea( const SwRect& _rOutputRect, } } -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 @@ -5250,20 +5223,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 @@ -5279,19 +5252,15 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 2; { 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 ); + _orBottomShadowRect.Chg( + Point( aPagePxRect.Left() + 1 + mnShadowPxWidth, aPagePxRect.Bottom() + 1 ), + Size( aPagePxRect.Width() - 1 - mnShadowPxWidth, mnShadowPxWidth ) ); - AddSidebarBorders(aBottomShadowPxRect,_pViewShell, bRightSidebar, true); + AddSidebarBorders( _orBottomShadowRect, _pViewShell, bRightSidebar, true); - _orBottomShadowRect = - SwRect( _pViewShell->GetOut()->PixelToLogic( aBottomShadowPxRect ) ); } /** paint page border and shadow @@ -5310,34 +5279,30 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 2; SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *_pViewShell->GetOut() ); // <-- - // get color for page border and shadow paint - const Color& rColor = SwViewOption::GetFontColor(); - - // save current fill and line color of output device - Color aFill( _pViewShell->GetOut()->GetFillColor() ); - Color aLine( _pViewShell->GetOut()->GetLineColor() ); + BitmapEx aPageBottomShadow( SW_RES( BMP_PAGE_BOTTOM_SHADOW ) ); + BitmapEx aPageRightShadow( SW_RES( BMP_PAGE_RIGHT_SHADOW ) ); + BitmapEx aPageTopRightShadow( SW_RES( BMP_PAGE_TOP_RIGHT_SHADOW ) ); + BitmapEx aPageBottomRightShadow( SW_RES( BMP_PAGE_BOTTOM_RIGHT_SHADOW ) ); + BitmapEx aPageBottomLeftShadow( SW_RES( BMP_PAGE_BOTTOM_LEFT_SHADOW ) ); - // 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() ); + 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 ); + pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Left() - mnShadowPxWidth, aPaintRect.Top() ) ), aPageBottomLeftShadow ); + aPageBottomShadow.Scale( aPaintRect.Width(), 1 ); + pOut->DrawBitmapEx( pOut->PixelToLogic( aPaintRect.Pos() ), aPageBottomShadow); } //mod #i6193# paint sidebar for notes @@ -5468,14 +5433,21 @@ 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 ); + + aPagePxRect.Right( aTmpRect.Right() ); + SwPageFrm::GetBottomShadowRect( _rPageRect, _pViewShell, aTmpRect, bRightSidebar ); - _orBorderAndShadowBoundRect.Union( aTmpRect ); + aPagePxRect.Bottom( aTmpRect.Bottom() ); + aPagePxRect.Left( aTmpRect.Left() - mnShadowPxWidth - 1); - AddSidebarBorders(_orBorderAndShadowBoundRect, _pViewShell, bRightSidebar, false); + _orBorderAndShadowBoundRect = _pViewShell->GetOut()->PixelToLogic( aPagePxRect.SVRect() ); } /*static*/ void SwPageFrm::AddSidebarBorders(SwRect &aRect, ViewShell* _pViewShell, bool bRightSidebar, bool bPx) diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 4988770..60bfcc7 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -1005,9 +1005,6 @@ void ViewShell::VisPortChgd( const SwRect &rRect) if ( aPageRect.IsOver( aBoth ) ) { - // #i9719#, - consider new border and shadow width - const SwTwips nBorderWidth = - GetOut()->PixelToLogic( Size( pPage->BorderPxWidth(), 0 ) ).Width(); const SwTwips nShadowWidth = GetOut()->PixelToLogic( Size( pPage->ShadowPxWidth(), 0 ) ).Width(); @@ -1017,14 +1014,14 @@ void ViewShell::VisPortChgd( const SwRect &rRect) { case sw::sidebarwindows::SIDEBAR_LEFT: { - nPageLeft = aPageRect.Left() - nBorderWidth - nSidebarWidth; - nPageRight = aPageRect.Right() + nBorderWidth + nShadowWidth; + nPageLeft = aPageRect.Left() - nSidebarWidth; + nPageRight = aPageRect.Right() + nShadowWidth; } break; case sw::sidebarwindows::SIDEBAR_RIGHT: { - nPageLeft = aPageRect.Left() - nBorderWidth; - nPageRight = aPageRect.Right() + nBorderWidth + nShadowWidth + nSidebarWidth; + nPageLeft = aPageRect.Left(); + nPageRight = aPageRect.Right() + nShadowWidth + nSidebarWidth; } break; case sw::sidebarwindows::SIDEBAR_NONE: -- 1.7.2.3
From 8a1fd1d4850b4f61ffc175766d0aa0dcc2f8526a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Le=20Ray?= <sebastien-libreoffice@orniz.org> Date: Sun, 27 Feb 2011 17:23:48 +0100 Subject: [PATCH 1/7] FDO#31251 - Add resources files for page shadow --- sw/inc/rcid.hrc | 5 ++++ sw/source/core/inc/pagefrm.hrc | 49 +++++++++++++++++++++++++++++++++++++ sw/source/core/layout/makefile.mk | 4 +++ sw/source/core/layout/pagefrm.src | 27 ++++++++++++++++++++ sw/util/makefile.mk | 1 + 5 files changed, 86 insertions(+), 0 deletions(-) create mode 100644 sw/source/core/inc/pagefrm.hrc create mode 100644 sw/source/core/layout/pagefrm.src diff --git a/sw/inc/rcid.hrc b/sw/inc/rcid.hrc index f5fe008..f06180a 100644 --- a/sw/inc/rcid.hrc +++ b/sw/inc/rcid.hrc @@ -79,6 +79,7 @@ #define RC_SMARTTAG (RC_BASE + 3950) // SMARTTAGS #define RC_UNOCORE (RC_BASE + 4050) #define RC_ANNOTATION (RC_BASE + 4150) +#define RC_PAGEFRM (RC_BASE + 4250) /*-------------------------------------------------------------------- Beschreibung: Bereiche ausspannen @@ -100,6 +101,10 @@ #define RC_ANNOTATION_BEGIN RC_ANNOTATION #define RC_ANNOTATION_END (RC_ANNOTATION_BEGIN + 99) +// Page frame +#define RC_PAGEFRM_BEGIN RC_PAGEFRM +#define RC_PAGEFRM_EN (RC_PAGEFRM + 99) + // SW/Web #define RC_WEB_BEGIN RC_WEB #define RC_WEB_END (RC_WEB_BEGIN + 199) diff --git a/sw/source/core/inc/pagefrm.hrc b/sw/source/core/inc/pagefrm.hrc new file mode 100644 index 0000000..c72c212 --- /dev/null +++ b/sw/source/core/inc/pagefrm.hrc @@ -0,0 +1,49 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Sébastien Le Ray <sebastien-libreoffice@orniz.org> + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef _PAGEFRM_HRC +#define _PAGEFRM_HRC + +#include "rcid.hrc" + +// Bitmaps for page shadow +#define BMP_PAGE_TOP_RIGHT_SHADOW RC_PAGEFRM_BEGIN +#define BMP_PAGE_RIGHT_SHADOW RC_PAGEFRM_BEGIN + 1 +#define BMP_PAGE_BOTTOM_RIGHT_SHADOW RC_PAGEFRM_BEGIN + 2 +#define BMP_PAGE_BOTTOM_SHADOW RC_PAGEFRM_BEGIN + 3 +#define BMP_PAGE_BOTTOM_LEFT_SHADOW RC_PAGEFRM_BEGIN + 4 + + +// If you add resources, don't forget to update this +#define PAGEFRM_ACT_END BMP_PAGE_BOTTOMLEFT_SHADOW + +// Sanity check +#if PAGEFRM_ACT_END > RC_PAGEFRM_END +#error Not enough room for pagefrm resource in #file:#line +#endif + +#endif diff --git a/sw/source/core/layout/makefile.mk b/sw/source/core/layout/makefile.mk index e986ec8..6470592 100644 --- a/sw/source/core/layout/makefile.mk +++ b/sw/source/core/layout/makefile.mk @@ -89,6 +89,10 @@ SLOFILES = \ $(SLO)$/swselectionlist.obj \ $(SLO)$/unusedf.obj +SRS1NAME=$(TARGET) +SRC1FILES =\ + pagefrm.src + .IF "$(DBG_LEVEL)">="2" SLOFILES += \ $(SLO)$/dbg_lay.obj diff --git a/sw/source/core/layout/pagefrm.src b/sw/source/core/layout/pagefrm.src new file mode 100644 index 0000000..dfa9b2b --- /dev/null +++ b/sw/source/core/layout/pagefrm.src @@ -0,0 +1,27 @@ +#include "pagefrm.hrc" + +Bitmap BMP_PAGE_TOP_RIGHT_SHADOW +{ + File = "page-topright-shadow.png"; +}; + +Bitmap BMP_PAGE_RIGHT_SHADOW +{ + File = "page-right-shadow.png"; +}; + +Bitmap BMP_PAGE_BOTTOM_RIGHT_SHADOW +{ + File = "page-bottomright-shadow.png"; +}; + +Bitmap BMP_PAGE_BOTTOM_SHADOW +{ + File = "page-bottom-shadow.png"; +}; + +Bitmap BMP_PAGE_BOTTOM_LEFT_SHADOW +{ + File = "page-bottomleft-shadow.png"; +}; + diff --git a/sw/util/makefile.mk b/sw/util/makefile.mk index 5539505..42132f1 100644 --- a/sw/util/makefile.mk +++ b/sw/util/makefile.mk @@ -53,6 +53,7 @@ sw_res_files= \ $(SRS)$/frmdlg.srs \ $(SRS)$/globdoc.srs \ $(SRS)$/index.srs \ + $(SRS)$/layout.srs \ $(SRS)$/lingu.srs \ $(SRS)$/misc.srs \ $(SRS)$/ribbar.srs \ -- 1.7.2.3
From 56bceaec5cef9593f23219b6d257e8073ec34426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Le=20Ray?= <sebastien-libreoffice@orniz.org> Date: Sun, 27 Feb 2011 18:06:13 +0100 Subject: [PATCH] Added shadow images. --- default_images/sw/res/page-bottom-shadow.png | Bin 0 -> 193 bytes default_images/sw/res/page-bottomleft-shadow.png | Bin 0 -> 285 bytes default_images/sw/res/page-bottomright-shadow.png | Bin 0 -> 289 bytes default_images/sw/res/page-right-shadow.png | Bin 0 -> 191 bytes default_images/sw/res/page-topright-shadow.png | Bin 0 -> 306 bytes 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 default_images/sw/res/page-bottom-shadow.png create mode 100644 default_images/sw/res/page-bottomleft-shadow.png create mode 100644 default_images/sw/res/page-bottomright-shadow.png create mode 100644 default_images/sw/res/page-right-shadow.png create mode 100644 default_images/sw/res/page-topright-shadow.png diff --git a/default_images/sw/res/page-bottom-shadow.png b/default_images/sw/res/page-bottom-shadow.png new file mode 100644 index 0000000000000000000000000000000000000000..fe881a97cc14556d3da978024cbff78912d9c1f6 GIT binary patch literal 193 zcmeAS@N?(olHy`uVBq!ia0vp^j6lrA!3HEtFPV6O1d4;)ofy`glX(f`uqAoByD<C* z!3BGlPX>x`7I;J!Gca%qgD@k*tT_@uLG}_)Usv|qOwv5Ef>(_TEPz6iC9V-A&iT2y zsd*&~&PAz-C8;S2<(VZJ3hti10pX2&;y^_*o-U3d9M_X~)cpNZug1pK_S}buhv)o* dBgJ!)7y`C&FFSDR?joQ%22WQ%mvv4FO#nZmHPrwB literal 0 HcmV?d00001 diff --git a/default_images/sw/res/page-bottomleft-shadow.png b/default_images/sw/res/page-bottomleft-shadow.png new file mode 100644 index 0000000000000000000000000000000000000000..9e4a72b1acacb82f99f323cdaf415f39f6cf4774 GIT binary patch literal 285 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V8<6ZZI=>f4F%}28J29*~C-V}>VN3FMcVYMs zf(!O8p9~b?EbxddW?<kJ24O~qS#u<Sg6t)pzOL-InWTB7S!Zr$J`5C^>*?YcB5}F& z{OP<y4m=JQjSWm3<V6A%C;tCGUuV+^^^)+FS^@J~U1bCtvtFK(`hDu#l3gpk)-)Ma zRPYxZjMtxEEwkZZ`Z2-f8t<Cp*BD+qR^E3^??sE|Jf~ZV&olCpkMehMFTOIbsN<G_ z<K2+_h)2xad)Uuw7<d@Q-3^&*a-3)VjFP0X?)4}B-uE+f@_MIqu7b0x{^*3_{9LzP ZOgjP$&+h*;pA+a%22WQ%mvv4FO#mOpX<PsR literal 0 HcmV?d00001 diff --git a/default_images/sw/res/page-bottomright-shadow.png b/default_images/sw/res/page-bottomright-shadow.png new file mode 100644 index 0000000000000000000000000000000000000000..ff00470bc5f24ee6ede99cbc892430cb9cbea8c9 GIT binary patch literal 289 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V8<6ZZI=>f4F%}28J29*~C-V}>VN3FMcVYMs zf(!O8p9~b?EbxddW?<kJ24O~qS#u<Sg6t)pzOL-InWTB7v}5Y*eSty?JzX3_BreBZ zu+BSdAkgyAzfpg&Q|r6>4iU{7=H=cgo*Q-C`$go~+QcL#DEz-Gx#^e1{`WtQJWbsz zbN=3@p9h(_!*VXhm3Uoe4)2*^;J*K2&;iqcb~`@dyrnNiUYm*^_6xU_Zfj6p7G7{H z!dAJY^HOrot8e$KxGhpIiQa!PYuDR_4b^fb{`>5L_b=)CI&J+<_3Hs@vIlMN8zg7F dDl1%J-z5}XI&;H;3ZP>dJYD@<);T3K0RYisYEb|H literal 0 HcmV?d00001 diff --git a/default_images/sw/res/page-right-shadow.png b/default_images/sw/res/page-right-shadow.png new file mode 100644 index 0000000000000000000000000000000000000000..7b8870ed042f72bb7da4e0c6abcc1930b778cb0f GIT binary patch literal 191 zcmeAS@N?(olHy`uVBq!ia0vp^AT}ch8<2ed)xHkIDGqXXVpw-h<|UBBmgMd3!tfsi z7wla=87RV8;1OBOz`!jG!i)^F=12eq*-JcqUD<ClN%P2<%c&k|0SZZ$xJHyX=jZ08 z=9Mrw7o{eaq^2m8XO?6rxO@5rgg5eu0~JYmx;Tb#Tu<Ip^Y>3Z8(Z6R9v+_a3w~Id a*)i}JaZe36ll2Cuiow&>&t;ucLK6Tx&@?;% literal 0 HcmV?d00001 diff --git a/default_images/sw/res/page-topright-shadow.png b/default_images/sw/res/page-topright-shadow.png new file mode 100644 index 0000000000000000000000000000000000000000..2603731527826eb1143d6191c4e27950b0d67d81 GIT binary patch literal 306 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V8<6ZZI=>f4F%}28J29*~C-V}>VN3FMcVYMs zf(!O8p9~b?EbxddW?<kJ24O~qS#u<Sg6t)pzOL-InWTB7g>%!lO#%vS@^o<wk+>Xt z-Zt-0fPm}6^L&O++yfUWC~aou;`+9qLtJl9rv|G4M_+TWfwJPflG*0&<>y3luV0Zc ze9-c^YOCa(Jwm5FWFxo4elFtnOR{(*&Tf-@yUe$B{nxBwzk<%<bw~L`-z|D$9DY6g z=K-1b6^FC4QXa=|$#qvdx-`?FKl!$4I}7`pKv9v0)m+crZJrp~raipEzM*@+<g%MT vWH0zLT=o#H`d)eF^3|m?FS#yu`N)6J*I4l5y#Ka9*E4v!`njxgN@xNA0Vi<z literal 0 HcmV?d00001 -- 1.7.2.3
Attachment:
signature.asc
Description: PGP signature