1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_automation.hxx"
30 #include <tools/stream.hxx>
31 #include <basic/ttstrhlp.hxx>
32 
33 #include "retstrm.hxx"
34 #include "rcontrol.hxx"
35 #include "svcommstream.hxx"
36 
37 
38 RetStream::RetStream()
39 {
40 	pSammel = new SvMemoryStream();
41 	pCommStream = new SvCommStream( pSammel );
42 //	SetCommStream( pCommStream );
43 }
44 
45 RetStream::~RetStream()
46 {
47 	delete pCommStream;
48 	delete pSammel;
49 }
50 
51 void RetStream::GenError ( rtl::OString aUId, String aString )
52 {
53     CmdBaseStream::GenError ( &aUId, &aString );
54 }
55 
56 void RetStream::GenReturn ( sal_uInt16 nRet, rtl::OString aUId, String aString )
57 {
58     CmdBaseStream::GenReturn ( nRet, &aUId, &aString );
59 }
60 
61 void RetStream::GenReturn ( sal_uInt16 nRet, rtl::OString aUId, comm_ULONG nNr, String aString, sal_Bool bBool )
62 {
63     CmdBaseStream::GenReturn ( nRet, &aUId, nNr, &aString, bBool );
64 }
65 
66 // MacroRecorder
67 void RetStream::GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_USHORT nMethod, String aString )
68 {
69     CmdBaseStream::GenReturn ( nRet, &aUId, nMethod, &aString );
70 }
71 
72 void RetStream::GenReturn( sal_uInt16 nRet, rtl::OString aUId, comm_USHORT nMethod, String aString, sal_Bool bBool )
73 {
74     CmdBaseStream::GenReturn ( nRet, &aUId, nMethod, &aString, bBool );
75 }
76 
77 
78 void RetStream::GenReturn ( sal_uInt16 nRet, sal_uInt16 nMethod, SbxValue &aValue )
79 {
80 	Write(sal_uInt16(SIReturn));
81 	Write(nRet);
82 	Write((comm_ULONG)nMethod); //HELPID BACKWARD (no sal_uLong needed)
83 	Write(sal_uInt16(PARAM_SBXVALUE_1));		// Typ der folgenden Parameter
84 	Write(aValue);
85 }
86 
87 void RetStream::GenReturn( sal_uInt16 nRet, sal_uInt16 nMethod, String aString )
88 {
89     CmdBaseStream::GenReturn ( nRet, nMethod, &aString );
90 }
91 
92 
93 
94 
95 void RetStream::Write( String *pString )
96 {
97 	CmdBaseStream::Write( pString->GetBuffer(), pString->Len() );
98 }
99 
100 void RetStream::Write( SbxValue &aValue )
101 {
102 	*pSammel << sal_uInt16( BinSbxValue );
103 	aValue.Store( *pSammel );
104 }
105 
106 void RetStream::Write( rtl::OString* pId )
107 {
108     //HELPID BACKWARD (should use ByteString or OString)
109     String aTmp( Id2Str( *pId ) );
110     Write( &aTmp );
111 }
112 
113 
114 SvStream* RetStream::GetStream()
115 {
116 	return pSammel;
117 }
118 
119 void RetStream::Reset ()
120 {
121 	delete pCommStream;
122 	delete pSammel;
123 	pSammel = new SvMemoryStream();
124 	pCommStream = new SvCommStream( pSammel );
125 //	SetCommStream( pCommStream );
126 }
127 
128