[Libreoffice-commits] .: 7 commits - sw/inc sw/source sw/util
Michael Meeks
mmeeks at kemper.freedesktop.org
Thu Mar 3 03:51:17 PST 2011
sw/inc/rcid.hrc | 5 +
sw/source/core/inc/pagefrm.hrc | 49 +++++++++
sw/source/core/inc/pagefrm.hxx | 42 ++------
sw/source/core/layout/layact.cxx | 12 --
sw/source/core/layout/makefile.mk | 4
sw/source/core/layout/pagefrm.src | 27 +++++
sw/source/core/layout/paintfrm.cxx | 148 +++++++++++++++---------------
sw/source/core/view/pagepreviewlayout.cxx | 4
sw/source/core/view/viewsh.cxx | 11 --
sw/util/makefile.mk | 1
10 files changed, 183 insertions(+), 120 deletions(-)
New commits:
commit f8d2677c8eaf4ec697000895be907fe20568e645
Author: Sébastien Le Ray <sebastien-libreoffice at orniz.org>
Date: Tue Mar 1 22:29:50 2011 +0100
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.
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);
commit e0846ced00cfa0d4b3341780cf624bf35faddc9c
Author: Sébastien Le Ray <sebastien-libreoffice at orniz.org>
Date: Mon Feb 28 23:04:30 2011 +0100
Properly handle shadow when in book mode.
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);
}
}
commit a1d5ab6147cc7cb8b8e85092cb76c9b763d87323
Author: Sébastien Le Ray <sebastien-libreoffice at orniz.org>
Date: Sun Feb 27 23:28:13 2011 +0100
Paint right shadow on last page.
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() )
commit b85ab50740f00190c6df80af062b62f674bcf0d9
Author: Sébastien Le Ray <sebastien-libreoffice at orniz.org>
Date: Sun Feb 27 23:27:37 2011 +0100
Code style
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() &&
commit a1881ec67c35b96b390251349a12c2cc38eee617
Author: Sébastien Le Ray <sebastien-libreoffice at orniz.org>
Date: Sun Feb 27 22:20:09 2011 +0100
Directly compute shadow rectangles
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
commit 14edd8786ab51a2eeeba7d346e6e4bed29afc36f
Author: Sébastien Le Ray <sebastien-libreoffice at orniz.org>
Date: Sun Feb 27 18:02:06 2011 +0100
Draw smooth shadows around page and remove borders
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:
commit 91aec198c0664c8cddc81289713fb86da9403772
Author: Sébastien Le Ray <sebastien-libreoffice at orniz.org>
Date: Sun Feb 27 17:23:48 2011 +0100
FDO#31251 - Add resources files for page shadow
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 at 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 \
More information about the Libreoffice-commits
mailing list