[Libreoffice-commits] .: toolkit/inc toolkit/source

Joseph Powers jpowers at kemper.freedesktop.org
Thu Feb 10 21:52:49 PST 2011


 toolkit/inc/toolkit/controls/stdtabcontrollermodel.hxx |    4 -
 toolkit/source/controls/stdtabcontroller.cxx           |   64 +++++++++--------
 2 files changed, 36 insertions(+), 32 deletions(-)

New commits:
commit 4f8714a7052a0a0474896adc1339cb46b9dd6d39
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Thu Feb 10 21:48:39 2011 -0800

    Remove DECLARE_LIST( ComponentEntryList, ComponentEntry* )

diff --git a/toolkit/inc/toolkit/controls/stdtabcontrollermodel.hxx b/toolkit/inc/toolkit/controls/stdtabcontrollermodel.hxx
index f486142..162e9dd 100644
--- a/toolkit/inc/toolkit/controls/stdtabcontrollermodel.hxx
+++ b/toolkit/inc/toolkit/controls/stdtabcontrollermodel.hxx
@@ -46,7 +46,6 @@
 #include <vector>
 
 struct UnoControlModelEntry;
-
 typedef ::std::vector< UnoControlModelEntry* > UnoControlModelEntryListBase;
 
 class UnoControlModelEntryList
@@ -80,14 +79,13 @@ struct UnoControlModelEntry
     };
 };
 
-// Keine Referenz halten, nur temporaer fuer AutoTabOrder
 struct ComponentEntry
 {
     ::com::sun::star::awt::XWindow*		pComponent;
     Point								aPos;
 };
 
-DECLARE_LIST( ComponentEntryList, ComponentEntry* )
+typedef ::std::vector< ComponentEntry* > ComponentEntryList;
 
 #define CONTROLPOS_NOTFOUND	0xFFFFFFFF
 
