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
400
401
402
403
404
405
406
407
408
409
410
411
412
|
/* -*- 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/.
*/
#ifndef INCLUDED_SW_SOURCE_FILTER_WW8_WW8TOOLBAR_HXX
#define INCLUDED_SW_SOURCE_FILTER_WW8_WW8TOOLBAR_HXX
#include <com/sun/star/container/XIndexContainer.hpp>
#include <filter/msfilter/mstoolbar.hxx>
#include <memory>
class Xst : public TBBase
{
OUString sString;
public:
Xst(){}
bool Read(SvStream &rS) override;
const OUString& getString() const { return sString; }
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* fp ) override;
#endif
};
class SwCTBWrapper;
class SwTBC : public TBBase
{
TBCHeader tbch;
std::shared_ptr< sal_uInt32 > cid; // optional
std::shared_ptr<TBCData> tbcd;
public:
SwTBC();
virtual ~SwTBC() override;
bool Read(SvStream &rS) override;
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* ) override;
#endif
bool ImportToolBarControl( SwCTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper&, bool );
OUString GetCustomText();
};
class SwCTB : public TBBase
{
Xst name;
sal_Int32 cbTBData;
TB tb;
std::vector<TBVisualData> rVisualData;
sal_Int32 iWCTBl;
sal_uInt16 reserved;
sal_uInt16 unused;
sal_Int32 cCtls;
std::vector< SwTBC > rTBC;
SwCTB(const SwCTB&) = delete;
SwCTB& operator = ( const SwCTB&) = delete;
public:
SwCTB();
virtual ~SwCTB() override;
bool Read(SvStream &rS) override;
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* fp ) override;
#endif
bool IsMenuToolbar();
bool ImportCustomToolBar( SwCTBWrapper&, CustomToolBarImportHelper& );
bool ImportMenuTB( SwCTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
OUString GetName() { return tb.getName().getString(); }
};
class TBDelta : public TBBase
{
sal_uInt8 doprfatendFlags;
sal_uInt8 ibts;
sal_Int32 cidNext;
sal_Int32 cid;
sal_Int32 fc;
sal_uInt16 CiTBDE; // careful of this ( endian matters etc. )
sal_uInt16 cbTBC;
public:
TBDelta();
virtual ~TBDelta() override {}
bool Read(SvStream &rS) override;
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* ) override;
#endif
bool ControlIsInserted();
bool ControlDropsToolBar();
sal_Int32 TBCStreamOffset() { return fc;}
sal_Int16 CustomizationIndex();
};
class Tcg255SubStruct : public TBBase
{
friend class Tcg255;
Tcg255SubStruct(const Tcg255SubStruct&) = delete;
Tcg255SubStruct& operator = ( const Tcg255SubStruct&) = delete;
protected:
sal_uInt8 ch;
public:
explicit Tcg255SubStruct();
virtual ~Tcg255SubStruct() override {}
sal_uInt8 id() const { return ch; }
bool Read(SvStream &rS) override;
};
class SwCTBWrapper;
class Customization : public TBBase
{
friend class SwCTBWrapper;
sal_Int32 tbidForTBD;
sal_uInt16 reserved1;
sal_uInt16 ctbds;
SwCTBWrapper* pWrapper;
std::shared_ptr< SwCTB > customizationDataCTB;
std::vector< TBDelta > customizationDataTBDelta;
bool bIsDroppedMenuTB;
public:
explicit Customization( SwCTBWrapper* rapper );
virtual ~Customization() override;
bool Read(SvStream &rS) override;
bool ImportCustomToolBar( SwCTBWrapper&, CustomToolBarImportHelper& );
bool ImportMenu( SwCTBWrapper&, CustomToolBarImportHelper& );
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* ) override;
#endif
SwCTB* GetCustomizationData() { return customizationDataCTB.get(); };
};
class SfxObjectShell;
class SwCTBWrapper : public Tcg255SubStruct
{
// reserved1 is the ch field of Tcg255SubStruct
sal_uInt16 reserved2;
sal_uInt8 reserved3;
sal_uInt16 reserved4;
sal_uInt16 reserved5;
sal_Int16 cbTBD;
sal_uInt16 cCust;
sal_Int32 cbDTBC;
std::vector< SwTBC > rtbdc;
std::vector< Customization > rCustomizations; // array of Customizations
std::vector< sal_Int16 > dropDownMenuIndices; // array of indexes of Customization toolbars that are dropped by a menu
SwCTBWrapper(const SwCTBWrapper&) = delete;
SwCTBWrapper& operator = ( const SwCTBWrapper&) = delete;
public:
explicit SwCTBWrapper();
virtual ~SwCTBWrapper() override;
void InsertDropIndex( sal_Int32 aIndex ) { dropDownMenuIndices.push_back( aIndex ); }
SwTBC* GetTBCAtOffset( sal_uInt32 nStreamOffset );
bool Read(SvStream &rS) override;
bool ImportCustomToolBar( SfxObjectShell& rDocSh );
Customization* GetCustomizaton( sal_Int16 index );
SwCTB* GetCustomizationData( const OUString& name );
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* ) override;
#endif
};
class MCD : public TBBase
{
sal_Int8 reserved1; // A signed integer that MUST be 0x56.
sal_uInt8 reserved2; // MUST be 0.
sal_uInt16 ibst; // Unsigned integer that specifies the name of the macro. Macro name is specified by MacroName.xstz of the MacroName entry in the MacroNames such that MacroName.ibst equals ibst. MacroNames MUST contain such an entry.
sal_uInt16 ibstName; // An unsigned integer that specifies the index into the Command String Table (TcgSttbf.sttbf) where the macro's name and arguments are specified.
sal_uInt16 reserved3; // An unsigned integer that MUST be 0xFFFF.
sal_uInt32 reserved4; //MUST be ignored.
sal_uInt32 reserved5; //MUST be 0.
sal_uInt32 reserved6; //MUST be ignored.
sal_uInt32 reserved7; //MUST be ignored
public:
MCD();
MCD(const MCD&);
MCD& operator = ( const MCD&);
bool Read(SvStream &rS) override;
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* ) override;
#endif
};
class PlfMcd : public Tcg255SubStruct
{
sal_Int32 iMac;
std::vector<MCD> rgmcd; // array of MCD's
PlfMcd(const PlfMcd&) = delete;
PlfMcd& operator = ( const PlfMcd&) = delete;
public:
explicit PlfMcd();
bool Read(SvStream &rS) override;
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* ) override;
#endif
};
class Acd : public TBBase
{
sal_Int16 ibst;
sal_uInt16 fciBasedOnABC; // fciBasedOn(13 bits) A(1bit)B(1bit)C(1Bit)
Acd(const Acd&) = delete;
Acd& operator = ( const Acd&) = delete;
public:
Acd();
virtual ~Acd() override {}
bool Read(SvStream &rS) override;
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* ) override;
#endif
};
class PlfAcd: public Tcg255SubStruct
{
sal_Int32 iMac;
Acd* rgacd;
PlfAcd(const PlfAcd&) = delete;
PlfAcd& operator = ( const PlfAcd&) = delete;
public:
explicit PlfAcd();
virtual ~PlfAcd() override;
bool Read(SvStream &rS) override;
#if OSL_DEBUG_LEVEL > 1
virtual void Print(FILE*) override;
#endif
};
class Kme : public TBBase
{
sal_Int16 reserved1; //MUST be zero.
sal_Int16 reserved2; //MUST be zero.
sal_uInt16 kcm1; //A Kcm that specifies the primary shortcut key.
sal_uInt16 kcm2; //A Kcm that specifies the secondary shortcut key, or 0x00FF if there is no secondary shortcut key.
sal_uInt16 kt; //A Kt that specifies the type of action to be taken when the key combination is pressed.
sal_uInt32 param; //The meaning of this field depends on the value of kt
Kme(const Kme&) = delete;
Kme& operator = ( const Kme&) = delete;
public:
Kme();
virtual ~Kme() override;
bool Read(SvStream &rS) override;
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* ) override;
#endif
};
class PlfKme : public Tcg255SubStruct
{
sal_Int32 iMac;
Kme* rgkme;
PlfKme(const PlfKme&) = delete;
PlfKme& operator = ( const PlfKme&) = delete;
public:
explicit PlfKme();
virtual ~PlfKme() override;
bool Read(SvStream &rS) override;
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* ) override;
#endif
};
class TcgSttbfCore : public TBBase
{
struct SBBItem
{
sal_uInt16 cchData;
OUString data;
sal_uInt16 extraData;
SBBItem() : cchData(0), extraData(0){}
};
sal_uInt16 fExtend;
sal_uInt16 cData;
sal_uInt16 cbExtra;
std::unique_ptr<SBBItem[]> dataItems;
TcgSttbfCore(const TcgSttbfCore&) = delete;
TcgSttbfCore& operator = ( const TcgSttbfCore&) = delete;
public:
TcgSttbfCore();
virtual ~TcgSttbfCore() override;
bool Read(SvStream &rS) override;
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* fp ) override;
#endif
};
class TcgSttbf : public Tcg255SubStruct
{
TcgSttbfCore sttbf;
TcgSttbf(const TcgSttbf&) = delete;
TcgSttbf& operator = ( const TcgSttbf&) = delete;
public:
explicit TcgSttbf();
virtual ~TcgSttbf() override {}
bool Read(SvStream &rS) override;
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* fp ) override;
#endif
};
class Xstz : public TBBase
{
Xst xst; //An Xst specifying the string with its pre-pended length.
sal_uInt16 chTerm;
Xstz(const Xstz&) = delete;
Xstz& operator = ( const Xstz&) = delete;
public:
Xstz();
virtual ~Xstz() override {}
bool Read(SvStream &rS) override;
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* fp ) override;
#endif
};
class MacroName : public TBBase
{
sal_uInt16 ibst; //An unsigned integer that specifies the index of the current entry in the macro name table. MUST NOT be the same as the index of any other entry.
Xstz xstz;
MacroName(const MacroName&) = delete;
MacroName& operator = ( const MacroName&) = delete;
public:
MacroName();
virtual ~MacroName() override {}
bool Read(SvStream &rS) override;
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* ) override;
#endif
};
class MacroNames : public Tcg255SubStruct
{
sal_uInt16 iMac; //An unsigned integer that specifies the number of MacroName structures in rgNames.
std::unique_ptr<MacroName[]> rgNames;
MacroNames(const MacroNames&) = delete;
MacroNames& operator = ( const MacroNames&) = delete;
public:
explicit MacroNames();
virtual ~MacroNames() override;
bool Read(SvStream &rS) override;
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* ) override;
#endif
};
class Tcg255 : public TBBase
{
std::vector< Tcg255SubStruct* > rgtcgData; // array of sub structures
Tcg255(const Tcg255&) = delete;
Tcg255& operator = ( const Tcg255&) = delete;
bool processSubStruct( sal_uInt8 nId, SvStream& );
public:
Tcg255();
virtual ~Tcg255() override;
bool Read(SvStream &rS) override;
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* ) override;
#endif
bool ImportCustomToolBar( SfxObjectShell& rDocSh );
};
class Tcg: public TBBase
{
sal_Int8 nTcgVer;
std::unique_ptr< Tcg255 > tcg;
Tcg(const Tcg&) = delete;
Tcg& operator = ( const Tcg&) = delete;
public:
Tcg();
virtual ~Tcg() override {}
bool Read(SvStream &rS) override;
bool ImportCustomToolBar( SfxObjectShell& rDocSh );
#if OSL_DEBUG_LEVEL > 1
virtual void Print( FILE* ) override;
#endif
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|