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

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Tue Mar 10 00:03:44 PDT 2015


 sc/source/ui/inc/gridwin.hxx   |    2 +-
 sc/source/ui/view/gridwin.cxx  |   10 +++-------
 sc/source/ui/view/gridwin4.cxx |    4 ++--
 sc/source/ui/view/gridwin5.cxx |   36 +++++++++++++++++++-----------------
 4 files changed, 25 insertions(+), 27 deletions(-)

New commits:
commit a099abe9ffd5e90b7cb4d488e25df4fce3099a48
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Tue Mar 10 12:02:43 2015 +0900

    GridWindow: change pNoteMarker to unique_ptr
    
    Change-Id: I1e141632172f53ddbd2f5f434206646c9a1e9cf0

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index a30afe2..ac158bf 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -134,7 +134,7 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou
     ScHSplitPos             eHWhich;
     ScVSplitPos             eVWhich;
 
-    ScNoteMarker*           pNoteMarker;
+    std::unique_ptr<ScNoteMarker> mpNoteMarker;
 
     std::unique_ptr<ScFilterListBox> mpFilterBox;
     std::unique_ptr<FloatingWindow> mpFilterFloat;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 4e87cd1..290c649 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -439,7 +439,7 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos
             mpAutoFillRect(static_cast<Rectangle*>(NULL)),
             pViewData( pData ),
             eWhich( eWhichPos ),
-            pNoteMarker( NULL ),
+            mpNoteMarker(),
             mpFilterBox(),
             mpFilterFloat(),
             mpAutoFilterPopup(),
@@ -519,10 +519,6 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos
 
 ScGridWindow::~ScGridWindow()
 {
-    // #114409#
-    ImpDestroyOverlayObjects();
-
-    delete pNoteMarker;
 }
 
 void ScGridWindow::ClickExtern()
@@ -2458,7 +2454,7 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt )
 {
     aCurMousePos = rMEvt.GetPosPixel();
 
-    if ( rMEvt.IsLeaveWindow() && pNoteMarker && !pNoteMarker->IsByKeyboard() )
+    if (rMEvt.IsLeaveWindow() && mpNoteMarker && !mpNoteMarker->IsByKeyboard())
         HideNoteMarker();
 
     ScModule* pScMod = SC_MOD();
@@ -3312,7 +3308,7 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt)
         }
         //  query for existing note marker before calling ViewShell's keyboard handling
         //  which may remove the marker
-        bool bHadKeyMarker = ( pNoteMarker && pNoteMarker->IsByKeyboard() );
+        bool bHadKeyMarker = mpNoteMarker && mpNoteMarker->IsByKeyboard();
         ScTabViewShell* pViewSh = pViewData->GetViewShell();
 
         if (pViewData->GetDocShell()->GetProgress())
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index dc747e6..74ac908 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -903,8 +903,8 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
     else
         rDevice.SetMapMode(aDrawMode);
 
-    if ( pNoteMarker )
-        pNoteMarker->Draw();        // ueber den Cursor, im Drawing-MapMode
+    if (mpNoteMarker)
+        mpNoteMarker->Draw(); // ueber den Cursor, im Drawing-MapMode
 }
 
 void ScGridWindow::PaintTile( VirtualDevice& rDevice,
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 531127b..249312f 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -168,23 +168,23 @@ bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, bool bKeyboard )
     {
         bool bNew = true;
         bool bFast = false;
-        if ( pNoteMarker )          // schon eine Notiz angezeigt
+        if (mpNoteMarker) // schon eine Notiz angezeigt
         {
-            if ( pNoteMarker->GetDocPos() == aCellPos ) // dieselbe
-                bNew = false;                           // dann stehenlassen
+            if (mpNoteMarker->GetDocPos() == aCellPos)
+                bNew = false; // dann stehenlassen
             else
-                bFast = true;                           // sonst sofort
+                bFast = true; // sonst sofort
 
             //  marker which was shown for ctrl-F1 isn't removed by mouse events
-            if ( pNoteMarker->IsByKeyboard() && !bKeyboard )
+            if (mpNoteMarker->IsByKeyboard() && !bKeyboard)
                 bNew = false;
         }
-        if ( bNew )
+        if (bNew)
         {
-            if ( bKeyboard )
-                bFast = true;           // keyboard also shows the marker immediately
+            if (bKeyboard)
+                bFast = true; // keyboard also shows the marker immediately
 
-            delete pNoteMarker;
+            mpNoteMarker.reset();
 
             bool bHSplit = pViewData->GetHSplitMode() != SC_SPLIT_NONE;
             bool bVSplit = pViewData->GetVSplitMode() != SC_SPLIT_NONE;
@@ -206,9 +206,9 @@ bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, bool bKeyboard )
                 aOrigin.Y() += aLeftSize.Height();
             aMapMode.SetOrigin( aOrigin );
 
-            pNoteMarker = new ScNoteMarker(  pLeft, pRight, pBottom, pDiagonal,
-                                            pDoc, aCellPos, aTrackText,
-                                            aMapMode, bLeftEdge, bFast, bKeyboard );
+            mpNoteMarker.reset(new ScNoteMarker(pLeft, pRight, pBottom, pDiagonal,
+                                                pDoc, aCellPos, aTrackText,
+                                                aMapMode, bLeftEdge, bFast, bKeyboard));
             if ( pViewData->GetScDrawView() )
             {
                 // get position for aCellPos
@@ -226,7 +226,7 @@ bool ScGridWindow::ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, bool bKeyboard )
                 // the mouse over the cell when the sheet are RTL
                 if ( pDoc->IsNegativePage(nTab))
                     aGridOff.setX(aCurPosHmm.getX() + aOldPos.getX());
-                pNoteMarker->SetGridOff( aGridOff );
+                mpNoteMarker->SetGridOff( aGridOff );
             }
         }
 
@@ -276,14 +276,16 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt)
         }
     }
 
-    if ( !bDone && pNoteMarker )
+    if (!bDone && mpNoteMarker)
     {
-        if ( pNoteMarker->IsByKeyboard() )
+        if (mpNoteMarker->IsByKeyboard())
         {
             //  marker which was shown for ctrl-F1 isn't removed by mouse events
         }
         else
-            DELETEZ(pNoteMarker);
+        {
+            mpNoteMarker.reset();
+        }
     }
 
     //  Image-Map / Text-URL
@@ -445,7 +447,7 @@ bool ScGridWindow::IsMyModel(SdrEditView* pSdrView)
 
 void ScGridWindow::HideNoteMarker()
 {
-    DELETEZ(pNoteMarker);
+    mpNoteMarker.reset();
 }
 
 com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >


More information about the Libreoffice-commits mailing list