diff options
-rw-r--r-- | sw/inc/dcontact.hxx | 5 | ||||
-rw-r--r-- | sw/inc/viewsh.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/draw/dcontact.cxx | 57 | ||||
-rw-r--r-- | sw/source/core/draw/dflyobj.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/layout/paintfrm.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/view/pagepreviewlayout.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/view/scrrect.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 46 | ||||
-rw-r--r-- | sw/source/ui/docvw/srcedtw.cxx | 4 |
9 files changed, 97 insertions, 38 deletions
diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx index 3bb2fb4f49c0..be39d837e97b 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -383,6 +383,11 @@ class SwDrawVirtObj : public SdrVirtObj // FullDrag support virtual bool supportsFullDrag() const; virtual SdrObject* getFullDragClone() const; + + // #i97197# + virtual void SetBoundRectDirty(); + virtual const Rectangle& GetCurrentBoundRect() const; + virtual const Rectangle& GetLastBoundRect() const; }; // OD 26.06.2003 #108784# diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 6a7918a414b3..060bcb2a9e3d 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -250,7 +250,7 @@ protected: public: void PrePaint(); void DLPrePaint2(const Region& rRegion); - void DLPostPaint2(); + void DLPostPaint2(bool bPaintFormLayer); const MapMode& getPrePostMapMode() const { return maPrePostMapMode; } ////////////////////////////////////////////////////////////////////////////// diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 05f384156500..cb3119d81c04 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -2393,12 +2393,6 @@ SwDrawVirtObj::SwDrawVirtObj( SdrObject& _rNewObj, SwDrawVirtObj::~SwDrawVirtObj() {} -const Point SwDrawVirtObj::GetOffset() const -{ - return GetLastBoundRect().TopLeft() - - GetReferencedObj().GetLastBoundRect().TopLeft(); -} - void SwDrawVirtObj::operator=( const SdrObject& rObj ) { SdrVirtObj::operator=(rObj); @@ -2511,6 +2505,44 @@ void SwDrawVirtObj::NbcSetAnchorPos(const Point& rPnt) SdrObject::NbcSetAnchorPos( rPnt ); } +////////////////////////////////////////////////////////////////////////////// +// #i97197# +// the methods relevant for positioning + +const Rectangle& SwDrawVirtObj::GetCurrentBoundRect() const +{ + if(aOutRect.IsEmpty()) + { + const_cast<SwDrawVirtObj*>(this)->RecalcBoundRect(); + } + + return aOutRect; +} + +const Rectangle& SwDrawVirtObj::GetLastBoundRect() const +{ + return aOutRect; +} + +const Point SwDrawVirtObj::GetOffset() const +{ + // do NOT use IsEmpty() here, there is already a useful offset + // in the position + if(aOutRect == Rectangle()) + { + return Point(); + } + else + { + return aOutRect.TopLeft() - GetReferencedObj().GetCurrentBoundRect().TopLeft(); + } +} + +void SwDrawVirtObj::SetBoundRectDirty() +{ + // do nothing to not lose model information in aOutRect +} + void SwDrawVirtObj::RecalcBoundRect() { // OD 2004-04-05 #i26791# - switch order of calling <GetOffset()> and @@ -2519,17 +2551,12 @@ void SwDrawVirtObj::RecalcBoundRect() //aOutRect = rRefObj.GetCurrentBoundRect(); //aOutRect += GetOffset(); - if(ReferencedObj().GetCurrentBoundRect().IsEmpty()) - { - aOutRect = Rectangle(); - } - else - { - const Point aOffset(GetOffset()); - aOutRect = ReferencedObj().GetCurrentBoundRect() + aOffset; - } + const Point aOffset(GetOffset()); + aOutRect = ReferencedObj().GetCurrentBoundRect() + aOffset; } +////////////////////////////////////////////////////////////////////////////// + SdrObject* SwDrawVirtObj::CheckHit(const Point& rPnt, USHORT nTol, const SetOfByte* pVisiLayer) const { Point aPnt(rPnt - GetOffset()); diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index d98d5cea0b8e..768cae90ce0a 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -202,6 +202,10 @@ namespace drawinglayer private: const SwVirtFlyDrawObj& mrSwVirtFlyDrawObj; + protected: + // method which is to be used to implement the local decomposition of a 2D primitive + virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + public: SwVirtFlyDrawObjPrimitive(const SwVirtFlyDrawObj& rSwVirtFlyDrawObj) : BasePrimitive2D(), @@ -215,9 +219,6 @@ namespace drawinglayer // get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; - // getDecomposition - virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; - // provide unique ID DeclPrimitrive2DIDBlock() }; @@ -248,7 +249,7 @@ namespace drawinglayer return basegfx::B2DRange(rSnapRect.Left(), rSnapRect.Top(), rSnapRect.Right(), rSnapRect.Bottom()); } - Primitive2DSequence SwVirtFlyDrawObjPrimitive::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const + Primitive2DSequence SwVirtFlyDrawObjPrimitive::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const { // This is the callback to keep the FlyFrame painting in SW alive as long as it // is not changed to primitives. This is the method which will be called by the processors @@ -258,7 +259,7 @@ namespace drawinglayer mrSwVirtFlyDrawObj.wrap_DoPaintObject(); // call parent - return BasePrimitive2D::get2DDecomposition(rViewInformation); + return BasePrimitive2D::createLocalDecomposition(rViewInformation); } // provide unique ID diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 7f681df6127e..dececa60560e 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -2998,7 +2998,7 @@ void SwRootFrm::Paint( const SwRect& rRect ) const // #i68597# // moved paint post-process for DrawingLayer overlay here, see above { - pSh->DLPostPaint2(); + pSh->DLPostPaint2(true); } } } @@ -3055,7 +3055,7 @@ void SwRootFrm::Paint( const SwRect& rRect ) const SwPageFrm::PaintNotesSidebar( aEmptyPageRect, pSh, pPage->GetPhyPageNum(), bRightSidebar); { - pSh->DLPostPaint2(); + pSh->DLPostPaint2(true); } } } @@ -6692,7 +6692,7 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap ) ::SetOutDevAndWin( pSh, pOld, pWin, nZoom ); // #i92711# end Pre/PostPaint encapsulation when pOut is back and content is painted - pSh->DLPostPaint2(); + pSh->DLPostPaint2(true); aMet.Stop(); aMet.Move( -pFly->Frm().Left(), -pFly->Frm().Top() ); diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index b6a092550369..5d967c6d5ef5 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -1176,7 +1176,7 @@ bool SwPagePreviewLayout::Paint( const Rectangle _aOutRect ) const const Region aDLRegion(aPageBorderRect.SVRect()); mrParentViewShell.DLPrePaint2(aDLRegion); SwPageFrm::PaintBorderAndShadow( aPageRect, &mrParentViewShell, true, true ); - mrParentViewShell.DLPostPaint2(); + mrParentViewShell.DLPostPaint2(true); } // <-- } diff --git a/sw/source/core/view/scrrect.cxx b/sw/source/core/view/scrrect.cxx index 665e41ff7cda..f70bb1a52470 100644 --- a/sw/source/core/view/scrrect.cxx +++ b/sw/source/core/view/scrrect.cxx @@ -830,7 +830,7 @@ void SwViewImp::_RefreshScrolledArea( const SwRect &rRect ) delete pVout; // #i72754# end Pre/PostPaint encapsulation when pOut is back and content is painted - GetShell()->DLPostPaint2(); + GetShell()->DLPostPaint2(true); } // <-- diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 4b27fad5b60d..3849a3ee1f84 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -159,7 +159,7 @@ void ViewShell::DLPrePaint2(const Region& rRegion) mnPrePostPaintCount++; } -void ViewShell::DLPostPaint2() +void ViewShell::DLPostPaint2(bool bPaintFormLayer) { OSL_ENSURE(mnPrePostPaintCount > 0L, "ViewShell::DLPostPaint2: Pre/PostPaint encapsulation broken (!)"); mnPrePostPaintCount--; @@ -173,7 +173,7 @@ void ViewShell::DLPostPaint2() } // #i74769# use SdrPaintWindow now direct - Imp()->GetDrawView()->EndDrawLayers(*mpTargetPaintWindow); + Imp()->GetDrawView()->EndDrawLayers(*mpTargetPaintWindow, bPaintFormLayer); mpTargetPaintWindow = 0; } } @@ -356,7 +356,7 @@ void ViewShell::ImplEndAction( const BOOL bIdleEnd ) pOut = pOld; // #i72754# end Pre/PostPaint encapsulation when pOut is back and content is painted - DLPostPaint2(); + DLPostPaint2(true); } } if ( bPaint ) @@ -374,7 +374,7 @@ void ViewShell::ImplEndAction( const BOOL bIdleEnd ) pLayout->Paint( aRect ); // #i75172# end DrawingLayer paint - DLPostPaint2(); + DLPostPaint2(true); } } @@ -485,7 +485,7 @@ void ViewShell::ImplUnlockPaint( BOOL bVirDev ) VisArea().Pos(), aSize, *pVout ); // #i72754# end Pre/PostPaint encapsulation when pOut is back and content is painted - DLPostPaint2(); + DLPostPaint2(true); } else { @@ -1427,7 +1427,7 @@ BOOL ViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect ) ViewShell::bLstAct = FALSE; // end paint and destroy ObjectContact again - DLPostPaint2(); + DLPostPaint2(true); pDrawView->DeleteWindowFromPaintView(pVout); // temporary debug paint checking... @@ -1568,7 +1568,7 @@ BOOL ViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect ) pVout->EnableMapMode(bMapModeWasEnabledSource); // end paint on logoc base - DLPostPaint2(); + DLPostPaint2(true); } else { @@ -1595,7 +1595,7 @@ BOOL ViewShell::SmoothScroll( long lXDiff, long lYDiff, const Rectangle *pRect ) // #i75172# Corret repaint end // Note: This also correcty creates the overlay, thus smooth scroll will // also be allowed now wth selection (see big IF above) - DLPostPaint2(); + DLPostPaint2(true); } } else @@ -1723,6 +1723,32 @@ void ViewShell::_PaintDesktop( const SwRegionRects &rRegion ) { const Rectangle aRectangle(rRegion[i].SVRect()); + // #i93170# + // Here we have a real Problem. On the one hand we have the buffering for paint + // and overlay which needs an embracing pair of DLPrePaint2/DLPostPaint2 calls, + // on the other hand the MapMode is not set correctly when this code is executed. + // This is done in the users of this method, for each SWpage before painting it. + // Since the MapMode is not correct here, the call to DLPostPaint2 will paint + // existing FormControls due to the current MapMode. + // + // There are basically three solutions for this: + // + // (1) Set the MapMode correct, move the background painting to the users of + // this code + // + // (2) Do no DLPrePaint2/DLPostPaint2 here; no SdrObjects are allowed to lie in + // the desktop region. Disadvantage: the desktop will not be part of the + // buffers, e.g. overlay. Thus, as soon as overlay will be used over the + // desktop, it will not work. + // + // (3) expand DLPostPaint2 with a flag to signal if FormControl paints shall + // be done or not + // + // Currently, (3) will be the best possible solution. It will keep overlay and + // buffering intact and work without MapMode for single pages. In the medium + // to long run, (1) will need to be used and the bool bPaintFormLayer needs + // to be removed again + // #i68597# inform Drawinglayer about display change DLPrePaint2(Region(aRectangle)); @@ -1732,7 +1758,7 @@ void ViewShell::_PaintDesktop( const SwRegionRects &rRegion ) GetOut()->SetLineColor(); GetOut()->DrawRect(aRectangle); - DLPostPaint2(); + DLPostPaint2(false); } GetOut()->Pop(); @@ -1993,7 +2019,7 @@ void ViewShell::Paint(const Rectangle &rRect) pOut->Pop(); // #i68597# - DLPostPaint2(); + DLPostPaint2(true); } } } diff --git a/sw/source/ui/docvw/srcedtw.cxx b/sw/source/ui/docvw/srcedtw.cxx index 9385d5a0ba6e..4780bfbcd007 100644 --- a/sw/source/ui/docvw/srcedtw.cxx +++ b/sw/source/ui/docvw/srcedtw.cxx @@ -191,8 +191,8 @@ static void lcl_Highlight(const String& rSource, SwTextPortions& aPortionList) { //was war das denn? #if OSL_DEBUG_LEVEL > 1 - DBG_ERROR("Token nicht erkannt!") - DBG_ERROR(ByteString(sToken, gsl_getSystemTextEncoding()).GetBuffer()) + DBG_ERROR("Token nicht erkannt!"); + DBG_ERROR(ByteString(sToken, gsl_getSystemTextEncoding()).GetBuffer()); #endif } |