summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-03-20 17:35:17 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-03-23 09:19:07 +0100
commit7b8a59807806dbf6ec759a836c873b435e09e907 (patch)
treef221c5bc1830cc3237e857cf01b4073bff2e6773 /sd
parent35cf00e20ad5826f715f5d5bbc48d486228774ca (diff)
sd: when tiled rendering, disable map mode early
This brings sd in sync with sw, that does the same for some time already. With this, we no longer do a complete repaint 6 times after every postMouseEvent(). Change-Id: I38754f4bdbb977abbdbb0f32e1460ab2f6290f87
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx11
-rw-r--r--sd/source/ui/view/sdwindow.cxx23
-rw-r--r--sd/source/ui/view/viewshe2.cxx6
-rw-r--r--sd/source/ui/view/viewshel.cxx6
4 files changed, 30 insertions, 16 deletions
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 207079166330..ac41220fd747 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -90,6 +90,7 @@
#include "ClientView.hxx"
#include "DrawViewShell.hxx"
#include "ViewShell.hxx"
+#include "Window.hxx"
#include "app.hrc"
#include <vcl/pdfextoutdevdata.hxx>
#include <com/sun/star/presentation/AnimationEffect.hpp>
@@ -2359,6 +2360,16 @@ void SdXImpressDocument::initializeForTiledRendering()
mpDocShell->GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_VIEWSHELL0, SfxCallMode::SYNCHRON | SfxCallMode::RECORD);
mpDoc->setTiledRendering(true);
+
+ // Disable map mode, so that it's possible to send mouse event coordinates
+ // in logic units.
+ if (DrawViewShell* pViewShell = GetViewShell())
+ {
+ if (sd::Window* pWindow = pViewShell->GetActiveWindow())
+ {
+ pWindow->EnableMapMode(false);
+ }
+ }
}
void SdXImpressDocument::registerCallback(LibreOfficeKitCallback pCallback, void* pData)
diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx
index 20e3086feedb..1268596c7042 100644
--- a/sd/source/ui/view/sdwindow.cxx
+++ b/sd/source/ui/view/sdwindow.cxx
@@ -324,10 +324,13 @@ long Window::SetZoomFactor(long nZoom)
nZoom = mnMinZoom;
// Set the zoom factor at the window's map mode.
- MapMode aMap(GetMapMode());
- aMap.SetScaleX(Fraction(nZoom, 100));
- aMap.SetScaleY(Fraction(nZoom, 100));
- SetMapMode(aMap);
+ if (!mpViewShell || !mpViewShell->GetDoc()->isTiledRendering())
+ {
+ MapMode aMap(GetMapMode());
+ aMap.SetScaleX(Fraction(nZoom, 100));
+ aMap.SetScaleY(Fraction(nZoom, 100));
+ SetMapMode(aMap);
+ }
// invalidate previous size - it was relative to the old scaling
maPrevSize = Size(-1,-1);
@@ -559,7 +562,8 @@ void Window::UpdateMapOrigin(bool bInvalidate)
maPrevSize = aWinSize;
- if (bChanged && bInvalidate)
+ // When tiled rendering, the above UpdateMapMode() call doesn't touch the map mode.
+ if (bChanged && bInvalidate && (!mpViewShell || !mpViewShell->GetDoc()->isTiledRendering()))
Invalidate();
}
@@ -599,9 +603,12 @@ void Window::UpdateMapMode (void)
Point aNewOrigin (-maWinPos.X(), -maWinPos.Y());
maWinPos += maViewOrigin;
- MapMode aMap(GetMapMode());
- aMap.SetOrigin(aNewOrigin);
- SetMapMode(aMap);
+ if (!mpViewShell || !mpViewShell->GetDoc()->isTiledRendering())
+ {
+ MapMode aMap(GetMapMode());
+ aMap.SetOrigin(aNewOrigin);
+ SetMapMode(aMap);
+ }
}
/**
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index 71d26c58ddb9..f6d25df97e1e 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -392,8 +392,10 @@ void ViewShell::SetZoomRect(const Rectangle& rZoomRect)
mpContentWindow->SetWinViewPos(aNewPos);
mpContentWindow->UpdateMapOrigin();
- // #i74769# see above
- mpContentWindow->Invalidate(INVALIDATE_CHILDREN);
+ // When tiled rendering, UpdateMapOrigin() doesn't touch the map mode.
+ if (!GetDoc()->isTiledRendering())
+ // #i74769# see above
+ mpContentWindow->Invalidate(INVALIDATE_CHILDREN);
}
Size aVisSizePixel = GetActiveWindow()->GetOutputSizePixel();
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 1fe42c761b6e..ce01af2ac0f5 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -510,15 +510,12 @@ void ViewShell::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(GetDoc()->isTiledRendering());
- bool bMap = mpActiveWindow->IsMapModeEnabled();
- mpActiveWindow->EnableMapMode(false);
Point aPoint = mpActiveWindow->GetPointerPosPixel();
mpActiveWindow->SetLastMousePos(rMouseEvent.GetPosPixel());
MouseButtonDown(rMouseEvent, 0);
mpActiveWindow->SetPointerPosPixel(aPoint);
- mpActiveWindow->EnableMapMode(bMap);
}
void ViewShell::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
@@ -526,15 +523,12 @@ void ViewShell::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
// When we're not doing tiled rendering, then positions must be passed as pixels.
assert(GetDoc()->isTiledRendering());
- bool bMap = mpActiveWindow->IsMapModeEnabled();
- mpActiveWindow->EnableMapMode(false);
Point aPoint = mpActiveWindow->GetPointerPosPixel();
mpActiveWindow->SetPointerPosPixel(rMouseEvent.GetPosPixel());
MouseButtonUp(rMouseEvent, 0);
mpActiveWindow->SetPointerPosPixel(aPoint);
- mpActiveWindow->EnableMapMode(bMap);
}
void ViewShell::MouseMove(const MouseEvent& rMEvt, ::sd::Window* pWin)