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