[Libreoffice-commits] .: sd/source

Katarina Machalkova bubli at kemper.freedesktop.org
Thu Apr 28 02:36:41 PDT 2011


 sd/source/ui/inc/zoomlist.hxx  |   11 ++--
 sd/source/ui/view/zoomlist.cxx |  106 +++--------------------------------------
 2 files changed, 16 insertions(+), 101 deletions(-)

New commits:
commit e5dcd6dbfa49694b81e35ca7d08c9f1dfb71ae38
Author: Rafael Dominguez <venccsralph at gmail.com>
Date:   Fri Mar 25 17:09:11 2011 -0430

    Remove deprecated container List in ZoomList.

diff --git a/sd/source/ui/inc/zoomlist.hxx b/sd/source/ui/inc/zoomlist.hxx
index fcea8ac..73a9284 100644
--- a/sd/source/ui/inc/zoomlist.hxx
+++ b/sd/source/ui/inc/zoomlist.hxx
@@ -29,20 +29,19 @@
 #ifndef SD_ZOOM_LIST_HXX
 #define SD_ZOOM_LIST_HXX
 
+#include <vector>
 
 #include <tools/gen.hxx>
-#include <tools/list.hxx>
-
 
 namespace sd {
 
 class ViewShell;
 
-class ZoomList : public List
+class ZoomList
 {
 public:
+
     ZoomList(ViewShell* pViewShell);
-    virtual ~ZoomList();
 
     void		InsertZoomRect(const Rectangle& rRect);
     Rectangle	GetNextZoomRect();
@@ -52,7 +51,9 @@ public:
 
 private:
     ViewShell*	mpViewShell;
-    sal_uLong		mnCurPos;
+    sal_uLong   mnCurPos;
+
+    std::vector<Rectangle> maRectangles;
 };
 
 } // end of namespace sd
diff --git a/sd/source/ui/view/zoomlist.cxx b/sd/source/ui/view/zoomlist.cxx
index d570beb..80b670c 100644
--- a/sd/source/ui/view/zoomlist.cxx
+++ b/sd/source/ui/view/zoomlist.cxx
@@ -36,159 +36,73 @@
 #include <sfx2/viewfrm.hxx>
 #include <sfx2/viewsh.hxx>
 
-
 #include "ViewShell.hxx"
 
 namespace sd {
 
 #define MAX_ENTRYS	10
 
-/*************************************************************************
-|*
-|* Constructor
-|*
-\************************************************************************/
-
 ZoomList::ZoomList(ViewShell* pViewShell)
-: List()
-, mpViewShell (pViewShell)
+: mpViewShell (pViewShell)
 , mnCurPos(0)
 {
 }
 
-
-/*************************************************************************
-|*
-|* Destructor
-|*
-\************************************************************************/
-
-ZoomList::~ZoomList()
-{
-#if ( defined GCC && defined C272 )
-    for (sal_uLong nObject=0; nObject<List::Count(); nObject++)
-#else
-    for (sal_uLong nObject=0; nObject<Count(); nObject++)
-#endif
-    {
-        // delete ZoomRects if necessary
-        delete ((Rectangle*) GetObject(nObject));
-    }
-}
-
-
-/*************************************************************************
-|*
-|* Insert new ZoomRect
-|*
-\************************************************************************/
-
 void ZoomList::InsertZoomRect(const Rectangle& rRect)
 {
-    sal_uLong nRectCount = Count();
+    sal_uLong nRectCount = maRectangles.size();
 
     if (nRectCount >= MAX_ENTRYS)
-    {
-        delete ((Rectangle*) GetObject(0));
-        Remove((sal_uLong) 0);
-    }
+        maRectangles.erase(maRectangles.begin());
     else if (nRectCount == 0)
-    {
         mnCurPos = 0;
-    }
     else
-    {
         mnCurPos++;
-    }
 
-    Rectangle* pRect = new Rectangle(rRect);
-    Insert(pRect, mnCurPos);
+    maRectangles.insert(maRectangles.begin()+mnCurPos,rRect);
 
     SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
     rBindings.Invalidate( SID_ZOOM_NEXT );
     rBindings.Invalidate( SID_ZOOM_PREV );
 }
 
-/*************************************************************************
-|*
-|* Return next ZoomRect
-|*
-\************************************************************************/
-
 Rectangle ZoomList::GetNextZoomRect()
 {
     mnCurPos++;
-    sal_uLong nRectCount = Count();
+    sal_uLong nRectCount = maRectangles.size();
 
     if (nRectCount > 0 && mnCurPos > nRectCount - 1)
-    {
         mnCurPos = nRectCount - 1;
-    }
 
     SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
     rBindings.Invalidate( SID_ZOOM_NEXT );
     rBindings.Invalidate( SID_ZOOM_PREV );
 
-    Rectangle aRect(*(Rectangle*) GetObject(mnCurPos));
-    return (aRect);
+    return maRectangles[mnCurPos];
 }
 
-/*************************************************************************
-|*
-|* Return last ZoomRect
-|*
-\************************************************************************/
-
 Rectangle ZoomList::GetPreviousZoomRect()
 {
     if (mnCurPos > 0)
-    {
         mnCurPos--;
-    }
 
     SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
     rBindings.Invalidate( SID_ZOOM_NEXT );
     rBindings.Invalidate( SID_ZOOM_PREV );
 
-    Rectangle aRect(*(Rectangle*) GetObject(mnCurPos));
-    return (aRect);
+    return maRectangles[mnCurPos];
 }
 
-/*************************************************************************
-|*
-|* Is there a next ZoomRect?
-|*
-\************************************************************************/
-
 sal_Bool ZoomList::IsNextPossible() const
 {
-    sal_Bool bPossible = sal_False;
-    sal_uLong nRectCount = Count();
+    sal_uLong nRectCount = maRectangles.size();
 
-    if (nRectCount > 0 && mnCurPos < nRectCount - 1)
-    {
-        bPossible = sal_True;
-    }
-
-    return (bPossible);
+    return nRectCount > 0 && mnCurPos < nRectCount - 1;
 }
 
-/*************************************************************************
-|*
-|* Is there a previous ZoomRect?
-|*
-\************************************************************************/
-
 sal_Bool ZoomList::IsPreviousPossible() const
 {
-    sal_Bool bPossible = sal_False;
-
-    if (mnCurPos > 0)
-    {
-        bPossible = sal_True;
-    }
-
-    return (bPossible);
+    return mnCurPos > 0;
 }
 
 } // end of namespace sd


More information about the Libreoffice-commits mailing list