[Libreoffice-commits] core.git: basctl/source basic/qa basic/source include/basic scripting/source sc/source sw/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Mon Dec 9 13:19:21 UTC 2019


 basctl/source/basicide/baside2.cxx      |   12 
 basctl/source/basicide/baside2b.cxx     |   59 +-
 basctl/source/basicide/basobj2.cxx      |   14 
 basctl/source/basicide/basobj3.cxx      |    2 
 basctl/source/basicide/macrodlg.cxx     |    6 
 basic/qa/cppunit/basictest.cxx          |    2 
 basic/source/basmgr/basmgr.cxx          |   12 
 basic/source/classes/eventatt.cxx       |   14 
 basic/source/classes/image.cxx          |   26 -
 basic/source/classes/propacc.cxx        |    6 
 basic/source/classes/sb.cxx             |   58 +-
 basic/source/classes/sbunoobj.cxx       |  166 +++---
 basic/source/classes/sbxmod.cxx         |  105 ++--
 basic/source/comp/codegen.cxx           |   12 
 basic/source/comp/dim.cxx               |   10 
 basic/source/comp/sbcomp.cxx            |    4 
 basic/source/runtime/dllmgr-none.cxx    |    4 
 basic/source/runtime/dllmgr-x64.cxx     |   38 -
 basic/source/runtime/dllmgr-x86.cxx     |   36 -
 basic/source/runtime/inputbox.cxx       |   18 
 basic/source/runtime/methods.cxx        |  810 ++++++++++++++++----------------
 basic/source/runtime/methods1.cxx       |  650 ++++++++++++-------------
 basic/source/runtime/props.cxx          |  194 +++----
 basic/source/runtime/runtime.cxx        |  170 +++---
 basic/source/runtime/stdobj.cxx         |    2 
 basic/source/runtime/stdobj1.cxx        |   18 
 basic/source/sbx/sbxarray.cxx           |  157 ------
 basic/source/sbx/sbxcoll.cxx            |   24 
 basic/source/sbx/sbxexec.cxx            |    4 
 basic/source/sbx/sbxobj.cxx             |   48 -
 basic/source/sbx/sbxstr.cxx             |   10 
 basic/source/sbx/sbxvalue.cxx           |    2 
 basic/source/sbx/sbxvar.cxx             |    6 
 include/basic/sbx.hxx                   |   31 -
 include/basic/sbxobj.hxx                |    2 
 sc/source/core/data/validat.cxx         |    6 
 sc/source/core/tool/interpr4.cxx        |    6 
 sc/source/ui/vba/vbaapplication.cxx     |    2 
 scripting/source/basprov/basmodnode.cxx |   12 
 scripting/source/basprov/basscript.cxx  |    9 
 sw/source/core/doc/docbasic.cxx         |    6 
 sw/source/uibase/docvw/edtwin.cxx       |   26 -
 42 files changed, 1332 insertions(+), 1467 deletions(-)

New commits:
commit 62f3f3d92aa204eaaa063b30d7ade44df501b997
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Mon Dec 9 13:06:03 2019 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Dec 9 14:18:25 2019 +0100

    SbxArray: drop 16-bit indices
    
    Change-Id: I43b478187636b9bb53fdf7ab938436ae364bd7a7
    Reviewed-on: https://gerrit.libreoffice.org/84733
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 5cb16f8f1f58..5ac30b14432b 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -336,9 +336,9 @@ void ModulWindow::BasicExecute()
             const sal_uInt32 nCurMethodStart = aSel.GetStart().GetPara() + 1;
             SbMethod* pMethod = nullptr;
             // first Macro, else blind "Main" (ExtSearch?)
