1*9d1279ecSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*9d1279ecSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*9d1279ecSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*9d1279ecSAndrew Rist * distributed with this work for additional information
6*9d1279ecSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*9d1279ecSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*9d1279ecSAndrew Rist * "License"); you may not use this file except in compliance
9*9d1279ecSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*9d1279ecSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*9d1279ecSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*9d1279ecSAndrew Rist * software distributed under the License is distributed on an
15*9d1279ecSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9d1279ecSAndrew Rist * KIND, either express or implied. See the License for the
17*9d1279ecSAndrew Rist * specific language governing permissions and limitations
18*9d1279ecSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*9d1279ecSAndrew Rist *************************************************************/
21*9d1279ecSAndrew Rist
22*9d1279ecSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_automation.hxx"
26cdf0e10cSrcweir #include <svl/intitem.hxx>
27cdf0e10cSrcweir #include <svl/stritem.hxx>
28cdf0e10cSrcweir #include <svl/eitem.hxx>
29cdf0e10cSrcweir #include "scmdstrm.hxx"
30cdf0e10cSrcweir #include "svcommstream.hxx"
31cdf0e10cSrcweir #include "rcontrol.hxx"
32cdf0e10cSrcweir
33cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
34cdf0e10cSrcweir #include "editwin.hxx"
35cdf0e10cSrcweir #include "statemnt.hxx"
36cdf0e10cSrcweir #endif
37cdf0e10cSrcweir
SCmdStream(SvStream * pIn)38cdf0e10cSrcweir SCmdStream::SCmdStream(SvStream *pIn)
39cdf0e10cSrcweir {
40cdf0e10cSrcweir pSammel = pIn;
41cdf0e10cSrcweir pCommStream = new SvCommStream( pSammel );
42cdf0e10cSrcweir // SetCommStream( pCommStream );
43cdf0e10cSrcweir }
44cdf0e10cSrcweir
~SCmdStream()45cdf0e10cSrcweir SCmdStream::~SCmdStream()
46cdf0e10cSrcweir {
47cdf0e10cSrcweir delete pCommStream;
48cdf0e10cSrcweir }
49cdf0e10cSrcweir
Read(String * & pString)50cdf0e10cSrcweir void SCmdStream::Read (String* &pString)
51cdf0e10cSrcweir {
52cdf0e10cSrcweir if ( !pString )
53cdf0e10cSrcweir pString = new String();
54cdf0e10cSrcweir comm_UniChar* pStr;
55cdf0e10cSrcweir sal_uInt16 nLenInChars;
56cdf0e10cSrcweir CmdBaseStream::Read( pStr, nLenInChars );
57cdf0e10cSrcweir
58cdf0e10cSrcweir *pString = String( pStr, nLenInChars );
59cdf0e10cSrcweir delete [] pStr;
60cdf0e10cSrcweir }
61cdf0e10cSrcweir
Read(String & aString)62cdf0e10cSrcweir void SCmdStream::Read (String &aString)
63cdf0e10cSrcweir {
64cdf0e10cSrcweir comm_UniChar* pStr;
65cdf0e10cSrcweir sal_uInt16 nLenInChars;
66cdf0e10cSrcweir CmdBaseStream::Read( pStr, nLenInChars );
67cdf0e10cSrcweir
68cdf0e10cSrcweir aString = String( pStr, nLenInChars );
69cdf0e10cSrcweir delete [] pStr;
70cdf0e10cSrcweir }
71cdf0e10cSrcweir
Read(SfxPoolItem * & pItem)72cdf0e10cSrcweir void SCmdStream::Read ( SfxPoolItem *&pItem )
73cdf0e10cSrcweir {
74cdf0e10cSrcweir sal_uInt16 nType;
75cdf0e10cSrcweir sal_uInt16 nId;
76cdf0e10cSrcweir Read(nId);
77cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
78cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "Parameter: " );
79cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( String::CreateFromInt32( nId ) );
80cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( " " );
81cdf0e10cSrcweir #endif
82cdf0e10cSrcweir Read( nType );
83cdf0e10cSrcweir switch (nType)
84cdf0e10cSrcweir {
85cdf0e10cSrcweir case BinUSHORT:
86cdf0e10cSrcweir {
87cdf0e10cSrcweir comm_USHORT nNr;
88cdf0e10cSrcweir Read (nNr );
89cdf0e10cSrcweir pItem = new SfxUInt16Item(nId,nNr);
90cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
91cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "USHORT:" );
92cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( String::CreateFromInt32( nNr ) );
93cdf0e10cSrcweir #endif
94cdf0e10cSrcweir }
95cdf0e10cSrcweir break;
96cdf0e10cSrcweir case BinULONG:
97cdf0e10cSrcweir {
98cdf0e10cSrcweir comm_ULONG nNr;
99cdf0e10cSrcweir Read (nNr );
100cdf0e10cSrcweir pItem = new SfxUInt32Item(nId,nNr);
101cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
102cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "ULONG:" );
103cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( String::CreateFromInt64( nNr ) );
104cdf0e10cSrcweir #endif
105cdf0e10cSrcweir }
106cdf0e10cSrcweir break;
107cdf0e10cSrcweir case BinString:
108cdf0e10cSrcweir {
109cdf0e10cSrcweir String aString;
110cdf0e10cSrcweir Read (aString);
111cdf0e10cSrcweir
112cdf0e10cSrcweir pItem = new SfxStringItem(nId,aString);
113cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
114cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "String:" );
115cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( aString );
116cdf0e10cSrcweir #endif
117cdf0e10cSrcweir }
118cdf0e10cSrcweir break;
119cdf0e10cSrcweir case BinBool:
120cdf0e10cSrcweir {
121cdf0e10cSrcweir comm_BOOL bBool;
122cdf0e10cSrcweir Read (bBool);
123cdf0e10cSrcweir pItem = new SfxBoolItem(nId,bBool);
124cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
125cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "BOOL:" );
126cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( bBool ? "TRUE" : "FALSE" );
127cdf0e10cSrcweir #endif
128cdf0e10cSrcweir }
129cdf0e10cSrcweir break;
130cdf0e10cSrcweir default:
131cdf0e10cSrcweir DBG_ERROR1( "Ung�ltiger Typ im Stream:%hu", nType );
132cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
133cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "Ung�ltiger Typ !!!! " );
134cdf0e10cSrcweir #endif
135cdf0e10cSrcweir break;
136cdf0e10cSrcweir }
137cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
138cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "\n" );
139cdf0e10cSrcweir #endif
140cdf0e10cSrcweir }
141cdf0e10cSrcweir
Read(::com::sun::star::beans::PropertyValue & rItem)142cdf0e10cSrcweir void SCmdStream::Read ( ::com::sun::star::beans::PropertyValue &rItem )
143cdf0e10cSrcweir {
144cdf0e10cSrcweir sal_uInt16 nType;
145cdf0e10cSrcweir String aId;
146cdf0e10cSrcweir Read(aId);
147cdf0e10cSrcweir rItem.Name = rtl::OUString( aId );
148cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
149cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "Parameter: " );
150cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( aId );
151cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( " " );
152cdf0e10cSrcweir #endif
153cdf0e10cSrcweir nType = GetNextType();
154cdf0e10cSrcweir switch (nType)
155cdf0e10cSrcweir {
156cdf0e10cSrcweir case BinUSHORT:
157cdf0e10cSrcweir {
158cdf0e10cSrcweir comm_USHORT nNr;
159cdf0e10cSrcweir Read (nNr );
160cdf0e10cSrcweir rItem.Value <<= nNr;
161cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
162cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "USHORT:" );
163cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( String::CreateFromInt32( nNr ) );
164cdf0e10cSrcweir #endif
165cdf0e10cSrcweir }
166cdf0e10cSrcweir break;
167cdf0e10cSrcweir case BinULONG:
168cdf0e10cSrcweir {
169cdf0e10cSrcweir comm_ULONG nNr;
170cdf0e10cSrcweir Read (nNr );
171cdf0e10cSrcweir rItem.Value <<= nNr;
172cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
173cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "ULONG:" );
174cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( String::CreateFromInt64( nNr ) );
175cdf0e10cSrcweir #endif
176cdf0e10cSrcweir }
177cdf0e10cSrcweir break;
178cdf0e10cSrcweir case BinString:
179cdf0e10cSrcweir {
180cdf0e10cSrcweir String aString;
181cdf0e10cSrcweir Read (aString);
182cdf0e10cSrcweir rItem.Value <<= ::rtl::OUString( aString );
183cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
184cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "String:" );
185cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( aString );
186cdf0e10cSrcweir #endif
187cdf0e10cSrcweir }
188cdf0e10cSrcweir break;
189cdf0e10cSrcweir case BinBool:
190cdf0e10cSrcweir {
191cdf0e10cSrcweir comm_BOOL bBool;
192cdf0e10cSrcweir Read (bBool);
193cdf0e10cSrcweir rItem.Value <<= bBool;
194cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
195cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "BOOL:" );
196cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( bBool ? "TRUE" : "FALSE" );
197cdf0e10cSrcweir #endif
198cdf0e10cSrcweir }
199cdf0e10cSrcweir break;
200cdf0e10cSrcweir default:
201cdf0e10cSrcweir DBG_ERROR1( "Ung�ltiger Typ im Stream:%hu", nType );
202cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
203cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "Ung�ltiger Typ !!!! " );
204cdf0e10cSrcweir #endif
205cdf0e10cSrcweir break;
206cdf0e10cSrcweir }
207cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1
208cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "\n" );
209cdf0e10cSrcweir #endif
210cdf0e10cSrcweir }
211cdf0e10cSrcweir
212