Files
libreoffice/basic/source/runtime/methods.cxx

4801 lines
121 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2000-09-18 15:18:56 +00:00
#include <tools/date.hxx>
#include <basic/sbxvar.hxx>
#include <osl/process.h>
2000-09-18 15:18:56 +00:00
#include <vcl/svapp.hxx>
2001-07-10 11:01:09 +00:00
#include <vcl/settings.hxx>
#include <vcl/sound.hxx>
2010-11-23 18:41:04 +01:00
#include <tools/wintypes.hxx>
2000-09-18 15:18:56 +00:00
#include <vcl/msgbox.hxx>
#include <basic/sbx.hxx>
#include <svl/zforlist.hxx>
#include <rtl/math.hxx>
2000-09-18 15:18:56 +00:00
#include <tools/urlobj.hxx>
2000-09-26 08:02:02 +00:00
#include <osl/time.h>
#include <unotools/charclass.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <tools/wldcrd.hxx>
#include <i18nlangtag/lang.h>
#include <rtl/string.hxx>
2011-11-18 21:03:31 +00:00
#include <rtl/strbuf.hxx>
2000-09-18 15:18:56 +00:00
#include "runtime.hxx"
#include "sbunoobj.hxx"
2001-05-30 09:52:05 +00:00
#include <osl/file.hxx>
#include "errobject.hxx"
2000-09-18 15:18:56 +00:00
2000-11-02 11:03:49 +00:00
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
2000-09-18 15:18:56 +00:00
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/script/XErrorQuery.hpp>
#include <ooo/vba/XHelperInterface.hpp>
#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
2000-11-02 11:03:49 +00:00
using namespace comphelper;
2000-09-18 15:18:56 +00:00
using namespace osl;
using namespace com::sun::star;
using namespace com::sun::star::lang;
using namespace com::sun::star::uno;
2000-09-18 15:18:56 +00:00
#include "date.hxx"
2000-09-18 15:18:56 +00:00
#include "stdobj.hxx"
#include <basic/sbstdobj.hxx>
2000-09-18 15:18:56 +00:00
#include "rtlproto.hxx"
#include "basrid.hxx"
#include "image.hxx"
2000-09-18 15:18:56 +00:00
#include "sb.hrc"
#include "iosys.hxx"
#include "ddectrl.hxx"
#include <sbintern.hxx>
#include <basic/vbahelper.hxx>
2000-09-18 15:18:56 +00:00
2000-11-22 12:27:25 +00:00
#include <list>
2000-09-18 15:18:56 +00:00
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
SbxVariable* getDefaultProp( SbxVariable* pRef );
2011-05-21 16:26:08 +03:00
#if defined (WNT)
2000-09-18 15:18:56 +00:00
#include <direct.h> // _getdcwd get current work directory, _chdrive
#endif
#ifdef UNX
#include <errno.h>
#include <unistd.h>
#endif
#include <basic/sbobjmod.hxx>
2011-03-28 12:54:35 +02:00
#ifdef WNT
#if defined _MSC_VER
#pragma warning (push, 1)
#pragma warning (disable: 4005)
#endif
2011-03-28 12:54:35 +02:00
#include <windows.h>
#if defined _MSC_VER
#pragma warning (pop)
#endif
2011-03-28 12:54:35 +02:00
#include <io.h>
#undef GetObject
#undef GradientSyle_RECT
#endif
2012-03-05 21:41:31 +02:00
#ifndef DISABLE_SCRIPTING
2011-05-04 16:52:03 +02:00
// from source/classes/sbxmod.cxx
uno::Reference< frame::XModel > getDocumentModel( StarBASIC* );
2011-05-04 16:52:03 +02:00
static void FilterWhiteSpace( OUString& rStr )
2000-09-18 15:18:56 +00:00
{
if (rStr.isEmpty())
{
2011-11-18 21:03:31 +00:00
return;
}
OUStringBuffer aRet;
2011-11-18 21:03:31 +00:00
for (sal_Int32 i = 0; i < rStr.getLength(); ++i)
2011-11-18 21:03:31 +00:00
{
sal_Unicode cChar = rStr[i];
2011-11-18 21:03:31 +00:00
if ((cChar != ' ') && (cChar != '\t') &&
(cChar != '\n') && (cChar != '\r'))
{
aRet.append(cChar);
}
}
rStr = aRet.makeStringAndClear();
2000-09-18 15:18:56 +00:00
}
2012-03-05 21:41:31 +02:00
static long GetDayDiff( const Date& rDate );
2000-09-18 15:18:56 +00:00
static const CharClass& GetCharClass( void )
{
static bool bNeedsInit = true;
static LanguageTag aLanguageTag( LANGUAGE_SYSTEM);
2001-07-10 11:01:09 +00:00
if( bNeedsInit )
{
bNeedsInit = false;
aLanguageTag = Application::GetSettings().GetLanguageTag();
}
static CharClass aCharClass( aLanguageTag );
return aCharClass;
}
static inline bool isFolder( FileStatus::Type aType )
{
return ( aType == FileStatus::Directory || aType == FileStatus::Volume );
}
2000-09-18 15:18:56 +00:00
//*** UCB file access ***
2000-09-26 08:02:02 +00:00
2000-09-18 15:18:56 +00:00
// Converts possibly relative paths to absolute paths
// according to the setting done by ChDir/ChDrive
OUString getFullPath( const OUString& aRelPath )
2000-09-26 08:02:02 +00:00
{
OUString aFileURL;
// #80204 Try first if it already is a valid URL
2001-05-30 09:52:05 +00:00
INetURLObject aURLObj( aRelPath );
aFileURL = aURLObj.GetMainURL( INetURLObject::NO_DECODE );
if( aFileURL.isEmpty() )
{
2001-05-10 13:02:47 +00:00
File::getFileURLFromSystemPath( aRelPath, aFileURL );
}
2001-05-30 09:52:05 +00:00
2000-09-26 08:02:02 +00:00
return aFileURL;
}
2000-09-18 15:18:56 +00:00
// TODO: -> SbiGlobals
static uno::Reference< ucb::XSimpleFileAccess3 > getFileAccess( void )
2000-09-18 15:18:56 +00:00
{
static uno::Reference< ucb::XSimpleFileAccess3 > xSFI;
2000-09-18 15:18:56 +00:00
if( !xSFI.is() )
{
xSFI = ucb::SimpleFileAccess::create( comphelper::getProcessComponentContext() );
2000-09-18 15:18:56 +00:00
}
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)
2000-09-18 15:18:56 +00:00
// CreateObject( class )
RTLFUNC(CreateObject)
{
(void)bWrite;
OUString aClass( rPar.Get( 1 )->GetOUString() );
2000-09-18 15:18:56 +00:00
SbxObjectRef p = SbxBase::CreateObject( aClass );
if( !p )
StarBASIC::Error( SbERR_CANNOT_LOAD );
else
{
// Convenience: enter BASIC as parent
2000-09-18 15:18:56 +00:00
p->SetParent( pBasic );
rPar.Get( 0 )->PutObject( p );
}
}
// Error( n )
RTLFUNC(Error)
{
(void)bWrite;
2000-09-18 15:18:56 +00:00
if( !pBasic )
StarBASIC::Error( SbERR_INTERNAL_ERROR );
else
{
OUString aErrorMsg;
2000-09-18 15:18:56 +00:00
SbError nErr = 0L;
sal_Int32 nCode = 0;
2000-09-18 15:18:56 +00:00
if( rPar.Count() == 1 )
{
nErr = StarBASIC::GetErrBasic();
2000-09-18 15:18:56 +00:00
aErrorMsg = StarBASIC::GetErrorMsg();
}
else
{
nCode = rPar.Get( 1 )->GetLong();
2000-09-18 15:18:56 +00:00
if( nCode > 65535L )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_CONVERSION );
}
2000-09-18 15:18:56 +00:00
else
{
nErr = StarBASIC::GetSfxFromVBError( (sal_uInt16)nCode );
}
2000-09-18 15:18:56 +00:00
}
bool bVBA = SbiRuntime::isVBAEnabled();
OUString tmpErrMsg;
if( bVBA && !aErrorMsg.isEmpty())
{
tmpErrMsg = aErrorMsg;
}
else
{
pBasic->MakeErrorText( nErr, aErrorMsg );
tmpErrMsg = pBasic->GetErrorText();
}
// If this rtlfunc 'Error' passed a errcode the same as the active Err Objects's
// current err then return the description for the error message if it is set
// ( complicated isn't it ? )
if ( bVBA && rPar.Count() > 1 )
{
uno::Reference< ooo::vba::XErrObject > xErrObj( SbxErrObject::getUnoErrObject() );
if ( xErrObj.is() && xErrObj->getNumber() == nCode && !xErrObj->getDescription().isEmpty() )
{
tmpErrMsg = xErrObj->getDescription();
}
}
rPar.Get( 0 )->PutString( tmpErrMsg );
2000-09-18 15:18:56 +00:00
}
}
// Sinus
RTLFUNC(Sin)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
SbxVariableRef pArg = rPar.Get( 1 );
rPar.Get( 0 )->PutDouble( sin( pArg->GetDouble() ) );
}
}
RTLFUNC(Cos)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
SbxVariableRef pArg = rPar.Get( 1 );
rPar.Get( 0 )->PutDouble( cos( pArg->GetDouble() ) );
}
}
RTLFUNC(Atn)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
SbxVariableRef pArg = rPar.Get( 1 );
rPar.Get( 0 )->PutDouble( atan( pArg->GetDouble() ) );
}
}
RTLFUNC(Abs)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
SbxVariableRef pArg = rPar.Get( 1 );
rPar.Get( 0 )->PutDouble( fabs( pArg->GetDouble() ) );
}
}
RTLFUNC(Asc)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
SbxVariableRef pArg = rPar.Get( 1 );
OUString aStr( pArg->GetOUString() );
if ( aStr.isEmpty())
2000-09-18 15:18:56 +00:00
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
rPar.Get(0)->PutEmpty();
}
else
{
sal_Unicode aCh = aStr[0];
rPar.Get(0)->PutLong( aCh );
2000-09-18 15:18:56 +00:00
}
}
}
void implChr( SbxArray& rPar, bool bChrW )
2000-09-18 15:18:56 +00:00
{
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
SbxVariableRef pArg = rPar.Get( 1 );
OUString aStr;
if( !bChrW && SbiRuntime::isVBAEnabled() )
{
2011-09-18 22:35:32 +01:00
sal_Char c = static_cast<sal_Char>(pArg->GetByte());
aStr = OUString(&c, 1, osl_getThreadTextEncoding());
}
else
{
2011-09-18 22:35:32 +01:00
sal_Unicode aCh = static_cast<sal_Unicode>(pArg->GetUShort());
aStr = OUString(aCh);
}
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutString( aStr );
}
}
RTLFUNC(Chr)
{
(void)pBasic;
(void)bWrite;
bool bChrW = false;
implChr( rPar, bChrW );
}
RTLFUNC(ChrW)
{
(void)pBasic;
(void)bWrite;
bool bChrW = true;
implChr( rPar, bChrW );
}
2000-09-18 15:18:56 +00:00
#ifdef UNX
#define _PATH_INCR 250
#endif
RTLFUNC(CurDir)
{
(void)pBasic;
(void)bWrite;
// #57064 Although this function doesn't work with DirEntry, it isn't touched
// 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
// could be delivered.
2000-09-18 15:18:56 +00:00
2011-05-21 16:26:08 +03:00
#if defined (WNT)
2000-09-18 15:18:56 +00:00
int nCurDir = 0; // Current dir // JSM
if ( rPar.Count() == 2 )
{
OUString aDrive = rPar.Get(1)->GetOUString();
if ( aDrive.getLength() != 1 )
2000-09-18 15:18:56 +00:00
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
else
{
nCurDir = (int)aDrive[0];
2000-09-18 15:18:56 +00:00
if ( !isalpha( nCurDir ) )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
else
{
2000-09-18 15:18:56 +00:00
nCurDir -= ( 'A' - 1 );
}
2000-09-18 15:18:56 +00:00
}
}
char* pBuffer = new char[ _MAX_PATH ];
if ( _getdcwd( nCurDir, pBuffer, _MAX_PATH ) != 0 )
{
rPar.Get(0)->PutString( OUString::createFromAscii( pBuffer ) );
}
2000-09-18 15:18:56 +00:00
else
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_NO_DEVICE );
}
delete [] pBuffer;
2000-09-18 15:18:56 +00:00
#elif defined( UNX )
int nSize = _PATH_INCR;
char* pMem;
while( true )
2000-09-18 15:18:56 +00:00
{
pMem = new char[nSize];
if( !pMem )
{
StarBASIC::Error( SbERR_NO_MEMORY );
return;
}
if( getcwd( pMem, nSize-1 ) != NULL )
{
rPar.Get(0)->PutString( OUString::createFromAscii(pMem) );
delete [] pMem;
2000-09-18 15:18:56 +00:00
return;
}
if( errno != ERANGE )
{
StarBASIC::Error( SbERR_INTERNAL_ERROR );
delete [] pMem;
2000-09-18 15:18:56 +00:00
return;
}
delete [] pMem;
2000-09-18 15:18:56 +00:00
nSize += _PATH_INCR;
};
#endif
}
2011-03-22 12:23:36 +01:00
RTLFUNC(ChDir)
2000-09-18 15:18:56 +00:00
{
(void)bWrite;
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutEmpty();
if (rPar.Count() == 2)
{
// VBA: track current directory per document type (separately for Writer, Calc, Impress, etc.)
if( SbiRuntime::isVBAEnabled() )
{
::basic::vba::registerCurrentDirectory( getDocumentModel( pBasic ), rPar.Get(1)->GetOUString() );
}
2000-09-18 15:18:56 +00:00
}
else
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
}
2011-03-22 12:23:36 +01:00
RTLFUNC(ChDrive)
2000-09-18 15:18:56 +00:00
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutEmpty();
2011-03-22 19:26:46 +01:00
if (rPar.Count() != 2)
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
}
// Implementation of StepRENAME with UCB
void implStepRenameUCB( const OUString& aSource, const OUString& aDest )
2000-09-18 15:18:56 +00:00
{
uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
2000-09-18 15:18:56 +00:00
if( xSFI.is() )
{
try
{
OUString aSourceFullPath = getFullPath( aSource );
if( !xSFI->exists( aSourceFullPath ) )
{
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
return;
}
OUString aDestFullPath = getFullPath( aDest );
if( xSFI->exists( aDestFullPath ) )
{
StarBASIC::Error( SbERR_FILE_EXISTS );
}
else
{
xSFI->move( aSourceFullPath, aDestFullPath );
}
2000-09-18 15:18:56 +00:00
}
catch(const Exception & )
2000-09-18 15:18:56 +00:00
{
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
2000-09-18 15:18:56 +00:00
}
}
}
2000-09-26 08:02:02 +00:00
// Implementation of StepRENAME with OSL
void implStepRenameOSL( const OUString& aSource, const OUString& aDest )
2000-09-26 08:02:02 +00:00
{
FileBase::RC nRet = File::move( getFullPath( aSource ), getFullPath( aDest ) );
if( nRet != FileBase::E_None )
2000-09-26 08:02:02 +00:00
{
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
}
}
2011-03-22 12:23:36 +01:00
RTLFUNC(FileCopy)
2000-09-18 15:18:56 +00:00
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutEmpty();
if (rPar.Count() == 3)
{
OUString aSource = rPar.Get(1)->GetOUString();
OUString aDest = rPar.Get(2)->GetOUString();
2000-09-18 15:18:56 +00:00
if( hasUno() )
{
uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
2000-09-18 15:18:56 +00:00
if( xSFI.is() )
{
try
{
xSFI->copy( getFullPath( aSource ), getFullPath( aDest ) );
}
catch(const Exception & )
2000-09-18 15:18:56 +00:00
{
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
2000-09-18 15:18:56 +00:00
}
}
}
else
{
FileBase::RC nRet = File::copy( getFullPath( aSource ), getFullPath( aDest ) );
if( nRet != FileBase::E_None )
2000-09-26 08:02:02 +00:00
{
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
}
2000-09-18 15:18:56 +00:00
}
}
else
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2011-03-22 12:23:36 +01:00
RTLFUNC(Kill)
2000-09-18 15:18:56 +00:00
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutEmpty();
if (rPar.Count() == 2)
{
OUString aFileSpec = rPar.Get(1)->GetOUString();
2000-09-18 15:18:56 +00:00
if( hasUno() )
{
uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
2000-09-18 15:18:56 +00:00
if( xSFI.is() )
{
OUString aFullPath = getFullPath( aFileSpec );
if( !xSFI->exists( aFullPath ) || xSFI->isFolder( aFullPath ) )
{
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
return;
}
2000-09-18 15:18:56 +00:00
try
{
xSFI->kill( aFullPath );
2000-09-18 15:18:56 +00:00
}
catch(const Exception & )
2000-09-18 15:18:56 +00:00
{
StarBASIC::Error( ERRCODE_IO_GENERAL );
}
}
}
else
{
File::remove( getFullPath( aFileSpec ) );
2000-09-18 15:18:56 +00:00
}
}
else
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
}
2011-03-22 12:23:36 +01:00
RTLFUNC(MkDir)
2000-09-18 15:18:56 +00:00
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutEmpty();
if (rPar.Count() == 2)
{
OUString aPath = rPar.Get(1)->GetOUString();
2000-09-18 15:18:56 +00:00
if( hasUno() )
{
uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
2000-09-18 15:18:56 +00:00
if( xSFI.is() )
{
try
{
xSFI->createFolder( getFullPath( aPath ) );
}
catch(const Exception & )
2000-09-18 15:18:56 +00:00
{
StarBASIC::Error( ERRCODE_IO_GENERAL );
}
}
}
else
{
Directory::create( getFullPath( aPath ) );
2000-09-18 15:18:56 +00:00
}
}
else
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
}
2000-09-26 08:02:02 +00:00
// In OSL only empty directories can be deleted
// so we have to delete all files recursively
void implRemoveDirRecursive( const OUString& aDirPath )
2000-09-26 08:02:02 +00:00
{
DirectoryItem aItem;
FileBase::RC nRet = DirectoryItem::get( aDirPath, aItem );
bool bExists = (nRet == FileBase::E_None);
2000-09-26 08:02:02 +00:00
FileStatus aFileStatus( osl_FileStatus_Mask_Type );
2000-09-26 08:02:02 +00:00
nRet = aItem.getFileStatus( aFileStatus );
FileStatus::Type aType = aFileStatus.getFileType();
bool bFolder = isFolder( aType );
2000-09-26 08:02:02 +00:00
if( !bExists || !bFolder )
{
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
return;
}
Directory aDir( aDirPath );
nRet = aDir.open();
if( nRet != FileBase::E_None )
2000-09-26 08:02:02 +00:00
{
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
return;
}
for( ;; )
{
DirectoryItem aItem2;
nRet = aDir.getNextItem( aItem2 );
if( nRet != FileBase::E_None )
{
2000-09-26 08:02:02 +00:00
break;
}
2000-09-26 08:02:02 +00:00
// Handle flags
FileStatus aFileStatus2( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL );
nRet = aItem2.getFileStatus( aFileStatus2 );
OUString aPath = aFileStatus2.getFileURL();
2000-09-26 08:02:02 +00:00
// Directory?
FileStatus::Type aType2 = aFileStatus2.getFileType();
bool bFolder2 = isFolder( aType2 );
if( bFolder2 )
2000-09-26 08:02:02 +00:00
{
implRemoveDirRecursive( aPath );
}
else
{
File::remove( aPath );
}
}
nRet = aDir.close();
2000-09-26 08:02:02 +00:00
nRet = Directory::remove( aDirPath );
}
2011-03-22 12:23:36 +01:00
RTLFUNC(RmDir)
2000-09-18 15:18:56 +00:00
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutEmpty();
if (rPar.Count() == 2)
{
OUString aPath = rPar.Get(1)->GetOUString();
2000-09-18 15:18:56 +00:00
if( hasUno() )
{
uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
2000-09-18 15:18:56 +00:00
if( xSFI.is() )
{
try
{
if( !xSFI->isFolder( aPath ) )
{
StarBASIC::Error( SbERR_PATH_NOT_FOUND );
return;
}
2012-01-15 16:15:08 +01:00
SbiInstance* pInst = GetSbData()->pInst;
bool bCompatibility = ( pInst && pInst->IsCompatibility() );
if( bCompatibility )
{
Sequence< OUString > aContent = xSFI->getFolderContents( aPath, true );
sal_Int32 nCount = aContent.getLength();
if( nCount > 0 )
{
StarBASIC::Error( SbERR_ACCESS_ERROR );
return;
}
}
2000-09-18 15:18:56 +00:00
xSFI->kill( getFullPath( aPath ) );
}
catch(const Exception & )
2000-09-18 15:18:56 +00:00
{
StarBASIC::Error( ERRCODE_IO_GENERAL );
}
}
}
else
{
implRemoveDirRecursive( getFullPath( aPath ) );
2000-09-18 15:18:56 +00:00
}
}
else
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
}
2011-03-22 12:23:36 +01:00
RTLFUNC(SendKeys)
2000-09-18 15:18:56 +00:00
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutEmpty();
StarBASIC::Error(SbERR_NOT_IMPLEMENTED);
}
RTLFUNC(Exp)
{
(void)pBasic;
(void)bWrite;
if( rPar.Count() < 2 )
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
double aDouble = rPar.Get( 1 )->GetDouble();
aDouble = exp( aDouble );
checkArithmeticOverflow( aDouble );
2000-09-18 15:18:56 +00:00
rPar.Get( 0 )->PutDouble( aDouble );
}
}
RTLFUNC(FileLen)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
SbxVariableRef pArg = rPar.Get( 1 );
OUString aStr( pArg->GetOUString() );
sal_Int32 nLen = 0;
2000-09-18 15:18:56 +00:00
if( hasUno() )
{
uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
2000-09-18 15:18:56 +00:00
if( xSFI.is() )
{
try
{
nLen = xSFI->getSize( getFullPath( aStr ) );
}
catch(const Exception & )
2000-09-18 15:18:56 +00:00
{
StarBASIC::Error( ERRCODE_IO_GENERAL );
}
}
}
else
{
2000-09-26 08:02:02 +00:00
DirectoryItem aItem;
DirectoryItem::get( getFullPath( aStr ), aItem );
FileStatus aFileStatus( osl_FileStatus_Mask_FileSize );
2011-01-23 18:29:24 +00:00
aItem.getFileStatus( aFileStatus );
nLen = (sal_Int32)aFileStatus.getFileSize();
2000-09-18 15:18:56 +00:00
}
rPar.Get(0)->PutLong( (long)nLen );
}
}
RTLFUNC(Hex)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
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>(pArg->GetLong());
OUString aStr(OUString::valueOf( sal_Int64(nVal), 16 ));
aStr = aStr.toAsciiUpperCase();
rPar.Get(0)->PutString( aStr );
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(FuncCaller)
{
(void)pBasic;
(void)bWrite;
2012-01-15 16:15:08 +01:00
if ( SbiRuntime::isVBAEnabled() && GetSbData()->pInst && GetSbData()->pInst->pRun )
{
2012-01-15 16:15:08 +01:00
if ( GetSbData()->pInst->pRun->GetExternalCaller() )
*rPar.Get(0) = *GetSbData()->pInst->pRun->GetExternalCaller();
else
{
SbxVariableRef pVar = new SbxVariable(SbxVARIANT);
*rPar.Get(0) = *pVar;
}
}
else
{
StarBASIC::Error( SbERR_NOT_IMPLEMENTED );
}
}
2000-09-18 15:18:56 +00:00
// InStr( [start],string,string,[compare] )
RTLFUNC(InStr)
{
(void)pBasic;
(void)bWrite;
sal_uIntPtr nArgCount = rPar.Count()-1;
2000-09-18 15:18:56 +00:00
if ( nArgCount < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
sal_Int32 nStartPos = 1;
sal_Int32 nFirstStringPos = 1;
2000-09-18 15:18:56 +00:00
if ( nArgCount >= 3 )
{
nStartPos = rPar.Get(1)->GetLong();
if( nStartPos <= 0 )
2000-09-18 15:18:56 +00:00
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
nStartPos = 1;
2000-09-18 15:18:56 +00:00
}
nFirstStringPos++;
}
2012-01-15 16:15:08 +01:00
SbiInstance* pInst = GetSbData()->pInst;
int bTextMode;
bool bCompatibility = ( pInst && pInst->IsCompatibility() );
if( bCompatibility )
{
SbiRuntime* pRT = pInst->pRun;
bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False;
}
else
{
bTextMode = 1;;
}
2000-09-18 15:18:56 +00:00
if ( nArgCount == 4 )
{
bTextMode = rPar.Get(4)->GetInteger();
}
sal_Int32 nPos;
const OUString& rToken = rPar.Get(nFirstStringPos+1)->GetOUString();
2000-09-18 15:18:56 +00:00
// #97545 Always find empty string
if( rToken.isEmpty() )
2000-09-18 15:18:56 +00:00
{
nPos = nStartPos;
2000-09-18 15:18:56 +00:00
}
else
{
if( !bTextMode )
{
const OUString& rStr1 = rPar.Get(nFirstStringPos)->GetOUString();
nPos = rStr1.indexOf( rToken, nStartPos - 1 ) + 1;
}
2000-09-18 15:18:56 +00:00
else
{
OUString aStr1 = rPar.Get(nFirstStringPos)->GetOUString();
OUString aToken = rToken;
aStr1 = aStr1.toAsciiUpperCase();
aToken = aToken.toAsciiUpperCase();
nPos = aStr1.indexOf( aToken, nStartPos-1 ) + 1;
}
2000-09-18 15:18:56 +00:00
}
rPar.Get(0)->PutLong( nPos );
}
}
// InstrRev(string1, string2[, start[, compare]])
RTLFUNC(InStrRev)
{
(void)pBasic;
(void)bWrite;
sal_uIntPtr nArgCount = rPar.Count()-1;
if ( nArgCount < 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
else
{
OUString aStr1 = rPar.Get(1)->GetOUString();
OUString aToken = rPar.Get(2)->GetOUString();
sal_Int32 nStartPos = -1;
if ( nArgCount >= 3 )
{
nStartPos = rPar.Get(3)->GetLong();
if( (nStartPos <= 0 && nStartPos != -1))
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
nStartPos = -1;
}
}
2012-01-15 16:15:08 +01:00
SbiInstance* pInst = GetSbData()->pInst;
int bTextMode;
bool bCompatibility = ( pInst && pInst->IsCompatibility() );
if( bCompatibility )
{
SbiRuntime* pRT = pInst->pRun;
bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False;
}
else
{
bTextMode = 1;;
}
if ( nArgCount == 4 )
{
bTextMode = rPar.Get(4)->GetInteger();
}
sal_Int32 nStrLen = aStr1.getLength();
if( nStartPos == -1 )
{
nStartPos = nStrLen;
}
sal_Int32 nPos = 0;
if( nStartPos <= nStrLen )
{
sal_Int32 nTokenLen = aToken.getLength();
if( !nTokenLen )
{
// Always find empty string
nPos = nStartPos;
}
else if( nStrLen > 0 )
{
if( !bTextMode )
{
nPos = aStr1.lastIndexOf( aToken, nStartPos ) + 1;
}
else
{
aStr1 = aStr1.toAsciiUpperCase();
aToken = aToken.toAsciiUpperCase();
nPos = aStr1.lastIndexOf( aToken, nStartPos ) + 1;
}
}
}
rPar.Get(0)->PutLong( nPos );
2000-09-18 15:18:56 +00:00
}
}
/*
Int( 2.8 ) = 2.0
Int( -2.8 ) = -3.0
Fix( 2.8 ) = 2.0
Fix( -2.8 ) = -2.0 <- !!
*/
RTLFUNC(Int)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
SbxVariableRef pArg = rPar.Get( 1 );
double aDouble= pArg->GetDouble();
/*
floor( 2.8 ) = 2.0
floor( -2.8 ) = -3.0
*/
aDouble = floor( aDouble );
rPar.Get(0)->PutDouble( aDouble );
}
}
RTLFUNC(Fix)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
SbxVariableRef pArg = rPar.Get( 1 );
double aDouble = pArg->GetDouble();
if ( aDouble >= 0.0 )
aDouble = floor( aDouble );
else
aDouble = ceil( aDouble );
rPar.Get(0)->PutDouble( aDouble );
}
}
RTLFUNC(LCase)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
const CharClass& rCharClass = GetCharClass();
OUString aStr( rPar.Get(1)->GetOUString() );
aStr = rCharClass.lowercase(aStr);
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutString( aStr );
}
}
RTLFUNC(Left)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 3 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
OUString aStr( rPar.Get(1)->GetOUString() );
sal_Int32 nResultLen = rPar.Get(2)->GetLong();
if( nResultLen < 0 )
{
nResultLen = 0;
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
else if(nResultLen > aStr.getLength())
2000-09-18 15:18:56 +00:00
{
nResultLen = aStr.getLength();
2000-09-18 15:18:56 +00:00
}
aStr = aStr.copy(0, nResultLen );
rPar.Get(0)->PutString( aStr );
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(Log)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
double aArg = rPar.Get(1)->GetDouble();
if ( aArg > 0 )
{
double d = log( aArg );
checkArithmeticOverflow( d );
rPar.Get( 0 )->PutDouble( d );
}
2000-09-18 15:18:56 +00:00
else
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(LTrim)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
OUString aStr(comphelper::string::stripStart(rPar.Get(1)->GetOUString(), ' '));
rPar.Get(0)->PutString(aStr);
2000-09-18 15:18:56 +00:00
}
}
// Mid( String, nStart, nLength )
RTLFUNC(Mid)
{
(void)pBasic;
(void)bWrite;
int nArgCount = rPar.Count()-1;
2000-09-18 15:18:56 +00:00
if ( nArgCount < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
// #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.
2000-09-18 15:18:56 +00:00
if( nArgCount == 4 )
{
bWrite = sal_True;
}
OUString aArgStr = rPar.Get(1)->GetOUString();
sal_Int32 nStartPos = rPar.Get(2)->GetLong();
2000-09-18 15:18:56 +00:00
if ( nStartPos == 0 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
nStartPos--;
sal_Int32 nLen = -1;
bool bWriteNoLenParam = false;
2000-09-18 15:18:56 +00:00
if ( nArgCount == 3 || bWrite )
{
sal_Int32 n = rPar.Get(3)->GetLong();
if( bWrite && n == -1 )
{
bWriteNoLenParam = true;
}
nLen = n;
}
2000-09-18 15:18:56 +00:00
if ( bWrite )
{
OUStringBuffer aResultStr;
2012-01-15 16:15:08 +01:00
SbiInstance* pInst = GetSbData()->pInst;
bool bCompatibility = ( pInst && pInst->IsCompatibility() );
if( bCompatibility )
{
sal_Int32 nArgLen = aArgStr.getLength();
if( nStartPos + 1 > nArgLen )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
OUString aReplaceStr = rPar.Get(4)->GetOUString();
sal_Int32 nReplaceStrLen = aReplaceStr.getLength();
sal_Int32 nReplaceLen;
if( bWriteNoLenParam )
{
nReplaceLen = nReplaceStrLen;
}
else
{
nReplaceLen = nLen;
if( nReplaceLen < 0 || nReplaceLen > nReplaceStrLen )
{
nReplaceLen = nReplaceStrLen;
}
}
sal_Int32 nReplaceEndPos = nStartPos + nReplaceLen;
if( nReplaceEndPos > nArgLen )
{
nReplaceLen -= (nReplaceEndPos - nArgLen);
}
aResultStr = aArgStr;
sal_Int32 nErase = nReplaceLen;
aResultStr.remove( nStartPos, nErase );
aResultStr.insert( nStartPos, aReplaceStr.getStr(), nReplaceLen);
}
else
{
aResultStr = aArgStr;
sal_Int32 nTmpStartPos = nStartPos;
if ( nTmpStartPos > aArgStr.getLength() )
nTmpStartPos = aArgStr.getLength();
else
aResultStr.remove( nTmpStartPos, nLen );
aResultStr.insert( nTmpStartPos, rPar.Get(4)->GetOUString().getStr(), std::min(nLen, rPar.Get(4)->GetOUString().getLength()));
}
rPar.Get(1)->PutString( aResultStr.makeStringAndClear() );
2000-09-18 15:18:56 +00:00
}
else
{
OUString aResultStr;
if(nLen < 0)
{
aResultStr = aArgStr.copy( nStartPos);
}
else
{
if(nStartPos + nLen > aArgStr.getLength())
{
nLen = aArgStr.getLength() - nStartPos;
}
aResultStr = aArgStr.copy( nStartPos, nLen );
}
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutString( aResultStr );
}
}
}
}
RTLFUNC(Oct)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
char aBuffer[16];
SbxVariableRef pArg = rPar.Get( 1 );
if ( pArg->IsInteger() )
{
snprintf( aBuffer, sizeof(aBuffer), "%o", pArg->GetInteger() );
}
2000-09-18 15:18:56 +00:00
else
{
snprintf( aBuffer, sizeof(aBuffer), "%lo", static_cast<long unsigned int>(pArg->GetLong()) );
}
rPar.Get(0)->PutString( OUString::createFromAscii( aBuffer ) );
2000-09-18 15:18:56 +00:00
}
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
// Replace(expression, find, replace[, start[, count[, compare]]])
RTLFUNC(Replace)
{
(void)pBasic;
(void)bWrite;
sal_uIntPtr nArgCount = rPar.Count()-1;
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
if ( nArgCount < 3 || nArgCount > 6 )
{
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
else
{
OUString aExpStr = rPar.Get(1)->GetOUString();
OUString aFindStr = rPar.Get(2)->GetOUString();
OUString aReplaceStr = rPar.Get(3)->GetOUString();
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
sal_Int32 lStartPos = 1;
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
if ( nArgCount >= 4 )
{
if( rPar.Get(4)->GetType() != SbxEMPTY )
{
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
lStartPos = rPar.Get(4)->GetLong();
}
if( lStartPos < 1)
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
lStartPos = 1;
}
}
sal_Int32 lCount = -1;
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
if( nArgCount >=5 )
{
if( rPar.Get(5)->GetType() != SbxEMPTY )
{
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
lCount = rPar.Get(5)->GetLong();
}
if( lCount < -1)
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
lCount = -1;
}
}
2012-01-15 16:15:08 +01:00
SbiInstance* pInst = GetSbData()->pInst;
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
int bTextMode;
bool bCompatibility = ( pInst && pInst->IsCompatibility() );
if( bCompatibility )
{
SbiRuntime* pRT = pInst->pRun;
bTextMode = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False;
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
}
else
{
bTextMode = 1;
}
if ( nArgCount == 6 )
{
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
bTextMode = rPar.Get(6)->GetInteger();
}
sal_Int32 nExpStrLen = aExpStr.getLength();
sal_Int32 nFindStrLen = aFindStr.getLength();
sal_Int32 nReplaceStrLen = aReplaceStr.getLength();
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
2008-10-28 08:22:18 +00:00
if( lStartPos <= nExpStrLen )
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
{
sal_Int32 nPos = lStartPos - 1;
sal_Int32 nCounts = 0;
2008-10-28 08:22:18 +00:00
while( lCount == -1 || lCount > nCounts )
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
{
OUString aSrcStr( aExpStr );
2008-10-28 08:22:18 +00:00
if( bTextMode )
{
aSrcStr = aSrcStr.toAsciiUpperCase();
aFindStr = aFindStr.toAsciiUpperCase();
2008-10-28 08:22:18 +00:00
}
nPos = aSrcStr.indexOf( aFindStr, nPos );
if( nPos >= 0 )
2008-10-28 08:22:18 +00:00
{
aExpStr = aExpStr.replaceAt( nPos, nFindStrLen, aReplaceStr );
2008-10-28 08:22:18 +00:00
nPos = nPos - nFindStrLen + nReplaceStrLen + 1;
nCounts++;
}
else
{
break;
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
}
}
rPar.Get(0)->PutString( aExpStr.copy( lStartPos - 1 ) );
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
}
}
2000-09-18 15:18:56 +00:00
RTLFUNC(Right)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 3 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
const OUString& rStr = rPar.Get(1)->GetOUString();
int nResultLen = rPar.Get(2)->GetLong();
if( nResultLen < 0 )
{
nResultLen = 0;
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
int nStrLen = rStr.getLength();
2000-09-18 15:18:56 +00:00
if ( nResultLen > nStrLen )
{
2000-09-18 15:18:56 +00:00
nResultLen = nStrLen;
}
OUString aResultStr = rStr.copy( nStrLen - nResultLen );
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutString( aResultStr );
}
}
RTLFUNC(RTL)
{
(void)pBasic;
(void)bWrite;
rPar.Get( 0 )->PutObject( pBasic->getRTL() );
}
2000-09-18 15:18:56 +00:00
RTLFUNC(RTrim)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
OUString aStr(comphelper::string::stripEnd(rPar.Get(1)->GetOUString(), ' '));
rPar.Get(0)->PutString(aStr);
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(Sgn)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
double aDouble = rPar.Get(1)->GetDouble();
sal_Int16 nResult = 0;
2000-09-18 15:18:56 +00:00
if ( aDouble > 0 )
{
2000-09-18 15:18:56 +00:00
nResult = 1;
}
2000-09-18 15:18:56 +00:00
else if ( aDouble < 0 )
{
2000-09-18 15:18:56 +00:00
nResult = -1;
}
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutInteger( nResult );
}
}
RTLFUNC(Space)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
OUStringBuffer aBuf;
string::padToLength(aBuf, rPar.Get(1)->GetLong(), ' ');
rPar.Get(0)->PutString(aBuf.makeStringAndClear());
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(Spc)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
OUStringBuffer aBuf;
string::padToLength(aBuf, rPar.Get(1)->GetLong(), ' ');
rPar.Get(0)->PutString(aBuf.makeStringAndClear());
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(Sqr)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
double aDouble = rPar.Get(1)->GetDouble();
if ( aDouble >= 0 )
{
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutDouble( sqrt( aDouble ));
}
2000-09-18 15:18:56 +00:00
else
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(Str)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
OUString aStr;
OUString aStrNew("");
SbxVariableRef pArg = rPar.Get( 1 );
pArg->Format( aStr );
2000-09-18 15:18:56 +00:00
// Numbers start with a space
if( pArg->IsNumericRTL() )
{
// replace commas by points so that it's symmetric to Val!
aStr = aStr.replaceFirst( ",", "." );
2012-01-15 16:15:08 +01:00
SbiInstance* pInst = GetSbData()->pInst;
bool bCompatibility = ( pInst && pInst->IsCompatibility() );
if( bCompatibility )
{
sal_Int32 nLen = aStr.getLength();
const sal_Unicode* pBuf = aStr.getStr();
bool bNeg = ( pBuf[0] == '-' );
sal_Int32 iZeroSearch = 0;
if( bNeg )
{
aStrNew += "-";
iZeroSearch++;
}
else
{
if( pBuf[0] != ' ' )
{
aStrNew += " ";
}
}
sal_Int32 iNext = iZeroSearch + 1;
if( pBuf[iZeroSearch] == '0' && nLen > iNext && pBuf[iNext] == '.' )
{
iZeroSearch += 1;
}
aStrNew += aStr.copy(iZeroSearch);
}
else
{
aStrNew = " " + aStr;
}
}
else
{
aStrNew = aStr;
}
rPar.Get(0)->PutString( aStrNew );
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(StrComp)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
rPar.Get(0)->PutEmpty();
return;
}
const OUString& rStr1 = rPar.Get(1)->GetOUString();
const OUString& rStr2 = rPar.Get(2)->GetOUString();
2012-01-15 16:15:08 +01:00
SbiInstance* pInst = GetSbData()->pInst;
sal_Int16 nTextCompare;
bool bCompatibility = ( pInst && pInst->IsCompatibility() );
if( bCompatibility )
{
SbiRuntime* pRT = pInst->pRun;
nTextCompare = pRT ? pRT->GetImageFlag( SBIMG_COMPARETEXT ) : sal_False;
}
else
{
nTextCompare = sal_True;
}
2000-09-18 15:18:56 +00:00
if ( rPar.Count() == 4 )
nTextCompare = rPar.Get(3)->GetInteger();
if( !bCompatibility )
{
nTextCompare = !nTextCompare;
}
sal_Int32 nRetValue = 0;
if( nTextCompare )
{
::utl::TransliterationWrapper* pTransliterationWrapper = GetSbData()->pTransliterationWrapper;
if( !pTransliterationWrapper )
{
uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
pTransliterationWrapper = GetSbData()->pTransliterationWrapper =
new ::utl::TransliterationWrapper( xContext,
i18n::TransliterationModules_IGNORE_CASE |
i18n::TransliterationModules_IGNORE_KANA |
i18n::TransliterationModules_IGNORE_WIDTH );
}
LanguageType eLangType = GetpApp()->GetSettings().GetLanguageTag().getLanguageType();
pTransliterationWrapper->loadModuleIfNeeded( eLangType );
nRetValue = pTransliterationWrapper->compareString( rStr1, rStr2 );
}
2000-09-18 15:18:56 +00:00
else
{
sal_Int32 aResult;
aResult = rStr1.compareTo( rStr2 );
if ( aResult < 0 )
{
nRetValue = -1;
}
else if ( aResult > 0)
{
nRetValue = 1;
}
}
rPar.Get(0)->PutInteger( sal::static_int_cast< sal_Int16 >( nRetValue ) );
2000-09-18 15:18:56 +00:00
}
RTLFUNC(String)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
sal_Unicode aFiller;
sal_Int32 lCount = rPar.Get(1)->GetLong();
if( lCount < 0 || lCount > 0xffff )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
if( rPar.Get(2)->GetType() == SbxINTEGER )
{
aFiller = (sal_Unicode)rPar.Get(2)->GetInteger();
}
2000-09-18 15:18:56 +00:00
else
{
const OUString& rStr = rPar.Get(2)->GetOUString();
aFiller = rStr[0];
2000-09-18 15:18:56 +00:00
}
OUStringBuffer aBuf(lCount);
string::padToLength(aBuf, lCount, aFiller);
rPar.Get(0)->PutString(aBuf.makeStringAndClear());
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(Tan)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
SbxVariableRef pArg = rPar.Get( 1 );
rPar.Get( 0 )->PutDouble( tan( pArg->GetDouble() ) );
}
}
RTLFUNC(UCase)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
const CharClass& rCharClass = GetCharClass();
OUString aStr( rPar.Get(1)->GetOUString() );
aStr = rCharClass.uppercase( aStr );
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutString( aStr );
}
}
RTLFUNC(Val)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
double nResult = 0.0;
2000-09-18 15:18:56 +00:00
char* pEndPtr;
OUString aStr( rPar.Get(1)->GetOUString() );
2000-09-18 15:18:56 +00:00
FilterWhiteSpace( aStr );
if ( aStr[0] == '&' && aStr.getLength() > 1 )
2000-09-18 15:18:56 +00:00
{
int nRadix = 10;
char aChar = (char)aStr[1];
2000-09-18 15:18:56 +00:00
if ( aChar == 'h' || aChar == 'H' )
{
2000-09-18 15:18:56 +00:00
nRadix = 16;
}
2000-09-18 15:18:56 +00:00
else if ( aChar == 'o' || aChar == 'O' )
{
2000-09-18 15:18:56 +00:00
nRadix = 8;
}
2000-09-18 15:18:56 +00:00
if ( nRadix != 10 )
{
OString aByteStr(OUStringToOString(aStr, osl_getThreadTextEncoding()));
2011-11-27 20:37:42 +00:00
sal_Int16 nlResult = (sal_Int16)strtol( aByteStr.getStr()+2, &pEndPtr, nRadix);
2000-09-18 15:18:56 +00:00
nResult = (double)nlResult;
}
}
else
{
rtl_math_ConversionStatus eStatus = rtl_math_ConversionStatus_Ok;
sal_Int32 nParseEnd = 0;
nResult = ::rtl::math::stringToDouble( aStr, '.', ',', &eStatus, &nParseEnd );
if ( eStatus != rtl_math_ConversionStatus_Ok )
StarBASIC::Error( SbERR_MATH_OVERFLOW );
/* 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
* like "x" resulted in 0. Not changing that now (2013-03-22) as
* user macros may rely on it. */
#if 0
else if ( nParseEnd != aStr.getLength() )
StarBASIC::Error( SbERR_CONVERSION );
#endif
2000-09-18 15:18:56 +00:00
}
rPar.Get(0)->PutDouble( nResult );
}
}
// Helper functions for date conversion
sal_Int16 implGetDateDay( double aDate )
2000-09-18 15:18:56 +00:00
{
aDate -= 2.0; // standardize: 1.1.1900 => 0.0
Date aRefDate( 1, 1, 1900 );
if ( aDate >= 0.0 )
2000-09-18 15:18:56 +00:00
{
aDate = floor( aDate );
aRefDate += (sal_uIntPtr)aDate;
2000-09-18 15:18:56 +00:00
}
else
{
aDate = ceil( aDate );
aRefDate -= (sal_uIntPtr)(-1.0 * aDate);
}
sal_Int16 nRet = (sal_Int16)( aRefDate.GetDay() );
return nRet;
}
sal_Int16 implGetDateMonth( double aDate )
{
Date aRefDate( 1,1,1900 );
long nDays = (long)aDate;
nDays -= 2; // standardize: 1.1.1900 => 0.0
aRefDate += nDays;
sal_Int16 nRet = (sal_Int16)( aRefDate.GetMonth() );
return nRet;
}
// Function to convert date to ISO 8601 date format
RTLFUNC(CDateToIso)
{
(void)pBasic;
(void)bWrite;
if ( rPar.Count() == 2 )
{
double aDate = rPar.Get(1)->GetDate();
2001-11-02 10:56:32 +00:00
char Buffer[9];
snprintf( Buffer, sizeof( Buffer ), "%04d%02d%02d",
2001-11-02 10:56:32 +00:00
implGetDateYear( aDate ),
implGetDateMonth( aDate ),
implGetDateDay( aDate ) );
OUString aRetStr = OUString::createFromAscii( Buffer );
rPar.Get(0)->PutString( aRetStr );
}
else
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
}
// Function to convert date from ISO 8601 date format
RTLFUNC(CDateFromIso)
{
(void)pBasic;
(void)bWrite;
if ( rPar.Count() == 2 )
{
OUString aStr = rPar.Get(1)->GetOUString();
sal_Int16 iMonthStart = aStr.getLength() - 4;
OUString aYearStr = aStr.copy( 0, iMonthStart );
OUString aMonthStr = aStr.copy( iMonthStart, 2 );
OUString aDayStr = aStr.copy( iMonthStart+2, 2 );
double dDate;
if( implDateSerial( (sal_Int16)aYearStr.toInt32(),
(sal_Int16)aMonthStr.toInt32(), (sal_Int16)aDayStr.toInt32(), dDate ) )
2001-11-02 10:56:32 +00:00
{
rPar.Get(0)->PutDate( dDate );
2001-11-02 10:56:32 +00:00
}
}
else
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
}
RTLFUNC(DateSerial)
{
(void)pBasic;
(void)bWrite;
if ( rPar.Count() < 4 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
sal_Int16 nYear = rPar.Get(1)->GetInteger();
sal_Int16 nMonth = rPar.Get(2)->GetInteger();
sal_Int16 nDay = rPar.Get(3)->GetInteger();
double dDate;
if( implDateSerial( nYear, nMonth, nDay, dDate ) )
{
rPar.Get(0)->PutDate( dDate );
}
2000-09-18 15:18:56 +00:00
}
RTLFUNC(TimeSerial)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 4 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
sal_Int16 nHour = rPar.Get(1)->GetInteger();
2000-09-18 15:18:56 +00:00
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();
2000-09-18 15:18:56 +00:00
if ((nHour < 0 || nHour > 23) ||
(nMinute < 0 || nMinute > 59 ) ||
(nSecond < 0 || nSecond > 59 ))
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
sal_Int32 nSeconds = nHour;
2000-09-18 15:18:56 +00:00
nSeconds *= 3600;
nSeconds += nMinute * 60;
nSeconds += nSecond;
double nDays = ((double)nSeconds) / (double)(86400.0);
rPar.Get(0)->PutDate( nDays ); // JSM
}
RTLFUNC(DateValue)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
2012-01-15 16:15:08 +01:00
// #39629 check GetSbData()->pInst, can be called from the URL line
2000-09-18 15:18:56 +00:00
SvNumberFormatter* pFormatter = NULL;
2012-01-15 16:15:08 +01:00
if( GetSbData()->pInst )
{
2012-01-15 16:15:08 +01:00
pFormatter = GetSbData()->pInst->GetNumberFormatter();
}
2000-09-18 15:18:56 +00:00
else
{
sal_uInt32 n; // Dummy
2000-09-18 15:18:56 +00:00
SbiInstance::PrepareNumberFormatter( pFormatter, n, n, n );
}
sal_uInt32 nIndex = 0;
2000-09-18 15:18:56 +00:00
double fResult;
OUString aStr( rPar.Get(1)->GetOUString() );
sal_Bool bSuccess = pFormatter->IsNumberFormat( aStr, nIndex, fResult );
2000-09-18 15:18:56 +00:00
short nType = pFormatter->GetType( nIndex );
2008-10-28 08:22:18 +00:00
// DateValue("February 12, 1969") raises error if the system locale is not en_US
// by using SbiInstance::GetNumberFormatter.
// It seems that both locale number formatter and English number formatter
// are supported in Visual Basic.
LanguageType eLangType = GetpApp()->GetSettings().GetLanguageTag().getLanguageType();
2008-10-28 08:22:18 +00:00
if( !bSuccess && ( eLangType != LANGUAGE_ENGLISH_US ) )
{
// Create a new SvNumberFormatter by using LANGUAGE_ENGLISH to get the date value;
SvNumberFormatter aFormatter( comphelper::getProcessComponentContext(), LANGUAGE_ENGLISH_US );
nIndex = 0;
2008-10-28 08:22:18 +00:00
bSuccess = aFormatter.IsNumberFormat( aStr, nIndex, fResult );
nType = aFormatter.GetType( nIndex );
}
2000-09-18 15:18:56 +00:00
if(bSuccess && (nType==NUMBERFORMAT_DATE || nType==NUMBERFORMAT_DATETIME))
{
if ( nType == NUMBERFORMAT_DATETIME )
{
// cut time
2000-09-18 15:18:56 +00:00
if ( fResult > 0.0 )
{
2000-09-18 15:18:56 +00:00
fResult = floor( fResult );
}
2000-09-18 15:18:56 +00:00
else
{
2000-09-18 15:18:56 +00:00
fResult = ceil( fResult );
}
2000-09-18 15:18:56 +00:00
}
2011-03-22 12:23:36 +01:00
rPar.Get(0)->PutDate( fResult );
2000-09-18 15:18:56 +00:00
}
else
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_CONVERSION );
}
// #39629 pFormatter can be requested itself
2012-01-15 16:15:08 +01:00
if( !GetSbData()->pInst )
{
2000-09-18 15:18:56 +00:00
delete pFormatter;
}
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(TimeValue)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
SvNumberFormatter* pFormatter = NULL;
2012-01-15 16:15:08 +01:00
if( GetSbData()->pInst )
pFormatter = GetSbData()->pInst->GetNumberFormatter();
2000-09-18 15:18:56 +00:00
else
{
sal_uInt32 n;
2000-09-18 15:18:56 +00:00
SbiInstance::PrepareNumberFormatter( pFormatter, n, n, n );
}
sal_uInt32 nIndex = 0;
2000-09-18 15:18:56 +00:00
double fResult;
sal_Bool bSuccess = pFormatter->IsNumberFormat( rPar.Get(1)->GetOUString(),
2000-09-18 15:18:56 +00:00
nIndex, fResult );
short nType = pFormatter->GetType(nIndex);
if(bSuccess && (nType==NUMBERFORMAT_TIME||nType==NUMBERFORMAT_DATETIME))
{
if ( nType == NUMBERFORMAT_DATETIME )
{
// cut days
2000-09-18 15:18:56 +00:00
fResult = fmod( fResult, 1 );
}
2011-03-22 12:23:36 +01:00
rPar.Get(0)->PutDate( fResult );
2000-09-18 15:18:56 +00:00
}
else
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_CONVERSION );
}
2012-01-15 16:15:08 +01:00
if( !GetSbData()->pInst )
{
2000-09-18 15:18:56 +00:00
delete pFormatter;
}
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(Day)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
SbxVariableRef pArg = rPar.Get( 1 );
double aDate = pArg->GetDate();
sal_Int16 nDay = implGetDateDay( aDate );
rPar.Get(0)->PutInteger( nDay );
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(Year)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
sal_Int16 nYear = implGetDateYear( rPar.Get(1)->GetDate() );
rPar.Get(0)->PutInteger( nYear );
2000-09-18 15:18:56 +00:00
}
}
sal_Int16 implGetHour( double dDate )
{
if( dDate < 0.0 )
{
dDate *= -1.0;
}
double nFrac = dDate - floor( dDate );
nFrac *= 86400.0;
sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5);
sal_Int16 nHour = (sal_Int16)(nSeconds / 3600);
return nHour;
}
2000-09-18 15:18:56 +00:00
RTLFUNC(Hour)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
double nArg = rPar.Get(1)->GetDate();
sal_Int16 nHour = implGetHour( nArg );
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutInteger( nHour );
}
}
RTLFUNC(Minute)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
double nArg = rPar.Get(1)->GetDate();
sal_Int16 nMin = implGetMinute( nArg );
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutInteger( nMin );
}
}
RTLFUNC(Month)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
sal_Int16 nMonth = implGetDateMonth( rPar.Get(1)->GetDate() );
rPar.Get(0)->PutInteger( nMonth );
2000-09-18 15:18:56 +00:00
}
}
sal_Int16 implGetSecond( double dDate )
{
if( dDate < 0.0 )
{
dDate *= -1.0;
}
double nFrac = dDate - floor( dDate );
nFrac *= 86400.0;
sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5);
sal_Int16 nTemp = (sal_Int16)(nSeconds / 3600);
nSeconds -= nTemp * 3600;
nTemp = (sal_Int16)(nSeconds / 60);
nSeconds -= nTemp * 60;
sal_Int16 nRet = (sal_Int16)nSeconds;
return nRet;
}
2000-09-18 15:18:56 +00:00
RTLFUNC(Second)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
double nArg = rPar.Get(1)->GetDate();
sal_Int16 nSecond = implGetSecond( nArg );
rPar.Get(0)->PutInteger( nSecond );
2000-09-18 15:18:56 +00:00
}
}
double Now_Impl()
2000-09-18 15:18:56 +00:00
{
Date aDate( Date::SYSTEM );
Time aTime( Time::SYSTEM );
2000-09-18 15:18:56 +00:00
double aSerial = (double)GetDayDiff( aDate );
long nSeconds = aTime.GetHour();
nSeconds *= 3600;
nSeconds += aTime.GetMin() * 60;
nSeconds += aTime.GetSec();
double nDays = ((double)nSeconds) / (double)(24.0*3600.0);
aSerial += nDays;
return aSerial;
}
// Date Now(void)
RTLFUNC(Now)
{
(void)pBasic;
(void)bWrite;
rPar.Get(0)->PutDate( Now_Impl() );
2000-09-18 15:18:56 +00:00
}
// Date Time(void)
RTLFUNC(Time)
{
(void)pBasic;
2000-09-18 15:18:56 +00:00
if ( !bWrite )
{
Time aTime( Time::SYSTEM );
2000-09-18 15:18:56 +00:00
SbxVariable* pMeth = rPar.Get( 0 );
OUString aRes;
2000-09-18 15:18:56 +00:00
if( pMeth->IsFixed() )
{
// Time$: hh:mm:ss
char buf[ 20 ];
snprintf( buf, sizeof(buf), "%02d:%02d:%02d",
aTime.GetHour(), aTime.GetMin(), aTime.GetSec() );
aRes = OUString::createFromAscii( buf );
2000-09-18 15:18:56 +00:00
}
else
{
// Time: system dependent
long nSeconds=aTime.GetHour();
nSeconds *= 3600;
nSeconds += aTime.GetMin() * 60;
nSeconds += aTime.GetSec();
double nDays = (double)nSeconds * ( 1.0 / (24.0*3600.0) );
Color* pCol;
SvNumberFormatter* pFormatter = NULL;
sal_uInt32 nIndex;
2012-01-15 16:15:08 +01:00
if( GetSbData()->pInst )
2000-09-18 15:18:56 +00:00
{
2012-01-15 16:15:08 +01:00
pFormatter = GetSbData()->pInst->GetNumberFormatter();
nIndex = GetSbData()->pInst->GetStdTimeIdx();
2000-09-18 15:18:56 +00:00
}
else
{
sal_uInt32 n; // Dummy
2000-09-18 15:18:56 +00:00
SbiInstance::PrepareNumberFormatter( pFormatter, n, nIndex, n );
}
pFormatter->GetOutputString( nDays, nIndex, aRes, &pCol );
2012-01-15 16:15:08 +01:00
if( !GetSbData()->pInst )
{
2000-09-18 15:18:56 +00:00
delete pFormatter;
}
2000-09-18 15:18:56 +00:00
}
pMeth->PutString( aRes );
}
else
{
StarBASIC::Error( SbERR_NOT_IMPLEMENTED );
}
}
RTLFUNC(Timer)
{
(void)pBasic;
(void)bWrite;
Time aTime( Time::SYSTEM );
2000-09-18 15:18:56 +00:00
long nSeconds = aTime.GetHour();
nSeconds *= 3600;
nSeconds += aTime.GetMin() * 60;
nSeconds += aTime.GetSec();
rPar.Get(0)->PutDate( (double)nSeconds );
}
RTLFUNC(Date)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( !bWrite )
{
Date aToday( Date::SYSTEM );
2000-09-18 15:18:56 +00:00
double nDays = (double)GetDayDiff( aToday );
SbxVariable* pMeth = rPar.Get( 0 );
if( pMeth->IsString() )
{
OUString aRes;
2000-09-18 15:18:56 +00:00
Color* pCol;
SvNumberFormatter* pFormatter = NULL;
sal_uInt32 nIndex;
2012-01-15 16:15:08 +01:00
if( GetSbData()->pInst )
2000-09-18 15:18:56 +00:00
{
2012-01-15 16:15:08 +01:00
pFormatter = GetSbData()->pInst->GetNumberFormatter();
nIndex = GetSbData()->pInst->GetStdDateIdx();
2000-09-18 15:18:56 +00:00
}
else
{
sal_uInt32 n;
2000-09-18 15:18:56 +00:00
SbiInstance::PrepareNumberFormatter( pFormatter, nIndex, n, n );
}
pFormatter->GetOutputString( nDays, nIndex, aRes, &pCol );
pMeth->PutString( aRes );
2012-01-15 16:15:08 +01:00
if( !GetSbData()->pInst )
{
2000-09-18 15:18:56 +00:00
delete pFormatter;
}
2000-09-18 15:18:56 +00:00
}
else
{
2000-09-18 15:18:56 +00:00
pMeth->PutDate( nDays );
}
2000-09-18 15:18:56 +00:00
}
else
{
StarBASIC::Error( SbERR_NOT_IMPLEMENTED );
}
}
RTLFUNC(IsArray)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
rPar.Get(0)->PutBool((rPar.Get(1)->GetType() & SbxARRAY) ? sal_True : sal_False );
}
2000-09-18 15:18:56 +00:00
}
RTLFUNC(IsObject)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
SbxVariable* pVar = rPar.Get(1);
SbxBase* pObj = (SbxBase*)pVar->GetObject();
// #100385: GetObject can result in an error, so reset it
SbxBase::ResetError();
SbUnoClass* pUnoClass;
sal_Bool bObject;
if( pObj && NULL != ( pUnoClass=PTR_CAST(SbUnoClass,pObj) ) )
{
bObject = pUnoClass->getUnoClass().is();
}
else
{
bObject = pVar->IsObject();
}
rPar.Get( 0 )->PutBool( bObject );
}
2000-09-18 15:18:56 +00:00
}
RTLFUNC(IsDate)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
// #46134 only string is converted, all other types result in sal_False
2000-09-18 15:18:56 +00:00
SbxVariableRef xArg = rPar.Get( 1 );
SbxDataType eType = xArg->GetType();
sal_Bool bDate = sal_False;
2000-09-18 15:18:56 +00:00
if( eType == SbxDATE )
{
bDate = sal_True;
2000-09-18 15:18:56 +00:00
}
else if( eType == SbxSTRING )
{
SbxError nPrevError = SbxBase::GetError();
SbxBase::ResetError();
// force conversion of the parameter to SbxDATE
2000-09-18 15:18:56 +00:00
xArg->SbxValue::GetDate();
bDate = !SbxBase::IsError();
SbxBase::ResetError();
SbxBase::SetError( nPrevError );
}
rPar.Get( 0 )->PutBool( bDate );
}
}
RTLFUNC(IsEmpty)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
SbxVariable* pVar = NULL;
if( SbiRuntime::isVBAEnabled() )
{
pVar = getDefaultProp( rPar.Get(1) );
}
if ( pVar )
{
pVar->Broadcast( SBX_HINT_DATAWANTED );
rPar.Get( 0 )->PutBool( pVar->IsEmpty() );
}
else
{
rPar.Get( 0 )->PutBool( rPar.Get(1)->IsEmpty() );
}
}
2000-09-18 15:18:56 +00:00
}
RTLFUNC(IsError)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
SbxVariable* pVar =rPar.Get( 1 );
SbUnoObject* pObj = PTR_CAST(SbUnoObject,pVar );
if ( !pObj )
{
if ( SbxBase* pBaseObj = pVar->GetObject() )
{
pObj = PTR_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() );
}
else
{
rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
}
}
2000-09-18 15:18:56 +00:00
}
RTLFUNC(IsNull)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
// #51475 because of Uno-objects return true
// even if the pObj value is NULL
2000-09-18 15:18:56 +00:00
SbxVariableRef pArg = rPar.Get( 1 );
sal_Bool bNull = rPar.Get(1)->IsNull();
2000-09-18 15:18:56 +00:00
if( !bNull && pArg->GetType() == SbxOBJECT )
{
SbxBase* pObj = pArg->GetObject();
if( !pObj )
{
bNull = sal_True;
}
2000-09-18 15:18:56 +00:00
}
rPar.Get( 0 )->PutBool( bNull );
}
}
RTLFUNC(IsNumeric)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
2000-09-18 15:18:56 +00:00
rPar.Get( 0 )->PutBool( rPar.Get( 1 )->IsNumericRTL() );
}
2000-09-18 15:18:56 +00:00
}
2000-09-18 15:18:56 +00:00
RTLFUNC(IsMissing)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() < 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
// #57915 Missing is reported by an error
2000-09-18 15:18:56 +00:00
rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
}
2000-09-18 15:18:56 +00:00
}
2000-12-08 15:35:54 +00:00
// Function looks for wildcards, removes them and always returns the pure path
OUString implSetupWildcard( const OUString& rFileParam, SbiRTLData* pRTLData )
2000-12-08 15:35:54 +00:00
{
2002-10-17 13:30:00 +00:00
static sal_Char cDelim1 = (sal_Char)'/';
static sal_Char cDelim2 = (sal_Char)'\\';
static sal_Char cWild1 = '*';
static sal_Char cWild2 = '?';
2001-06-15 12:28:55 +00:00
delete pRTLData->pWildCard;
pRTLData->pWildCard = NULL;
pRTLData->sFullNameToBeChecked = OUString();
OUString aFileParam = rFileParam;
sal_Int32 nLastWild = aFileParam.lastIndexOf( cWild1 );
if( nLastWild < 0 )
{
nLastWild = aFileParam.lastIndexOf( cWild2 );
}
bool bHasWildcards = ( nLastWild >= 0 );
2000-12-08 15:35:54 +00:00
2002-10-17 13:30:00 +00:00
sal_Int32 nLastDelim = aFileParam.lastIndexOf( cDelim1 );
if( nLastDelim < 0 )
{
nLastDelim = aFileParam.lastIndexOf( cDelim2 );
}
2002-10-17 13:30:00 +00:00
if( bHasWildcards )
{
// Wildcards in path?
if( nLastDelim >= 0 && nLastDelim > nLastWild )
{
2002-10-17 13:30:00 +00:00
return aFileParam;
}
2002-10-17 13:30:00 +00:00
}
else
{
OUString aPathStr = getFullPath( aFileParam );
if( nLastDelim != aFileParam.getLength() - 1 )
{
2002-10-17 13:30:00 +00:00
pRTLData->sFullNameToBeChecked = aPathStr;
}
2002-10-17 13:30:00 +00:00
return aPathStr;
}
OUString aPureFileName;
if( nLastDelim < 0 )
2001-03-08 12:54:27 +00:00
{
aPureFileName = aFileParam;
aFileParam = OUString();
2001-03-08 12:54:27 +00:00
}
else
{
aPureFileName = aFileParam.copy( nLastDelim + 1 );
aFileParam = aFileParam.copy( 0, nLastDelim );
2001-03-08 12:54:27 +00:00
}
2000-12-08 15:35:54 +00:00
2002-10-17 13:30:00 +00:00
// Try again to get a valid URL/UNC-path with only the path
OUString aPathStr = getFullPath( aFileParam );
2000-12-08 15:35:54 +00:00
2002-10-17 13:30:00 +00:00
// Is there a pure file name left? Otherwise the path is
// invalid anyway because it was not accepted by OSL before
if (string::equals(aPureFileName, '*'))
2002-10-17 13:30:00 +00:00
{
pRTLData->pWildCard = new WildCard( aPureFileName );
2001-03-08 12:54:27 +00:00
}
2000-12-08 15:35:54 +00:00
return aPathStr;
}
inline sal_Bool implCheckWildcard( const OUString& rName, SbiRTLData* pRTLData )
2000-12-08 15:35:54 +00:00
{
sal_Bool bMatch = sal_True;
if( pRTLData->pWildCard )
{
bMatch = pRTLData->pWildCard->Matches( rName );
}
2000-12-08 15:35:54 +00:00
return bMatch;
}
bool isRootDir( OUString aDirURLStr )
{
INetURLObject aDirURLObj( aDirURLStr );
bool bRoot = false;
// Check if it's a root directory
sal_Int32 nCount = aDirURLObj.getSegmentCount();
// 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( nCount == 1 )
{
OUString aSeg1 = aDirURLObj.getName( 0, sal_True,
INetURLObject::DECODE_WITH_CHARSET );
if( aSeg1[1] == (sal_Unicode)':' )
{
bRoot = true;
}
}
// More than one segments can never be root
// so bRoot remains false
return bRoot;
}
2000-09-18 15:18:56 +00:00
RTLFUNC(Dir)
{
(void)pBasic;
(void)bWrite;
OUString aPath;
2000-09-18 15:18:56 +00:00
sal_uInt16 nParCount = rPar.Count();
2000-09-18 15:18:56 +00:00
if( nParCount > 3 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
2012-01-15 16:15:08 +01:00
SbiRTLData* pRTLData = GetSbData()->pInst->GetRTLData();
2000-09-18 15:18:56 +00:00
// #34645: can also be called from the URL line via 'macro: Dir'
// there's no pRTLDate existing in that case and the method must be left
2000-09-18 15:18:56 +00:00
if( !pRTLData )
{
2000-09-18 15:18:56 +00:00
return;
}
2000-09-18 15:18:56 +00:00
if( hasUno() )
{
uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
2000-09-18 15:18:56 +00:00
if( xSFI.is() )
{
if ( nParCount >= 2 )
{
OUString aFileParam = rPar.Get(1)->GetOUString();
OUString aFileURLStr = implSetupWildcard( aFileParam, pRTLData );
if( !pRTLData->sFullNameToBeChecked.isEmpty())
2002-10-17 13:30:00 +00:00
{
sal_Bool bExists = sal_False;
try { bExists = xSFI->exists( aFileURLStr ); }
catch(const Exception & ) {}
2002-10-17 13:30:00 +00:00
OUString aNameOnlyStr;
2002-10-17 13:30:00 +00:00
if( bExists )
{
INetURLObject aFileURL( aFileURLStr );
aNameOnlyStr = aFileURL.getName( INetURLObject::LAST_SEGMENT,
true, INetURLObject::DECODE_WITH_CHARSET );
2002-10-17 13:30:00 +00:00
}
rPar.Get(0)->PutString( aNameOnlyStr );
return;
}
2000-09-18 15:18:56 +00:00
try
{
OUString aDirURLStr;
2001-03-29 14:15:18 +00:00
sal_Bool bFolder = xSFI->isFolder( aFileURLStr );
2000-09-18 15:18:56 +00:00
if( bFolder )
{
aDirURLStr = aFileURLStr;
}
else
{
OUString aEmptyStr;
2002-10-17 13:30:00 +00:00
rPar.Get(0)->PutString( aEmptyStr );
2000-09-18 15:18:56 +00:00
}
sal_uInt16 nFlags = 0;
2000-09-18 15:18:56 +00:00
if ( nParCount > 2 )
{
2000-09-18 15:18:56 +00:00
pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger();
}
2000-09-18 15:18:56 +00:00
else
{
2000-09-18 15:18:56 +00:00
pRTLData->nDirFlags = 0;
}
2000-09-18 15:18:56 +00:00
// Read directory
sal_Bool bIncludeFolders = ((nFlags & Sb_ATTR_DIRECTORY) != 0);
pRTLData->aDirSeq = xSFI->getFolderContents( aDirURLStr, bIncludeFolders );
pRTLData->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
// returned "." and for -1 ".."
if( !bRoot )
{
pRTLData->nCurDirPos = -2;
}
}
2000-09-18 15:18:56 +00:00
}
catch(const Exception & )
2000-09-18 15:18:56 +00:00
{
}
}
if( pRTLData->aDirSeq.getLength() > 0 )
{
bool bFolderFlag = ((pRTLData->nDirFlags & Sb_ATTR_DIRECTORY) != 0);
2012-01-15 16:15:08 +01:00
SbiInstance* pInst = GetSbData()->pInst;
bool bCompatibility = ( pInst && pInst->IsCompatibility() );
2000-09-18 15:18:56 +00:00
for( ;; )
{
if( pRTLData->nCurDirPos < 0 )
{
if( pRTLData->nCurDirPos == -2 )
{
aPath = OUString("." );
}
else if( pRTLData->nCurDirPos == -1 )
{
aPath = OUString(".." );
}
pRTLData->nCurDirPos++;
}
else if( pRTLData->nCurDirPos >= pRTLData->aDirSeq.getLength() )
2000-09-18 15:18:56 +00:00
{
pRTLData->aDirSeq.realloc( 0 );
aPath = "";
2000-09-18 15:18:56 +00:00
break;
}
else
{
OUString aFile = pRTLData->aDirSeq.getConstArray()[pRTLData->nCurDirPos++];
2000-09-18 15:18:56 +00:00
if( bCompatibility )
{
if( !bFolderFlag )
{
sal_Bool bFolder = xSFI->isFolder( aFile );
if( bFolder )
{
continue;
}
}
}
else
2000-09-18 15:18:56 +00:00
{
// Only directories
if( bFolderFlag )
{
sal_Bool bFolder = xSFI->isFolder( aFile );
if( !bFolder )
{
continue;
}
}
2000-09-18 15:18:56 +00:00
}
INetURLObject aURL( aFile );
aPath = aURL.getName( INetURLObject::LAST_SEGMENT, sal_True,
INetURLObject::DECODE_WITH_CHARSET );
}
sal_Bool bMatch = implCheckWildcard( aPath, pRTLData );
if( !bMatch )
{
continue;
}
break;
2000-09-18 15:18:56 +00:00
}
}
rPar.Get(0)->PutString( aPath );
}
}
else
{
2000-09-26 08:02:02 +00:00
// TODO: OSL
if ( nParCount >= 2 )
{
OUString aFileParam = rPar.Get(1)->GetOUString();
2000-09-26 08:02:02 +00:00
OUString aDirURL = implSetupWildcard( aFileParam, pRTLData );
2000-09-26 08:02:02 +00:00
sal_uInt16 nFlags = 0;
2000-09-26 08:02:02 +00:00
if ( nParCount > 2 )
{
2000-09-26 08:02:02 +00:00
pRTLData->nDirFlags = nFlags = rPar.Get(2)->GetInteger();
}
2000-09-26 08:02:02 +00:00
else
{
2000-09-26 08:02:02 +00:00
pRTLData->nDirFlags = 0;
}
2000-09-26 08:02:02 +00:00
// Read directory
bool bIncludeFolders = ((nFlags & Sb_ATTR_DIRECTORY) != 0);
pRTLData->pDir = new Directory( aDirURL );
2000-12-08 15:35:54 +00:00
FileBase::RC nRet = pRTLData->pDir->open();
if( nRet != FileBase::E_None )
2000-09-26 08:02:02 +00:00
{
delete pRTLData->pDir;
pRTLData->pDir = NULL;
rPar.Get(0)->PutString( OUString() );
2000-09-26 08:02:02 +00:00
return;
}
// #86950 Add "." and ".." directories for VB compatibility
pRTLData->nCurDirPos = 0;
if( bIncludeFolders )
{
bool bRoot = isRootDir( aDirURL );
// 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
// returned "." and for -1 ".."
if( !bRoot )
{
pRTLData->nCurDirPos = -2;
}
}
2000-09-26 08:02:02 +00:00
}
if( pRTLData->pDir )
{
bool bFolderFlag = ((pRTLData->nDirFlags & Sb_ATTR_DIRECTORY) != 0);
2000-09-26 08:02:02 +00:00
for( ;; )
{
if( pRTLData->nCurDirPos < 0 )
2000-09-26 08:02:02 +00:00
{
if( pRTLData->nCurDirPos == -2 )
{
aPath = OUString("." );
}
else if( pRTLData->nCurDirPos == -1 )
{
aPath = OUString(".." );
}
pRTLData->nCurDirPos++;
2000-09-26 08:02:02 +00:00
}
else
{
DirectoryItem aItem;
FileBase::RC nRet = pRTLData->pDir->getNextItem( aItem );
if( nRet != FileBase::E_None )
{
delete pRTLData->pDir;
pRTLData->pDir = NULL;
aPath = "";
break;
}
2000-09-26 08:02:02 +00:00
// Handle flags
FileStatus aFileStatus( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileName );
nRet = aItem.getFileStatus( aFileStatus );
2000-09-26 08:02:02 +00:00
// Only directories?
if( bFolderFlag )
{
FileStatus::Type aType = aFileStatus.getFileType();
bool bFolder = isFolder( aType );
if( !bFolder )
{
continue;
}
}
2000-09-26 08:02:02 +00:00
aPath = aFileStatus.getFileName();
}
2000-12-08 15:35:54 +00:00
sal_Bool bMatch = implCheckWildcard( aPath, pRTLData );
if( !bMatch )
{
2000-12-08 15:35:54 +00:00
continue;
}
2000-09-26 08:02:02 +00:00
break;
}
}
rPar.Get(0)->PutString( aPath );
2000-09-18 15:18:56 +00:00
}
}
}
RTLFUNC(GetAttr)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() == 2 )
{
sal_Int16 nFlags = 0;
2000-09-18 15:18:56 +00:00
// In Windows, we want to use Windows API to get the file attributes
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
// for VBA interoperability.
#if defined( WNT )
if( SbiRuntime::isVBAEnabled() )
{
OUString aPathURL = getFullPath( rPar.Get(1)->GetOUString() );
OUString aPath;
FileBase::getSystemPathFromFileURL( aPathURL, aPath );
OString aSystemPath(OUStringToOString(aPath, osl_getThreadTextEncoding()));
DWORD nRealFlags = GetFileAttributes (aSystemPath.getStr());
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
if (nRealFlags != 0xffffffff)
{
if (nRealFlags == FILE_ATTRIBUTE_NORMAL)
{
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
nRealFlags = 0;
}
nFlags = (sal_Int16) (nRealFlags);
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
}
else
{
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
rPar.Get(0)->PutInteger( nFlags );
return;
}
#endif
2000-09-18 15:18:56 +00:00
if( hasUno() )
{
uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
2000-09-18 15:18:56 +00:00
if( xSFI.is() )
{
try
{
OUString aPath = getFullPath( rPar.Get(1)->GetOUString() );
2000-09-18 15:18:56 +00:00
sal_Bool bExists = sal_False;
try { bExists = xSFI->exists( aPath ); }
catch(const Exception & ) {}
2000-09-18 15:18:56 +00:00
if( !bExists )
{
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
return;
}
sal_Bool bReadOnly = xSFI->isReadOnly( aPath );
sal_Bool bHidden = xSFI->isHidden( aPath );
2000-09-18 15:18:56 +00:00
sal_Bool bDirectory = xSFI->isFolder( aPath );
if( bReadOnly )
{
nFlags |= Sb_ATTR_READONLY;
}
if( bHidden )
{
nFlags |= Sb_ATTR_HIDDEN;
}
2000-09-18 15:18:56 +00:00
if( bDirectory )
{
nFlags |= Sb_ATTR_DIRECTORY;
}
2000-09-18 15:18:56 +00:00
}
catch(const Exception & )
2000-09-18 15:18:56 +00:00
{
StarBASIC::Error( ERRCODE_IO_GENERAL );
}
}
}
else
{
2000-09-26 08:02:02 +00:00
DirectoryItem aItem;
DirectoryItem::get( getFullPath( rPar.Get(1)->GetOUString() ), aItem );
FileStatus aFileStatus( osl_FileStatus_Mask_Attributes | osl_FileStatus_Mask_Type );
2011-01-23 18:29:24 +00:00
aItem.getFileStatus( aFileStatus );
2000-09-26 08:02:02 +00:00
sal_uInt64 nAttributes = aFileStatus.getAttributes();
bool bReadOnly = (nAttributes & osl_File_Attribute_ReadOnly) != 0;
2000-09-26 08:02:02 +00:00
FileStatus::Type aType = aFileStatus.getFileType();
bool bDirectory = isFolder( aType );
2000-09-26 08:02:02 +00:00
if( bReadOnly )
{
nFlags |= Sb_ATTR_READONLY;
}
2000-09-26 08:02:02 +00:00
if( bDirectory )
{
nFlags |= Sb_ATTR_DIRECTORY;
}
2000-09-18 15:18:56 +00:00
}
rPar.Get(0)->PutInteger( nFlags );
}
else
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
}
RTLFUNC(FileDateTime)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() != 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
OUString aPath = rPar.Get(1)->GetOUString();
Time aTime( Time::EMPTY );
Date aDate( Date::EMPTY );
2000-09-18 15:18:56 +00:00
if( hasUno() )
{
uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
2000-09-18 15:18:56 +00:00
if( xSFI.is() )
{
try
{
util::DateTime aUnoDT = xSFI->getDateTimeModified( aPath );
aTime = Time( aUnoDT.Hours, aUnoDT.Minutes, aUnoDT.Seconds, aUnoDT.NanoSeconds );
2000-09-18 15:18:56 +00:00
aDate = Date( aUnoDT.Day, aUnoDT.Month, aUnoDT.Year );
}
catch(const Exception & )
2000-09-18 15:18:56 +00:00
{
StarBASIC::Error( ERRCODE_IO_GENERAL );
}
}
}
else
{
2000-09-26 08:02:02 +00:00
DirectoryItem aItem;
DirectoryItem::get( getFullPath( aPath ), aItem );
FileStatus aFileStatus( osl_FileStatus_Mask_ModifyTime );
2011-01-23 18:29:24 +00:00
aItem.getFileStatus( aFileStatus );
2000-09-26 08:02:02 +00:00
TimeValue aTimeVal = aFileStatus.getModifyTime();
oslDateTime aDT;
osl_getDateTimeFromTimeValue( &aTimeVal, &aDT );
2000-09-26 08:02:02 +00:00
aTime = Time( aDT.Hours, aDT.Minutes, aDT.Seconds, 10000000*aDT.NanoSeconds );
aDate = Date( aDT.Day, aDT.Month, aDT.Year );
2000-09-18 15:18:56 +00:00
}
double fSerial = (double)GetDayDiff( aDate );
long nSeconds = aTime.GetHour();
nSeconds *= 3600;
nSeconds += aTime.GetMin() * 60;
nSeconds += aTime.GetSec();
double nDays = ((double)nSeconds) / (double)(24.0*3600.0);
fSerial += nDays;
Color* pCol;
SvNumberFormatter* pFormatter = NULL;
sal_uInt32 nIndex;
2012-01-15 16:15:08 +01:00
if( GetSbData()->pInst )
2000-09-18 15:18:56 +00:00
{
2012-01-15 16:15:08 +01:00
pFormatter = GetSbData()->pInst->GetNumberFormatter();
nIndex = GetSbData()->pInst->GetStdDateTimeIdx();
2000-09-18 15:18:56 +00:00
}
else
{
sal_uInt32 n;
2000-09-18 15:18:56 +00:00
SbiInstance::PrepareNumberFormatter( pFormatter, n, n, nIndex );
}
OUString aRes;
2000-09-18 15:18:56 +00:00
pFormatter->GetOutputString( fSerial, nIndex, aRes, &pCol );
rPar.Get(0)->PutString( aRes );
2012-01-15 16:15:08 +01:00
if( !GetSbData()->pInst )
{
2000-09-18 15:18:56 +00:00
delete pFormatter;
}
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(EOF)
{
(void)pBasic;
(void)bWrite;
2011-03-22 12:23:36 +01:00
// No changes for UCB
2000-09-18 15:18:56 +00:00
if ( rPar.Count() != 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
sal_Int16 nChannel = rPar.Get(1)->GetInteger();
2012-01-15 16:15:08 +01:00
SbiIoSystem* pIO = GetSbData()->pInst->GetIoSystem();
2000-09-18 15:18:56 +00:00
SbiStream* pSbStrm = pIO->GetStream( nChannel );
if ( !pSbStrm )
{
StarBASIC::Error( SbERR_BAD_CHANNEL );
return;
}
sal_Bool bIsEof;
2000-09-18 15:18:56 +00:00
SvStream* pSvStrm = pSbStrm->GetStrm();
if ( pSbStrm->IsText() )
{
char cBla;
(*pSvStrm) >> cBla; // can we read another character?
2000-09-18 15:18:56 +00:00
bIsEof = pSvStrm->IsEof();
if ( !bIsEof )
{
2000-09-18 15:18:56 +00:00
pSvStrm->SeekRel( -1 );
}
2000-09-18 15:18:56 +00:00
}
else
{
bIsEof = pSvStrm->IsEof(); // for binary data!
}
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutBool( bIsEof );
}
}
RTLFUNC(FileAttr)
{
(void)pBasic;
(void)bWrite;
// 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.
2000-09-18 15:18:56 +00:00
if ( rPar.Count() != 3 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
sal_Int16 nChannel = rPar.Get(1)->GetInteger();
2012-01-15 16:15:08 +01:00
SbiIoSystem* pIO = GetSbData()->pInst->GetIoSystem();
2000-09-18 15:18:56 +00:00
SbiStream* pSbStrm = pIO->GetStream( nChannel );
if ( !pSbStrm )
{
StarBASIC::Error( SbERR_BAD_CHANNEL );
return;
}
sal_Int16 nRet;
2000-09-18 15:18:56 +00:00
if ( rPar.Get(2)->GetInteger() == 1 )
{
nRet = (sal_Int16)(pSbStrm->GetMode());
}
2000-09-18 15:18:56 +00:00
else
{
2000-09-18 15:18:56 +00:00
nRet = 0; // System file handle not supported
}
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutInteger( nRet );
}
}
RTLFUNC(Loc)
{
(void)pBasic;
(void)bWrite;
// No changes for UCB
2000-09-18 15:18:56 +00:00
if ( rPar.Count() != 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
sal_Int16 nChannel = rPar.Get(1)->GetInteger();
2012-01-15 16:15:08 +01:00
SbiIoSystem* pIO = GetSbData()->pInst->GetIoSystem();
2000-09-18 15:18:56 +00:00
SbiStream* pSbStrm = pIO->GetStream( nChannel );
if ( !pSbStrm )
{
StarBASIC::Error( SbERR_BAD_CHANNEL );
return;
}
SvStream* pSvStrm = pSbStrm->GetStrm();
sal_uIntPtr nPos;
2000-09-18 15:18:56 +00:00
if( pSbStrm->IsRandom())
{
short nBlockLen = pSbStrm->GetBlockLen();
nPos = nBlockLen ? (pSvStrm->Tell() / nBlockLen) : 0;
nPos++; // block positions starting at 1
2000-09-18 15:18:56 +00:00
}
else if ( pSbStrm->IsText() )
{
2000-09-18 15:18:56 +00:00
nPos = pSbStrm->GetLine();
}
2000-09-18 15:18:56 +00:00
else if( pSbStrm->IsBinary() )
{
2000-09-18 15:18:56 +00:00
nPos = pSvStrm->Tell();
}
2000-09-18 15:18:56 +00:00
else if ( pSbStrm->IsSeq() )
{
2000-09-18 15:18:56 +00:00
nPos = ( pSvStrm->Tell()+1 ) / 128;
}
2000-09-18 15:18:56 +00:00
else
{
2000-09-18 15:18:56 +00:00
nPos = pSvStrm->Tell();
}
rPar.Get(0)->PutLong( (sal_Int32)nPos );
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(Lof)
{
(void)pBasic;
(void)bWrite;
2011-03-22 12:23:36 +01:00
// No changes for UCB
2000-09-18 15:18:56 +00:00
if ( rPar.Count() != 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
sal_Int16 nChannel = rPar.Get(1)->GetInteger();
2012-01-15 16:15:08 +01:00
SbiIoSystem* pIO = GetSbData()->pInst->GetIoSystem();
2000-09-18 15:18:56 +00:00
SbiStream* pSbStrm = pIO->GetStream( nChannel );
if ( !pSbStrm )
{
StarBASIC::Error( SbERR_BAD_CHANNEL );
return;
}
SvStream* pSvStrm = pSbStrm->GetStrm();
sal_uIntPtr nOldPos = pSvStrm->Tell();
sal_uIntPtr nLen = pSvStrm->Seek( STREAM_SEEK_TO_END );
2000-09-18 15:18:56 +00:00
pSvStrm->Seek( nOldPos );
rPar.Get(0)->PutLong( (sal_Int32)nLen );
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(Seek)
{
(void)pBasic;
(void)bWrite;
// No changes for UCB
2000-09-18 15:18:56 +00:00
int nArgs = (int)rPar.Count();
if ( nArgs < 2 || nArgs > 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
sal_Int16 nChannel = rPar.Get(1)->GetInteger();
2012-01-15 16:15:08 +01:00
SbiIoSystem* pIO = GetSbData()->pInst->GetIoSystem();
2000-09-18 15:18:56 +00:00
SbiStream* pSbStrm = pIO->GetStream( nChannel );
if ( !pSbStrm )
{
StarBASIC::Error( SbERR_BAD_CHANNEL );
return;
}
SvStream* pStrm = pSbStrm->GetStrm();
if ( nArgs == 2 ) // Seek-Function
{
sal_uIntPtr nPos = pStrm->Tell();
2000-09-18 15:18:56 +00:00
if( pSbStrm->IsRandom() )
{
2000-09-18 15:18:56 +00:00
nPos = nPos / pSbStrm->GetBlockLen();
}
nPos++; // Basic counts from 1
rPar.Get(0)->PutLong( (sal_Int32)nPos );
2000-09-18 15:18:56 +00:00
}
else // Seek-Statement
{
sal_Int32 nPos = rPar.Get(2)->GetLong();
2000-09-18 15:18:56 +00:00
if ( nPos < 1 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
nPos--; // Basic counts from 1, SvStreams count from 0
2000-09-18 15:18:56 +00:00
pSbStrm->SetExpandOnWriteTo( 0 );
if ( pSbStrm->IsRandom() )
{
2000-09-18 15:18:56 +00:00
nPos *= pSbStrm->GetBlockLen();
}
pStrm->Seek( (sal_uIntPtr)nPos );
2000-09-18 15:18:56 +00:00
pSbStrm->SetExpandOnWriteTo( nPos );
}
}
RTLFUNC(Format)
{
(void)pBasic;
(void)bWrite;
sal_uInt16 nArgCount = (sal_uInt16)rPar.Count();
2000-09-18 15:18:56 +00:00
if ( nArgCount < 2 || nArgCount > 3 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
OUString aResult;
2000-09-18 15:18:56 +00:00
if( nArgCount == 2 )
{
2000-09-18 15:18:56 +00:00
rPar.Get(1)->Format( aResult );
}
2000-09-18 15:18:56 +00:00
else
{
OUString aFmt( rPar.Get(2)->GetOUString() );
2000-09-18 15:18:56 +00:00
rPar.Get(1)->Format( aResult, &aFmt );
}
rPar.Get(0)->PutString( aResult );
}
}
RTLFUNC(Randomize)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() > 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
sal_Int16 nSeed;
2000-09-18 15:18:56 +00:00
if( rPar.Count() == 2 )
{
nSeed = (sal_Int16)rPar.Get(1)->GetInteger();
}
2000-09-18 15:18:56 +00:00
else
{
nSeed = (sal_Int16)rand();
}
2000-09-18 15:18:56 +00:00
srand( nSeed );
}
RTLFUNC(Rnd)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() > 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
double nRand = (double)rand();
2011-02-14 13:02:09 -04:00
nRand = ( nRand / ((double)RAND_MAX + 1.0));
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutDouble( nRand );
}
}
// Syntax: Shell("Path",[ Window-Style,[ "Params", [ bSync = sal_False ]]])
2000-09-18 15:18:56 +00:00
// WindowStyles (VBA-kompatibel):
// 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"
2000-09-18 15:18:56 +00:00
RTLFUNC(Shell)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
// No shell command for "virtual" portal users
if( needSecurityRestrictions() )
{
StarBASIC::Error(SbERR_NOT_IMPLEMENTED);
return;
}
sal_uIntPtr nArgCount = rPar.Count();
if ( nArgCount < 2 || nArgCount > 5 )
2000-09-18 15:18:56 +00:00
{
rPar.Get(0)->PutLong(0);
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
else
{
oslProcessOption nOptions = osl_Process_SEARCHPATH | osl_Process_DETACHED;
OUString aCmdLine = rPar.Get(1)->GetOUString();
// attach additional parameters - everything must be parsed anyway
if( nArgCount >= 4 )
2000-09-18 15:18:56 +00:00
{
aCmdLine += " ";
aCmdLine += rPar.Get(3)->GetOUString();
2000-09-18 15:18:56 +00:00
}
else if( aCmdLine.isEmpty() )
2000-09-18 15:18:56 +00:00
{
// avaoid special treatment (empty list)
aCmdLine += " ";
2000-09-18 15:18:56 +00:00
}
sal_Int32 nLen = aCmdLine.getLength();
2000-09-18 15:18:56 +00:00
// #55735 if there are parameters, they have to be separated
// #72471 also seperate the single parameters
2000-09-18 15:18:56 +00:00
std::list<String> aTokenList;
OUString aToken;
sal_Int32 i = 0;
sal_Unicode c;
2000-09-18 15:18:56 +00:00
while( i < nLen )
{
for ( ;; ++i )
{
c = aCmdLine[ i ];
if ( c != ' ' && c != '\t' )
{
break;
}
}
2000-09-18 15:18:56 +00:00
if( c == '\"' || c == '\'' )
{
sal_Int32 iFoundPos = aCmdLine.indexOf( c, i + 1 );
2000-09-18 15:18:56 +00:00
if( iFoundPos < 0 )
2000-09-18 15:18:56 +00:00
{
aToken = aCmdLine.copy( i);
2000-09-18 15:18:56 +00:00
i = nLen;
}
else
{
aToken = aCmdLine.copy( i + 1, (iFoundPos - i - 1) );
2000-09-18 15:18:56 +00:00
i = iFoundPos + 1;
}
}
else
{
sal_Int32 iFoundSpacePos = aCmdLine.indexOf( ' ', i );
sal_Int32 iFoundTabPos = aCmdLine.indexOf( '\t', i );
sal_Int32 iFoundPos = iFoundSpacePos >= 0 ? iFoundTabPos >= 0 ? std::min( iFoundSpacePos, iFoundTabPos ) : iFoundSpacePos : -1;
2000-09-18 15:18:56 +00:00
if( iFoundPos < 0 )
2000-09-18 15:18:56 +00:00
{
aToken = aCmdLine.copy( i );
2000-09-18 15:18:56 +00:00
i = nLen;
}
else
{
aToken = aCmdLine.copy( i, (iFoundPos - i) );
2000-09-18 15:18:56 +00:00
i = iFoundPos;
}
}
// insert into the list
2000-09-18 15:18:56 +00:00
aTokenList.push_back( aToken );
}
// #55735 / #72471 end
2000-09-18 15:18:56 +00:00
sal_Int16 nWinStyle = 0;
if( nArgCount >= 3 )
2000-09-18 15:18:56 +00:00
{
nWinStyle = rPar.Get(2)->GetInteger();
switch( nWinStyle )
{
case 2:
nOptions |= osl_Process_MINIMIZED;
break;
case 3:
nOptions |= osl_Process_MAXIMIZED;
break;
case 10:
nOptions |= osl_Process_FULLSCREEN;
break;
2000-09-18 15:18:56 +00:00
}
sal_Bool bSync = sal_False;
if( nArgCount >= 5 )
{
bSync = rPar.Get(4)->GetBool();
}
if( bSync )
{
nOptions |= osl_Process_WAIT;
}
2000-09-18 15:18:56 +00:00
}
// #72471 work parameter(s) up
2000-09-18 15:18:56 +00:00
std::list<String>::const_iterator iter = aTokenList.begin();
const OUString& rStr = *iter;
OUString aOUStrProg( rStr.getStr(), rStr.getLength() );
OUString aOUStrProgURL = getFullPath( aOUStrProg );
2011-01-01 21:03:34 +00:00
++iter;
2000-09-18 15:18:56 +00:00
sal_uInt16 nParamCount = sal::static_int_cast< sal_uInt16 >(aTokenList.size() - 1 );
rtl_uString** pParamList = NULL;
2000-09-18 15:18:56 +00:00
if( nParamCount )
{
pParamList = new rtl_uString*[nParamCount];
for(int iList = 0; iter != aTokenList.end(); ++iList, ++iter)
2000-09-18 15:18:56 +00:00
{
const OUString& rParamStr = (*iter);
const OUString aTempStr( rParamStr.getStr(), rParamStr.getLength());
pParamList[iList] = NULL;
rtl_uString_assign(&(pParamList[iList]), aTempStr.pData);
2000-09-18 15:18:56 +00:00
}
}
oslProcess pApp;
Merge commit 'ooo/DEV300_m101' into integration/dev300_m101 Conflicts: avmedia/inc/avmedia/mediaitem.hxx avmedia/prj/build.lst avmedia/source/framework/mediaitem.cxx avmedia/source/gstreamer/gstcommon.hxx avmedia/source/gstreamer/gstframegrabber.cxx avmedia/source/gstreamer/gstframegrabber.hxx avmedia/source/gstreamer/gstmanager.cxx avmedia/source/gstreamer/gstmanager.hxx avmedia/source/gstreamer/gstplayer.cxx avmedia/source/gstreamer/gstplayer.hxx avmedia/source/gstreamer/gstuno.cxx avmedia/source/gstreamer/gstwindow.cxx avmedia/source/gstreamer/gstwindow.hxx avmedia/source/gstreamer/makefile.mk avmedia/source/quicktime/quicktimeuno.cxx avmedia/source/viewer/mediawindow.cxx avmedia/source/viewer/mediawindow_impl.cxx avmedia/source/viewer/mediawindow_impl.hxx avmedia/source/viewer/mediawindowbase_impl.cxx avmedia/source/win/winuno.cxx basic/inc/basic/basmgr.hxx basic/inc/basic/mybasic.hxx basic/inc/basic/process.hxx basic/inc/basic/sbmeth.hxx basic/inc/basic/sbmod.hxx basic/inc/basic/sbxdef.hxx basic/inc/basic/sbxvar.hxx basic/source/app/app.cxx basic/source/app/app.hxx basic/source/app/appbased.cxx basic/source/app/appedit.cxx basic/source/app/appwin.cxx basic/source/app/appwin.hxx basic/source/app/brkpnts.cxx basic/source/app/brkpnts.hxx basic/source/app/dialogs.cxx basic/source/app/dialogs.hxx basic/source/app/msgedit.cxx basic/source/app/mybasic.cxx basic/source/app/process.cxx basic/source/app/processw.hxx basic/source/app/textedit.cxx basic/source/basmgr/basicmanagerrepository.cxx basic/source/basmgr/basmgr.cxx basic/source/classes/disas.cxx basic/source/classes/eventatt.cxx basic/source/classes/image.cxx basic/source/classes/sb.cxx basic/source/classes/sbunoobj.cxx basic/source/classes/sbxmod.cxx basic/source/comp/codegen.cxx basic/source/comp/dim.cxx basic/source/comp/exprgen.cxx basic/source/comp/exprnode.cxx basic/source/comp/exprtree.cxx basic/source/comp/sbcomp.cxx basic/source/inc/expr.hxx basic/source/inc/object.hxx basic/source/inc/sbunoobj.hxx basic/source/runtime/dllmgr-x86.cxx basic/source/runtime/iosys.cxx basic/source/runtime/makefile.mk basic/source/runtime/methods.cxx basic/source/runtime/methods1.cxx basic/source/runtime/runtime.cxx basic/source/runtime/stdobj.cxx basic/source/runtime/step0.cxx basic/source/runtime/step1.cxx basic/source/runtime/step2.cxx basic/source/sbx/sbxarray.cxx basic/source/sbx/sbxbase.cxx basic/source/sbx/sbxbool.cxx basic/source/sbx/sbxbyte.cxx basic/source/sbx/sbxcoll.cxx basic/source/sbx/sbxconv.hxx basic/source/sbx/sbxcurr.cxx basic/source/sbx/sbxexec.cxx basic/source/sbx/sbxint.cxx basic/source/sbx/sbxobj.cxx basic/source/sbx/sbxscan.cxx basic/source/sbx/sbxstr.cxx basic/source/sbx/sbxvals.cxx basic/source/sbx/sbxvalue.cxx basic/source/sbx/sbxvar.cxx basic/workben/mgrtest.cxx configmgr/prj/build.lst configmgr/source/access.cxx configmgr/source/configurationprovider.cxx configmgr/source/defaultprovider.cxx configmgr/source/pad.cxx configmgr/source/services.cxx configmgr/source/update.cxx configmgr/source/xmlreader.cxx configmgr/source/xmlreader.hxx connectivity/prj/build.lst connectivity/qa/complex/connectivity/TestCase.java connectivity/source/cpool/Zregistration.cxx connectivity/source/drivers/adabas/Bservices.cxx connectivity/source/drivers/ado/Aservices.cxx connectivity/source/drivers/calc/Cservices.cxx connectivity/source/drivers/calc/makefile.mk connectivity/source/drivers/dbase/DIndex.cxx connectivity/source/drivers/dbase/DIndexIter.cxx connectivity/source/drivers/dbase/DNoException.cxx connectivity/source/drivers/dbase/DTable.cxx connectivity/source/drivers/dbase/Dservices.cxx connectivity/source/drivers/dbase/dindexnode.cxx connectivity/source/drivers/evoab/LNoException.cxx connectivity/source/drivers/evoab/LServices.cxx connectivity/source/drivers/evoab2/NServices.cxx connectivity/source/drivers/file/FNoException.cxx connectivity/source/drivers/file/FPreparedStatement.cxx connectivity/source/drivers/file/FResultSet.cxx connectivity/source/drivers/file/FStatement.cxx connectivity/source/drivers/file/quotedstring.cxx connectivity/source/drivers/flat/ETable.cxx connectivity/source/drivers/flat/Eservices.cxx connectivity/source/drivers/hsqldb/Hservices.cxx connectivity/source/drivers/jdbc/jservices.cxx connectivity/source/drivers/kab/KServices.cxx connectivity/source/drivers/macab/MacabServices.cxx connectivity/source/drivers/mozab/MResultSet.cxx connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx connectivity/source/drivers/mysql/Yservices.cxx connectivity/source/drivers/odbc/OFunctions.cxx connectivity/source/drivers/odbc/oservices.cxx connectivity/source/inc/dbase/DIndexPage.hxx connectivity/source/inc/file/FTable.hxx connectivity/source/manager/mregistration.cxx connectivity/source/parse/PColumn.cxx desktop/prj/build.lst desktop/qa/deployment_misc/test_dp_version.cxx desktop/source/app/app.cxx desktop/source/app/appfirststart.cxx desktop/source/app/cmdlineargs.cxx desktop/source/app/cmdlineargs.hxx desktop/source/app/sofficemain.cxx desktop/source/deployment/gui/dp_gui.hrc desktop/source/deployment/gui/dp_gui_dialog2.cxx desktop/source/deployment/gui/dp_gui_dialog2.hxx desktop/source/deployment/gui/dp_gui_updatedialog.cxx desktop/source/deployment/gui/dp_gui_updatedialog.hxx desktop/source/deployment/manager/dp_extensionmanager.cxx desktop/source/deployment/manager/dp_extensionmanager.hxx desktop/source/deployment/misc/dp_misc.src desktop/source/deployment/registry/component/dp_component.cxx desktop/source/deployment/registry/configuration/dp_configuration.cxx desktop/source/deployment/registry/dp_backend.cxx desktop/source/deployment/registry/help/dp_help.cxx desktop/source/deployment/registry/script/dp_script.cxx desktop/source/migration/pages.cxx desktop/source/migration/pages.hxx desktop/source/migration/wizard.cxx desktop/source/migration/wizard.hrc desktop/source/migration/wizard.hxx desktop/source/migration/wizard.src desktop/source/pkgchk/unopkg/unopkg_shared.h desktop/source/so_comp/services.cxx desktop/source/splash/makefile.mk desktop/source/splash/services_spl.cxx desktop/source/splash/splash.cxx drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx editeng/inc/editeng/adjitem.hxx editeng/inc/editeng/bolnitem.hxx editeng/inc/editeng/borderline.hxx editeng/inc/editeng/boxitem.hxx editeng/inc/editeng/brkitem.hxx editeng/inc/editeng/brshitem.hxx editeng/inc/editeng/bulitem.hxx editeng/inc/editeng/charreliefitem.hxx editeng/inc/editeng/charrotateitem.hxx editeng/inc/editeng/charscaleitem.hxx editeng/inc/editeng/cmapitem.hxx editeng/inc/editeng/colritem.hxx editeng/inc/editeng/crsditem.hxx editeng/inc/editeng/editdata.hxx editeng/inc/editeng/editeng.hxx editeng/inc/editeng/editobj.hxx editeng/inc/editeng/editstat.hxx editeng/inc/editeng/editview.hxx editeng/inc/editeng/emphitem.hxx editeng/inc/editeng/escpitem.hxx editeng/inc/editeng/fhgtitem.hxx editeng/inc/editeng/flstitem.hxx editeng/inc/editeng/fontitem.hxx editeng/inc/editeng/frmdiritem.hxx editeng/inc/editeng/fwdtitem.hxx editeng/inc/editeng/hyznitem.hxx editeng/inc/editeng/kernitem.hxx editeng/inc/editeng/langitem.hxx editeng/inc/editeng/lrspitem.hxx editeng/inc/editeng/lspcitem.hxx editeng/inc/editeng/numitem.hxx editeng/inc/editeng/outliner.hxx editeng/inc/editeng/paravertalignitem.hxx editeng/inc/editeng/pmdlitem.hxx editeng/inc/editeng/postitem.hxx editeng/inc/editeng/protitem.hxx editeng/inc/editeng/shaditem.hxx editeng/inc/editeng/sizeitem.hxx editeng/inc/editeng/svxacorr.hxx editeng/inc/editeng/svxfont.hxx editeng/inc/editeng/svxrtf.hxx editeng/inc/editeng/swafopt.hxx editeng/inc/editeng/tstpitem.hxx editeng/inc/editeng/twolinesitem.hxx editeng/inc/editeng/txtrange.hxx editeng/inc/editeng/udlnitem.hxx editeng/inc/editeng/ulspitem.hxx editeng/inc/editeng/wghtitem.hxx editeng/inc/editeng/writingmodeitem.hxx editeng/inc/editeng/xmlcnitm.hxx editeng/inc/helpid.hrc editeng/inc/pch/precompiled_editeng.hxx editeng/source/editeng/editdbg.cxx editeng/source/editeng/editdoc.cxx editeng/source/editeng/editdoc.hxx editeng/source/editeng/editdoc2.cxx editeng/source/editeng/editeng.cxx editeng/source/editeng/editobj.cxx editeng/source/editeng/editobj2.hxx editeng/source/editeng/editsel.cxx editeng/source/editeng/editundo.cxx editeng/source/editeng/editundo.hxx editeng/source/editeng/editview.cxx editeng/source/editeng/edtspell.hxx editeng/source/editeng/eehtml.cxx editeng/source/editeng/eehtml.hxx editeng/source/editeng/eeobj.cxx editeng/source/editeng/eerdll.cxx editeng/source/editeng/eertfpar.cxx editeng/source/editeng/impedit.cxx editeng/source/editeng/impedit.hxx editeng/source/editeng/impedit2.cxx editeng/source/editeng/impedit3.cxx editeng/source/editeng/impedit4.cxx editeng/source/editeng/impedit5.cxx editeng/source/editeng/makefile.mk editeng/source/items/bulitem.cxx editeng/source/items/charhiddenitem.cxx editeng/source/items/flditem.cxx editeng/source/items/frmitems.cxx editeng/source/items/makefile.mk editeng/source/items/numitem.cxx editeng/source/items/paraitem.cxx editeng/source/items/svxfont.cxx editeng/source/items/textitem.cxx editeng/source/items/writingmodeitem.cxx editeng/source/items/xmlcnitm.cxx editeng/source/misc/SvXMLAutoCorrectImport.cxx editeng/source/misc/svxacorr.cxx editeng/source/misc/txtrange.cxx editeng/source/misc/unolingu.cxx editeng/source/outliner/outleeng.cxx editeng/source/outliner/outliner.cxx editeng/source/outliner/outlundo.hxx editeng/source/outliner/outlvw.cxx editeng/source/outliner/paralist.cxx editeng/source/outliner/paralist.hxx editeng/source/rtf/rtfgrf.cxx editeng/source/rtf/rtfitem.cxx editeng/source/rtf/svxrtf.cxx editeng/source/uno/unoipset.cxx editeng/util/makefile.mk embeddedobj/prj/build.lst embeddedobj/source/commonembedding/miscobj.cxx eventattacher/prj/build.lst fileaccess/source/FileAccess.cxx formula/inc/formula/FormulaCompiler.hxx formula/inc/formula/token.hxx formula/inc/formula/tokenarray.hxx formula/source/core/api/FormulaCompiler.cxx formula/source/core/api/token.cxx formula/source/ui/dlg/FormulaHelper.cxx formula/source/ui/dlg/formula.cxx formula/source/ui/dlg/parawin.cxx formula/source/ui/dlg/structpg.cxx fpicker/prj/d.lst fpicker/source/aqua/FPentry.cxx fpicker/source/office/OfficeControlAccess.cxx fpicker/source/office/iodlg.cxx fpicker/source/office/iodlg.hxx fpicker/source/office/iodlg.src fpicker/source/office/iodlgimp.cxx fpicker/source/unx/gnome/FPentry.cxx fpicker/source/unx/gnome/SalGtkFilePicker.cxx fpicker/source/unx/gnome/SalGtkPicker.cxx fpicker/source/unx/kde4/KDE4FPEntry.cxx fpicker/source/win32/filepicker/FPentry.cxx framework/AllLangResTarget_fwe.mk framework/inc/dispatch/interaction.hxx framework/inc/framework/addonmenu.hxx framework/inc/framework/addonsoptions.hxx framework/inc/framework/bmkmenu.hxx framework/inc/framework/imageproducer.hxx framework/inc/framework/sfxhelperfunctions.hxx framework/inc/framework/statusbarconfiguration.hxx framework/inc/framework/titlehelper.hxx framework/inc/framework/toolboxconfiguration.hxx framework/inc/threadhelp/lockhelper.hxx framework/inc/xml/eventsdocumenthandler.hxx framework/inc/xml/statusbardocumenthandler.hxx framework/inc/xml/toolboxconfiguration.hxx framework/inc/xml/toolboxconfigurationdefines.hxx framework/inc/xml/toolboxdocumenthandler.hxx framework/prj/build.lst framework/qa/complex/ModuleManager/makefile.mk framework/qa/complex/accelerators/makefile.mk framework/qa/complex/framework/recovery/makefile.mk framework/qa/complex/imageManager/_XInitialization.java framework/source/classes/menumanager.cxx framework/source/dispatch/interaction.cxx framework/source/fwe/classes/bmkmenu.cxx framework/source/fwe/helper/actiontriggerhelper.cxx framework/source/fwe/helper/imageproducer.cxx framework/source/fwe/xml/menuconfiguration.cxx framework/source/fwe/xml/toolboxdocumenthandler.cxx framework/source/helper/uiconfigelementwrapperbase.cxx framework/source/helper/uielementwrapperbase.cxx framework/source/inc/pattern/window.hxx framework/source/jobs/jobdata.cxx framework/source/layoutmanager/layoutmanager.cxx framework/source/layoutmanager/panel.hxx framework/source/loadenv/loadenv.cxx framework/source/register/registerservices.cxx framework/source/services/menudocumenthandler.cxx framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx framework/source/uiconfiguration/uiconfigurationmanager.cxx framework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx framework/source/uielement/addonstoolbarmanager.cxx framework/source/uielement/controlmenucontroller.cxx framework/source/uielement/fontsizemenucontroller.cxx framework/source/uielement/imagebuttontoolbarcontroller.cxx framework/source/uielement/macrosmenucontroller.cxx framework/source/uielement/menubarmanager.cxx framework/source/uielement/newmenucontroller.cxx framework/source/uielement/togglebuttontoolbarcontroller.cxx framework/source/uielement/toolbarmanager.cxx framework/source/uielement/toolbarsmenucontroller.cxx framework/test/makefile.mk framework/test/threadtest/makefile.mk framework/test/typecfg/makefile.mk framework/util/guiapps/makefile.mk framework/util/makefile.mk idl/inc/bastype.hxx idl/inc/hash.hxx idl/inc/lex.hxx idl/inc/module.hxx idl/inc/object.hxx idl/inc/slot.hxx idl/inc/types.hxx idl/source/cmptools/hash.cxx idl/source/cmptools/lex.cxx idl/source/objects/basobj.cxx idl/source/objects/bastype.cxx idl/source/objects/module.cxx idl/source/objects/object.cxx idl/source/objects/slot.cxx idl/source/objects/types.cxx idl/source/prj/command.cxx idl/source/prj/database.cxx idl/source/prj/globals.cxx idl/source/prj/svidl.cxx linguistic/inc/linguistic/misc.hxx linguistic/prj/build.lst linguistic/source/convdic.cxx linguistic/source/convdiclist.cxx linguistic/source/dicimp.cxx linguistic/source/dlistimp.cxx linguistic/source/gciterator.cxx linguistic/source/iprcache.cxx linguistic/source/lngopt.cxx linguistic/source/lngprophelp.cxx linguistic/source/lngsvcmgr.cxx linguistic/source/lngsvcmgr.hxx linguistic/source/misc2.cxx linguistic/workben/sprophelp.cxx officecfg/registry/data/org/openoffice/VCL.xcu officecfg/util/makefile.mk oovbaapi/ooo/vba/XApplicationBase.idl oovbaapi/ooo/vba/XVBAAppService.idl oovbaapi/ooo/vba/XVBADocService.idl oovbaapi/ooo/vba/excel/XApplication.idl oovbaapi/ooo/vba/excel/XRange.idl oovbaapi/ooo/vba/excel/XWorkbook.idl oovbaapi/ooo/vba/excel/XWorksheet.idl oovbaapi/ooo/vba/word/XApplication.idl oovbaapi/ooo/vba/word/XGlobals.idl oovbaapi/ooo/vba/word/XTableOfContents.idl readlicense_oo/prj/build.lst scripting/prj/build.lst scripting/prj/d.lst scripting/source/basprov/basprov.cxx scripting/source/basprov/basscript.cxx scripting/source/basprov/basscript.hxx scripting/source/dlgprov/dlgprov.cxx scripting/source/inc/util/util.hxx scripting/source/protocolhandler/scripthandler.cxx scripting/source/provider/ProviderCache.cxx scripting/source/pyprov/makefile.mk scripting/source/runtimemgr/ScriptNameResolverImpl.cxx scripting/source/runtimemgr/ScriptRuntimeManager.cxx scripting/source/runtimemgr/StorageBridge.cxx scripting/source/storage/ScriptMetadataImporter.cxx scripting/source/storage/ScriptSecurityManager.cxx scripting/source/storage/ScriptStorage.cxx scripting/source/storage/ScriptStorageManager.cxx sfx2/inc/about.hxx sfx2/inc/brokenpackageint.hxx sfx2/inc/docvor.hxx sfx2/inc/pch/precompiled_sfx2.hxx sfx2/inc/sfx2/app.hxx sfx2/inc/sfx2/basmgr.hxx sfx2/inc/sfx2/bindings.hxx sfx2/inc/sfx2/childwin.hxx sfx2/inc/sfx2/ctrlitem.hxx sfx2/inc/sfx2/dinfdlg.hxx sfx2/inc/sfx2/dispatch.hxx sfx2/inc/sfx2/docfilt.hxx sfx2/inc/sfx2/evntconf.hxx sfx2/inc/sfx2/fcontnr.hxx sfx2/inc/sfx2/frame.hxx sfx2/inc/sfx2/imagemgr.hxx sfx2/inc/sfx2/imgmgr.hxx sfx2/inc/sfx2/linksrc.hxx sfx2/inc/sfx2/macrconf.hxx sfx2/inc/sfx2/macropg.hxx sfx2/inc/sfx2/mnuitem.hxx sfx2/inc/sfx2/mnumgr.hxx sfx2/inc/sfx2/module.hxx sfx2/inc/sfx2/msg.hxx sfx2/inc/sfx2/objsh.hxx sfx2/inc/sfx2/passwd.hxx sfx2/inc/sfx2/prnmon.hxx sfx2/inc/sfx2/request.hxx sfx2/inc/sfx2/sfx.hrc sfx2/inc/sfx2/sfxbasemodel.hxx sfx2/inc/sfx2/sfxhtml.hxx sfx2/inc/sfx2/sfxresid.hxx sfx2/inc/sfx2/sfxsids.hrc sfx2/inc/sfx2/sfxuno.hxx sfx2/inc/sfx2/shell.hxx sfx2/inc/sfx2/stbitem.hxx sfx2/inc/sfx2/styfitem.hxx sfx2/inc/sfx2/tabdlg.hxx sfx2/inc/sfx2/tbxctrl.hxx sfx2/inc/sfx2/tplpitem.hxx sfx2/inc/sfx2/viewfrm.hxx sfx2/inc/sfx2/viewsh.hxx sfx2/inc/sfxbasic.hxx sfx2/inc/sorgitm.hxx sfx2/prj/build.lst sfx2/qa/complex/docinfo/makefile.mk sfx2/qa/cppunit/makefile.mk sfx2/sdi/makefile.mk sfx2/source/appl/app.cxx sfx2/source/appl/app.hrc sfx2/source/appl/app.src sfx2/source/appl/appbas.cxx sfx2/source/appl/appcfg.cxx sfx2/source/appl/appchild.cxx sfx2/source/appl/appmain.cxx sfx2/source/appl/appmisc.cxx sfx2/source/appl/appopen.cxx sfx2/source/appl/appquit.cxx sfx2/source/appl/appserv.cxx sfx2/source/appl/appuno.cxx sfx2/source/appl/childwin.cxx sfx2/source/appl/fileobj.cxx sfx2/source/appl/helpinterceptor.cxx sfx2/source/appl/imagemgr.cxx sfx2/source/appl/impldde.cxx sfx2/source/appl/impldde.hxx sfx2/source/appl/linkmgr2.cxx sfx2/source/appl/lnkbase2.cxx sfx2/source/appl/makefile.mk sfx2/source/appl/module.cxx sfx2/source/appl/newhelp.cxx sfx2/source/appl/opengrf.cxx sfx2/source/appl/sfxdll.cxx sfx2/source/appl/sfxhelp.cxx sfx2/source/appl/shutdownicon.cxx sfx2/source/appl/shutdowniconunx.cxx sfx2/source/appl/workwin.cxx sfx2/source/bastyp/fltfnc.cxx sfx2/source/bastyp/frmhtml.cxx sfx2/source/bastyp/frmhtmlw.cxx sfx2/source/bastyp/helper.cxx sfx2/source/bastyp/minarray.cxx sfx2/source/bastyp/progress.cxx sfx2/source/bastyp/sfxhtml.cxx sfx2/source/config/evntconf.cxx sfx2/source/control/bindings.cxx sfx2/source/control/ctrlitem.cxx sfx2/source/control/dispatch.cxx sfx2/source/control/macrconf.cxx sfx2/source/control/macro.cxx sfx2/source/control/makefile.mk sfx2/source/control/minfitem.cxx sfx2/source/control/msg.cxx sfx2/source/control/msgpool.cxx sfx2/source/control/objface.cxx sfx2/source/control/request.cxx sfx2/source/control/shell.cxx sfx2/source/control/sorgitm.cxx sfx2/source/dialog/about.cxx sfx2/source/dialog/basedlgs.cxx sfx2/source/dialog/dinfdlg.cxx sfx2/source/dialog/dinfedt.cxx sfx2/source/dialog/dockwin.cxx sfx2/source/dialog/filedlghelper.cxx sfx2/source/dialog/mailmodel.cxx sfx2/source/dialog/mailmodelapi.cxx sfx2/source/dialog/makefile.mk sfx2/source/dialog/mgetempl.cxx sfx2/source/dialog/passwd.cxx sfx2/source/dialog/passwd.hrc sfx2/source/dialog/printopt.cxx sfx2/source/dialog/securitypage.cxx sfx2/source/dialog/splitwin.cxx sfx2/source/dialog/styfitem.cxx sfx2/source/dialog/tabdlg.cxx sfx2/source/dialog/taskpane.cxx sfx2/source/dialog/templdlg.cxx sfx2/source/dialog/tplpitem.cxx sfx2/source/dialog/versdlg.cxx sfx2/source/doc/QuerySaveDocument.cxx sfx2/source/doc/SfxDocumentMetaData.cxx sfx2/source/doc/applet.cxx sfx2/source/doc/doc.hrc sfx2/source/doc/doc.src sfx2/source/doc/docfile.cxx sfx2/source/doc/docinf.cxx sfx2/source/doc/doctempl.cxx sfx2/source/doc/doctemplates.cxx sfx2/source/doc/docvor.cxx sfx2/source/doc/guisaveas.cxx sfx2/source/doc/makefile.mk sfx2/source/doc/objcont.cxx sfx2/source/doc/objitem.cxx sfx2/source/doc/objmisc.cxx sfx2/source/doc/objserv.cxx sfx2/source/doc/printhelper.cxx sfx2/source/doc/sfxacldetect.cxx sfx2/source/doc/sfxbasemodel.cxx sfx2/source/inc/applet.hxx sfx2/source/inc/fltoptint.hxx sfx2/source/inc/sfxlocal.hrc sfx2/source/inc/virtmenu.hxx sfx2/source/inc/workwin.hxx sfx2/source/menu/mnuitem.cxx sfx2/source/menu/objmnctl.cxx sfx2/source/menu/virtmenu.cxx sfx2/source/notify/eventsupplier.cxx sfx2/source/notify/makefile.mk sfx2/source/toolbox/imgmgr.cxx sfx2/source/toolbox/tbxitem.cxx sfx2/source/view/frame.cxx sfx2/source/view/orgmgr.cxx sfx2/source/view/printer.cxx sfx2/source/view/prnmon.cxx sfx2/source/view/viewfrm.cxx sfx2/source/view/viewprn.cxx sfx2/source/view/viewsh.cxx sfx2/util/makefile.mk sfx2/workben/custompanel/makefile.mk shell/source/backends/desktopbe/desktopbackend.cxx shell/source/backends/gconfbe/gconfbackend.cxx shell/source/backends/kde4be/kde4backend.cxx shell/source/backends/kdebe/kdebackend.cxx shell/source/win32/SysShentry.cxx shell/source/win32/shlxthandler/propsheets/propsheets.cxx shell/source/win32/simplemail/smplmailentry.cxx svx/inc/float3d.hrc svx/inc/fmhelp.hrc svx/inc/globlmn_tmpl.hrc svx/inc/helpid.hrc svx/inc/pch/precompiled_svx.hxx svx/inc/sjctrl.hxx svx/inc/srchitem.hxx svx/inc/svdibrow.hxx svx/inc/svx/SmartTagItem.hxx svx/inc/svx/algitem.hxx svx/inc/svx/camera3d.hxx svx/inc/svx/chrtitem.hxx svx/inc/svx/clipfmtitem.hxx svx/inc/svx/ctredlin.hxx svx/inc/svx/dbtoolsclient.hxx svx/inc/svx/deflt3d.hxx svx/inc/svx/dialogs.hrc svx/inc/svx/drawitem.hxx svx/inc/svx/e3ditem.hxx svx/inc/svx/extrud3d.hxx svx/inc/svx/flagsdef.hxx svx/inc/svx/float3d.hxx svx/inc/svx/frmsel.hxx svx/inc/svx/gallery.hxx svx/inc/svx/gallery1.hxx svx/inc/svx/galtheme.hxx svx/inc/svx/grfcrop.hxx svx/inc/svx/hdft.hxx svx/inc/svx/hlnkitem.hxx svx/inc/svx/hyprlink.hxx svx/inc/svx/itemwin.hxx svx/inc/svx/lathe3d.hxx svx/inc/svx/linkwarn.hxx svx/inc/svx/modctrl.hxx svx/inc/svx/msdffdef.hxx svx/inc/svx/obj3d.hxx svx/inc/svx/optgenrl.hxx svx/inc/svx/optgrid.hxx svx/inc/svx/pageitem.hxx svx/inc/svx/paraprev.hxx svx/inc/svx/postattr.hxx svx/inc/svx/rotmodit.hxx svx/inc/svx/ruler.hxx svx/inc/svx/rulritem.hxx svx/inc/svx/scene3d.hxx svx/inc/svx/sdasaitm.hxx svx/inc/svx/sdasitm.hxx svx/inc/svx/sdggaitm.hxx svx/inc/svx/sdmetitm.hxx svx/inc/svx/sdtaaitm.hxx svx/inc/svx/sdtaditm.hxx svx/inc/svx/sdtaitm.hxx svx/inc/svx/sdtakitm.hxx svx/inc/svx/sdtfchim.hxx svx/inc/svx/sdtfsitm.hxx svx/inc/svx/srchdlg.hxx svx/inc/svx/svddrag.hxx svx/inc/svx/svdetc.hxx svx/inc/svx/svdglue.hxx svx/inc/svx/svdhlpln.hxx svx/inc/svx/svdlayer.hxx svx/inc/svx/svdmark.hxx svx/inc/svx/svdmodel.hxx svx/inc/svx/svdoashp.hxx svx/inc/svx/svdobj.hxx svx/inc/svx/svdocirc.hxx svx/inc/svx/svdoedge.hxx svx/inc/svx/svdogrp.hxx svx/inc/svx/svdomeas.hxx svx/inc/svx/svdoole2.hxx svx/inc/svx/svdorect.hxx svx/inc/svx/svdotable.hxx svx/inc/svx/svdotext.hxx svx/inc/svx/svdovirt.hxx svx/inc/svx/svdpage.hxx svx/inc/svx/svdsnpv.hxx svx/inc/svx/svdtrans.hxx svx/inc/svx/svdundo.hxx svx/inc/svx/svimbase.hxx svx/inc/svx/svx3ditems.hxx svx/inc/svx/svxdlg.hxx svx/inc/svx/sxcikitm.hxx svx/inc/svx/sxekitm.hxx svx/inc/svx/sxelditm.hxx svx/inc/svx/sxenditm.hxx svx/inc/svx/sxmkitm.hxx svx/inc/svx/sxmtpitm.hxx svx/inc/svx/sxmuitm.hxx svx/inc/svx/tabarea.hxx svx/inc/svx/tabline.hxx svx/inc/svx/unoprov.hxx svx/inc/svx/viewlayoutitem.hxx svx/inc/svx/xbitmap.hxx svx/inc/svx/xbtmpit.hxx svx/inc/svx/xcolit.hxx svx/inc/svx/xfillit0.hxx svx/inc/svx/xflclit.hxx svx/inc/svx/xflftrit.hxx svx/inc/svx/xflgrit.hxx svx/inc/svx/xflhtit.hxx svx/inc/svx/xftadit.hxx svx/inc/svx/xftsfit.hxx svx/inc/svx/xftshit.hxx svx/inc/svx/xlineit0.hxx svx/inc/svx/xlinjoit.hxx svx/inc/svx/xlnclit.hxx svx/inc/svx/xlndsit.hxx svx/inc/svx/xlnedcit.hxx svx/inc/svx/xlnedit.hxx svx/inc/svx/xlnedwit.hxx svx/inc/svx/xlnstcit.hxx svx/inc/svx/xlnstit.hxx svx/inc/svx/xlnstwit.hxx svx/inc/svx/xlnwtit.hxx svx/inc/svx/xtextit0.hxx svx/inc/svx/zoomitem.hxx svx/inc/svx/zoomslideritem.hxx svx/inc/xpolyimp.hxx svx/inc/zoom_def.hxx svx/prj/d.lst svx/source/accessibility/AccessibleShape.cxx svx/source/accessibility/DescriptionGenerator.cxx svx/source/customshapes/EnhancedCustomShapeEngine.cxx svx/source/customshapes/EnhancedCustomShapeFontWork.cxx svx/source/dialog/_bmpmask.cxx svx/source/dialog/_contdlg.cxx svx/source/dialog/connctrl.cxx svx/source/dialog/contwnd.cxx svx/source/dialog/ctredlin.cxx svx/source/dialog/ctredlin.hrc svx/source/dialog/ctredlin.src svx/source/dialog/dialcontrol.cxx svx/source/dialog/dlgctrl.cxx svx/source/dialog/docrecovery.cxx svx/source/dialog/fntctrl.cxx svx/source/dialog/fontwork.cxx svx/source/dialog/frmsel.cxx svx/source/dialog/graphctl.cxx svx/source/dialog/grfflt.cxx svx/source/dialog/hdft.cxx svx/source/dialog/hyperdlg.cxx svx/source/dialog/hyprdlg.hxx svx/source/dialog/hyprlink.cxx svx/source/dialog/hyprlink.hxx svx/source/dialog/hyprlink.src svx/source/dialog/imapdlg.cxx svx/source/dialog/imapwnd.cxx svx/source/dialog/linkwarn.hrc svx/source/dialog/makefile.mk svx/source/dialog/optgrid.cxx svx/source/dialog/orienthelper.cxx svx/source/dialog/pagectrl.cxx svx/source/dialog/prtqry.cxx svx/source/dialog/rlrcitem.cxx svx/source/dialog/rubydialog.cxx svx/source/dialog/rulritem.cxx svx/source/dialog/simptabl.cxx svx/source/dialog/srchdlg.cxx svx/source/dialog/svxbmpnumvalueset.cxx svx/source/dialog/svxruler.cxx svx/source/dialog/swframeexample.cxx svx/source/engine3d/float3d.cxx svx/source/engine3d/float3d.src svx/source/engine3d/svx3ditems.cxx svx/source/fmcomp/gridctrl.cxx svx/source/fmcomp/trace.cxx svx/source/form/ParseContext.cxx svx/source/form/datanavi.cxx svx/source/form/filtnav.cxx svx/source/form/fmexch.cxx svx/source/form/fmexpl.cxx svx/source/form/fmobjfac.cxx svx/source/form/fmpage.cxx svx/source/form/fmshell.cxx svx/source/form/fmshimp.cxx svx/source/form/fmsrcimp.cxx svx/source/form/fmvwimp.cxx svx/source/form/makefile.mk svx/source/form/tabwin.cxx svx/source/form/tbxform.cxx svx/source/form/typemap.cxx svx/source/gallery2/galbrws1.cxx svx/source/gallery2/galbrws2.cxx svx/source/gallery2/galexpl.cxx svx/source/gallery2/gallery1.cxx svx/source/gallery2/galtheme.cxx svx/source/gallery2/makefile.mk svx/source/gengal/gengal.cxx svx/source/gengal/makefile.mk svx/source/inc/fmgroup.hxx svx/source/intro/about_ooo.hrc svx/source/intro/iso.src svx/source/intro/ooo.src svx/source/items/SmartTagItem.cxx svx/source/items/algitem.cxx svx/source/items/chrtitem.cxx svx/source/items/clipfmtitem.cxx svx/source/items/customshapeitem.cxx svx/source/items/drawitem.cxx svx/source/items/e3ditem.cxx svx/source/items/grfitem.cxx svx/source/items/hlnkitem.cxx svx/source/items/makefile.mk svx/source/items/pageitem.cxx svx/source/items/rotmodit.cxx svx/source/items/viewlayoutitem.cxx svx/source/items/zoomitem.cxx svx/source/items/zoomslideritem.cxx svx/source/src/app.hrc svx/source/stbctrls/makefile.mk svx/source/stbctrls/modctrl.cxx svx/source/stbctrls/xmlsecctrl.cxx svx/source/stbctrls/zoomctrl.cxx svx/source/svdraw/clonelist.cxx svx/source/svdraw/svdattr.cxx svx/source/svdraw/svdcrtv.cxx svx/source/svdraw/svdedtv1.cxx svx/source/svdraw/svdedtv2.cxx svx/source/svdraw/svdedxv.cxx svx/source/svdraw/svdetc.cxx svx/source/svdraw/svdfmtf.cxx svx/source/svdraw/svdfmtf.hxx svx/source/svdraw/svdglue.cxx svx/source/svdraw/svdhdl.cxx svx/source/svdraw/svdhlpln.cxx svx/source/svdraw/svdibrow.cxx svx/source/svdraw/svdlayer.cxx svx/source/svdraw/svdmodel.cxx svx/source/svdraw/svdoashp.cxx svx/source/svdraw/svdobj.cxx svx/source/svdraw/svdocapt.cxx svx/source/svdraw/svdocirc.cxx svx/source/svdraw/svdoedge.cxx svx/source/svdraw/svdograf.cxx svx/source/svdraw/svdogrp.cxx svx/source/svdraw/svdomeas.cxx svx/source/svdraw/svdomedia.cxx svx/source/svdraw/svdopath.cxx svx/source/svdraw/svdotext.cxx svx/source/svdraw/svdotxdr.cxx svx/source/svdraw/svdotxed.cxx svx/source/svdraw/svdotxfl.cxx svx/source/svdraw/svdotxln.cxx svx/source/svdraw/svdotxtr.cxx svx/source/svdraw/svdoutl.cxx svx/source/svdraw/svdpage.cxx svx/source/svdraw/svdpagv.cxx svx/source/svdraw/svdpntv.cxx svx/source/svdraw/svdpoev.cxx svx/source/svdraw/svdsnpv.cxx svx/source/svdraw/svdstr.src svx/source/svdraw/svdtrans.cxx svx/source/svdraw/svdundo.cxx svx/source/svdraw/svdview.cxx svx/source/svdraw/svdxcgv.cxx svx/source/table/svdotable.cxx svx/source/tbxctrls/colorwindow.hxx svx/source/tbxctrls/extrusioncontrols.cxx svx/source/tbxctrls/fillctrl.cxx svx/source/tbxctrls/grafctrl.cxx svx/source/tbxctrls/itemwin.cxx svx/source/tbxctrls/layctrl.cxx svx/source/tbxctrls/lboxctrl.cxx svx/source/tbxctrls/linectrl.cxx svx/source/tbxctrls/tbcontrl.cxx svx/source/tbxctrls/verttexttbxctrl.cxx svx/source/unodraw/unomod.cxx svx/source/unodraw/unopage.cxx svx/source/unodraw/unoprov.cxx svx/source/unodraw/unoshape.cxx svx/source/unodraw/unoshtxt.cxx svx/source/xml/xmlxtexp.cxx svx/source/xoutdev/_xpoly.cxx svx/source/xoutdev/xattr.cxx svx/source/xoutdev/xattr2.cxx svx/source/xoutdev/xattrbmp.cxx svx/source/xoutdev/xtabcolr.cxx svx/util/makefile.mk svx/workben/edittest.cxx sysui/desktop/productversion.mk ucb/prj/build.lst ucb/source/cacher/cacheserv.cxx ucb/source/core/ucb1.component ucb/source/core/ucbserv.cxx ucb/source/core/ucbstore.cxx ucb/source/core/ucbstore.hxx ucb/source/sorter/sortmain.cxx ucb/source/ucp/file/prov.cxx ucb/source/ucp/file/shell.cxx ucb/source/ucp/ftp/ftpservices.cxx ucb/source/ucp/gio/gio_provider.cxx ucb/source/ucp/gvfs/gvfs_provider.cxx ucb/source/ucp/hierarchy/hierarchyservices.cxx ucb/source/ucp/odma/odma_lib.cxx ucb/source/ucp/odma/odma_services.cxx ucb/source/ucp/package/pkgservices.cxx ucb/source/ucp/tdoc/tdoc_services.cxx ucb/source/ucp/webdav/ContentProperties.cxx ucb/source/ucp/webdav/NeonHeadRequest.cxx ucb/source/ucp/webdav/webdavcontent.cxx ucb/source/ucp/webdav/webdavservices.cxx uui/source/iahndl.cxx uui/source/iahndl.hxx uui/source/loginerr.hxx uui/source/nameclashdlg.hxx uui/source/passcrtdlg.cxx uui/source/passworddlg.cxx uui/source/passworddlg.hxx uui/source/services.cxx vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/prj/build.lst vbahelper/prj/d.lst vbahelper/source/msforms/makefile.mk vbahelper/source/msforms/vbauserform.cxx vbahelper/source/vbahelper/makefile.mk vbahelper/source/vbahelper/vbaapplicationbase.cxx vbahelper/source/vbahelper/vbacommandbarcontrol.cxx vbahelper/source/vbahelper/vbadocumentbase.cxx vbahelper/source/vbahelper/vbadocumentsbase.cxx vbahelper/source/vbahelper/vbahelper.cxx vbahelper/util/makefile.mk xmlhelp/source/cxxhelp/provider/databases.cxx xmlhelp/source/cxxhelp/provider/services.cxx xmlhelp/source/treeview/tvfactory.cxx xmloff/JunitTest_xmloff_unoapi.mk xmloff/inc/functional.hxx xmloff/inc/xmloff/formlayerexport.hxx xmloff/inc/xmloff/formlayerimport.hxx xmloff/inc/xmloff/functional.hxx xmloff/inc/xmloff/shapeimport.hxx xmloff/inc/xmloff/xmlcnitm.hxx xmloff/inc/xmloff/xmlnumfi.hxx xmloff/prj/build.lst xmloff/source/chart/SchXMLChartContext.cxx xmloff/source/chart/SchXMLExport.cxx xmloff/source/chart/SchXMLImport.cxx xmloff/source/chart/SchXMLLegendContext.hxx xmloff/source/chart/SchXMLPlotAreaContext.cxx xmloff/source/core/xmluconv.cxx xmloff/source/draw/sdxmlexp.cxx xmloff/source/draw/shapeexport4.cxx xmloff/source/draw/ximp3dobject.cxx xmloff/source/draw/ximp3dscene.cxx xmloff/source/forms/formlayerexport.cxx xmloff/source/forms/formlayerimport.cxx xmloff/source/forms/handler/vcl_time_handler.hxx xmloff/source/forms/layerimport.cxx xmloff/source/forms/layerimport.hxx xmloff/source/forms/property_meta_data.hxx xmloff/source/style/PageHeaderFooterContext.cxx xmloff/source/style/PageMasterStyleMap.cxx xmloff/source/style/prstylei.cxx xmloff/source/style/xmlimppr.cxx xmloff/source/style/xmlnumfi.cxx xmloff/source/style/xmlstyle.cxx xmloff/source/table/tabledesignsimporter.cxx xmloff/source/text/XMLTextNumRuleInfo.cxx xmloff/source/text/XMLTextShapeStyleContext.cxx xmloff/source/text/txtstyle.cxx xmloff/source/transform/ChartOOoTContext.cxx xmloff/source/transform/EventOOoTContext.cxx xmloff/source/transform/TransformerBase.cxx xmloff/util/makefile.mk xmlscript/util/xcr.component
2011-03-12 02:42:58 +01:00
sal_Bool bSucc = osl_executeProcess(
aOUStrProgURL.pData,
pParamList,
nParamCount,
nOptions,
NULL,
NULL,
NULL, 0,
&pApp ) == osl_Process_E_None;
// 53521 only free process handle on success
if (bSucc)
{
osl_freeProcessHandle( pApp );
}
for(int j = 0; i < nParamCount; i++)
2000-09-18 15:18:56 +00:00
{
rtl_uString_release(pParamList[j]);
pParamList[j] = NULL;
2000-09-18 15:18:56 +00:00
}
2000-09-18 15:18:56 +00:00
if( !bSucc )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
}
2000-09-18 15:18:56 +00:00
else
{
2012-09-11 08:48:02 +01:00
rPar.Get(0)->PutLong( 0 );
}
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(VarType)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() != 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
SbxDataType eType = rPar.Get(1)->GetType();
rPar.Get(0)->PutInteger( (sal_Int16)eType );
2000-09-18 15:18:56 +00:00
}
}
// Exported function
OUString getBasicTypeName( SbxDataType eType )
2000-09-18 15:18:56 +00:00
{
static const char* pTypeNames[] =
{
"Empty", // SbxEMPTY
"Null", // SbxNULL
"Integer", // SbxINTEGER
"Long", // SbxLONG
"Single", // SbxSINGLE
"Double", // SbxDOUBLE
"Currency", // SbxCURRENCY
"Date", // SbxDATE
"String", // SbxSTRING
"Object", // SbxOBJECT
"Error", // SbxERROR
"Boolean", // SbxBOOL
"Variant", // SbxVARIANT
"DataObject", // SbxDATAOBJECT
"Unknown Type", //
"Unknown Type", //
"Char", // SbxCHAR
"Byte", // SbxBYTE
"UShort", // SbxUSHORT
"ULong", // SbxULONG
"Long64", // SbxLONG64
"ULong64", // SbxULONG64
"Int", // SbxINT
"UInt", // SbxUINT
"Void", // SbxVOID
"HResult", // SbxHRESULT
"Pointer", // SbxPOINTER
"DimArray", // SbxDIMARRAY
"CArray", // SbxCARRAY
"Userdef", // SbxUSERDEF
"Lpstr", // SbxLPSTR
"Lpwstr", // SbxLPWSTR
"Unknown Type", // SbxCoreSTRING
"WString", // SbxWSTRING
"WChar", // SbxWCHAR
"Int64", // SbxSALINT64
"UInt64", // SbxSALUINT64
"Decimal", // SbxDECIMAL
2000-09-18 15:18:56 +00:00
};
int nPos = ((int)eType) & 0x0FFF;
sal_uInt16 nTypeNameCount = sizeof( pTypeNames ) / sizeof( char* );
if ( nPos < 0 || nPos >= nTypeNameCount )
{
nPos = nTypeNameCount - 1;
}
return OUString::createFromAscii(pTypeNames[nPos]);
}
String getObjectTypeName( SbxVariable* pVar )
{
OUString sRet( "Object" );
if ( pVar )
{
SbxBase* pObj = pVar->GetObject();
if( !pObj )
{
sRet = OUString("Nothing");
}
else
{
SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pVar );
if ( !pUnoObj )
{
if ( SbxBase* pBaseObj = pVar->GetObject() )
{
pUnoObj = PTR_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( aObj, uno::UNO_QUERY );
if ( xServInfo.is() )
{
// is this a VBA object ?
uno::Reference< ooo::vba::XHelperInterface > xVBA( aObj, uno::UNO_QUERY );
Sequence< OUString > sServices = xServInfo->getSupportedServiceNames();
if ( sServices.getLength() )
{
sRet = sServices[ 0 ];
}
}
else
{
uno::Reference< bridge::oleautomation::XAutomationObject > xAutoMation( aObj, uno::UNO_QUERY );
if ( xAutoMation.is() )
{
uno::Reference< script::XInvocation > xInv( aObj, uno::UNO_QUERY );
if ( xInv.is() )
{
try
{
xInv->getValue( OUString( "$GetTypeName" ) ) >>= sRet;
}
catch(const Exception& )
{
}
}
}
}
sal_Int32 nDot = sRet.lastIndexOf( '.' );
if ( nDot != -1 && nDot < sRet.getLength() )
{
sRet = sRet.copy( nDot + 1 );
}
}
}
}
return sRet;
}
RTLFUNC(TypeName)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() != 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
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 );
}
2000-09-18 15:18:56 +00:00
if( bIsArray )
{
aRetStr += "()";
}
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutString( aRetStr );
}
}
RTLFUNC(Len)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() != 2 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else
{
const OUString& rStr = rPar.Get(1)->GetOUString();
rPar.Get(0)->PutLong( rStr.getLength() );
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(DDEInitiate)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
// No DDE for "virtual" portal users
if( needSecurityRestrictions() )
{
StarBASIC::Error(SbERR_NOT_IMPLEMENTED);
return;
}
int nArgs = (int)rPar.Count();
if ( nArgs != 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
const OUString& rApp = rPar.Get(1)->GetOUString();
const OUString& rTopic = rPar.Get(2)->GetOUString();
2000-09-18 15:18:56 +00:00
2012-01-15 16:15:08 +01:00
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
size_t nChannel;
2000-09-18 15:18:56 +00:00
SbError nDdeErr = pDDE->Initiate( rApp, rTopic, nChannel );
if( nDdeErr )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( nDdeErr );
}
2000-09-18 15:18:56 +00:00
else
{
rPar.Get(0)->PutInteger( (int)nChannel );
}
2000-09-18 15:18:56 +00:00
}
RTLFUNC(DDETerminate)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
// No DDE for "virtual" portal users
if( needSecurityRestrictions() )
{
StarBASIC::Error(SbERR_NOT_IMPLEMENTED);
return;
}
rPar.Get(0)->PutEmpty();
int nArgs = (int)rPar.Count();
if ( nArgs != 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
size_t nChannel = rPar.Get(1)->GetInteger();
2012-01-15 16:15:08 +01:00
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
2000-09-18 15:18:56 +00:00
SbError nDdeErr = pDDE->Terminate( nChannel );
if( nDdeErr )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( nDdeErr );
}
2000-09-18 15:18:56 +00:00
}
RTLFUNC(DDETerminateAll)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
// No DDE for "virtual" portal users
if( needSecurityRestrictions() )
{
StarBASIC::Error(SbERR_NOT_IMPLEMENTED);
return;
}
rPar.Get(0)->PutEmpty();
int nArgs = (int)rPar.Count();
if ( nArgs != 1 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
2012-01-15 16:15:08 +01:00
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
2000-09-18 15:18:56 +00:00
SbError nDdeErr = pDDE->TerminateAll();
if( nDdeErr )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( nDdeErr );
}
2000-09-18 15:18:56 +00:00
}
RTLFUNC(DDERequest)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
// No DDE for "virtual" portal users
if( needSecurityRestrictions() )
{
StarBASIC::Error(SbERR_NOT_IMPLEMENTED);
return;
}
int nArgs = (int)rPar.Count();
if ( nArgs != 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
size_t nChannel = rPar.Get(1)->GetInteger();
const OUString& rItem = rPar.Get(2)->GetOUString();
2012-01-15 16:15:08 +01:00
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
OUString aResult;
2000-09-18 15:18:56 +00:00
SbError nDdeErr = pDDE->Request( nChannel, rItem, aResult );
if( nDdeErr )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( nDdeErr );
}
2000-09-18 15:18:56 +00:00
else
{
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutString( aResult );
}
2000-09-18 15:18:56 +00:00
}
RTLFUNC(DDEExecute)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
// No DDE for "virtual" portal users
if( needSecurityRestrictions() )
{
StarBASIC::Error(SbERR_NOT_IMPLEMENTED);
return;
}
rPar.Get(0)->PutEmpty();
int nArgs = (int)rPar.Count();
if ( nArgs != 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
size_t nChannel = rPar.Get(1)->GetInteger();
const OUString& rCommand = rPar.Get(2)->GetOUString();
2012-01-15 16:15:08 +01:00
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
2000-09-18 15:18:56 +00:00
SbError nDdeErr = pDDE->Execute( nChannel, rCommand );
if( nDdeErr )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( nDdeErr );
}
2000-09-18 15:18:56 +00:00
}
RTLFUNC(DDEPoke)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
// No DDE for "virtual" portal users
if( needSecurityRestrictions() )
{
StarBASIC::Error(SbERR_NOT_IMPLEMENTED);
return;
}
rPar.Get(0)->PutEmpty();
int nArgs = (int)rPar.Count();
if ( nArgs != 4 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
size_t nChannel = rPar.Get(1)->GetInteger();
const OUString& rItem = rPar.Get(2)->GetOUString();
const OUString& rData = rPar.Get(3)->GetOUString();
2012-01-15 16:15:08 +01:00
SbiDdeControl* pDDE = GetSbData()->pInst->GetDdeControl();
2000-09-18 15:18:56 +00:00
SbError nDdeErr = pDDE->Poke( nChannel, rItem, rData );
if( nDdeErr )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( nDdeErr );
}
2000-09-18 15:18:56 +00:00
}
RTLFUNC(FreeFile)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() != 1 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
2012-01-15 16:15:08 +01:00
SbiIoSystem* pIO = GetSbData()->pInst->GetIoSystem();
2000-09-18 15:18:56 +00:00
short nChannel = 1;
while( nChannel < CHANNELS )
{
SbiStream* pStrm = pIO->GetStream( nChannel );
if( !pStrm )
{
rPar.Get(0)->PutInteger( nChannel );
return;
}
nChannel++;
}
StarBASIC::Error( SbERR_TOO_MANY_FILES );
}
RTLFUNC(LBound)
{
(void)pBasic;
(void)bWrite;
sal_uInt16 nParCount = rPar.Count();
2000-09-18 15:18:56 +00:00
if ( nParCount != 3 && nParCount != 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
SbxBase* pParObj = rPar.Get(1)->GetObject();
SbxDimArray* pArr = PTR_CAST(SbxDimArray,pParObj);
if( pArr )
{
sal_Int32 nLower, nUpper;
2000-09-18 15:18:56 +00:00
short nDim = (nParCount == 3) ? (short)rPar.Get(2)->GetInteger() : 1;
2002-11-18 07:38:47 +00:00
if( !pArr->GetDim32( nDim, nLower, nUpper ) )
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_OUT_OF_RANGE );
else
2002-11-18 07:38:47 +00:00
rPar.Get(0)->PutLong( nLower );
2000-09-18 15:18:56 +00:00
}
else
StarBASIC::Error( SbERR_MUST_HAVE_DIMS );
}
RTLFUNC(UBound)
{
(void)pBasic;
(void)bWrite;
sal_uInt16 nParCount = rPar.Count();
2000-09-18 15:18:56 +00:00
if ( nParCount != 3 && nParCount != 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
SbxBase* pParObj = rPar.Get(1)->GetObject();
SbxDimArray* pArr = PTR_CAST(SbxDimArray,pParObj);
if( pArr )
{
sal_Int32 nLower, nUpper;
2000-09-18 15:18:56 +00:00
short nDim = (nParCount == 3) ? (short)rPar.Get(2)->GetInteger() : 1;
2002-11-18 07:38:47 +00:00
if( !pArr->GetDim32( nDim, nLower, nUpper ) )
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_OUT_OF_RANGE );
else
2002-11-18 07:38:47 +00:00
rPar.Get(0)->PutLong( nUpper );
2000-09-18 15:18:56 +00:00
}
else
StarBASIC::Error( SbERR_MUST_HAVE_DIMS );
}
RTLFUNC(RGB)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() != 4 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
sal_uIntPtr nRed = rPar.Get(1)->GetInteger() & 0xFF;
sal_uIntPtr nGreen = rPar.Get(2)->GetInteger() & 0xFF;
sal_uIntPtr nBlue = rPar.Get(3)->GetInteger() & 0xFF;
sal_uIntPtr nRGB;
2012-01-15 16:15:08 +01:00
SbiInstance* pInst = GetSbData()->pInst;
bool bCompatibility = ( pInst && pInst->IsCompatibility() );
if( bCompatibility )
{
nRGB = (nBlue << 16) | (nGreen << 8) | nRed;
}
else
{
nRGB = (nRed << 16) | (nGreen << 8) | nBlue;
}
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutLong( nRGB );
}
RTLFUNC(QBColor)
{
(void)pBasic;
(void)bWrite;
static const sal_Int32 pRGB[] =
{
0x000000,
0x800000,
0x008000,
0x808000,
0x000080,
0x800080,
0x008080,
0xC0C0C0,
0x808080,
0xFF0000,
0x00FF00,
0xFFFF00,
0x0000FF,
0xFF00FF,
0x00FFFF,
0xFFFFFF,
};
2000-09-18 15:18:56 +00:00
if ( rPar.Count() != 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
sal_Int16 nCol = rPar.Get(1)->GetInteger();
if( nCol < 0 || nCol > 15 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
sal_Int32 nRGB = pRGB[ nCol ];
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutLong( nRGB );
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
// StrConv(string, conversion, LCID)
2000-09-18 15:18:56 +00:00
RTLFUNC(StrConv)
{
(void)pBasic;
(void)bWrite;
sal_uIntPtr nArgCount = rPar.Count()-1;
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
if( nArgCount < 2 || nArgCount > 3 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
return;
}
OUString aOldStr = rPar.Get(1)->GetOUString();
sal_Int32 nConversion = rPar.Get(2)->GetLong();
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
sal_uInt16 nLanguage = LANGUAGE_SYSTEM;
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
sal_Int32 nOldLen = aOldStr.getLength();
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
if( nOldLen == 0 )
{
// null string,return
rPar.Get(0)->PutString(aOldStr);
return;
}
sal_Int32 nType = 0;
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
if ( (nConversion & 0x03) == 3 ) // vbProperCase
{
const CharClass& rCharClass = GetCharClass();
aOldStr = rCharClass.titlecase( aOldStr.toAsciiLowerCase(), 0, nOldLen );
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
}
else if ( (nConversion & 0x01) == 1 ) // vbUpperCase
{
nType |= i18n::TransliterationModules_LOWERCASE_UPPERCASE;
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
else if ( (nConversion & 0x02) == 2 ) // vbLowerCase
{
nType |= i18n::TransliterationModules_UPPERCASE_LOWERCASE;
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
if ( (nConversion & 0x04) == 4 ) // vbWide
{
nType |= i18n::TransliterationModules_HALFWIDTH_FULLWIDTH;
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
else if ( (nConversion & 0x08) == 8 ) // vbNarrow
{
nType |= i18n::TransliterationModules_FULLWIDTH_HALFWIDTH;
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
if ( (nConversion & 0x10) == 16) // vbKatakana
{
nType |= i18n::TransliterationModules_HIRAGANA_KATAKANA;
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
else if ( (nConversion & 0x20) == 32 ) // vbHiragana
{
nType |= i18n::TransliterationModules_KATAKANA_HIRAGANA;
}
OUString aNewStr( aOldStr );
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
if( nType != 0 )
{
uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
::utl::TransliterationWrapper aTransliterationWrapper( xContext, nType );
uno::Sequence<sal_Int32> aOffsets;
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
aTransliterationWrapper.loadModuleIfNeeded( nLanguage );
aNewStr = aTransliterationWrapper.transliterate( aOldStr, nLanguage, 0, nOldLen, &aOffsets );
}
if ( (nConversion & 0x40) == 64 ) // vbUnicode
{
// convert the string to byte string, preserving unicode (2 bytes per character)
sal_Int32 nSize = aNewStr.getLength()*2;
const sal_Unicode* pSrc = aNewStr.getStr();
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
sal_Char* pChar = new sal_Char[nSize+1];
for( sal_Int32 i=0; i < nSize; i++ )
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
{
2011-07-30 10:08:45 +02:00
pChar[i] = static_cast< sal_Char >( (i%2) ? ((*pSrc) >> 8) & 0xff : (*pSrc) & 0xff );
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
if( i%2 )
{
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
pSrc++;
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
}
pChar[nSize] = '\0';
OString aOStr(pChar);
2011-05-16 12:37:45 +02:00
delete[] pChar;
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
// there is no concept about default codepage in unix. so it is incorrectly in unix
OUString aOUStr = OStringToOUString(aOStr, osl_getThreadTextEncoding());
rPar.Get(0)->PutString( aOUStr );
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
return;
}
else if ( (nConversion & 0x80) == 128 ) // vbFromUnicode
{
// there is no concept about default codepage in unix. so it is incorrectly in unix
OString aOStr = OUStringToOString(aNewStr,osl_getThreadTextEncoding());
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
const sal_Char* pChar = aOStr.getStr();
sal_Int32 nArraySize = aOStr.getLength();
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
SbxDimArray* pArray = new SbxDimArray(SbxBYTE);
bool bIncIndex = (IsBaseIndexOne() && SbiRuntime::isVBAEnabled() );
if(nArraySize)
{
if( bIncIndex )
{
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
pArray->AddDim( 1, nArraySize );
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
else
{
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
pArray->AddDim( 0, nArraySize-1 );
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
}
else
{
pArray->unoAddDim( 0, -1 );
}
for( sal_Int32 i=0; i< nArraySize; i++)
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
{
SbxVariable* pNew = new SbxVariable( SbxBYTE );
pNew->PutByte(*pChar);
pChar++;
pNew->SetFlag( SBX_WRITE );
short index = i;
if( bIncIndex )
{
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
++index;
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
pArray->Put( pNew, &index );
}
SbxVariableRef refVar = rPar.Get(0);
sal_uInt16 nFlags = refVar->GetFlags();
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
refVar->ResetFlag( SBX_FIXED );
refVar->PutObject( pArray );
refVar->SetFlags( nFlags );
refVar->SetParameters( NULL );
return;
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
}
rPar.Get(0)->PutString(aNewStr);
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
2000-09-18 15:18:56 +00:00
RTLFUNC(Beep)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() != 1 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
Sound::Beep();
2000-09-18 15:18:56 +00:00
}
RTLFUNC(Load)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if( rPar.Count() != 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
2000-09-18 15:18:56 +00:00
SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject();
if ( pObj )
2000-09-18 15:18:56 +00:00
{
if( pObj->IsA( TYPE( SbUserFormModule ) ) )
{
((SbUserFormModule*)pObj)->Load();
}
else if( pObj->IsA( TYPE( SbxObject ) ) )
{
SbxVariable* pVar = ((SbxObject*)pObj)->Find( OUString("Load"), SbxCLASS_METHOD );
if( pVar )
{
pVar->GetInteger();
}
}
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(Unload)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutEmpty();
if( rPar.Count() != 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
2000-09-18 15:18:56 +00:00
SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject();
if ( pObj )
2000-09-18 15:18:56 +00:00
{
if( pObj->IsA( TYPE( SbUserFormModule ) ) )
{
SbUserFormModule* pFormModule = ( SbUserFormModule* )pObj;
pFormModule->Unload();
}
else if( pObj->IsA( TYPE( SbxObject ) ) )
{
SbxVariable* pVar = ((SbxObject*)pObj)->Find( OUString("Unload"), SbxCLASS_METHOD );
if( pVar )
{
pVar->GetInteger();
}
}
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(LoadPicture)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if( rPar.Count() != 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
OUString aFileURL = getFullPath( rPar.Get(1)->GetOUString() );
SvStream* pStream = utl::UcbStreamHelper::CreateStream( aFileURL, STREAM_READ );
if( pStream != NULL )
{
Bitmap aBmp;
*pStream >> aBmp;
Graphic aGraphic( aBmp );
2000-09-18 15:18:56 +00:00
SbxObjectRef xRef = new SbStdPicture;
((SbStdPicture*)(SbxObject*)xRef)->SetGraphic( aGraphic );
rPar.Get(0)->PutObject( xRef );
}
delete pStream;
2000-09-18 15:18:56 +00:00
}
RTLFUNC(SavePicture)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutEmpty();
if( rPar.Count() != 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
SbxBase* pObj = (SbxObject*)rPar.Get(1)->GetObject();
if( pObj->IsA( TYPE( SbStdPicture ) ) )
{
SvFileStream aOStream( rPar.Get(2)->GetOUString(), STREAM_WRITE | STREAM_TRUNC );
2000-09-18 15:18:56 +00:00
Graphic aGraphic = ((SbStdPicture*)pObj)->GetGraphic();
aOStream << aGraphic;
}
}
//-----------------------------------------------------------------------------------------
RTLFUNC(MsgBox)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
static const WinBits nStyleMap[] =
{
WB_OK, // MB_OK
WB_OK_CANCEL, // MB_OKCANCEL
WB_ABORT_RETRY_IGNORE, // MB_ABORTRETRYIGNORE
2000-09-18 15:18:56 +00:00
WB_YES_NO_CANCEL, // MB_YESNOCANCEL
WB_YES_NO, // MB_YESNO
WB_RETRY_CANCEL // MB_RETRYCANCEL
};
static const sal_Int16 nButtonMap[] =
2000-09-18 15:18:56 +00:00
{
2, // #define RET_CANCEL sal_False
1, // #define RET_OK sal_True
2000-09-18 15:18:56 +00:00
6, // #define RET_YES 2
7, // #define RET_NO 3
4 // #define RET_RETRY 4
};
sal_uInt16 nArgCount = (sal_uInt16)rPar.Count();
if( nArgCount < 2 || nArgCount > 6 )
2000-09-18 15:18:56 +00:00
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
WinBits nWinBits;
WinBits nType = 0; // MB_OK
if( nArgCount >= 3 )
nType = (WinBits)rPar.Get(2)->GetInteger();
WinBits nStyle = nType;
nStyle &= 15; // delete bits 4-16
2000-09-18 15:18:56 +00:00
if( nStyle > 5 )
{
2000-09-18 15:18:56 +00:00
nStyle = 0;
}
2000-09-18 15:18:56 +00:00
nWinBits = nStyleMap[ nStyle ];
WinBits nWinDefBits;
nWinDefBits = (WB_DEF_OK | WB_DEF_RETRY | WB_DEF_YES);
2000-09-18 15:18:56 +00:00
if( nType & 256 )
{
if( nStyle == 5 )
{
nWinDefBits = WB_DEF_CANCEL;
}
else if( nStyle == 2 )
{
nWinDefBits = WB_DEF_RETRY;
}
2000-09-18 15:18:56 +00:00
else
{
nWinDefBits = (WB_DEF_CANCEL | WB_DEF_RETRY | WB_DEF_NO);
}
2000-09-18 15:18:56 +00:00
}
else if( nType & 512 )
{
if( nStyle == 2)
{
nWinDefBits = WB_DEF_IGNORE;
}
else
{
nWinDefBits = WB_DEF_CANCEL;
}
}
else if( nStyle == 2)
{
nWinDefBits = WB_DEF_CANCEL;
}
nWinBits |= nWinDefBits;
2000-09-18 15:18:56 +00:00
OUString aMsg = rPar.Get(1)->GetOUString();
OUString aTitle;
if( nArgCount >= 4 )
{
aTitle = rPar.Get(3)->GetOUString();
}
2000-09-18 15:18:56 +00:00
else
{
2000-09-18 15:18:56 +00:00
aTitle = GetpApp()->GetAppName();
}
2000-09-18 15:18:56 +00:00
nType &= (16+32+64);
MessBox* pBox = 0;
Window* pParent = GetpApp()->GetDefDialogParent();
2000-09-18 15:18:56 +00:00
switch( nType )
{
case 16:
pBox = new ErrorBox( pParent, nWinBits, aMsg );
break;
case 32:
pBox = new QueryBox( pParent, nWinBits, aMsg );
break;
case 48:
pBox = new WarningBox( pParent, nWinBits, aMsg );
break;
case 64:
pBox = new InfoBox( pParent, aMsg );
break;
default:
pBox = new MessBox( pParent, nWinBits, aTitle, aMsg );
2000-09-18 15:18:56 +00:00
}
pBox->SetText( aTitle );
sal_uInt16 nRet = (sal_uInt16)pBox->Execute();
if( nRet == sal_True )
{
2000-09-18 15:18:56 +00:00
nRet = 1;
}
sal_Int16 nMappedRet;
if( nStyle == 2 )
{
nMappedRet = nRet;
if( nMappedRet == 0 )
{
nMappedRet = 3; // Abort
}
}
else
{
nMappedRet = nButtonMap[ nRet ];
}
rPar.Get(0)->PutInteger( nMappedRet );
2000-09-18 15:18:56 +00:00
delete pBox;
}
2011-03-22 12:23:36 +01:00
RTLFUNC(SetAttr)
2000-09-18 15:18:56 +00:00
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
rPar.Get(0)->PutEmpty();
if ( rPar.Count() == 3 )
{
OUString aStr = rPar.Get(1)->GetOUString();
sal_Int16 nFlags = rPar.Get(2)->GetInteger();
2000-09-18 15:18:56 +00:00
if( hasUno() )
{
uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
2000-09-18 15:18:56 +00:00
if( xSFI.is() )
{
try
{
sal_Bool bReadOnly = (nFlags & Sb_ATTR_READONLY) != 0;
2000-09-18 15:18:56 +00:00
xSFI->setReadOnly( aStr, bReadOnly );
sal_Bool bHidden = (nFlags & Sb_ATTR_HIDDEN) != 0;
xSFI->setHidden( aStr, bHidden );
2000-09-18 15:18:56 +00:00
}
catch(const Exception & )
2000-09-18 15:18:56 +00:00
{
StarBASIC::Error( ERRCODE_IO_GENERAL );
}
}
}
}
else
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
}
2011-03-22 12:23:36 +01:00
RTLFUNC(Reset)
2000-09-18 15:18:56 +00:00
{
(void)pBasic;
(void)bWrite;
(void)rPar;
2012-01-15 16:15:08 +01:00
SbiIoSystem* pIO = GetSbData()->pInst->GetIoSystem();
2000-09-18 15:18:56 +00:00
if (pIO)
{
2000-09-18 15:18:56 +00:00
pIO->CloseAll();
}
2000-09-18 15:18:56 +00:00
}
RTLFUNC(DumpAllObjects)
{
(void)pBasic;
(void)bWrite;
sal_uInt16 nArgCount = (sal_uInt16)rPar.Count();
2000-09-18 15:18:56 +00:00
if( nArgCount < 2 || nArgCount > 3 )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
else if( !pBasic )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_INTERNAL_ERROR );
}
2000-09-18 15:18:56 +00:00
else
{
SbxObject* p = pBasic;
while( p->GetParent() )
{
2000-09-18 15:18:56 +00:00
p = p->GetParent();
}
SvFileStream aStrm( rPar.Get( 1 )->GetOUString(),
2000-09-18 15:18:56 +00:00
STREAM_WRITE | STREAM_TRUNC );
p->Dump( aStrm, rPar.Get( 2 )->GetBool() );
aStrm.Close();
if( aStrm.GetError() != SVSTREAM_OK )
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_IO_ERROR );
}
2000-09-18 15:18:56 +00:00
}
}
RTLFUNC(FileExists)
{
(void)pBasic;
(void)bWrite;
2000-09-18 15:18:56 +00:00
if ( rPar.Count() == 2 )
{
OUString aStr = rPar.Get(1)->GetOUString();
sal_Bool bExists = sal_False;
2000-09-18 15:18:56 +00:00
if( hasUno() )
{
uno::Reference< ucb::XSimpleFileAccess3 > xSFI = getFileAccess();
2000-09-18 15:18:56 +00:00
if( xSFI.is() )
{
try
{
bExists = xSFI->exists( aStr );
}
catch(const Exception & )
2000-09-18 15:18:56 +00:00
{
StarBASIC::Error( ERRCODE_IO_GENERAL );
}
}
}
else
{
2000-09-26 08:02:02 +00:00
DirectoryItem aItem;
FileBase::RC nRet = DirectoryItem::get( getFullPath( aStr ), aItem );
bExists = (nRet == FileBase::E_None);
2000-09-18 15:18:56 +00:00
}
rPar.Get(0)->PutBool( bExists );
}
else
{
2000-09-18 15:18:56 +00:00
StarBASIC::Error( SbERR_BAD_ARGUMENT );
}
2000-09-18 15:18:56 +00:00
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
RTLFUNC(Partition)
{
(void)pBasic;
(void)bWrite;
if ( rPar.Count() != 5 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
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();
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
if( nStart < 0 || nStop <= nStart || nInterval < 1 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
// 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 maximun number of characters before lowervalue and uppervalue
OUString aBeforeStart = OUString::valueOf( nStart - 1 );
OUString aAfterStop = OUString::valueOf( nStop + 1 );
sal_Int32 nLen1 = aBeforeStart.getLength();
sal_Int32 nLen2 = aAfterStop.getLength();
sal_Int32 nLen = nLen1 >= nLen2 ? nLen1:nLen2;
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
OUStringBuffer aRetStr( nLen * 2 + 1);
OUString aLowerValue;
OUString aUpperValue;
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
if( nNumber < nStart )
{
aUpperValue = aBeforeStart;
}
else if( nNumber > nStop )
{
aLowerValue = aAfterStop;
}
else
{
sal_Int32 nLowerValue = nNumber;
sal_Int32 nUpperValue = nLowerValue;
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
if( nInterval > 1 )
{
nLowerValue = ((( nNumber - nStart ) / nInterval ) * nInterval ) + nStart;
nUpperValue = nLowerValue + nInterval - 1;
}
aLowerValue = OUString::valueOf( nLowerValue );
aUpperValue = OUString::valueOf( nUpperValue );
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
}
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 )
{
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
aRetStr.appendAscii(" ");
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
}
aRetStr.append( aLowerValue ).appendAscii(":");
if( nLen > nLen2 )
{
// appending the leading spaces for the uppervalue
for ( sal_Int32 i= (nLen - nLen2) ; i > 0; --i )
{
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
aRetStr.appendAscii(" ");
}
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
}
aRetStr.append( aUpperValue );
rPar.Get(0)->PutString( aRetStr.makeStringAndClear());
INTEGRATION: CWS npower10 (1.77.34); FILE MERGED 2008/05/12 03:35:52 pflin 1.77.34.15: Issue number: # i85035 Submitted by: pflin, fixed conflict during resync Reviewed by: pflin 2008/05/07 07:11:12 pflin 1.77.34.14: RESYNC: (1.78-1.79); FILE MERGED 2008/03/18 14:56:31 pflin 1.77.34.13: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 13:40:54 pflin 1.77.34.12: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel 2008/03/18 05:52:57 pflin 1.77.34.11: Issue number: i85037 Submitted by: pflin Reviewed by: Andreas, Noel Rewrite the algorithm. 2008/03/12 06:32:50 pflin 1.77.34.10: Issue number: i85039 Submitted by: pflin Reviewed by: npower, ab Fix some issues found by code review 2008/03/10 16:32:47 npower 1.77.34.9: Issue number: 85349 removed the code associated with this issue 2008/02/26 21:59:45 npower 1.77.34.8: RESYNC: (1.77-1.78); FILE MERGED 2008/02/26 04:57:10 pflin 1.77.34.7: Issue number: i85349 Submitted by: jiaojianhua Reviewed by: npower 2008/01/29 03:21:14 pflin 1.77.34.6: Issue number: i85039 Submitted by: pflin Reviewed by: npower Fixed for format function 2008/01/07 06:54:10 pflin 1.77.34.5: Issue number: #i85039# Submitted by: pflin Reviewed by: npower support most format types in mso vba 2008/01/07 06:52:52 pflin 1.77.34.4: Issue number: #i85038# Submitted by: pflin Reviewed by: npower Fix the issue of getattr function in Win32 2008/01/07 06:47:16 pflin 1.77.34.3: Issue number: #i85037# Submitted by: pflin Reviewed by: npower Support the partition function 2008/01/07 06:42:54 pflin 1.77.34.2: Issue number: #i85036# Submitted by: pflin Reviewed by: npower Support strconv function 2008/01/07 06:41:38 pflin 1.77.34.1: Issue number: #i85035# Submitted by: pflin Reviewed by: npower Support replace function
2008-07-02 09:18:22 +00:00
}
2012-03-05 21:41:31 +02:00
#endif
static long GetDayDiff( const Date& rDate )
{
Date aRefDate( 1,1,1900 );
long nDiffDays;
if ( aRefDate > rDate )
{
nDiffDays = (long)(aRefDate - rDate);
nDiffDays *= -1;
}
else
{
2012-03-05 21:41:31 +02:00
nDiffDays = (long)(rDate - aRefDate);
}
2012-03-05 21:41:31 +02:00
nDiffDays += 2; // adjustment VisualBasic: 1.Jan.1900 == 2
return nDiffDays;
}
sal_Int16 implGetDateYear( double aDate )
{
Date aRefDate( 1,1,1900 );
long nDays = (long) aDate;
nDays -= 2; // standardize: 1.1.1900 => 0.0
aRefDate += nDays;
sal_Int16 nRet = (sal_Int16)( aRefDate.GetYear() );
return nRet;
}
bool implDateSerial( sal_Int16 nYear, sal_Int16 nMonth, sal_Int16 nDay, double& rdRet )
2012-03-05 21:41:31 +02:00
{
#ifndef DISABLE_SCRIPTING
if ( nYear < 30 && SbiRuntime::isVBAEnabled() )
{
2012-03-05 21:41:31 +02:00
nYear += 2000;
}
2012-03-05 21:41:31 +02:00
else
#endif
{
2012-03-05 21:41:31 +02:00
if ( nYear < 100 )
{
2012-03-05 21:41:31 +02:00
nYear += 1900;
}
}
2012-03-05 21:41:31 +02:00
Date aCurDate( nDay, nMonth, nYear );
if ((nYear < 100 || nYear > 9999) )
{
#ifndef DISABLE_SCRIPTING
StarBASIC::Error( SbERR_BAD_ARGUMENT );
#endif
return false;
2012-03-05 21:41:31 +02:00
}
#ifndef DISABLE_SCRIPTING
if ( !SbiRuntime::isVBAEnabled() )
#endif
{
if ( (nMonth < 1 || nMonth > 12 )||
(nDay < 1 || nDay > 31 ) )
2012-03-05 21:41:31 +02:00
{
#ifndef DISABLE_SCRIPTING
StarBASIC::Error( SbERR_BAD_ARGUMENT );
#endif
return false;
2012-03-05 21:41:31 +02:00
}
}
#ifndef DISABLE_SCRIPTING
else
{
// grab the year & month
aCurDate = Date( 1, (( nMonth % 12 ) > 0 ) ? ( nMonth % 12 ) : 12 + ( nMonth % 12 ), nYear );
// adjust year based on month value
// e.g. 2000, 0, xx = 1999, 12, xx ( or December of the previous year )
// 2000, 13, xx = 2001, 1, xx ( or January of the following year )
if( ( nMonth < 1 ) || ( nMonth > 12 ) )
{
// inacurrate around leap year, don't use days to calculate,
// just modify the months directory
sal_Int16 nYearAdj = ( nMonth /12 ); // default to positive months inputed
if ( nMonth <=0 )
{
2012-03-05 21:41:31 +02:00
nYearAdj = ( ( nMonth -12 ) / 12 );
}
2012-03-05 21:41:31 +02:00
aCurDate.SetYear( aCurDate.GetYear() + nYearAdj );
}
// adjust day value,
// e.g. 2000, 2, 0 = 2000, 1, 31 or the last day of the previous month
// 2000, 1, 32 = 2000, 2, 1 or the first day of the following month
if( ( nDay < 1 ) || ( nDay > aCurDate.GetDaysInMonth() ) )
{
2012-03-05 21:41:31 +02:00
aCurDate += nDay - 1;
}
2012-03-05 21:41:31 +02:00
else
{
2012-03-05 21:41:31 +02:00
aCurDate.SetDay( nDay );
}
2012-03-05 21:41:31 +02:00
}
#endif
long nDiffDays = GetDayDiff( aCurDate );
rdRet = (double)nDiffDays;
return true;
2012-03-05 21:41:31 +02:00
}
sal_Int16 implGetMinute( double dDate )
{
if( dDate < 0.0 )
{
2012-03-05 21:41:31 +02:00
dDate *= -1.0;
}
2012-03-05 21:41:31 +02:00
double nFrac = dDate - floor( dDate );
nFrac *= 86400.0;
sal_Int32 nSeconds = (sal_Int32)(nFrac + 0.5);
sal_Int16 nTemp = (sal_Int16)(nSeconds % 3600);
sal_Int16 nMin = nTemp / 60;
return nMin;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */