From bdfd7ed115a6f543c9c5d665e191f28e1421ae16 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Wed, 5 Sep 2007 16:40:16 +0000 Subject: INTEGRATION: CWS impress130_SRC680 (1.17.102); FILE MERGED 2007/09/04 13:33:52 af 1.17.102.2: #i81212# Added missing includes. 2007/09/04 13:26:51 af 1.17.102.1: #i81212# In ShouldPaintObject() the paint rectangle is enlarged by one pixel to counter rounding errors. --- svx/source/sdr/contact/viewcontactofsdrobj.cxx | 44 +++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'svx') diff --git a/svx/source/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx index 2fccbef22b63..e334cf40401b 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx @@ -4,9 +4,9 @@ * * $RCSfile: viewcontactofsdrobj.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: hr $ $Date: 2007-06-27 18:46:04 $ + * last change: $Author: kz $ $Date: 2007-09-05 17:40:16 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -76,6 +76,18 @@ #include #endif +#ifndef _SDR_CONTACT_OBJECTCONTACTOFPAGEVIEW_HXX +#include +#endif + +#ifndef _SDRPAGEWINDOW_HXX +#include +#endif + +#ifndef _SDRPAINTWINDOW_HXX +#include +#endif + ////////////////////////////////////////////////////////////////////////////// namespace sdr @@ -204,7 +216,7 @@ namespace sdr // When ShouldPaintObject() returns sal_True, the object itself is painted and // PaintObject() is called. - sal_Bool ViewContactOfSdrObj::ShouldPaintObject(DisplayInfo& rDisplayInfo, const ViewObjectContact& /*rAssociatedVOC*/) + sal_Bool ViewContactOfSdrObj::ShouldPaintObject(DisplayInfo& rDisplayInfo, const ViewObjectContact& rAssociatedVOC) { // Test layer visibility if(!rDisplayInfo.GetProcessLayers().IsSet(GetSdrObject().GetLayer())) @@ -214,8 +226,30 @@ namespace sdr // Test area visibility const Region& rRedrawArea = rDisplayInfo.GetRedrawArea(); - - if(!rRedrawArea.IsEmpty() && !rRedrawArea.IsOver(GetPaintRectangle())) + // Before we can test whether the paint rectangle has an + // intersection with the redraw area we enlarge the paint + // rectangle by the equivalent in logical coordinates of one + // pixel. This takes care of rounding errors in VCL of the + // redraw area (#i81212#). (The redraw area is the one which + // should be enlarged but it may consist of more than one + // rectangle and enlarging the paint rectangle leads to the same + // result). This can be considered a hack. Not because its + // there but because it is here. It belongs to VCL where + // internally the redraw rectangles are transformed into pixels + // and back again. + Rectangle aPaintRectangle (GetPaintRectangle()); + ObjectContactOfPageView* pObjectContact + = dynamic_cast(&rAssociatedVOC.GetObjectContact()); + if (pObjectContact != NULL) + { + OutputDevice& rDevice = pObjectContact->GetPageWindow().GetPaintWindow().GetOutputDevice(); + Size aOnePixel (rDevice.PixelToLogic(Size(1,1))); + aPaintRectangle.Left() -= aOnePixel.Width(); + aPaintRectangle.Right() += aOnePixel.Width(); + aPaintRectangle.Top() -= aOnePixel.Height(); + aPaintRectangle.Bottom() += aOnePixel.Height(); + } + if(!rRedrawArea.IsEmpty() && !rRedrawArea.IsOver(aPaintRectangle)) { return sal_False; } -- cgit