summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-03-20 12:37:26 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-03-23 09:19:06 +0100
commitf9c9f57e6901ce6a55a153962d0852324d9cadcf (patch)
tree3faea933f2fa974671a7f1141b70bd4fc7127882
parent355f1199fdd552cfd4fa167b345f37649ae76d80 (diff)
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
-rw-r--r--sc/source/ui/view/gridwin4.cxx13
-rw-r--r--sd/source/ui/view/sdwindow.cxx13
-rw-r--r--vcl/source/window/paint.cxx16
3 files changed, 18 insertions, 24 deletions
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 630a0c8e2680..cf72fc3aacc8 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 8a79750c3173..727eca96c6ec 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 4d47decb9a74..7180d79a2af0 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);
}
}