-            for ( sal_uInt16 nMacro = 0; nMacro < m_xModule->GetMethods()->Count(); nMacro++ )
+            for ( sal_uInt32 nMacro = 0; nMacro < m_xModule->GetMethods()->Count32(); nMacro++ )
             {
-                SbMethod* pM = static_cast<SbMethod*>(m_xModule->GetMethods()->Get( nMacro ));
+                SbMethod* pM = static_cast<SbMethod*>(m_xModule->GetMethods()->Get32( nMacro ));
                 assert(pM && "Method?");
                 pM->GetLineRange( nStart, nEnd );
                 if (  nCurMethodStart >= nStart && nCurMethodStart <= nEnd )
@@ -526,9 +526,9 @@ void ModulWindow::ToggleBreakPoint( sal_uLong nLine )
                 GetBreakPoints().InsertSorted( BreakPoint( nLine ) );
                 if ( StarBASIC::IsRunning() )
                 {
-                    for ( sal_uInt16 nMethod = 0; nMethod < m_xModule->GetMethods()->Count(); nMethod++ )
+                    for ( sal_uInt32 nMethod = 0; nMethod < m_xModule->GetMethods()->Count32(); nMethod++ )
                     {
-                        SbMethod* pMethod = static_cast<SbMethod*>(m_xModule->GetMethods()->Get( nMethod ));
+                        SbMethod* pMethod = static_cast<SbMethod*>(m_xModule->GetMethods()->Get32( nMethod ));
                         assert(pMethod && "Method not found! (NULL)");
                         pMethod->SetDebugFlags( pMethod->GetDebugFlags() | BasicDebugFlags::Break );
                     }
@@ -1295,9 +1295,9 @@ void ModulWindow::BasicStarted()
         {
             rList.ResetHitCount();
             rList.SetBreakPointsInBasic( m_xModule.get() );
-            for ( sal_uInt16 nMethod = 0; nMethod < m_xModule->GetMethods()->Count(); nMethod++ )
+            for ( sal_uInt32 nMethod = 0; nMethod < m_xModule->GetMethods()->Count32(); nMethod++ )
             {
-                SbMethod* pMethod = static_cast<SbMethod*>(m_xModule->GetMethods()->Get( nMethod ));
+                SbMethod* pMethod = static_cast<SbMethod*>(m_xModule->GetMethods()->Get32( nMethod ));
                 assert(pMethod && "Method not found! (NULL)");
                 pMethod->SetDebugFlags( pMethod->GetDebugFlags() | BasicDebugFlags::Break );
             }
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index a5baaed5f100..c29f3e179636 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1118,9 +1118,9 @@ void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
 OUString EditorWindow::GetActualSubName( sal_uLong nLine )
 {
     SbxArrayRef pMethods = rModulWindow.GetSbModule()->GetMethods();
-    for( sal_uInt16 i=0; i < pMethods->Count(); i++ )
+    for( sal_uInt32 i=0; i < pMethods->Count32(); i++ )
     {
-        SbMethod* pMeth = dynamic_cast<SbMethod*>( pMethods->Get( i )  );
+        SbMethod* pMeth = dynamic_cast<SbMethod*>( pMethods->Get32( i )  );
         if( pMeth )
         {
             sal_uInt16 l1,l2;
@@ -1682,7 +1682,7 @@ struct WatchItem
     SbxDimArrayRef  mpArray;
     int             nDimLevel;  // 0 = Root
     int             nDimCount;
-    std::vector<short> vIndices;
+    std::vector<sal_Int32> vIndices;
 
     WatchItem*      mpArrayParentItem;
 
@@ -1914,9 +1914,9 @@ void StackWindow::UpdateCalls()
             {
                 aEntry.append("(");
                 // 0 is the sub's name...
-                for ( sal_uInt16 nParam = 1; nParam < pParams->Count(); nParam++ )
+                for ( sal_uInt32 nParam = 1; nParam < pParams->Count32(); nParam++ )
                 {
-                    SbxVariable* pVar = pParams->Get( nParam );
+                    SbxVariable* pVar = pParams->Get32( nParam );
                     assert(pVar && "Parameter?!");
                     if ( !pVar->GetName().isEmpty() )
                     {
@@ -1924,7 +1924,8 @@ void StackWindow::UpdateCalls()
                     }
                     else if ( pInfo )
                     {
-                        const SbxParamInfo* pParam = pInfo->GetParam( nParam );
+                        assert(nParam <= std::numeric_limits<sal_uInt16>::max());
+                        const SbxParamInfo* pParam = pInfo->GetParam( sal::static_int_cast<sal_uInt16>(nParam) );
                         if ( pParam )
                         {
                             aEntry.append(pParam->aName);
@@ -1940,7 +1941,7 @@ void StackWindow::UpdateCalls()
                     {
                         aEntry.append(pVar->GetOUString());
                     }
-                    if ( nParam < ( pParams->Count() - 1 ) )
+                    if ( nParam < ( pParams->Count32() - 1 ) )
                     {
                         aEntry.append(", ");
                     }
@@ -2143,19 +2144,19 @@ void WatchTreeListBox::RequestingChildren( SvTreeListEntry * pParent )
     {
         createAllObjectProperties( pObj );
         SbxArray* pProps = pObj->GetProperties();
-        sal_uInt16 nPropCount = pProps->Count();
+        sal_uInt32 nPropCount = pProps->Count32();
         if ( nPropCount >= 3 &&
-             pProps->Get( nPropCount -1 )->GetName().equalsIgnoreAsciiCase( "Dbg_Methods" ) &&
-             pProps->Get( nPropCount -2 )->GetName().equalsIgnoreAsciiCase( "Dbg_Properties" ) &&
-             pProps->Get( nPropCount -3 )->GetName().equalsIgnoreAsciiCase( "Dbg_SupportedInterfaces" ) )
+             pProps->Get32( nPropCount -1 )->GetName().equalsIgnoreAsciiCase( "Dbg_Methods" ) &&
+             pProps->Get32( nPropCount -2 )->GetName().equalsIgnoreAsciiCase( "Dbg_Properties" ) &&
+             pProps->Get32( nPropCount -3 )->GetName().equalsIgnoreAsciiCase( "Dbg_SupportedInterfaces" ) )
         {
             nPropCount -= 3;
         }
         pItem->maMemberList.reserve(nPropCount);
 
-        for( sal_uInt16 i = 0 ; i < nPropCount ; ++i )
+        for( sal_uInt32 i = 0 ; i < nPropCount ; ++i )
         {
-            SbxVariable* pVar = pProps->Get( i );
+            SbxVariable* pVar = pProps->Get32( i );
 
             pItem->maMemberList.push_back(pVar->GetName());
             OUString const& rName = pItem->maMemberList.back();
@@ -2190,10 +2191,10 @@ void WatchTreeListBox::RequestingChildren( SvTreeListEntry * pParent )
             sal_Int32 j;
             for( j = 0 ; j < nParentLevel ; j++ )
             {
-                short n = pChildItem->vIndices[j] = pItem->vIndices[j];
+                sal_Int32 n = pChildItem->vIndices[j] = pItem->vIndices[j];
                 aIndexStr.append(OUString::number( n )).append(",");
             }
-            pChildItem->vIndices[nParentLevel] = sal::static_int_cast<short>( i );
+            pChildItem->vIndices[nParentLevel] = i;
             aIndexStr.append(OUString::number( i )).append(")");
 
             OUString aDisplayName;
@@ -2246,7 +2247,7 @@ SbxBase* WatchTreeListBox::ImplGetSBXForEntry( SvTreeListEntry* pEntry, bool& rb
         {
             rbArrayElement = true;
             if( pParentItem->nDimLevel + 1 == pParentItem->nDimCount )
-                pSBX = pArray->Get(pItem->vIndices.empty() ? nullptr : &*pItem->vIndices.begin());
+                pSBX = pArray->Get32(pItem->vIndices.empty() ? nullptr : &*pItem->vIndices.begin());
         }
     }
     else
@@ -2356,8 +2357,8 @@ OUString implCreateTypeStringForDimArray( WatchItem* pItem, SbxDataType eType )
             aRetStr += "(";
             for( int i = nDimLevel ; i < nDims ; i++ )
             {
-                short nMin, nMax;
-                pArray->GetDim( sal::static_int_cast<short>( i+1 ), nMin, nMax );
+                sal_Int32 nMin, nMax;
+                pArray->GetDim32( sal::static_int_cast<sal_Int32>( i+1 ), nMin, nMax );
                 aRetStr += OUString::number(nMin) + " to "  + OUString::number(nMax);
                 if( i < nDims - 1 )
                     aRetStr += ", ";
@@ -2429,21 +2430,21 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped )
                         {
                             // Compare Array dimensions to see if array has changed
                             // Can be a copy, so comparing pointers does not work
-                            sal_uInt16 nOldDims = pOldArray->GetDims();
-                            sal_uInt16 nNewDims = pNewArray->GetDims();
+                            sal_Int32 nOldDims = pOldArray->GetDims32();
+                            sal_Int32 nNewDims = pNewArray->GetDims32();
                             if( nOldDims != nNewDims )
                             {
                                 bArrayChanged = true;
                             }
                             else
                             {
-                                for( int i = 0 ; i < nOldDims ; i++ )
+                                for( sal_Int32 i = 0 ; i < nOldDims ; i++ )
                                 {
-                                    short nOldMin, nOldMax;
-                                    short nNewMin, nNewMax;
+                                    sal_Int32 nOldMin, nOldMax;
+                                    sal_Int32 nNewMin, nNewMax;
 
-                                    pOldArray->GetDim( sal::static_int_cast<short>( i+1 ), nOldMin, nOldMax );
-                                    pNewArray->GetDim( sal::static_int_cast<short>( i+1 ), nNewMin, nNewMax );
+                                    pOldArray->GetDim32( i+1, nOldMin, nOldMax );
+                                    pNewArray->GetDim32( i+1, nNewMin, nNewMax );
                                     if( nOldMin != nNewMin || nOldMax != nNewMax )
                                     {
                                         bArrayChanged = true;
@@ -2464,7 +2465,7 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped )
                             implEnableChildren(pEntry, true);
 
                             pItem->mpArray = pNewArray;
-                            sal_uInt16 nDims = pNewArray->GetDims();
+                            sal_Int32 nDims = pNewArray->GetDims32();
                             pItem->nDimLevel = 0;
                             pItem->nDimCount = nDims;
                         }
@@ -2487,10 +2488,10 @@ void WatchTreeListBox::UpdateWatches( bool bBasicStopped )
                         {
                             bool bObjChanged = false; // Check if member list has changed
                             SbxArray* pProps = pObj->GetProperties();
-                            sal_uInt16 nPropCount = pProps->Count();
-                            for( sal_uInt16 i = 0 ; i < nPropCount - 3 ; i++ )
+                            sal_uInt32 nPropCount = pProps->Count32();
+                            for( sal_uInt32 i = 0 ; i < nPropCount - 3 ; i++ )
                             {
-                                SbxVariable* pVar_ = pProps->Get( i );
+                                SbxVariable* pVar_ = pProps->Get32( i );
                                 if( pItem->maMemberList[i] != pVar_->GetName() )
                                 {
                                     bObjChanged = true;
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
index 9160637a015a..9a9656d0d160 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -377,20 +377,20 @@ Sequence< OUString > GetMethodNames( const ScriptDocument& rDocument, const OUSt
             pMod = xModule.get();
         }
 
-        sal_uInt16 nCount = pMod->GetMethods()->Count();
-        sal_uInt16 nRealCount = nCount;
-        for ( sal_uInt16 i = 0; i < nCount; i++ )
+        sal_uInt32 nCount = pMod->GetMethods()->Count32();
+        sal_uInt32 nRealCount = nCount;
+        for ( sal_uInt32 i = 0; i < nCount; i++ )
         {
-            SbMethod* pMethod = static_cast<SbMethod*>(pMod->GetMethods()->Get( i ));
+            SbMethod* pMethod = static_cast<SbMethod*>(pMod->GetMethods()->Get32( i ));
             if( pMethod->IsHidden() )
                 --nRealCount;
         }
         aSeqMethods.realloc( nRealCount );
 
-        sal_uInt16 iTarget = 0;
-        for ( sal_uInt16 i = 0 ; i < nCount; ++i )
+        sal_uInt32 iTarget = 0;
+        for ( sal_uInt32 i = 0 ; i < nCount; ++i )
         {
-            SbMethod* pMethod = static_cast<SbMethod*>(pMod->GetMethods()->Get( i ));
+            SbMethod* pMethod = static_cast<SbMethod*>(pMod->GetMethods()->Get32( i ));
             if( pMethod->IsHidden() )
                 continue;
             SAL_WARN_IF( !pMethod, "basctl.basicide","Method not found! (NULL)" );
diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx
index acebc2328867..0f7d8d525d01 100644
--- a/basctl/source/basicide/basobj3.cxx
+++ b/basctl/source/basicide/basobj3.cxx
@@ -71,7 +71,7 @@ SbMethod* CreateMacro( SbModule* pModule, const OUString& rMacroName )
     OUString aMacroName( rMacroName );
     if ( aMacroName.isEmpty() )
     {
-        if ( !pModule->GetMethods()->Count() )
+        if ( !pModule->GetMethods()->Count32() )
             aMacroName = "Main" ;
         else
         {
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
index 97a45c59c03c..98c6e2fffed6 100644
--- a/basctl/source/basicide/macrodlg.cxx
+++ b/basctl/source/basicide/macrodlg.cxx
@@ -478,10 +478,10 @@ IMPL_LINK_NOARG(MacroChooser, BasicSelectHdl, weld::TreeView&, void)
 
         m_xMacroBox->freeze();
 
-        size_t nMacroCount = pModule->GetMethods()->Count();
-        for ( size_t iMeth = 0; iMeth  < nMacroCount; iMeth++ )
+        sal_uInt32 nMacroCount = pModule->GetMethods()->Count32();
+        for ( sal_uInt32 iMeth = 0; iMeth  < nMacroCount; iMeth++ )
         {
-            SbMethod* pMethod = static_cast<SbMethod*>(pModule->GetMethods()->Get( iMeth ));
+            SbMethod* pMethod = static_cast<SbMethod*>(pModule->GetMethods()->Get32( iMeth ));
             assert(pMethod && "Method not found!");
             if (pMethod->IsHidden())
                 continue;
diff --git a/basic/qa/cppunit/basictest.cxx b/basic/qa/cppunit/basictest.cxx
index 3a22c84e9007..f309cc13f00a 100644
--- a/basic/qa/cppunit/basictest.cxx
+++ b/basic/qa/cppunit/basictest.cxx
@@ -84,7 +84,7 @@ SbxVariableRef MacroSnippet::Run( const css::uno::Sequence< css::uno::Any >& rAr
             {
                 SbxVariable* pVar = new SbxVariable();
                 unoToSbxValue( pVar, rArgs[ i ] );
-                aArgs->Put(  pVar, i + 1 );
+                aArgs->Put32(  pVar, i + 1 );
             }
             pMeth->SetParameters( aArgs.get() );
         }
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 8adc59a9e874..764e5d70150e 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1837,10 +1837,10 @@ sal_Bool DialogContainer_Impl::hasElements()
 {
     bool bRet = false;
 
-    sal_Int16 nCount = mpLib->GetObjects()->Count();
-    for( sal_Int16 nObj = 0; nObj < nCount ; nObj++ )
+    sal_Int32 nCount = mpLib->GetObjects()->Count32();
+    for( sal_Int32 nObj = 0; nObj < nCount ; nObj++ )
     {
-        SbxVariable* pVar = mpLib->GetObjects()->Get( nObj );
+        SbxVariable* pVar = mpLib->GetObjects()->Get32( nObj );
         SbxObject* pObj = dynamic_cast<SbxObject*>(pVar);
         if ( pObj && (pObj->GetSbxId() == SBXID_DIALOG ) )
         {
@@ -1871,14 +1871,14 @@ uno::Any DialogContainer_Impl::getByName( const OUString& aName )
 
 uno::Sequence< OUString > DialogContainer_Impl::getElementNames()
 {
-    sal_Int16 nCount = mpLib->GetObjects()->Count();
+    sal_Int32 nCount = mpLib->GetObjects()->Count32();
     uno::Sequence< OUString > aRetSeq( nCount );
     OUString* pRetSeq = aRetSeq.getArray();
     sal_Int32 nDialogCounter = 0;
 
-    for( sal_Int16 nObj = 0; nObj < nCount ; nObj++ )
+    for( sal_Int32 nObj = 0; nObj < nCount ; nObj++ )
     {
-        SbxVariable* pVar = mpLib->GetObjects()->Get( nObj );
+        SbxVariable* pVar = mpLib->GetObjects()->Get32( nObj );
         SbxObject* pObj = dynamic_cast<SbxObject*> (pVar);
         if ( pObj && ( pObj->GetSbxId() == SBXID_DIALOG ) )
         {
diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx
index 35582a0c25be..2a4127159b71 100644
--- a/basic/source/classes/eventatt.cxx
+++ b/basic/source/classes/eventatt.cxx
@@ -241,8 +241,8 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
         // Be still tolerant and make default search if no search basic exists
         if( bSearchLib && xLibSearchBasic.is() )
         {
-            sal_Int16 nCount = xLibSearchBasic->GetObjects()->Count();
-            for( sal_Int16 nObj = -1; nObj < nCount ; nObj++ )
+            sal_Int32 nCount = xLibSearchBasic->GetObjects()->Count32();
+            for( sal_Int32 nObj = -1; nObj < nCount ; nObj++ )
             {
                 StarBASIC* pBasic;
                 if( nObj == -1 )
@@ -251,7 +251,7 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
                 }
                 else
                 {
-                    SbxVariable* pVar = xLibSearchBasic->GetObjects()->Get( nObj );
+                    SbxVariable* pVar = xLibSearchBasic->GetObjects()->Get32( nObj );
                     pBasic = dynamic_cast<StarBASIC*>( pVar );
                 }
                 if( pBasic )
@@ -291,7 +291,7 @@ void BasicScriptListener_Impl::firing_impl( const ScriptEvent& aScriptEvent, Any
             {
                 SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
                 unoToSbxValue( xVar.get(), pArgs[i] );
-                xArray->Put( xVar.get(), sal::static_int_cast< sal_uInt16 >(i+1) );
+                xArray->Put32( xVar.get(), sal::static_int_cast< sal_uInt32 >(i+1) );
             }
         }
 
@@ -409,14 +409,14 @@ void RTL_Impl_CreateUnoDialog( SbxArray& rPar )
     Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
 
     // We need at least 1 parameter
-    if ( rPar.Count() < 2 )
+    if ( rPar.Count32() < 2 )
     {
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
         return;
     }
 
     // Get dialog
-    SbxBaseRef pObj = rPar.Get( 1 )->GetObject();
+    SbxBaseRef pObj = rPar.Get32( 1 )->GetObject();
     if( !(pObj.is() && dynamic_cast<const SbUnoObject*>( pObj.get() ) != nullptr) )
     {
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
@@ -540,7 +540,7 @@ void RTL_Impl_CreateUnoDialog( SbxArray& rPar )
     // Return dialog
     Any aRetVal;
     aRetVal <<= xCntrl;
-    SbxVariableRef refVar = rPar.Get(0);
+    SbxVariableRef refVar = rPar.Get32(0);
     unoToSbxValue( refVar.get(), aRetVal );
 }
 
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index 90cdaa7b7ed9..fc2cbf0b154c 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -311,7 +311,7 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
                             }
                         }
 
-                        pTypeMembers->Insert( pTypeElem, pTypeMembers->Count() );
+                        pTypeMembers->Insert32( pTypeElem, pTypeMembers->Count32() );
 
                     }
 
@@ -442,27 +442,29 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
     // User defined types
     if ( rTypes.is() )
     {
-        sal_uInt16 nTypes = rTypes->Count();
+        sal_uInt32 nTypes = rTypes->Count32();
+        assert(nTypes <= std::numeric_limits<sal_uInt16>::max());
         if (nTypes > 0 )
         {
-            nPos = SbiOpenRecord( r, FileOffset::UserTypes, nTypes );
+            nPos = SbiOpenRecord( r, FileOffset::UserTypes, sal::static_int_cast<sal_uInt16>(nTypes) );
 
-            for (sal_uInt16 i = 0; i < nTypes; i++)
+            for (sal_uInt32 i = 0; i < nTypes; i++)
             {
-                SbxObject* pType = static_cast< SbxObject* > ( rTypes->Get(i) );
+                SbxObject* pType = static_cast< SbxObject* > ( rTypes->Get32(i) );
                 OUString aTypeName = pType->GetClassName();
 
                 r.WriteUniOrByteString( aTypeName, eCharSet );
 
                 SbxArray  *pTypeMembers = pType->GetProperties();
-                sal_uInt16 nTypeMembers = pTypeMembers->Count();
+                sal_uInt32 nTypeMembers = pTypeMembers->Count32();
+                assert(nTypeMembers <= std::numeric_limits<sal_uInt16>::max());
 
-                r.WriteInt16(nTypeMembers);
+                r.WriteInt16(sal::static_int_cast<sal_uInt16>(nTypeMembers));
 
-                for (sal_uInt16 j = 0; j < nTypeMembers; j++)
+                for (sal_uInt32 j = 0; j < nTypeMembers; j++)
                 {
 
-                    SbxProperty* pTypeElem = static_cast< SbxProperty* > ( pTypeMembers->Get(j) );
+                    SbxProperty* pTypeElem = static_cast< SbxProperty* > ( pTypeMembers->Get32(j) );
 
                     const OUString& aElemName = pTypeElem->GetName();
                     r.WriteUniOrByteString( aElemName, eCharSet );
@@ -497,7 +499,7 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
                             else
                                 r.WriteInt16(0);
 
-                            sal_Int32 nDims = pArray->GetDims();
+                            sal_Int32 nDims = pArray->GetDims32();
                             r.WriteInt32(nDims);
 
                             for (sal_Int32 d = 0; d < nDims; d++)
@@ -596,7 +598,7 @@ void SbiImage::AddType(SbxObject const * pObject)
         rTypes = new SbxArray;
     }
     SbxObject *pCopyObject = new SbxObject(*pObject);
-    rTypes->Insert (pCopyObject,rTypes->Count());
+    rTypes->Insert32 (pCopyObject,rTypes->Count32());
 }
 
 void SbiImage::AddEnum(SbxObject* pObject) // Register enum type
@@ -605,7 +607,7 @@ void SbiImage::AddEnum(SbxObject* pObject) // Register enum type
     {
         rEnums = new SbxArray;
     }
-    rEnums->Insert( pObject, rEnums->Count() );
+    rEnums->Insert32( pObject, rEnums->Count32() );
 }
 
 // Note: IDs start with 1
diff --git a/basic/source/classes/propacc.cxx b/basic/source/classes/propacc.cxx
index fbceb81ad7b1..1ec508567197 100644
--- a/basic/source/classes/propacc.cxx
+++ b/basic/source/classes/propacc.cxx
@@ -155,7 +155,7 @@ void RTL_Impl_CreatePropertySet( SbxArray& rPar )
 {
     // We need at least one parameter
     // TODO: In this case < 2 is not correct ;-)
-    if ( rPar.Count() < 2 )
+    if ( rPar.Count32() < 2 )
     {
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
         return;
@@ -165,11 +165,11 @@ void RTL_Impl_CreatePropertySet( SbxArray& rPar )
 
     Reference< XInterface > xInterface = static_cast<OWeakObject*>(new SbPropertyValues());
 
-    SbxVariableRef refVar = rPar.Get(0);
+    SbxVariableRef refVar = rPar.Get32(0);
     if( xInterface.is() )
     {
         // Set PropertyValues
-        Any aArgAsAny = sbxToUnoValue( rPar.Get(1),
+        Any aArgAsAny = sbxToUnoValue( rPar.Get32(1),
                 cppu::UnoType<Sequence<PropertyValue>>::get() );
         auto pArg = o3tl::doAccess<Sequence<PropertyValue>>(aArgAsAny);
         Reference< XPropertyAccess > xPropAcc( xInterface, UNO_QUERY );
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index dac4197c18f6..310bc293dfdb 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -553,11 +553,11 @@ SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj )
                 SbxDimArray* pDest = new SbxDimArray( pVar->GetType() );
 
                 pDest->setHasFixedSize( pSource && pSource->hasFixedSize() );
-                if ( pSource && pSource->GetDims() && pSource->hasFixedSize() )
+                if ( pSource && pSource->GetDims32() && pSource->hasFixedSize() )
                 {
                     sal_Int32 lb = 0;
                     sal_Int32 ub = 0;
-                    for ( sal_Int32 j = 1 ; j <= pSource->GetDims(); ++j )
+                    for ( sal_Int32 j = 1 ; j <= pSource->GetDims32(); ++j )
                     {
                         pSource->GetDim32( j, lb, ub );
                         pDest->AddDim32( lb, ub );
@@ -565,7 +565,7 @@ SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj )
                 }
                 else
                 {
-                    pDest->unoAddDim( 0, -1 ); // variant array
+                    pDest->unoAddDim32( 0, -1 ); // variant array
                 }
                 SbxFlagBits nSavFlags = pVar->GetFlags();
                 pNewProp->ResetFlag( SbxFlagBits::Fixed );
@@ -996,10 +996,10 @@ StarBASIC::~StarBASIC()
     // #100326 Set Parent NULL in registered listeners
     if( xUnoListeners.is() )
     {
-        sal_uInt16 uCount = xUnoListeners->Count();
-        for( sal_uInt16 i = 0 ; i < uCount ; i++ )
+        sal_uInt32 uCount = xUnoListeners->Count32();
+        for( sal_uInt32 i = 0 ; i < uCount ; i++ )
         {
-            SbxVariable* pListenerObj = xUnoListeners->Get( i );
+            SbxVariable* pListenerObj = xUnoListeners->Get32( i );
             pListenerObj->SetParent( nullptr );
         }
         xUnoListeners = nullptr;
@@ -1018,9 +1018,9 @@ void StarBASIC::implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic )
         }
     }
 
-    for( sal_uInt16 nObj = 0; nObj < pObjs->Count(); nObj++ )
+    for( sal_uInt32 nObj = 0; nObj < pObjs->Count32(); nObj++ )
     {
-        SbxVariable* pVar = pObjs->Get( nObj );
+        SbxVariable* pVar = pObjs->Get32( nObj );
         StarBASIC* pBasic = dynamic_cast<StarBASIC*>( pVar );
         if( pBasic && pBasic != pDeletedBasic )
         {
@@ -1225,9 +1225,9 @@ void StarBASIC::InitAllModules( StarBASIC const * pBasicNotToInit )
 
     // Check all objects if they are BASIC,
     // if yes initialize
-    for ( sal_uInt16 nObj = 0; nObj < pObjs->Count(); nObj++ )
+    for ( sal_uInt32 nObj = 0; nObj < pObjs->Count32(); nObj++ )
     {
-        SbxVariable* pVar = pObjs->Get( nObj );
+        SbxVariable* pVar = pObjs->Get32( nObj );
         StarBASIC* pBasic = dynamic_cast<StarBASIC*>( pVar );
         if( pBasic && pBasic != pBasicNotToInit )
         {
@@ -1249,9 +1249,9 @@ void StarBASIC::DeInitAllModules()
         }
     }
 
-    for ( sal_uInt16 nObj = 0; nObj < pObjs->Count(); nObj++ )
+    for ( sal_uInt32 nObj = 0; nObj < pObjs->Count32(); nObj++ )
     {
-        SbxVariable* pVar = pObjs->Get( nObj );
+        SbxVariable* pVar = pObjs->Get32( nObj );
         StarBASIC* pBasic = dynamic_cast<StarBASIC*>( pVar );
         if( pBasic )
         {
@@ -1793,13 +1793,13 @@ bool StarBASIC::LoadData( SvStream& r, sal_uInt16 nVer )
     }
     // #95459 Delete dialogs, otherwise endless recursion
     // in SbxVarable::GetType() if dialogs are accessed
-    sal_uInt16 nObjCount = pObjs->Count();
+    sal_uInt32 nObjCount = pObjs->Count32();
     std::unique_ptr<SbxVariable*[]> ppDeleteTab(new SbxVariable*[ nObjCount ]);
-    sal_uInt16 nObj;
+    sal_uInt32 nObj;
 
     for( nObj = 0 ; nObj < nObjCount ; nObj++ )
     {
-        SbxVariable* pVar = pObjs->Get( nObj );
+        SbxVariable* pVar = pObjs->Get32( nObj );
         StarBASIC* pBasic = dynamic_cast<StarBASIC*>( pVar  );
         ppDeleteTab[nObj] = pBasic ? nullptr : pVar;
     }
@@ -2103,24 +2103,24 @@ sal_Int32 BasicCollection::implGetIndexForName( const OUString& rName )
 
 void BasicCollection::CollAdd( SbxArray* pPar_ )
 {
-    sal_uInt16 nCount = pPar_->Count();
+    sal_uInt32 nCount = pPar_->Count32();
     if( nCount < 2 || nCount > 5 )
     {
         SetError( ERRCODE_BASIC_WRONG_ARGS );
         return;
     }
 
-    SbxVariable* pItem = pPar_->Get(1);
+    SbxVariable* pItem = pPar_->Get32(1);
     if( pItem )
     {
-        int nNextIndex;
+        sal_uInt32 nNextIndex;
         if( nCount < 4 )
         {
-            nNextIndex = xItemArray->Count();
+            nNextIndex = xItemArray->Count32();
         }
         else
         {
-            SbxVariable* pBefore = pPar_->Get(3);
+            SbxVariable* pBefore = pPar_->Get32(3);
             if( nCount == 5 )
             {
                 if( !( pBefore->IsErr() || ( pBefore->GetType() == SbxEMPTY ) ) )
@@ -2128,14 +2128,14 @@ void BasicCollection::CollAdd( SbxArray* pPar_ )
                     SetError( ERRCODE_BASIC_BAD_ARGUMENT );
                     return;
                 }
-                SbxVariable* pAfter = pPar_->Get(4);
+                SbxVariable* pAfter = pPar_->Get32(4);
                 sal_Int32 nAfterIndex = implGetIndex( pAfter );
                 if( nAfterIndex == -1 )
                 {
                     SetError( ERRCODE_BASIC_BAD_ARGUMENT );
                     return;
                 }
-                nNextIndex = nAfterIndex + 1;
+                nNextIndex = sal::static_int_cast<sal_uInt32>(nAfterIndex + 1);
             }
             else // if( nCount == 4 )
             {
@@ -2145,14 +2145,14 @@ void BasicCollection::CollAdd( SbxArray* pPar_ )
                     SetError( ERRCODE_BASIC_BAD_ARGUMENT );
                     return;
                 }
-                nNextIndex = nBeforeIndex;
+                nNextIndex = sal::static_int_cast<sal_uInt32>(nBeforeIndex);
             }
         }
 
         auto pNewItem = tools::make_ref<SbxVariable>( *pItem );
         if( nCount >= 3 )
         {
-            SbxVariable* pKey = pPar_->Get(2);
+            SbxVariable* pKey = pPar_->Get32(2);
             if( !( pKey->IsErr() || ( pKey->GetType() == SbxEMPTY ) ) )
             {
                 if( pKey->GetType() != SbxSTRING )
@@ -2181,13 +2181,13 @@ void BasicCollection::CollAdd( SbxArray* pPar_ )
 
 void BasicCollection::CollItem( SbxArray* pPar_ )
 {
-    if( pPar_->Count() != 2 )
+    if( pPar_->Count32() != 2 )
     {
         SetError( ERRCODE_BASIC_WRONG_ARGS );
         return;
     }
     SbxVariable* pRes = nullptr;
-    SbxVariable* p = pPar_->Get( 1 );
+    SbxVariable* p = pPar_->Get32( 1 );
     sal_Int32 nIndex = implGetIndex( p );
     if( nIndex >= 0 && nIndex < static_cast<sal_Int32>(xItemArray->Count32()) )
     {
@@ -2199,19 +2199,19 @@ void BasicCollection::CollItem( SbxArray* pPar_ )
     }
     else
     {
-        *(pPar_->Get(0)) = *pRes;
+        *(pPar_->Get32(0)) = *pRes;
     }
 }
 
 void BasicCollection::CollRemove( SbxArray* pPar_ )
 {
-    if( pPar_ == nullptr || pPar_->Count() != 2 )
+    if( pPar_ == nullptr || pPar_->Count32() != 2 )
     {
         SetError( ERRCODE_BASIC_WRONG_ARGS );
         return;
     }
 
-    SbxVariable* p = pPar_->Get( 1 );
+    SbxVariable* p = pPar_->Get32( 1 );
     sal_Int32 nIndex = implGetIndex( p );
     if( nIndex >= 0 && nIndex < static_cast<sal_Int32>(xItemArray->Count32()) )
     {
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index c8d9b7ec16fb..4b84fffe5ba8 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -782,7 +782,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
             }
             else
             {
-                xArray->unoAddDim( 0, -1 );
+                xArray->unoAddDim32( 0, -1 );
             }
 
             // return the Array
@@ -871,7 +871,7 @@ static Type getUnoTypeForSbxValue( const SbxValue* pVal )
 
         if( auto pArray = dynamic_cast<SbxDimArray*>( xObj.get() ) )
         {
-            short nDims = pArray->GetDims();
+            sal_Int32 nDims = pArray->GetDims32();
             Type aElementType = getUnoTypeForSbxBaseType( static_cast<SbxDataType>(pArray->GetType() & 0xfff) );
             TypeClass eElementTypeClass = aElementType.getTypeClass();
 
@@ -948,7 +948,7 @@ static Type getUnoTypeForSbxValue( const SbxValue* pVal )
                 }
 
                 OUStringBuffer aSeqTypeName;
-                for( short iDim = 0 ; iDim < nDims ; iDim++ )
+                for(sal_Int32 iDim = 0 ; iDim < nDims ; iDim++ )
                 {
                     aSeqTypeName.append(aSeqLevelStr);
                 }
@@ -1078,7 +1078,7 @@ static Any sbxToUnoValueImpl( const SbxValue* pVar, bool bBlockConversionToSmall
 
 // Helper function for StepREDIMP
 static Any implRekMultiDimArrayToSequence( SbxDimArray* pArray,
-    const Type& aElemType, short nMaxDimIndex, short nActualDim,
+    const Type& aElemType, sal_Int32 nMaxDimIndex, sal_Int32 nActualDim,
     sal_Int32* pActualIndices, sal_Int32* pLowerBounds, sal_Int32* pUpperBounds )
 {
     sal_Int32 nSeqLevel = nMaxDimIndex - nActualDim + 1;
@@ -1302,7 +1302,7 @@ Any sbxToUnoValue( const SbxValue* pVar, const Type& rType, Property const * pUn
             SbxBaseRef xObj = pVar->GetObject();
             if( auto pArray = dynamic_cast<SbxDimArray*>( xObj.get() ) )
             {
-                short nDims = pArray->GetDims();
+                sal_Int32 nDims = pArray->GetDims32();
 
                 // Normal case: One dimensional array
                 sal_Int32 nLower, nUpper;
@@ -1380,12 +1380,12 @@ Any sbxToUnoValue( const SbxValue* pVar, const Type& rType, Property const * pUn
                         std::unique_ptr<sal_Int32[]> pLowerBounds(new sal_Int32[nDims]);
                         std::unique_ptr<sal_Int32[]> pUpperBounds(new sal_Int32[nDims]);
                         std::unique_ptr<sal_Int32[]> pActualIndices(new sal_Int32[nDims]);
-                        for( short i = 1 ; i <= nDims ; i++ )
+                        for(sal_Int32 i = 1 ; i <= nDims ; i++ )
                         {
                             sal_Int32 lBound, uBound;
                             pArray->GetDim32( i, lBound, uBound );
 
-                            short j = i - 1;
+                            sal_Int32 j = i - 1;
                             pActualIndices[j] = pLowerBounds[j] = lBound;
                             pUpperBounds[j] = uBound;
                         }
@@ -1468,9 +1468,9 @@ static void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, s
         Any aValAny;
         for( i = 0 ; i < nParamCount ; i++ )
         {
-            sal_uInt16 iSbx = static_cast<sal_uInt16>(i+1);
+            sal_uInt32 iSbx = i + 1;
 
-            aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
+            aValAny = sbxToUnoValueImpl( pParams->Get32( iSbx ),
             bBlockConversionToSmallestType );
 
             OUString aParamName = pNames[iSbx];
@@ -1491,7 +1491,7 @@ static void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, s
     {
         for( i = 0 ; i < nParamCount ; i++ )
         {
-            pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( static_cast<sal_uInt16>(i+1) ),
+            pAnyArgs[i] = sbxToUnoValueImpl(pParams->Get32(i + 1),
             bBlockConversionToSmallestType );
         }
     }
@@ -1539,7 +1539,7 @@ static Any invokeAutomationMethod( const OUString& Name, Sequence< Any > const &
             sal_Int16 iTarget = pIndices[ j ];
             if( iTarget >= static_cast<sal_Int16>(nParamCount) )
                 break;
-            unoToSbxValue( pParams->Get( static_cast<sal_uInt16>(j+1) ), pNewValues[ j ] );
+            unoToSbxValue( pParams->Get32(j + 1), pNewValues[ j ] );
         }
     }
     return aRetAny;
@@ -1855,11 +1855,11 @@ static OUString Impl_DumpProperties(SbUnoObject& rUnoObj)
     const Property* pUnoProps = props.getConstArray();
 
     SbxArray* pProps = rUnoObj.GetProperties();
-    sal_uInt16 nPropCount = pProps->Count();
-    sal_uInt16 nPropsPerLine = 1 + nPropCount / 30;
-    for( sal_uInt16 i = 0; i < nPropCount; i++ )
+    sal_uInt32 nPropCount = pProps->Count32();
+    sal_uInt32 nPropsPerLine = 1 + nPropCount / 30;
+    for( sal_uInt32 i = 0; i < nPropCount; i++ )
     {
-        SbxVariable* pVar = pProps->Get( i );
+        SbxVariable* pVar = pProps->Get32( i );
         if( pVar )
         {
             OUStringBuffer aPropStr;
@@ -1931,16 +1931,16 @@ static OUString Impl_DumpMethods(SbUnoObject& rUnoObj)
     const Reference< XIdlMethod >* pUnoMethods = methods.getConstArray();
 
     SbxArray* pMethods = rUnoObj.GetMethods();
-    sal_uInt16 nMethodCount = pMethods->Count();
+    sal_uInt32 nMethodCount = pMethods->Count32();
     if( !nMethodCount )
     {
         aRet.append( "\nNo methods found\n" );
         return aRet.makeStringAndClear();
     }
-    sal_uInt16 nPropsPerLine = 1 + nMethodCount / 30;
-    for( sal_uInt16 i = 0; i < nMethodCount; i++ )
+    sal_uInt32 nPropsPerLine = 1 + nMethodCount / 30;
+    for( sal_uInt32 i = 0; i < nMethodCount; i++ )
     {
-        SbxVariable* pVar = pMethods->Get( i );
+        SbxVariable* pVar = pMethods->Get32( i );
         if( pVar )
         {
             if( (i % nPropsPerLine) == 0 )
@@ -2086,7 +2086,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
                 {
                     try
                     {
-                        sal_uInt32 nParamCount = pParams ? (static_cast<sal_uInt32>(pParams->Count()) - 1) : 0;
+                        sal_uInt32 nParamCount = pParams ? (pParams->Count32() - 1) : 0;
                         bool bCanBeConsideredAMethod = mxInvocation->hasMethod( pProp->GetName() );
                         Any aRetAny;
                         if ( bCanBeConsideredAMethod && nParamCount )
@@ -2172,7 +2172,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
             if( pHint->GetId() == SfxHintId::BasicDataWanted )
             {
                 // number of Parameter -1 because of Param0 == this
-                sal_uInt32 nParamCount = pParams ? (static_cast<sal_uInt32>(pParams->Count()) - 1) : 0;
+                sal_uInt32 nParamCount = pParams ? (pParams->Count32() - 1) : 0;
                 Sequence<Any> args;
                 bool bOutParams = false;
 
@@ -2224,7 +2224,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
                             css::uno::Type aType( rxClass->getTypeClass(), rxClass->getName() );
 
                             // ATTENTION: Don't forget for Sbx-Parameter the offset!
-                            pAnyArgs[i] = sbxToUnoValue( pParams->Get( static_cast<sal_uInt16>(i+1) ), aType );
+                            pAnyArgs[i] = sbxToUnoValue( pParams->Get32(i + 1), aType );
 
                             // If it is not certain check whether the out-parameter are available.
                             if( !bOutParams )
@@ -2267,7 +2267,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
                                 const ParamInfo& rInfo = pParamInfos[j];
                                 ParamMode aParamMode = rInfo.aMode;
                                 if( aParamMode != ParamMode_IN )
-                                    unoToSbxValue( pParams->Get( static_cast<sal_uInt16>(j+1) ), pAnyArgs[ j ] );
+                                    unoToSbxValue( pParams->Get32(j + 1), pAnyArgs[ j ] );
                             }
                         }
                     }
@@ -2922,14 +2922,14 @@ void createAllObjectProperties( SbxObject* pObj )
 void RTL_Impl_CreateUnoStruct( SbxArray& rPar )
 {
     // We need 1 parameter minimum
-    if ( rPar.Count() < 2 )
+    if ( rPar.Count32() < 2 )
     {
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
         return;
     }
 
     // get the name of the class of the struct
-    OUString aClassName = rPar.Get(1)->GetOUString();
+    OUString aClassName = rPar.Get32(1)->GetOUString();
 
     // try to create Struct with the same name
     SbUnoObjectRef xUnoObj = Impl_CreateUnoStruct( aClassName );
@@ -2938,21 +2938,21 @@ void RTL_Impl_CreateUnoStruct( SbxArray& rPar )
         return;
     }
     // return the object
-    SbxVariableRef refVar = rPar.Get(0);
+    SbxVariableRef refVar = rPar.Get32(0);
     refVar->PutObject( xUnoObj.get() );
 }
 
 void RTL_Impl_CreateUnoService( SbxArray& rPar )
 {
     // We need 1 Parameter minimum
-    if ( rPar.Count() < 2 )
+    if ( rPar.Count32() < 2 )
     {
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
         return;
     }
 
     // get the name of the class of the struct
-    OUString aServiceName = rPar.Get(1)->GetOUString();
+    OUString aServiceName = rPar.Get32(1)->GetOUString();
 
     // search for the service and instantiate it
     Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() );
@@ -2966,7 +2966,7 @@ void RTL_Impl_CreateUnoService( SbxArray& rPar )
         implHandleAnyException( ::cppu::getCaughtException() );
     }
 
-    SbxVariableRef refVar = rPar.Get(0);
+    SbxVariableRef refVar = rPar.Get32(0);
     if( xInterface.is() )
     {
         // Create a SbUnoObject out of it and return it
@@ -2990,15 +2990,15 @@ void RTL_Impl_CreateUnoService( SbxArray& rPar )
 void RTL_Impl_CreateUnoServiceWithArguments( SbxArray& rPar )
 {
     // We need 2 parameter minimum
-    if ( rPar.Count() < 3 )
+    if ( rPar.Count32() < 3 )
     {
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
         return;
     }
 
     // get the name of the class of the struct
-    OUString aServiceName = rPar.Get(1)->GetOUString();
-    Any aArgAsAny = sbxToUnoValue( rPar.Get(2),
+    OUString aServiceName = rPar.Get32(1)->GetOUString();
+    Any aArgAsAny = sbxToUnoValue( rPar.Get32(2),
                 cppu::UnoType<Sequence<Any>>::get() );
     Sequence< Any > aArgs;
     aArgAsAny >>= aArgs;
@@ -3015,7 +3015,7 @@ void RTL_Impl_CreateUnoServiceWithArguments( SbxArray& rPar )
         implHandleAnyException( ::cppu::getCaughtException() );
     }
 
-    SbxVariableRef refVar = rPar.Get(0);
+    SbxVariableRef refVar = rPar.Get32(0);
     if( xInterface.is() )
     {
         // Create a SbUnoObject out of it and return it
@@ -3038,7 +3038,7 @@ void RTL_Impl_CreateUnoServiceWithArguments( SbxArray& rPar )
 
 void RTL_Impl_GetProcessServiceManager( SbxArray& rPar )
 {
-    SbxVariableRef refVar = rPar.Get(0);
+    SbxVariableRef refVar = rPar.Get32(0);
 
     // get the global service manager
     Reference< XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory() );
@@ -3051,7 +3051,7 @@ void RTL_Impl_GetProcessServiceManager( SbxArray& rPar )
 void RTL_Impl_HasInterfaces( SbxArray& rPar )
 {
     // We need 2 parameter minimum
-    sal_uInt16 nParCount = rPar.Count();
+    sal_uInt32 nParCount = rPar.Count32();
     if( nParCount < 3 )
     {
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
@@ -3059,11 +3059,11 @@ void RTL_Impl_HasInterfaces( SbxArray& rPar )
     }
 
     // variable for the return value
-    SbxVariableRef refVar = rPar.Get(0);
+    SbxVariableRef refVar = rPar.Get32(0);
     refVar->PutBool( false );
 
     // get the Uno-Object
-    SbxBaseRef pObj = rPar.Get( 1 )->GetObject();
+    SbxBaseRef pObj = rPar.Get32( 1 )->GetObject();
     auto obj = dynamic_cast<SbUnoObject*>( pObj.get() );
     if( obj == nullptr )
     {
@@ -3082,10 +3082,10 @@ void RTL_Impl_HasInterfaces( SbxArray& rPar )
     {
         return;
     }
-    for( sal_uInt16 i = 2 ; i < nParCount ; i++ )
+    for( sal_uInt32 i = 2 ; i < nParCount ; i++ )
     {
         // get the name of the interface of the struct
-        OUString aIfaceName = rPar.Get( i )->GetOUString();
+        OUString aIfaceName = rPar.Get32( i )->GetOUString();
 
         // search for the class
         Reference< XIdlClass > xClass = xCoreReflection->forName( aIfaceName );
@@ -3109,23 +3109,23 @@ void RTL_Impl_HasInterfaces( SbxArray& rPar )
 void RTL_Impl_IsUnoStruct( SbxArray& rPar )
 {
     // We need 1 parameter minimum
-    if ( rPar.Count() < 2 )
+    if ( rPar.Count32() < 2 )
     {
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
         return;
     }
 
     // variable for the return value
-    SbxVariableRef refVar = rPar.Get(0);
+    SbxVariableRef refVar = rPar.Get32(0);
     refVar->PutBool( false );
 
     // get the Uno-Object
-    SbxVariableRef xParam = rPar.Get( 1 );
+    SbxVariableRef xParam = rPar.Get32( 1 );
     if( !xParam->IsObject() )
     {
         return;
     }
-    SbxBaseRef pObj = rPar.Get( 1 )->GetObject();
+    SbxBaseRef pObj = xParam->GetObject();
     auto obj = dynamic_cast<SbUnoObject*>( pObj.get() );
     if( obj == nullptr )
     {
@@ -3142,18 +3142,18 @@ void RTL_Impl_IsUnoStruct( SbxArray& rPar )
 
 void RTL_Impl_EqualUnoObjects( SbxArray& rPar )
 {
-    if ( rPar.Count() < 3 )
+    if ( rPar.Count32() < 3 )
     {
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
         return;
     }
 
     // variable for the return value
-    SbxVariableRef refVar = rPar.Get(0);
+    SbxVariableRef refVar = rPar.Get32(0);
     refVar->PutBool( false );
 
     // get the Uno-Objects
-    SbxVariableRef xParam1 = rPar.Get( 1 );
+    SbxVariableRef xParam1 = rPar.Get32( 1 );
     if( !xParam1->IsObject() )
     {
         return;
@@ -3173,7 +3173,7 @@ void RTL_Impl_EqualUnoObjects( SbxArray& rPar )
     Reference< XInterface > x1;
     aAny1 >>= x1;
 
-    SbxVariableRef xParam2 = rPar.Get( 2 );
+    SbxVariableRef xParam2 = rPar.Get32( 2 );
     if( !xParam2->IsObject() )
     {
         return;
@@ -3540,7 +3540,7 @@ void SbUnoService::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
         if( pUnoCtor && pHint->GetId() == SfxHintId::BasicDataWanted )
         {
             // Parameter count -1 because of Param0 == this
-            sal_uInt32 nParamCount = pParams ? (static_cast<sal_uInt32>(pParams->Count()) - 1) : 0;
+            sal_uInt32 nParamCount = pParams ? (pParams->Count32() - 1) : 0;
             Sequence<Any> args;
 
             Reference< XServiceConstructorDescription > xCtor = pUnoCtor->getServiceCtorDesc();
@@ -3564,14 +3564,14 @@ void SbUnoService::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
             }
 
             // Too many parameters with context as first parameter?
-            sal_uInt16 nSbxParameterOffset = 1;
-            sal_uInt16 nParameterOffsetByContext = 0;
+            sal_uInt32 nSbxParameterOffset = 1;
+            sal_uInt32 nParameterOffsetByContext = 0;
             Reference < XComponentContext > xFirstParamContext;
             if( nParamCount > nUnoParamCount )
             {
                 // Check if first parameter is a context and use it
                 // then in createInstanceWithArgumentsAndContext
-                Any aArg0 = sbxToUnoValue( pParams->Get( nSbxParameterOffset ) );
+                Any aArg0 = sbxToUnoValue( pParams->Get32( nSbxParameterOffset ) );
                 if( (aArg0 >>= xFirstParamContext) && xFirstParamContext.is() )
                     nParameterOffsetByContext = 1;
             }
@@ -3607,7 +3607,7 @@ void SbUnoService::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
                     Any* pAnyArgs = args.getArray();
                     for( sal_uInt32 i = 0 ; i < nEffectiveParamCount ; i++ )
                     {
-                        sal_uInt16 iSbx = static_cast<sal_uInt16>(i + nSbxParameterOffset + nParameterOffsetByContext);
+                        sal_uInt32 iSbx = i + nSbxParameterOffset + nParameterOffsetByContext;
 
                         // bRestParameterMode allows nEffectiveParamCount > nUnoParamCount
                         Reference< XParameter > xParam;
@@ -3623,7 +3623,7 @@ void SbUnoService::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
                             css::uno::Type aType( xParamTypeDesc->getTypeClass(), xParamTypeDesc->getName() );
 
                             // sbx parameter needs offset 1
-                            pAnyArgs[i] = sbxToUnoValue( pParams->Get( iSbx ), aType );
+                            pAnyArgs[i] = sbxToUnoValue( pParams->Get32( iSbx ), aType );
 
                             // Check for out parameter if not already done
                             if( !bOutParams && xParam->isOut() )
@@ -3631,7 +3631,7 @@ void SbUnoService::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
                         }
                         else
                         {
-                            pAnyArgs[i] = sbxToUnoValue( pParams->Get( iSbx ) );
+                            pAnyArgs[i] = sbxToUnoValue( pParams->Get32( iSbx ) );
                         }
                     }
                 }
@@ -3669,7 +3669,7 @@ void SbUnoService::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
                             continue;
 
                         if( xParam->isOut() )
-                            unoToSbxValue( pParams->Get( static_cast<sal_uInt16>(j+1) ), pAnyArgs[ j ] );
+                            unoToSbxValue( pParams->Get32(j + 1), pAnyArgs[ j ] );
                     }
                 }
             }
@@ -3737,7 +3737,7 @@ void SbUnoSingleton::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
     {
         SbxVariable* pVar = pHint->GetVar();
         SbxArray* pParams = pVar->GetParameters();
-        sal_uInt32 nParamCount = pParams ? (static_cast<sal_uInt32>(pParams->Count()) - 1) : 0;
+        sal_uInt32 nParamCount = pParams ? (pParams->Count32() - 1) : 0;
         sal_uInt32 nAllowedParamCount = 1;
 
         Reference < XComponentContext > xContextToUse;
@@ -3745,7 +3745,7 @@ void SbUnoSingleton::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
         {
             // Check if first parameter is a context and use it then
             Reference < XComponentContext > xFirstParamContext;
-            Any aArg1 = sbxToUnoValue( pParams->Get( 1 ) );
+            Any aArg1 = sbxToUnoValue( pParams->Get32( 1 ) );
             if( (aArg1 >>= xFirstParamContext) && xFirstParamContext.is() )
                 xContextToUse = xFirstParamContext;
         }
@@ -3832,7 +3832,7 @@ void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet
                     // Convert elements
                     SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
                     unoToSbxValue( xVar.get(), pArgs[i] );
-                    xSbxArray->Put( xVar.get(), sal::static_int_cast< sal_uInt16 >(i+1) );
+                    xSbxArray->Put32( xVar.get(), i + 1 );
                 }
 
                 pLib->Call( aMethodName, xSbxArray.get() );
@@ -3840,7 +3840,7 @@ void BasicAllListener_Impl::firing_impl( const AllEventObject& Event, Any* pRet
                 // get the return value from the Param-Array, if requested
                 if( pRet )
                 {
-                    SbxVariable* pVar = xSbxArray->Get( 0 );
+                    SbxVariable* pVar = xSbxArray->Get32( 0 );
                     if( pVar )
                     {
                         // #95792 Avoid a second call
@@ -4025,15 +4025,15 @@ sal_Bool SAL_CALL InvocationToAllListenerMapper::hasProperty(const OUString& Nam
 void SbRtl_CreateUnoListener(StarBASIC * pBasic, SbxArray & rPar, bool)
 {
     // We need 2 parameters
-    if ( rPar.Count() != 3 )
+    if ( rPar.Count32() != 3 )
     {
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
         return;
     }
 
     // get the name of the class of the struct
-    OUString aPrefixName = rPar.Get(1)->GetOUString();
-    OUString aListenerClassName = rPar.Get(2)->GetOUString();
+    OUString aPrefixName = rPar.Get32(1)->GetOUString();
+    OUString aListenerClassName = rPar.Get32(2)->GetOUString();
 
     // get the CoreReflection
     Reference< XIdlReflection > xCoreReflection = getCoreReflection_Impl();
@@ -4071,10 +4071,10 @@ void SbRtl_CreateUnoListener(StarBASIC * pBasic, SbxArray & rPar, bool)
 
     // #100326 Register listener object to set Parent NULL in Dtor
     SbxArrayRef xBasicUnoListeners = pBasic->getUnoListeners();
-    xBasicUnoListeners->Insert( pUnoObj, xBasicUnoListeners->Count() );
+    xBasicUnoListeners->Insert32( pUnoObj, xBasicUnoListeners->Count32() );
 
     // return the object
-    SbxVariableRef refVar = rPar.Get(0);
+    SbxVariableRef refVar = rPar.Get32(0);
     refVar->PutObject( p->xSbxObj.get() );
 }
 
@@ -4083,7 +4083,7 @@ void SbRtl_CreateUnoListener(StarBASIC * pBasic, SbxArray & rPar, bool)
 // in the Basic runtime system.
 void RTL_Impl_GetDefaultContext( SbxArray& rPar )
 {
-    SbxVariableRef refVar = rPar.Get(0);
+    SbxVariableRef refVar = rPar.Get32(0);
 
     Any aContextAny( comphelper::getProcessComponentContext() );
 
@@ -4097,15 +4097,15 @@ void RTL_Impl_GetDefaultContext( SbxArray& rPar )
 void RTL_Impl_CreateUnoValue( SbxArray& rPar )
 {
     // 2 parameters needed
-    if ( rPar.Count() != 3 )
+    if ( rPar.Count32() != 3 )
     {
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
         return;
     }
 
     // get the name of the class of the struct
-    OUString aTypeName = rPar.Get(1)->GetOUString();
-    SbxVariable* pVal = rPar.Get(2);
+    OUString aTypeName = rPar.Get32(1)->GetOUString();
+    SbxVariable* pVal = rPar.Get32(2);
 
     if( aTypeName == "type" )
     {
@@ -4137,7 +4137,7 @@ void RTL_Impl_CreateUnoValue( SbxArray& rPar )
         if( bSuccess )
         {
             Any aTypeAny( aType );
-            SbxVariableRef refVar = rPar.Get(0);
+            SbxVariableRef refVar = rPar.Get32(0);
             SbxObjectRef xUnoAnyObject = new SbUnoAnyObject( aTypeAny );
             refVar->PutObject( xUnoAnyObject.get() );
         }
@@ -4167,7 +4167,7 @@ void RTL_Impl_CreateUnoValue( SbxArray& rPar )
     Any aVal = sbxToUnoValueImpl( pVal );
     Any aConvertedVal = convertAny( aVal, aDestType );
 
-    SbxVariableRef refVar = rPar.Get(0);
+    SbxVariableRef refVar = rPar.Get32(0);
     SbxObjectRef xUnoAnyObject = new SbUnoAnyObject( aConvertedVal );
     refVar->PutObject( xUnoAnyObject.get() );
 }
@@ -4244,7 +4244,7 @@ void SAL_CALL ModuleInvocationProxy::setValue(const OUString& rProperty, const A
     SbxArrayRef xArray = new SbxArray;
     SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
     unoToSbxValue( xVar.get(), rValue );
-    xArray->Put( xVar.get(), 1 );
+    xArray->Put32( xVar.get(), 1 );
 
     // Call property method
     SbxVariableRef xValue = new SbxVariable;
@@ -4344,7 +4344,7 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const OUString& rFunction,
         {
             SbxVariableRef xVar = new SbxVariable( SbxVARIANT );
             unoToSbxValue( xVar.get(), pArgs[i] );
-            xArray->Put( xVar.get(), sal::static_int_cast< sal_uInt16 >(i+1) );
+            xArray->Put32( xVar.get(), sal::static_int_cast< sal_uInt16 >(i+1) );
         }
     }
 
@@ -4467,7 +4467,7 @@ void registerComListenerVariableForBasic( SbxVariable* pVar, StarBASIC* pBasic )
 {
     StarBasicDisposeItem* pItem = lcl_getOrCreateItemForBasic( pBasic );
     SbxArray* pArray = pItem->m_pRegisteredVariables.get();
-    pArray->Put( pVar, pArray->Count() );
+    pArray->Put32( pVar, pArray->Count32() );
 }
 
 void disposeComVariablesForBasic( StarBASIC const * pBasic )
@@ -4478,10 +4478,10 @@ void disposeComVariablesForBasic( StarBASIC const * pBasic )
         StarBasicDisposeItem* pItem = *it;
 
         SbxArray* pArray = pItem->m_pRegisteredVariables.get();
-        sal_uInt16 nCount = pArray->Count();
-        for( sal_uInt16 i = 0 ; i < nCount ; ++i )
+        sal_uInt32 nCount = pArray->Count32();
+        for( sal_uInt32 i = 0 ; i < nCount ; ++i )
         {
-            SbxVariable* pVar = pArray->Get( i );
+            SbxVariable* pVar = pArray->Get32( i );
             pVar->ClearComListener();
         }
 
@@ -4519,10 +4519,10 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
     bool bSuccess = false;
 
     SbxArray* pModIfaces = pClassData->mxIfaces.get();
-    sal_uInt16 nCount = pModIfaces->Count();
-    for( sal_uInt16 i = 0 ; i < nCount ; ++i )
+    sal_uInt32 nCount = pModIfaces->Count32();
+    for( sal_uInt32 i = 0 ; i < nCount ; ++i )
     {
-        SbxVariable* pVar = pModIfaces->Get( i );
+        SbxVariable* pVar = pModIfaces->Get32( i );
         const OUString& aIfaceName = pVar->GetName();
 
         if( !aIfaceName.isEmpty() )
@@ -4775,11 +4775,11 @@ OUString SbUnoStructRefObject::Impl_DumpProperties()
     aRet.append("Properties of object ");
     aRet.append( getDbgObjectName() );
 
-    sal_uInt16 nPropCount = pProps->Count();
-    sal_uInt16 nPropsPerLine = 1 + nPropCount / 30;
-    for( sal_uInt16 i = 0; i < nPropCount; i++ )
+    sal_uInt32 nPropCount = pProps->Count32();
+    sal_uInt32 nPropsPerLine = 1 + nPropCount / 30;
+    for( sal_uInt32 i = 0; i < nPropCount; i++ )
     {
-        SbxVariable* pVar = pProps->Get( i );
+        SbxVariable* pVar = pProps->Get32( i );
         if( pVar )
         {
             OUStringBuffer aPropStr;
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index ee0123710e3c..c1e34eb8b7b1 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -229,7 +229,7 @@ DocObjectWrapper::invoke( const OUString& aFunctionName, const Sequence< Any >&
         {
             SbxVariableRef xSbxVar = new SbxVariable( SbxVARIANT );
             unoToSbxValue( xSbxVar.get(), pParams[i] );
-            xSbxParams->Put( xSbxVar.get(), static_cast< sal_uInt16 >( i ) + 1 );
+            xSbxParams->Put32( xSbxVar.get(), static_cast< sal_uInt32 >( i ) + 1 );
 
             // Enable passing by ref
             if ( xSbxVar->GetType() != SbxVARIANT )
@@ -251,12 +251,13 @@ DocObjectWrapper::invoke( const OUString& aFunctionName, const Sequence< Any >&
         if ( pInfo_ )
         {
             OutParamMap aOutParamMap;
-            for ( sal_uInt16 n = 1, nCount = xSbxParams->Count(); n < nCount; ++n )
+            for ( sal_uInt32 n = 1, nCount = xSbxParams->Count32(); n < nCount; ++n )
             {
-                const SbxParamInfo* pParamInfo = pInfo_->GetParam( n );
+                assert(n <= std::numeric_limits<sal_uInt16>::max());
+                const SbxParamInfo* pParamInfo = pInfo_->GetParam( sal::static_int_cast<sal_uInt16>(n) );
                 if ( pParamInfo && ( pParamInfo->eType & SbxBYREF ) != 0 )
                 {
-                    SbxVariable* pVar = xSbxParams->Get( n );
+                    SbxVariable* pVar = xSbxParams->Get32( n );
                     if ( pVar )
                     {
                         SbxVariableRef xVar = pVar;
@@ -470,16 +471,16 @@ void SbModule::StartDefinitions()
 
     // methods and properties persist, but they are invalid;
     // at least are the information under certain conditions clogged
-    sal_uInt16 i;
-    for( i = 0; i < pMethods->Count(); i++ )
+    sal_uInt32 i;
+    for( i = 0; i < pMethods->Count32(); i++ )
     {
-        SbMethod* p = dynamic_cast<SbMethod*>( pMethods->Get( i )  );
+        SbMethod* p = dynamic_cast<SbMethod*>( pMethods->Get32( i )  );
         if( p )
             p->bInvalid = true;
     }
-    for( i = 0; i < pProps->Count(); )
+    for( i = 0; i < pProps->Count32(); )
     {
-        SbProperty* p = dynamic_cast<SbProperty*>( pProps->Get( i )  );
+        SbProperty* p = dynamic_cast<SbProperty*>( pProps->Get32( i )  );
         if( p )
             pProps->Remove( i );
         else
@@ -502,7 +503,7 @@ SbMethod* SbModule::GetMethod( const OUString& rName, SbxDataType t )
         pMeth = new SbMethod( rName, t, this );
         pMeth->SetParent( this );
         pMeth->SetFlags( SbxFlagBits::Read );
-        pMethods->Put( pMeth, pMethods->Count() );
+        pMethods->Put32( pMeth, pMethods->Count32() );
         StartListening(pMeth->GetBroadcaster(), DuplicateHandling::Prevent);
     }
     // The method is per default valid, because it could be
@@ -540,7 +541,7 @@ SbProperty* SbModule::GetProperty( const OUString& rName, SbxDataType t )
         pProp = new SbProperty( rName, t, this );
         pProp->SetFlag( SbxFlagBits::ReadWrite );
         pProp->SetParent( this );
-        pProps->Put( pProp, pProps->Count() );
+        pProps->Put32( pProp, pProps->Count32() );
         StartListening(pProp->GetBroadcaster(), DuplicateHandling::Prevent);
     }
     return pProp;
@@ -559,7 +560,7 @@ void SbModule::GetProcedureProperty( const OUString& rName, SbxDataType t )
         pProp = new SbProcedureProperty( rName, t );
         pProp->SetFlag( SbxFlagBits::ReadWrite );
         pProp->SetParent( this );
-        pProps->Put( pProp, pProps->Count() );
+        pProps->Put32( pProp, pProps->Count32() );
         StartListening(pProp->GetBroadcaster(), DuplicateHandling::Prevent);
     }
 }
@@ -577,7 +578,7 @@ void SbModule::GetIfaceMapperMethod( const OUString& rName, SbMethod* pImplMeth
         pMapperMethod = new SbIfaceMapperMethod( rName, pImplMeth );
         pMapperMethod->SetParent( this );
         pMapperMethod->SetFlags( SbxFlagBits::Read );
-        pMethods->Put( pMapperMethod, pMethods->Count() );
+        pMethods->Put32( pMapperMethod, pMethods->Count32() );
     }
     pMapperMethod->bInvalid = false;
 }
@@ -591,9 +592,9 @@ SbIfaceMapperMethod::~SbIfaceMapperMethod()
 
 void SbModule::EndDefinitions( bool bNewState )
 {
-    for( sal_uInt16 i = 0; i < pMethods->Count(); )
+    for( sal_uInt32 i = 0; i < pMethods->Count32(); )
     {
-        SbMethod* p = dynamic_cast<SbMethod*>( pMethods->Get( i )  );
+        SbMethod* p = dynamic_cast<SbMethod*>( pMethods->Get32( i )  );
         if( p )
         {
             if( p->bInvalid )
@@ -699,15 +700,15 @@ void SbModule::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
                     aVals.eType = SbxVARIANT;
 
                     SbxArray* pArg = pVar->GetParameters();
-                    sal_uInt16 nVarParCount = (pArg != nullptr) ? pArg->Count() : 0;
+                    sal_uInt32 nVarParCount = (pArg != nullptr) ? pArg->Count32() : 0;
                     if( nVarParCount > 1 )
                     {
                         auto xMethParameters = tools::make_ref<SbxArray>();
-                        xMethParameters->Put( pMethVar, 0 );    // Method as parameter 0
-                        for( sal_uInt16 i = 1 ; i < nVarParCount ; ++i )
+                        xMethParameters->Put32( pMethVar, 0 );    // Method as parameter 0
+                        for( sal_uInt32 i = 1 ; i < nVarParCount ; ++i )
                         {
-                            SbxVariable* pPar = pArg->Get( i );
-                            xMethParameters->Put( pPar, i );
+                            SbxVariable* pPar = pArg->Get32( i );
+                            xMethParameters->Put32( pPar, i );
                         }
 
                         pMethVar->SetParameters( xMethParameters.get() );
@@ -746,8 +747,8 @@ void SbModule::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
                 {
                     // Setup parameters
                     SbxArrayRef xArray = new SbxArray;
-                    xArray->Put( pMethVar, 0 ); // Method as parameter 0
-                    xArray->Put( pVar, 1 );
+                    xArray->Put32( pMethVar, 0 ); // Method as parameter 0
+                    xArray->Put32( pVar, 1 );
                     pMethVar->SetParameters( xArray.get() );
 
                     SbxValues aVals;
@@ -905,9 +906,9 @@ static void SendHint_( SbxObject* pObj, SfxHintId nId, SbMethod* p )
         pObj->GetBroadcaster().Broadcast( SbxHint( nId, p ) );
     // Then ask for the subobjects
     SbxArray* pObjs = pObj->GetObjects();
-    for( sal_uInt16 i = 0; i < pObjs->Count(); i++ )
+    for( sal_uInt32 i = 0; i < pObjs->Count32(); i++ )
     {
-        SbxVariable* pVar = pObjs->Get( i );
+        SbxVariable* pVar = pObjs->Get32( i );
         if( dynamic_cast<const SbxObject *>(pVar) != nullptr )
             SendHint_( dynamic_cast<SbxObject*>( pVar), nId, p  );
     }
@@ -950,10 +951,10 @@ static void ClearUnoObjectsInRTL_Impl_Rek( StarBASIC* pBasic )
     }
     // Go over all Sub-Basics
     SbxArray* pObjs = pBasic->GetObjects();
-    sal_uInt16 nCount = pObjs->Count();
-    for( sal_uInt16 i = 0 ; i < nCount ; i++ )
+    sal_uInt32 nCount = pObjs->Count32();
+    for( sal_uInt32 i = 0 ; i < nCount ; i++ )
     {
-        SbxVariable* pObjVar = pObjs->Get( i );
+        SbxVariable* pObjVar = pObjs->Get32( i );
         StarBASIC* pSubBasic = dynamic_cast<StarBASIC*>( pObjVar  );
         if( pSubBasic )
         {
@@ -1297,9 +1298,9 @@ void SbModule::RemoveVars()
 
 void SbModule::ClearPrivateVars()
 {
-    for( sal_uInt16 i = 0 ; i < pProps->Count() ; i++ )
+    for( sal_uInt32 i = 0 ; i < pProps->Count32() ; i++ )
     {
-        SbProperty* p = dynamic_cast<SbProperty*>( pProps->Get( i )  );
+        SbProperty* p = dynamic_cast<SbProperty*>( pProps->Get32( i )  );
         if( p )
         {
             // Delete not the arrays, only their content
@@ -1308,9 +1309,9 @@ void SbModule::ClearPrivateVars()
                 SbxArray* pArray = dynamic_cast<SbxArray*>( p->GetObject() );
                 if( pArray )
                 {
-                    for( sal_uInt16 j = 0 ; j < pArray->Count() ; j++ )
+                    for( sal_uInt32 j = 0 ; j < pArray->Count32() ; j++ )
                     {
-                        SbxVariable* pj = pArray->Get( j );
+                        SbxVariable* pj = pArray->Get32( j );
                         pj->SbxValue::Clear();
                     }
                 }
@@ -1351,9 +1352,9 @@ void SbModule::implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC
 
 void SbModule::ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic )
 {
-    for( sal_uInt16 i = 0 ; i < pProps->Count() ; i++ )
+    for( sal_uInt32 i = 0 ; i < pProps->Count32() ; i++ )
     {
-        SbProperty* p = dynamic_cast<SbProperty*>( pProps->Get( i )  );
+        SbProperty* p = dynamic_cast<SbProperty*>( pProps->Get32( i )  );
         if( p )
         {
             if( p->GetType() & SbxARRAY )
@@ -1361,9 +1362,9 @@ void SbModule::ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic )
                 SbxArray* pArray = dynamic_cast<SbxArray*>( p->GetObject() );
                 if( pArray )
                 {
-                    for( sal_uInt16 j = 0 ; j < pArray->Count() ; j++ )
+                    for( sal_uInt32 j = 0 ; j < pArray->Count32() ; j++ )
                     {
-                        SbxVariable* pVar = pArray->Get( j );
+                        SbxVariable* pVar = pArray->Get32( j );
                         implClearIfVarDependsOnDeletedBasic( pVar, pDeletedBasic );
                     }
                 }
@@ -1577,9 +1578,9 @@ SbModule::fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg ) const
 {
         if ( !pImg )
             pImg = pImage;
-        for( sal_uInt32 i = 0; i < pMethods->Count(); i++ )
+        for( sal_uInt32 i = 0; i < pMethods->Count32(); i++ )
         {
-            SbMethod* pMeth = dynamic_cast<SbMethod*>( pMethods->Get( static_cast<sal_uInt16>(i) )  );
+            SbMethod* pMeth = dynamic_cast<SbMethod*>( pMethods->Get32(i)  );
             if( pMeth )
             {
                 //fixup method start positions
@@ -1802,17 +1803,17 @@ void SbModule::LoadBinaryData( SvStream& rStrm )
 bool SbModule::LoadCompleted()
 {
     SbxArray* p = GetMethods().get();
-    sal_uInt16 i;
-    for( i = 0; i < p->Count(); i++ )
+    sal_uInt32 i;
+    for( i = 0; i < p->Count32(); i++ )
     {
-        SbMethod* q = dynamic_cast<SbMethod*>( p->Get( i )  );
+        SbMethod* q = dynamic_cast<SbMethod*>( p->Get32( i )  );
         if( q )
             q->pMod = this;
     }
     p = GetProperties();
-    for( i = 0; i < p->Count(); i++ )
+    for( i = 0; i < p->Count32(); i++ )
     {
-        SbProperty* q = dynamic_cast<SbProperty*>( p->Get( i )  );
+        SbProperty* q = dynamic_cast<SbProperty*>( p->Get32( i )  );
         if( q )
             q->pMod = this;
     }
@@ -1844,15 +1845,15 @@ void SbModule::handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rH
                     aVals.eType = SbxVARIANT;
 
                     SbxArray* pArg = pVar->GetParameters();
-                    sal_uInt16 nVarParCount = (pArg != nullptr) ? pArg->Count() : 0;
+                    sal_uInt32 nVarParCount = (pArg != nullptr) ? pArg->Count32() : 0;
                     if( nVarParCount > 1 )
                     {
                         SbxArrayRef xMethParameters = new SbxArray;
-                        xMethParameters->Put( pMeth, 0 );   // Method as parameter 0
-                        for( sal_uInt16 i = 1 ; i < nVarParCount ; ++i )
+                        xMethParameters->Put32( pMeth, 0 );   // Method as parameter 0
+                        for( sal_uInt32 i = 1 ; i < nVarParCount ; ++i )
                         {
-                            SbxVariable* pPar = pArg->Get( i );
-                            xMethParameters->Put( pPar, i );
+                            SbxVariable* pPar = pArg->Get32( i );
+                            xMethParameters->Put32( pPar, i );
                         }
 
                         pMeth->SetParameters( xMethParameters.get() );
@@ -1891,8 +1892,8 @@ void SbModule::handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rH
                 {
                     // Setup parameters
                     SbxArrayRef xArray = new SbxArray;
-                    xArray->Put( pMeth, 0 );    // Method as parameter 0
-                    xArray->Put( pVar, 1 );
+                    xArray->Put32( pMeth, 0 );    // Method as parameter 0
+                    xArray->Put32( pVar, 1 );
                     pMeth->SetParameters( xArray.get() );
 
                     SbxValues aVals;
@@ -2441,13 +2442,13 @@ void SbUserFormModule::triggerMethod( const OUString& aMethodToRun, Sequence< An
         if ( aArguments.hasElements() )   // Setup parameters
         {
             auto xArray = tools::make_ref<SbxArray>();
-            xArray->Put( pMeth, 0 );    // Method as parameter 0
+            xArray->Put32( pMeth, 0 );    // Method as parameter 0
 
             for ( sal_Int32 i = 0; i < aArguments.getLength(); ++i )
             {
                 auto xSbxVar = tools::make_ref<SbxVariable>( SbxVARIANT );
                 unoToSbxValue( xSbxVar.get(), aArguments[i] );
-                xArray->Put( xSbxVar.get(), static_cast< sal_uInt16 >( i ) + 1 );
+                xArray->Put32( xSbxVar.get(), static_cast< sal_uInt32 >( i ) + 1 );
 
                 // Enable passing by ref
                 if ( xSbxVar->GetType() != SbxVARIANT )
@@ -2460,7 +2461,7 @@ void SbUserFormModule::triggerMethod( const OUString& aMethodToRun, Sequence< An
 
             for ( sal_Int32 i = 0; i < aArguments.getLength(); ++i )
             {
-                aArguments[i] = sbxToUnoValue( xArray->Get( static_cast< sal_uInt16 >(i) + 1) );
+                aArguments[i] = sbxToUnoValue( xArray->Get32( static_cast< sal_uInt32 >(i) + 1) );
             }
             pMeth->SetParameters( nullptr );
         }
diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index f36ab61f7cf1..58e0e59c3b3e 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -165,7 +165,7 @@ void SbiCodeGen::Save()
                 SbxVariable* pIfaceVar = new SbxVariable( SbxVARIANT );
                 pIfaceVar->SetName( rIfaceName );
                 SbxArray* pIfaces = rMod.pClassData->mxIfaces.get();
-                pIfaces->Insert( pIfaceVar, pIfaces->Count() );
+                pIfaces->Insert32( pIfaceVar, pIfaces->Count32() );
             }
         }
 
@@ -362,22 +362,22 @@ void SbiCodeGen::Save()
     SbiStringPool* pPool = &pParser->aGblStrings;
     sal_uInt16 nSize = pPool->GetSize();
     p->MakeStrings( nSize );
-    sal_uInt16 i;
+    sal_uInt32 i;
     for( i = 1; i <= nSize; i++ )
     {
         p->AddString( pPool->Find( i ) );
     }
     // Insert types
-    sal_uInt16 nCount = pParser->rTypeArray->Count();
+    sal_uInt32 nCount = pParser->rTypeArray->Count32();
     for (i = 0; i < nCount; i++)
     {
-         p->AddType(static_cast<SbxObject *>(pParser->rTypeArray->Get(i)));
+         p->AddType(static_cast<SbxObject *>(pParser->rTypeArray->Get32(i)));
     }
     // Insert enum objects
-    nCount = pParser->rEnumArray->Count();
+    nCount = pParser->rEnumArray->Count32();
     for (i = 0; i < nCount; i++)
     {
-         p->AddEnum(static_cast<SbxObject *>(pParser->rEnumArray->Get(i)));
+         p->AddEnum(static_cast<SbxObject *>(pParser->rEnumArray->Get32(i)));
     }
     if( !p->IsError() )
     {
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index 6e6c3e024d67..0689e421e533 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -641,7 +641,7 @@ void SbiParser::DefType()
                         pArray->setHasFixedSize( true );
                     }
                     else
-                        pArray->unoAddDim( 0, -1 ); // variant array
+                        pArray->unoAddDim32( 0, -1 ); // variant array
                     SbxFlagBits nSavFlags = pTypeElem->GetFlags();
                     // need to reset the FIXED flag
                     // when calling PutObject ( because the type will not match Object )
@@ -664,7 +664,7 @@ void SbiParser::DefType()
                         }
                     }
                 }
-                pTypeMembers->Insert( pTypeElem, pTypeMembers->Count() );
+                pTypeMembers->Insert32( pTypeElem, pTypeMembers->Count32() );
             }
         }
     }
@@ -672,7 +672,7 @@ void SbiParser::DefType()
     pType->Remove( "Name", SbxClassType::DontCare );
     pType->Remove( "Parent", SbxClassType::DontCare );
 
-    rTypeArray->Insert (pType,rTypeArray->Count());
+    rTypeArray->Insert32 (pType,rTypeArray->Count32());
 }
 
 
@@ -796,14 +796,14 @@ void SbiParser::DefEnum( bool bPrivate )
             pEnumElem->PutLong( nCurrentEnumValue );
             pEnumElem->ResetFlag( SbxFlagBits::Write );
             pEnumElem->SetFlag( SbxFlagBits::Const );
-            pEnumMembers->Insert( pEnumElem, pEnumMembers->Count() );
+            pEnumMembers->Insert32( pEnumElem, pEnumMembers->Count32() );
         }
     }
 
     pEnum->Remove( "Name", SbxClassType::DontCare );
     pEnum->Remove( "Parent", SbxClassType::DontCare );
 
-    rEnumArray->Insert( pEnum, rEnumArray->Count() );
+    rEnumArray->Insert32( pEnum, rEnumArray->Count32() );
 }
 
 
diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx
index b0cc2840a5d6..bc8db7e3442a 100644
--- a/basic/source/comp/sbcomp.cxx
+++ b/basic/source/comp/sbcomp.cxx
@@ -62,9 +62,9 @@ bool SbModule::Compile()
             pBasic->ClearAllModuleVars();
         RemoveVars(); // remove 'this' Modules variables
         // clear all method statics
-        for( sal_uInt16 i = 0; i < pMethods->Count(); i++ )
+        for( sal_uInt32 i = 0; i < pMethods->Count32(); i++ )
         {
-            SbMethod* p = dynamic_cast<SbMethod*>( pMethods->Get( i )  );
+            SbMethod* p = dynamic_cast<SbMethod*>( pMethods->Get32( i )  );
             if( p )
                 p->ClearStatics();
         }
diff --git a/basic/source/runtime/dllmgr-none.cxx b/basic/source/runtime/dllmgr-none.cxx
index 5b4c24003b3b..7ca7e5131e3e 100644
--- a/basic/source/runtime/dllmgr-none.cxx
+++ b/basic/source/runtime/dllmgr-none.cxx
@@ -42,9 +42,9 @@ ErrCode returnInt64InOutArg(SbxArray *pArgs, SbxVariable &rRetVal,
 {
     if (!rRetVal.PutLong(1) && !rRetVal.PutInteger(1))
         return ERRCODE_BASIC_BAD_ARGUMENT;
-    if (!pArgs || pArgs->Count() != 2)
+    if (!pArgs || pArgs->Count32() != 2)
         return ERRCODE_BASIC_BAD_ARGUMENT;
-    SbxVariable *pOut = pArgs->Get(1);
+    SbxVariable *pOut = pArgs->Get32(1);
     if (!pOut)
         return ERRCODE_BASIC_BAD_ARGUMENT;
     if (pOut->IsCurrency())
diff --git a/basic/source/runtime/dllmgr-x64.cxx b/basic/source/runtime/dllmgr-x64.cxx
index d36e7238e20f..00f3984f7216 100644
--- a/basic/source/runtime/dllmgr-x64.cxx
+++ b/basic/source/runtime/dllmgr-x64.cxx
@@ -162,8 +162,8 @@ std::size_t alignment(SbxVariable const * variable) {
                 SbxObject* pobj = dynamic_cast<SbxObject*>(variable->GetObject());
                 assert(pobj);
                 SbxArray* props = pobj->GetProperties();
-                for (sal_uInt16 i = 0; i < props->Count(); ++i) {
-                    n = std::max(n, alignment(props->Get(i)));
+                for (sal_uInt32 i = 0; i < props->Count32(); ++i) {
+                    n = std::max(n, alignment(props->Get32(i)));
                 }
                 return n;
             }
@@ -177,9 +177,9 @@ std::size_t alignment(SbxVariable const * variable) {
     } else {
         SbxDimArray * arr = dynamic_cast<SbxDimArray*>( variable->GetObject() );
         assert(arr);
-        int dims = arr->GetDims();
+        sal_Int32 dims = arr->GetDims32();
         std::vector< sal_Int32 > low(dims);
-        for (int i = 0; i < dims; ++i) {
+        for (sal_Int32 i = 0; i < dims; ++i) {
             sal_Int32 up;
             arr->GetDim32(i + 1, low[i], up);
         }
@@ -215,8 +215,8 @@ ErrCode marshalStruct(
     SbxObject* pobj = dynamic_cast<SbxObject*>(variable->GetObject());
     assert(pobj);
     SbxArray* props = pobj->GetProperties();
-    for (sal_uInt16 i = 0; i < props->Count(); ++i) {
-        ErrCode e = marshal(false, props->Get(i), false, blob, offset, data);
+    for (sal_uInt32 i = 0; i < props->Count32(); ++i) {
+        ErrCode e = marshal(false, props->Get32(i), false, blob, offset, data);
         if (e != ERRCODE_NONE) {
             return e;
         }
@@ -231,10 +231,10 @@ ErrCode marshalArray(
     OSL_ASSERT(variable != nullptr);
     SbxDimArray * arr = dynamic_cast<SbxDimArray*>( variable->GetObject() );
     assert(arr);
-    int dims = arr->GetDims();
+    sal_Int32 dims = arr->GetDims32();
     std::vector< sal_Int32 > low(dims);
     std::vector< sal_Int32 > up(dims);
-    for (int i = 0; i < dims; ++i) {
+    for (sal_Int32 i = 0; i < dims; ++i) {
         arr->GetDim32(i + 1, low[i], up[i]);
     }
     for (std::vector< sal_Int32 > idx = low;;) {
@@ -243,7 +243,7 @@ ErrCode marshalArray(
         if (e != ERRCODE_NONE) {
             return e;
         }
-        int i = dims - 1;
+        sal_Int32 i = dims - 1;
         while (idx[i] == up[i]) {
             idx[i] = low[i];
             if (i == 0) {
@@ -409,8 +409,8 @@ void const * unmarshal(SbxVariable * variable, void const * data) {
                 SbxObject* pobj = dynamic_cast<SbxObject*>(variable->GetObject());
                 assert(pobj);
                 SbxArray* props = pobj->GetProperties();
-                for (sal_uInt16 i = 0; i < props->Count(); ++i) {
-                    data = unmarshal(props->Get(i), data);
+                for (sal_uInt32 i = 0; i < props->Count32(); ++i) {
+                    data = unmarshal(props->Get32(i), data);
                 }
                 break;
             }
@@ -427,15 +427,15 @@ void const * unmarshal(SbxVariable * variable, void const * data) {
     } else {
         SbxDimArray * arr = dynamic_cast<SbxDimArray*>( variable->GetObject() );
         assert(arr);
-        int dims = arr->GetDims();
+        sal_Int32 dims = arr->GetDims32();
         std::vector< sal_Int32 > low(dims);
         std::vector< sal_Int32 > up(dims);
-        for (int i = 0; i < dims; ++i) {
+        for (sal_Int32 i = 0; i < dims; ++i) {
             arr->GetDim32(i + 1, low[i], up[i]);
         }
         for (std::vector< sal_Int32 > idx = low;;) {
             data = unmarshal(arr->Get32(idx.data()), data);
-            int i = dims - 1;
+            sal_Int32 i = dims - 1;
             while (idx[i] == up[i]) {
                 idx[i] = low[i];
                 if (i == 0) {
@@ -482,7 +482,7 @@ ErrCode call(
     OUString const & dll, ProcData const & proc, SbxArray * arguments,
     SbxVariable & result)
 {
-    if (arguments && arguments->Count() > 20)
+    if (arguments && arguments->Count32() > 20)
         return ERRCODE_BASIC_NOT_IMPLEMENTED;
 
     std::vector< char > stack;
@@ -495,9 +495,9 @@ ErrCode call(
     bool special =
         dll.equalsIgnoreAsciiCase("KERNEL32.DLL") &&
         (proc.name == OString("GetLogicalDriveStringsA"));
-    for (int i = 1; i < (arguments == nullptr ? 0 : arguments->Count()); ++i) {
+    for (sal_uInt32 i = 1; i < (arguments == nullptr ? 0 : arguments->Count32()); ++i) {
         ErrCode e = marshal(
-            true, arguments->Get(i), special && i == 2, stack, stack.size(),
+            true, arguments->Get32(i), special && i == 2, stack, stack.size(),
             data);
         if (e != ERRCODE_NONE) {
             return e;
@@ -619,8 +619,8 @@ ErrCode call(
         OSL_ASSERT(false);
         break;
     }
-    for (int i = 1; i < (arguments == nullptr ? 0 : arguments->Count()); ++i) {
-        arguments->Get(i)->ResetFlag(SbxFlagBits::Reference);
+    for (sal_uInt32 i = 1; i < (arguments == nullptr ? 0 : arguments->Count32()); ++i) {
+        arguments->Get32(i)->ResetFlag(SbxFlagBits::Reference);
             //TODO: skipped for errors?!?
     }
     for (auto const& elem : data.unmarshal)
diff --git a/basic/source/runtime/dllmgr-x86.cxx b/basic/source/runtime/dllmgr-x86.cxx
index 74b470da2e04..a6a9e9609674 100644
--- a/basic/source/runtime/dllmgr-x86.cxx
+++ b/basic/source/runtime/dllmgr-x86.cxx
@@ -169,8 +169,8 @@ std::size_t alignment(SbxVariable * variable) {
                 SbxObject* pobj = dynamic_cast<SbxObject*>(variable->GetObject());
                 assert(pobj);
                 SbxArray* props = pobj->GetProperties();
-                for (sal_uInt16 i = 0; i < props->Count(); ++i) {
-                    n = std::max(n, alignment(props->Get(i)));
+                for (sal_uInt32 i = 0; i < props->Count32(); ++i) {
+                    n = std::max(n, alignment(props->Get32(i)));
                 }
                 return n;
             }
@@ -184,9 +184,9 @@ std::size_t alignment(SbxVariable * variable) {
     } else {
         SbxDimArray * arr = dynamic_cast<SbxDimArray*>( variable->GetObject() );
         assert(arr);
-        int dims = arr->GetDims();
+        sal_Int32 dims = arr->GetDims32();
         std::vector< sal_Int32 > low(dims);
-        for (int i = 0; i < dims; ++i) {
+        for (sal_Int32 i = 0; i < dims; ++i) {
             sal_Int32 up;
             arr->GetDim32(i + 1, low[i], up);
         }
@@ -223,8 +223,8 @@ ErrCode marshalStruct(
     SbxObject* pobj = dynamic_cast<SbxObject*>(variable->GetObject());
     assert(pobj);
     SbxArray* props = pobj->GetProperties();
-    for (sal_uInt16 i = 0; i < props->Count(); ++i) {
-        ErrCode e = marshal(false, props->Get(i), false, blob, offset, data);
+    for (sal_uInt32 i = 0; i < props->Count32(); ++i) {
+        ErrCode e = marshal(false, props->Get32(i), false, blob, offset, data);
         if (e != ERRCODE_NONE) {
             return e;
         }
@@ -239,10 +239,10 @@ ErrCode marshalArray(
     OSL_ASSERT(variable != 0);
     SbxDimArray * arr = dynamic_cast<SbxDimArray*>( variable->GetObject() );
     assert(arr);
-    int dims = arr->GetDims();
+    sal_Int32 dims = arr->GetDims32();
     std::vector< sal_Int32 > low(dims);
     std::vector< sal_Int32 > up(dims);
-    for (int i = 0; i < dims; ++i) {
+    for (sal_Int32 i = 0; i < dims; ++i) {
         arr->GetDim32(i + 1, low[i], up[i]);
     }
     for (std::vector< sal_Int32 > idx = low;;) {
@@ -251,7 +251,7 @@ ErrCode marshalArray(
         if (e != ERRCODE_NONE) {
             return e;
         }
-        int i = dims - 1;
+        sal_Int32 i = dims - 1;
         while (idx[i] == up[i]) {
             idx[i] = low[i];
             if (i == 0) {
@@ -417,8 +417,8 @@ void const * unmarshal(SbxVariable * variable, void const * data) {
                 SbxObject* pobj = dynamic_cast<SbxObject*>(variable->GetObject());
                 assert(pobj);
                 SbxArray* props = pobj->GetProperties();
-                for (sal_uInt16 i = 0; i < props->Count(); ++i) {
-                    data = unmarshal(props->Get(i), data);
+                for (sal_uInt32 i = 0; i < props->Count32(); ++i) {
+                    data = unmarshal(props->Get32(i), data);
                 }
                 break;
             }
@@ -435,15 +435,15 @@ void const * unmarshal(SbxVariable * variable, void const * data) {
     } else {
         SbxDimArray * arr = dynamic_cast<SbxDimArray*>( variable->GetObject() );
         assert(arr);
-        int dims = arr->GetDims();
+        sal_Int32 dims = arr->GetDims32();
         std::vector< sal_Int32 > low(dims);
         std::vector< sal_Int32 > up(dims);
-        for (int i = 0; i < dims; ++i) {
+        for (sal_Int32 i = 0; i < dims; ++i) {
             arr->GetDim32(i + 1, low[i], up[i]);
         }
         for (std::vector< sal_Int32 > idx = low;;) {
             data = unmarshal(arr->Get32(&idx[0]), data);
-            int i = dims - 1;
+            sal_Int32 i = dims - 1;
             while (idx[i] == up[i]) {
                 idx[i] = low[i];
                 if (i == 0) {
@@ -498,9 +498,9 @@ ErrCode call(
     // require similar treatment, too:
     bool special = dll.equalsIgnoreAsciiCase("KERNEL32.DLL") &&
                    (proc.name == OString("GetLogicalDriveStringsA"));
-    for (sal_uInt16 i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
+    for (sal_uInt32 i = 1; i < (arguments == 0 ? 0 : arguments->Count32()); ++i) {
         ErrCode e = marshal(
-            true, arguments->Get(i), special && i == 2, stack, stack.size(),
+            true, arguments->Get32(i), special && i == 2, stack, stack.size(),
             data);
         if (e != ERRCODE_NONE) {
             return e;
@@ -559,8 +559,8 @@ ErrCode call(
         OSL_ASSERT(false);
         break;
     }
-    for (sal_uInt16 i = 1; i < (arguments == 0 ? 0 : arguments->Count()); ++i) {
-        arguments->Get(i)->ResetFlag(SbxFlagBits::Reference);
+    for (sal_uInt32 i = 1; i < (arguments == 0 ? 0 : arguments->Count32()); ++i) {
+        arguments->Get32(i)->ResetFlag(SbxFlagBits::Reference);
             //TODO: skipped for errors?!?
     }
     for (auto& rUnmarshalData : data.unmarshal)
diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx
index 296063d9534e..1d27b25abf46 100644
--- a/basic/source/runtime/inputbox.cxx
+++ b/basic/source/runtime/inputbox.cxx
@@ -110,7 +110,7 @@ IMPL_LINK_NOARG( SvRTLInputBox, CancelHdl, weld::Button&, void )
 
 void SbRtl_InputBox(StarBASIC *, SbxArray & rPar, bool)
 {
-    sal_uInt32 nArgCount = rPar.Count();
+    sal_uInt32 nArgCount = rPar.Count32();
     if ( nArgCount < 2 )
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
     else
@@ -118,11 +118,11 @@ void SbRtl_InputBox(StarBASIC *, SbxArray & rPar, bool)
         OUString aTitle;
         OUString aDefault;
         sal_Int32 nX = -1, nY = -1;  // center
-        const OUString& rPrompt = rPar.Get(1)->GetOUString();
-        if ( nArgCount > 2 && !rPar.Get(2)->IsErr() )
-            aTitle = rPar.Get(2)->GetOUString();
-        if ( nArgCount > 3 && !rPar.Get(3)->IsErr() )
-            aDefault = rPar.Get(3)->GetOUString();
+        const OUString& rPrompt = rPar.Get32(1)->GetOUString();
+        if ( nArgCount > 2 && !rPar.Get32(2)->IsErr() )
+            aTitle = rPar.Get32(2)->GetOUString();
+        if ( nArgCount > 3 && !rPar.Get32(3)->IsErr() )
+            aDefault = rPar.Get32(3)->GetOUString();
         if ( nArgCount > 4 )
         {
             if ( nArgCount != 6 )
@@ -130,13 +130,13 @@ void SbRtl_InputBox(StarBASIC *, SbxArray & rPar, bool)
                 StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
                 return;
             }
-            nX = rPar.Get(4)->GetLong();
-            nY = rPar.Get(5)->GetLong();
+            nX = rPar.Get32(4)->GetLong();
+            nY = rPar.Get32(5)->GetLong();
         }
         vcl::Window* pParent = Application::GetDefDialogParent();
         SvRTLInputBox aDlg(pParent ? pParent->GetFrameWeld() : nullptr,rPrompt,aTitle,aDefault,nX,nY);
         aDlg.run();
-        rPar.Get(0)->PutString(aDlg.GetText());
+        rPar.Get32(0)->PutString(aDlg.GetText());
     }
 }
 
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 4860ec34376d..93a8e877497c 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -169,7 +169,7 @@ static uno::Reference< ucb::XSimpleFileAccess3 > const & getFileAccess()
 
 void SbRtl_CreateObject(StarBASIC * pBasic, SbxArray & rPar, bool)
 {
-    OUString aClass( rPar.Get( 1 )->GetOUString() );
+    OUString aClass( rPar.Get32(1)->GetOUString() );
     SbxObjectRef p = SbxBase::CreateObject( aClass );
     if( !p.is() )
         StarBASIC::Error( ERRCODE_BASIC_CANNOT_LOAD );
@@ -177,7 +177,7 @@ void SbRtl_CreateObject(StarBASIC * pBasic, SbxArray & rPar, bool)
     {
         // Convenience: enter BASIC as parent
         p->SetParent( pBasic );
-        rPar.Get( 0 )->PutObject( p.get() );
+        rPar.Get32(0)->PutObject( p.get() );
     }
 }
 
@@ -192,14 +192,14 @@ void SbRtl_Error(StarBASIC * pBasic, SbxArray & rPar, bool)
         OUString aErrorMsg;
         ErrCode nErr = ERRCODE_NONE;
         sal_Int32 nCode = 0;
-        if( rPar.Count() == 1 )
+        if( rPar.Count32() == 1 )
         {
             nErr = StarBASIC::GetErrBasic();
             aErrorMsg = StarBASIC::GetErrorMsg();
         }
         else
         {
-            nCode = rPar.Get( 1 )->GetLong();
+            nCode = rPar.Get32(1)->GetLong();
             if( nCode > 65535 )
             {
                 StarBASIC::Error( ERRCODE_BASIC_CONVERSION );
@@ -224,7 +224,7 @@ void SbRtl_Error(StarBASIC * pBasic, SbxArray & rPar, bool)
         // If this rtlfunc 'Error' passed an errcode the same as the active Err Objects's
         // current err then  return the description for the error message if it is set
         // ( complicated isn't it ? )
-        if ( bVBA && rPar.Count() > 1 )
+        if ( bVBA && rPar.Count32() > 1 )
         {
             uno::Reference< ooo::vba::XErrObject > xErrObj( SbxErrObject::getUnoErrObject() );
             if ( xErrObj.is() && xErrObj->getNumber() == nCode && !xErrObj->getDescription().isEmpty() )
@@ -232,7 +232,7 @@ void SbRtl_Error(StarBASIC * pBasic, SbxArray & rPar, bool)
                 tmpErrMsg = xErrObj->getDescription();
             }
         }
-        rPar.Get( 0 )->PutString( tmpErrMsg );
+        rPar.Get32(0)->PutString( tmpErrMsg );
     }
 }
 
@@ -240,86 +240,86 @@ void SbRtl_Error(StarBASIC * pBasic, SbxArray & rPar, bool)
 
 void SbRtl_Sin(StarBASIC *, SbxArray & rPar, bool)
 {
-    if ( rPar.Count() < 2 )
+    if ( rPar.Count32() < 2 )
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
     else
     {
-        SbxVariableRef pArg = rPar.Get( 1 );
-        rPar.Get( 0 )->PutDouble( sin( pArg->GetDouble() ) );
+        SbxVariableRef pArg = rPar.Get32(1);
+        rPar.Get32(0)->PutDouble( sin( pArg->GetDouble() ) );
     }
 }
 
 
 void SbRtl_Cos(StarBASIC *, SbxArray & rPar, bool)
 {
-    if ( rPar.Count() < 2 )
+    if ( rPar.Count32() < 2 )
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
     else
     {
-        SbxVariableRef pArg = rPar.Get( 1 );
-        rPar.Get( 0 )->PutDouble( cos( pArg->GetDouble() ) );
+        SbxVariableRef pArg = rPar.Get32(1);
+        rPar.Get32(0)->PutDouble( cos( pArg->GetDouble() ) );
     }
 }
 
 
 void SbRtl_Atn(StarBASIC *, SbxArray & rPar, bool)
 {
-    if ( rPar.Count() < 2 )
+    if ( rPar.Count32() < 2 )
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
     else
     {
-        SbxVariableRef pArg = rPar.Get( 1 );
-        rPar.Get( 0 )->PutDouble( atan( pArg->GetDouble() ) );
+        SbxVariableRef pArg = rPar.Get32(1);
+        rPar.Get32(0)->PutDouble( atan( pArg->GetDouble() ) );
     }
 }
 
 
 void SbRtl_Abs(StarBASIC *, SbxArray & rPar, bool)
 {
-    if ( rPar.Count() < 2 )
+    if ( rPar.Count32() < 2 )
     {
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
     }
     else
     {
-        SbxVariableRef pArg = rPar.Get( 1 );
-        rPar.Get( 0 )->PutDouble( fabs( pArg->GetDouble() ) );
+        SbxVariableRef pArg = rPar.Get32(1);
+        rPar.Get32(0)->PutDouble( fabs( pArg->GetDouble() ) );
     }
 }
 
 
 void SbRtl_Asc(StarBASIC *, SbxArray & rPar, bool)
 {
-    if ( rPar.Count() < 2 )
+    if ( rPar.Count32() < 2 )
     {
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
     }
     else
     {
-        SbxVariableRef pArg = rPar.Get( 1 );
+        SbxVariableRef pArg = rPar.Get32(1);
         OUString aStr( pArg->GetOUString() );
         if ( aStr.isEmpty())
         {
             StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
-            rPar.Get(0)->PutEmpty();
+            rPar.Get32(0)->PutEmpty();
         }
         else
         {
             sal_Unicode aCh = aStr[0];
-            rPar.Get(0)->PutLong( aCh );
+            rPar.Get32(0)->PutLong( aCh );
         }
     }
 }
 
 static void implChr( SbxArray& rPar, bool bChrW )
 {
-    if ( rPar.Count() < 2 )
+    if ( rPar.Count32() < 2 )
     {
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
     }
     else
     {
-        SbxVariableRef pArg = rPar.Get( 1 );
+        SbxVariableRef pArg = rPar.Get32(1);
 
         OUString aStr;
         if( !bChrW && SbiRuntime::isVBAEnabled() )
@@ -332,7 +332,7 @@ static void implChr( SbxArray& rPar, bool bChrW )
             sal_Unicode aCh = static_cast<sal_Unicode>(pArg->GetUShort());
             aStr = OUString(aCh);
         }
-        rPar.Get(0)->PutString( aStr );
+        rPar.Get32(0)->PutString( aStr );
     }
 }
 
@@ -377,9 +377,9 @@ void SbRtl_CurDir(StarBASIC * pBasic, SbxArray & rPar, bool bWrite)
 
 #if defined(_WIN32)
     int nCurDir = 0;  // Current dir // JSM
-    if ( rPar.Count() == 2 )
+    if ( rPar.Count32() == 2 )
     {
-        OUString aDrive = rPar.Get(1)->GetOUString();
+        OUString aDrive = rPar.Get32(1)->GetOUString();
         if ( aDrive.getLength() != 1 )
         {
             StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
@@ -402,7 +402,7 @@ void SbRtl_CurDir(StarBASIC * pBasic, SbxArray & rPar, bool bWrite)
     _set_thread_local_invalid_parameter_handler(handler);
     if ( ok )
     {
-        rPar.Get(0)->PutString( o3tl::toU(pBuffer) );
+        rPar.Get32(0)->PutString( o3tl::toU(pBuffer) );
     }
     else
     {
@@ -425,7 +425,7 @@ void SbRtl_CurDir(StarBASIC * pBasic, SbxArray & rPar, bool bWrite)
           }
         if( getcwd( pMem.get(), nSize-1 ) != nullptr )
           {
-            rPar.Get(0)->PutString( OUString::createFromAscii(pMem.get()) );
+            rPar.Get32(0)->PutString( OUString::createFromAscii(pMem.get()) );
             return;
           }
         if( errno != ERANGE )
@@ -441,13 +441,13 @@ void SbRtl_CurDir(StarBASIC * pBasic, SbxArray & rPar, bool bWrite)
 
 void SbRtl_ChDir(StarBASIC * pBasic, SbxArray & rPar, bool)
 {
-    rPar.Get(0)->PutEmpty();
-    if (rPar.Count() == 2)
+    rPar.Get32(0)->PutEmpty();
+    if (rPar.Count32() == 2)
     {
         // VBA: track current directory per document type (separately for Writer, Calc, Impress, etc.)
         if( SbiRuntime::isVBAEnabled() )
         {
-            ::basic::vba::registerCurrentDirectory( getDocumentModel( pBasic ), rPar.Get(1)->GetOUString() );
+            ::basic::vba::registerCurrentDirectory( getDocumentModel( pBasic ), rPar.Get32(1)->GetOUString() );
         }
     }
     else
@@ -458,8 +458,8 @@ void SbRtl_ChDir(StarBASIC * pBasic, SbxArray & rPar, bool)
 
 void SbRtl_ChDrive(StarBASIC *, SbxArray & rPar, bool)
 {
-    rPar.Get(0)->PutEmpty();
-    if (rPar.Count() != 2)
+    rPar.Get32(0)->PutEmpty();
+    if (rPar.Count32() != 2)
     {
         StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
     }
@@ -510,11 +510,11 @@ void implStepRenameOSL( const OUString& aSource, const OUString& aDest )
 
 void SbRtl_FileCopy(StarBASIC *, SbxArray & rPar, bool)
 {
-    rPar.Get(0)->PutEmpty();
-    if (rPar.Count() == 3)
+    rPar.Get32(0)->PutEmpty();
+    if (rPar.Count32() == 3)
     {
-        OUString aSource = rPar.Get(1)->GetOUString();
-        OUString aDest = rPar.Get(2)->GetOUString();
+        OUString aSource = rPar.Get32(1)->GetOUString();
+        OUString aDest = rPar.Get32(2)->GetOUString();
         if( hasUno() )
         {
             const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
@@ -545,10 +545,10 @@ void SbRtl_FileCopy(StarBASIC *, SbxArray & rPar, bool)
 
 void SbRtl_Kill(StarBASIC *, SbxArray & rPar, bool)
 {
-    rPar.Get(0)->PutEmpty();
-    if (rPar.Count() == 2)
+    rPar.Get32(0)->PutEmpty();
+    if (rPar.Count32() == 2)
     {
-        OUString aFileSpec = rPar.Get(1)->GetOUString();
+        OUString aFileSpec = rPar.Get32(1)->GetOUString();
 
         if( hasUno() )
         {
@@ -584,10 +584,10 @@ void SbRtl_Kill(StarBASIC *, SbxArray & rPar, bool)
 
 void SbRtl_MkDir(StarBASIC * pBasic, SbxArray & rPar, bool bWrite)
 {
-    rPar.Get(0)->PutEmpty();
-    if (rPar.Count() == 2)
+    rPar.Get32(0)->PutEmpty();
+    if (rPar.Count32() == 2)
     {
-        OUString aPath = rPar.Get(1)->GetOUString();
+        OUString aPath = rPar.Get32(1)->GetOUString();
         if ( SbiRuntime::isVBAEnabled() )
         {
             // In vba if the full path is not specified then
@@ -598,12 +598,12 @@ void SbRtl_MkDir(StarBASIC * pBasic, SbxArray & rPar, bool bWrite)
                 SbxArrayRef pPar = new SbxArray();
                 SbxVariableRef pResult = new SbxVariable();
                 SbxVariableRef pParam = new SbxVariable();
-                pPar->Insert( pResult.get(), pPar->Count() );
-                pPar->Insert( pParam.get(), pPar->Count() );
+                pPar->Insert32( pResult.get(), pPar->Count32() );
+                pPar->Insert32( pParam.get(), pPar->Count32() );
                 SbRtl_CurDir( pBasic, *pPar, bWrite );
 
                 OUString sCurPathURL;
-                File::getFileURLFromSystemPath( pPar->Get(0)->GetOUString(), sCurPathURL );
+                File::getFileURLFromSystemPath( pPar->Get32(0)->GetOUString(), sCurPathURL );
 
                 aURLObj.SetURL( sCurPathURL );
                 aURLObj.Append( aPath );
@@ -703,10 +703,10 @@ static void implRemoveDirRecursive( const OUString& aDirPath )
 
 void SbRtl_RmDir(StarBASIC *, SbxArray & rPar, bool)
 {
-    rPar.Get(0)->PutEmpty();
-    if (rPar.Count() == 2)
+    rPar.Get32(0)->PutEmpty();
+    if (rPar.Count32() == 2)
     {
-        OUString aPath = rPar.Get(1)->GetOUString();
+        OUString aPath = rPar.Get32(1)->GetOUString();
         if( hasUno() )
         {
             const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
@@ -752,32 +752,32 @@ void SbRtl_RmDir(StarBASIC *, SbxArray & rPar, bool)
 
 void SbRtl_SendKeys(StarBASIC *, SbxArray & rPar, bool)
 {
-    rPar.Get(0)->PutEmpty();
+    rPar.Get32(0)->PutEmpty();

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list