sc/source/ui/view/gridwin4.cxx | 13 +------------ sd/source/ui/view/sdwindow.cxx | 13 +------------ vcl/source/window/paint.cxx | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 24 deletions(-)
New commits: commit 0ff8b2c4340356cb0699dc0f22ea6cf5f06df934 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Mar 20 12:37:26 2015 +0100 OutputDevice::LogicInvalidate: clean up sc/sd duplication Writer is not affected, as there the map mode is disabled and everything is in twips internally. Change-Id: I3b5289f82e89be5943a0b14a5167b33132cf78d0 diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 630a0c8..cf72fc3 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -984,18 +984,7 @@ void ScGridWindow::LogicInvalidate(const ::vcl::Region* pRegion) if (!pRegion) sRectangle = "EMPTY"; else - { - Rectangle aRectangle = pRegion->GetBoundRect(); - if (GetMapMode().GetMapUnit() == MAP_100TH_MM) - { - // Conversion to twips is necessary. - aRectangle.Left() = convertMm100ToTwip(aRectangle.Left()); - aRectangle.Top() = convertMm100ToTwip(aRectangle.Top()); - aRectangle.Right() = convertMm100ToTwip(aRectangle.Right()); - aRectangle.Bottom() = convertMm100ToTwip(aRectangle.Bottom()); - } - sRectangle = aRectangle.toString(); - } + sRectangle = pRegion->GetBoundRect().toString(); pViewData->GetDocument()->GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); } diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index 8a79750..727eca9 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -996,18 +996,7 @@ void Window::LogicInvalidate(const ::vcl::Region* pRegion) if (!pRegion) sRectangle = "EMPTY"; else - { - Rectangle aRectangle = pRegion->GetBoundRect(); - if (GetMapMode().GetMapUnit() == MAP_100TH_MM) - { - // Conversion to twips is necessary. - aRectangle.Left() = convertMm100ToTwip(aRectangle.Left()); - aRectangle.Top() = convertMm100ToTwip(aRectangle.Top()); - aRectangle.Right() = convertMm100ToTwip(aRectangle.Right()); - aRectangle.Bottom() = convertMm100ToTwip(aRectangle.Bottom()); - } - sRectangle = aRectangle.toString(); - } + sRectangle = pRegion->GetBoundRect().toString(); mpViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); } diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index 4d47dec..7180d79 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -859,6 +859,20 @@ void Window::Invalidate( sal_uInt16 nFlags ) LogicInvalidate(0); } +/// Converts rRegion from MM100 to twips based on the map mode of rWindow. +void lcl_toTwips(Window& rWindow, vcl::Region& rRegion) +{ + if (rWindow.IsMapModeEnabled() && rWindow.GetMapMode().GetMapUnit() == MAP_100TH_MM) + { + Rectangle aRectangle = rRegion.GetBoundRect(); + aRectangle.Left() = convertMm100ToTwip(aRectangle.Left()); + aRectangle.Top() = convertMm100ToTwip(aRectangle.Top()); + aRectangle.Right() = convertMm100ToTwip(aRectangle.Right()); + aRectangle.Bottom() = convertMm100ToTwip(aRectangle.Bottom()); + rRegion = aRectangle; + } +} + void Window::Invalidate( const Rectangle& rRect, sal_uInt16 nFlags ) { @@ -872,6 +886,7 @@ void Window::Invalidate( const Rectangle& rRect, sal_uInt16 nFlags ) vcl::Region aRegion( aRect ); ImplInvalidate( &aRegion, nFlags ); vcl::Region aLogicRegion(rRect); + lcl_toTwips(*this, aLogicRegion); LogicInvalidate(&aLogicRegion); } } @@ -894,6 +909,7 @@ void Window::Invalidate( const vcl::Region& rRegion, sal_uInt16 nFlags ) { ImplInvalidate( &aRegion, nFlags ); vcl::Region aLogicRegion(rRegion); + lcl_toTwips(*this, aLogicRegion); LogicInvalidate(&aLogicRegion); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits