merge the formfield patch from ooo-build
[ooovba.git] / automation / source / server / retstrm.cxx
blob79c34b634be4e1d9dc2300db7691a0ddd4846aa2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: retstrm.cxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_automation.hxx"
33 #include <tools/stream.hxx>
35 #include "retstrm.hxx"
36 #include "rcontrol.hxx"
37 #include "svcommstream.hxx"
40 RetStream::RetStream()
42 pSammel = new SvMemoryStream();
43 pCommStream = new SvCommStream( pSammel );
44 // SetCommStream( pCommStream );
47 RetStream::~RetStream()
49 delete pCommStream;
50 delete pSammel;
53 void RetStream::GenError ( SmartId aUId, String aString )
55 CmdBaseStream::GenError ( &aUId, &aString );
58 void RetStream::GenReturn ( USHORT nRet, SmartId aUId, String aString )
60 CmdBaseStream::GenReturn ( nRet, &aUId, &aString );
63 void RetStream::GenReturn ( USHORT nRet, SmartId aUId, SbxValue &aValue )
65 Write(USHORT(SIReturn));
66 Write(nRet);
67 Write(&aUId);
68 Write(USHORT(PARAM_SBXVALUE_1)); // Typ der folgenden Parameter
69 Write(aValue);
72 void RetStream::GenReturn ( USHORT nRet, SmartId aUId, comm_ULONG nNr, String aString, BOOL bBool )
74 CmdBaseStream::GenReturn ( nRet, &aUId, nNr, &aString, bBool );
77 void RetStream::GenReturn( USHORT nRet, SmartId aUId, comm_USHORT nMethod, String aString )
79 CmdBaseStream::GenReturn ( nRet, &aUId, nMethod, &aString );
82 void RetStream::GenReturn( USHORT nRet, SmartId aUId, comm_USHORT nMethod, String aString, BOOL bBool )
84 CmdBaseStream::GenReturn ( nRet, &aUId, nMethod, &aString, bBool );
88 void RetStream::Write( String *pString )
90 CmdBaseStream::Write( pString->GetBuffer(), pString->Len() );
93 void RetStream::Write( SbxValue &aValue )
95 *pSammel << USHORT( BinSbxValue );
96 aValue.Store( *pSammel );
99 void RetStream::Write( SmartId* pId )
101 DBG_ASSERT( !pId->HasString() || !pId->HasNumeric(), "SmartId contains Number and String. using String only." );
102 if ( pId->HasString() )
104 String aTmp( pId->GetStr() );
105 Write( &aTmp );
107 else
108 Write( static_cast<comm_ULONG>(pId->GetNum()) ); ////GetNum() ULONG != comm_ULONG on 64bit
112 SvStream* RetStream::GetStream()
114 return pSammel;
117 void RetStream::Reset ()
119 delete pCommStream;
120 delete pSammel;
121 pSammel = new SvMemoryStream();
122 pCommStream = new SvCommStream( pSammel );
123 // SetCommStream( pCommStream );