2010-10-12 15:57:08 +02:00
|
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2002-11-18 14:54:26 +00:00
|
|
|
|
/*************************************************************************
|
|
|
|
|
*
|
2008-04-11 09:09:14 +00:00
|
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2002-11-18 14:54:26 +00:00
|
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2002-11-18 14:54:26 +00:00
|
|
|
|
*
|
2008-04-11 09:09:14 +00:00
|
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2002-11-18 14:54:26 +00:00
|
|
|
|
*
|
2008-04-11 09:09:14 +00:00
|
|
|
|
* This file is part of OpenOffice.org.
|
2002-11-18 14:54:26 +00:00
|
|
|
|
*
|
2008-04-11 09:09:14 +00:00
|
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
|
* only, as published by the Free Software Foundation.
|
2002-11-18 14:54:26 +00:00
|
|
|
|
*
|
2008-04-11 09:09:14 +00:00
|
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2002-11-18 14:54:26 +00:00
|
|
|
|
*
|
2008-04-11 09:09:14 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
|
* for a copy of the LGPLv3 License.
|
2002-11-18 14:54:26 +00:00
|
|
|
|
*
|
|
|
|
|
************************************************************************/
|
2006-09-16 23:38:17 +00:00
|
|
|
|
|
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
|
#include "precompiled_automation.hxx"
|
2002-11-18 14:54:26 +00:00
|
|
|
|
#include <vcl/keycod.hxx>
|
2005-04-13 08:54:41 +00:00
|
|
|
|
#include <basic/sbx.hxx>
|
2002-11-18 14:54:26 +00:00
|
|
|
|
#include <tools/stream.hxx>
|
|
|
|
|
|
|
|
|
|
#include "cmdstrm.hxx"
|
|
|
|
|
#include "rcontrol.hxx"
|
|
|
|
|
#include "objtest.hxx"
|
2011-08-01 12:26:20 +01:00
|
|
|
|
#include "ittresid.hxx"
|
2002-11-18 14:54:26 +00:00
|
|
|
|
#include "svcommstream.hxx"
|
|
|
|
|
#include <basic/testtool.hrc>
|
|
|
|
|
|
2010-12-12 09:17:59 +01:00
|
|
|
|
ControlDefLoad const CmdStream::arKeyCodes [] =
|
2002-11-18 14:54:26 +00:00
|
|
|
|
#include <keycodes.hxx>
|
|
|
|
|
CNames *CmdStream::pKeyCodes = NULL;
|
|
|
|
|
|
2011-08-01 12:26:20 +01:00
|
|
|
|
ResMgr* IttResId::getIttResMgr()
|
2007-04-26 08:40:01 +00:00
|
|
|
|
{
|
|
|
|
|
static ResMgr* pMgr = NULL;
|
|
|
|
|
if( ! pMgr )
|
|
|
|
|
pMgr = CREATEVERSIONRESMGR( stt );
|
|
|
|
|
return pMgr;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-18 14:54:26 +00:00
|
|
|
|
CmdStream::CmdStream()
|
|
|
|
|
{
|
|
|
|
|
pSammel = new SvMemoryStream();
|
|
|
|
|
pCommStream = new SvCommStream( pSammel );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CmdStream::~CmdStream()
|
|
|
|
|
{
|
|
|
|
|
delete pCommStream;
|
|
|
|
|
delete pSammel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define PUT_CHAR(ch) \
|
2011-01-12 11:34:50 +01:00
|
|
|
|
sal_uInt16 nMCode = nModify + ch; \
|
|
|
|
|
sal_uInt16 _Code = 1; \
|
2002-11-18 14:54:26 +00:00
|
|
|
|
if ( (nMCode & 0xFF) == 0 ) \
|
|
|
|
|
_Code |= 2; \
|
|
|
|
|
if ( (nMCode >> 8) == 0 ) \
|
|
|
|
|
_Code |= 4; \
|
|
|
|
|
Result += (char) _Code; \
|
|
|
|
|
Result += (char) ( nMCode & 0xFF ); \
|
|
|
|
|
Result += (char) ( nMCode >> 8 )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String CmdStream::WandleKeyEventString( String aKeys )
|
|
|
|
|
{
|
|
|
|
|
if ( !pKeyCodes )
|
|
|
|
|
ReadFlatArray(arKeyCodes,pKeyCodes);
|
|
|
|
|
if ( !pKeyCodes )
|
|
|
|
|
return aKeys;
|
|
|
|
|
|
|
|
|
|
xub_StrLen nPos1 = 0;
|
|
|
|
|
while ( (nPos1 = aKeys.Search('<',nPos1)) != STRING_NOTFOUND)
|
|
|
|
|
{
|
|
|
|
|
xub_StrLen nPos2 = aKeys.Search('>',nPos1);
|
|
|
|
|
if ( nPos2 != STRING_NOTFOUND )
|
|
|
|
|
{
|
|
|
|
|
String Work = aKeys.Copy(nPos1+1,nPos2-nPos1+1-2);
|
2011-08-22 11:39:37 +02:00
|
|
|
|
aKeys.Erase(nPos1,nPos2-nPos1+1); // includes removing <>'s
|
2002-11-18 14:54:26 +00:00
|
|
|
|
String Result, Token;
|
2011-01-12 11:34:50 +01:00
|
|
|
|
sal_uInt16 nModify = 0;
|
2002-11-18 14:54:26 +00:00
|
|
|
|
while ( Work.Len() > 0 )
|
|
|
|
|
{
|
|
|
|
|
Token = Work.GetToken(0,' ');
|
|
|
|
|
Work.Erase(0,Token.Len()+1);
|
2010-06-04 13:46:22 +02:00
|
|
|
|
ControlDef WhatName(Token,rtl::OString());
|
2011-01-12 11:34:50 +01:00
|
|
|
|
sal_uInt16 nElement;
|
2002-11-18 14:54:26 +00:00
|
|
|
|
if (pKeyCodes->Seek_Entry(&WhatName,&nElement))
|
|
|
|
|
{
|
2010-06-04 13:46:22 +02:00
|
|
|
|
// FIXME: HELPID
|
2011-01-12 11:34:50 +01:00
|
|
|
|
sal_uInt16 nCode = 0;//(sal_uInt16) pKeyCodes->GetObject(nElement)->pData->aUId.GetNum();
|
2002-11-18 14:54:26 +00:00
|
|
|
|
if ( nCode >= KEY_SHIFT )
|
|
|
|
|
nModify ^= nCode;
|
|
|
|
|
else
|
|
|
|
|
{
|
2003-03-18 15:03:50 +00:00
|
|
|
|
if ( ( nModify == 0 ) &&
|
2002-11-18 14:54:26 +00:00
|
|
|
|
(((nCode & 0xFF00) == KEYGROUP_NUM) ||
|
|
|
|
|
((nCode & 0xFF00) == KEYGROUP_ALPHA) ||
|
|
|
|
|
( nCode == KEY_SPACE) ||
|
|
|
|
|
( nCode == KEY_ADD) ||
|
|
|
|
|
( nCode == KEY_SUBTRACT) ||
|
|
|
|
|
( nCode == KEY_MULTIPLY) ||
|
|
|
|
|
( nCode == KEY_DIVIDE) ||
|
|
|
|
|
( nCode == KEY_POINT) ||
|
|
|
|
|
( nCode == KEY_COMMA) ||
|
|
|
|
|
( nCode == KEY_LESS) ||
|
|
|
|
|
( nCode == KEY_GREATER) ||
|
|
|
|
|
( nCode == KEY_EQUAL) ) )
|
|
|
|
|
{
|
|
|
|
|
switch ( nCode )
|
|
|
|
|
{
|
|
|
|
|
case KEY_SPACE: Token = ' '; break;
|
|
|
|
|
case KEY_ADD: Token = '+'; break;
|
|
|
|
|
case KEY_SUBTRACT: Token = '-'; break;
|
|
|
|
|
case KEY_MULTIPLY: Token = '*'; break;
|
|
|
|
|
case KEY_DIVIDE: Token = '/'; break;
|
|
|
|
|
case KEY_POINT: Token = '.'; break;
|
|
|
|
|
case KEY_COMMA: Token = ','; break;
|
|
|
|
|
case KEY_LESS: Token = '<'; break;
|
|
|
|
|
case KEY_GREATER: Token = '>'; break;
|
|
|
|
|
case KEY_EQUAL: Token = '='; break;
|
|
|
|
|
default:
|
|
|
|
|
// if ( nModify == 0 )
|
|
|
|
|
// Token.ToLower();
|
|
|
|
|
// else
|
|
|
|
|
// Token.ToUpper();
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
Result += Token;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PUT_CHAR (nCode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Result += '<';
|
|
|
|
|
Result += Token;
|
|
|
|
|
Result += ' ';
|
2011-08-01 12:26:20 +01:00
|
|
|
|
Result += String( IttResId( S_INVALID_KEYCODE ) );
|
2002-11-18 14:54:26 +00:00
|
|
|
|
Result += '>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
aKeys.Insert(Result,nPos1);
|
2006-10-12 10:18:23 +00:00
|
|
|
|
nPos1 = nPos1 + Result.Len();
|
2002-11-18 14:54:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
nPos1 = aKeys.Len() + 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return aKeys;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-01-12 11:34:50 +01:00
|
|
|
|
void CmdStream::WriteSortedParams( SbxArray* rPar, sal_Bool IsKeyString )
|
2002-11-18 14:54:26 +00:00
|
|
|
|
{
|
2011-01-12 11:34:50 +01:00
|
|
|
|
sal_uInt16 nParams = PARAM_NONE;
|
|
|
|
|
sal_uInt16 nNr1=0,nNr2=0,nNr3=0,nNr4=0;
|
2011-08-21 18:12:16 -05:00
|
|
|
|
comm_UINT32 nLNr1=0;
|
2002-11-18 14:54:26 +00:00
|
|
|
|
String aString1,aString2;
|
2011-01-12 11:34:50 +01:00
|
|
|
|
sal_Bool bBool1=sal_False,bBool2=sal_False;
|
2002-11-18 14:54:26 +00:00
|
|
|
|
|
|
|
|
|
if ( rPar )
|
|
|
|
|
{
|
2011-01-12 11:34:50 +01:00
|
|
|
|
for ( sal_uInt16 i = 1; i < rPar->Count() ; i++)
|
2002-11-18 14:54:26 +00:00
|
|
|
|
{
|
|
|
|
|
switch (rPar->Get( i )->GetType())
|
|
|
|
|
{
|
2011-08-22 11:39:37 +02:00
|
|
|
|
case SbxLONG: // always pass everything as Short
|
2002-11-18 14:54:26 +00:00
|
|
|
|
case SbxULONG:
|
2010-12-21 15:47:58 +00:00
|
|
|
|
case SbxSALINT64:
|
|
|
|
|
case SbxSALUINT64:
|
2002-11-18 14:54:26 +00:00
|
|
|
|
case SbxDOUBLE:
|
|
|
|
|
case SbxINTEGER:
|
|
|
|
|
case SbxBYTE:
|
|
|
|
|
case SbxUSHORT:
|
|
|
|
|
case SbxINT:
|
|
|
|
|
case SbxUINT:
|
|
|
|
|
case SbxSINGLE:
|
2011-08-21 18:12:16 -05:00
|
|
|
|
if ( (nParams & PARAM_UINT16_1) == 0 )
|
2002-11-18 14:54:26 +00:00
|
|
|
|
{
|
2011-08-21 18:12:16 -05:00
|
|
|
|
nParams |= PARAM_UINT16_1;
|
2002-11-18 14:54:26 +00:00
|
|
|
|
nNr1 = rPar->Get( i )->GetUShort();
|
|
|
|
|
}
|
2011-08-21 18:12:16 -05:00
|
|
|
|
else if ( (nParams & PARAM_UINT16_2) == 0 )
|
2002-11-18 14:54:26 +00:00
|
|
|
|
{
|
2011-08-21 18:12:16 -05:00
|
|
|
|
nParams |= PARAM_UINT16_2;
|
2002-11-18 14:54:26 +00:00
|
|
|
|
nNr2 = rPar->Get( i )->GetUShort();
|
|
|
|
|
}
|
2011-08-21 18:12:16 -05:00
|
|
|
|
else if ( (nParams & PARAM_UINT16_3) == 0 )
|
2002-11-18 14:54:26 +00:00
|
|
|
|
{
|
2011-08-21 18:12:16 -05:00
|
|
|
|
nParams |= PARAM_UINT16_3;
|
2002-11-18 14:54:26 +00:00
|
|
|
|
nNr3 = rPar->Get( i )->GetUShort();
|
|
|
|
|
}
|
2011-08-21 18:12:16 -05:00
|
|
|
|
else if ( (nParams & PARAM_UINT16_4) == 0 )
|
2002-11-18 14:54:26 +00:00
|
|
|
|
{
|
2011-08-21 18:12:16 -05:00
|
|
|
|
nParams |= PARAM_UINT16_4;
|
2002-11-18 14:54:26 +00:00
|
|
|
|
nNr4 = rPar->Get( i )->GetUShort();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
SbxBase::SetError( SbxERR_WRONG_ARGS );
|
|
|
|
|
break;
|
2004-12-10 16:13:54 +00:00
|
|
|
|
case SbxOBJECT: // whenever a control is passed. TabPage, MenuBar
|
2002-11-18 14:54:26 +00:00
|
|
|
|
{
|
2006-10-12 10:18:23 +00:00
|
|
|
|
SbxProperty *pMember = NULL;
|
|
|
|
|
if ( rPar->Get( i )->ISA( SbxObject ) )
|
|
|
|
|
pMember = ((SbxObject*)rPar->Get( i ))->GetDfltProperty();
|
|
|
|
|
if ( pMember != NULL )
|
2004-12-10 16:13:54 +00:00
|
|
|
|
{
|
|
|
|
|
if ( pMember->GetType() == SbxSTRING )
|
|
|
|
|
{
|
|
|
|
|
if ( nParams & PARAM_STR_1 )
|
|
|
|
|
if ( nParams & PARAM_STR_2 )
|
|
|
|
|
SbxBase::SetError( SbxERR_WRONG_ARGS );
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nParams |= PARAM_STR_2;
|
|
|
|
|
aString2 = pMember->GetString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nParams |= PARAM_STR_1;
|
|
|
|
|
aString1 = pMember->GetString();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if ( pMember->GetType() == SbxULONG )
|
|
|
|
|
{
|
2011-08-21 18:12:16 -05:00
|
|
|
|
if ( nParams & PARAM_UINT32_1 )
|
2004-12-10 16:13:54 +00:00
|
|
|
|
SbxBase::SetError( SbxERR_WRONG_ARGS );
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-08-21 18:12:16 -05:00
|
|
|
|
nParams |= PARAM_UINT32_1;
|
2004-12-10 16:13:54 +00:00
|
|
|
|
nLNr1 = pMember->GetULong();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
SbxBase::SetError( SbxERR_NAMED_NOT_FOUND );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SbxBase::SetError( SbxERR_NAMED_NOT_FOUND );
|
|
|
|
|
}
|
2002-11-18 14:54:26 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case SbxSTRING:
|
|
|
|
|
case SbxCHAR:
|
|
|
|
|
if ( nParams & PARAM_STR_1 )
|
|
|
|
|
if ( nParams & PARAM_STR_2 )
|
|
|
|
|
SbxBase::SetError( SbxERR_WRONG_ARGS );
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nParams |= PARAM_STR_2;
|
|
|
|
|
aString2 = rPar->Get( i )->GetString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nParams |= PARAM_STR_1;
|
|
|
|
|
aString1 = rPar->Get( i )->GetString();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case SbxBOOL:
|
|
|
|
|
if ( nParams & PARAM_BOOL_1 )
|
|
|
|
|
if ( nParams & PARAM_BOOL_2 )
|
|
|
|
|
SbxBase::SetError( SbxERR_WRONG_ARGS );
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nParams |= PARAM_BOOL_2;
|
|
|
|
|
bBool2 = rPar->Get( i )->GetBool();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nParams |= PARAM_BOOL_1;
|
|
|
|
|
bBool1 = rPar->Get( i )->GetBool();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
SbxBase::SetError( SbxERR_WRONG_ARGS );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Write (nParams);
|
2011-08-21 18:12:16 -05:00
|
|
|
|
if( nParams & PARAM_UINT16_1 ) Write( nNr1 );
|
|
|
|
|
if( nParams & PARAM_UINT16_2 ) Write( nNr2 );
|
|
|
|
|
if( nParams & PARAM_UINT16_3 ) Write( nNr3 );
|
|
|
|
|
if( nParams & PARAM_UINT16_4 ) Write( nNr4 );
|
|
|
|
|
if( nParams & PARAM_UINT32_1 ) Write( nLNr1 );
|
2002-11-18 14:54:26 +00:00
|
|
|
|
if( nParams & PARAM_STR_1 ) Write( aString1, IsKeyString );
|
|
|
|
|
if( nParams & PARAM_STR_2 ) Write( aString2, IsKeyString );
|
|
|
|
|
if( nParams & PARAM_BOOL_1 ) Write( bBool1 );
|
|
|
|
|
if( nParams & PARAM_BOOL_2 ) Write( bBool2 );
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-12 11:34:50 +01:00
|
|
|
|
void CmdStream::GenCmdCommand( sal_uInt16 nNr, SbxArray* rPar )
|
2002-11-18 14:54:26 +00:00
|
|
|
|
{
|
2011-01-12 11:34:50 +01:00
|
|
|
|
Write(sal_uInt16(SICommand));
|
2002-11-18 14:54:26 +00:00
|
|
|
|
Write(nNr);
|
|
|
|
|
WriteSortedParams(rPar, (nNr & M_KEY_STRING) != 0 );
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-12 11:34:50 +01:00
|
|
|
|
void CmdStream::GenCmdSlot( sal_uInt16 nNr, SbxArray* rPar )
|
2002-11-18 14:54:26 +00:00
|
|
|
|
{
|
2011-01-12 11:34:50 +01:00
|
|
|
|
Write(sal_uInt16(SISlot));
|
2002-11-18 14:54:26 +00:00
|
|
|
|
Write(nNr);
|
|
|
|
|
if (rPar)
|
|
|
|
|
{
|
2011-08-22 11:39:37 +02:00
|
|
|
|
sal_uInt16 nAnz = (rPar->Count()-1) >> 1;
|
2002-11-18 14:54:26 +00:00
|
|
|
|
Write(nAnz);
|
2011-01-12 11:34:50 +01:00
|
|
|
|
sal_Bool bWriteUnoSlot = rPar->Get( 1 )->GetType() == SbxSTRING;
|
2002-11-18 14:54:26 +00:00
|
|
|
|
|
2011-01-12 11:34:50 +01:00
|
|
|
|
for (sal_uInt16 n = 1 ; n <= nAnz ; n++)
|
2002-11-18 14:54:26 +00:00
|
|
|
|
{
|
2011-08-22 11:39:37 +02:00
|
|
|
|
/// #59513# not necessary anymore
|
2011-01-12 11:34:50 +01:00
|
|
|
|
// sal_uLong nUserData = rPar->Get( 2*n-1 )->GetUserData();
|
2011-08-22 11:39:37 +02:00
|
|
|
|
// rPar->Get( 2*n-1 )->SetUserData(ID_DoNothing); // prevents execution of the slots that are passed as parameters
|
2002-11-18 14:54:26 +00:00
|
|
|
|
|
|
|
|
|
if ( bWriteUnoSlot )
|
|
|
|
|
Write(rPar->Get( 2*n-1 )->GetString());
|
|
|
|
|
else
|
|
|
|
|
Write(rPar->Get( 2*n-1 )->GetUShort());
|
|
|
|
|
switch (rPar->Get( 2*n )->GetType())
|
|
|
|
|
{
|
|
|
|
|
case SbxINTEGER:
|
|
|
|
|
case SbxBYTE:
|
|
|
|
|
case SbxUSHORT:
|
|
|
|
|
case SbxINT:
|
|
|
|
|
case SbxUINT:
|
|
|
|
|
case SbxSINGLE:
|
|
|
|
|
if ( !bWriteUnoSlot )
|
2011-08-21 18:12:16 -05:00
|
|
|
|
Write( (sal_uInt16)BinUINT16 );
|
2002-11-18 14:54:26 +00:00
|
|
|
|
Write(rPar->Get( 2*n )->GetUShort());
|
|
|
|
|
break;
|
|
|
|
|
case SbxLONG:
|
|
|
|
|
case SbxULONG:
|
2010-12-21 15:47:58 +00:00
|
|
|
|
case SbxSALINT64:
|
|
|
|
|
case SbxSALUINT64:
|
2002-11-18 14:54:26 +00:00
|
|
|
|
case SbxDOUBLE:
|
|
|
|
|
if ( !bWriteUnoSlot )
|
2011-08-21 18:12:16 -05:00
|
|
|
|
Write( (sal_uInt16)BinUINT32 );
|
2002-11-18 14:54:26 +00:00
|
|
|
|
Write(rPar->Get( 2*n )->GetULong());
|
|
|
|
|
break;
|
|
|
|
|
case SbxSTRING:
|
|
|
|
|
case SbxCHAR:
|
|
|
|
|
if ( !bWriteUnoSlot )
|
2011-01-12 11:34:50 +01:00
|
|
|
|
Write( (sal_uInt16)BinString);
|
2011-08-22 11:39:37 +02:00
|
|
|
|
Write((String)rPar->Get( 2*n )->GetString()); // Cast for OS/2
|
2002-11-18 14:54:26 +00:00
|
|
|
|
break;
|
|
|
|
|
case SbxBOOL:
|
|
|
|
|
if ( !bWriteUnoSlot )
|
2011-01-12 11:34:50 +01:00
|
|
|
|
Write( (sal_uInt16)BinBool);
|
2002-11-18 14:54:26 +00:00
|
|
|
|
Write(rPar->Get( 2*n )->GetBool());
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
SbxBase::SetError( SbxERR_WRONG_ARGS );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2007-04-26 08:40:01 +00:00
|
|
|
|
/// #59513# nicht mehr ben<65>tigt ( siehe oben )
|
|
|
|
|
// rPar->Get( 2*n-1 )->SetUserData(nUserData); // Und wieder zur<75>cksetzen, so da<64> auch alles sauber ist.
|
2002-11-18 14:54:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2011-01-12 11:34:50 +01:00
|
|
|
|
Write(sal_uInt16(0));
|
2002-11-18 14:54:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CmdStream::GenCmdUNOSlot( const String &aURL )
|
|
|
|
|
{
|
2011-01-12 11:34:50 +01:00
|
|
|
|
Write( sal_uInt16(SIUnoSlot) );
|
2011-08-22 11:39:37 +02:00
|
|
|
|
/* Write( sal_uInt16(0) ); // The SID_OPENURL is entered here.
|
|
|
|
|
// That must be wired hard in the Office and not here of course
|
|
|
|
|
// as the ID might change
|
2002-11-18 14:54:26 +00:00
|
|
|
|
|
2011-08-22 11:39:37 +02:00
|
|
|
|
// Because the ID must also be taken for the PoolItem from the Office, it is not
|
|
|
|
|
// necessary to send a PoolItem here.
|
2002-11-18 14:54:26 +00:00
|
|
|
|
|
2011-08-22 11:39:37 +02:00
|
|
|
|
Write( sal_uInt16(0) ); // number of PoolItems
|
2002-11-18 14:54:26 +00:00
|
|
|
|
|
2011-08-22 11:39:37 +02:00
|
|
|
|
// instead there's an extra string sent by the Office which is changed to an
|
|
|
|
|
// SfxStringItem with the respective ID
|
|
|
|
|
Write( aURL ); // String for the PoolItem*/
|
2002-11-18 14:54:26 +00:00
|
|
|
|
|
2011-08-22 11:39:37 +02:00
|
|
|
|
Write( aURL ); // UNO URL
|
2002-11-18 14:54:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-08-21 18:12:16 -05:00
|
|
|
|
void CmdStream::GenCmdControl( comm_UINT32 nUId, sal_uInt16 nMethodId, SbxArray* rPar )
|
2002-11-18 14:54:26 +00:00
|
|
|
|
{
|
2011-01-12 11:34:50 +01:00
|
|
|
|
Write(sal_uInt16(SIControl));
|
2002-11-18 14:54:26 +00:00
|
|
|
|
Write(nUId);
|
|
|
|
|
Write(nMethodId);
|
|
|
|
|
WriteSortedParams(rPar, (nMethodId & M_KEY_STRING) != 0 );
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-12 11:34:50 +01:00
|
|
|
|
void CmdStream::GenCmdControl( String aUId, sal_uInt16 nMethodId, SbxArray* rPar )
|
2002-11-18 14:54:26 +00:00
|
|
|
|
{
|
2011-01-12 11:34:50 +01:00
|
|
|
|
Write(sal_uInt16(SIStringControl));
|
2002-11-18 14:54:26 +00:00
|
|
|
|
Write(aUId);
|
|
|
|
|
Write(nMethodId);
|
|
|
|
|
WriteSortedParams(rPar, (nMethodId & M_KEY_STRING) != 0 );
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-12 11:34:50 +01:00
|
|
|
|
void CmdStream::GenCmdFlow( sal_uInt16 nArt )
|
2002-11-18 14:54:26 +00:00
|
|
|
|
{
|
2011-01-12 11:34:50 +01:00
|
|
|
|
Write(sal_uInt16(SIFlow));
|
2002-11-18 14:54:26 +00:00
|
|
|
|
Write(nArt);
|
2011-08-22 11:39:37 +02:00
|
|
|
|
Write(sal_uInt16(PARAM_NONE)); // type of the following parameters
|
2002-11-18 14:54:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-05-24 10:10:13 +01:00
|
|
|
|
void CmdStream::GenCmdFlow( sal_uInt16 nArt, comm_UINT32 nNr1 )
|
2002-11-18 14:54:26 +00:00
|
|
|
|
{
|
2011-01-12 11:34:50 +01:00
|
|
|
|
Write(sal_uInt16(SIFlow));
|
2002-11-18 14:54:26 +00:00
|
|
|
|
Write(nArt);
|
2011-08-22 11:39:37 +02:00
|
|
|
|
Write(sal_uInt16(PARAM_UINT32_1)); // type of the following parameters
|
2002-11-18 14:54:26 +00:00
|
|
|
|
Write(nNr1);
|
|
|
|
|
}
|
|
|
|
|
|
2011-01-12 11:34:50 +01:00
|
|
|
|
void CmdStream::Write( String aString, sal_Bool IsKeyString )
|
2002-11-18 14:54:26 +00:00
|
|
|
|
{
|
|
|
|
|
if ( IsKeyString )
|
2011-01-12 11:34:50 +01:00
|
|
|
|
Write( WandleKeyEventString( aString ), sal_False );
|
2002-11-18 14:54:26 +00:00
|
|
|
|
else
|
|
|
|
|
Write( aString.GetBuffer(), aString.Len() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SvMemoryStream* CmdStream::GetStream()
|
|
|
|
|
{
|
|
|
|
|
return pSammel;
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-21 18:12:16 -05:00
|
|
|
|
void CmdStream::Reset( comm_UINT32 nSequence )
|
2002-11-18 14:54:26 +00:00
|
|
|
|
{
|
|
|
|
|
delete pCommStream;
|
|
|
|
|
delete pSammel;
|
|
|
|
|
pSammel = new SvMemoryStream();
|
|
|
|
|
pCommStream = new SvCommStream( pSammel );
|
|
|
|
|
GenCmdFlow (F_Sequence,nSequence);
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-12 15:57:08 +02:00
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|