1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: svdde.hxx,v $
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 ************************************************************************/
34 #ifndef INCLUDED_SVTDLLAPI_H
35 #include "bf_svtools/svtdllapi.h"
38 #ifndef _SOT_EXCHANGE_HXX
39 #include <sot/exchange.hxx>
42 #ifndef _STRING_HXX //autogen
43 #include <tools/string.hxx>
45 #ifndef _LIST_HXX //autogen
46 #include <tools/list.hxx>
48 #ifndef _LINK_HXX //autogen
49 #include <tools/link.hxx>
73 #ifndef _SVDDE_NOLISTS
74 DECLARE_LIST( DdeConnections
, DdeConnection
* )
75 DECLARE_LIST( DdeServices
, DdeService
* )
76 DECLARE_LIST( DdeTopics
, DdeTopic
* )
77 DECLARE_LIST( DdeItems
, DdeItem
* )
79 typedef List DdeConnections
;
80 typedef List DdeServices
;
81 typedef List DdeTopics
;
82 typedef List DdeItems
;
85 //#if 0 // _SOLAR__PRIVATE
86 DECLARE_LIST( DdeTransactions
, DdeTransaction
* )
87 DECLARE_LIST( DdeFormats
, long )
89 //typedef List DdeTransactions;
90 //typedef List DdeFormats;
95 DECLARE_LIST( StringList
, String
* )
104 friend class DdeInternal
;
105 friend class DdeService
;
106 friend class DdeConnection
;
107 friend class DdeTransaction
;
111 void SetFormat( ULONG nFmt
);
115 DdeData( const void*, long, ULONG
= FORMAT_STRING
);
116 DdeData( const String
& );
117 DdeData( const DdeData
& );
120 operator const void*() const;
121 operator long() const;
123 ULONG
GetFormat() const;
125 DdeData
& operator = ( const DdeData
& );
127 static ULONG
GetExternalFormat( ULONG nFmt
);
128 static ULONG
GetInternalFormat( ULONG nFmt
);
130 // ------------------
131 // - DdeServiceList -
132 // ------------------
136 StringList aServices
;
139 DdeServiceList( const String
* = NULL
);
142 StringList
& GetServices() { return aServices
; }
145 DdeServiceList( const DdeServiceList
& );
146 const DdeServiceList
& operator= ( const DdeServiceList
& );
157 //#if 0 // _SOLAR__PRIVATE
158 DECL_LINK( Data
, DdeData
* );
161 DdeTopicList( const String
& );
164 StringList
& GetTopics() { return aTopics
; }
167 // ------------------
168 // - DdeTransaction -
169 // ------------------
174 virtual void Data( const DdeData
* );
175 virtual void Done( BOOL bDataValid
);
187 DdeTransaction( DdeConnection
&, const String
&, long = 0 );
190 virtual ~DdeTransaction();
192 BOOL
IsBusy() { return bBusy
; }
193 const String
& GetName() const;
197 void SetDataHdl( const Link
& rLink
) { aData
= rLink
; }
198 const Link
& GetDataHdl() const { return aData
; }
200 void SetDoneHdl( const Link
& rLink
) { aDone
= rLink
; }
201 const Link
& GetDoneHdl() const { return aDone
; }
203 void SetFormat( ULONG nFmt
) { aDdeData
.SetFormat( nFmt
); }
204 ULONG
GetFormat() const { return aDdeData
.GetFormat(); }
209 friend class DdeInternal
;
210 friend class DdeConnection
;
212 DdeTransaction( const DdeTransaction
& );
213 const DdeTransaction
& operator= ( const DdeTransaction
& );
221 class DdeLink
: public DdeTransaction
226 DdeLink( DdeConnection
&, const String
&, long = 0 );
229 void SetNotifyHdl( const Link
& rLink
) { aNotify
= rLink
; }
230 const Link
& GetNotifyHdl() const { return aNotify
; }
231 virtual void Notify();
238 class DdeWarmLink
: public DdeLink
241 DdeWarmLink( DdeConnection
&, const String
&, long = 0 );
248 class DdeHotLink
: public DdeLink
251 DdeHotLink( DdeConnection
&, const String
&, long = 0 );
258 class DdeRequest
: public DdeTransaction
261 DdeRequest( DdeConnection
&, const String
&, long = 0 );
268 class DdePoke
: public DdeTransaction
271 DdePoke( DdeConnection
&, const String
&, const char*, long,
272 ULONG
= FORMAT_STRING
, long = 0 );
273 DdePoke( DdeConnection
&, const String
&, const DdeData
&, long = 0 );
274 DdePoke( DdeConnection
&, const String
&, const String
&, long = 0 );
281 class DdeExecute
: public DdeTransaction
284 DdeExecute( DdeConnection
&, const String
&, long = 0 );
293 friend class DdeInternal
;
294 friend class DdeTransaction
;
295 DdeTransactions aTransactions
;
301 DdeConnection( const String
&, const String
& );
307 static const DdeConnections
& GetConnections();
311 const String
& GetServiceName();
312 const String
& GetTopicName();
315 DdeConnection( const DdeConnection
& );
316 const DdeConnection
& operator= ( const DdeConnection
& );
325 friend class DdeInternal
;
326 friend class DdeTopic
;
329 DdeItemImp
* pImpData
;
331 void IncMonitor( ULONG
);
332 void DecMonitor( ULONG
);
338 DdeItem( const sal_Unicode
* );
339 DdeItem( const String
& );
340 DdeItem( const DdeItem
& );
343 const String
& GetName() const;
352 class DdeGetPutItem
: public DdeItem
355 DdeGetPutItem( const sal_Unicode
* p
);
356 DdeGetPutItem( const String
& rStr
);
357 DdeGetPutItem( const DdeItem
& rItem
);
359 virtual DdeData
* Get( ULONG
);
360 virtual BOOL
Put( const DdeData
* );
361 virtual void AdviseLoop( BOOL
); // AdviseLoop starten/stoppen
370 void _Disconnect( long );
373 virtual void Connect( long );
374 virtual void Disconnect( long );
375 virtual DdeData
* Get( ULONG
);
376 virtual BOOL
Put( const DdeData
* );
377 virtual BOOL
Execute( const String
* );
378 // evt. ein neues anlegen; return 0 -> es konnte nicht angelegt werden
379 virtual BOOL
MakeItem( const String
& rItem
);
381 // es wird ein Warm-/Hot-Link eingerichtet. Return-Wert
382 // besagt ob es geklappt hat
383 virtual BOOL
StartAdviseLoop();
384 virtual BOOL
StopAdviseLoop();
387 friend class DdeInternal
;
388 friend class DdeService
;
389 friend class DdeItem
;
396 Link aDisconnectLink
;
402 DdeTopic( const String
& );
405 const String
& GetName() const;
408 void SetConnectHdl( const Link
& rLink
) { aConnectLink
= rLink
; }
409 const Link
& GetConnectHdl() const { return aConnectLink
; }
410 void SetDisconnectHdl( const Link
& rLink
) { aDisconnectLink
= rLink
; }
411 const Link
& GetDisconnectHdl() const { return aDisconnectLink
; }
412 void SetGetHdl( const Link
& rLink
) { aGetLink
= rLink
; }
413 const Link
& GetGetHdl() const { return aGetLink
; }
414 void SetPutHdl( const Link
& rLink
) { aPutLink
= rLink
; }
415 const Link
& GetPutHdl() const { return aPutLink
; }
416 void SetExecuteHdl( const Link
& rLink
) { aExecLink
= rLink
; }
417 const Link
& GetExecuteHdl() const { return aExecLink
; }
419 void NotifyClient( const String
& );
420 BOOL
IsSystemTopic();
422 void InsertItem( DdeItem
* ); // fuer eigene Ableitungen!
423 DdeItem
* AddItem( const DdeItem
& ); // werden kopiert !
424 void RemoveItem( const DdeItem
& );
425 const String
& GetCurItem() { return aItem
; }
426 const DdeItems
& GetItems() { return aItems
; }
429 DdeTopic( const DdeTopic
& );
430 const DdeTopic
& operator= ( const DdeTopic
& );
439 friend class DdeInternal
;
442 virtual BOOL
IsBusy();
443 virtual String
GetHelp();
444 // evt. ein neues anlegen; return 0 -> es konnte nicht angelegt werden
445 virtual BOOL
MakeTopic( const String
& rItem
);
448 virtual String
Topics();
449 virtual String
Formats();
450 virtual String
SysItems();
451 virtual String
Status();
452 virtual String
SysTopicGet( const String
& );
453 virtual BOOL
SysTopicExecute( const String
* );
455 const DdeTopic
* GetSysTopic() const { return pSysTopic
; }
464 BOOL
HasCbFormat( USHORT
);
467 DdeService( const String
& );
468 virtual ~DdeService();
470 const String
& GetName() const;
471 short GetError() { return nStatus
; }
473 static DdeServices
& GetServices();
474 DdeTopics
& GetTopics() { return aTopics
; }
476 void AddTopic( const DdeTopic
& );
477 void RemoveTopic( const DdeTopic
& );
479 void AddFormat( ULONG
);
480 void RemoveFormat( ULONG
);
481 BOOL
HasFormat( ULONG
);
484 // DdeService( const DdeService& );
485 //int operator= ( const DdeService& );
488 // ------------------
489 // - DdeTransaction -
490 // ------------------
492 inline long DdeTransaction::GetError()
494 return rDde
.GetError();