LibreOffice Module svl (master) 1
svdde.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_SVL_SVDDE_HXX
21#define INCLUDED_SVL_SVDDE_HXX
22
23#include <sal/config.h>
24
25#include <svl/svldllapi.h>
26#include <sot/formats.hxx>
27#include <rtl/ustring.hxx>
28#include <tools/solar.h>
29#include <tools/link.hxx>
30#include <tools/long.hxx>
31#include <memory>
32#include <vector>
33
34class DdeString;
35class DdeConnection;
36class DdeTopic;
37class DdeService;
38struct DdeDataImp;
39struct DdeImp;
40struct DdeItemImpData;
41struct Conversation;
42
43typedef ::std::vector< DdeService* > DdeServices;
44
45
47{
48 friend class DdeInternal;
49 friend class DdeService;
50 friend class DdeConnection;
51 friend class DdeTransaction;
52 std::unique_ptr<DdeDataImp> xImp;
53
54 SVL_DLLPRIVATE void Lock();
55
57
58public:
59 DdeData();
60 DdeData(SAL_UNUSED_PARAMETER const void*, SAL_UNUSED_PARAMETER tools::Long, SAL_UNUSED_PARAMETER SotClipboardFormatId = SotClipboardFormatId::STRING);
61 DdeData(SAL_UNUSED_PARAMETER const OUString&);
62 DdeData(const DdeData&);
63 DdeData(DdeData&&) noexcept;
64 ~DdeData();
65
66 void const * getData() const;
67 tools::Long getSize() const;
68
70
71 DdeData& operator=(const DdeData&);
72 DdeData& operator=(DdeData&&) noexcept;
73
74 static sal_uInt32 GetExternalFormat(SotClipboardFormatId nFmt);
75 static SotClipboardFormatId GetInternalFormat(sal_uLong nFmt);
76};
77
78
80{
81public:
82 void Data( const DdeData* );
83 void Done( bool bDataValid );
84protected:
88 short nType;
89 sal_IntPtr nId;
90 sal_IntPtr nTime;
93 bool bBusy;
94
95 DdeTransaction( DdeConnection&, SAL_UNUSED_PARAMETER const OUString&, SAL_UNUSED_PARAMETER tools::Long = 0 );
96
97public:
98 virtual ~DdeTransaction();
99
100 bool IsBusy() const { return bBusy; }
101 OUString GetName() const;
102
103 void Execute();
104
105 void SetDataHdl( const Link<const DdeData*,void>& rLink ) { aData = rLink; }
106 const Link<const DdeData*,void>& GetDataHdl() const { return aData; }
107
108 void SetDoneHdl( const Link<bool,void>& rLink ) { aDone = rLink; }
109 const Link<bool,void>& GetDoneHdl() const { return aDone; }
110
113
114 tools::Long GetError() const;
115
116private:
117 friend class DdeInternal;
118 friend class DdeConnection;
119
120 DdeTransaction( const DdeTransaction& ) = delete;
121 const DdeTransaction& operator= ( const DdeTransaction& ) = delete;
122
123};
124
125
127{
129
130public:
131 DdeLink( DdeConnection&, const OUString&, tools::Long = 0 );
132 virtual ~DdeLink() override;
133
134 void SetNotifyHdl( const Link<void*,void>& rLink ) { aNotify = rLink; }
135 const Link<void*,void>& GetNotifyHdl() const { return aNotify; }
136 void Notify();
137};
138
139
141{
142public:
143 DdeHotLink( DdeConnection&, const OUString& );
144};
145
146
148{
149public:
150 DdeRequest( DdeConnection&, const OUString&, tools::Long = 0 );
151};
152
153
155{
156public:
157 DdePoke( DdeConnection&, const OUString&, SAL_UNUSED_PARAMETER const DdeData&, tools::Long = 0 );
158};
159
160
162{
163public:
164 DdeExecute( DdeConnection&, const OUString&, tools::Long = 0 );
165};
166
167
169{
170 friend class DdeInternal;
171 friend class DdeTransaction;
172 std::vector<DdeTransaction*> aTransactions;
175 std::unique_ptr<DdeImp> pImp;
176
177public:
178 DdeConnection( SAL_UNUSED_PARAMETER const OUString&, SAL_UNUSED_PARAMETER const OUString& );
180
181 tools::Long GetError() const;
182
183 static const std::vector<DdeConnection*>& GetConnections();
184
185 bool IsConnected();
186
187 OUString GetServiceName() const;
188 OUString GetTopicName() const;
189
190private:
191 DdeConnection( const DdeConnection& ) = delete;
192 const DdeConnection& operator= ( const DdeConnection& ) = delete;
193};
194
195
197{
198 friend class DdeInternal;
199 friend class DdeTopic;
202 std::vector<DdeItemImpData>* pImpData;
203
204protected:
206
207public:
208 DdeItem( const sal_Unicode* );
209 DdeItem( SAL_UNUSED_PARAMETER const OUString& );
210 DdeItem( const DdeItem& );
211 virtual ~DdeItem();
212
213 OUString GetName() const;
214 short GetLinks();
215 void NotifyClient();
216};
217
218
220{
221public:
222 DdeGetPutItem( const sal_Unicode* p );
223 DdeGetPutItem( const OUString& rStr );
224 DdeGetPutItem( const DdeItem& rItem );
225
226 virtual DdeData* Get( SotClipboardFormatId );
227 virtual bool Put( const DdeData* );
228 virtual void AdviseLoop( bool ); // Start / Stop AdviseLoop
229};
230
231
233{
234
235public:
237 virtual bool Put( const DdeData* );
238 virtual bool Execute( const OUString* );
239 // Eventually create a new item. return 0 -> Item creation failed
240 virtual bool MakeItem( const OUString& rItem );
241
242 // A Warm-/Hot-Link is created. Return true if successful
243 virtual bool StartAdviseLoop();
244
245private:
246 friend class DdeInternal;
247 friend class DdeService;
248 friend class DdeItem;
249
250private:
252 OUString aItem;
253 std::vector<DdeItem*> aItems;
254
255public:
256 DdeTopic( SAL_UNUSED_PARAMETER const OUString& );
257 virtual ~DdeTopic();
258
259 OUString GetName() const;
260
261 void NotifyClient( const OUString& );
262 bool IsSystemTopic();
263
264 void InsertItem( DdeItem* ); // For own superclasses
265 DdeItem* AddItem( const DdeItem& ); // Will be cloned
266 void RemoveItem( const DdeItem& );
267 const OUString& GetCurItem() const { return aItem; }
268 const std::vector<DdeItem*>& GetItems() const { return aItems; }
269
270private:
271 DdeTopic( const DdeTopic& ) = delete;
272 const DdeTopic& operator= ( const DdeTopic& ) = delete;
273};
274
275
277{
278 friend class DdeInternal;
279
280protected:
281 OUString Topics();
282 OUString Formats();
283 OUString SysItems();
284 OUString Status();
285
286 const DdeTopic* GetSysTopic() const { return pSysTopic; }
287private:
288 std::vector<DdeTopic*> aTopics;
289 std::vector< sal_uInt32 > aFormats;
292 std::vector<std::unique_ptr<Conversation>>
294 short nStatus;
295
296 SVL_DLLPRIVATE bool HasCbFormat( sal_uInt32 );
297
298public:
299 DdeService( SAL_UNUSED_PARAMETER const OUString& );
300 virtual ~DdeService();
301
302 DdeService( const DdeService& ) = delete;
303 DdeService& operator= ( const DdeService& ) = delete;
304
305 OUString GetName() const;
306 short GetError() const { return nStatus; }
307
308 static DdeServices& GetServices();
309 std::vector<DdeTopic*>& GetTopics() { return aTopics; }
310
311 void AddTopic( const DdeTopic& );
312 void RemoveTopic( const DdeTopic& );
313
314 void AddFormat(SotClipboardFormatId);
315 void RemoveFormat(SotClipboardFormatId);
316 bool HasFormat(SotClipboardFormatId);
317};
318
319
321{
322 return rDde.GetError();
323}
324#endif // INCLUDED_SVL_SVDDE_HXX
325
326/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DdeString * pTopic
Definition: svdde.hxx:174
std::vector< DdeTransaction * > aTransactions
Definition: svdde.hxx:172
DdeString * pService
Definition: svdde.hxx:173
DdeConnection(SAL_UNUSED_PARAMETER const OUString &, SAL_UNUSED_PARAMETER const OUString &)
std::unique_ptr< DdeImp > pImp
Definition: svdde.hxx:175
DdeConnection(const DdeConnection &)=delete
const DdeConnection & operator=(const DdeConnection &)=delete
SotClipboardFormatId GetFormat() const
Definition: ddedata.cxx:87
void SetFormat(SotClipboardFormatId nFmt)
Definition: ddedata.cxx:92
DdeData(SAL_UNUSED_PARAMETER const OUString &)
std::unique_ptr< DdeDataImp > xImp
Definition: svdde.hxx:52
DdeData(SAL_UNUSED_PARAMETER const void *, SAL_UNUSED_PARAMETER tools::Long, SAL_UNUSED_PARAMETER SotClipboardFormatId=SotClipboardFormatId::STRING)
OUString GetName() const
Definition: ddesvr.cxx:617
DdeTopic * pMyTopic
Definition: svdde.hxx:201
std::vector< DdeItemImpData > * pImpData
Definition: svdde.hxx:202
DdeItem(SAL_UNUSED_PARAMETER const OUString &)
DdeString * pName
Definition: svdde.hxx:200
sal_uInt8 nType
Definition: svdde.hxx:205
void NotifyClient()
Definition: ddesvr.cxx:622
const DdeTopic * GetSysTopic() const
Definition: svdde.hxx:286
short GetError() const
Definition: svdde.hxx:306
std::vector< DdeTopic * > aTopics
Definition: svdde.hxx:288
std::vector< DdeTopic * > & GetTopics()
Definition: svdde.hxx:309
short nStatus
Definition: svdde.hxx:294
DdeService(SAL_UNUSED_PARAMETER const OUString &)
DdeService(const DdeService &)=delete
std::vector< std::unique_ptr< Conversation > > m_vConv
Definition: svdde.hxx:293
std::vector< sal_uInt32 > aFormats
Definition: svdde.hxx:289
DdeString * pName
Definition: svdde.hxx:291
DdeTopic * pSysTopic
Definition: svdde.hxx:290
void NotifyClient(const OUString &)
Definition: ddesvr.cxx:540
DdeTopic(const DdeTopic &)=delete
DdeString * pName
Definition: svdde.hxx:251
std::vector< DdeItem * > aItems
Definition: svdde.hxx:253
OUString aItem
Definition: svdde.hxx:252
DdeTopic(SAL_UNUSED_PARAMETER const OUString &)
OUString GetName() const
Definition: ddesvr.cxx:495
const OUString & GetCurItem() const
Definition: svdde.hxx:267
const std::vector< DdeItem * > & GetItems() const
Definition: svdde.hxx:268
friend class DdeItem
Definition: svdde.hxx:248
DdeTransaction(DdeConnection &, SAL_UNUSED_PARAMETER const OUString &, SAL_UNUSED_PARAMETER tools::Long=0)
short nType
Definition: svdde.hxx:88
void SetDoneHdl(const Link< bool, void > &rLink)
Definition: svdde.hxx:108
DdeTransaction(const DdeTransaction &)=delete
tools::Long GetError() const
Definition: svdde.hxx:320
void SetFormat(SotClipboardFormatId nFmt)
Definition: svdde.hxx:111
Link< const DdeData *, void > aData
Definition: svdde.hxx:91
bool IsBusy() const
Definition: svdde.hxx:100
OUString GetName() const
Definition: ddecli.cxx:316
Link< bool, void > aDone
Definition: svdde.hxx:92
void SetDataHdl(const Link< const DdeData *, void > &rLink)
Definition: svdde.hxx:105
virtual ~DdeTransaction()
Definition: ddecli.cxx:250
void Execute()
Definition: ddecli.cxx:263
const DdeTransaction & operator=(const DdeTransaction &)=delete
const Link< const DdeData *, void > & GetDataHdl() const
Definition: svdde.hxx:106
bool bBusy
Definition: svdde.hxx:93
DdeString * pName
Definition: svdde.hxx:87
void Done(bool bDataValid)
Definition: ddecli.cxx:334
const Link< bool, void > & GetDoneHdl() const
Definition: svdde.hxx:109
sal_IntPtr nId
Definition: svdde.hxx:89
SotClipboardFormatId GetFormat() const
Definition: svdde.hxx:112
DdeData aDdeData
Definition: svdde.hxx:86
DdeConnection & rDde
Definition: svdde.hxx:85
sal_IntPtr nTime
Definition: svdde.hxx:90
void Data(const DdeData *)
Definition: ddecli.cxx:321
virtual OUString GetName() const override
SotClipboardFormatId
void Notify(SwFlyFrame *pFly, SwPageFrame *pOld, const SwRect &rOld, const SwRect *pOldRect=nullptr)
void * p
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
Status
Put
const ::avmedia::MediaItem * Execute(const SdrMarkView *pSdrView, SfxRequest const &rReq)
long Long
sal_uIntPtr sal_uLong
::std::vector< DdeService * > DdeServices
Definition: svdde.hxx:41
#define SVL_DLLPRIVATE
Definition: svldllapi.h:30
#define SVL_DLLPUBLIC
Definition: svldllapi.h:28
unsigned char sal_uInt8
sal_uInt16 sal_Unicode