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

Miklos Vajna vmiklos at collabora.co.uk
Tue Mar 3 06:06:35 PST 2015


 sw/source/uibase/docvw/edtwin.cxx |   40 +++++++++++++++++++++++++-------------
 1 file changed, 27 insertions(+), 13 deletions(-)

New commits:
commit 2e59b848cb956a365b1b1829a6e80609e46236e6
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Mar 3 12:09:04 2015 +0100

    SwEditWin: disable map mode in LogicMouseButtonUp/Down
    
    This partially reverts commit 3d4c1b9dcebaeefaf70dd9191f0573f050297d11
    (Initial SwEditWin::LogicMouseButtonDown/Up, 2015-01-21), which tried to
    catch all pixel -> logic conversions in SwEditWin::MouseButtonDown().
    The problem is that it doesn't really scale, we can't do the same for
    drawinglayer as well.
    
    Instead, simply disable the map mode in the Logic...() methods as we
    already do in Impress, which doesn't have a single central
    LogicMouseButtonDown/Up method, so there we had to use mapmode disabling
    from day 0 for tiled editing.
    
    Change-Id: I72be546400f5db10ac6d09a9bb10f7f0658942a5

diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 08105b9..4a45b73 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -2817,7 +2817,6 @@ void SwEditWin::MoveCursor( SwWrtShell &rSh, const Point aDocPos,
 void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
 {
     SwWrtShell &rSh = m_rView.GetWrtShell();
-    bool bTiledRendering = rSh.isTiledRendering();
     const SwField *pCrsrFld = rSh.CrsrInsideInputFld() ? rSh.GetCurFld( true ) : NULL;
 
     // We have to check if a context menu is shown and we have an UI
@@ -2834,7 +2833,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
 
     MouseEvent rMEvt(_rMEvt);
 
-    if (!bTiledRendering && m_rView.GetPostItMgr()->IsHit(rMEvt.GetPosPixel()))
+    if (m_rView.GetPostItMgr()->IsHit(rMEvt.GetPosPixel()))
         return;
 
     m_rView.GetPostItMgr()->SetActiveSidebarWin(0);
@@ -2853,11 +2852,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
     m_bWasShdwCrsr = 0 != m_pShadCrsr;
     delete m_pShadCrsr, m_pShadCrsr = 0;
 
-    Point aDocPos;
-    if (bTiledRendering)
-        aDocPos = rMEvt.GetPosPixel();
-    else
-        aDocPos = PixelToLogic( rMEvt.GetPosPixel() );
+    const Point aDocPos( PixelToLogic( rMEvt.GetPosPixel() ) );
 
     // How many clicks do we need to select a fly frame?
     FrameControlType eControl;
@@ -2979,7 +2974,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
     SET_CURR_SHELL( &rSh );
 
     SdrView *pSdrView = rSh.GetDrawView();
-    if ( pSdrView && !bTiledRendering)
+    if ( pSdrView )
     {
         if (pSdrView->MouseButtonDown( rMEvt, this ) )
         {
@@ -3028,7 +3023,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
             m_rView.InvalidateRulerPos();
             SfxBindings& rBind = m_rView.GetViewFrame()->GetBindings();
             rBind.Update();
-            if ( !bTiledRendering && RulerColumnDrag( rMEvt,
+            if ( RulerColumnDrag( rMEvt,
                     (SwTab::COL_VERT == nMouseTabCol || SwTab::ROW_HORI == nMouseTabCol)) )
             {
                 m_rView.SetTabColFromDoc( false );
@@ -3052,7 +3047,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
         SfxBindings& rBind = m_rView.GetViewFrame()->GetBindings();
         rBind.Update();
 
-        if ( !bTiledRendering && RulerMarginDrag( rMEvt,
+        if ( RulerMarginDrag( rMEvt,
                         rSh.IsVerticalModeAtNdAndPos( *pNodeAtPos, aDocPos ) ) )
         {
             m_rView.SetNumRuleNodeFromDoc( NULL );
@@ -3108,7 +3103,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
                         return;
                     }
                 }
-                if ( !bTiledRendering && EnterDrawMode( rMEvt, aDocPos ) )
+                if ( EnterDrawMode( rMEvt, aDocPos ) )
                 {
                     bNoInterrupt = false;
                     return;
@@ -3183,7 +3178,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
                     SwEditWin::m_nDDStartPosX = aDocPos.X();
 
                     // hit an URL in DrawText object?
-                    if (bExecHyperlinks && pSdrView && !bTiledRendering)
+                    if (bExecHyperlinks && pSdrView)
                     {
                         SdrViewEvent aVEvt;
                         pSdrView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
@@ -3756,7 +3751,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
         }
     }
 
-    if (bCallBase && !bTiledRendering)
+    if (bCallBase)
         Window::MouseButtonDown(rMEvt);
 }
 
@@ -6250,13 +6245,32 @@ void SwEditWin::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
 {
     // When we're not doing tiled rendering, then positions must be passed as pixels.
     assert(m_rView.GetWrtShell().isTiledRendering());
+
+    bool bMap = IsMapModeEnabled();
+    EnableMapMode(false);
+    Point aPoint = GetPointerPosPixel();
+    SetLastMousePos(rMouseEvent.GetPosPixel());
+
     MouseButtonDown(rMouseEvent);
+
+    SetPointerPosPixel(aPoint);
+    EnableMapMode(bMap);
 }
 
 void SwEditWin::LogicMouseButtonUp(const MouseEvent& rMouseEvent)
 {
+    // When we're not doing tiled rendering, then positions must be passed as pixels.
     assert(m_rView.GetWrtShell().isTiledRendering());
+
+    bool bMap = IsMapModeEnabled();
+    EnableMapMode(false);
+    Point aPoint = GetPointerPosPixel();
+    SetLastMousePos(rMouseEvent.GetPosPixel());
+
     MouseButtonUp(rMouseEvent);
+
+    SetPointerPosPixel(aPoint);
+    EnableMapMode(bMap);
 }
 
 void SwEditWin::SetCursorLogicPosition(const Point& rPosition, bool bPoint, bool bClearMark)


More information about the Libreoffice-commits mailing list