1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_SVL_SVDDE_HXX
#define INCLUDED_SVL_SVDDE_HXX
#include <svl/svldllapi.h>
#include <sot/exchange.hxx>
#include <tools/solar.h>
#include <tools/link.hxx>
#include <vector>
class DdeString;
class DdeData;
class DdeConnection;
class DdeTransaction;
class DdeLink;
class DdeRequest;
class DdeWarmLink;
class DdeHotLink;
class DdePoke;
class DdeExecute;
class DdeItem;
class DdeTopic;
class DdeService;
struct DdeDataImp;
struct DdeImp;
class DdeItemImp;
struct Conversation;
typedef ::std::vector< DdeService* > DdeServices;
typedef ::std::vector< long > DdeFormats;
typedef ::std::vector< Conversation* > ConvList;
// - DdeData -
class SVL_DLLPUBLIC DdeData
{
friend class DdeInternal;
friend class DdeService;
friend class DdeConnection;
friend class DdeTransaction;
DdeDataImp* pImp;
SVL_DLLPRIVATE void Lock();
void SetFormat( SotClipboardFormatId nFmt );
public:
DdeData();
DdeData( SAL_UNUSED_PARAMETER const void*, SAL_UNUSED_PARAMETER long, SAL_UNUSED_PARAMETER SotClipboardFormatId = SotClipboardFormatId::STRING );
DdeData( SAL_UNUSED_PARAMETER const OUString& );
DdeData( const DdeData& );
~DdeData();
operator const void*() const;
operator long() const;
SotClipboardFormatId GetFormat() const;
DdeData& operator = ( const DdeData& );
static sal_uLong GetExternalFormat(SotClipboardFormatId nFmt);
static SotClipboardFormatId GetInternalFormat(sal_uLong nFmt);
};
// - DdeTransaction -
class SVL_DLLPUBLIC DdeTransaction
{
public:
void Data( const DdeData* );
void Done( bool bDataValid );
protected:
DdeConnection& rDde;
DdeData aDdeData;
DdeString* pName;
short nType;
sal_IntPtr nId;
sal_IntPtr nTime;
Link<const DdeData*,void> aData;
Link<bool,void> aDone;
bool bBusy;
DdeTransaction( DdeConnection&, SAL_UNUSED_PARAMETER const OUString&, SAL_UNUSED_PARAMETER long = 0 );
public:
virtual ~DdeTransaction();
bool IsBusy() { return bBusy; }
const OUString GetName() const;
void Execute();
void SetDataHdl( const Link<const DdeData*,void>& rLink ) { aData = rLink; }
const Link<const DdeData*,void>& GetDataHdl() const { return aData; }
void SetDoneHdl( const Link<bool,void>& rLink ) { aDone = rLink; }
const Link<bool,void>& GetDoneHdl() const { return aDone; }
void SetFormat( SotClipboardFormatId nFmt ) { aDdeData.SetFormat( nFmt ); }
SotClipboardFormatId GetFormat() const { return aDdeData.GetFormat(); }
long GetError();
private:
friend class DdeInternal;
friend class DdeConnection;
DdeTransaction( const DdeTransaction& ) SAL_DELETED_FUNCTION;
const DdeTransaction& operator= ( const DdeTransaction& ) SAL_DELETED_FUNCTION;
};
// - DdeLink -
class SVL_DLLPUBLIC DdeLink : public DdeTransaction
{
Link<void*,void> aNotify;
public:
DdeLink( DdeConnection&, const OUString&, long = 0 );
virtual ~DdeLink();
void SetNotifyHdl( const Link<void*,void>& rLink ) { aNotify = rLink; }
const Link<void*,void>& GetNotifyHdl() const { return aNotify; }
void Notify();
};
// - DdeWarmLink -
class SVL_DLLPUBLIC DdeWarmLink : public DdeLink
{
public:
DdeWarmLink( DdeConnection&, const OUString&, long = 0 );
};
// - DdeHotLink -
class SVL_DLLPUBLIC DdeHotLink : public DdeLink
{
public:
DdeHotLink( DdeConnection&, const OUString&, long = 0 );
};
// - DdeRequest -
class SVL_DLLPUBLIC DdeRequest : public DdeTransaction
{
public:
DdeRequest( DdeConnection&, const OUString&, long = 0 );
};
// - DdePoke -
class SVL_DLLPUBLIC DdePoke : public DdeTransaction
{
public:
DdePoke( DdeConnection&, const OUString&, const char*, long,
SotClipboardFormatId = SotClipboardFormatId::STRING, long = 0 );
DdePoke( DdeConnection&, const OUString&, SAL_UNUSED_PARAMETER const DdeData&, long = 0 );
DdePoke( DdeConnection&, const OUString&, const OUString&, long = 0 );
};
// - DdeExecute -
class SVL_DLLPUBLIC DdeExecute : public DdeTransaction
{
public:
DdeExecute( DdeConnection&, const OUString&, long = 0 );
};
// - DdeConnection -
class SVL_DLLPUBLIC DdeConnection
{
friend class DdeInternal;
friend class DdeTransaction;
std::vector<DdeTransaction*> aTransactions;
DdeString* pService;
DdeString* pTopic;
DdeImp* pImp;
public:
DdeConnection( SAL_UNUSED_PARAMETER const OUString&, SAL_UNUSED_PARAMETER const OUString& );
~DdeConnection();
long GetError();
sal_IntPtr GetConvId();
static const std::vector<DdeConnection*>& GetConnections();
bool IsConnected();
const OUString GetServiceName();
const OUString GetTopicName();
private:
DdeConnection( const DdeConnection& ) SAL_DELETED_FUNCTION;
const DdeConnection& operator= ( const DdeConnection& ) SAL_DELETED_FUNCTION;
};
// - DdeItem -
class SVL_DLLPUBLIC DdeItem
{
friend class DdeInternal;
friend class DdeTopic;
DdeString* pName;
DdeTopic* pMyTopic;
DdeItemImp* pImpData;
void IncMonitor( sal_uLong );
void DecMonitor( sal_uLong );
protected:
sal_uInt8 nType;
public:
DdeItem( const sal_Unicode* );
DdeItem( SAL_UNUSED_PARAMETER const OUString& );
DdeItem( const DdeItem& );
virtual ~DdeItem();
const OUString GetName() const;
short GetLinks();
void NotifyClient();
};
// - DdeItem -
class SVL_DLLPUBLIC DdeGetPutItem : public DdeItem
{
public:
DdeGetPutItem( const sal_Unicode* p );
DdeGetPutItem( const OUString& rStr );
DdeGetPutItem( const DdeItem& rItem );
virtual DdeData* Get( SotClipboardFormatId );
virtual bool Put( const DdeData* );
virtual void AdviseLoop( bool ); // Start / Stop AdviseLoop
};
// - DdeTopic -
class SVL_DLLPUBLIC DdeTopic
{
SVL_DLLPRIVATE void _Disconnect( sal_IntPtr );
public:
void Connect( sal_IntPtr );
void Disconnect( sal_IntPtr );
virtual DdeData* Get(SotClipboardFormatId);
virtual bool Put( const DdeData* );
virtual bool Execute( const OUString* );
// Eventually create a new item. return 0 -> Item creation failed
virtual bool MakeItem( const OUString& rItem );
// A Warm-/Hot-Link is created. Return true if successful
virtual bool StartAdviseLoop();
bool StopAdviseLoop();
private:
friend class DdeInternal;
friend class DdeService;
friend class DdeItem;
private:
DdeString* pName;
OUString aItem;
std::vector<DdeItem*> aItems;
public:
DdeTopic( SAL_UNUSED_PARAMETER const OUString& );
virtual ~DdeTopic();
const OUString GetName() const;
long GetConvId();
void NotifyClient( const OUString& );
bool IsSystemTopic();
void InsertItem( DdeItem* ); // For own superclasses
DdeItem* AddItem( const DdeItem& ); // Will be cloned
void RemoveItem( const DdeItem& );
const OUString& GetCurItem() { return aItem; }
const std::vector<DdeItem*>& GetItems() const { return aItems; }
private:
DdeTopic( const DdeTopic& ) SAL_DELETED_FUNCTION;
const DdeTopic& operator= ( const DdeTopic& ) SAL_DELETED_FUNCTION;
};
// - DdeService -
class SVL_DLLPUBLIC DdeService
{
friend class DdeInternal;
public:
bool IsBusy();
OUString GetHelp();
// Eventually creating a new item. return 0 -> Topic creation failed
bool MakeTopic( const OUString& rItem );
protected:
OUString Topics();
OUString Formats();
OUString SysItems();
OUString Status();
OUString SysTopicGet( const OUString& );
bool SysTopicExecute( const OUString* );
const DdeTopic* GetSysTopic() const { return pSysTopic; }
private:
std::vector<DdeTopic*> aTopics;
DdeFormats aFormats;
DdeTopic* pSysTopic;
DdeString* pName;
ConvList* pConv;
short nStatus;
SVL_DLLPRIVATE bool HasCbFormat( sal_uInt16 );
public:
DdeService( SAL_UNUSED_PARAMETER const OUString& );
virtual ~DdeService();
const OUString GetName() const;
short GetError() { return nStatus; }
static DdeServices& GetServices();
std::vector<DdeTopic*>& GetTopics() { return aTopics; }
void AddTopic( const DdeTopic& );
void RemoveTopic( const DdeTopic& );
void AddFormat(SotClipboardFormatId);
void RemoveFormat(SotClipboardFormatId);
bool HasFormat(SotClipboardFormatId);
private:
// DdeService( const DdeService& );
//int operator= ( const DdeService& );
};
// - DdeTransaction -
inline long DdeTransaction::GetError()
{
return rDde.GetError();
}
#endif // INCLUDED_SVL_SVDDE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|