summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/doc/poolfmt.cxx2
-rw-r--r--sw/source/core/inc/frmtool.hxx2
-rw-r--r--sw/source/core/inc/pagefrm.hrc6
-rw-r--r--sw/source/core/inc/pagefrm.hxx46
-rw-r--r--sw/source/core/layout/layact.cxx83
-rw-r--r--sw/source/core/layout/pagechg.cxx5
-rw-r--r--sw/source/core/layout/pagefrm.src14
-rw-r--r--sw/source/core/layout/paintfrm.cxx219
-rw-r--r--sw/source/core/view/pagepreviewlayout.cxx3
-rw-r--r--sw/source/core/view/viewimp.cxx6
-rw-r--r--sw/source/core/view/viewsh.cxx32
-rw-r--r--sw/source/filter/basflt/fltini.cxx8
-rw-r--r--sw/source/ui/dialog/swabstdlg.cxx3
13 files changed, 219 insertions, 210 deletions
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index ca115007c9eb..5212f709f1ee 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -1308,7 +1308,7 @@ SwFmt* SwDoc::GetFmtFromPool( sal_uInt16 nId )
aSet.Put( SwFmtAnchor( FLY_AT_PARA ));
aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME ));
aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ));
- aSet.Put( SwFmtSurround( SURROUND_NONE ));
+ aSet.Put( SwFmtSurround( SURROUND_IDEAL ));
}
break;
case RES_POOLFRM_FORMEL:
diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx
index 0cc9898089b6..ba1b0f43d539 100644
--- a/sw/source/core/inc/frmtool.hxx
+++ b/sw/source/core/inc/frmtool.hxx
@@ -72,7 +72,7 @@ void MA_FASTCALL DrawGraphic( const SvxBrushItem *, OutputDevice *,
// - method to align rectangle
// Created declaration here to avoid <extern> declarations
-void MA_FASTCALL SwAlignRect( SwRect &rRect, ViewShell *pSh );
+void MA_FASTCALL SwAlignRect( SwRect &rRect, const ViewShell *pSh );
// - method to align graphic rectangle
// Created declaration here to avoid <extern> declarations
diff --git a/sw/source/core/inc/pagefrm.hrc b/sw/source/core/inc/pagefrm.hrc
index 302ba9a76b16..b8f89e091c15 100644
--- a/sw/source/core/inc/pagefrm.hrc
+++ b/sw/source/core/inc/pagefrm.hrc
@@ -31,13 +31,11 @@
#include "rcid.hrc"
// Bitmaps for page shadow
-#define BMP_PAGE_RIGHT_SHADOW_MASK RC_PAGEFRM_BEGIN + 0
-#define BMP_PAGE_BOTTOM_RIGHT_SHADOW_MASK RC_PAGEFRM_BEGIN + 1
-#define BMP_PAGE_BOTTOM_SHADOW_MASK RC_PAGEFRM_BEGIN + 2
+#define BMP_PAGE_SHADOW_MASK RC_PAGEFRM_BEGIN + 0
// If you add resources, don't forget to update this
-#define PAGEFRM_ACT_END BMP_PAGE_BOTTOMLEFT_SHADOW
+#define PAGEFRM_ACT_END BMP_PAGE_SHADOW_MASK
// Sanity check
#if PAGEFRM_ACT_END > RC_PAGEFRM_END
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx
index 92b11aed27ea..1fb456dea39d 100644
--- a/sw/source/core/inc/pagefrm.hxx
+++ b/sw/source/core/inc/pagefrm.hxx
@@ -95,29 +95,7 @@ class SwPageFrm: public SwFtnBossFrm
// Anpassen der max. Fussnotenhoehen in den einzelnen Spalten
void SetColMaxFtnHeight();
- /** determine rectangle for right page shadow
-
- #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 _orRightShadowRect
- output parameter - instance reference of the right shadow rectangle for
- the given page rectangle
- */
- static void GetRightShadowRect( const SwRect& _rPageRect,
- ViewShell* _pViewShell,
- SwRect& _orRightShadowRect,
- bool bRightSidebar );
-
- /** determine rectangle for bottom page shadow
+ /** determine rectangle for horizontal page shadow
#i9719#
@@ -135,10 +113,11 @@ class SwPageFrm: public SwFtnBossFrm
the given page rectangle
*/
- static void GetBottomShadowRect( const SwRect& _rPageRect,
- ViewShell* _pViewShell,
+ static void GetHorizontalShadowRect( const SwRect& _rPageRect,
+ const ViewShell* _pViewShell,
SwRect& _orBottomShadowRect,
- bool bFullBottomShadow,
+ bool bPaintLeftShadow,
+ bool bPaintRightShadow,
bool bRightSidebar );
/** adds the sidebar used for notes to right and left border
@@ -193,6 +172,8 @@ public:
inline const SwCntntFrm *FindFirstBodyCntnt() const;
inline const SwCntntFrm *FindLastBodyCntnt() const;
+ SwRect GetBoundRect() const;
+
//Spezialisiertes GetCntntPos() fuer Felder in Rahmen.
void GetCntntPosition( const Point &rPt, SwPosition &rPos ) const;
@@ -267,6 +248,8 @@ public:
inline void ValidateWordCount() const;
inline sal_Bool IsInvalid() const;
inline sal_Bool IsInvalidFly() const;
+ sal_Bool IsRightShadowNeeded() const;
+ sal_Bool IsLeftShadowNeeded() const;
sal_Bool IsInvalidFlyLayout() const { return bInvalidFlyLayout; }
sal_Bool IsInvalidFlyCntnt() const { return bInvalidFlyCntnt; }
sal_Bool IsInvalidFlyInCnt() const { return bInvalidFlyInCnt; }
@@ -328,9 +311,9 @@ public:
shadow with & position).
*/
static void PaintBorderAndShadow( const SwRect& _rPageRect,
- ViewShell* _pViewShell,
+ const ViewShell* _pViewShell,
+ bool bPaintLeftShadow,
bool bPaintRightShadow,
- bool bFullBottomShadow,
bool bRightSidebar );
/** get bound rectangle of border and shadow for repaints
@@ -351,9 +334,12 @@ public:
rectangle for the given page rectangle
*/
static void GetBorderAndShadowBoundRect( const SwRect& _rPageRect,
- ViewShell* _pViewShell,
+ const ViewShell* _pViewShell,
SwRect& _orBorderAndShadowBoundRect,
- const bool bRightSidebar );
+ const bool bLeftShadow,
+ const bool bRightShadow,
+ const bool bRightSidebar
+ );
static void PaintNotesSidebar(const SwRect& _rPageRect, ViewShell* _pViewShell, sal_uInt16 nPageNum, bool bRight);
static void PaintNotesSidebarArrows(const Point &aMiddleFirst, const Point &aMiddleSecond, ViewShell* _pViewShell, const Color aColorUp, const Color aColorDown);
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index e19e086c8b47..e0b4cd7432dc 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1399,9 +1399,15 @@ sal_Bool SwLayAction::FormatLayout( SwLayoutFrm *pLay, sal_Bool bAddRect )
if ( pLay->GetPrev() && !pLay->GetPrev()->IsValid() )
pLay->GetPrev()->SetCompletePaint();
- SwRect aOldRect( pLay->Frm() );
+ SwRect aOldFrame( pLay->Frm() );
+ SwRect aOldRect( aOldFrame );
+ if( pLay->IsPageFrm() )
+ {
+ aOldRect = static_cast<SwPageFrm*>(pLay)->GetBoundRect();
+ }
+
pLay->Calc();
- if ( aOldRect != pLay->Frm() )
+ if ( aOldFrame != pLay->Frm() )
bChanged = sal_True;
sal_Bool bNoPaint = sal_False;
@@ -1424,30 +1430,7 @@ sal_Bool SwLayAction::FormatLayout( SwLayoutFrm *pLay, sal_Bool bAddRect )
if ( pLay->IsPageFrm() )
{
SwPageFrm* pPageFrm = static_cast<SwPageFrm*>(pLay);
- const int nShadowWidth =
- pImp->GetShell()->GetOut()->PixelToLogic( Size( pPageFrm->ShadowPxWidth(), 0 ) ).Width();
-
- //mod #i6193# added sidebar width
- const SwPostItMgr* pPostItMgr = pImp->GetShell()->GetPostItMgr();
- const int nSidebarWidth = pPostItMgr && pPostItMgr->HasNotes() && pPostItMgr->ShowNotes() ? pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth() : 0;
- switch ( pPageFrm->SidebarPosition() )
- {
- case sw::sidebarwindows::SIDEBAR_LEFT:
- {
- aPaint.Left( aPaint.Left() - nSidebarWidth);
- aPaint.Right( aPaint.Right() + nShadowWidth);
- }
- break;
- case sw::sidebarwindows::SIDEBAR_RIGHT:
- {
- aPaint.Right( aPaint.Right() + nShadowWidth + nSidebarWidth);
- }
- break;
- case sw::sidebarwindows::SIDEBAR_NONE:
- // nothing to do
- break;
- }
- aPaint.Bottom( aPaint.Bottom() + nShadowWidth );
+ aPaint = pPageFrm->GetBoundRect();
}
sal_Bool bPageInBrowseMode = pLay->IsPageFrm();
@@ -1499,38 +1482,50 @@ sal_Bool SwLayAction::FormatLayout( SwLayoutFrm *pLay, sal_Bool bAddRect )
const bool bLeftToRightViewLayout = pRoot->IsLeftToRightViewLayout();
const bool bPrev = bLeftToRightViewLayout ? pLay->GetPrev() : pLay->GetNext();
const bool bNext = bLeftToRightViewLayout ? pLay->GetNext() : pLay->GetPrev();
+ SwPageFrm* pPageFrm = static_cast<SwPageFrm*>(pLay);
+ const ViewShell *pSh = pLay->getRootFrm()->GetCurrShell();
+ SwRect aPageRect( pLay->Frm() );
+
+ if(pSh)
+ {
+ SwPageFrm::GetBorderAndShadowBoundRect(aPageRect, pSh,
+ aPageRect, pPageFrm->IsLeftShadowNeeded(), pPageFrm->IsRightShadowNeeded(),
+ pPageFrm->SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT);
+ }
if ( bPrev )
{
// top
- SwRect aSpaceToPrevPage( pLay->Frm() );
- const SwTwips nTop = aSpaceToPrevPage.Top() - nHalfDocBorder;
- if ( nTop >= 0 )
- aSpaceToPrevPage.Top( nTop );
+ SwRect aSpaceToPrevPage( aPageRect );
+ aSpaceToPrevPage.Top( aSpaceToPrevPage.Top() - nHalfDocBorder );
aSpaceToPrevPage.Bottom( pLay->Frm().Top() );
- pImp->GetShell()->AddPaintRect( aSpaceToPrevPage );
+ if(aSpaceToPrevPage.Height() > 0 && aSpaceToPrevPage.Width() > 0)
+ pImp->GetShell()->AddPaintRect( aSpaceToPrevPage );
+
+ pSh->GetOut()->DrawRect( aSpaceToPrevPage.SVRect() );
// left
- aSpaceToPrevPage = pLay->Frm();
- const SwTwips nLeft = aSpaceToPrevPage.Left() - nHalfDocBorder;
- if ( nLeft >= 0 )
- aSpaceToPrevPage.Left( nLeft );
+ aSpaceToPrevPage = aPageRect;
+ aSpaceToPrevPage.Left( aSpaceToPrevPage.Left() - nHalfDocBorder );
aSpaceToPrevPage.Right( pLay->Frm().Left() );
- pImp->GetShell()->AddPaintRect( aSpaceToPrevPage );
+ if(aSpaceToPrevPage.Height() > 0 && aSpaceToPrevPage.Width() > 0)
+ pImp->GetShell()->AddPaintRect( aSpaceToPrevPage );
}
if ( bNext )
{
// bottom
- SwRect aSpaceToNextPage( pLay->Frm() );
+ SwRect aSpaceToNextPage( aPageRect );
aSpaceToNextPage.Bottom( aSpaceToNextPage.Bottom() + nHalfDocBorder );
aSpaceToNextPage.Top( pLay->Frm().Bottom() );
- pImp->GetShell()->AddPaintRect( aSpaceToNextPage );
+ if(aSpaceToNextPage.Height() > 0 && aSpaceToNextPage.Width() > 0)
+ pImp->GetShell()->AddPaintRect( aSpaceToNextPage );
// right
- aSpaceToNextPage = pLay->Frm();
+ aSpaceToNextPage = aPageRect;
aSpaceToNextPage.Right( aSpaceToNextPage.Right() + nHalfDocBorder );
aSpaceToNextPage.Left( pLay->Frm().Right() );
- pImp->GetShell()->AddPaintRect( aSpaceToNextPage );
+ if(aSpaceToNextPage.Height() > 0 && aSpaceToNextPage.Width() > 0)
+ pImp->GetShell()->AddPaintRect( aSpaceToNextPage );
}
}
}
@@ -1585,12 +1580,14 @@ sal_Bool SwLayAction::FormatLayout( SwLayoutFrm *pLay, sal_Bool bAddRect )
// OD 11.11.2002 #104414# - add complete frame area as paint area, if frame
// area has been already added and after formating its lowers the frame area
// is enlarged.
+ SwRect aBoundRect(pLay->IsPageFrm() ? static_cast<SwPageFrm*>(pLay)->GetBoundRect() : pLay->Frm() );
+
if ( bAlreadyPainted &&
- ( pLay->Frm().Width() > aFrmAtCompletePaint.Width() ||
- pLay->Frm().Height() > aFrmAtCompletePaint.Height() )
+ ( aBoundRect.Width() > aFrmAtCompletePaint.Width() ||
+ aBoundRect.Height() > aFrmAtCompletePaint.Height() )
)
{
- pImp->GetShell()->AddPaintRect( pLay->Frm() );
+ pImp->GetShell()->AddPaintRect( aBoundRect );
}
return bChanged || bTabChanged;
}
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 948efb8452c5..aa7aa23e02c0 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -310,7 +310,7 @@ SwPageFrm::~SwPageFrm()
// including border and shadow area.
const bool bRightSidebar = (SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT);
SwRect aRetoucheRect;
- SwPageFrm::GetBorderAndShadowBoundRect( Frm(), pSh, aRetoucheRect, bRightSidebar );
+ SwPageFrm::GetBorderAndShadowBoundRect( Frm(), pSh, aRetoucheRect, IsLeftShadowNeeded(), IsRightShadowNeeded(), bRightSidebar );
pSh->AddPaintRect( aRetoucheRect );
}
}
@@ -674,7 +674,8 @@ void SwPageFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
// page frame for determine 'old' rectangle - it's used for invalidating.
const bool bRightSidebar = (SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT);
SwRect aOldRectWithBorderAndShadow;
- SwPageFrm::GetBorderAndShadowBoundRect( aOldPageFrmRect, pSh, aOldRectWithBorderAndShadow, bRightSidebar );
+ SwPageFrm::GetBorderAndShadowBoundRect( aOldPageFrmRect, pSh, aOldRectWithBorderAndShadow,
+ IsLeftShadowNeeded(), IsRightShadowNeeded(), bRightSidebar );
pSh->InvalidateWindows( aOldRectWithBorderAndShadow );
}
rInvFlags |= 0x03;
diff --git a/sw/source/core/layout/pagefrm.src b/sw/source/core/layout/pagefrm.src
index 83b80e4714f9..1c5cafc38c4d 100644
--- a/sw/source/core/layout/pagefrm.src
+++ b/sw/source/core/layout/pagefrm.src
@@ -1,17 +1,7 @@
#include "pagefrm.hrc"
-Bitmap BMP_PAGE_RIGHT_SHADOW_MASK
+Bitmap BMP_PAGE_SHADOW_MASK
{
- File = "page-right-shadow-mask.png";
-};
-
-Bitmap BMP_PAGE_BOTTOM_RIGHT_SHADOW_MASK
-{
- File = "page-bottomright-shadow-mask.png";
-};
-
-Bitmap BMP_PAGE_BOTTOM_SHADOW_MASK
-{
- File = "page-bottom-shadow-mask.png";
+ File = "page-shadow-mask.png";
};
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 82513c75d32c..8744151ef0e2 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -102,6 +102,7 @@
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
+#include <drawinglayer/primitive2d/discreteshadowprimitive2d.hxx>
#include <svx/sdr/contact/objectcontacttools.hxx>
#include <svx/unoapi.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
@@ -1037,7 +1038,7 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
// OD 29.04.2003 #107169# - correction: adjust rectangle on pixel level in order
// to assure, that the border 'leaves its original pixel', if it has to.
// No prior adjustments for odd relation between pixel and twip.
-void MA_FASTCALL SwAlignRect( SwRect &rRect, ViewShell *pSh )
+void MA_FASTCALL SwAlignRect( SwRect &rRect, const ViewShell *pSh )
{
if( !rRect.HasArea() )
return;
@@ -2838,8 +2839,6 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const
if ( bBookMode && pPage->GetPrev() && static_cast<const SwPageFrm*>(pPage->GetPrev())->IsEmptyPage() )
pPage = static_cast<const SwPageFrm*>(pPage->GetPrev());
- const bool bLTR = IsLeftToRightViewLayout();
-
// #i68597#
const bool bGridPainting(pSh->GetWin() && pSh->Imp()->HasDrawView() && pSh->Imp()->GetDrawView()->IsGridVisible());
@@ -2848,22 +2847,15 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const
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 bPaintRightShadow = pPage->IsRightShadowNeeded();
+ const bool bPaintLeftShadow = pPage->IsLeftShadowNeeded();
const bool bRightSidebar = pPage->SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT;
if ( !pPage->IsEmptyPage() )
{
SwRect aPaintRect;
- SwPageFrm::GetBorderAndShadowBoundRect( pPage->Frm(), pSh, aPaintRect, bRightSidebar );
+ SwPageFrm::GetBorderAndShadowBoundRect( pPage->Frm(), pSh, aPaintRect,
+ bPaintLeftShadow, bPaintRightShadow, bRightSidebar );
if ( aRect.IsOver( aPaintRect ) )
// <--
@@ -2963,7 +2955,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, bFullBottomShadow, bRightSidebar );
+ SwPageFrm::PaintBorderAndShadow( pPage->Frm(), pSh, bPaintLeftShadow, bPaintRightShadow, bRightSidebar );
SwPageFrm::PaintNotesSidebar( pPage->Frm(), pSh, pPage->GetPhyPageNum(), bRightSidebar);
}
@@ -3016,7 +3008,8 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const
const SwPageFrm& rFormatPage = pPage->GetFormatPage();
aEmptyPageRect.SSize() = rFormatPage.Frm().SSize();
- SwPageFrm::GetBorderAndShadowBoundRect( aEmptyPageRect, pSh, aPaintRect, bRightSidebar );
+ SwPageFrm::GetBorderAndShadowBoundRect( aEmptyPageRect, pSh, aPaintRect,
+ bPaintLeftShadow, bPaintRightShadow, bRightSidebar );
aPaintRect._Intersection( aRect );
if ( aRect.IsOver( aEmptyPageRect ) )
@@ -3055,7 +3048,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, bFullBottomShadow, bRightSidebar );
+ SwPageFrm::PaintBorderAndShadow( aEmptyPageRect, pSh, bPaintLeftShadow, bPaintRightShadow, bRightSidebar );
SwPageFrm::PaintNotesSidebar( aEmptyPageRect, pSh, pPage->GetPhyPageNum(), bRightSidebar);
{
@@ -5213,35 +5206,31 @@ void SwPageFrm::PaintMarginArea( const SwRect& _rOutputRect,
}
}
-const sal_Int8 SwPageFrm::mnShadowPxWidth = 10;
-
-/** determine rectangle for right page shadow
-
- OD 12.02.2003 for #i9719# and #105645#
+const sal_Int8 SwPageFrm::mnShadowPxWidth = 9;
- @author OD
-*/
-/*static*/ void SwPageFrm::GetRightShadowRect( const SwRect& _rPageRect,
- ViewShell* _pViewShell,
- SwRect& _orRightShadowRect,
- bool bRightSidebar )
+sal_Bool SwPageFrm::IsRightShadowNeeded() const
{
- SwRect aAlignedPageRect( _rPageRect );
- ::SwAlignRect( aAlignedPageRect, _pViewShell );
- SwRect aPagePxRect =
- _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() );
- const SwPostItMgr *pMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0;
+ const ViewShell *pSh = getRootFrm()->GetCurrShell();
+ const bool bIsLTR = getRootFrm()->IsLeftToRightViewLayout();
- _orRightShadowRect.Chg(
- Point( aPagePxRect.Right() + 1, aPagePxRect.Top() + mnShadowPxWidth + 1 ),
- Size( mnShadowPxWidth, aPagePxRect.Height() - mnShadowPxWidth - 1 ) );
+ // We paint the right shadow if we're not in book mode
+ // or if we've no sibling or are the last page of the "row"
+ return !pSh || (!pSh->GetViewOptions()->IsViewLayoutBookMode()) || !GetNext()
+ || (this == Lower()) || (bIsLTR && OnRightPage())
+ || (!bIsLTR && !OnRightPage());
- if (bRightSidebar && pMgr && pMgr->ShowNotes() && pMgr->HasNotes())
- {
- _orRightShadowRect.Pos(_orRightShadowRect.Left() + pMgr->GetSidebarWidth(true)
- + pMgr->GetSidebarBorderWidth(true), _orRightShadowRect.Top());
- }
+}
+sal_Bool SwPageFrm::IsLeftShadowNeeded() const
+{
+ const ViewShell *pSh = getRootFrm()->GetCurrShell();
+ const bool bIsLTR = getRootFrm()->IsLeftToRightViewLayout();
+
+ // We paint the left shadow if we're not in book mode
+ // or if we've no sibling or are the last page of the "row"
+ return !pSh || (!pSh->GetViewOptions()->IsViewLayoutBookMode()) || !GetPrev()
+ || (bIsLTR && !OnRightPage())
+ || (!bIsLTR && OnRightPage());
}
/** determine rectangle for bottom page shadow
@@ -5250,10 +5239,11 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10;
@author OD
*/
-/*static*/ void SwPageFrm::GetBottomShadowRect( const SwRect& _rPageRect,
- ViewShell* _pViewShell,
- SwRect& _orBottomShadowRect,
- bool bFullBottomShadow,
+/*static*/ void SwPageFrm::GetHorizontalShadowRect( const SwRect& _rPageRect,
+ const ViewShell* _pViewShell,
+ SwRect& _orHorizontalShadowRect,
+ bool bPaintLeftShadow,
+ bool bPaintRightShadow,
bool bRightSidebar )
{
const SwPostItMgr *pMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0;
@@ -5262,21 +5252,21 @@ 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);
+ long lShadowAdjustment = mnShadowPxWidth - 1; // TODO extract this
- _orBottomShadowRect.Chg(
- Point( aPagePxRect.Left() + lShadowAdjustment, aPagePxRect.Bottom() + 1 ),
- Size( aPagePxRect.Width() - lShadowAdjustment, mnShadowPxWidth ) );
+ _orHorizontalShadowRect.Chg(
+ Point( aPagePxRect.Left() + (bPaintLeftShadow ? lShadowAdjustment : 0), 0 ),
+ Size( aPagePxRect.Width() - ( (bPaintLeftShadow ? lShadowAdjustment : 0) + (bPaintRightShadow ? lShadowAdjustment : 0) ),
+ mnShadowPxWidth ) );
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 );
+ _orHorizontalShadowRect.Right( _orHorizontalShadowRect.Right() + aSidebarTotalWidth );
else
- _orBottomShadowRect.Left( _orBottomShadowRect.Left() - aSidebarTotalWidth );
+ _orHorizontalShadowRect.Left( _orHorizontalShadowRect.Left() - aSidebarTotalWidth );
}
}
@@ -5288,9 +5278,9 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10;
@author OD
*/
/*static*/ void SwPageFrm::PaintBorderAndShadow( const SwRect& _rPageRect,
- ViewShell* _pViewShell,
+ const ViewShell* _pViewShell,
+ bool bPaintLeftShadow,
bool bPaintRightShadow,
- bool bFullBottomShadow,
bool bRightSidebar )
{
// No shadow in prefs
@@ -5300,60 +5290,102 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10;
SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *_pViewShell->GetOut() );
// <--
+ static drawinglayer::primitive2d::DiscreteShadow shadowMask( SW_RES( BMP_PAGE_SHADOW_MASK ) );
static BitmapEx aPageTopRightShadow;
static BitmapEx aPageBottomRightShadow;
static BitmapEx aPageBottomLeftShadow;
static BitmapEx aPageBottomShadowBase;
static BitmapEx aPageRightShadowBase;
- static Color aShadowColor;
+ static BitmapEx aPageTopShadowBase;
+ static BitmapEx aPageTopLeftShadow;
+ static BitmapEx aPageLeftShadowBase;
+ static Color aShadowColor( COL_AUTO );
+
+ SwRect aAlignedPageRect( _rPageRect );
+ ::SwAlignRect( aAlignedPageRect, _pViewShell );
+ SwRect aPagePxRect =
+ _pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() );
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 );
+ AlphaMask aMask( shadowMask.getBottomRight().GetBitmap() );
+ Bitmap aFilledSquare( aMask.GetSizePixel(), 24 );
+ aFilledSquare.Erase( aShadowColor );
aPageBottomRightShadow = BitmapEx( aFilledSquare, aMask );
- aMask.Rotate( 900, 255 );
- aPageTopRightShadow = BitmapEx( aFilledSquare, aMask );
- aMask.Rotate( 1800, 255);
+
+ aMask = AlphaMask( shadowMask.getBottomLeft().GetBitmap() );
+ aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
+ aFilledSquare.Erase( aShadowColor );
aPageBottomLeftShadow = BitmapEx( aFilledSquare, aMask );
- aFilledSquare = Bitmap( Size( 1, mnShadowPxWidth ), 24 );
+ aMask = AlphaMask( shadowMask.getBottom().GetBitmap() );
+ aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
aFilledSquare.Erase( aShadowColor );
- aMask = Bitmap( SW_RES( BMP_PAGE_BOTTOM_SHADOW_MASK ) );
aPageBottomShadowBase = BitmapEx( aFilledSquare, aMask );
- aFilledSquare = Bitmap( Size( mnShadowPxWidth, 1 ), 24 );
+ aMask = AlphaMask( shadowMask.getTop().GetBitmap() );
+ aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
+ aFilledSquare.Erase( aShadowColor );
+ aPageTopShadowBase = BitmapEx( aFilledSquare, aMask );
+
+ aMask = AlphaMask( shadowMask.getTopRight().GetBitmap() );
+ aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
+ aFilledSquare.Erase( aShadowColor );
+ aPageTopRightShadow = BitmapEx( aFilledSquare, aMask );
+
+ aMask = AlphaMask( shadowMask.getRight().GetBitmap() );
+ aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
aFilledSquare.Erase( aShadowColor );
- aMask = Bitmap( SW_RES( BMP_PAGE_RIGHT_SHADOW_MASK ) );
aPageRightShadowBase = BitmapEx( aFilledSquare, aMask );
+
+ aMask = AlphaMask( shadowMask.getTopLeft().GetBitmap() );
+ aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
+ aFilledSquare.Erase( aShadowColor );
+ aPageTopLeftShadow = BitmapEx( aFilledSquare, aMask );
+
+ aMask = AlphaMask( shadowMask.getLeft().GetBitmap() );
+ aFilledSquare = Bitmap( aMask.GetSizePixel(), 24 );
+ aFilledSquare.Erase( aShadowColor );
+ aPageLeftShadowBase = BitmapEx( aFilledSquare, aMask );
}
SwRect aPaintRect;
OutputDevice *pOut = _pViewShell->GetOut();
- // paint right shadow
+ SwPageFrm::GetHorizontalShadowRect( _rPageRect, _pViewShell, aPaintRect, bPaintLeftShadow, bPaintRightShadow, bRightSidebar );
+
+ // Right shadow & corners
if ( bPaintRightShadow )
{
- SwPageFrm::GetRightShadowRect( _rPageRect, _pViewShell, aPaintRect, bRightSidebar );
+ pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Right() + 1, aPagePxRect.Bottom() + 1 - (aPageBottomRightShadow.GetSizePixel().Height() - mnShadowPxWidth) ) ),
+ aPageBottomRightShadow );
+ pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Right() + 1, aPagePxRect.Top() - mnShadowPxWidth ) ),
+ aPageTopRightShadow );
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 );
+ aPageRightShadow.Scale( 1, aPagePxRect.Height() - 2 * (mnShadowPxWidth - 1) );
+ pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Right() + mnShadowPxWidth, aPagePxRect.Top() + mnShadowPxWidth - 1) ), aPageRightShadow );
}
- // paint bottom shadow
- SwPageFrm::GetBottomShadowRect( _rPageRect, _pViewShell, aPaintRect, bFullBottomShadow, bRightSidebar );
- if(!bFullBottomShadow)
+ // Left shadows and corners
+ if(bPaintLeftShadow)
{
- pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Left() - mnShadowPxWidth, aPaintRect.Top() ) ), aPageBottomLeftShadow );
+ const long lLeft = aPaintRect.Left() - aPageBottomLeftShadow.GetSizePixel().Width();
+ pOut->DrawBitmapEx( pOut->PixelToLogic( Point( lLeft,
+ aPagePxRect.Bottom() + 1 + mnShadowPxWidth - aPageBottomLeftShadow.GetSizePixel().Height() ) ), aPageBottomLeftShadow );
+ pOut->DrawBitmapEx( pOut->PixelToLogic( Point( lLeft, aPagePxRect.Top() - mnShadowPxWidth ) ), aPageTopLeftShadow );
+ BitmapEx aPageLeftShadow = aPageLeftShadowBase;
+ aPageLeftShadow.Scale( 1, aPagePxRect.Height() - 2 * (mnShadowPxWidth - 1) );
+ pOut->DrawBitmapEx( pOut->PixelToLogic( Point( lLeft, aPagePxRect.Top() + mnShadowPxWidth - 1) ), aPageLeftShadow );
}
+
BitmapEx aPageBottomShadow = aPageBottomShadowBase;
aPageBottomShadow.Scale( aPaintRect.Width(), 1 );
- pOut->DrawBitmapEx( pOut->PixelToLogic( aPaintRect.Pos() ), aPageBottomShadow);
+ pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Left(), aPagePxRect.Bottom() + 1 ) ), aPageBottomShadow);
+ BitmapEx aPageTopShadow = aPageTopShadowBase;
+ aPageTopShadow.Scale( aPaintRect.Width(), 1 );
+ pOut->DrawBitmapEx( pOut->PixelToLogic( Point( aPaintRect.Left(), aPagePxRect.Top() - mnShadowPxWidth ) ), aPageTopShadow );
}
//mod #i6193# paint sidebar for notes
@@ -5480,28 +5512,47 @@ const sal_Int8 SwPageFrm::mnShadowPxWidth = 10;
author OD
*/
/*static*/ void SwPageFrm::GetBorderAndShadowBoundRect( const SwRect& _rPageRect,
- ViewShell* _pViewShell,
+ const ViewShell* _pViewShell,
SwRect& _orBorderAndShadowBoundRect,
- bool bRightSidebar )
+ bool bLeftShadow,
+ bool bRightShadow,
+ bool bRightSidebar
+ )
{
SwRect aAlignedPageRect( _rPageRect );
::SwAlignRect( aAlignedPageRect, _pViewShell );
SwRect aPagePxRect =
_pViewShell->GetOut()->LogicToPixel( aAlignedPageRect.SVRect() );
+ aPagePxRect.Bottom( aPagePxRect.Bottom() + mnShadowPxWidth + 1 );
+ aPagePxRect.Top( aPagePxRect.Top() - mnShadowPxWidth - 1 );
SwRect aTmpRect;
- SwPageFrm::GetRightShadowRect( _rPageRect, _pViewShell, aTmpRect, bRightSidebar );
- aPagePxRect.Right( aTmpRect.Right() );
+ // Always ask for full shadow since we want a bounding rect
+ // including at least the page frame
+ SwPageFrm::GetHorizontalShadowRect( _rPageRect, _pViewShell, aTmpRect, false, false, bRightSidebar );
- // Always ask for full shadow
- SwPageFrm::GetBottomShadowRect( _rPageRect, _pViewShell, aTmpRect, true, bRightSidebar );
- aPagePxRect.Bottom( aTmpRect.Bottom() );
- aPagePxRect.Left( aTmpRect.Left() );
+ if(bLeftShadow) aPagePxRect.Left( aTmpRect.Left() - mnShadowPxWidth - 1);
+ if(bRightShadow) aPagePxRect.Right( aTmpRect.Right() + mnShadowPxWidth + 1);
_orBorderAndShadowBoundRect = _pViewShell->GetOut()->PixelToLogic( aPagePxRect.SVRect() );
}
+SwRect SwPageFrm::GetBoundRect() const
+{
+ const ViewShell *pSh = getRootFrm()->GetCurrShell();
+ SwRect aPageRect( Frm() );
+ SwRect aResult;
+
+ if(!pSh) {
+ return SwRect( Point(0, 0), Size(0, 0) );
+ }
+
+ SwPageFrm::GetBorderAndShadowBoundRect( aPageRect, pSh, aResult,
+ IsLeftShadowNeeded(), IsRightShadowNeeded(), SidebarPosition() == sw::sidebarwindows::SIDEBAR_RIGHT );
+ return aResult;
+}
+
/*static*/ void SwPageFrm::AddSidebarBorders(SwRect &aRect, ViewShell* _pViewShell, bool bRightSidebar, bool bPx)
{
const SwPostItMgr *pMgr = _pViewShell ? _pViewShell->GetPostItMgr() : 0;
diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx
index eae56dde8d50..fc24047a0b91 100644
--- a/sw/source/core/view/pagepreviewlayout.cxx
+++ b/sw/source/core/view/pagepreviewlayout.cxx
@@ -1073,7 +1073,8 @@ bool SwPagePreviewLayout::Paint( const Rectangle _aOutRect ) const
// #i80691# paint page border and shadow
{
SwRect aPageBorderRect;
- SwPageFrm::GetBorderAndShadowBoundRect( SwRect( aPageRect ), &mrParentViewShell, aPageBorderRect, true );
+ SwPageFrm::GetBorderAndShadowBoundRect( SwRect( aPageRect ), &mrParentViewShell, aPageBorderRect,
+ (*aPageIter)->pPage->IsLeftShadowNeeded(), (*aPageIter)->pPage->IsRightShadowNeeded(), true );
const Region aDLRegion(aPageBorderRect.SVRect());
mrParentViewShell.DLPrePaint2(aDLRegion);
SwPageFrm::PaintBorderAndShadow( aPageRect, &mrParentViewShell, true, false, true );
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 96cef3170ece..c3ca3f655ae1 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -190,17 +190,17 @@ void SwViewImp::SetFirstVisPage()
const bool bBookMode = pSwViewOption->IsViewLayoutBookMode();
SwPageFrm *pPage = (SwPageFrm*)pSh->GetLayout()->Lower();
- SwRect aPageRect = pPage->Frm();
+ SwRect aPageRect = pPage->GetBoundRect();
while ( pPage && !aPageRect.IsOver( pSh->VisArea() ) )
{
pPage = (SwPageFrm*)pPage->GetNext();
if ( pPage )
{
- aPageRect = pPage->Frm();
+ aPageRect = pPage->GetBoundRect();
if ( bBookMode && pPage->IsEmptyPage() )
{
const SwPageFrm& rFormatPage = pPage->GetFormatPage();
- aPageRect.SSize() = rFormatPage.Frm().SSize();
+ aPageRect.SSize() = rFormatPage.GetBoundRect().SSize();
}
}
}
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index fba37f34809d..797ed01a3287 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -991,45 +991,29 @@ void ViewShell::VisPortChgd( const SwRect &rRect)
SwTwips nMinLeft = LONG_MAX;
SwTwips nMaxRight= 0;
- const SwTwips nSidebarWidth = pPostItMgr && pPostItMgr->ShowNotes() && pPostItMgr->HasNotes() ?
- pPostItMgr->GetSidebarWidth() + pPostItMgr->GetSidebarBorderWidth() :
- 0;
const bool bBookMode = GetViewOptions()->IsViewLayoutBookMode();
while ( pPage && pPage->Frm().Top() <= nBottom )
{
- SwRect aPageRect( pPage->Frm() );
+ SwRect aPageRect( pPage->GetBoundRect() );
if ( bBookMode )
{
const SwPageFrm& rFormatPage = static_cast<const SwPageFrm*>(pPage)->GetFormatPage();
- aPageRect.SSize() = rFormatPage.Frm().SSize();
+ aPageRect.SSize() = rFormatPage.GetBoundRect().SSize();
}
if ( aPageRect.IsOver( aBoth ) )
{
- const SwTwips nShadowWidth =
- GetOut()->PixelToLogic( Size( pPage->ShadowPxWidth(), 0 ) ).Width();
-
SwTwips nPageLeft = 0;
SwTwips nPageRight = 0;
- switch ( pPage->SidebarPosition() )
+ const sw::sidebarwindows::SidebarPosition aSidebarPos = pPage->SidebarPosition();
+
+ if( aSidebarPos != sw::sidebarwindows::SIDEBAR_NONE )
{
- case sw::sidebarwindows::SIDEBAR_LEFT:
- {
- nPageLeft = aPageRect.Left() - nSidebarWidth;
- nPageRight = aPageRect.Right() + nShadowWidth;
- }
- break;
- case sw::sidebarwindows::SIDEBAR_RIGHT:
- {
- nPageLeft = aPageRect.Left();
- nPageRight = aPageRect.Right() + nShadowWidth + nSidebarWidth;
- }
- break;
- case sw::sidebarwindows::SIDEBAR_NONE:
- // nothing to do
- break;
+ nPageLeft = aPageRect.Left();
+ nPageRight = aPageRect.Right();
}
+
if( nPageLeft < nMinLeft )
nMinLeft = nPageLeft;
if( nPageRight > nMaxRight )
diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx
index f584b0476565..632d5c183e08 100644
--- a/sw/source/filter/basflt/fltini.cxx
+++ b/sw/source/filter/basflt/fltini.cxx
@@ -822,11 +822,11 @@ extern "C" { static void SAL_CALL thisModule() {} }
static oslGenericFunction GetMswordLibSymbol( const char *pSymbol )
{
static ::osl::Module aModule;
- static sal_Bool bLoaded = sal_False;
+ static sal_Bool bLoaded = sal_False;
static ::rtl::OUString aLibName( RTL_CONSTASCII_USTRINGPARAM( SVLIBRARY( "msword" ) ) );
- if (!bLoaded)
- bLoaded = SvLibrary::LoadModule( aModule, aLibName, &thisModule );
- if (bLoaded)
+ if (!bLoaded)
+ bLoaded = SvLibrary::LoadModule( aModule, aLibName, &thisModule, SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY );
+ if (bLoaded)
return aModule.getFunctionSymbol( ::rtl::OUString::createFromAscii( pSymbol ) );
return NULL;
}
diff --git a/sw/source/ui/dialog/swabstdlg.cxx b/sw/source/ui/dialog/swabstdlg.cxx
index 1f97f9ddf717..2a3dedd83028 100644
--- a/sw/source/ui/dialog/swabstdlg.cxx
+++ b/sw/source/ui/dialog/swabstdlg.cxx
@@ -44,7 +44,8 @@ SwAbstractDialogFactory* SwAbstractDialogFactory::Create()
SwFuncPtrCreateDialogFactory fp = 0;
static ::osl::Module aDialogLibrary;
static const ::rtl::OUString sLibName(::vcl::unohelper::CreateLibraryName("swui", sal_True));
- if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, String( sLibName ) ) )
+ if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, String( sLibName ),
+ SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY ) )
fp = ( SwAbstractDialogFactory* (__LOADONCALLAPI*)() )
aDialogLibrary.getFunctionSymbol( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CreateDialogFactory")));
if ( fp )