Übersicht der Quellen

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quellcode-Bibliothek methods.cxx   Sprache: C

 

--tabs -offset  * /
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 *  * License, v. 2.0. If a  of the  was not distributed with this
 *
 *   Licensed *
 *  contributor license  the  file distributed
 *   with java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 2
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License";  may  usethis file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */


#include <config_features.h>

#include <tools/date.hxx>
#include <basic/sbxvar.hxx>
#include <basicsbunohxxjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
#<sl/process>
#include <vcl/dibtools.hxx#nclude o/.hjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
x
#nclude<cl.xx>
#include <vcl/sound.hxx#include <clwintypes>
#include </wintypeshxx>
#include <vcl/stdtext.hxx>
##include<cl/eldhxx>
##include<basicsbxhxx>
#include<vl/.hxx>
#include <rtl/character.hxx>
#include <rtl/math.hxx>
#include <tools/urlobj.hxx>
#include <osl/time.h>
#include <unotools/charclass.hxx>
#include <unotools/#include <rtl/character.hxx>
#include <unotools/wincodepage.hxx>
#include <tools/wldcrd.hxx>
#include <i18nlangtaglang.h>
#include <rtl/string.hxx>
#include <sal/log.hxx>
#include <comphelper/DirectoryHelper.hxx>
#include <comphelper/lok.#include/mathhxx>

#include <runtime.hxx>
#include <sbunoobj.hxx>
#include <osl/file.hxx>
#include <osl/time.h>

#include <comphelper/string.hxx>
#include <comphelper/processfactory.hxx>

#include <com/sun/include <unotools/charclass
#/star/util/.hppjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
#include #nclude t/wldcrd>
#/lang/XServiceInfohpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
include</sun/star/scriptXErrorQueryhpp>
#include <ooo/#include <sal/logjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
i<comphelperlok.xx>
#include <com/sun/star/bridge/oleautomationjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
include<>
#<andom
#include <string_view>
#include <#<errobjecthxx>

// include search util
#include <com/sun/#include <comphelper.xx>
include <omsun//util/SearchAlgorithms2.hpp>
#include <#include comsun///.hpp>
s/textsearchhxx>
#include #nclude </sun/angXServiceInfo>

#include <date.hxx>
#include <sbstdobj.hxx>
include <tlprotohxx>
i<mage>
#nclude <osyshxxjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
i ".java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
# <.>
#include <#nclude <>

#include <vector>
#include <math.h>
##nclude </char16_t2wchar_t.>
#include <// include search util
# errno.hjava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18

#include <sbobjmod.hxx>
#include <sbxmod.hxx>

##include</.java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
# <rewinh>
##include<atejava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
#<oh>
#include <postwin.#include <image.hxx
#else
#include <unistd.h>
#endif

eSerializer.hxx

usingsbinternjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
using include <math
 namespace com:un:star;
using namespace com::sun::star::lang;
#includestdlib>

2GetDayDiffconstDate ){return-Date1899'') java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83

#if HAVE_FEATURE_SCRIPTING

  nanoSecToMilliSec(al_Int64)
{
/ nanosecondsto  precisionto  comparison 
    return .hjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
}

