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_svl.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #define UNICODE 32*cdf0e10cSrcweir #include <string.h> // memset 33*cdf0e10cSrcweir #include "ddeimp.hxx" 34*cdf0e10cSrcweir #include <svl/svdde.hxx> 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir #include <osl/thread.h> 37*cdf0e10cSrcweir #include <tools/debug.hxx> 38*cdf0e10cSrcweir #include <tools/solarmutex.hxx> 39*cdf0e10cSrcweir #include <vos/mutex.hxx> 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir // static DWORD hDdeInst = NULL; 42*cdf0e10cSrcweir // static short nInstance = 0; 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir // DdeConnections* DdeConnection::pConnections = NULL; 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir DdeInstData* ImpInitInstData() 47*cdf0e10cSrcweir { 48*cdf0e10cSrcweir DdeInstData* pData = new DdeInstData; 49*cdf0e10cSrcweir memset( pData,0,sizeof(DdeInstData) ); 50*cdf0e10cSrcweir DdeInstData** ppInst = (DdeInstData**)GetAppData( SHL_SVDDE ); 51*cdf0e10cSrcweir *ppInst = pData; 52*cdf0e10cSrcweir return pData; 53*cdf0e10cSrcweir } 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir void ImpDeinitInstData() 56*cdf0e10cSrcweir { 57*cdf0e10cSrcweir DdeInstData** ppInst = (DdeInstData**)GetAppData( SHL_SVDDE ); 58*cdf0e10cSrcweir delete (*ppInst); 59*cdf0e10cSrcweir *ppInst = 0; 60*cdf0e10cSrcweir } 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir struct DdeImp 64*cdf0e10cSrcweir { 65*cdf0e10cSrcweir HCONV hConv; 66*cdf0e10cSrcweir long nStatus; 67*cdf0e10cSrcweir }; 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir // --- DdeInternat::CliCallback() ---------------------------------- 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir HDDEDATA CALLBACK DdeInternal::CliCallback( 72*cdf0e10cSrcweir WORD nCode, WORD nCbType, HCONV hConv, HSZ, HSZ hText2, 73*cdf0e10cSrcweir HDDEDATA hData, DWORD nInfo1, DWORD ) 74*cdf0e10cSrcweir { 75*cdf0e10cSrcweir HDDEDATA nRet = DDE_FNOTPROCESSED; 76*cdf0e10cSrcweir DdeConnections& rAll = (DdeConnections&)DdeConnection::GetConnections(); 77*cdf0e10cSrcweir DdeConnection* self = 0; 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir DdeInstData* pInst = ImpGetInstData(); 80*cdf0e10cSrcweir DBG_ASSERT(pInst,"SVDDE:No instance data"); 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir for ( self = rAll.First(); self; self = rAll.Next() ) 83*cdf0e10cSrcweir if ( self->pImp->hConv == hConv ) 84*cdf0e10cSrcweir break; 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir if( self ) 87*cdf0e10cSrcweir { 88*cdf0e10cSrcweir DdeTransaction* t; 89*cdf0e10cSrcweir sal_Bool bFound = sal_False; 90*cdf0e10cSrcweir for( t = self->aTransactions.First(); t; t = self->aTransactions.Next() ) 91*cdf0e10cSrcweir { 92*cdf0e10cSrcweir switch( nCode ) 93*cdf0e10cSrcweir { 94*cdf0e10cSrcweir case XTYP_XACT_COMPLETE: 95*cdf0e10cSrcweir if( (DWORD)t->nId == nInfo1 ) 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir nCode = t->nType & (XCLASS_MASK | XTYP_MASK); 98*cdf0e10cSrcweir t->bBusy = sal_False; 99*cdf0e10cSrcweir t->Done( 0 != hData ); 100*cdf0e10cSrcweir bFound = sal_True; 101*cdf0e10cSrcweir } 102*cdf0e10cSrcweir break; 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir case XTYP_DISCONNECT: 105*cdf0e10cSrcweir self->pImp->hConv = DdeReconnect( hConv ); 106*cdf0e10cSrcweir self->pImp->nStatus = self->pImp->hConv 107*cdf0e10cSrcweir ? DMLERR_NO_ERROR 108*cdf0e10cSrcweir : DdeGetLastError( pInst->hDdeInstCli ); 109*cdf0e10cSrcweir t = 0; 110*cdf0e10cSrcweir nRet = 0; 111*cdf0e10cSrcweir bFound = sal_True; 112*cdf0e10cSrcweir break; 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir case XTYP_ADVDATA: 115*cdf0e10cSrcweir bFound = sal_Bool( *t->pName == hText2 ); 116*cdf0e10cSrcweir break; 117*cdf0e10cSrcweir } 118*cdf0e10cSrcweir if( bFound ) 119*cdf0e10cSrcweir break; 120*cdf0e10cSrcweir } 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir if( t ) 123*cdf0e10cSrcweir { 124*cdf0e10cSrcweir switch( nCode ) 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir case XTYP_ADVDATA: 127*cdf0e10cSrcweir if( !hData ) 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir ((DdeLink*) t)->Notify(); 130*cdf0e10cSrcweir nRet = (HDDEDATA)DDE_FACK; 131*cdf0e10cSrcweir break; 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir // kein break; 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir case XTYP_REQUEST: 136*cdf0e10cSrcweir if( !hData && XTYP_REQUEST == nCode ) 137*cdf0e10cSrcweir { 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir } 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir DdeData d; 142*cdf0e10cSrcweir d.pImp->hData = hData; 143*cdf0e10cSrcweir d.pImp->nFmt = DdeData::GetInternalFormat( nCbType ); 144*cdf0e10cSrcweir d.Lock(); 145*cdf0e10cSrcweir t->Data( &d ); 146*cdf0e10cSrcweir nRet = (HDDEDATA)DDE_FACK; 147*cdf0e10cSrcweir break; 148*cdf0e10cSrcweir } 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir } 151*cdf0e10cSrcweir return nRet; 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir // --- DdeConnection::DdeConnection() ------------------------------ 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir DdeConnection::DdeConnection( const String& rService, const String& rTopic ) 157*cdf0e10cSrcweir { 158*cdf0e10cSrcweir pImp = new DdeImp; 159*cdf0e10cSrcweir pImp->nStatus = DMLERR_NO_ERROR; 160*cdf0e10cSrcweir pImp->hConv = NULL; 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir DdeInstData* pInst = ImpGetInstData(); 163*cdf0e10cSrcweir if( !pInst ) 164*cdf0e10cSrcweir pInst = ImpInitInstData(); 165*cdf0e10cSrcweir pInst->nRefCount++; 166*cdf0e10cSrcweir pInst->nInstanceCli++; 167*cdf0e10cSrcweir if ( !pInst->hDdeInstCli ) 168*cdf0e10cSrcweir { 169*cdf0e10cSrcweir pImp->nStatus = DdeInitialize( &pInst->hDdeInstCli, 170*cdf0e10cSrcweir (PFNCALLBACK)DdeInternal::CliCallback, 171*cdf0e10cSrcweir APPCLASS_STANDARD | APPCMD_CLIENTONLY | 172*cdf0e10cSrcweir CBF_FAIL_ALLSVRXACTIONS | 173*cdf0e10cSrcweir CBF_SKIP_REGISTRATIONS | 174*cdf0e10cSrcweir CBF_SKIP_UNREGISTRATIONS, 0L ); 175*cdf0e10cSrcweir pInst->pConnections = new DdeConnections; 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir pService = new DdeString( pInst->hDdeInstCli, rService ); 179*cdf0e10cSrcweir pTopic = new DdeString( pInst->hDdeInstCli, rTopic ); 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir if ( pImp->nStatus == DMLERR_NO_ERROR ) 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir pImp->hConv = DdeConnect( pInst->hDdeInstCli,*pService,*pTopic, NULL); 184*cdf0e10cSrcweir if( !pImp->hConv ) 185*cdf0e10cSrcweir pImp->nStatus = DdeGetLastError( pInst->hDdeInstCli ); 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir if ( pInst->pConnections ) 189*cdf0e10cSrcweir pInst->pConnections->Insert( this ); 190*cdf0e10cSrcweir } 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir // --- DdeConnection::~DdeConnection() ----------------------------- 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir DdeConnection::~DdeConnection() 195*cdf0e10cSrcweir { 196*cdf0e10cSrcweir if ( pImp->hConv ) 197*cdf0e10cSrcweir DdeDisconnect( pImp->hConv ); 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir delete pService; 200*cdf0e10cSrcweir delete pTopic; 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir DdeInstData* pInst = ImpGetInstData(); 203*cdf0e10cSrcweir DBG_ASSERT(pInst,"SVDDE:No instance data"); 204*cdf0e10cSrcweir if ( pInst->pConnections ) 205*cdf0e10cSrcweir pInst->pConnections->Remove( this ); 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir pInst->nInstanceCli--; 208*cdf0e10cSrcweir pInst->nRefCount--; 209*cdf0e10cSrcweir if ( !pInst->nInstanceCli && pInst->hDdeInstCli ) 210*cdf0e10cSrcweir { 211*cdf0e10cSrcweir if( DdeUninitialize( pInst->hDdeInstCli ) ) 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir pInst->hDdeInstCli = NULL; 214*cdf0e10cSrcweir delete pInst->pConnections; 215*cdf0e10cSrcweir pInst->pConnections = NULL; 216*cdf0e10cSrcweir if( pInst->nRefCount == 0 ) 217*cdf0e10cSrcweir ImpDeinitInstData(); 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir delete pImp; 221*cdf0e10cSrcweir } 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir // --- DdeConnection::IsConnected() -------------------------------- 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir sal_Bool DdeConnection::IsConnected() 226*cdf0e10cSrcweir { 227*cdf0e10cSrcweir CONVINFO c; 228*cdf0e10cSrcweir #ifdef OS2 229*cdf0e10cSrcweir c.nSize = sizeof( c ); 230*cdf0e10cSrcweir #else 231*cdf0e10cSrcweir c.cb = sizeof( c ); 232*cdf0e10cSrcweir #endif 233*cdf0e10cSrcweir if ( DdeQueryConvInfo( pImp->hConv, QID_SYNC, &c ) ) 234*cdf0e10cSrcweir return sal_True; 235*cdf0e10cSrcweir else 236*cdf0e10cSrcweir { 237*cdf0e10cSrcweir DdeInstData* pInst = ImpGetInstData(); 238*cdf0e10cSrcweir pImp->hConv = DdeReconnect( pImp->hConv ); 239*cdf0e10cSrcweir pImp->nStatus = pImp->hConv ? DMLERR_NO_ERROR : DdeGetLastError( pInst->hDdeInstCli ); 240*cdf0e10cSrcweir return sal_Bool( pImp->nStatus == DMLERR_NO_ERROR ); 241*cdf0e10cSrcweir } 242*cdf0e10cSrcweir } 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir // --- DdeConnection::GetServiceName() ----------------------------- 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir const String& DdeConnection::GetServiceName() 247*cdf0e10cSrcweir { 248*cdf0e10cSrcweir return (const String&)*pService; 249*cdf0e10cSrcweir } 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir // --- DdeConnection::GetTopicName() ------------------------------- 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir const String& DdeConnection::GetTopicName() 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir return (const String&)*pTopic; 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir // --- DdeConnection::GetConvId() ---------------------------------- 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir long DdeConnection::GetConvId() 261*cdf0e10cSrcweir { 262*cdf0e10cSrcweir return (long)pImp->hConv; 263*cdf0e10cSrcweir } 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir const DdeConnections& DdeConnection::GetConnections() 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir DdeInstData* pInst = ImpGetInstData(); 268*cdf0e10cSrcweir DBG_ASSERT(pInst,"SVDDE:No instance data"); 269*cdf0e10cSrcweir return *(pInst->pConnections); 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir // --- DdeTransaction::DdeTransaction() ---------------------------- 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir DdeTransaction::DdeTransaction( DdeConnection& d, const String& rItemName, 275*cdf0e10cSrcweir long n ) : 276*cdf0e10cSrcweir rDde( d ) 277*cdf0e10cSrcweir { 278*cdf0e10cSrcweir DdeInstData* pInst = ImpGetInstData(); 279*cdf0e10cSrcweir pName = new DdeString( pInst->hDdeInstCli, rItemName ); 280*cdf0e10cSrcweir nTime = n; 281*cdf0e10cSrcweir nId = 0; 282*cdf0e10cSrcweir nType = 0; 283*cdf0e10cSrcweir bBusy = sal_False; 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir rDde.aTransactions.Insert( this ); 286*cdf0e10cSrcweir } 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir // --- DdeTransaction::~DdeTransaction() --------------------------- 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir DdeTransaction::~DdeTransaction() 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir if ( nId && rDde.pImp->hConv ) 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir DdeInstData* pInst = ImpGetInstData(); 295*cdf0e10cSrcweir DdeAbandonTransaction( pInst->hDdeInstCli, rDde.pImp->hConv, nId ); 296*cdf0e10cSrcweir } 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir delete pName; 299*cdf0e10cSrcweir rDde.aTransactions.Remove( this ); 300*cdf0e10cSrcweir } 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir // --- DdeTransaction::Execute() ----------------------------------- 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir void DdeTransaction::Execute() 305*cdf0e10cSrcweir { 306*cdf0e10cSrcweir HSZ hItem = *pName; 307*cdf0e10cSrcweir void* pData = (void*)(const void *)aDdeData; 308*cdf0e10cSrcweir DWORD nData = (DWORD)(long)aDdeData; 309*cdf0e10cSrcweir sal_uLong nIntFmt = aDdeData.pImp->nFmt; 310*cdf0e10cSrcweir UINT nExtFmt = DdeData::GetExternalFormat( nIntFmt ); 311*cdf0e10cSrcweir DdeInstData* pInst = ImpGetInstData(); 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir if ( nType == XTYP_EXECUTE ) 314*cdf0e10cSrcweir hItem = NULL; 315*cdf0e10cSrcweir if ( nType != XTYP_EXECUTE && nType != XTYP_POKE ) 316*cdf0e10cSrcweir { 317*cdf0e10cSrcweir pData = NULL; 318*cdf0e10cSrcweir nData = 0L; 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir if ( nTime ) 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir HDDEDATA hData = DdeClientTransaction( (unsigned char*)pData, 323*cdf0e10cSrcweir nData, rDde.pImp->hConv, 324*cdf0e10cSrcweir hItem, nExtFmt, (UINT)nType, 325*cdf0e10cSrcweir (DWORD)nTime, (DWORD FAR*)NULL ); 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir rDde.pImp->nStatus = DdeGetLastError( pInst->hDdeInstCli ); 328*cdf0e10cSrcweir if( hData && nType == XTYP_REQUEST ) 329*cdf0e10cSrcweir { 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir DdeData d; 332*cdf0e10cSrcweir d.pImp->hData = hData; 333*cdf0e10cSrcweir d.pImp->nFmt = nIntFmt; 334*cdf0e10cSrcweir d.Lock(); 335*cdf0e10cSrcweir Data( &d ); 336*cdf0e10cSrcweir } 337*cdf0e10cSrcweir DdeFreeDataHandle( hData ); 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir else 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir if ( nId && rDde.pImp->hConv ) 343*cdf0e10cSrcweir DdeAbandonTransaction( pInst->hDdeInstCli, rDde.pImp->hConv, nId); 344*cdf0e10cSrcweir nId = 0; 345*cdf0e10cSrcweir bBusy = sal_True; 346*cdf0e10cSrcweir HDDEDATA hRet = DdeClientTransaction( (unsigned char*)pData, nData, 347*cdf0e10cSrcweir rDde.pImp->hConv, hItem, nExtFmt, 348*cdf0e10cSrcweir (UINT)nType, TIMEOUT_ASYNC, 349*cdf0e10cSrcweir (DWORD FAR *) ((long*) &nId) ); 350*cdf0e10cSrcweir rDde.pImp->nStatus = hRet ? DMLERR_NO_ERROR 351*cdf0e10cSrcweir : DdeGetLastError( pInst->hDdeInstCli ); 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir } 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir // --- DdeTransaction::GetName() ----------------------------------- 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir const String& DdeTransaction::GetName() const 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir return *pName; 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir // --- DdeTransaction::Data() -------------------------------------- 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir void __EXPORT DdeTransaction::Data( const DdeData* p ) 366*cdf0e10cSrcweir { 367*cdf0e10cSrcweir if ( ::tools::SolarMutex::Acquire() ) 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir aData.Call( (void*)p ); 370*cdf0e10cSrcweir ::tools::SolarMutex::Release(); 371*cdf0e10cSrcweir } 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir // --- DdeTransaction::Done() -------------------------------------- 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir void __EXPORT DdeTransaction::Done( sal_Bool bDataValid ) 377*cdf0e10cSrcweir { 378*cdf0e10cSrcweir aDone.Call( (void*)bDataValid ); 379*cdf0e10cSrcweir } 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir // --- DdeLink::DdeLink() ------------------------------------------ 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir DdeLink::DdeLink( DdeConnection& d, const String& aItemName, long n ) : 384*cdf0e10cSrcweir DdeTransaction (d, aItemName, n) 385*cdf0e10cSrcweir { 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir // --- DdeLink::~DdeLink() ----------------------------------------- 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir DdeLink::~DdeLink() 391*cdf0e10cSrcweir { 392*cdf0e10cSrcweir nType = (sal_uInt16)XTYP_ADVSTOP; 393*cdf0e10cSrcweir nTime = 0; 394*cdf0e10cSrcweir } 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir // --- DdeLink::Notify() ----------------------------------------- 397*cdf0e10cSrcweir 398*cdf0e10cSrcweir void __EXPORT DdeLink::Notify() 399*cdf0e10cSrcweir { 400*cdf0e10cSrcweir aNotify.Call( NULL ); 401*cdf0e10cSrcweir } 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir // --- DdeRequest::DdeRequest() ------------------------------------ 404*cdf0e10cSrcweir 405*cdf0e10cSrcweir DdeRequest::DdeRequest( DdeConnection& d, const String& i, long n ) : 406*cdf0e10cSrcweir DdeTransaction( d, i, n ) 407*cdf0e10cSrcweir { 408*cdf0e10cSrcweir nType = XTYP_REQUEST; 409*cdf0e10cSrcweir } 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir // --- DdeWarmLink::DdeWarmLink() ---------------------------------- 412*cdf0e10cSrcweir 413*cdf0e10cSrcweir DdeWarmLink::DdeWarmLink( DdeConnection& d, const String& i, long n ) : 414*cdf0e10cSrcweir DdeLink( d, i, n ) 415*cdf0e10cSrcweir { 416*cdf0e10cSrcweir nType = XTYP_ADVSTART | XTYPF_NODATA; 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir // --- DdeHotLink::DdeHotLink() ------------------------------------ 420*cdf0e10cSrcweir 421*cdf0e10cSrcweir DdeHotLink::DdeHotLink( DdeConnection& d, const String& i, long n ) : 422*cdf0e10cSrcweir DdeLink( d, i, n ) 423*cdf0e10cSrcweir { 424*cdf0e10cSrcweir nType = XTYP_ADVSTART; 425*cdf0e10cSrcweir } 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir // --- DdePoke::DdePoke() ------------------------------------------ 428*cdf0e10cSrcweir 429*cdf0e10cSrcweir DdePoke::DdePoke( DdeConnection& d, const String& i, const char* p, 430*cdf0e10cSrcweir long l, sal_uLong f, long n ) : 431*cdf0e10cSrcweir DdeTransaction( d, i, n ) 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir aDdeData = DdeData( p, l, f ); 434*cdf0e10cSrcweir nType = XTYP_POKE; 435*cdf0e10cSrcweir } 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir // --- DdePoke::DdePoke() ------------------------------------------ 438*cdf0e10cSrcweir 439*cdf0e10cSrcweir DdePoke::DdePoke( DdeConnection& d, const String& i, const String& rData, 440*cdf0e10cSrcweir long n ) : 441*cdf0e10cSrcweir DdeTransaction( d, i, n ) 442*cdf0e10cSrcweir { 443*cdf0e10cSrcweir // ByteString aByteStr( rData, osl_getThreadTextEncoding() ); 444*cdf0e10cSrcweir aDdeData = DdeData( (void*) rData.GetBuffer(), sizeof(sal_Unicode) * (rData.Len()), CF_TEXT ); 445*cdf0e10cSrcweir nType = XTYP_POKE; 446*cdf0e10cSrcweir } 447*cdf0e10cSrcweir 448*cdf0e10cSrcweir // --- DdePoke::DdePoke() ------------------------------------------ 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir DdePoke::DdePoke( DdeConnection& d, const String& i, const DdeData& rData, 451*cdf0e10cSrcweir long n ) : 452*cdf0e10cSrcweir DdeTransaction( d, i, n ) 453*cdf0e10cSrcweir { 454*cdf0e10cSrcweir aDdeData = rData; 455*cdf0e10cSrcweir nType = XTYP_POKE; 456*cdf0e10cSrcweir } 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir // --- DdeExecute::DdeExecute() ------------------------------------ 459*cdf0e10cSrcweir 460*cdf0e10cSrcweir DdeExecute::DdeExecute( DdeConnection& d, const String& rData, long n ) : 461*cdf0e10cSrcweir DdeTransaction( d, String(), n ) 462*cdf0e10cSrcweir { 463*cdf0e10cSrcweir // ByteString aByteStr( rData, osl_getThreadTextEncoding() ); 464*cdf0e10cSrcweir aDdeData = DdeData( (void*)rData.GetBuffer(), sizeof(sal_Unicode) * (rData.Len() + 1), CF_TEXT ); 465*cdf0e10cSrcweir nType = XTYP_EXECUTE; 466*cdf0e10cSrcweir } 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir // --- DdeConnection::GetError() ----------------------------------- 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir long DdeConnection::GetError() 471*cdf0e10cSrcweir { 472*cdf0e10cSrcweir return pImp->nStatus; 473*cdf0e10cSrcweir } 474