diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-12-06 22:59:40 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-12-07 14:46:07 +0100 |
commit | 689cead9e0837dc932e3a4cd765f7d319b529018 (patch) | |
tree | cd6cdcd77f017ef1e60ec11556617da5b1c39721 /sw | |
parent | b346439637b7d03a3eb1d6e67dfb585b357567f4 (diff) |
tdf#91260 svx, sw: don't paint off-page part of drawing object
Since commit a4dee94afed9ade6ac50237c8d99a6e49d3bebc1 Writer no
longer forces drawing objects to be entirely on one page. However since
there is only one SdrPage for the entire document, a drawing object
dangleing off the bottom of one page will be painted again on the next
page, which is clearly undesirable since Word doesn't do that
(and it also destroys the nice invariant that a fly on page N never
overlaps a fly on page N+1).
So force the SdrPageView code to ignore the drawing object on the next
page, by passing in the area of the page frame so that
ViewObjectContactOfSdrObj::isPrimitiveVisible() can verify that the
anchor position of the SdrObject is actually on the painted page.
This requires passing in another parameter; in the usual case the
DisplayInfo::maRedrawArea already contains the page frame since
commit 8af09bf33291df2fb2bfbbd6e42f9bf074fcc4fc, but there are special
cases in SwFrame::Retouch() and SwFlyFrameFormat::MakeGraphic() where
some sub-area is passed in, which cannot be used to check the anchor.
Change-Id: Ia0476216ca41dbdaa3de1063fa18cb94fe2e5ae8
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/inc/viewimp.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/layout/paintfrm.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/view/vdraw.cxx | 8 |
3 files changed, 16 insertions, 7 deletions
diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx index 465a68fada6b..87b7b24fc708 100644 --- a/sw/source/core/inc/viewimp.hxx +++ b/sw/source/core/inc/viewimp.hxx @@ -169,6 +169,7 @@ public: */ void PaintLayer( const SdrLayerID _nLayerID, SwPrintData const*const pPrintData, + SwPageFrame const& rPageFrame, const SwRect& _rRect, const Color* _pPageBackgrdColor, const bool _bIsPageRightToLeft = false, diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 34f2f2dc6e98..90cfe6975309 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -3357,7 +3357,7 @@ void SwRootFrame::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, const IDocumentDrawModelAccess& rIDDMA = pSh->getIDocumentDrawModelAccess(); pSh->Imp()->PaintLayer( rIDDMA.GetHellId(), pPrintData, - pPage->Frame(), + *pPage, pPage->Frame(), &aPageBackgrdColor, pPage->IsRightToLeft(), &aSwRedirector ); @@ -3404,7 +3404,7 @@ void SwRootFrame::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, // OD 09.12.2002 #103045# - add 4th parameter for horizontal text direction. pSh->Imp()->PaintLayer( pSh->GetDoc()->getIDocumentDrawModelAccess().GetHeavenId(), pPrintData, - pPage->Frame(), + *pPage, pPage->Frame(), &aPageBackgrdColor, pPage->IsRightToLeft(), &aSwRedirector ); @@ -7414,11 +7414,11 @@ void SwFrame::Retouch( const SwPageFrame * pPage, const SwRect &rRect ) const // <-- pSh->Imp()->PaintLayer( rIDDMA.GetHellId(), nullptr, - rRetouche, &aPageBackgrdColor, + *pPage, rRetouche, &aPageBackgrdColor, pPage->IsRightToLeft(), &aSwRedirector ); pSh->Imp()->PaintLayer( rIDDMA.GetHeavenId(), nullptr, - rRetouche, &aPageBackgrdColor, + *pPage, rRetouche, &aPageBackgrdColor, pPage->IsRightToLeft(), &aSwRedirector ); } @@ -7702,7 +7702,8 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap ) // --> OD #i76669# SwViewObjectContactRedirector aSwRedirector( *pSh ); // <-- - pImp->PaintLayer( rIDDMA.GetHellId(), nullptr, aOut, &aPageBackgrdColor, + pImp->PaintLayer( rIDDMA.GetHellId(), nullptr, + *pFlyPage, aOut, &aPageBackgrdColor, pFlyPage->IsRightToLeft(), &aSwRedirector ); gProp.pSLines->PaintLines( pDev, gProp ); @@ -7710,7 +7711,8 @@ Graphic SwFlyFrameFormat::MakeGraphic( ImageMap* pMap ) pFly->Paint( *pDev, aOut ); gProp.pSLines->PaintLines( pDev, gProp ); // OD 30.08.2002 #102450# - add 3rd parameter - pImp->PaintLayer( rIDDMA.GetHeavenId(), nullptr, aOut, &aPageBackgrdColor, + pImp->PaintLayer( rIDDMA.GetHeavenId(), nullptr, + *pFlyPage, aOut, &aPageBackgrdColor, pFlyPage->IsRightToLeft(), &aSwRedirector ); gProp.pSLines->PaintLines( pDev, gProp ); diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx index 2f20aeb33dca..eb4ad0772eca 100644 --- a/sw/source/core/view/vdraw.cxx +++ b/sw/source/core/view/vdraw.cxx @@ -40,6 +40,9 @@ #include "flyfrm.hxx" #include <vcl/svapp.hxx> #include <vcl/settings.hxx> +#include <vcl/canvastools.hxx> + +#include <basegfx/range/b2irectangle.hxx> #include <IDocumentDrawModelAccess.hxx> @@ -84,6 +87,7 @@ void SwViewShellImp::UnlockPaint() void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID, SwPrintData const*const pPrintData, + SwPageFrame const& rPageFrame, const SwRect& aPaintRect, const Color* _pPageBackgrdColor, const bool _bIsPageRightToLeft, @@ -137,7 +141,9 @@ void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID, SdrView &rSdrView = const_cast< SdrView & >(GetPageView()->GetView()); rSdrView.setHideDraw( !pPrintData->IsPrintDraw() ); } - GetPageView()->DrawLayer( _nLayerID, pOutDev, pRedirector, aPaintRect.SVRect() ); + basegfx::B2IRectangle const pageFrame( + vcl::unotools::b2IRectangleFromRectangle(rPageFrame.Frame().SVRect())); + GetPageView()->DrawLayer(_nLayerID, pOutDev, pRedirector, aPaintRect.SVRect(), &pageFrame); pOutDev->Pop(); // reset background color of the outliner & default horiz. text dir. |