summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Le Ray <sebastien-libreoffice@orniz.org>2011-02-27 18:02:06 +0100
committerMichael Meeks <michael.meeks@novell.com>2011-03-03 10:41:27 +0000
commit58dac4a84808321327a9bae8d2006ec3e9df4b32 (patch)
tree5af40c57759f963e531c6633150e1d8035669e03
parent4b3607067688d53d8bad91066b2eb483d2ee0407 (diff)
Draw smooth shadows around page and remove borders
-rw-r--r--sw/source/core/inc/pagefrm.hxx29
-rw-r--r--sw/source/core/layout/layact.cxx12
-rw-r--r--sw/source/core/layout/paintfrm.cxx110
-rw-r--r--sw/source/core/view/viewsh.cxx11
4 files changed, 49 insertions, 113 deletions
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index a1fc3b7e6853..647801f5330f 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 6dfd19902a5f..4a66aba8ef4f 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 e02ea9aea53a..f709b6a657a3 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 c975001ac00f..08c8aa3dd69d 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: