[Libreoffice-commits] core.git: 2 commits - sc/source

Markus Mohrhard markus.mohrhard at googlemail.com
Sun Mar 10 07:59:18 PDT 2013


 sc/source/ui/drawfunc/fusel.cxx  |   28 ++++++++++++++++++++++++----
 sc/source/ui/drawfunc/futext.cxx |   37 ++++++++++++++++++++++++++-----------
 2 files changed, 50 insertions(+), 15 deletions(-)

New commits:
commit ecfe151546e3c0bcea71c949b9fa35a327d71969
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Mar 10 14:48:37 2013 +0100

    changing the note handling was an error, fdo#55430
    
    Change-Id: I1c18f33af2a1199fd9c5e54c0b0c4b52702ca0f6

diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx
index 61fdf0a..02d086a 100644
--- a/sc/source/ui/drawfunc/futext.cxx
+++ b/sc/source/ui/drawfunc/futext.cxx
@@ -135,10 +135,6 @@ sal_Bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
         if( !IsSizingOrMovingNote(rMEvt) )
         {
             StopEditMode();            // Danebengeklickt, Ende mit Edit
-            pView->UnmarkAll();
-            bStraightEnter = false;
-            ScViewData& rViewData = *pViewShell->GetViewData();
-            rViewData.GetDispatcher().Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
         }
         pView->SetCreateMode();
     }
commit e5e2405bbb81fe8700a11b015784649e29f8fe7f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Mar 10 14:46:05 2013 +0100

    reverts d2157548221e28d8f702cc81991f7aef198b523e

diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx
index 4968f15..a3568b0 100644
--- a/sc/source/ui/drawfunc/fusel.cxx
+++ b/sc/source/ui/drawfunc/fusel.cxx
@@ -53,6 +53,8 @@
 //  Maximal erlaubte Mausbewegung um noch Drag&Drop zu starten
 //! fusel,fuconstr,futext - zusammenfassen!
 #define SC_MAXDRAGMOVE  3
+// Min necessary mouse motion for normal dragging
+#define SC_MINDRAGMOVE 2
 
 // -----------------------------------------------------------------------
 
@@ -381,11 +383,14 @@ sal_Bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
     sal_Bool bReturn = FuDraw::MouseButtonUp(rMEvt);
     sal_Bool bOle = pViewShell->GetViewFrame()->GetFrame().IsInPlace();
 
+    SdrObject* pObj = NULL;
+    SdrPageView* pPV = NULL;
     if (aDragTimer.IsActive() )
     {
         aDragTimer.Stop();
     }
 
+    sal_uInt16 nDrgLog = sal_uInt16 ( pWindow->PixelToLogic(Size(SC_MINDRAGMOVE,0)).Width() );
     Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
 
     bool bCopy = false;
@@ -416,7 +421,7 @@ sal_Bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
                     for ( sal_uLong i = 0; i < nMarkCount; ++i )
                     {
                         SdrMark* pMark = rSdrMarkList.GetMark( i );
-                        SdrObject* pObj = ( pMark ? pMark->GetMarkedSdrObj() : NULL );
+                        pObj = ( pMark ? pMark->GetMarkedSdrObj() : NULL );
                         if ( pObj )
                         {
                             ScChartHelper::AddRangesIfProtectedChart( aProtectedChartRangesVector, pDocument, pObj );
@@ -426,6 +431,21 @@ sal_Bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
                 bCopy = true;
             }
 
+            if (!rMEvt.IsShift() && !rMEvt.IsMod1() && !rMEvt.IsMod2() &&
+                Abs(aPnt.X() - aMDPos.X()) < nDrgLog &&
+                Abs(aPnt.Y() - aMDPos.Y()) < nDrgLog)
+            {
+                /*************************************************************
+                * If a user wants to click on an object in front of a marked
+                * one, he releases the mouse button immediately
+                **************************************************************/
+                if (pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_BEFOREMARK))
+                {
+                    pView->UnmarkAllObj();
+                    pView->MarkObj(pObj,pPV,false,false);
+                    return (sal_True);
+                }
+            }
             pView->EndDragObj( rMEvt.IsMod1() );
             pView->ForceMarkedToAnotherPage();
 
@@ -433,7 +453,7 @@ sal_Bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
             if (rMarkList.GetMarkCount() == 1)
             {
                   SdrMark* pMark = rMarkList.GetMark(0);
-                  SdrObject* pObj = pMark->GetMarkedSdrObj();
+                  pObj = pMark->GetMarkedSdrObj();
                   FuPoor* pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr();
                   FuText* pText = static_cast<FuText*>(pPoor);
                 pText->StopDragMode(pObj );
@@ -458,7 +478,7 @@ sal_Bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
                     bool bFound = false;
                     for( sal_uLong nIdx = 0; !bFound && (nIdx < nCount); ++nIdx )
                     {
-                        SdrObject* pObj = rMarkList.GetMark( nIdx )->GetMarkedSdrObj();
+                        pObj = rMarkList.GetMark( nIdx )->GetMarkedSdrObj();
                         bFound = ScDrawLayer::IsNoteCaption( pObj );
                         if( bFound )
                         {
@@ -494,7 +514,7 @@ sal_Bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
             if (rMarkList.GetMarkCount() == 1)
             {
                 SdrMark* pMark = rMarkList.GetMark(0);
-                SdrObject* pObj = pMark->GetMarkedSdrObj();
+                pObj = pMark->GetMarkedSdrObj();
 
                 //  aktivieren nur, wenn die Maus auch (noch) ueber dem
                 //  selektierten Objekt steht
diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx
index 71e4561..61fdf0a 100644
--- a/sc/source/ui/drawfunc/futext.cxx
+++ b/sc/source/ui/drawfunc/futext.cxx
@@ -125,6 +125,7 @@ sal_Bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
 {
     // remember button state for creation of own MouseEvents
     SetMouseButtonCode(rMEvt.GetButtons());
+    sal_Bool bStraightEnter = true;
 
     if ( pView->MouseButtonDown(rMEvt, pWindow) )
         return (sal_True);                 // Event von der SdrView ausgewertet
@@ -132,7 +133,13 @@ sal_Bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
     if ( pView->IsTextEdit() )
     {
         if( !IsSizingOrMovingNote(rMEvt) )
+        {
             StopEditMode();            // Danebengeklickt, Ende mit Edit
+            pView->UnmarkAll();
+            bStraightEnter = false;
+            ScViewData& rViewData = *pViewShell->GetViewData();
+            rViewData.GetDispatcher().Execute(aSfxRequest.GetSlot(), SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
+        }
         pView->SetCreateMode();
     }
 
@@ -301,18 +308,30 @@ sal_Bool FuText::MouseButtonDown(const MouseEvent& rMEvt)
                 }
                 else
                 {
-                    /**********************************************************
-                    * Objekt erzeugen
-                    **********************************************************/
-                    // Hack  to align object to nearest grid position where object
-                    // would be anchored ( if it were cell anchored )
-                    // Get grid offset for current position ( note: aPnt is
-                    // also adjusted )
-                    Point aGridOff = CurrentGridSyncOffsetAndPos( aMDPos );
-
-                    bool bRet = pView->BegCreateObj(aMDPos, (OutputDevice*) NULL);
-                    if ( bRet )
+                    if (bStraightEnter)//Hack for that silly idea that creating text fields is inside the text routine
+                    {
+                        /**********************************************************
+                        * Objekt erzeugen
+                        **********************************************************/
+                        // Hack  to align object to nearest grid position where object
+                        // would be anchored ( if it were cell anchored )
+                        // Get grid offset for current position ( note: aPnt is
+                        // also adjusted )
+                        Point aGridOff = CurrentGridSyncOffsetAndPos( aMDPos );
+
+                        bool bRet = pView->BegCreateObj(aMDPos, (OutputDevice*) NULL);
+                        if ( bRet )
                         pView->GetCreateObj()->SetGridOffset( aGridOff );
+                    }
+                    else if (pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER | SDRSEARCH_BEFOREMARK))
+                    {
+                        pView->UnmarkAllObj();
+                        pView->MarkObj(pObj,pPV,false,false);
+
+                        pHdl=pView->PickHandle(aMDPos);
+                        pView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl);
+                        return(sal_True);
+                    }
                 }
             }
         }


More information about the Libreoffice-commits mailing list