[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - editeng/source sd/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Mar 20 10:47:08 PDT 2015


 editeng/source/editeng/impedit.cxx |    2 +-
 sd/source/ui/unoidl/unomodel.cxx   |   11 +++++++++++
 sd/source/ui/view/sdwindow.cxx     |   23 +++++++++++++++--------
 sd/source/ui/view/viewshe2.cxx     |    6 ++++--
 sd/source/ui/view/viewshel.cxx     |    6 ------
 5 files changed, 31 insertions(+), 17 deletions(-)

New commits:
commit c9aa10bc6398e620ae56194a76ebb19bc3e0cc64
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Mar 20 17:35:17 2015 +0100

    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

diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 046a24f..87beaed 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -922,7 +922,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor, sal_uInt16
             Rectangle aRect(rPos.getX(), rPos.getY(), rPos.getX() + GetCursor()->GetWidth(), rPos.getY() + GetCursor()->GetHeight());
 
             // LOK output is always in twips, convert from mm100 if necessary.
-            if (pOutWin->IsMapModeEnabled() && pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM)
+            if (pOutWin->GetMapMode().GetMapUnit() == MAP_100TH_MM)
                 aRect = OutputDevice::LogicToLogic(aRect, MAP_100TH_MM, MAP_TWIP);
             // Let the LOK client decide the cursor width.
             aRect.setWidth(0);
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index d1781c5..7e6bd7b 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>
@@ -2357,6 +2358,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 20e3086..1268596 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 71d26c5..f6d25df 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 1fe42c7..ce01af2 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)


More information about the Libreoffice-commits mailing list