1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_automation.hxx" 26 #include <tools/stream.hxx> 27 #include <basic/ttstrhlp.hxx> 28 29 #include "retstrm.hxx" 30 #include "rcontrol.hxx" 31 #include "svcommstream.hxx" 32 33 34 RetStream::RetStream() 35 { 36 pSammel = new SvMemoryStream(); 37 pCommStream = new SvCommStream( pSammel ); 38 // SetCommStream( pCommStream ); 39 } 40 41 RetStream::~RetStream() 42 { 43 delete pCommStream; 44 delete pSammel; 45 } 46 47 void RetStream::GenError ( rtl::OString aUId, String aString ) 48 { 49 CmdBaseStream::GenError ( &aUId, &aString ); 50 } 51 52 void RetStream::GenReturn ( sal_uInt16 nRet, rtl::OString aUId, String aString ) 53 { 54 CmdBaseStream::GenReturn ( nRet, &aUId, &aString ); 55 } 56 57 void RetStream::GenReturn ( sal_uInt16 nRet, rtl::OString aUId, comm_ULONG nNr, String aString, sal_Bool bBool ) 58 { 59 CmdBaseStream::GenReturn ( nRet, &aUId, nNr, &aString, bBool ); 60 } 61 62 // MacroRecorder 63 void RetStream::GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_USHORT nMethod, String aString ) 64 { 65 CmdBaseStream::GenReturn ( nRet, &aUId, nMethod, &aString ); 66 } 67 68 void RetStream::GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_USHORT nMethod, String aString, sal_Bool bBool ) 69 { 70 CmdBaseStream::GenReturn ( nRet, &aUId, nMethod, &aString, bBool ); 71 } 72 73 74 void RetStream::GenReturn ( sal_uInt16 nRet, sal_uInt16 nMethod, SbxValue &aValue ) 75 { 76 Write(sal_uInt16(SIReturn)); 77 Write(nRet); 78 Write((comm_ULONG)nMethod); //HELPID BACKWARD (no sal_uLong needed) 79 Write(sal_uInt16(PARAM_SBXVALUE_1)); // Typ der folgenden Parameter 80 Write(aValue); 81 } 82 83 void RetStream::GenReturn( sal_uInt16 nRet, sal_uInt16 nMethod, String aString ) 84 { 85 CmdBaseStream::GenReturn ( nRet, nMethod, &aString ); 86 } 87 88 89 90 91 void RetStream::Write( String *pString ) 92 { 93 CmdBaseStream::Write( pString->GetBuffer(), pString->Len() ); 94 } 95 96 void RetStream::Write( SbxValue &aValue ) 97 { 98 *pSammel << sal_uInt16( BinSbxValue ); 99 aValue.Store( *pSammel ); 100 } 101 102 void RetStream::Write( rtl::OString* pId ) 103 { 104 //HELPID BACKWARD (should use ByteString or OString) 105 String aTmp( Id2Str( *pId ) ); 106 Write( &aTmp ); 107 } 108 109 110 SvStream* RetStream::GetStream() 111 { 112 return pSammel; 113 } 114 115 void RetStream::Reset () 116 { 117 delete pCommStream; 118 delete pSammel; 119 pSammel = new SvMemoryStream(); 120 pCommStream = new SvCommStream( pSammel ); 121 // SetCommStream( pCommStream ); 122 } 123 124