[Libreoffice-commits] .: svtools/source

Joseph Powers jpowers at kemper.freedesktop.org
Wed Feb 2 20:41:51 PST 2011


 svtools/source/brwbox/brwbox2.cxx |   11 ++++++-----
 svtools/source/brwbox/datwin.cxx  |   34 ++++++++++++++++------------------
 svtools/source/brwbox/datwin.hxx  |    6 +++---
 3 files changed, 25 insertions(+), 26 deletions(-)

New commits:
commit 524039eba26f4d16f058f008d353aaad036c8638
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Wed Feb 2 20:41:45 2011 -0800

    Remove DECLARE_LIST( RectangleList, Rectangle* )

diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index 17d508d..d05e35e 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -365,20 +365,21 @@ void BrowseBox::ToggleSelection( BOOL bForce )
         Rectangle aAddRect(
             Point( nOfsX, (nRow-nTopRow)*GetDataRowHeight() ),
             Size( pDataWin->GetSizePixel().Width(), GetDataRowHeight() ) );
-        if ( aHighlightList.Count() && nLastRowInRect == ( nRow - 1 ) )
-            aHighlightList.First()->Union( aAddRect );
+        if ( aHighlightList.size() && nLastRowInRect == ( nRow - 1 ) )
+            aHighlightList[ 0 ]->Union( aAddRect );
         else
-            aHighlightList.Insert( new Rectangle( aAddRect ), (ULONG) 0 );
+            aHighlightList.insert( aHighlightList.begin(), new Rectangle( aAddRect ) );
         nLastRowInRect = nRow;
     }
 
     // unhighlight the old selection (if any)
-    while ( aHighlightList.Count() )
+    for ( size_t i = aHighlightList.size(); i > 0; )
     {
-        Rectangle *pRect = aHighlightList.Remove( aHighlightList.Count() - 1 );
+        Rectangle *pRect = aHighlightList[ --i ];
         pDataWin->Invalidate( *pRect );
         delete pRect;
     }
+    aHighlightList.clear();
 
     // unhighlight old column selection (if any)
     for ( long nColId = pColSel ? pColSel->FirstSelected() : BROWSER_ENDOFSELECTION;
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index 1066e38..9ed2430 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -232,6 +232,10 @@ BrowserDataWin::~BrowserDataWin()
 {
     if( pDtorNotify )
         *pDtorNotify = TRUE;
+
+    for ( size_t i = 0, n = aInvalidRegion.size(); i < n; ++i )
+        delete aInvalidRegion[ i ];
+    aInvalidRegion.clear();
 }
 
 //-------------------------------------------------------------------
@@ -315,7 +319,7 @@ void BrowserDataWin::Paint( const Rectangle& rRect )
     {
         if ( bInPaint )
         {
-            aInvalidRegion.Insert( new Rectangle( rRect ) );
+            aInvalidRegion.push_back( new Rectangle( rRect ) );
             return;
         }
         bInPaint = TRUE;
@@ -324,7 +328,7 @@ void BrowserDataWin::Paint( const Rectangle& rRect )
         DoOutstandingInvalidations();
     }
     else
-        aInvalidRegion.Insert( new Rectangle( rRect ) );
+        aInvalidRegion.push_back( new Rectangle( rRect ) );
 }
 
 //-------------------------------------------------------------------
@@ -685,8 +689,7 @@ BrowserExecuteDropEvent::BrowserExecuteDropEvent( BrowserDataWin *pWindow, const
 
 void BrowserDataWin::SetUpdateMode( BOOL bMode )
 {
-    DBG_ASSERT( !bUpdateMode || aInvalidRegion.Count() == 0,
-                "invalid region not empty" );
+    DBG_ASSERT( !bUpdateMode || aInvalidRegion.empty(), "invalid region not empty" );
     if ( bMode == bUpdateMode )
         return;
 
@@ -698,14 +701,11 @@ void BrowserDataWin::SetUpdateMode( BOOL bMode )
 //-------------------------------------------------------------------
 void BrowserDataWin::DoOutstandingInvalidations()
 {
-    for ( Rectangle* pRect = aInvalidRegion.First();
-          pRect;
-          pRect = aInvalidRegion.Next() )
-    {
-        Control::Invalidate( *pRect );
-        delete pRect;
+    for ( size_t i = 0, n = aInvalidRegion.size(); i < n; ++i ) {
+        Control::Invalidate( *aInvalidRegion[ i ] );
+        delete aInvalidRegion[ i ];
     }
-    aInvalidRegion.Clear();
+    aInvalidRegion.clear();
 }
 
 //-------------------------------------------------------------------
@@ -714,12 +714,10 @@ void BrowserDataWin::Invalidate( USHORT nFlags )
 {
     if ( !GetUpdateMode() )
     {
-        for ( Rectangle* pRect = aInvalidRegion.First();
-              pRect;
-              pRect = aInvalidRegion.Next() )
-            delete pRect;
-        aInvalidRegion.Clear();
-        aInvalidRegion.Insert( new Rectangle( Point( 0, 0 ), GetOutputSizePixel() ) );
+        for ( size_t i = 0, n = aInvalidRegion.size(); i < n; ++i )
+            delete aInvalidRegion[ i ];
+        aInvalidRegion.clear();
+        aInvalidRegion.push_back( new Rectangle( Point( 0, 0 ), GetOutputSizePixel() ) );
     }
     else
         Window::Invalidate( nFlags );
@@ -730,7 +728,7 @@ void BrowserDataWin::Invalidate( USHORT nFlags )
 void BrowserDataWin::Invalidate( const Rectangle& rRect, USHORT nFlags )
 {
     if ( !GetUpdateMode() )
-        aInvalidRegion.Insert( new Rectangle( rRect ) );
+        aInvalidRegion.push_back( new Rectangle( rRect ) );
     else
         Window::Invalidate( rRect, nFlags );
 }
diff --git a/svtools/source/brwbox/datwin.hxx b/svtools/source/brwbox/datwin.hxx
index 2e65513..594abc9 100644
--- a/svtools/source/brwbox/datwin.hxx
+++ b/svtools/source/brwbox/datwin.hxx
@@ -2,7 +2,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -33,15 +33,15 @@
 #include <svtools/brwhead.hxx>
 #include <vcl/timer.hxx>
 #include <vcl/image.hxx>
-#include <tools/list.hxx>
 #include <svtools/transfer.hxx>
+#include <vector>
 
 //===================================================================
 
 #define MIN_COLUMNWIDTH  2
 #define DRAG_CRITICAL    4
 
-DECLARE_LIST( RectangleList, Rectangle* )
+typedef ::std::vector< Rectangle* > RectangleList;
 
 //===================================================================
 


More information about the Libreoffice-commits mailing list