diff --git a/toolkit/source/controls/stdtabcontroller.cxx b/toolkit/source/controls/stdtabcontroller.cxx
index 9b2278a..926612c 100644
--- a/toolkit/source/controls/stdtabcontroller.cxx
+++ b/toolkit/source/controls/stdtabcontroller.cxx
@@ -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
@@ -67,7 +67,7 @@ sal_Bool StdTabController::ImplCreateComponentSequence(
         Sequence< Any>*									pTabStops,
         sal_Bool bPeerComponent ) const
 {
-    sal_Bool bOK = sal_True;			
+    sal_Bool bOK = sal_True;
 
     // nur die wirklich geforderten Controls
     sal_Int32 nModels = rModels.getLength();
@@ -94,7 +94,7 @@ sal_Bool StdTabController::ImplCreateComponentSequence(
 
 
     const Reference< XControl > * pControls = rControls.getConstArray();
-    sal_uInt32 nCtrls = rControls.getLength(); 
+    sal_uInt32 nCtrls = rControls.getLength();
     rComponents.realloc( nCtrls );
     Reference< XWindow > * pComps = rComponents.getArray();
     Any* pTabs = NULL;
@@ -107,22 +107,22 @@ sal_Bool StdTabController::ImplCreateComponentSequence(
     }
 
     for ( sal_uInt32 n = 0; bOK && ( n < nCtrls ); n++ )
-    {			
+    {
         // Zum Model passendes Control suchen
         Reference< XControl >  xCtrl(pControls[n]);
         if ( xCtrl.is() )
         {
             if (bPeerComponent)
-                pComps[n] = Reference< XWindow > (xCtrl->getPeer(), UNO_QUERY);							
+                pComps[n] = Reference< XWindow > (xCtrl->getPeer(), UNO_QUERY);
             else
                 pComps[n] = Reference< XWindow > (xCtrl, UNO_QUERY);
 
             // TabStop-Property
             if ( pTabs )
-            {					
+            {
                 // opt: String fuer TabStop als Konstante
                 static const ::rtl::OUString aTabStopName( RTL_CONSTASCII_USTRINGPARAM("Tabstop") );
-                
+
                 Reference< XPropertySet >  xPSet( xCtrl->getModel(), UNO_QUERY );
                 Reference< XPropertySetInfo >  xInfo = xPSet->getPropertySetInfo();
                 if( xInfo->hasPropertyByName( aTabStopName ) )
@@ -147,9 +147,9 @@ void StdTabController::ImplActivateControl( sal_Bool bFirst ) const
     Sequence< Reference< XControl > > aCtrls = xTabController->getControls();
     const Reference< XControl > * pControls = aCtrls.getConstArray();
     sal_uInt32 nCount = aCtrls.getLength();
-    
+
     for ( sal_uInt32 n = bFirst ? 0 : nCount; bFirst ? ( n < nCount ) : n; )
-    {			
+    {
         sal_uInt32 nCtrl = bFirst ? n++ : --n;
         DBG_ASSERT( pControls[nCtrl].is(), "Control nicht im Container!" );
         if ( pControls[nCtrl].is() )
@@ -187,35 +187,35 @@ IMPL_XTYPEPROVIDER_END
 void StdTabController::setModel( const Reference< XTabControllerModel >& Model ) throw(RuntimeException)
 {
     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-    
+
     mxModel = Model;
 }
 
 Reference< XTabControllerModel > StdTabController::getModel(  ) throw(RuntimeException)
 {
     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-    
+
     return mxModel;
 }
 
 void StdTabController::setContainer( const Reference< XControlContainer >& Container ) throw(RuntimeException)
 {
     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-    
+
     mxControlContainer = Container;
 }
 
 Reference< XControlContainer > StdTabController::getContainer(  ) throw(RuntimeException)
 {
     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-    
+
     return mxControlContainer;
 }
 
 Sequence< Reference< XControl > > StdTabController::getControls(  ) throw(RuntimeException)
 {
     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-    
+
     Sequence< Reference< XControl > > aSeq;
 
     if ( mxControlContainer.is() )
@@ -241,7 +241,7 @@ Sequence< Reference< XControl > > StdTabController::getControls(  ) throw(Runtim
 void StdTabController::autoTabOrder(  ) throw(RuntimeException)
 {
     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-    
+
     DBG_ASSERT( mxControlContainer.is(), "autoTabOrder: No ControlContainer!" );
     if ( !mxControlContainer.is() )
         return;
@@ -251,7 +251,7 @@ void StdTabController::autoTabOrder(  ) throw(RuntimeException)
 
     // vieleicht erhalte ich hier einen TabController,
     // der schneller die Liste meiner Controls ermittelt
-    Reference< XTabController >  xTabController(static_cast< ::cppu::OWeakObject* >(this), UNO_QUERY);	
+    Reference< XTabController >  xTabController(static_cast< ::cppu::OWeakObject* >(this), UNO_QUERY);
     Sequence< Reference< XControl > > aControls = xTabController->getControls();
 
     // #58317# Es sind ggf. noch nicht alle Controls fuer die Models im Container,
@@ -263,7 +263,7 @@ void StdTabController::autoTabOrder(  ) throw(RuntimeException)
     Reference< XWindow > * pComponents = aCompSeq.getArray();
 
     ComponentEntryList aCtrls;
-    sal_uInt32 n;
+    size_t n;
     for ( n = 0; n < nCtrls; n++ )
     {
         XWindow* pC = (XWindow*)pComponents[n].get();
@@ -274,31 +274,37 @@ void StdTabController::autoTabOrder(  ) throw(RuntimeException)
         pE->aPos.Y() = aPosSize.Y;
 
         sal_uInt16 nPos;
-        for ( nPos = 0; nPos < aCtrls.Count(); nPos++ )
+        for ( nPos = 0; nPos < aCtrls.size(); nPos++ )
         {
-            ComponentEntry* pEntry = aCtrls.GetObject( nPos );
+            ComponentEntry* pEntry = aCtrls[ nPos ];
             if ( pEntry->aPos.Y() >= pE->aPos.Y() )
             {
                 while ( pEntry && ( pEntry->aPos.Y() == pE->aPos.Y() )
                                 && ( pEntry->aPos.X() < pE->aPos.X() ) )
                 {
-                    pEntry = aCtrls.GetObject( ++nPos );
+                    pEntry = aCtrls[ ++nPos ];
                 }
                 break;
             }
         }
-        aCtrls.Insert( pE, nPos );
+        if ( nPos < aCtrls.size() ) {
+            ComponentEntryList::iterator it = aCtrls.begin();
+            ::std::advance( it, nPos );
+            aCtrls.insert( it, pE );
+        } else {
+            aCtrls.push_back( pE );
+        }
     }
 
     Sequence< Reference< XControlModel > > aNewSeq( nCtrls );
     for ( n = 0; n < nCtrls; n++ )
     {
-        ComponentEntry* pE = aCtrls.GetObject( n );
+        ComponentEntry* pE = aCtrls[ n ];
         Reference< XControl >  xUC( pE->pComponent, UNO_QUERY );
         aNewSeq.getArray()[n] = xUC->getModel();
         delete pE;
     }
-    aCtrls.Clear();
+    aCtrls.clear();
 
     mxModel->setControlModels( aNewSeq );
 }
@@ -306,7 +312,7 @@ void StdTabController::autoTabOrder(  ) throw(RuntimeException)
 void StdTabController::activateTabOrder(  ) throw(RuntimeException)
 {
     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-    
+
     // Am Container die Tab-Reihenfolge aktivieren...
 
     Reference< XControl >  xC( mxControlContainer, UNO_QUERY );
@@ -318,7 +324,7 @@ void StdTabController::activateTabOrder(  ) throw(RuntimeException)
 
     // vieleicht erhalte ich hier einen TabController,
     // der schneller die Liste meiner Controls ermittelt
-    Reference< XTabController >  xTabController(static_cast< ::cppu::OWeakObject* >(this), UNO_QUERY);	
+    Reference< XTabController >  xTabController(static_cast< ::cppu::OWeakObject* >(this), UNO_QUERY);
 
     // Flache Liste besorgen...
     Sequence< Reference< XControlModel > > aModels = mxModel->getControlModels();
@@ -327,7 +333,7 @@ void StdTabController::activateTabOrder(  ) throw(RuntimeException)
 
     // DG: Aus Optimierungsgruenden werden die Controls mittels getControls() geholt,
     // dieses hoert sich zwar wiedersinning an, fuehrt aber im konkreten Fall (Forms) zu sichtbaren
-    // Geschwindigkeitsvorteilen	
+    // Geschwindigkeitsvorteilen
     Sequence< Reference< XControl > > aControls = xTabController->getControls();
 
     // #58317# Es sind ggf. noch nicht alle Controls fuer die Models im Container,
@@ -362,14 +368,14 @@ void StdTabController::activateTabOrder(  ) throw(RuntimeException)
 void StdTabController::activateFirst(  ) throw(RuntimeException)
 {
     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-    
+
     ImplActivateControl( sal_True );
 }
 
 void StdTabController::activateLast(  ) throw(RuntimeException)
 {
     ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-    
+
     ImplActivateControl( sal_False );
 }
 
@@ -412,7 +418,7 @@ Reference< XControl >  StdTabController::FindControl( Sequence< Reference< XCont
     if ( !xCtrl.is() && rxCtrlModel.is())
 */
     DBG_ASSERT( rxCtrlModel.is(), "ImplFindControl - welches ?!" );
-    
+
     const Reference< XControl > * pCtrls = rCtrls.getConstArray();
     sal_Int32 nCtrls = rCtrls.getLength();
     for ( sal_Int32 n = 0; n < nCtrls; n++ )


More information about the Libreoffice-commits mailing list