LCOV - code coverage report
Current view: top level - extensions/source/propctrlr - taborder.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 177 0.0 %
Date: 2012-08-25 Functions: 0 30 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "taborder.hxx"
      30                 :            : #include "taborder.hrc"
      31                 :            : 
      32                 :            : #include "modulepcr.hxx"
      33                 :            : #include "formresid.hrc"
      34                 :            : #include "formstrings.hxx"
      35                 :            : #include <comphelper/types.hxx>
      36                 :            : #include <comphelper/property.hxx>
      37                 :            : #include <cppuhelper/implbase1.hxx>
      38                 :            : #include <com/sun/star/form/FormComponentType.hpp>
      39                 :            : #include <com/sun/star/awt/XTabController.hpp>
      40                 :            : #include <vcl/scrbar.hxx>
      41                 :            : 
      42                 :            : //............................................................................
      43                 :            : namespace pcr
      44                 :            : {
      45                 :            : //............................................................................
      46                 :            : 
      47                 :            :     using namespace ::com::sun::star::uno;
      48                 :            :     using namespace ::com::sun::star::awt;
      49                 :            :     using namespace ::com::sun::star::lang;
      50                 :            :     using namespace ::com::sun::star::form;
      51                 :            :     using namespace ::com::sun::star::beans;
      52                 :            :     using namespace ::com::sun::star::datatransfer;
      53                 :            : 
      54                 :            :     //========================================================================
      55                 :            :     //= OSimpleTabModel
      56                 :            :     //========================================================================
      57                 :          0 :     class OSimpleTabModel : public ::cppu::WeakImplHelper1< XTabControllerModel>
      58                 :            :     {
      59                 :            :         Sequence< Reference< XControlModel > > m_aModels;
      60                 :            : 
      61                 :            :     public:
      62                 :          0 :         OSimpleTabModel( const Sequence< Reference< XControlModel > >& _rModels )
      63                 :          0 :             :m_aModels( _rModels )
      64                 :            :         {
      65                 :          0 :         }
      66                 :            : 
      67                 :            :         // XTabControllerModel
      68                 :          0 :         virtual void SAL_CALL setControlModels(const Sequence< Reference< XControlModel > >& rModels) throw( RuntimeException ) {m_aModels = rModels;}
      69                 :          0 :         virtual Sequence< Reference< XControlModel > > SAL_CALL getControlModels(void) throw( RuntimeException ) {return m_aModels;}
      70                 :          0 :         virtual void SAL_CALL setGroup(const Sequence< Reference< XControlModel > >& /*Group*/, const ::rtl::OUString& /*GroupName*/) throw( RuntimeException ) {}
      71                 :          0 :         virtual sal_Int32 SAL_CALL getGroupCount(void) throw( RuntimeException ) {return 0;}
      72                 :          0 :         virtual void SAL_CALL getGroup(sal_Int32 /*nGroup*/, Sequence< Reference< XControlModel > >& /*Group*/, ::rtl::OUString& /*Name*/) throw( RuntimeException ) {}
      73                 :          0 :         virtual void SAL_CALL getGroupByName(const ::rtl::OUString& /*Name*/, Sequence< Reference< XControlModel > >& /*Group*/) throw( RuntimeException ) {}
      74                 :          0 :         virtual sal_Bool SAL_CALL getGroupControl(void) throw( RuntimeException ){return sal_False;} ;
      75                 :          0 :         virtual void SAL_CALL setGroupControl(sal_Bool /*GroupControl*/) throw( RuntimeException ){};
      76                 :            :     };
      77                 :            : 
      78                 :            :     //========================================================================
      79                 :            :     //= TabOrderDialog
      80                 :            :     //========================================================================
      81                 :            :     DBG_NAME(TabOrderDialog)
      82                 :            :     //------------------------------------------------------------------------
      83                 :          0 :     TabOrderDialog::TabOrderDialog( Window* _pParent, const Reference< XTabControllerModel >& _rxTabModel,
      84                 :            :                     const Reference< XControlContainer >& _rxControlCont, const Reference< XMultiServiceFactory >& _rxORB )
      85                 :            :         :ModalDialog( _pParent, PcrRes( RID_DLG_TABORDER ) )
      86                 :            :         ,m_xModel( _rxTabModel )
      87                 :            :         ,m_xControlContainer( _rxControlCont )
      88                 :            :         ,m_xORB( _rxORB )
      89                 :            :         ,aFT_Controls( this, PcrRes( FT_CONTROLS ) )
      90                 :            :         ,aLB_Controls( this, PcrRes( CTRL_TREE ) )
      91                 :            :         ,aPB_OK( this, PcrRes( PB_OK ) )
      92                 :            :         ,aPB_CANCEL( this, PcrRes( PB_CANCEL ) )
      93                 :            :         ,aPB_HELP( this, PcrRes( PB_HELP ) )
      94                 :            :         ,aPB_MoveUp( this, PcrRes( PB_MOVE_UP ) )
      95                 :            :         ,aPB_MoveDown( this, PcrRes( PB_MOVE_DOWN ) )
      96                 :            :         ,aPB_AutoOrder( this, PcrRes( PB_AUTO_ORDER ) )
      97                 :          0 :         ,pImageList( NULL )
      98                 :            :     {
      99                 :            :         DBG_CTOR(TabOrderDialog,NULL);
     100                 :            : 
     101                 :          0 :         aPB_MoveUp.SetClickHdl( LINK( this, TabOrderDialog, MoveUpClickHdl ) );
     102                 :          0 :         aPB_MoveDown.SetClickHdl( LINK( this, TabOrderDialog, MoveDownClickHdl ) );
     103                 :          0 :         aPB_AutoOrder.SetClickHdl( LINK( this, TabOrderDialog, AutoOrderClickHdl ) );
     104                 :          0 :         aPB_OK.SetClickHdl( LINK( this, TabOrderDialog, OKClickHdl ) );
     105                 :          0 :         aPB_OK.Disable();
     106                 :            : 
     107                 :          0 :         pImageList = new ImageList( PcrRes( RID_IL_FORMEXPLORER ) );
     108                 :            : 
     109                 :          0 :         if ( m_xModel.is() )
     110                 :          0 :             m_xTempModel = new OSimpleTabModel( m_xModel->getControlModels() );
     111                 :            : 
     112                 :          0 :         if ( m_xTempModel.is() && m_xControlContainer.is() )
     113                 :          0 :             FillList();
     114                 :            : 
     115                 :          0 :         if ( aLB_Controls.GetEntryCount() < 2 )
     116                 :            :         {
     117                 :          0 :             aPB_MoveUp.Disable();
     118                 :          0 :             aPB_MoveDown.Disable();
     119                 :          0 :             aPB_AutoOrder.Disable();
     120                 :            :         }
     121                 :            : 
     122                 :          0 :         FreeResource();
     123                 :          0 :     }
     124                 :            : 
     125                 :            :     //------------------------------------------------------------------------
     126                 :          0 :     void TabOrderDialog::SetModified()
     127                 :            :     {
     128                 :          0 :         aPB_OK.Enable();
     129                 :          0 :     }
     130                 :            : 
     131                 :            :     //------------------------------------------------------------------------
     132                 :          0 :     TabOrderDialog::~TabOrderDialog()
     133                 :            :     {
     134                 :          0 :         aLB_Controls.Hide();
     135                 :            :         //  delete pLB_Controls;
     136                 :          0 :         delete pImageList;
     137                 :            : 
     138                 :            :         DBG_DTOR(TabOrderDialog,NULL);
     139                 :          0 :     }
     140                 :            : 
     141                 :            :     //------------------------------------------------------------------------
     142                 :          0 :     Image TabOrderDialog::GetImage( const Reference< XPropertySet >& _rxSet ) const
     143                 :            :     {
     144                 :          0 :         sal_uInt16 nImageId = RID_SVXIMG_CONTROL;
     145                 :            :         // TODO: classify controls also in Basic propbrw
     146                 :          0 :         if ( _rxSet.is() && ::comphelper::hasProperty( PROPERTY_CLASSID, _rxSet ) )
     147                 :            :         {
     148                 :          0 :             switch( ::comphelper::getINT16( _rxSet->getPropertyValue( PROPERTY_CLASSID ) ) )
     149                 :            :             {
     150                 :          0 :             case FormComponentType::COMMANDBUTTON:  nImageId = RID_SVXIMG_BUTTON; break;
     151                 :          0 :             case FormComponentType::FIXEDTEXT:      nImageId = RID_SVXIMG_FIXEDTEXT; break;
     152                 :          0 :             case FormComponentType::TEXTFIELD:      nImageId = RID_SVXIMG_EDIT; break;
     153                 :          0 :             case FormComponentType::RADIOBUTTON:    nImageId = RID_SVXIMG_RADIOBUTTON; break;
     154                 :          0 :             case FormComponentType::CHECKBOX:       nImageId = RID_SVXIMG_CHECKBOX; break;
     155                 :          0 :             case FormComponentType::LISTBOX:        nImageId = RID_SVXIMG_LISTBOX; break;
     156                 :          0 :             case FormComponentType::COMBOBOX:       nImageId = RID_SVXIMG_COMBOBOX; break;
     157                 :          0 :             case FormComponentType::GROUPBOX:       nImageId = RID_SVXIMG_GROUPBOX; break;
     158                 :          0 :             case FormComponentType::IMAGEBUTTON:    nImageId = RID_SVXIMG_IMAGEBUTTON; break;
     159                 :          0 :             case FormComponentType::FILECONTROL:    nImageId = RID_SVXIMG_FILECONTROL; break;
     160                 :          0 :             case FormComponentType::HIDDENCONTROL:  nImageId = RID_SVXIMG_HIDDEN; break;
     161                 :          0 :             case FormComponentType::DATEFIELD:      nImageId = RID_SVXIMG_DATEFIELD; break;
     162                 :          0 :             case FormComponentType::TIMEFIELD:      nImageId = RID_SVXIMG_TIMEFIELD; break;
     163                 :          0 :             case FormComponentType::NUMERICFIELD:   nImageId = RID_SVXIMG_NUMERICFIELD; break;
     164                 :          0 :             case FormComponentType::CURRENCYFIELD:  nImageId = RID_SVXIMG_CURRENCYFIELD; break;
     165                 :          0 :             case FormComponentType::PATTERNFIELD:   nImageId = RID_SVXIMG_PATTERNFIELD; break;
     166                 :          0 :             case FormComponentType::IMAGECONTROL:   nImageId = RID_SVXIMG_IMAGECONTROL; break;
     167                 :          0 :             case FormComponentType::GRIDCONTROL:    nImageId = RID_SVXIMG_GRID; break;
     168                 :          0 :             case FormComponentType::SCROLLBAR:      nImageId = RID_SVXIMG_SCROLLBAR; break;
     169                 :          0 :             case FormComponentType::SPINBUTTON:     nImageId = RID_SVXIMG_SPINBUTTON; break;
     170                 :          0 :             case FormComponentType::NAVIGATIONBAR:  nImageId = RID_SVXIMG_NAVIGATIONBAR; break;
     171                 :            :             default:
     172                 :            :                 OSL_FAIL( "TabOrderDialog::GetImage: unknown control type" );
     173                 :            :             }
     174                 :            :         }
     175                 :            : 
     176                 :          0 :         return pImageList->GetImage( nImageId );
     177                 :            :     }
     178                 :            : 
     179                 :            :     //------------------------------------------------------------------------
     180                 :          0 :     void TabOrderDialog::FillList()
     181                 :            :     {
     182                 :            :         DBG_ASSERT( m_xTempModel.is() && m_xControlContainer.is(), "TabOrderDialog::FillList: invalid call!" );
     183                 :          0 :         if ( !m_xTempModel.is() || !m_xControlContainer.is() )
     184                 :          0 :             return;
     185                 :            : 
     186                 :          0 :         aLB_Controls.Clear();
     187                 :            : 
     188                 :            :         try
     189                 :            :         {
     190                 :          0 :             Sequence< Reference< XControlModel > > aControlModels( m_xTempModel->getControlModels() );
     191                 :          0 :             const Reference< XControlModel >* pControlModels = aControlModels.getConstArray();
     192                 :            : 
     193                 :          0 :             ::rtl::OUString aName;
     194                 :          0 :             Image aImage;
     195                 :            : 
     196                 :          0 :             for ( sal_Int32 i=0; i < aControlModels.getLength(); ++i, ++pControlModels )
     197                 :            :             {
     198                 :          0 :                 Reference< XPropertySet > xControl( *pControlModels, UNO_QUERY );
     199                 :          0 :                 Reference< XPropertySetInfo > xPI;
     200                 :          0 :                 if ( xControl.is() )
     201                 :          0 :                     xPI = xControl->getPropertySetInfo();
     202                 :            : 
     203                 :          0 :                 if ( xPI.is() )
     204                 :            :                 {
     205                 :          0 :                     if ( xPI->hasPropertyByName( PROPERTY_TABSTOP ) )
     206                 :            :                     {
     207                 :          0 :                         aName = ::comphelper::getString( xControl->getPropertyValue( PROPERTY_NAME ) );
     208                 :            :                             // TODO: do Basic controls have a name?
     209                 :          0 :                         aImage = GetImage( xControl );
     210                 :          0 :                         aLB_Controls.InsertEntry( aName, aImage, aImage, 0, sal_False, LIST_APPEND, xControl.get() );
     211                 :            :                     }
     212                 :            :                 }
     213                 :            :                 else
     214                 :            :                 {
     215                 :            :                     // no property set -> no tab order
     216                 :            :                     OSL_FAIL( "TabOrderDialog::FillList: invalid control encountered!" );
     217                 :          0 :                     aLB_Controls.Clear();
     218                 :            :                     break;
     219                 :            :                 }
     220                 :          0 :             }
     221                 :            :         }
     222                 :          0 :         catch( const Exception& )
     223                 :            :         {
     224                 :            :             OSL_FAIL( "TabOrderDialog::FillList: caught an exception!" );
     225                 :            :         }
     226                 :            : 
     227                 :            :         // select first entry
     228                 :          0 :         SvLBoxEntry* pFirstEntry = aLB_Controls.GetEntry( 0 );
     229                 :          0 :         if ( pFirstEntry )
     230                 :          0 :             aLB_Controls.Select( pFirstEntry );
     231                 :            :     }
     232                 :            : 
     233                 :            :     //------------------------------------------------------------------------
     234                 :          0 :     IMPL_LINK( TabOrderDialog, MoveUpClickHdl, Button*, /*pButton*/ )
     235                 :            :     {
     236                 :          0 :         aLB_Controls.MoveSelection( -1 );
     237                 :          0 :         return 0;
     238                 :            :     }
     239                 :            : 
     240                 :            :     //------------------------------------------------------------------------
     241                 :          0 :     IMPL_LINK( TabOrderDialog, MoveDownClickHdl, Button*, /*pButton*/ )
     242                 :            :     {
     243                 :          0 :         aLB_Controls.MoveSelection( 1 );
     244                 :          0 :         return 0;
     245                 :            :     }
     246                 :            : 
     247                 :            :     //------------------------------------------------------------------------
     248                 :          0 :     IMPL_LINK( TabOrderDialog, AutoOrderClickHdl, Button*, /*pButton*/ )
     249                 :            :     {
     250                 :            :         try
     251                 :            :         {
     252                 :          0 :             Reference< XTabController > xTabController;
     253                 :          0 :             if ( m_xORB.is() )
     254                 :          0 :                 xTabController = xTabController.query( m_xORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.FormController" ) ) ) );
     255                 :            :             DBG_ASSERT( xTabController.is(), "TabOrderDialog::AutoOrderClickHdl: could not instantiate a tab controller!" );
     256                 :          0 :             if ( !xTabController.is() )
     257                 :          0 :                 return 0;
     258                 :            : 
     259                 :          0 :             xTabController->setModel( m_xTempModel );
     260                 :          0 :             xTabController->setContainer( m_xControlContainer );
     261                 :          0 :             xTabController->autoTabOrder();
     262                 :            : 
     263                 :          0 :             SetModified();
     264                 :          0 :             FillList();
     265                 :            : 
     266                 :          0 :             ::comphelper::disposeComponent( xTabController );
     267                 :            :         }
     268                 :          0 :         catch( const Exception& )
     269                 :            :         {
     270                 :            :             OSL_FAIL( "TabOrderDialog::AutoOrderClickHdl: caught an exception!" );
     271                 :            :         }
     272                 :            : 
     273                 :          0 :         return 0;
     274                 :            :     }
     275                 :            : 
     276                 :            :     //------------------------------------------------------------------------
     277                 :          0 :     IMPL_LINK( TabOrderDialog, OKClickHdl, Button*, /*pButton*/ )
     278                 :            :     {
     279                 :          0 :         sal_uLong nEntryCount = aLB_Controls.GetEntryCount();
     280                 :          0 :         Sequence< Reference< XControlModel > > aSortedControlModelSeq( nEntryCount );
     281                 :          0 :         Sequence< Reference< XControlModel > > aControlModels( m_xTempModel->getControlModels());
     282                 :          0 :         Reference< XControlModel > * pSortedControlModels = aSortedControlModelSeq.getArray();
     283                 :          0 :         const Reference< XControlModel > * pControlModels = aControlModels.getConstArray();
     284                 :            : 
     285                 :          0 :         for (sal_uLong i=0; i < nEntryCount; i++)
     286                 :            :         {
     287                 :          0 :             SvLBoxEntry* pEntry = aLB_Controls.GetEntry(i);
     288                 :            : 
     289                 :          0 :             for( sal_Int32 j=0; j<aControlModels.getLength(); j++ )
     290                 :            :             {
     291                 :          0 :                 Reference< XPropertySet >  xSet(pControlModels[j], UNO_QUERY);
     292                 :          0 :                 if ((XPropertySet*)xSet.get() == ((XPropertySet*)pEntry->GetUserData()))
     293                 :            :                 {
     294                 :          0 :                     pSortedControlModels[i] = pControlModels[j];
     295                 :            :                     break;
     296                 :            :                 }
     297                 :          0 :             }
     298                 :            :         }
     299                 :            : 
     300                 :            :         // TODO: UNO action (to bracket all the single actions which are being created)
     301                 :          0 :         m_xModel->setControlModels( aSortedControlModelSeq );
     302                 :            : 
     303                 :          0 :         EndDialog( sal_True );
     304                 :          0 :         return 0;
     305                 :            :     }
     306                 :            : 
     307                 :            :     //========================================================================
     308                 :            :     //= TabOrderListBox
     309                 :            :     //========================================================================
     310                 :            :     DBG_NAME(TabOrderListBox);
     311                 :            :     //------------------------------------------------------------------------
     312                 :          0 :     TabOrderListBox::TabOrderListBox( Window* pParent, const ResId& rResId  )
     313                 :          0 :         :SvTreeListBox( pParent, rResId  )
     314                 :            :     {
     315                 :            :         DBG_CTOR(TabOrderListBox,NULL);
     316                 :          0 :         SetDragDropMode(0xFFFF/*SV_DRAGDROP_CTRL_MOVE*/);
     317                 :            :             // Hmm. The flag alone is not enough, so to be on the safe side ...
     318                 :            : 
     319                 :          0 :         SetSelectionMode( MULTIPLE_SELECTION );
     320                 :          0 :     }
     321                 :            : 
     322                 :            :     //------------------------------------------------------------------------
     323                 :          0 :     TabOrderListBox::~TabOrderListBox()
     324                 :            :     {
     325                 :            :         DBG_DTOR(TabOrderListBox,NULL);
     326                 :          0 :     }
     327                 :            : 
     328                 :            :     //------------------------------------------------------------------------
     329                 :          0 :     void TabOrderListBox::ModelHasMoved( SvListEntry* _pSource )
     330                 :            :     {
     331                 :          0 :         SvTreeListBox::ModelHasMoved( _pSource );
     332                 :            : 
     333                 :          0 :         ((TabOrderDialog*)Window::GetParent())->SetModified();
     334                 :          0 :     }
     335                 :            : 
     336                 :            :     //------------------------------------------------------------------------
     337                 :          0 :     void TabOrderListBox::MoveSelection( long nRelPos )
     338                 :            :     {
     339                 :          0 :         rtl::OUString aSelEntryPrevText, aSelEntryNextText;
     340                 :          0 :         Image  aImage;
     341                 :          0 :         for (long i=0; i<labs(nRelPos); i++)
     342                 :            :         {
     343                 :          0 :             ((TabOrderDialog*)Window::GetParent())->SetModified();
     344                 :            : 
     345                 :            :             //////////////////////////////////////////////////////////////////////
     346                 :            :             // move entries
     347                 :          0 :             if( nRelPos < 0 )
     348                 :            :             {
     349                 :          0 :                 SvLBoxEntry* pFirstSelected = FirstSelected();
     350                 :          0 :                 if( !pFirstSelected ) return;
     351                 :          0 :                 sal_uLong nFirstSelPos = GetModel()->GetAbsPos( pFirstSelected );
     352                 :          0 :                 if( nFirstSelPos == 0 ) return;
     353                 :            : 
     354                 :          0 :                 SvLBoxEntry* pSelEntry = pFirstSelected;
     355                 :          0 :                 while( pSelEntry )
     356                 :            :                 {
     357                 :          0 :                     sal_uLong nSelEntryPos = GetModel()->GetAbsPos( pSelEntry );
     358                 :          0 :                     SvLBoxEntry* pSelEntryPrev = GetEntry( nSelEntryPos-1 );
     359                 :          0 :                     aSelEntryPrevText = GetEntryText( pSelEntryPrev );
     360                 :          0 :                     aImage = GetExpandedEntryBmp(pSelEntryPrev);
     361                 :          0 :                     void*  pData = pSelEntryPrev->GetUserData();
     362                 :            : 
     363                 :          0 :                     GetModel()->Remove( pSelEntryPrev );
     364                 :          0 :                     InsertEntry( aSelEntryPrevText, aImage, aImage, 0, sal_False, nSelEntryPos, pData );
     365                 :            : 
     366                 :          0 :                     pSelEntry = NextSelected( pSelEntry );
     367                 :            :                 }
     368                 :            :             }
     369                 :            : 
     370                 :          0 :             else if( nRelPos > 0 )
     371                 :            :             {
     372                 :          0 :                 SvLBoxEntry* pLastSelected = LastSelected();
     373                 :          0 :                 if( !pLastSelected ) return;
     374                 :          0 :                 sal_uLong nLastSelPos = GetModel()->GetAbsPos( pLastSelected );
     375                 :            : 
     376                 :          0 :                 if( (nLastSelPos + nRelPos - i) > (GetEntryCount()-1) ) return;
     377                 :            : 
     378                 :            : #if OSL_DEBUG_LEVEL > 0
     379                 :            :                 sal_uLong nSelCount = GetSelectionCount();
     380                 :            :                 (void)nSelCount;
     381                 :            : #endif
     382                 :            : 
     383                 :            : 
     384                 :          0 :                 SvLBoxEntry* pSelEntry = pLastSelected;
     385                 :          0 :                 while( pSelEntry )
     386                 :            :                 {
     387                 :          0 :                     sal_uLong nSelEntryPos = GetModel()->GetAbsPos( pSelEntry );
     388                 :          0 :                     SvLBoxEntry* pSelEntryNext = GetEntry( nSelEntryPos+1 );
     389                 :          0 :                     void* pData = pSelEntryNext->GetUserData();
     390                 :            : 
     391                 :          0 :                     aSelEntryNextText = GetEntryText( pSelEntryNext );
     392                 :          0 :                     aImage = GetExpandedEntryBmp(pSelEntryNext);
     393                 :            : 
     394                 :          0 :                     GetModel()->Remove( pSelEntryNext );
     395                 :          0 :                     InsertEntry( aSelEntryNextText, aImage, aImage, 0, sal_False, nSelEntryPos, pData );
     396                 :            : 
     397                 :          0 :                     pSelEntry = PrevSelected( pSelEntry );
     398                 :            :                 }
     399                 :          0 :                 long nThumbPos      = GetVScroll()->GetThumbPos();
     400                 :          0 :                 long nVisibleSize   = GetVScroll()->GetVisibleSize();
     401                 :          0 :                 long nFirstVisible = GetModel()->GetAbsPos( FirstVisible());
     402                 :            : 
     403                 :          0 :                 if ( ( nThumbPos + nVisibleSize + 1 ) < (long)( nLastSelPos + 3 ) )
     404                 :          0 :                     GetVScroll()->DoScrollAction(SCROLL_LINEDOWN);
     405                 :          0 :                 else if((nThumbPos+nVisibleSize+1) >= (nFirstVisible))
     406                 :          0 :                     GetVScroll()->DoScrollAction(SCROLL_LINEUP);
     407                 :            :             }
     408                 :          0 :         }
     409                 :            :     }
     410                 :            : 
     411                 :            : //............................................................................
     412                 :            : }  // namespace pcr
     413                 :            : //............................................................................
     414                 :            : 
     415                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10