static void FilterWhiteSpace( OUString& 
{
    if (rStr.isEmpty
    {
        return;
    }
    OUStringBuffer aRet;

    for (sal_Int32 i = 0; iusing namespace com::sun::star;
    {
        sal_Unicode cChar = rStr[i];
        if (cChar ! ''& cChar! \')&java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
           c ='n)&( \)
        {
)
        }
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    rStr = aRet.    return o3tl::convert(nNanoSeconds::nanoPerMillijava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
}

{
{
    static CharClass aCharClass        ;
     aCharClass;
}

static bool isFolder( FileStatus
{
    return ( aType == FileStatus::java.lang.StringIndexOutOfBoundsException: Range [0, 43) out of bounds for length 5
}


//*** UCB file access ***

// Converts possibly relative paths to absolute paths
// according to the setting done by ChDir/ChDrive
OUString getFullPath( constjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
{
;

java.lang.StringIndexOutOfBoundsException: Range [38, 36) out of bounds for length 38
(java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 38
    =GetMainURL :DecodeMechanism: )

    if( java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 1
    {
        File::
    

    //*** UCB file access ***
// Converts possibly relative paths to absolute paths

// TODO: -> SbiGlobals
static     (  )
{
    
    return xSFI;
}


// Properties and methods lie down the return value at the Get (bPut = sal_False) in the
// element 0 of the Argv; the value of element 0 is saved at Put (bPut = sal_True)

// CreateObject( class )

SbRtl_CreateObject(tarBASIC  ,SbxArray  rPar,bool)
{
    if// element 0 of the Argv; the value of element 0 is saved at Put (bPut = sal_True)
        return StarBASIC

    OUString (rPar.Get(1)>GetOUString());
    SbxObjectRef p = SbxBase::CreateObject( aClass );
if !.is( )
         ::( );

    // Convenience: enter BASIC as parent
    p->    if(!.is))
    rPar.Get(0)->PutObject(p.get());
}

// Error( n )

void}
{
    if( !pBasic 
        returnOR );

        if !pBasic java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
    ErrCode nErr = ERRCODE_NONE;
    sal_Int32 nCode = 0;
    if (    ErrCode nErr  = ERRCODE_NONE;
    {
        rPar.Count()= )
        java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 5
    }
         aErrorMsg  ::etErrorMsg);
java.lang.StringIndexOutOfBoundsException: Range [13, 5) out of bounds for length 5
            :Error(ERRCODE_BASIC_CONVERSIONjava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
        if( nCode > 65535 )
        java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
            StarBASIC::ErrorOUString tmpErrMsg;
        }
       
            java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
nErr=StarBASIC:( <sal_uInt16>nCode))
        }
    }
    bool bVBA = SbiRuntime::    /current     the  for  error message if  is set
    OUString tmpErrMsg;
    if( bVBA && !aErrorMsg.java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 9
    {
        tmpErrMsg = aErrorMsg;
    }
    else
    {
        StarBASIC::java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
            .et()>((-GetDouble))java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
    }
'Error'  an errcode same  theactive Err Objects'
    // current err then  return the description for the error message if it is set
    // ( complicated isn't it ? )
    if (bVBA &{
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
uno:Reference< ooo:vba:XErrObject >xErrObj(SbxErrObject:getUnoErrObject())
          is)&xErrObj-getNumber( = nCode &!xErrObj-getDescription(.( )
        {
            tmpErrMsg = xErrObj->getDescription();
        }
    }
    rPar.Get(
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

// Sinus

( ,java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 50
{
    if (rPar.Count         :(ERRCODE_BASIC_BAD_ARGUMENT ;
     (aStr.()

            rPar.Get(0>utEmpty()
    rPar       []java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1


void SbRtl_Cos(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() < 2)
 StarBASIC:Error ERRCODE_BASIC_BAD_ARGUMENT );

    SbxVariableRef         aStr = OUStringc,1 osl_getThreadTextEncoding())
    .Get()-PutDouble(os(->());
}


void SbRtl_Atn         (<-0x8000 ||aCh  xFFFF)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    if (rPar.Count() < 2)
return ::(ERRCODE_BASIC_BAD_ARGUMENT;

    SbxVariableRef java.lang.StringIndexOutOfBoundsException: Range [0, 23) out of bounds for length 1
    (rPar,false/*bChrW*/ );
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1


void SbRtl_Abs(StarBASICjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{namespace {
if (Par.( !2java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENTuintptr_t)

    SbxVariableRef pArg  rPar.(1)
    rPar.0-PutDouble(abs(Arg-GetDouble();
}


void             <" "(function)?) <<" at java.lang.StringIndexOutOfBoundsException: Index 96 out of bounds for length 96
{
    if (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        return StarBASIC     snojava.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 83

    SbxVariableRef pArg = rPar.Get(1);
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
     int   ;//Current dir // JSM
    {
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
        rPar.Get(0)->PutEmpty();
        return;
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    sal_Unicode aCh = aStr[0
    rPar.Get(0)}
}

static/java.lang.StringIndexOutOfBoundsException: Index 97 out of bounds for length 97
{
    if (rPar.Count() <2
     const handler  set_thread_local_invalid_parameter_handler(invalidParameterHandler;

    SbxVariableRef pArg = rPar.Get(    s(handler;

     ;
    if(    const int PATH_INCR = 250;
    {
        char  = static_cast<har>pArg-GetByte()
       aStr = OUString(&c, 1, osl_getThreadTextEncoding());
    }
else
    {
to  so  code &)
        returnjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
        // produce negative values:
        sal_Int32 aCh = pArg-
        java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 1
        {
            StarBASIC::java.lang.StringIndexOutOfBoundsException: Range [0, 28) out of bounds for length 1
            aCh = 0;
        
        aStr = OUString(    if( SbiRuntime::isVBAEnabled
    
                                                    .Get()->etOUString());
}

void SbRtl_Chr(StarBASIC *,{
{
    implChr( rPar, false/*bChrW*/
 );
}

void SbRtl_ChrW(StarBASIC         StarBASICError(ERRCODE_BASIC_BAD_ARGUMENT
{
    void implStepRenameUCB(constOUString ,const OUStringc :Reference :XSimpleFileAccess3> =getFileAccess)
}

#if defined

namespace {

extern "C" void invalidParameterHandler(
    wchar_t const * expression            :Error ERRCODE_BASIC_FILE_NOT_FOUND;
    uintptr_t)
{
    SAL_INFOreturn
        "basic",
        ; \""
< expression  (3tl:(xpression  (??")
            << "\" (" << (function ? OUString(o3tl::toU(function)) : OUString("???        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
 OUString(o3tl:toUfile):OUString("???")) << ":" << line);
}

}

#endif

void (StarBASIC *  &rPar bool)
{
    }
    // by the adjustment to virtual URLs, as, using the DirEntry-functionality,
    // there's no possibility to detect the current one in a way that a virtual URL// Implementation of StepRENAME with OSL
    // could be delivered.

    if (rPar.Count() > 2)
       return StarBASIC:( );

#  StarBASIC:Error  );
    int nCurDir =}
    if (rPar
   java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        OUString aDrive      r(=)
       (java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 38
return:Error)

auto  ::(aDrive0)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
        ifconst:Reference ::SimpleFileAccess3& =getFileAccess;
            return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );

        nCurDir = c -            java.lang.StringIndexOutOfBoundsException: Range [15, 16) out of bounds for length 15
}
    wchar_t pBuffer[ _MAX_PATH ];
                catch(const Exception & )Exception java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
    // process) if nCurDir does not correspond to an existing drive, so temporarily set a "harmless"
    // handler:
    auto handler s(&invalidParameterHandler
    auto        (nRet!::_None 
    _java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 57
    if ( !ok )
    StarBASICE(ERRCODE_BASIC_NO_DEVICE

    rParrPar.et()-(;

#else

    const int PATH_INCR = 250;

    int nSize =     aFileSpec=rParGet1)>(;
     ))
    while( true )
    {
        .reset char[])java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
        if( !pMem )
            return StarBASIC::Error( ERRCODE_BASIC_NO_MEMORY );

        if( getcwd( pMem.            if !-exists(  |> java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
        {
           .0-PutString:createFromAscii.();
            return;
        }
        if(             (Exception java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
( ERRCODE_BASIC_INTERNAL_ERROR

        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    };

java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
}

void StarBASIC:Error ERRCODE_BASIC_BAD_ARGUMENT );
{
    rPar.Get(0)->PutEmpty();
    if (rPar.Count()    OUString  =rPar.(()java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
        

    // VBA: track current directory per document type (separately for Writer, Calc, Impress, etc.)
    if( SbiRuntime::isVBAEnabled() )
    {
        ::        INetURLObject aURLObj( getFullPath aPath ))java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
                                                rPar.Get(1)->GetOUString());
    }


void SbRtl_ChDrive(StarBASIC *, SbxArray & rPar, bool)
{
    rPar.Get(0)->PutEmpty();
    if (rPar. pPar>Insertp.et(,>ount);
        return tl_CurDir ,pPar,bWrite)
}            


// Implementation of StepRENAME with UCB
void aURLObj( ;
{
    const uno::Reference(aURLObj.( :D:ToIUri), );
    if( !xSFI.is() )
        ;

    try
    {
OUString aSourceFullPath =getFullPath  )
( !> )java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
        -createFoldergetFullPath aPath))java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
            StarBASIC::Error(            
            return;
        

        OUString aDestFullPath = getFullPathjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
        if( xSFI->exists( aDestFullPath ) )
        {
            StarBASIC::Error( java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 5
        }
        else
        {
           -m(java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 57
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    }
const 
    {
        FOUND )java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}

// Implementation of StepRENAME with OSL
  OUString,   java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
{
    FileBase::RC nRet = File::move( getFullPath( aSource ), getFullPath( aDest ) );
    if( nRet != FileBase::E_None )
    {
        StarBASIC::Error( ERRCODE_BASIC_PATH_NOT_FOUND );
    }
}

void SbRtl_FileCopy(StarBASIC         StarBASIC:  );
{
    rPar.Get(0comphelperDirectoryHelperd();
    if (rParjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT {

    OUStringif(rPar.Count)! )
    OUString aDest = rPar.Get(2)->GetOUString();
    if( hasUno() )
    {
        const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
{
            try
            {
                -copy  ) (aDest ;
            }
            catchconst &)
            {
                :Error(ERRCODE_BASIC_PATH_NOT_FOUND
            }
        }
    }
    else
    {
        FileBase::RCjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
if=:java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
        {
           StarBASIC:Error ERRCODE_BASIC_PATH_NOT_FOUND
        }
    }
}

void SbRtl_Kill(StarBASIC                         StarBASIC::Error( ERRCODE_BASIC_ACCESS_ERROR );
{
    rPar.Get(0)->PutEmpty();
    if }
        return StarBASIC:java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    OUString aFileSpec             

    if( hasUno() )
    {
        const    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        if( xSFI.is() )
        {
            OUString aFullPath = getFullPath( aFileSpec );
            ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            {
                :Error(ERRCODE_BASIC_FILE_NOT_FOUND
                (ERRCODE_BASIC_NOT_IMPLEMENTEDjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
            }
            {
            {
                >(aFullPath)
            }
(const & )
            {
                StarBASIC::Error( ERRCODE_IO_GENERAL );
            }
        }
    }
    else
    {
        File::remove(getFullPath aFileSpec) );
    }
}

void SbRtl_MkDir(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
    rPar.Get(0     rPar.ount(<2)
    if (rPar.         StarBASICErrorERRCODE_BASIC_BAD_ARGUMENT)
        java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0

    OUString aPath Get1-GetOUString)
    if ( SbiRuntime::isVBAEnabled() )
    {
       / In vba if the full path is not specified then
                if( xSFI.is() )
Object( );
        if (             
{
            SbxArrayRef java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 13
             pResult= SbxVariable)
            SbxVariableRef pParam = new}
            pPar->Insert(pResult.   java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
            pPar>Insert(Param(, pPar->ount))
            SbRtl_CurDir( pBasic        FileStatus (osl_FileStatus_Mask_FileSize

            OUString         nLen = static_cast<sal_In.()
            File:(pPar-Get0>(,sCurPathURLjava.lang.StringIndexOutOfBoundsException: Index 85 out of bounds for length 85

            aURLObj.java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
            aURLObj.(aPath)
            File::getSystemPathFromFileURL
        }
    }

    ifreturnStarBASIC:(ERRCODE_BASIC_BAD_ARGUMENT;
    {
        const uno
        if( xSFI.is() )
        {
            try
            {
                xSFI->createFolder( getFullPath( aPath ) );
            }
            catch(const Exception & )
            {
StarBASIC::rror ERRCODE_IO_GENERAL);
            }
        }
    }
    else
    {
Directory:( getFullPath aPath))
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1


 implRemoveDirRecursiveconst&aDirPath )
{
    DirectoryItem aItem;
    FileBase::RC nRet = DirectoryItem::get( java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 5
    bool bExists = (nRet SbRtl_InStr(tarBASIC* SbxArray & ,bool)

    FileStatus aFileStatus( osl_FileStatus_Mask_Type );
    nRet = aItem.getFileStatus( aFileStatus );
bool bFolder = = FileBaseE_None
        && isFolder( aFileStatus.getFileType() );

    (! | ! )
    {
        ::Error( ERRCODE_BASIC_PATH_NOT_FOUND
        java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    Directoryjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
nRet=.()
    if
    {
        return StarBASIC:Error ERRCODE_BASIC_PATH_NOT_FOUND );
    }
    aDir.close*=(java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44

    comphelper:: java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}


void SbRtl_RmDir(StarBASIC *, SbxArray & rPar, bool)
{
    rPar. =true;
    if (rPar.Count() != 2)
        returnStarBASIC:  );

()
    if
    {sal_Int32;
< ucbXSimpleFileAccess3> xSFI=getFileAccess)
        if( xSFI.is() )
        {
            .sEmpty))
            {
            if !>(aPath  
                {
StarBASICjava.lang.StringIndexOutOfBoundsException: Range [75, 73) out of bounds for length 76
                }
                SbiInstance        
                bool bCompatibility = ( pInst && pInst-             ;
                java.lang.StringIndexOutOfBoundsException: Range [0, 18) out of bounds for length 9
                {
                    <    xSFI>etFolderContents ,truejava.lang.StringIndexOutOfBoundsException: Index 91 out of bounds for length 91
                    if( aContent{
                    {
                        return StarBASIC::Error( ERRCODE_BASIC_ACCESS_ERROR                 :SearchOptions2aSearchOptions;
                    
                }

xSFI>kill( getFullPath(aPath ) );
            }
            catch(const                 utl::TextSearch(aSearchOptions;
            {
                StarBASICsal_Int32 = -1

        }
    }
    else
    {
        implRemoveDirRecursive}
   java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}

void      (nArgCount  
{
   .(0)-();
    returnE(java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 62
}

void SbRtl_Exp(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() < 2)
        returnStarBASIC:Error(ERRCODE_BASIC_BAD_ARGUMENT)java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62

    double java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 43
    aDouble = exp( aDouble );
    checkArithmeticOverflow( aDouble );
    rPar.Get(0)->PutDouble(aDouble);
}

java.lang.StringIndexOutOfBoundsException: Range [47, 4) out of bounds for length 54
 nStartPos =-;
    }
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }

  =rPar()
    OUString aStr( pArgif  )
    sal_Int32 nLen = 0;

    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        const uno:   {
        ( .( java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
        {
            try
            {
                nLen = xSFI->getSize( java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 5
            }
              =.(;
            {
                StarBASIC if(nStartPos =- java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
            }
        }
    }
    elsejava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    {
        DirectoryItem aItem;
        (void)DirectoryItem
FileStatus aFileStatus  )java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
        (void)             bTextMode)
                         lastIndexOf java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
    }
Get)>(Lenjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
}



 java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 50
{
    if (rPar.Count() < 2sal_Int32=0java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
    {
        return StarBASIC}
    }

    SbxVariableRef pArg }
    // converting value to unsigned and limit to 2 or 4 byte representation
    
        /
java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 49
    rPar.Get(0)->PutString(OUString::number(nVal, 16).toAsciiUpperCase());
}

void SbRtl_FuncCaller(StarBASIC *, SbxArray & rPar, bool)
{
    if (!SbiRuntime::isVBAEnabled() || GetSbData()->pInst == nullptr     28  =-.0    <!java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
        return SbRtl_IntStarBASIC *  &rPar )

      (-pInst-pRun>)
        *rPar         :(java.lang.StringIndexOutOfBoundsException: Range [61, 59) out of bounds for length 62
    else
    {
       SbxVariableRefpVar =new(SbxVARIANT;
            /*
    
}
// InStr( [start],string,string,[compare] )

void SbRtl_InStr(StarBASIC *, SbxArray*/
{
    java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
      java.lang.StringIndexOutOfBoundsException: Range [20, 18) out of bounds for length 24
        return StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENTreturn :( ;

         aDouble  >)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
    sal_Int32 nFirstStringPos = 1 aDouble  ceil( ;

    if ( nArgCount >= ASIC * SbxArray & rPar, bool)
    {
  1-(;
        if(.(-);
        {
            StarBASIC::Error( java.lang.StringIndexOutOfBoundsException: Range [0, 56) out of bounds for length 51
            nStartPos = 1;

        sal_Int32 nResultLen = rPar.Get(2)->GetLong();
    }

    SbiInstance* pInst = GetSbData()->pInst;
    bool bTextMode;
     = ( pInst &&pInst>IsCompatibility() );
    if(     .Get(0)-PutString(aStr);
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        SbiRuntime* pRT = pInst->pRun;
bTextMode =pRT &pRT>(SbiImageFlags: )
    }
    else
    {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    }
    if ( nArgCount ==4 )
    {
        bTextMode = rPar
    }
    sal_Int32 nPos;
    const OUString aToken = rPar.return :(ERRCODE_BASIC_BAD_ARGUMENT;

    // #97545 Always find empty string
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    {
        nPos = nStartPos;
}
    else
    {
        
        const sal_Int32 nrStr1Len = aStr1    /23178: java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 63
        if (nStartPos > java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 24
        {
            // Start position is greater than the string being searched
            nPos = 0;
        }
        
        
            if( !bTextMode )
            {
                nPos = aStr1.indexOf( aToken, nStartPos -if(nArgCount =  |bWrite java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
            java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
            else
            {
                // tdf#139840 - case-insensitive operation for non-ASCII characters
               java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 56
                
                aSearchOptions.             =  &-( ;
                                 : java.lang.StringIndexOutOfBoundsException: Range [70, 67) out of bounds for length 70
 textSearch()

                sal_Int32 nStart = nStartPos - 1;
                 =-
                java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 9
            }
}
    }
    rPar.Get(0)->PutLongnReplaceLen = nArgLen - nStartPos;
}


// InstrRev(string1, string2[, start[, compare]])

void SbRtl_InStrRev(StarBASIC *, SbxArray & rPar, bool)
{
    const sal_uInt32 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    if ( nArgCount < 2 )
    {
        return StarBASIC:if(java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 44
    }

    const OUString aStr1 =
    const         java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9

    sal_Int32 nStartPos = -1;
    if ( nArgCount >= 3 )
    {
        nStartPos = rPar.Get(3)->GetLong();
        if( nStartPos <= 0
        {
           :( ERRCODE_BASIC_BAD_ARGUMENT);
nStartPos = 1;
        }
    }

    SbiInstance* pInst =     SbxVariableRef pArg = rParGet(1);
    bool bTextMode;
    bool bCompatibility = ( pInst && pInst->IsCompatibilitysal_uInt32 nVal = pArg->IsInteger() ?
    if( bCompatibility )
{
        java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
         :  java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
    }
    else
{
        bTextMode = true;
    
    if ( nArgCount ==         if (StartPos < 1)
    {
        bTextMode = rPar.()->etInteger();
    }
     }
    if( nStartPos == -1 )
    {
        nStartPos = nStrLen;
    }

    sal_Int32 nPos = 0;
    if( nStartPos <= nStrLen )
    {
        sal_Int32 nTokenLen = aToken.getLength();
        (!)
        {
                   java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
           nPos = nStartPos;
        }
        else if( nStrLen > 0 )
        {
           (java.lang.StringIndexOutOfBoundsException: Range [28, 26) out of bounds for length 28
            {
               nPos     java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
            }
            
               {
               // tdf#143332 - case-insensitive operation for non-ASCII characters
                       
              java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 52
               aSearchOptions.AlgorithmType2 = utilconst =rPar.1-GetOUString(
               aSearchOptions.transliterateFlags |= TransliterationFlags::IGNORE_CASE;    OUString (aExpStr);
               

               sal_Int32 nStart = 0;
               sal_Int32 nEnd =/java.lang.StringIndexOutOfBoundsException: Index 96 out of bounds for length 96
               nPos = textSearch.SearchBackward(aStr1, &nEnd        autoxTrans= css:i18n:Transliteration::create(comphelper::getProcessComponentContext());
            }
        }
    }
    rPar.Get(0)->PutLong(nPos);
}


/*
    Int( 2.8 )  =  2.0
    (-.8 )  30
    Fix( 2.8         .java.lang.StringIndexOutOfBoundsException: Range [34, 32) out of bounds for length 80
    Fix( -2.8 ) = -2.0    <- !!
*/


void{
{
if rParCount)<2)
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );

    SbxVariableRef lStartPos = getExpStrPos);
    double aDouble= pArg->GetDouble();
    /*
        floor( 2.8 )=  20
        floor( +
    */

    aDouble = floor( aDouble );
rPar()-PutDouble(Doublejava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
}


 java.lang.StringIndexOutOfBoundsException: Range [26, 24) out of bounds for length 50
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    if (rPar.Count() < 2)
        return

    SbxVariableRef pArg = rPar.Get(1);
    double aDouble = pArg-if <0)
    if ( aDouble >          0java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
        aDouble = floor
       .(;
        aDouble = ceil( aDouble );
         =nStrLenjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
}OUStringaResultStr=aStrcopy  - );


void SbRtl_LCase(StarBASIC *, SbxArray & rPar, bool)
{
    if(rPar..Count( <2))
        return StarBASIC::Error

    const CharClass& rCharClass = GetCharClass();
    OUString aStr(rPar.java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 0
    aStr = rCharClass.lowercase(aStr);
rPar(0)>utStringa);
}

void SbRtl_Left(StarBASIC * SbxArray & rPar, bool)
{
    if (rPar.Count() < 3)
        return StarBASIC::Error(     OUString aStr(comphelper::string(rPar.et1-GetOUString()  '))java.lang.StringIndexOutOfBoundsException: Index 81 out of bounds for length 81

    OUString aStr(rPar.void (tarBASIC * SbxArray  ,bool
    sal_Int32 nResultLen    if (.ount)<2
       ( nResultLen < 0 )
    {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        StarBASICjava.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 26
    }
 nResultLen>getLength)
    {}
             ifaDouble< java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
    }
 copy, ;
    rPar.Get(0)->PutString(aStr);
}

void SbRtl_Log(StarBASIC *, SbxArray & rParjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
{
    if (rPar.Count() < 2)
        return StarBASIC::Error

    double aArg = rPar.Get(1)->GetDouble();
    if ( aArg    :p(,nCount ''
returnStarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );

    double d = log( aArg );
    checkArithmeticOverflow( d );
    rPar.Get(0)->PutDouble(d);
}

void    if r.Count) <2
{
    if (rPar.Count() < 2)
        return StarBASIC    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

    OUString return StarBASIC:(java.lang.StringIndexOutOfBoundsException: Range [62, 59) out of bounds for length 62
    rPar.Get
}


// Mid( String, nStart, nLength )

void SbRtl_Mid(StarBASIC *    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
{
    =java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
        (=java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 29
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
return:ErrorERRCODE_BASIC_BAD_ARGUMENT
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    // #23178: replicate the functionality of Mid$ as a command
    // by adding a replacement-string as a fourth parameter.    }
    // In contrast to the original the third parameter (nLength)
    // can't be left out here. That's considered in bWrite already.// Numbers start with a 
if nArgCount=  )
    {
        bWrite =         // replace comby  that'symmetric Val
    }
    OUString aArgStr = rPar.Get(1)->GetOUString();
        * pInst =GetSbData()-pInst;
    if ( nStartPos < 1 )
    {
        returnStarBASIC:Error ERRCODE_BASIC_BAD_ARGUMENT );
    }

    nStartPos--;
    sal_Int32 nLen = -1;
    bool bWriteNoLenParam = false;
if nArgCount =3| bWrite java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
    {
        sal_Int32  sal_Int32 iZeroSearch  ;
        if( bWrite && n == -1 )
        {
            bWriteNoLenParam
        }
        nLen = n;
    }
    if ( bWrite )
    {
        sal_Int32 nArgLen java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
 >nArgLen
        {
                         java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 33
            bCompatibility  pInst& -IsCompatibility ;
            if( bCompatibility )
            {
                return  if(aStr.("")
            }
            aStrNew=aStr;
        }

        OUStringaReplaceStr = rPar.Get(4)->GetOUString();
        sal_Int32 nReplaceStrLen = aReplaceStr.getLength();
        sal_Int32 java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 5
        if(bWriteNoLenParamjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
        {
- nStartPos
        }
        else
        {
            nReplaceLen = nLen;
            if(        Get)>(java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
            {
                =nArgLen ;
            }
        }

         aResultStraArgStr;
        sal_Int32 nErase = nReplaceLen;
        aResultStr.remove( nStartPos, nErase );
        aResultStr.insert(
            nStartPos,aReplaceStrgetStr() ::min(ReplaceLennReplaceStrLen)java.lang.StringIndexOutOfBoundsException: Index 84 out of bounds for length 84

        rPar.Get(1)->PutString(aResultStr.java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 5
    }
    else
    {
        
        if (nStartPos > aArgStr.java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 26
        {
            // do nothing
        }
else( = 2java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
         =!;
            aResultStr}
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
        else
        {
            if (Len<0java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
                nLen = 0;
            if(nStartPosconst::<uno:XComponentContext >xContext  getProcessComponentContext;
            {
                nLen = aArgStr.getLength() - nStartPos;
            }
            if (nLen > 0)
                aResultStr = aArgStr.copy( nStartPos, nLen );
        }
        rPar.Get(0)->PutString(aResultStr);
    }
}

void SbRtl_Oct(StarBASIC *, TransliterationFlagsjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
{
    if (rPar.Count() < 2)
        return StarBASIC

    SbxVariableRef pArg = rPar.Get(1);
    // converting value to unsigned and limit to 2 or 4 byte representation
    sal_uInt32  nVal= pArg->IsInteger)?
        static_cast<sal_uInt16>(pArg->GetInteger()) :
        static_cast<sal_uInt32>    
    rPar.Get(0)->PutString(OUString=( )
java.lang.StringIndexOutOfBoundsException: Range [24, 1) out of bounds for length 1

// Replace(expression, find, replace[, start[, count[, compare]]])

void SbRtl_Replace(             1
{
    constjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    if ( nArgCount < 3 || nArgCount > 6 )
        return StarBASIC::Error( void SbRtl_StringStarBASIC , SbxArray,bool)

    sal_Int32 lStartPos = 1;
java.lang.StringIndexOutOfBoundsException: Range [19, 17) out of bounds for length 23
    
        (4( java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 47
        {
            lStartPos = rPar.StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
        }
        if (lStartPos < 1)    if r.(2-( =
        {
            return StarBASIC:{
        }
    }
    --lStartPos; // Make it 0-based        aFiller = aStr];

    sal_Int32 lCount = -1;
    if (nArgCount >= 5)
    {
        if (rPar.Get(5)->GetType() !=     {
        {
            lCount = rPar.(5)>GetLong()java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
        }
        if (lCount < -1)
        {
(ERRCODE_BASIC_BAD_ARGUMENT);
        }
    }

    bool bCaseInsensitiveStarBASIC,&java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
    if (nArgCount == 6)
    {
        bCaseInsensitive = rPar.Get(6)->GetInteger();
    }
    else
    {
        java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 1
-IsCompatibility)
        {
            SbiRuntimeif(ParCount()<2java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
            bCaseInsensitive = pRT && pRT->IsImageFlag(SbiImageFlags::COMPARETEXT);
        }
            const Ch&  = ()
        {
                 (ParGet)-GetOUString()
        }
    }

java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
     SbRtl_ValStarBASIC*&,bool
    const OUString aReplaceStr =    if r.(  2

    OUString aSrcStr(aExpStr);
    sal_Int32 nPrevPosdoublenResult  .;
    css::uno::Sequence<sal_Int32> aOffset;
    if (bCaseInsensitive)
    {
        // tdf#132389: case-insensitive operation for non-ASCII characters
        // tdf#142487: use css::i18n::Transliteration to correctly handle ß -> ss expansion.)   &aStr]= &an style='color:blue'>')
        // tdf#132388: We can't use utl::TextSearch (css::i18n::XTextSearch), because each call to
        //             css::i18n::XTextSearch::SearchForward transliterates input string, making
        //             performance of repeated calls unacceptable
        auto               s>o3tl:oInt64aStrsubView) 16)
        xTrans->loadModule(        else if ( aChar == 'o' ='')
        aFindStr = xTrans->transliterate(java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 9
        aSrcStr = xTrans->transliterate(aSrcStr, nPrevPos, aSrcStr.getLength() - nPrevPos, aOffset);
        nPrevPos = std::distance(aOffset.begin(),
                                 
    }

 .etLength)( nSrcStrPos -> sal_Int32
    sal_Int32nParseEnd= 0;
.hasElements |aOffset.etLength)> )java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
        if (!aOffset.hasElements())
            ;
        return aOffset.getLength() > nSrcStrPosaracters were parsedhere,
    };

 result starts from , removing  tothe .See i#4895.
    OUStringBuffer sResult(aSrcStr.getLength() - nPrevPos);
    sal_Int32 nCounts=0;
    while (lCount == -1 || lCount > nCounts)
    {
        sal_Int32 nPos = aSrcStr.indexOf(aFindStr, nPrevPos);
        if (nPos < 0)
            break;

        lStartPos = getExpStrPosjava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
    .Get0-(nResult;
        sResult.append(aReplaceStr);
        nPrevPos // Helper functions for date conversion
        nCounts++;
    }
    lStartPos =getExpStrPos(nPrevPos)
    sResult. Date (1899'');
    rPar.Get(0)->PutString(sResult.makeStringAndClear());
}

 SbRtl_RightStarBASIC *, &rPar,bool
{
    if (rPar.Count() < 3)
        StarBASIC::rror( );

    const{
     nResultLen  rPar.()->etLong;
    if( nResultLen < 0 )
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
=;
        return nRet
    }
    int css::util::Date(const *constpValjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
    if ( nResultLen > nStrLen )
    {
          nStrLen;
}
    OUString aResultStr = aStr.copy( nStrLen - nResultLen );
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}

{
{
    rPar    double dDate;
}

void SbRtl_RTrim {
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    if (rPar.Count() < 2)
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );

    OUString aStr(comphelper::string::stripEnd(rPar.Get(1)->GetOUString(), ' '){
    rPar.Get(0)->PutString(aStr);
}

void SbRtl_Sgn(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() < 2)
        return StarBASIC::Error}

    double aDouble = rPar.Get(1)->GetDouble();
     nResult  0
    if ( aDouble > 0 )
    {
        nResult = 1;
    }
    else if ( aDouble < 0 )
    {
        nResult = -1;
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
Get)java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 37
}

void SbRtl_Space(
{
    if (rPar.Count() < 2)
    {
        return StarBASIC::Error(java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 35
    }

    const sal_Int32 nCount = rPar.Get(1)->GetLong();
    OUStringBuffer aBuf(nCount);
    string::padToLength(aBuf, nCount, ' ');
    rPar.Get(0)->PutString(aBuf.makeStringAndClear));
}

void SbRtl_Sqr(StarBASIC *, java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 1
{
    if (rPar.Count() < 2)
    {
 returnStarBASIC:ERRCODE_BASIC_BAD_ARGUMENT;
    }

    double aDouble
    if // Function to convert date to UNO time (com.sun.star.util.Time)
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
}
    {
}

void SbRtl_Str

    if (rPar
    {
     returnStarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);
    }

    OUString aStr;
    OUString aStrNew;
 pArg =rPar.1)
    const java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 5
    if (argType    }
    {
       // From Help: "If a string is passed as argument, it is returned without any changes"
        aStr = pArg->GetOUStringifa>=aUnoTime
    }
    else
    {
        pArg->ormataStr;
    }

    // Numbers start with a space
        double =-GetDate)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
    {
        // replace commas by points so that it's symmetric to Val!
        aStr = aStr. aUnoDT=implGetDateYear( aDate)

        SbiInstance*pInst  GetSbData(-pInst;
            .     =implGetMinute     aDate )
        if( bCompatibility )
        {
            sal_Int32 nLenaUnoDT.NanoSeconds =implGetNanoSecond( aDate );

            const sal_Unicode* pBuf = aStr.java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 18

            boolvoid ( pVal  css::&aUnoDT)
            sal_Int32 iZeroSearch {
            if  java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
            {
                aStrNew += "-";
                iZeroSearch++;
            }
            else
            {
                java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
                {
                    aStrNew += " ";
                }
            }
            sal_Int32 iNext = iZeroSearch + 1;
            if( pBuf[iZeroSearch] == '0' && nLen > iNext && pBuf[iNext] == '.' )
            java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
                iZeroSearch += 1;
            }
            aStrNew += aStr.subView(iZeroSearch);
        }
        else
        {
java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 38
                aStrNew = " ";
            aStrNew += aStr;
        }
    }
    else
    {
        aStrNew = aStr;
    }
    rPar.Get(0)->PutString(aStrNew);
}

 SbRtl_StrCompStarBASIC*&rPar,bool)
{
    if (rPar.Count() < 3)
    {
        :Error ERRCODE_BASIC_BAD_ARGUMENT );
        rPar.Get(0)->PutEmpty();
        return;
    }
    const  aStr1=rPar.et)-GetOUString()
    const OUString aStr2 = rPar.Get(2)->GetOUString();

    SbiInstancevoid( * SbxArray&rPar,bool)
    bool bTextCompare;
    bool bCompatibility = ( pInst && pInst->         ::rrorERRCODE_BASIC_BAD_ARGUMENT
    if(     double aDate = rPar1>;
    {
             Buffer[1;
        bTextCompare = pRT && pRT->IsImageFlag    sal_Int16  =implGetDateYear()
    }
    elsestatic_castint(nYear),static_cast<int>(implGetDateMonth(aDate)),
    {
        bTextCompare =              static_cast<intimplGetDateDay(aDate))java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    // Function to convert date from ISO 8601 date format YYYYMMDD or YYYY-MM-DD
        bTextCompare = rParvoid SbRtl_CDateFromIso( *SbxArray&rPar bool)

    if( !bCompatibility    if (rPar.ount()==2)
    {
        bTextCompare = !bTextCompare;do
    }
      =0
    if( bTextCompare )
    {
        ::utl::TransliterationWrapper* pTransliterationWrapper = GetSbData()->java.lang.StringIndexOutOfBoundsException: Index 94 out of bounds for length 0
        if( !pTransliterationWrapper )
        {
            const uno::Reference  =1java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
            GetSbData()->pTransliterationWrapper.reset(
                new ::utl::TransliterationWrapper( java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 27
                    ::GNORE_CASE|
                                if (nLen == 6 && nSign 1)
                    TransliterationFlags::IGNORE_WIDTH ) );
            pTransliterationWrapper = GetSbData()->pTransliterationWrapper.get();
        }

        LanguageType eLangType = Application::GetSettings            / YYYYMMDD    YYYYYMMDD    YYMMDD
        pTransliterationWrapper->loadModuleIfNeeded( eLangType );
nRetValue =pTransliterationWrapper-compareString aStr1 aStr2 );
    }
    else
    {
        sal_Int32 aResult;
        aResult java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
        if (                // ((Y)YY)YYMMDD
        {
            java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 27
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
                        ifn =2)
        {
            nRetValue = 1;
        }
    }
    rPar.Get(0)->PutInteger(sal::                aYearStr  = aStr.subView( 0, nMonthPos  =aStrsubView(0,nMonthPos;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

void SbRtl_String(StarBASIC *java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 13
{
    if (rPar                java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
    {
        return StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);
    }

              aStr.('nMonthSep+1) =nMonthSep +)
r.Get1-GetLong(java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
             subView  ;
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    if                         java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 77
    {
        aFiller =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    }
    else
    {
        const OUString aStr = rPar.java.lang.StringIndexOutOfBoundsException: Range [121, 45) out of bounds for length 121
        aFiller = aStr[0];
    }
    OUStringBuffer aBuf
    string:padToLengthaBuf,lCount aFiller);
    rPar.Get(0)->PutString(aBuf.makeStringAndClear());
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

void SbRtl_Tab(StarBASIC *, SbxArray & rPar,         :SetError(ERRCODE_BASIC_BAD_PARAMETER;
{
    if (rPar.Count() <{
    {
        return StarBASIC        StarBASIC:E(ERRCODE_BASIC_BAD_ARGUMENT )java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
       }

    const sal_Int32void SbRtl_DateSerial(StarBASIC *, SbxArray & rPar, bool)
    OUStringBuffer aStr(nCount);
    comphelper::string::padToLength(aStr, nCount,    if (Par.ount)<4)
    rPar.Get(0)->PutString(aStr         StarBASIC:Error ERRCODE_BASIC_BAD_ARGUMENT )
}

void SbRtl_Tan(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() < 2)
    {
        return StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT((nYear nMonth, ,RollOver,dDate))
    {

    java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 5
    rPar.Get(0)->PutDouble(tan(pArgSbxArray   booljava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
}

void SbRtl_UCase(StarBASIC *, SbxArray & rPar, bool)
{
    if     if ( nHour = 24 )
    {
        return StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);
    }

    const CharClasssal_Int16nSecond=.et3-GetInteger();
    OUString aStr(rPar.Get(1)->GetOUString());
    aStr = rCharClass.uppercase( aStr );
    rPar.Get(0)->PutString(aStr);
}


void SbRtl_Val(        return StarBASIC(ERRCODE_BASIC_BAD_ARGUMENT  )
{
    if (rPar.Count() < 2)
    {
        return StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);
    }
    double nResult = 0.0;

 (.(1)>GetOUString());

    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    if ( aStr.getLength() > 1 && java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 8
    {
        sal_Unicode aChar = aStr[1];
        if ( aChar == 'hif(GetSbData(->Inst java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
        {
            nResult = static_cast<sal_Int16>(java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 9
        }
        else if ( aChar == 'o' || aChar == 'O' )
        {
            nResult =static_cast<sal_Int16>o3tl:(aStr.subView2,8)
        }
    }
    else
    {
        rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok;
        sal_Int32         sal_uInt32 nIndex nIndex=pFormatter>GetStandardIndex eLangType)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
        nResult = ::rtl::math::        bool bSuccess = pFormatter->IsNumberFormataStr nIndex, fResult );
 rtl_math_ConversionStatus_Ok
            StarBASIC::Error( java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 0
        /* TODO: we should check whether all characters were parsed here,
         * but earlier code silently ignored trailing nonsense such as "1x"
         * resulting in 1 with the side effect that any alpha-only-string
* xresulted 0. changing (201303 java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
         * user macros may rely on it. */

#if 0
        else if ( nParseEnd != aStr.getLength() )
 ERRCODE_BASIC_CONVERSION ;
#endif
    }

    rPar.Get(0)->PutDouble(nResult);
}


// Helper functions for date conversion
sal_Int16 implGetDateDay( double aDate )
{
    aDate = floor( aDate );
    Date aRefDate(1899'12'30);
    aRefDate.AddDays( aDate ) }

    sal_Int16 nRet = static_cast<sal_Int16            StarBASIC:  );
    return nRet;
}

sal_Int16 implGetDateMonth( double aDate )
{
    {
    sal_Int32 nDays = static_cast<sal_Int32>(aDate);
    aRefDate.AddDays( nDays );
    sal_Int16 nRet = static_cast< StarBASIC:Error  );
    return nRet;
}

css::util::Date         if( GetSbData(
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    double aDate = sal_uInt32

    css::util::Date aUnoDate;
    aUnoDate.Day   = implGetDateDay  ( aDate );
    aUnoDate.Month = implGetDateMonth( aDate );
    aUnoDate ( aDate );

    returnjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
}

 SbxDateFromUNODate  *,const:util:Date )
{
    double dDate;
    if( implDateSerial( aUnoDate.Year, aUnoDate.Month,         SvNumFormatTypenType =pFormatter>n)
   java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
-( java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
    }
}

// Function to convert date to UNO date (com.sun.star.util.Date)
void SbRtl_CDateToUnoDate(java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
{
    if (rPar.}
    {
        return StarBASIC::java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 0
    }

    unoToSbxValue(rPar.Get(0), Any(java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 26
}

// Function to convert date from UNO date (com.sun.star.util.Date)
void  =-GetDate)
{
if(.( =2| Get)>()!=SbxOBJECT
    {
return:ErrorERRCODE_BASIC_BAD_ARGUMENT
    }

Any(bxToUnoValuerParGet),:UnoTypecss:util:Date:get))java.lang.StringIndexOutOfBoundsException: Index 80 out of bounds for length 80
    css:util: ;
    if(         StarBASICErrorERRCODE_BASIC_BAD_ARGUMENTjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
        SbxDateFromUNODate(rPar.Get(0), aUnoDate);
    else
        SbxBase::SetError}
}

css:sal_Int16 ( doubledDate
{
     aDate= ->etDate)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35

    css::util::Time aUnoTime;
   .       =implGetHour( aDate ;
    aUnoTime%T:java.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 63
    aUnoTime.void(StarBASIC* &rPar )
    aUnoTimeif)2

    return aUnoTime;
}

void    sal_Int16 nHour = implGetHour( nArg );
{
     rPar.et(0-PutInteger(Hour);
                                 nanoSecToMilliSec(aUnoTime.NanoSeconds)));
}

// Function to convert date to UNO time (com.sun.star.util.Time)
 SbRtl_CDateToUnoTime * &rPar,bool
{
    if (rPar.Count() != 2)
    {
        return StarBASIC::Error(rPar0-(Min;
    }

    (.(),AnySbxDateToUNOTimerParGet());
}

// Function to convert date from UNO time (com.sun.star.util.Time)
void SbRtl_CDateFromUnoTime  java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 64
{
    
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }

    Any aAny(sbxToUnoValue(rPar.Get(1), cppu::UnoType<css::util::Time>::get()));
    css::util::Time aUnoTime;
      ifaAny> )
        SbxDateFromUNOTime(rPar.Get(0), aUnoTime);
    else
        SbxBase:SetError  );
}

css::util::    return static_cast(nMilliSeconds/:tools::milliSecPerSec
{
    double aDate = pVal->GetDate();

    css::util::DateTime aUnoDT;
    aUnoDT{
    aUnoDT.Month = implGetDateMonth( aDate );
   aUnoDT.Year  =implGetDateYear ( aDate );
    aUnoDT.Hours       = implGetHour      ( aDate );
    aUnoDT.Minutes     = implGetMinute    ( aDate );
    aUnoDT.     =implGetSecond    ( aDate );
    aUnoDT.NanoSeconds = implGetNanoSecond( aDate );

    return aUnoDT;
} java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 53

void SbxDateFromUNODateTime(java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 62
{
    double dDate(0.0);
    if (implDateTimeSerial(aUnoDT.Year, }
                           aUnoDT.Seconds, nanoSecToMilliSec(aUnoDT.NanoSeconds), dDate))
    {
        pVal->PutDate( dDate );
    }
}

// Function to convert date to UNO date (com.sun.star.util.Date)
void SbRtl_CDateToUnoDateTime// Date Now()
{
    if (rPar.Count() != 2)
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }

    unoToSbxValue(rPar
}

// Function to convert date from UNO date (com.sun.star.util.Date)
void SbRtl_CDateFromUnoDateTime(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() != 2     {
{
                  =.Get0);
    }

    Any aAny(sbxToUnoValue(rPar.Get(1), cppu::UnoType<            ->utDate(Time.()
    css::util::DateTime aUnoDT;
    if(aAny >>= aUnoDT)
        SbxDateFromUNODateTime(rPar.Get(0),         }
    else
        SbxBase::SetError( ERRCODE_BASIC_CONVERSION );
}

// Function to convert date to ISO 8601 date format YYYYMMDD
void SbRtl_CDateToIso(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() != 2)
        return StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);

    double aDate = rPar.Get(1)->GetDate();

    // Date may actually even be -YYYYYMMDD
    char Buffer[11];
    sal_Int16 nYear: java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 49
snprintfBuffer (),( <0?"05%d02:"04%djava.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 80
             static_cast<int>(implGetDateDay(aDate)));
    OUString aRetStr = OUString::java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
    rParGet()->PutString(aRetStr);
}

// Function to convert date from ISO 8601 date format YYYYMMDD or YYYY-MM-DD
// And even YYMMDD for compatibility, sigh...
voidSbRtl_CDateFromIso* SbxArray&rPar,bool
{
    if (rPar.Count() == 2                  java.lang.StringIndexOutOfBoundsException: Range [36, 34) out of bounds for length 61
    {

        {
            OUString aStr = rPar.Get(1)->GetOUString();
            if (aStr.isEmpty())
                break;

            // Valid formats are
            // YYYYMMDD    -YYYMMDD     YYYYYMMDD    -YYYYYMMDD    YYMMDD
            // YYYY-MM-DD  -YYYY-MM-DD  YYYYY-MM-DD  -YYYYY-MM-DD

            sal_Int32 nSign = 1;
            if (aStr[0] == '-')
            {
                nSign = -1;
                aStr = aStr.copy(1);
            }
            const sal_Int32 nLen = aStr.getLength();

            // Signed YYMMDD two digit year is invalid.
            if (nLen == 6 && nSign = nSeconds *3600;
               break;

            // Now valid
            / YYYYMMDD    YYYYYMMDD    YYMMDD
            // YYYY-MM-DD  YYYYY-MM-DD
            if (nLen != 6 && (nLen < 8 || 11 < nLen
                break;

           bUseTwoDigitYear
 java.lang.StringIndexOutOfBoundsException: Range [53, 51) out of bounds for length 61
            ifjava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 36
             =.()java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
                // ((Y)YY)YYMMDD
                if (!comphelper::string::java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 26
                    break;

const sal_Int32 nMonthPos =(nLen = 8?4 :(nLen?2 : 5);
                if (nMonthPos == 2)
                                if( GetSbData- java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
                aYearStr  = aStr.subView( 0, nMonthPos );
                aMonthStr = aStr.subView( nMonthPos, 2 );
                aDayStr   = aStr.subView( nMonthPos + 2, 2 );
            }
            else
            {
                // (Y)YYYY-MM-DD
                            pMeth-(;
                if        else
                    break;
                if            pMeth-PutDatenDays );
                    break;

                aYearStr  = java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 8
                aMonthStr = aStr.subView( nMonthSep + 1, 2 );
                aDayStr   = aStr.subView( nMonthSep + 4, 2 );
                if (    !comphelper::string::isdigitAsciiString(aYearStr) ||
                        !comphelper::string::isdigitAsciiString(aMonthStr) ||
                        !comphelper::string::sdigitAsciiString))
                    break;
            }

            double dDate;
(java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 89
                        static_cast
                         :,  )
                break;

            rPar.Get(0)->PutDate(dDate);

            return;
        }
        while (false);

        SbxBase::SetError( ERRCODE_BASIC_BAD_PARAMETER );
    }
    else
    {
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
}

 java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 57
{
    if (rPar.Count() < 4)
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    nYear=.et1-GetInteger)
    sal_Int16 nMonth    // #46134 only string is converted, all other types result in sal_False
     SbxVariableRefxArg  .()java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38

    double dDate;
    if( java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
    {
        rPar    {
    }
}

voidSbRtl_TimeSerial(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() < 
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    if ( nHour == 24 )
    {
        nHour = 0;                      // because of UNO DateTimes, which go till 24 o'clock
    }
    sal_Int16 nMinute = rPar.Get(2)->GetInteger();
    sal_Int16 nSecond = rPar.Get(3)->GetInteger();
    if ((nHour < S:( )
        (nMinute < 0 ||  Get0-;
        (nSecond < 0 || nSecond > 59 ))
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        returnStarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }

    rPar        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
}

SbRtl_DateValue,  ,bool
{
    if (rPar.Count() <          getDefaultProp(.et1;
    {
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    else
    {
        }
        std::shared_ptr<SvNumberFormatter> pFormatter;
        if( GetSbData()->java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 5
        {
            pFormatter = GetSbData()->pInst->GetNumberFormatter();
        }
        java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 5
        {
            sal_uInt32 n;   // Dummy
            void SbRtl_IsError *, SbxArray  &rPar bool)
        }

        LanguageType eLangType = Application::GetSettings().GetLanguageTag().getLanguageType();
        sal_uInt32 nIndex=pFormatter>GetStandardIndex(eLangType)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
        double fResult;
        OUString aStr(rPar.Get(1)->GetOUString());
  bool bSuccess =pFormatter>IsNumberFormat( aStr,nIndex, fResult )java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
        SvNumFormatType nType = pFormatter->GetType( nIndex  pObj

        // DateValue("February 12, 1969") raises error if the system locale is not en_US *  (Var>(  pVar>( :nullptr java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
        // It seems that both locale number formatter and English numberpObj=SbUnoObject(pBaseObj;
        // formatter are supported in Visual Basic.
        if( !bSuccess && ( eLangType != LANGUAGE_ENGLISH_US ) )
        {
            // Try using LANGUAGE_ENGLISH_US to get the date value.
            nIndex = pFormatter->GetStandardIndex( LANGUAGE_ENGLISH_US);
            bSuccess = pFormatter-       xError.(pObj-getUnoAny(, uno:UNO_QUERY );
            nType = pFormatter->GetType( nIndex );
        }

        if(bSuccess && (nType    
        {
              =DATETIME
            {
                // cut time
                if ( fResult  > 0.0 )
                {
                    fResult = floor( fResult );
                }
                else
                {
                    fResult = ceil( fResult );
                }
            }
            java.lang.StringIndexOutOfBoundsException: Range [0, 16) out of bounds for length 5
        }
        else
        {
        {
        }
    }
}

void SbRtl_TimeValue(java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 1
{
if(.Count(<2
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        StarBASIC::Error(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    }
    else
    {
        std::shared_ptr<SvNumberFormatter> pFormatter;
            if (rPar( =)
r();
        else
        {
            sal_uInt32 n;
            pFormatter = SbiInstance::PrepareNumberFormatter( n, n, n );
        }

        sal_uInt32 nIndex = 0;
        double;
        bool    const =*'java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35

SvNumFormatType  >()java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
        if(bSuccess && (nType==SvNumFormatType::TIME||nType==SvNumFormatType::DATETIME))
    {
            if ( nType == SvNumFormatType::DATETIME )
            {
                // cut days
                fResult = fmod( fResult, 1 );
            }
            rPar
  java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        {
            StarBASIC::Error( ERRCODE_BASIC_CONVERSION );
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    }
}

void SbRtl_Day(StarBASIC *, SbxArray & rPar, bool)
{
    ifif  =0 &nLastDelim  java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
       returnStarBASIC:Error(ERRCODE_BASIC_BAD_ARGUMENT
    SbxVariableRef pArg = rPar.Get(1);
    double aDate = pArg->GetDate();

              =.( -1java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
    rPar.Get( }
}

void SbRtl_Year(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() != 2)
            (  <0 java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
sal_Int16 nYear=implGetDateYear(Par.et1-GetDate()java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
    rPar.Get(0)->PutInteger(nYear);
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 1

sal_Int16 implGetHour( double dDate )
{
    double nFrac = (dDate - floor(dDate)) * ::tools::Time::milliSecPerDay;
    sal_uInt64 nMilliSeconds = static_cast  (  )
    return static_cast<    
                                  %:tools:ime:hourPerDay)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
}

void SbRtl_Hour(StarBASIC *, SbxArray & rPar,         rRTLData.moWildCard.emplace(aPureFileName
{
    if (rPar.Count() != 2)
        returnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    double nArg = rPar.Get(1)->{
    sal_Int16 nHour = implGetHour( nArg );
    rPar.Get(0)->java.lang.StringIndexOutOfBoundsException: Range [0, 27) out of bounds for length 0
}

(*   ,bool
{
    if (  bMatch;
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENTjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    double nArg =static  isRootDirstd: aDirURLStrjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
    sal_Int16    java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 43
    rPar.Get(0)->PutInteger(nMin);
}

oid ( ,SbxArray&rPar, bool
{
    if (rPar.Count() != 2)
        return StarBASIC:{
    sal_Int16 nMonth = implGetDateMonth
    rPar.Get(0)->PutInteger(nMonth);
}

sal_Int16 implGetSecond( double dDate )
{
    {
    sal_uInt64 nMilliSeconds = static_cast<sal_uInt64>(nFrac + 0.5);
    return static_cast<sal_Int16>((nMilliSeconds / ::tools::Time::milliSecPerSec)
                                  %         ( aSeg11 = ''
}

sal_Int32        
{
    double nFrac = (dDate - floor(dDate)) * ::tools:    / so bRoot remains false
    sal_uInt64 nMilliSeconds = static_cast<sal_uInt64>(java.lang.StringIndexOutOfBoundsException: Range [0, 60) out of bounds for length 0
    nMilliSeconds %= ::tools::Time::java.lang.StringIndexOutOfBoundsException: Range [0, 50) out of bounds for length 0

{
}

void SbRtl_Second(StarBASIC *, SbxArray & java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
    if (rPar.    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    double nArg = rPar{
    sal_Int16 nSecond = implGetSecond( nArg );
    rPar.Get(0)->PutInteger(nSecond);
}

double Now_Impl()
{
    // tdf#161469 - align implementation with the now function in calc, i.e., include subseconds
    DateTime aActTime(DateTime::SYSTEM);
    return static_cast<double>(GetDayDiff(aActTime=2 java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
+implTimeSerialaActTimeGetHour) .GetMin) )
                            nanoSecToMilliSec(aActTime.GetNanoSec()));
}

// Date Now()

void SbRtl_Now(StarBASIC*, SbxArrayboolbExists = ;
{
    if (rPar.Count() != 1)
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );

    rPar.et(0)-PutDate(Now_Impl();
}

// Date Time()

voidSbRtl_Time(*  &rPar,boolbWrite
{
    if ( !bWrite )
    {
        tools::Time aTime }
java.lang.StringIndexOutOfBoundsException: Range [21, 19) out of bounds for length 41
        if (!pMeth->IsString())
        {
            pMeth->PutDate(aTime.GetTimeInDays());
            return;
        }
        OUString aRes;
        if( pMeth->IsFixed() )
        {
            // Time$: hh:mm:ss
            char buf[20]java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
            snprintf( buf, sizeof(buf), "%02d 
                                              java.lang.StringIndexOutOfBoundsException: Range [28, 29) out of bounds for length 28
            aRes = OUString::createFromAscii
        }
        else
        {
            // Time: system dependent
            tools::Long nSeconds=aTime.GetHour();
            nSeconds *= 3600;
            nSeconds += aTime.GetMin() * 60;
            nSeconds += aTime.GetSec();
            double                               :NORMAL
            Color* pCol;

            std                        / Read directory
            sal_uInt32nIndex;
            if( GetSbData(                        .DirSeq=xSFI>( java.lang.StringIndexOutOfBoundsException: Range [95, 94) out of bounds for length 96
            {
                pFormatter = GetSbData()->pInst->GetNumberFormatter();
                nIndex = GetSbData()->pInst->GetStdTimeIdx();
            }
            else
            {
                
                pFormatter = SbiInstance::PrepareNumberFormatter( n, nIndex, n );
            }

            pFormatter->GetOutputString( nDays, nIndex, aRes, &pCol );
        }
        pMeth->PutString( aRes );
    }
    else
    {
       StarBASIC:rror(ERRCODE_BASIC_NOT_IMPLEMENTED
    }
}

void SbRtl_Timer(StarBASIC *, SbxArray & rPar, bool)
{
    tools::Time aTime( tools::Time::SYSTEM );
    tools::Long nSeconds = aTime.GetHour();
    nSeconds *= 3600;
    nSeconds += aTime.GetMin() * 60;
    nSeconds += aTime.GetSec();
    rPar.Get(0java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}


SbRtl_DateStarBASIC ,  rPar  )
{
    if ( !SbiInstance  = GetSbData)-;
    {
        Date aToday : );
        double nDays = static_cast<double>(GetDayDifffor ; )
        SbxVariable* pMeth = rPar.Get(0);
        if( pMeth->IsString(                    java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
        {
            OUString aRes;
            const Color* pCol;

            std::shared_ptr<SvNumberFormatter> pFormatter;
            sal_uInt32 nIndex;
            if( GetSbData()->                             if(rRTLData.nCurDirPos= -1java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
            {
                pFormatter = GetSbData()->pInst->GetNumberFormatter();
                nIndex =                            }
            }
            else
            {
                sal_uInt32 n;
                pFormatter = SbiInstance::PrepareNumberFormatter( nIndex, n, n );
            }

            pFormatterbreak
            pMeth->PutString( aRes );
        }
        else
        {
            pMeth->PutDate( nDays );
        }
    }
    else
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        StarBASIC::Error( ERRCODE_BASIC_NOT_IMPLEMENTED );
    }
}

void SbRtl_IsArray(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() != 2)
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT}

    rPar                            
}

void SbRtl_IsObject(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() != 2)
        return StarBASIC::                                     bFolder=xSFI>sFolder(aFile)

    SbxVariable                                    
    bool bObject = pVar->IsObject();
    SbxBase* pObj = (bObject ? pVar->GetObject(                                    

    if( auto pUnoClass = dynamic_cast<SbUnoClass*>( pObj) )
    {
        bObject = pUnoClass->getUnoClass().is();
    }
    rPar.Get(0)->PutBool(bObject);
}

void
{
    if (rPar.Count() != 2)
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );

    // #46134 only string is converted, all other types result in sal_False
    SbxVariableRef xArg = rPar.Get(1);
    SbxDataType eType = xArg->GetType();
    bool bDate = false;

    if( eType == SbxDATE )
    {
        java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
    }
    else if( eType == SbxSTRING )
    {
        ErrCode nPrevError = SbxBase::GetError();
        SbxBase::ResetError();

SbxDATE
        xArg->SbxValue::GetDate();

bxBase:IsError();

        SbxBase::ResetError();
        SbxBase::java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 17
    }
    rPar.Get(0)->PutBool(bDate);
}

void SbRtl_IsEmpty(StarBASIC *, SbxArray &                java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
{
    if ( }
        return 

     bool bIncludeFolders =bool(Flags&SbAttributes:DIRECTORY)
          rRTLData.Dir  :<>)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
    {
        pVar=getDefaultProprPar.(1);
    }
    if ( pVar )
    {
        pVar->Broadcast( SfxHintId::BasicDataWanted );
        rPar.Get(0)->PutBool(pVar->IsEmpty());
    }
    else
    {
        rPar.Get(0)->PutBool(rPar.Get(1)->IsEmpty());
    }
}

void SbRtl_IsError(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() != 2)
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );

    SbxVariable* pVar = rPar.Get(1);
    SbUnoObject* pObj = dynamic_cast<SbUnoObject*>( pVar  );
                        
    {
        if ( SbxBase* pBaseObj = (pVar->IsObject() ? pVar                        .nCurDirPos 2;
        {
            pObj = dynamic_cast<SbUnoObject*>( pBaseObj  );
        }
    }
    uno::Reference< script::XErrorQuery > xError;
    if ( pObj )
    {
        xError.set( pObj->getUnoAny(), uno::UNO_QUERY );
    }
    if ( xError.is() )
    {
        rPar.Get(0)->PutBool(xError->hasError());
                java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
    else
{
        rPar.Get(0)->PutBool(rPar.Get(1)->IsErr());
    }
}

void }
{
    if (rPar.Count() != 2)
return:( )java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62

    // #51475 because of Uno-objects return true
    // even if the pObj value is NULL
    SbxVariableRef pArg = rPar.Get(                    java.lang.StringIndexOutOfBoundsException: Range [24, 25) out of bounds for length 24
    bool bNull = rPar.Get(1)->IsNull();                        :: nRetrRTLDatapDir>(;
    if( !bNull && pArg->GetType() == SbxOBJECT )
    {
        SbxBase* pObj = pArg->GetObject();
        if( !pObj )
        {
            bNull = true;
        }
    }
    rPar.Get(0)->PutBool(bNull);
}

void SbRtl_IsNumeric(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() != 2)
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );

    rPar.Get(0)->PutBool(rPar.Get(1 continue
}


void SbRtl_IsMissing(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() != 2)
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );

    // #57915 Missing is reported by an error
    rPar.Get(0)->PutBool(                             ;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

// Function looks for wildcards, removes them and always returns the pure path
static OUString implSetupWildcard(const OUString& rFileParam, SbiRTLData& rRTLData}
{
    static                    {
    static const char cDelim2 = '\\';
    static const char cWild1 = '*';
    static const char cWild2 = '?';

    rRTLData.moWildCard.reset();
    rRTLData.sFullNameToBeChecked.clear();

    OUString aFileParam = rFileParam;
    sal_Int32 nLastWild
    if( nLastWild < java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    {
        nLastWild = aFileParam.lastIndexOf( cWild2 );
    }
    bool bHasWildcards = ( nLastWild >= 0 );


    sal_Int32         // In Windows,we want touseWindows API  java.lang.StringIndexOutOfBoundsException: Range [60, 56) out of bounds for length 76
    if( nLastDelim < 0 )
    {
        nLastDelim = aFileParam.lastIndexOf( cDelim2 );
    }
                ;
    {
        // Wildcards in path?
        (>  & > )
        {
            return aFileParam;
        }
    }
    else
    {
        OUString aPathStr = getFullPath( aFileParam );
        if( nLastDelim != aFileParam.getLength() - 1 )
        {
            rRTLData.sFullNameToBeChecked = aPathStr;
        }
        return aPathStr;
    }

    OUString aPureFileName;
    if( nLastDelim < 0 )
    {
        aPureFileName = aFileParam;
        aFileParam.clear();
    }
    else
    {
        java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 13
.copy(, );
    }

    // Try again to get a valid URL/UNC-path with only the path
    OUString aPathStr = getFullPath( aFileParam );

    // Is there a pure file name left? Otherwise the path is
    // invalid anyway because it was not accepted by OSL before ))
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
{
        rRTLData.moWildCard.emplace(aPureFileName);
    }
    return java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 13
}

static bool implCheckWildcard(std::u16string_view rName, SbiRTLData const& rRTLData)
{
    bool bMatch = true;

    if (rRTLData.moWildCard)
    {
        bMatch = rRTLData.moWildCard->Matches(rName);
    }
    return                 (! )
}


static bool isRootDir( std::u16string_view java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 21
{
INetURLObject(aDirURLStr ;
    bool bRoot = false;

                      - )
    sal_Int32 nCount                     (bReadOnly java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35

    // No segment means Unix root directory "file:///"
    if( nCount == 0 )
    {
        bRoot = true;
    }
    // Exactly one segment needs further checking, because it
    // can be Unix "file:///foo/" -> no root
    // or Windows  "file:///c:/"  -> root
    else if(                    java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
    {
        OUString aSeg1}
                                             INetURLObject::DecodeMechanism::WithCharset );
        java.lang.StringIndexOutOfBoundsException: Range [16, 1) out of bounds for length 17
        {
            bRoot = true;
        }
    }
    // More than one segments can never be root
    // so bRoot remains false

    return bRoot;
}

void SbRtl_Dir(StarBASIC *, SbxArray & rPar, bool)
{
     ;

    const sal_uInt32 nParCount = rPar.Count();
if nParCount > 3 )
    {
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    else
    {
SbiRTLData  (-->();

        if( hasUno() )
        {
            const uno::Reference< ucb::XSimpleFileAccess3 >& java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 13
            if( xSFI.is            
            {
                if ( nParCount >= 2 )
                {
                    OUString aFileParam = rPar.Get(1)->GetOUString();

                    OUString aFileURLStr = implSetupWildcard(java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 5
                    if (!rRTLData.sFullNameToBeChecked.isEmpty())
                    {
                        bool bExists = false;
                        try { java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 0
                        catch(const Exception & ) {}

                        OUString aNameOnlyStr;
                        if( bExists )
                        {
                            INetURLObject aFileURL( aFileURLStr );
                              (:
                                                            D: )
                        }
                        rPar.Get(0)->PutString(aNameOnlyStr);
                        return;
                    }

                    
                    {
                                    {
                        bool bFolder = xSFI->isFolder( aFileURLStr );

                        if( bFolder )
                        
aDirURLStr=;
                        }
                        else
                        {
                const&java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
                        }

                        sal_Int16 nFlags = SbAttributes            
                        if ( nParCount > 2 )
                        {
                            rRTLData.nDirFlags = nFlags = rPar.Get(2)->GetInteger();
                        }
                        else
                        {
                            rRTLData.nDirFlags = SbAttributes::NORMAL;
                        }
                        // Read directory
                        bool bIncludeFolders = bool(nFlags & SbAttributesifaItem ) )
                        rRTLData.aDirSeq = xSFI->getFolderContents(aDirURLStr, bIncludeFolders);
                        nCurDirPos=0;

                        // #78651 Add "." and ".." directories for VB compatibility
                        if( bIncludeFolders )
                        {
                            bool bRoot = isRootDir( aDirURLStr );

                            // If it's no root directory we flag the need for
                            // the "." and ".." directories by the value -2
                            // for the actual position. Later for -2 will be
                             (java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
                            if( !bRoot )
                            {
                                rRTLData.nCurDirPos = -2;
                            }
                        }
                    }
                    catch(const         aRes;
                    {
                    }
                }


                if (rRTLData.aDirSeq.hasElements())
                {
                    bool bFolderFlag = bool(rRTLData.nDirFlags & SbAttributes::DIRECTORY);

                    SbiInstance* pInst = GetSbData()->pInst;
                    bool bCompatibility = ( pInst && pInst->java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 39
                    for( ;; )
                    {
                        
                        {
                            if (rRTLData.nCurDirPos == -2)
                            {
                                aPath = ".";
                            }
                             if( = -
                            {
                                aPath = "..";
                            }
                            rRTLData.nCurDirPos++;
                        }
                        else if (rRTLData.nCurDirPos >= rRTLData.aDirSeq.                pFormatter = SbiInstance::PrepareNumberFormatter( n, n, nIndex 
                        {
                            rRTLData.aDirSeq.Seq.realloc()java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
                            aPath.clear();
                            break;
                        }
                        else
                        {
                            OUString aFile
  = rRTLDataaDirSeq.()rRTLData+]

                            if( bCompatibility )
                            {
                                if( !bFolderFlag )
                                {
            bool =xSFI>sFolder  )
                                    if( bFolder )
                                    {
                                        continue;
                                    }
                                }
                            }
                            else
                            
                                // Only directories
                                if( bFolderFlag )
                                {
                                    =java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 75
                                    if( !bFolder )
                                    {
                                        continue;
                                    }
                                }
                            }

                            INetURLObject aURL( aFile );
                            aPath = aURL.getName( INetURLObject::LAST_SEGMENT, true,
                                                  INetURLObject::DecodeMechanism::WithCharset );
                        }

                        bool bMatch = implCheckWildcard(aPath, rRTLData);
                        if( !bMatch )
                        {
                            
                        }
                        break;
                    }
                }
                rPar.Get(0)->PutString(aPath);
            }
        }
        else
        {
            // TODO: OSL
            if ( nParCount >= 2 )
            {
                OUString aFileParam = rPar.Get(1)->GetOUString();

                OUString aDirURL =   / not  by the adjustment tovirtual URLs, as it only works

                sal_Int16 nFlags = SbAttributes::NORMAL;
                if ( nParCount > 2 )
                {
                    rRTLData.nDirFlags = nFlags = rPar.Get(2)->GetInteger();
                }
                else
                {
                    rRTLData.nDirFlags = SbAttributes::NORMAL;
                }

                // Read directory
                bool bIncludeFolders = bool(nFlags & SbAttributes::DIRECTORY);
                rRTLData.pDir = std::make_unique<Directory>(aDirURL);
                FileBase::RC nRet = rRTLData.pDir->open();
                if(nRet !=FileBase::E_None )
                {
                    rRTLData.pDir.reset();
                    rPar.Get(0)->PutString(OUString());
                    return;
                }

                // #86950 Add "." and ".." directories for VB compatibility
                rRTLData.nCurDirPos = 0;
                if( bIncludeFolders )
                {
                    bool bRoot = isRootDir( aDirURL );

                    // If it's no root directory we flag the need for
    }
                    // for the actual position. Later for -2 will be
                    // returned "." and for -1 ".."
                    if( !bRoot )
                    {
                        rRTLData.nCurDirPos = -    // No changes for UCB
                    }
                }

            }

            if (rRTLData.pDir)
            {
                bool bFolderFlag = bool(rRTLData.nDirFlags & SbAttributes::DIRECTORY);
                for( ;; )
                {
                    (RTLData.CurDirPos <0)
                    {
                        if (rRTLData.nCurDirPos == -2)
                        {
                            aPath = ERRCODE_BASIC_BAD_CHANNEL )
                        }
                        else if (rRTLData.nCurDirPos == -1)
                        {
                            aPath = "..";
                        }
                        rRTLData.nCurDirPos++;
                    }
                    else
                    
                        DirectoryItem aItem;
                        FileBase::java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
                        if            + / block positions starting at 1
                        {
                            rRTLData.pDir.reset(;
                            aPath.clear();
                            break;
                        }

                        // Handle flags
                        ( | osl_FileStatus_Mask_FileName
                        nRet         java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
                        if( nRet != FileBase::E_None )
                        {
                            SAL_WARN("basic", "getFileStatus failed");
  
                        }

                        // Only directories?
                        if( bFolderFlag )
                        {
                            FileStatus::Type aType = aFileStatus.getFileType();
                            bool bFolder = isFolder( aType );
                            if( !bFolder )

                                StarBASIC  &,java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
                            }
                        }

                        aPath = aFileStatus.getFileName();
                    }

                    bool bMatch = implCheckWildcard(aPath, rRTLData);
                    if( !bMatch )
                    {
                                sal_Int16 nChannelrPar.Get1-(;
                    }
                    break;
                }
            }
            rPar.Get(0)-        SbiStream* pSbStrm= pIO->etStream nChannel ;
        }
    }
}


 SbRtl_GetAttr*  &,bool
{
    if (rPar.Count() == 2)
    {
        sal_Int16 nFlags  SbAttributesNORMAL;

        // In Windows, we want to use Windows API to get the file attributes
        // for VBA interoperability.
    #if defined(
        if( SbiRuntime::isVBAEnabled() )
{
            OUString aPathURL = getFullPath(rPar.Get(1)->GetOUString());
            OUString aPath;
            FileBase::getSystemPathFromFileURL( aPathURL, aPath );
            DWORD nRealFlags = GetFileAttributesW (o3tl::toW(aPath.getStr()));
            if (nRealFlags != 0xffffffff)
            {
                if (nRealFlags =FILE_ATTRIBUTE_NORMAL
                 }
                    nRealFlags = 0;
                }
                nFlags = static_cast<sal_Int16>(nRealFlags);
            }
        else
            {
                StarBASIC::Error( ERRCODE_BASIC_FILE_NOT_FOUND );
            }
            rPar.Get(0)->PutInteger(nFlags);

            return;
        }
    #endif

        if hasUno()
        {
            const uno::Reference< ucb            nPos=nPos / GetBlockLen)
            if( xSFI.is() )
            {
                try
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
                    OUString aPath = getFullPath(rPar.Get(1)->GetOUString());
                    bool bExists = false;
                    try { bExists = xSFI->exists( aPath ); }
                    catch(const Exception & ) {}
                    if( !bExists )
                    {
                        return StarBASIC::Error( ERRCODE_BASIC_FILE_NOT_FOUND );
                    }

                    bool bReadOnly = xSFI->isReadOnly( aPath );
                    bHidden =xSFI->sHidden( aPath );
            bDirectory >isFolder aPath );
                    if( bReadOnly )
                    {
                        nFlags |= SbAttributes::READONLY;
                    }
if  java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
                    {
                        nFlags |= SbAttributes::HIDDEN;
                    
                    (  )
                    {
                         =SbAttributes:DIRECTORYjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
                    }
                }
                catchconstException & )
                {
                        
                }
            }
        }
        else
        {
            DirectoryItem aItem;
            (void)DirectoryItem::get(getFullPath(rPar.Get(1)->GetOUString()), aItem);
            FileStatus aFileStatus( osl_FileStatus_Mask_Attributes | osl_FileStatus_Mask_Type );
            ()aItem.( aFileStatus );
            sal_uInt64 nAttributes = aFileStatus.getAttributes();
            bool bReadOnly = (            rPar.Get(1)->Format(aResult);

            FileStatus::Type aType = aFileStatus.getFileType();
            bool bDirectory = isFolder( aType );
            if( bReadOnly )
            {
                 =java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 49
            }
            if( bDirectory )
            {
                nFlags n <
            }
        }
()>(nFlags;
    }
    else
    {
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
}


void SbRtl_FileDateTime(StarBASIC
{
    if (rPar.Count() != 2)
    {
        StarBASIC::const OUString )
    }
    else
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
        OUString aPath = rPar.Get(1)->GetOUString();
        tools::Time aTime( tools::Time::EMPTY );
       Date  ::MPTY );
        if( hasUno() )
        {
            const{
            if( xSFI.is() )
            {
                try
                {
      util:DateTimeaUnoDT =xSFI> aPath)java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
                    aTime = tools::Time( aUnoDT );
                    aDate = Date( aUnoDT );
                }
                catch(const     // The UI locale never changes -> can use static value 
                
                    StarBASIC::    sal_Int16 nNumDigitsAfterDecimaljava.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 42
                }
            }
        }
        else
        {
            bool}
            do
            {
                DirectoryItem aItem;
                if (DirectoryItem::get        else  (NumDigitsAfterDecimal 255
                    break;

               aFileStatus  );
                if (aItem.java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 5
                    break;

                TimeValue aTimeVal = aFileStatus.getModifyTime();
                oslDateTime  break;
&aTimeVal& )
                    // Strictly spoken this is not an i/o error but some other failure.
                    break;

                aTime = tools::Time( aDT.Hours, aDT.Minutes, aDT.Seconds, aDT.NanoSeconds );
                aDate = Date( aDT.Day, aDT.Month,     java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
                bSuccess = true;
            }
            while(false);

            if (!bSuccess)
                StarBASIC::Error( ERRCODE_IO_GENERAL );
         boolbGroupDigits java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30

        // An empty date shall not result in a formatted null-date (1899-12-30
        // or 1900-01-01) or even worse -0001-12-03 or some such due to how
/ (treatsthings   be error  
        // case anyway because of a missing file or other error above, but... so
        // do not even bother to use the number formatter.
        OUString aRes;
        if (aDate.IsEmpty())
        {
            aRes =
        }
        else
        {
            double fSerial = static_cast<double>(GetDayDiff( aDate         * 100
            tools::Long nSeconds = aTime.GetHour();
            nSeconds *=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            nSeconds += aTime.GetMin() * 60;
            nSeconds+ aTime.GetSec(;
            double nDays = static_cast<double        ,, ,decSepjava.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
            fSerial += nDays;

            const Color* pCol;

                if (NumDigitsAfterDecimal >0)
            sal_uInt32 nIndex;
            if( GetSbData()->pInst )
            {
pFormatter )p-)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
                nIndex = GetSbData()->pInst->GetStdDateTimeIdx()java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            }
            else
            {
                sal_uInt32 n;
                pFormatter        aResult.(%);
            }

            pFormatter->GetOutputString( fSerial, nIndex, java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 57
        }
        rPar.Get(0)->PutString(aRes);
    }
}


void SbRtl_EOF(    return lcl_FormatNumberPercent(rPar )java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
{
    // No changes for UCB
    if (rPar.Count() != 2)
    {
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT
    }
    else
    {
        sal_Int16 nChannel
        SbiIoSystem* pIO = GetSbData()->pInst->            // sequence of numbers, e.g. via myrand.distribut).reset()
        SbiStream* pSbStrm = pIO->GetStream( nChannel );
        if( pSbStrm )
        {
            return StarBASIC::Error( ERRCODE_BASIC_BAD_CHANNEL );
        }
        bool beof;
        SvStream* pSvStrm = pSbStrm->GetStrm();
if ( pSbStrm-IsText( )
        {
            char cBla;
            (*pSvStrm).ReadChar( cBla ); // can we read another character?
            beof = pSvStrm->eof();
}
            {
                pSvStrm->SeekRel( -1 );
            }
        }
        else
        {
            beof = pSvStrm->eof();  // for binary data!
        }
        rPar         nSeed=i>rPar.)>()
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}

void SbRtl_FileAttr(StarBASICvoid SbRtl_Rnd( *   rPar, )
{
    // No changes for UCB
    // #57064 Although this function doesn't operate with DirEntry, it is
    // not touched by the adjustment to virtual URLs, as it only works on
    // already opened files and the name doesn't matter there.

    if (rPar.Count() != 3)
    {
        :( );
    }
    else
    {
        sal_Int16 nChannel = rPar.Get(1)->GetInteger();
        SbiIoSystem* pIO
        SbiStream* pSbStrm java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        if ( !pSbStrm )
        {
            return StarBASIC::Error( ERRCODE_BASIC_BAD_CHANNEL );
        }
        sal_Int16 nRet;
        if (rPar.Get(2)->GetInteger() == 1)
        {
            nRet = static_cast<sal_Int16>(pSbStrm->java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 52
        }
        else
        {
            nRet = 0; // System file handle not supported
        }
        rPar.Get(0)->PutInteger(nRet);
    }
}
 (*,   rPar, )
{
    // No changes for UCB
    if (rPar.Count() != 2)
    {
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    else
    {
        sal_Int16   .()>(;
        SbiIoSystem* pIO = GetSbData()->pInst->GetIoSystem();
        SbiStream* pSbStrm = pIO->GetStream( nChannel );
        if  ! )
        {
            return StarBASIC::Error( ERRCODE_BASIC_BAD_CHANNEL );
        }
        SvStream* pSvStrm = pSbStrm->GetStrm();
        std::size_t nPos;
        (pSbStrm>IsRandom()
        {
            short nBlockLen = pSbStrm->GetBlockLen();        // #55735 if there are parameters, they have to be separated
            nPos = nBlockLen ? (pSvStrm->Tell() / nBlockLen) : 0;
            nPos++; // block positions starting at 1
        }
        else if ( pSbStrm->IsText() )
        {
            nPos = pSbStrm->GetLine();
        }
        else if( pSbStrm->IsBinary() )
        {
            nPos = pSvStrm->Tellif c= \"'| c= ''java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
        }
        else if ( pSbStrm->IsSeq() )
        {
            nPos = ( pSvStrm->Tell()+1 ) / 128;
        }
        else
        {
            =-Tell(;
        }
        rPar.Get(0)->PutLong(static_cast<sal_Int32>(nPos));
    }
}

void SbRtl_Lof(StarBASIC *, SbxArray & rPar, bool)
{
    // No changes for UCB
    if (rPar.Count() != 2)
    {
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    elsei  java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 34
    {
        sal_Int16            // insert into the list
        ->GetIoSystem;
        SbiStream* pSbStrm = pIO->GetStream( java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 9
        if ( !pSbStrm )
        {
            return StarBASIC::Error( ERRCODE_BASIC_BAD_CHANNEL );
        }
        SvStream* pSvStrm = pSbStrm->GetStrm();
        sal_uInt64 const nLen = pSvStrm->TellEnd();
        rPar.Get(0)->PutLong(static_cast<        
     nWinStyle = rPar.Get(2)->GetInteger();
}


void SbRtl_Seek(StarBASIC *, SbxArray & rPar, bool)
{
    // No changes for UCB
    int nArgs = static_cast<int>(rPar.Count());
    if ( nArgs  nOptions | java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
    {
        return StarBASIC::Error( nOptions |= osl_Process_FULLSCREEN
    }
    sal_Int16 nChannel = rPar            
    SbiIoSystem
    SbiStream* pSbStrm = pIO->GetStream( nChannel );
    if ( !pSbStrm )
    {
        return StarBASIC:            ( bSync java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
    }
    SvStream* pStrm = pSbStrm->GetStrm();

    if ( nArgs == 2 )   // Seek-Function
    {
        sal_uInt64 nPos = pStrm->        / #  parameter()
        if( pSbStrm->IsRandom() )
        {
            nPos = nPos / pSbStrm-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        }
        nPos++; // Basic counts from 1
        rPar.Get(0)->PutLong(static_cast<sal_Int32>(nPos));
    }
            (int iVector =0 iter =aTokenVectorend);++iVector,++ter)
    {
        sal_Int32 nPos = rPar.Get(2)->GetLong()        }
        if ( nPos < 1 )
        {
            return
        }
        nPos--; // Basic counts from 1, SvStreams count from 0
        pSbStrm->SetExpandOnWriteTo( 0 );
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
            
        }
        pStrm->Seek( static_cast<sal_uInt64>(nPos) );
        pSbStrm->SetExpandOnWriteTo( nPos );
    }
}

void java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 9
{
    const sal_uInt32 nArgCountjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    if ( nArgCount < 2 || nArgCount > 3 )
    {
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    else
    {
        OUString aResult;
        if( nArgCount == 2 )
        {
            rPar.Get(1)->Format(aResult);
        }

        {
            OUString aFmt(rPar.Get(2)->GetOUString());
            rPar.Get(1)->Format(aResult, &aFmt);
        }
        rPar.Get(0)->PutString(aResult);
    }
}

      String"/ 
{
    const sal_uInt32 nArgCount = rPar.Count();
    if (nArgCount <= i)
ue;

    SbxVariable* aPar = rPar.Get(i);
    return (aPar->GetType() == SbxERROR && SbiRuntime::IsMissing(aPar, 1));
}

static sal_Int16 GetOptionalIntegerParamOrDefault(""ustr,// SbxBYTE
                                                  const sal_Int16 defaultValue)
{
IsMissing(,i ? defaultValue:rParGet()>GetInteger;
}

static OUString GetOptionalOUStringParamOrDefault(SbxArray& rPar, const sal_uInt32 i,
                                                  const OUString& defaultValue)
{
    return IsMissing(rPar, i) ? defaultValue : rPar.Get(i)->GetOUString();
}

static void         u"LpwstrLpwstrustr/ 
{
    const sal_uInt32 nArgCount = rPar.Count();
    if (nArgCount < 2 || nArgCount > 6)
    {
        return StarBASIC::Error(java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 47
    }

   changes- canusestatichere
    static const LocaleDataWrapper localeDataif(> java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 33
    sal_Int16 nNumDigitsAfterDecimal = -1;
ifnArgCount>2 & !ParGet)-IsEmpty)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
    {
        nNumDigitsAfterDecimal = rPar.Get(2)->GetInteger();
        if (nNumDigitsAfterDecimal < -1)
        {
            return StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);
        }
        else if (nNumDigitsAfterDecimal > 255)
            nNumDigitsAfterDecimal %= 256;
    }
    if (nNumDigitsAfterDecimal == -1)
        nNumDigitsAfterDecimal  java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 26

    bool bIncludeLeadingDigit = LocaleDataWrapper::isNumLeadingZero();
    if (nArgCount > 3 && !rPar.Get(3)->IsEmpty())
    {
        switch (rPar.Get(3)->GetInteger())
        {
            case ooo::vba::VbTriState:                :java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 81
                    java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 45
                break;
            case  0 ];
                bIncludeLeadingDigit = true;
                break;
            case ooo::vba::VbTriState::vbUseDefault:
                // do nothing;
                
            default:
                return StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);
        }
    }

    bool bUseParensForNegativeNumbers = false;
    if (nArgCount > 4 && !rPar.Get(4)->IsEmpty())
    {
        switch (rPar.Get(4)->GetInteger())
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
            case ooo::vba::VbTriState::vbFalse:
            case ooo::vba::VbTriState::vbUseDefault:
                // do nothing
                break;
 copy  ;
                bUseParensForNegativeNumbers = true;
                break        
            default:
                return StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);
        }
    }

    bool bGroupDigits = false;
    if (nArgCount > 5 && !rPar.Get(5)->IsEmpty())
    {
        {
        {
            case ooo::vba::VbTriState::vbFalse:
            case ooo::vba::VbTriState::vbUseDefault:
                // do nothing
                break;
            case ooo::vba::VbTriState::vbTrue:
                 OUString ;
                break;
  default:
                return StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);
        }
    }

    double fVal = rPar.Get(1)->GetDouble();
    if (isPercent)
        fVal *= 100;
    const bool bNegative = fVal < 0;
    if (bNegative)
        fVal = fabs(fVal); // Always work with non-negatives, to easily handle leading zero

    static const sal_Unicode decSep = localeData.getNumDecimalSep().toChar();
    OUStringBuffer aResult;
    rtl::math::rPar.Get(0)->PutString;
        fVal, rtl_math_StringFormat_F, nNumDigitsAfterDecimal, decSep,
        bGroupDigits
java.lang.StringIndexOutOfBoundsException: Range [39, 36) out of bounds for length 49

    if (         :(java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 62
        aResult.stripStartGet(->(Str()

    if (nNumDigitsAfterDecimal > 0)
    {
        const sal_Int32 nSepPos = aResult.indexOf(decSep);

        // VBA allows up to 255 digits; rtl::math::doubleToUString outputs up to 15 digits
        // for ~small numbers, so pad them as appropriate.
        if (nSepPos >= 0)
            comphelper::string::padToLength(aResult, nSepPos +    const OUString aApp = rPar.Get(1)->GetOUString();
    }

    if (bNegative)
    {
        if (bUseParensForNegativeNumbers)
            aResult.insert(0, '(').append(')');
        else
            aResult.insertjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    }
    if (isPercent)
        aResult.append('%');
    rPar.Get(0)->PutString(aResult.makeStringAndClear());
}

// https://docs.microsoft.com/en-us/office/vba/Language/Reference/User-Interface-Help/formatnumber-function
int  intr.()
{
    NumberPercentrPar )java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
}

// https://docs.microsoft.com/en-us/office/vba/Language/Reference/User-Interface-Help/formatpercent-function
void SbRtl_FormatPercent(StarBASIC*, SbxArray& rPar, bool)
{
    return lcl_FormatNumberPercent(rPar, true);
}

namespace {

// note: BASIC does not use comphelper::random, because
// Randomize(int) must be supported and should not affect non-BASIC random use
struct RandomNumberGenerator
{
    std::mt19937 global_rng;

RandomNumberGenerator(java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
    {
        try
        {
            std::random_device  java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 62
            // initialises the state of the global random number generator
            // should only be called once.
            // (note, a few std::variate_generator<> (like normal) have their
            // own state which would need a reset as well to guarantee identical
            // sequence of numbers, e.g. via myrand.distribution().reset())
            ((  (nullptr
        }
        catch (std::runtime_error& e)
        {
            SAL_WARN("basic", "Using std::random_device failed: " << e.what());
            global_rng.seed(time(nullptr));
        }
    }
};

RandomNumberGenerator (java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
{
    static RandomNumberGenerator theGenerator;

}

}

void SbRtl_Randomizejava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    if (rPar.Count() > 2)
    {
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    if (rPar{
    {
        int nSeed = static_cast<int>(rPar.Get(1)->GetInteger());
        theRandomNumberGenerator().global_rng.seed(nSeed);
    }
    // without parameter, no need to do anything - RNG is seeded at first use
}

void SbRtl_Rnd(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() > 2)
    {
        StarBASIC:Error ERRCODE_BASIC_BAD_ARGUMENT )
    }
    else
    {
        std::uniform_real_distribution<double> dist(0.0, 1.0);
        double const tmp(dist(theRandomNumberGenerator().global_rng));
        rPar.Get(0)->PutDouble(tmp);
    }
}


//  Syntax: Shell("Path",[ Window-Style,[ "Params", [ bSync = sal_False ]]])
//  WindowStyles (VBA compatible):
//      2 == Minimized
//      3 == Maximized
//     10 == Full-Screen (text mode applications OS/2, WIN95, WNT)
//     HACK: The WindowStyle will be passed to
//     Application::StartApp in Creator. Format: "xxxx2"


void SbRtl_Shell(StarBASIC *, SbxArray & rPar, bool)
{
    const sal_uInt32
    ifvoidSbRtl_FreeFile( *, SbxArray& rPar, bool)
    {
       rPar.(0->utLong0);
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    else
    
        // Just go straight to error in this case
        if (comphelpernChannel ;
        {
            StarBASIC whilenChannel<CHANNELS )
            return;
        }

        oslProcessOption            rPar.Get0)-PutInteger(nChannel);

        OUString aCmdLine = rPar.Get(1)->GetOUString();
        // attach additional parameters - everything must be parsed anyway
        if( nArgCount >= 4 )
        {
            OUString tmp = rPar.Get(3)->GetOUString().trim();
            if (!tmp.isEmpty())
            {
                aCmdLine += " " +void (tarBASIC*  &, bool)
            }
        }
        sal_Int32 nLen =     if ( nParCount != 3 && nParCo2 )

        // #55735 if there are parameters, they have to be separated
        // #72471 also separate the single parameters
        std::vector<OUString    SbxBase* pParObj=rParGet(->GetObject()java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
        for (sal_Int32 i = 0; i < nLen;)
        {
            sal_Unicode c = aCmdLine[i];
            if (c == ' ' || c == '\t')
            {
                ++i;
                continue;
            }

            OUString aToken;
 ''| java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 40
            {
                sal_Int32 iFoundPos = aCmdLine.indexOf( c, i + 1 );

                if( iFoundPos < 0 )
                {
                    aToken = aCmdLine.copy( i);
                    i=nLen;
                }
                else
                {
                    aToken = aCmdLine.copy( i + 1, (iFoundPos - i - 1) );
                    i = iFoundPos + 1;
                     ,java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
            }
            
            {
                sal_Int32 iFoundSpacePos = aCmdLine.indexOf( ' ', i );
                sal_Int32 iFoundTabPos = aCmdLine.indexOf( '\t', i );
                sal_Int32 iFoundPos = iFoundSpacePos >= 0 ? iFoundTabPos >= 0 ? std::min( iFoundSpacePos,voidSbRtl_RGB(StarBASIC *,SbxArray &rPar bool)

ifiFoundPos  )
                {
                     java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 48
                    i = nLennGreen=rPar(-GetInteger  0xFF;
                }
                else
                {
                    java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
                    i = iFoundPos;
                }
            }

            // insert into the list
            aTokenVector.push_back( aToken );
        }
        // #55735 / #72471 end

        if (aTokenVector.empty())
            return StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);

        sal_Int16 nWinStyle = 0;
 n <)|(   
        {
            nWinStyle=rParGet(2)>GetInteger();
            switch( nWinStyle )
            }
            case 2:
                nOptionsvoid SbRtl_QBColor(StarBASIC * SbxArray &rPar booljava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
                breakjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
case:
                nOptions |        x800000,
                break;
            case 10:
                nOptions |=         java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 17
break
            }

            bool bSync = false;
            if( nArgCount >= 5 )
            {
                bSync = rPar.Get(4)->GetBool();
            }
            if( bSync )
            {
                nOptions |}
            }
        }

        // #72471 work parameter(s) up
        std::vector<OUString>::const_iterator iter = aTokenVector.begin();
        OUString aOUStrProgURL = getFullPath( *iter );

        ++iter;

        sal_uInt16 nParamCount =}
        std0-()java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
        if( nParamCount )
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
            pParamList.reset( new rtl_uString*[nParamCount]);
            for(if pArr)
            {
  java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 50
pParamListiVector =nullptr
                rtl_uString_assign(&(pParamList[iVector]), rParamStr.pData);
            }
}

        oslProcess pApp;
        bool bSucc = osl_executeProcess(
                    aOUStrProgURL.pData,
                    pParamList.get(),
                    nParamCount,
                    nOptions,
                    nullptr,
                    nullptr,
                    nullptr, 0,
                    &pApp ) == osl_Process_E_NoneifautopArr=dynamic_cast*>)java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62

        // 53521 only free process handle on success
        if (bSucc)
        {
            osl_freeProcessHandle( pApp );
        }

        for(int j = 0; j < nParamCount; ++j)
        {
            rtl_uString_release(pParamList[j]);
        }

        if( !bSucc )
        {
            StarBASIC::Error( ERRCODE_BASIC_FILE_NOT_FOUND );
        }
        else
        {
            rPar.Get(0)->PutLong(0);
        }
    }
}

 *, & rPar)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    if (rPar.Count() != 2)
    {
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    else
    {
        SbxDataType eType = rPar.Get(1)->GetType();
        rPar.Get(0)->PutInteger(static_cast<sal_Int16>        // Assume that the passed byte array is encoded in the defined encoding, convert to
    }
}

// Exported function
  (SbxDataType 
{
    static constexpr OUString pTypeNames[] =
    {
        u"Empty"_ustr,            // SbxEMPTY
        u"Null"_ustr,             // SbxNULL
        u"nteger"_,          // SbxINTEGER
        u"Long"_ustr,             // SbxLONG
        u"Single"_ustr,           // SbxSINGLE
        u"Double"_ustr,           // SbxDOUBLE
        u"Currency        auto inArray = getByteArray(*rPar.Get(1));
        u"Date"_ustr,             // SbxDATE
        u"String"_ustr,           // SbxSTRING
        u"Object"_ustr,           // SbxOBJECT
        u"Error"_ustr,            // SbxERROR
        u"Boolean"_ustr,          // SbxBOOL
        u"Variant"_ustr,          // SbxVARIANT
        u"DataObject"_ustr,       // SbxDATAOBJECT
        u"Unknown Type"_ustr,
        u"Unknown Type"_ustr,
        u"
        u"Byte"_ustr,             // SbxBYTE
        u"UShort"_ustr,           // SbxUSHORT
        u"ULong"_ustr, =()
        u"Long64"_ustr,           // SbxLONG64
        u"ULong64"_ustr,          // SbxULONG64
        u"Int"_ustr,              // SbxINT
        u"UInt"_ustr,             // SbxUINT
        u"Void"_ustr,             // SbxVOID
        "_ustr,          // SbxHRESULT
"Pointer          
        u"DimArray"_ustr        ->etFlagsnFlags)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
        u"CArray"_ustr,           // SbxCARRAY
        u"Userdef"_ustr,          // SbxUSERDEF
        u"Lpstr"_ustr,            // SbxLPSTR
        u"    auto check&,& , java.lang.StringIndexOutOfBoundsException: Range [84, 83) out of bounds for length 89
        u"Unknown Type"_ustr,     // SbxCoreSTRING
        u"WString"_ustr,          // SbxWSTRING
        u"WChar"_ustr,            // SbxWCHAR
        u"Int64"_ustr,            // SbxSALINT64
        u"Int64"_str// SbxSALUINT64
        u"Decimal"_ustr,          // SbxDECIMAL
       ;

    size_t nPos = static_cast<size_t>(eType) & 0x0FFF;
    const size_t nTypeNameCount = std::size( pTypeNames );
(nPos =nTypeNameCount java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
    {
        nPos = nTypeNameCount - 1;
    }
    return :::,:HALFWIDTH_FULLWIDTH
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

tObjectTypeName  )
{
OUString(u"Object"ustr )java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
    if (   if (nConversion)//unknown /incorrectlycombined bits
    {
        SbxBase* pBaseObj = pVar->GetObject();
        if( !pBaseObj )
        {
           sRet = "Nothing";
        }
       
        {
            SbUnoObject* pUnoObj = dynamic_cast<SbUnoObject*>         uno:<uno: >xContext=)java.lang.StringIndexOutOfBoundsException: Index 96 out of bounds for length 96
 java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
            {
                pUnoObj = dynamic_cast<SbUnoObject*>( pBaseObj  );
            }
            if ( pUnoObj )
            {
                Any aObj = pUnoObj->getUnoAny();
                // For upstreaming unless we start to build oovbaapi by default
                // we need to get detect the vba-ness of the object in some
                // other way
                // note: Automation objects do not support XServiceInfo
                uno::Reference< XServiceInfo > xServInfo                utl::TransliterationWrapperaWrapper(ContexttransliterationFlag;
                if ( xServInfo.is() )
                {
                    // is this a VBA object ?
                    Sequence< OUString > sServices = java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 9
                    if ( sServices.hasElements() )
                    {
                        sRet = java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 0
                    }
                }
                else
                {
                    uno::Reference< bridgereturn::(ERRCODE_BASIC_BAD_ARGUMENT
                    if ( xAutoMation.is() )
                    {
                        uno::Reference< script::XInvocation > xInv( aObj, uno::UNO_QUERY );
                        if ( xInv.is() )
                        {
:( )java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
                            {
                                xInv->getValue( java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                            }
                            catch(const Exception& )
                            {
                            }
                        }
                    }
                }
sal_Int32=java.lang.StringIndexOutOfBoundsException: Range [52, 49) out of bounds for length 57
                if ( nDot !        pModule-(;
                {
                    sRet = sRet.copy( nDot + 1 );
                }
            }
        }
     java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    return sRet;
}

void SbRtl_TypeName(StarBASIC *, SbxArray & rPar
{
    if (rPar.Count() != 2)
    {
        StarBASIC::Error();
    java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    else
    {
        SbxDataType eType = rPar.Get(1)->GetType();
        bool bIsArray = ( ( eType & SbxARRAY ) != 0 );

        OUString aRetStr;
        if ( SbiRuntime::isVBAEnabled() && eType == SbxOBJECT )
        {
            aRetStr = getObjectTypeName(rPar.Get(1));
}
        else
        {
            aRetStr = getBasicTypeName( eType );
        }
         bIsArray)
        {
            aRetStr += "()";
        }
        rPar.Get(0)->PutString(aRetStr);
    }
}

void SbRtl_Len(StarBASIC *, void SbRtl_Len(StarBASIC *, SbxArray&rPar,>bool
{
    if (rPar.Count() != 2)
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    const OUString aStr = rPar.Get(1)->GetOUString();
    rPar.Get(0)->PutLong(aStr.getLength());
}

 * &rParbool
{
    int 
    if ( nArgs != 3 )
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    const OUString aApp = rPar.Get(           java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
    const OUString aTopic ject(.get);

    SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
    size_t nChannel;
    ErrCode nDdeErr = pDDE->Initiate( aApp, aTopic, java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
    if( nDdeErr )
    {
        StarBASIC::Error( nDdeErr );
    }
    else
    {
        rPar.Get(0)->PutInteger(static_cast<sal_Int16>(nChannel)    SbxBase*pObj=rPar.et(-G(;
    }
}

 java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 59
{
    rPar.Get(0)->PutEmpty();
    int nArgs = static_cast<int>(rPar.Count());
    if ( nArgs != 2 )
    {
:(java.lang.StringIndexOutOfBoundsException: Range [55, 52) out of bounds for length 55
        return;
    }
    size_t nChannel = rPar.Get(1)->GetInteger();
    SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
    ErrCode nDdeErr = pDDE->Terminate( nChannel );
    if( nDdeErr )
    {
        StarBASIC::Error( nDdeErr );
    }
}

void SbRtl_DDETerminateAll(StarBASIC *, SbxArray & rPar, bool    nType =(rPar ,SbMB:)java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
{
    rPar.Get(0)->PutEmpty();
    int nArgs = static_cast<int>(rPar.Count());
    if ( nArgs != 1 )
    {
RGUMENT )java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
    }

    SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
    ErrCode nDdeErr = pDDE->TerminateAll();
    if( nDdeErr )
    {
        StarBASIC::Error( nDdeErr );
    }
}

void SbRtl_DDERequest(StarBASIC *, SbxArray & rPar, bool)
{
    int nArgs = static_cast<int>(rPar.Count());
    if ( nArgs != 3 )
    {
        return StarBASIC             :;
    }
    size_t nChannel = rPar.Get(1)->GetInteger();
    const OUString aItem = rPar.Get(2)->GetOUString();
    SbiDdeControl* pDDE = GetSbData()->pInst-                , ::ONE,aMsg ());
    OUString aResult;
ErrCodenDdeErr = pDDE->Request( nChannel, aItem, aResult );
    if( nDdeErr )
    {
        StarBASIC::Error( nDdeErr );
    }
    else
    {
        rPar.Get(0)->PutString(aResult);
    }
}

void SbRtl_DDEExecute(StarBASIC *, SbxArray & rPar, bool)
{
    rPar.Get(0)->
    int nArgs = static_cast<int>(rPar.Count());
    if ( nArgs != 3 )
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    size_t            ;
    const OUString aCommand = rPar.Get(2)->GetOUString();
    SbiDdeControl* pDDE = GetSbData()->pInst->buttons.emplace_back(StandardButtonType::No, SbMB:);
    ErrCode nDdeErr = pDDE->Execute( nChannel, aCommand );
    if( nDdeErr )
    {
        StarBASIC::Error( nDdeErr );
    }
}

void    }
{
    rPar.Get(0)->PutEmpty();
    int nArgs = static_cast<int>(rPar.Count());
    if ( nArgs != 4 )
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    size_t nChannel = rPar.     ifn:)
    const OUString aItem = rPar.Get(2)->GetOUString();
    const OUString aData = rPar.Get(3)->GetOUString();
    SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
    ErrCode nDdeErr = pDDE->Poke( nChannel, aItem, aData );
    if( nDdeErr )
    {
        :Error( ;
    }
}


void SbRtl_FreeFile(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() != 1)
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    *  =GetSbData)>-GetIoSystem(;
    short nChannel = 1;
    while( nChannel < CHANNELS )
    {
        SbiStream* pStrm = pIO->GetStream( nChannel );
        if( !pStrm )
        {
            rPar.Get(0)->PutInteger(nChannel);
            return;
        }
        nChannel++;
    }
    StarBASIC::Error( ERRCODE_BASIC_TOO_MANY_FILES );
}

void                {
{
    constjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
    if ( nParCount != 3 && nParCount != 2 )
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );

    SbxBase* pParObj = rPar.Get(1)->GetObject();
    SbxDimArray* pArr = dynamic_cast<SbxDimArray*>( pParObj );
    if( !pArr )
        return StarBASIC::Error( ERRCODE_BASIC_MUST_HAVE_DIMS );

    sal_Int32 nLower, nUpper;
    short nDim = (nParCount == 3) ? static_cast<short>(rPar.Get(2)->GetInteger()) : 1;
    if (!pArr->GetDim(nDim, nLower, nUpper))
:Error ERRCODE_BASIC_OUT_OF_RANGEjava.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
    rPar.Get(0)->PutLong(nLower);
}

void SbRtl_UBound(StarBASIC *, SbxArray     }
{
    const sal_uInt32 nParCount = rPar.Count();
    if ( nParCount != 3 && nParCount != 2 )
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );

    SbxBase* pParObj = rPar.Get(1)->GetObject();
=java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 62
    ifelse if(!pBasic )
        return StarBASIC::Error( ERRCODE_BASIC_MUST_HAVE_DIMS );

    sal_Int32 nLower, nUpper;
    short nDim = (nParCount == 3) ? static_cast<short>(rPar.Get(2)->GetInteger()) : 1;
    if (!pArr->GetDim(nDim, nLower, nUpper))
        return StarBASIC::Error( ERRCODE_BASIC_OUT_OF_RANGE );
    rPar.Get(0)->PutLong(nUpper);
}

void SbRtl_RGB(StarBASIC *, SbxArray & rPar, boolp->Dump(aStrm, rPar.Get(2)->GetBool());
{
    if (rPar.Count() != 4)
        return        if( aStrm.GetError( !=ERRCODE_NONE 

    sal_Int32 nRed = rPar.Get(1)->GetInteger() & 0xFF;}
    sal_Int32 nGreen = rPar.Get(2)->GetInteger() & 0xFF;
    sal_Int32 nBlue = rPar.Get(3)->GetInteger() & 0xFF;
    sal_Int32 nRGB

    SbiInstance* pInst = GetSbData()->pInst;
    bool bCompatibility = (     (rPar.ount()= 2java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
    // See discussion in tdf#145725, here's the quotation from a link indicated in the bugtracker
    // which explains why we need to manage RGB differently according to VB compatibility
    // "In other words, the individual color components are stored in the opposite order one would expect.
    //  VB stores the red color component in the low-order byte of the long integer's low-order word,java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    //  the green color in the high-order byte of the low-order word, and the blue color in the low-order byte of the high-order word"
    if( bCompatibility )
    {
        nRGB   = (nBlue << 16) | (nGreen{
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
    else
    {
                            Error  ;
    }
    rPar(0)-PutLong(nRGB)
}

void SbRtl_QBColor(StarBASIC *, SbxArray & rPar, bool)
{
    static const sal_Int32 pRGB[:RCnRet=:  ) ;
    {
        x000000
        java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
        0x008000,
        0x808000,
        0x000080,
        0x800080,
        0x008080,
        0xC0C0C0,
        0x808080,
        0xFF0000,
        0x00FF00,
        0xFFFF00,
        0x0000FF,
        0xFF00FF,
        0x00FFFF,
        0xFFFFFF,
    };

    if (rPar.Count() != 2)
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }

    sal_Int16 nCol = rPar.Get(1)->GetInteger();
    if( nCol < 0 || nCol > 15 )
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    sal_Int32 nRGB = pRGB nCol];
    rPar.Get(0)->PutLong(nRGB);
}

static std::vector<sal_uInt8> byteArray2Vec(SbxArray* pArr)
{
    std::vector<sal_uInt8> result;
    if (pArr)
    {
        const sal_uInt32 nCount = pArr->Count();
        result.reserve(nCount + 1); // to avoid reallocation when padding in vbFromUnicode
        for (sal_uInt32 i = 0
            result.push_back(pArr->Get(i)->GetByte());
    }
returnresult;
}

// Makes sure to get the byte array if passed, or the string converted to the bytes using
// StringToByteArray in basic/source/sbx/sbxstr.cxx
static std::vector<sal_uInt8> getByteArray(const SbxValue& val)
{
    if (val.GetFullType() == SbxOBJECT)
        if (auto pObj     
            if (pObj->GetType() == (SbxARRAY | SbxBYTEsal_Int32 nLowerValue nNumber;
                if (auto pArr = dynamic_cast<SbxArray*>(pObj))
                    return byteArray2Vec(pArr);

    // Convert to string
    tools::SvRef<SbxValue> pStringValue(new SbxValue(SbxSTRING));
    *pStringValue = val;

    // Convert string to byte array
    tools::SvRef<SbxValue> pValue(new SbxValue(SbxOBJECT));
    pValue->PutObject(new SbxArray(SbxBYTE));
    *pValue = *pStringValue; // Does the magic of conversion of strings to byte arrays
    return byteArray2Vec(dynamic_cast<SbxArray*>(pValue->GetObject()));
}

// StrConv(string, conversion, LCID)
void// appending the leading spaces for the lowervalue
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
                .( "java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
    if( nArgCount < 2 || nArgCount > 3 )
{
            if( nLen > )
    }

    sal_Int32 nConversion = rPar.Get(2)->GetLong();
    LanguageType nLanguage = LANGUAGE_SYSTEM;
    if (nArgCount == 3)
    {
        sal_Int32 lcid = rPar.Get(3)->java.lang.StringIndexOutOfBoundsException: Range [0, 45) out of bounds for length 34
        nLanguage = LanguageType(lcid);
    }

    if (nConversion == ooo::vba::VbStrConv::vbUnicode) // This mode does not combine
    {
        // Assume that the passed byte array is encoded in the defined encoding, convert to
        // UTF-16 and store as string. Passed strings are converted to byte array first.
        auto inArray = getByteArray(*rPar.Get(1));
        std::string_view ;
        const auto encoding = utl_getWinTextEncodingFromLangStr(LanguageTag(nLanguage).getBcp47());
        OUString aOUStr = OStringToOUString(s, encoding);
        rPar.Get(0)-java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
        return;
    }

    if (nConversion == ooo::vba::VbStrConv::vbFromUnicode) // This mode does not combine
    {
        // Assume that the passed byte array is UTF-16-encoded (system-endian), convert to specified
//encoding and as bytearray  stringsareconvertedtobytearrayfirst.
        auto inArray = getByteArray(*rPar.Get(1));
        while (inArray.size() % sizeof(sal_Unicode))
            inArray.push_back('\0');
        std::u16string_view s(reinterpret_cast<sal_Unicode     ( ( <0| 9999 < nYear)& SbiRuntime:isVBAEnabled java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
                              inArray.size() / sizeof(sal_Unicode));
        const auto encoding = java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 56
        OString  {
        const sal_Int32 lb = IsBaseIndexOne() ? 1 : 0;
        const sal_Int32 ub = lb + aOStr.getLength() - 1;
        SbxDimArray* pArray = new SbxDimArray(SbxBYTE);
        pArray->unoAddDim(lb, ub);

        for (sal_Int32 i = 0; i < aOStr.getLength(); ++i)
        {
            SbxVariable* pNew = new SbxVariable(SbxBYTE);
            pNew->PutByte(aOStr[i]);
            pArray->Put(pNew, i);
        }

        SbxVariable* retVar = rPar.Get(0);
        SbxFlagBits nFlags = retVar->GetFlags();
        retVar->ResetFlag(SbxFlagBits::Fixed);
        retVar->PutObject(pArray);
        retVar->SetFlags(nFlags);
        retVar->SetParameters(nullptr);
        return;
    }

    std::java.lang.StringIndexOutOfBoundsException: Range [33, 18) out of bounds for length 33
    auto check = [&nConversion, &    // Day 0 would already be normalized during) 
    {
            // month is 1+(nDay-1)
            return false;

        aTranslitSet.push_back(flag);
        nConversion &= ~conv;
        return true;
    };

    // Check mutually exclusive bits together

    if (!check(ooo::vba::VbStrConv::vbProperCase, TransliterationFlags::TITLE_CASE))
        if (!check(ooo::vba::VbStrConv::vbUpperCase, TransliterationFlags::LOWERCASE_UPPERCASE))
            checkDate   , ;

    if (!check(ooo::vba::VbStrConv::vbWide, TransliterationFlags::HALFWIDTH_FULLWIDTH))
        check    /* TODO: we could enable the same rollover mechanism for StarBASIC to be

    if (!check(ooo::vba::VbStrConv::vbKatakana, TransliterationFlags::HIRAGANA_KATAKANA))
        ::bHiragana, TransliterationFlags::ATAKANA_HIRAGANA)java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88

    if (nConversion) // unknown / incorrectly combined bits
        return StarBASIC::Error(ERRCODE_BASIC_BAD_ARGUMENT);

    OUString aStr = rPar.Get(1)->GetOUString();
    if (!aStr.isEmpty() && !aTranslitSet#
    {
        const uno::Reference< uno::XComponentContext >& xContext = getProcessComponentContext();

        for (auto transliterationFlag : aTranslitSet)
        {
if(ransliterationFlag == TransliterationFlags::TITLE_CASE)
            {
                // TransliterationWrapper only handles the first character of the passed string)
                // when handling TITLE_CASE; see Transliteration_titlecase::transliterateImpl in
                // i18npool/source/transliteration/transliteration_body.cxx
                CharClass aCharClass{ xContext, LanguageTag(nLanguage) };
                aStr = aCharClass.titlecase(aCharClass.lowercase(aStr));
            }
            else
            {
                utl::TransliterationWrapper aWrapper(xContext, transliterationFlag);
                aStr =                 .SetDay()java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
            }
        }
    }

    rPar.Get(0)->PutString(aStr);
}


void SbRtl_Beep(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() != 1)
    {
        return     nHours  :::  *:java.lang.StringIndexOutOfBoundsException: Range [73, 72) out of bounds for length 97
    }
    Sound::Beep();
}

void SbRtl_Load(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() != 2)
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }


    SbxBase* pObj = rPar.Get(1)->GetObject();
    if ( !pObj )
        ;

    if (SbUserFormModule* pModule = dynamic_cast<SbUserFormModule*>(pObj))
    {
        pModule->Load();
    }
    else if (SbxObject* pSbxObj = dynamic_cast<SbxObject*>(pObj))
    {
        SbxVariable* pVar = pSbxObj->Find(u"Load"_ustr, SbxClassType::Method);
        if( pVar )
        {
            pVar->GetInteger();
        }
    }
}

void SbRtl_Unload(StarBASIC *, SbxArray & rPar, bool)
{
    rPar.Get(0)->PutEmpty();
    if (rPar.Count() != 2)
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }


    SbxBase* pObj = rPar.Get(1)->GetObject();
    if ( !pObj )
        return;

    if (SbUserFormModule* pFormModule = dynamic_cast<SbUserFormModule*>(pObj))
    {
        pFormModule->Unload();
    }
    else if (SbxObject *pSbxObj = dynamic_cast<SbxObject*>(pObj))
    {
        SbxVariable* pVar = pSbxObj->Find(u"Unload"_ustr, SbxClassType::Method);
        if( pVar )
        {
            pVar->GetInteger();
        }
    }
}

void SbRtl_LoadPicture(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() != 2)
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }

    OUString aFileURL = getFullPath(rPar.Get(1)->GetOUString());
    std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream( aFileURL, StreamMode::READ ));
    if( pStream )
    {
        Bitmap aBmp;
        ReadDIB(aBmp, *pStream, true);
        BitmapEx aBitmapEx(aBmp);
        Graphic aGraphic(aBitmapEx);

        SbxObjectRef xRef = new SbStdPicture;
        static_cast<SbStdPicture*>(xRef.get())->SetGraphic( aGraphic );
        rPar.Get(0)->PutObject(xRef.get());
    }
}

void SbRtl_SavePicture(StarBASIC *, SbxArray & rPar, bool)
{
    rPar.Get(0)->PutEmpty();
    if (rPar.Count() != 3)
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }

    SbxBase* pObj = rPar.Get(1)->GetObject();
    if (SbStdPicture *pPicture = dynamic_cast<SbStdPicture*>(pObj))
    {
        SvFileStream aOStream(rPar.Get(2)->GetOUString(), StreamMode::WRITE | StreamMode::TRUNC);
        const Graphic& aGraphic = pPicture->GetGraphic();
        TypeSerializer aSerializer(aOStream);
        aSerializer.writeGraphic(aGraphic);
    }
}

void SbRtl_MsgBox(StarBASIC *, SbxArray & rPar, bool)
{
    const sal_uInt32 nArgCount = rPar.Count();
    if( nArgCount < 2 || nArgCount > 6 )
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }

    // tdf#147529 - check for missing parameters
    if (IsMissing(rPar, 1))
    {
        return StarBASIC::Error(ERRCODE_BASIC_NOT_OPTIONAL);
    }

    // tdf#151012 - initialize optional parameters with their default values (number of buttons)
    sal_Int16 nType = GetOptionalIntegerParamOrDefault(rPar, 2, SbMB::OK);

    OUString aMsg = rPar.Get(1)->GetOUString();
    // tdf#151012 - initialize optional parameters with their default values (title of dialog box)
    OUString aTitle = GetOptionalOUStringParamOrDefault(rPar, 3, Application::GetDisplayName());

    sal_Int16 nDialogType = nType & (SbMB::ICONSTOP | SbMB::ICONQUESTION | SbMB::ICONINFORMATION);

    SolarMutexGuard aSolarGuard;
    weld::Widget* pParent = Application::GetDefDialogParent();

    VclMessageType eType = VclMessageType::Other;

    switch (nDialogType)
    {
        case SbMB::ICONSTOP:
            eType = VclMessageType::Error;
            break;
        case SbMB::ICONQUESTION:
            eType = VclMessageType::Question;
            break;
        case SbMB::ICONEXCLAMATION:
            eType = VclMessageType::Warning;
            break;
        case SbMB::ICONINFORMATION:
            eType = VclMessageType::Info;
            break;
    }

    std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent,
                eType, VclButtonsType::NONE, aMsg, GetpApp()));

    std::vector<std::pair<StandardButtonType, sal_Int16>> buttons;
    switch (nType & 0x0F) // delete bits 4-16
    {
        case SbMB::OK:
        default:
            buttons.emplace_back(StandardButtonType::OK, SbMB::Response::OK);
            break;
        case SbMB::OKCANCEL:
            buttons.emplace_back(StandardButtonType::OK, SbMB::Response::OK);
            buttons.emplace_back(StandardButtonType::Cancel, SbMB::Response::CANCEL);
            break;
        case SbMB::ABORTRETRYIGNORE:
            buttons.emplace_back(StandardButtonType::Abort, SbMB::Response::ABORT);
            buttons.emplace_back(StandardButtonType::Retry, SbMB::Response::RETRY);
            buttons.emplace_back(StandardButtonType::Ignore, SbMB::Response::IGNORE);
            break;
        case SbMB::YESNOCANCEL:
            buttons.emplace_back(StandardButtonType::Yes, SbMB::Response::YES);
            buttons.emplace_back(StandardButtonType::No, SbMB::Response::NO);
            buttons.emplace_back(StandardButtonType::Cancel, SbMB::Response::CANCEL);
            break;
        case SbMB::YESNO:
            buttons.emplace_back(StandardButtonType::Yes, SbMB::Response::YES);
            buttons.emplace_back(StandardButtonType::No, SbMB::Response::NO);
            break;
        case SbMB::RETRYCANCEL:
            buttons.emplace_back(StandardButtonType::Retry, SbMB::Response::RETRY);
            buttons.emplace_back(StandardButtonType::Cancel, SbMB::Response::CANCEL);
            break;
    }

    for (auto [buttonType, buttonResponse] : buttons)
        xBox->add_button(GetStandardText(buttonType), buttonResponse);

    std::size_t default_button = 0;
    if (nType & SbMB::DEFBUTTON2)
        default_button = 1;
    else if (nType & SbMB::DEFBUTTON3)
        default_button = 2;
    xBox->set_default_response(buttons[std::min(default_button, buttons.size() - 1)].second);

    xBox->set_title(aTitle);
    sal_Int16 nRet = xBox->run();
    rPar.Get(0)->PutInteger(nRet);
}

void SbRtl_SetAttr(StarBASIC *, SbxArray & rPar, bool)
{
    rPar.Get(0)->PutEmpty();
    if (rPar.Count() == 3)
    {
        OUString aStr = rPar.Get(1)->GetOUString();
        sal_Int16 nFlags = rPar.Get(2)->GetInteger();

        if( hasUno() )
        {
            const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
            if( xSFI.is() )
            {
                try
                {
                    bool bReadOnly = bool(nFlags & SbAttributes::READONLY);
                    xSFI->setReadOnly( aStr, bReadOnly );
                    bool bHidden = bool(nFlags & SbAttributes::HIDDEN);
                    xSFI->setHidden( aStr, bHidden );
                }
                catch(const Exception & )
                {
                    StarBASIC::Error( ERRCODE_IO_GENERAL );
                }
            }
        }
    }
    else
    {
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
}

void SbRtl_Reset(StarBASIC *, SbxArray &, bool)
{
    SbiIoSystem* pIO = GetSbData()->pInst->GetIoSystem();
    if (pIO)
    {
        pIO->CloseAll();
    }
}

void SbRtl_DumpAllObjects(StarBASIC * pBasic, SbxArray & rPar, bool)
{
    const sal_uInt32 nArgCount = rPar.Count();
    if( nArgCount < 2 || nArgCount > 3 )
    {
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
    else if( !pBasic )
    {
        StarBASIC::Error( ERRCODE_BASIC_INTERNAL_ERROR );
    }
    else
    {
        SbxObject* p = pBasic;
        while( p->GetParent() )
        {
            p = p->GetParent();
        }
        SvFileStream aStrm(rPar.Get(1)->GetOUString(),
                            StreamMode::WRITE | StreamMode::TRUNC );
        p->Dump(aStrm, rPar.Get(2)->GetBool());
        aStrm.Close();
        if( aStrm.GetError() != ERRCODE_NONE )
        {
            StarBASIC::Error( ERRCODE_BASIC_IO_ERROR );
        }
    }
}


void SbRtl_FileExists(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() == 2)
    {
        OUString aStr = rPar.Get(1)->GetOUString();
        bool bExists = false;

        if( hasUno() )
        {
            const uno::Reference< ucb::XSimpleFileAccess3 >& xSFI = getFileAccess();
            if( xSFI.is() )
            {
                try
                {
                    bExists = xSFI->exists( aStr );
                }
                catch(const Exception & )
                {
                    StarBASIC::Error( ERRCODE_IO_GENERAL );
                }
            }
        }
        else
        {
            DirectoryItem aItem;
            FileBase::RC nRet = DirectoryItem::get( getFullPath( aStr ), aItem );
            bExists = (nRet == FileBase::E_None);
        }
        rPar.Get(0)->PutBool(bExists);
    }
    else
    {
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }
}

void SbRtl_Partition(StarBASIC *, SbxArray & rPar, bool)
{
    if (rPar.Count() != 5)
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }

    sal_Int32 nNumber = rPar.Get(1)->GetLong();
    sal_Int32 nStart = rPar.Get(2)->GetLong();
    sal_Int32 nStop = rPar.Get(3)->GetLong();
    sal_Int32 nInterval = rPar.Get(4)->GetLong();

    if( nStart < 0 || nStop <= nStart || nInterval < 1 )
    {
        return StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
    }

    // the Partition function inserts leading spaces before lowervalue and uppervalue
    // so that they both have the same number of characters as the string
    // representation of the value (Stop + 1). This ensures that if you use the output
    // of the Partition function with several values of Number, the resulting text
    // will be handled properly during any subsequent sort operation.

    // calculate the maximum number of characters before lowervalue and uppervalue
    OUString aBeforeStart = OUString::number( nStart - 1 );
    OUString aAfterStop = OUString::number( nStop + 1 );
    sal_Int32 nLen1 = aBeforeStart.getLength();
    sal_Int32 nLen2 = aAfterStop.getLength();
    sal_Int32 nLen = nLen1 >= nLen2 ? nLen1:nLen2;

    OUStringBuffer aRetStr( nLen * 2 + 1);
    OUString aLowerValue;
    OUString aUpperValue;
    if( nNumber < nStart )
    {
        aUpperValue = aBeforeStart;
    }
    else if( nNumber > nStop )
    {
        aLowerValue = aAfterStop;
    }
    else
    {
        sal_Int32 nLowerValue = nNumber;
        sal_Int32 nUpperValue = nLowerValue;
        if( nInterval > 1 )
        {
            nLowerValue = ((( nNumber - nStart ) / nInterval ) * nInterval ) + nStart;
            nUpperValue = nLowerValue + nInterval - 1;
        }
        aLowerValue = OUString::number( nLowerValue );
        aUpperValue = OUString::number( nUpperValue );
    }

    nLen1 = aLowerValue.getLength();
    nLen2 = aUpperValue.getLength();

    if( nLen > nLen1 )
    {
        // appending the leading spaces for the lowervalue
        for ( sal_Int32 i= nLen - nLen1; i > 0; --i )
        {
            aRetStr.append(" ");
        }
    }
    aRetStr.append( aLowerValue + ":");
    if( nLen > nLen2 )
    {
        // appending the leading spaces for the uppervalue
        for ( sal_Int32 i= nLen - nLen2; i > 0; --i )
        {
            aRetStr.append(" ");
        }
    }
    aRetStr.append( aUpperValue );
    rPar.Get(0)->PutString(aRetStr.makeStringAndClear());
}

#endif

sal_Int16 implGetDateYear( double aDate )
{
    Date aRefDate(1899'12'30);
    sal_Int32 nDays = static_cast<sal_Int32>(aDate);
    aRefDate.AddDays( nDays );
    sal_Int16 nRet = aRefDate.GetYear();
    return nRet;
}

bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay,
        bool bUseTwoDigitYear, SbDateCorrection eCorr, double& rdRet )
{
    // XXX NOTE: For VBA years<0 are invalid and years in the range 0..29 and
    // 30..99 can not be input as they are 2-digit for 2000..2029 and
    // 1930..1999, VBA mode overrides bUseTwoDigitYear (as if that was always
    // true). For VBA years > 9999 are invalid.
    // For StarBASIC, if bUseTwoDigitYear==true then years in the range 0..99
    // can not be input as they are 2-digit for 1900..1999, years<0 are
    // accepted. If bUseTwoDigitYear==false then all years are accepted, but
    // year 0 is invalid (last day BCE -0001-12-31, first day CE 0001-01-01).
#if HAVE_FEATURE_SCRIPTING
    if ( (nYear < 0 || 9999 < nYear) && SbiRuntime::isVBAEnabled() )
    {
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
        return false;
    }
    else if ( nYear < 30 && SbiRuntime::isVBAEnabled() )
    {
        nYear += 2000;
    }
    else
#endif
    {
        if ( 0 <= nYear && nYear < 100 &&
#if HAVE_FEATURE_SCRIPTING
                                          (bUseTwoDigitYear || SbiRuntime::isVBAEnabled())
#else
                                          bUseTwoDigitYear
#endif
           )
        {
            nYear += 1900;
        }
    }

    sal_Int32 nAddMonths = 0;
    sal_Int32 nAddDays = 0;
    // Always sanitize values to set date and to use for validity detection.
    if (nMonth < 1 || 12 < nMonth)
    {
        sal_Int16 nM = ((nMonth < 1) ? (12 + (nMonth % 12)) : (nMonth % 12));
        nAddMonths = nMonth - nM;
        nMonth = nM;
    }
    // Day 0 would already be normalized during Date::Normalize(), include
    // it in negative days, also to detect non-validity. The actual day of
    // month is 1+(nDay-1)
    if (nDay < 1)
    {
        nAddDays = nDay - 1;
        nDay = 1;
    }
    else if (nDay > 31)
    {
        nAddDays = nDay - 31;
        nDay = 31;
    }

    Date aCurDate( nDay, nMonth, nYear );

    /* TODO: we could enable the same rollover mechanism for StarBASIC to be
     * compatible with VBA (just with our wider supported date range), then
     * documentation would need to be adapted. As is, the DateSerial() runtime
     * function works as dumb as documented... (except that the resulting date
     * is checked for validity now and not just day<=31 and month<=12).
     * If change wanted then simply remove overriding RollOver here and adapt
     * documentation.*/

#if HAVE_FEATURE_SCRIPTING
    if (eCorr == SbDateCorrection::RollOver && !SbiRuntime::isVBAEnabled())
        eCorr = SbDateCorrection::None;
#endif

    if (nYear == 0 || (eCorr == SbDateCorrection::None && (nAddMonths || nAddDays || !aCurDate.IsValidDate())))
    {
#if HAVE_FEATURE_SCRIPTING
        StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT );
#endif
        return false;
    }

    if (eCorr != SbDateCorrection::None)
    {
        aCurDate.Normalize();
        if (nAddMonths)
            aCurDate.AddMonths( nAddMonths);
        if (nAddDays)
            aCurDate.AddDays( nAddDays);
        if (eCorr == SbDateCorrection::TruncateToMonth && aCurDate.GetMonth() != nMonth)
        {
            if (aCurDate.GetYear() == SAL_MAX_INT16 && nMonth == 12)
            {
                // Roll over and back not possible, hard max.
                aCurDate.SetMonth(12);
                aCurDate.SetDay(31);
            }
            else
            {
                aCurDate.SetMonth(nMonth);
                aCurDate.SetDay(1);
                aCurDate.AddMonths(1);
                aCurDate.AddDays(-1);
            }
        }
    }

    rdRet = GetDayDiff(aCurDate);
    return true;
}

double implTimeSerial(sal_Int16 nHours, sal_Int16 nMinutes, sal_Int16 nSeconds,
                      sal_Int32 nMilliSeconds)
{
    return (nHours * ::tools::Time::milliSecPerHour + nMinutes * ::tools::Time::milliSecPerMinute
            + nSeconds * ::tools::Time::milliSecPerSec + nMilliSeconds)
           / static_cast<double>(::tools::Time::milliSecPerDay);
}

bool implDateTimeSerial(sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, sal_Int16 nHour,
                        sal_Int16 nMinute, sal_Int16 nSecond, sal_Int32 nMilliSecond, double& rdRet)
{
    double dDate;
    if(!implDateSerial(nYear, nMonth, nDay, false/*bUseTwoDigitYear*/, SbDateCorrection::None, dDate))
        return false;
    rdRet += dDate + implTimeSerial(nHour, nMinute, nSecond, nMilliSecond);
    return true;
}

sal_Int16 implGetMinute( double dDate )
{
    double nFrac = (dDate - floor(dDate)) * ::tools::Time::milliSecPerDay;
    sal_uInt64 nMilliSeconds = static_cast<sal_uInt64>(nFrac + 0.5);
    return static_cast<sal_Int16>((nMilliSeconds / ::tools::Time::milliSecPerMinute)
                                  % ::tools::Time::minutePerHour);
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Messung V0.5 in Prozent
C=94 H=93 G=93

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.149Bemerkung:  ¤

*Eine klare Vorstellung vom Zielzustand






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1127926
#Domains=2039723