1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_automation.hxx" 30*cdf0e10cSrcweir #include <svl/intitem.hxx> 31*cdf0e10cSrcweir #include <svl/stritem.hxx> 32*cdf0e10cSrcweir #include <svl/eitem.hxx> 33*cdf0e10cSrcweir #include "scmdstrm.hxx" 34*cdf0e10cSrcweir #include "svcommstream.hxx" 35*cdf0e10cSrcweir #include "rcontrol.hxx" 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 38*cdf0e10cSrcweir #include "editwin.hxx" 39*cdf0e10cSrcweir #include "statemnt.hxx" 40*cdf0e10cSrcweir #endif 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir SCmdStream::SCmdStream(SvStream *pIn) 43*cdf0e10cSrcweir { 44*cdf0e10cSrcweir pSammel = pIn; 45*cdf0e10cSrcweir pCommStream = new SvCommStream( pSammel ); 46*cdf0e10cSrcweir // SetCommStream( pCommStream ); 47*cdf0e10cSrcweir } 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir SCmdStream::~SCmdStream() 50*cdf0e10cSrcweir { 51*cdf0e10cSrcweir delete pCommStream; 52*cdf0e10cSrcweir } 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir void SCmdStream::Read (String* &pString) 55*cdf0e10cSrcweir { 56*cdf0e10cSrcweir if ( !pString ) 57*cdf0e10cSrcweir pString = new String(); 58*cdf0e10cSrcweir comm_UniChar* pStr; 59*cdf0e10cSrcweir sal_uInt16 nLenInChars; 60*cdf0e10cSrcweir CmdBaseStream::Read( pStr, nLenInChars ); 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir *pString = String( pStr, nLenInChars ); 63*cdf0e10cSrcweir delete [] pStr; 64*cdf0e10cSrcweir } 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir void SCmdStream::Read (String &aString) 67*cdf0e10cSrcweir { 68*cdf0e10cSrcweir comm_UniChar* pStr; 69*cdf0e10cSrcweir sal_uInt16 nLenInChars; 70*cdf0e10cSrcweir CmdBaseStream::Read( pStr, nLenInChars ); 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir aString = String( pStr, nLenInChars ); 73*cdf0e10cSrcweir delete [] pStr; 74*cdf0e10cSrcweir } 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir void SCmdStream::Read ( SfxPoolItem *&pItem ) 77*cdf0e10cSrcweir { 78*cdf0e10cSrcweir sal_uInt16 nType; 79*cdf0e10cSrcweir sal_uInt16 nId; 80*cdf0e10cSrcweir Read(nId); 81*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 82*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "Parameter: " ); 83*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( String::CreateFromInt32( nId ) ); 84*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( " " ); 85*cdf0e10cSrcweir #endif 86*cdf0e10cSrcweir Read( nType ); 87*cdf0e10cSrcweir switch (nType) 88*cdf0e10cSrcweir { 89*cdf0e10cSrcweir case BinUSHORT: 90*cdf0e10cSrcweir { 91*cdf0e10cSrcweir comm_USHORT nNr; 92*cdf0e10cSrcweir Read (nNr ); 93*cdf0e10cSrcweir pItem = new SfxUInt16Item(nId,nNr); 94*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 95*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "USHORT:" ); 96*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( String::CreateFromInt32( nNr ) ); 97*cdf0e10cSrcweir #endif 98*cdf0e10cSrcweir } 99*cdf0e10cSrcweir break; 100*cdf0e10cSrcweir case BinULONG: 101*cdf0e10cSrcweir { 102*cdf0e10cSrcweir comm_ULONG nNr; 103*cdf0e10cSrcweir Read (nNr ); 104*cdf0e10cSrcweir pItem = new SfxUInt32Item(nId,nNr); 105*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 106*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "ULONG:" ); 107*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( String::CreateFromInt64( nNr ) ); 108*cdf0e10cSrcweir #endif 109*cdf0e10cSrcweir } 110*cdf0e10cSrcweir break; 111*cdf0e10cSrcweir case BinString: 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir String aString; 114*cdf0e10cSrcweir Read (aString); 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir pItem = new SfxStringItem(nId,aString); 117*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 118*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "String:" ); 119*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( aString ); 120*cdf0e10cSrcweir #endif 121*cdf0e10cSrcweir } 122*cdf0e10cSrcweir break; 123*cdf0e10cSrcweir case BinBool: 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir comm_BOOL bBool; 126*cdf0e10cSrcweir Read (bBool); 127*cdf0e10cSrcweir pItem = new SfxBoolItem(nId,bBool); 128*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 129*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "BOOL:" ); 130*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( bBool ? "TRUE" : "FALSE" ); 131*cdf0e10cSrcweir #endif 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir break; 134*cdf0e10cSrcweir default: 135*cdf0e10cSrcweir DBG_ERROR1( "Ung�ltiger Typ im Stream:%hu", nType ); 136*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 137*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "Ung�ltiger Typ !!!! " ); 138*cdf0e10cSrcweir #endif 139*cdf0e10cSrcweir break; 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 142*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "\n" ); 143*cdf0e10cSrcweir #endif 144*cdf0e10cSrcweir } 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir void SCmdStream::Read ( ::com::sun::star::beans::PropertyValue &rItem ) 147*cdf0e10cSrcweir { 148*cdf0e10cSrcweir sal_uInt16 nType; 149*cdf0e10cSrcweir String aId; 150*cdf0e10cSrcweir Read(aId); 151*cdf0e10cSrcweir rItem.Name = rtl::OUString( aId ); 152*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 153*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "Parameter: " ); 154*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( aId ); 155*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( " " ); 156*cdf0e10cSrcweir #endif 157*cdf0e10cSrcweir nType = GetNextType(); 158*cdf0e10cSrcweir switch (nType) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir case BinUSHORT: 161*cdf0e10cSrcweir { 162*cdf0e10cSrcweir comm_USHORT nNr; 163*cdf0e10cSrcweir Read (nNr ); 164*cdf0e10cSrcweir rItem.Value <<= nNr; 165*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 166*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "USHORT:" ); 167*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( String::CreateFromInt32( nNr ) ); 168*cdf0e10cSrcweir #endif 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir break; 171*cdf0e10cSrcweir case BinULONG: 172*cdf0e10cSrcweir { 173*cdf0e10cSrcweir comm_ULONG nNr; 174*cdf0e10cSrcweir Read (nNr ); 175*cdf0e10cSrcweir rItem.Value <<= nNr; 176*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 177*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "ULONG:" ); 178*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( String::CreateFromInt64( nNr ) ); 179*cdf0e10cSrcweir #endif 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir break; 182*cdf0e10cSrcweir case BinString: 183*cdf0e10cSrcweir { 184*cdf0e10cSrcweir String aString; 185*cdf0e10cSrcweir Read (aString); 186*cdf0e10cSrcweir rItem.Value <<= ::rtl::OUString( aString ); 187*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 188*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "String:" ); 189*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( aString ); 190*cdf0e10cSrcweir #endif 191*cdf0e10cSrcweir } 192*cdf0e10cSrcweir break; 193*cdf0e10cSrcweir case BinBool: 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir comm_BOOL bBool; 196*cdf0e10cSrcweir Read (bBool); 197*cdf0e10cSrcweir rItem.Value <<= bBool; 198*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 199*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "BOOL:" ); 200*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( bBool ? "TRUE" : "FALSE" ); 201*cdf0e10cSrcweir #endif 202*cdf0e10cSrcweir } 203*cdf0e10cSrcweir break; 204*cdf0e10cSrcweir default: 205*cdf0e10cSrcweir DBG_ERROR1( "Ung�ltiger Typ im Stream:%hu", nType ); 206*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 207*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "Ung�ltiger Typ !!!! " ); 208*cdf0e10cSrcweir #endif 209*cdf0e10cSrcweir break; 210*cdf0e10cSrcweir } 211*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 1 212*cdf0e10cSrcweir StatementList::m_pDbgWin->AddText( "\n" ); 213*cdf0e10cSrcweir #endif 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir 216