LibreOffice Module sw (master)  1
ww8toolbar.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 #ifndef INCLUDED_SW_SOURCE_FILTER_WW8_WW8TOOLBAR_HXX
10 #define INCLUDED_SW_SOURCE_FILTER_WW8_WW8TOOLBAR_HXX
11 
12 #include <com/sun/star/container/XIndexContainer.hpp>
14 #include <memory>
15 
16 
17 class SfxObjectShell;
18 class SwCTBWrapper;
19 
20 class Xst : public TBBase
21 {
22  OUString sString;
23 
24 public:
25  Xst(){}
26  bool Read(SvStream &rS) override;
27  const OUString& getString() const { return sString; }
28 };
29 
30 class SwTBC : public TBBase
31 {
33  std::shared_ptr< sal_uInt32 > cid; // optional
34  std::shared_ptr<TBCData> tbcd;
35 
36 public:
37  SwTBC();
38  virtual ~SwTBC() override;
39  bool Read(SvStream &rS) override;
40  bool ImportToolBarControl( SwCTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper&, bool );
41  OUString GetCustomText();
42 };
43 
44 class SwCTB : public TBBase
45 {
47  sal_Int32 cbTBData;
48  TB tb;
49  std::vector<TBVisualData> rVisualData;
50  sal_Int32 iWCTBl;
51  sal_uInt16 reserved;
52  sal_uInt16 unused;
53  sal_Int32 cCtls;
54  std::vector< SwTBC > rTBC;
55 
56  SwCTB(const SwCTB&) = delete;
57  SwCTB& operator = ( const SwCTB&) = delete;
58 
59 public:
60  SwCTB();
61  virtual ~SwCTB() override;
62  bool Read(SvStream &rS) override;
63  bool IsMenuToolbar() const;
65  bool ImportMenuTB( SwCTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
66  OUString const & GetName() { return tb.getName().getString(); }
67 };
68 
69 class TBDelta : public TBBase
70 {
72 
74  sal_Int32 cidNext;
75  sal_Int32 cid;
76  sal_Int32 fc;
77  sal_uInt16 CiTBDE; // careful of this ( endian matters etc. )
78  sal_uInt16 cbTBC;
79 
80 public:
81  TBDelta();
82  bool Read(SvStream &rS) override;
83  bool ControlIsInserted();
84  bool ControlDropsToolBar();
85  sal_Int32 TBCStreamOffset() { return fc;}
86  sal_Int16 CustomizationIndex();
87 };
88 
89 class Tcg255SubStruct : public TBBase
90 {
91  friend class Tcg255;
92 
93  Tcg255SubStruct(const Tcg255SubStruct&) = delete;
94  Tcg255SubStruct& operator = ( const Tcg255SubStruct&) = delete;
95 
96 protected:
98 
99 public:
100  explicit Tcg255SubStruct();
101  sal_uInt8 id() const { return ch; }
102  bool Read(SvStream &rS) override;
103 };
104 
105 class Customization : public TBBase
106 {
107  friend class SwCTBWrapper;
108 
109  sal_Int32 tbidForTBD;
110  sal_uInt16 reserved1;
111  sal_uInt16 ctbds;
113  std::shared_ptr< SwCTB > customizationDataCTB;
114  std::vector< TBDelta > customizationDataTBDelta;
116 
117 public:
118  explicit Customization( SwCTBWrapper* rapper );
119  virtual ~Customization() override;
120  bool Read(SvStream &rS) override;
123  SwCTB* GetCustomizationData() { return customizationDataCTB.get(); };
124 };
125 
127 {
128  // reserved1 is the ch field of Tcg255SubStruct
129  sal_uInt16 reserved2;
131  sal_uInt16 reserved4;
132  sal_uInt16 reserved5;
133 
134  sal_Int16 cbTBD;
135  sal_uInt16 cCust;
136 
137  sal_Int32 cbDTBC;
138 
139  std::vector< SwTBC > rtbdc;
140  std::vector< Customization > rCustomizations; // array of Customizations
141  std::vector< sal_Int16 > dropDownMenuIndices; // array of indexes of Customization toolbars that are dropped by a menu
142  SwCTBWrapper(const SwCTBWrapper&) = delete;
143  SwCTBWrapper& operator = ( const SwCTBWrapper&) = delete;
144 
145 public:
146  explicit SwCTBWrapper();
147  virtual ~SwCTBWrapper() override;
148  void InsertDropIndex( sal_Int32 aIndex ) { dropDownMenuIndices.push_back( aIndex ); }
149  SwTBC* GetTBCAtOffset( sal_uInt32 nStreamOffset );
150  bool Read(SvStream &rS) override;
151  bool ImportCustomToolBar( SfxObjectShell& rDocSh );
152 
153  Customization* GetCustomizaton( sal_Int16 index );
154  SwCTB* GetCustomizationData( const OUString& name );
155 };
156 
157 class MCD : public TBBase
158 {
159  sal_Int8 reserved1; // A signed integer that MUST be 0x56.
160  sal_uInt8 reserved2; // MUST be 0.
161  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.
162  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.
163  sal_uInt16 reserved3; // An unsigned integer that MUST be 0xFFFF.
164  sal_uInt32 reserved4; //MUST be ignored.
165  sal_uInt32 reserved5; //MUST be 0.
166  sal_uInt32 reserved6; //MUST be ignored.
167  sal_uInt32 reserved7; //MUST be ignored
168 
169 public:
170  MCD();
171  bool Read(SvStream &rS) override;
172 };
173 
174 class PlfMcd : public Tcg255SubStruct
175 {
176  sal_Int32 iMac;
177  std::vector<MCD> rgmcd; // array of MCD's
178  PlfMcd(const PlfMcd&) = delete;
179  PlfMcd& operator = ( const PlfMcd&) = delete;
180 
181 public:
182  explicit PlfMcd();
183  bool Read(SvStream &rS) override;
184 };
185 
186 class Acd : public TBBase
187 {
188  sal_Int16 ibst;
189  sal_uInt16 fciBasedOnABC; // fciBasedOn(13 bits) A(1bit)B(1bit)C(1Bit)
190  Acd(const Acd&) = delete;
191  Acd& operator = ( const Acd&) = delete;
192 
193 public:
194  Acd();
195  bool Read(SvStream &rS) override;
196 };
197 
198 class PlfAcd: public Tcg255SubStruct
199 {
200  sal_Int32 iMac;
201  std::unique_ptr<Acd[]> rgacd;
202  PlfAcd(const PlfAcd&) = delete;
203  PlfAcd& operator = ( const PlfAcd&) = delete;
204 
205 public:
206  explicit PlfAcd();
207  virtual ~PlfAcd() override;
208  bool Read(SvStream &rS) override;
209 };
210 
211 class Kme : public TBBase
212 {
213  sal_Int16 reserved1; //MUST be zero.
214  sal_Int16 reserved2; //MUST be zero.
215  sal_uInt16 kcm1; //A Kcm that specifies the primary shortcut key.
216  sal_uInt16 kcm2; //A Kcm that specifies the secondary shortcut key, or 0x00FF if there is no secondary shortcut key.
217  sal_uInt16 kt; //A Kt that specifies the type of action to be taken when the key combination is pressed.
218  sal_uInt32 param; //The meaning of this field depends on the value of kt
219 
220  Kme(const Kme&) = delete;
221  Kme& operator = ( const Kme&) = delete;
222 
223 public:
224  Kme();
225  virtual ~Kme() override;
226  bool Read(SvStream &rS) override;
227 };
228 
229 class PlfKme : public Tcg255SubStruct
230 {
231  sal_Int32 iMac;
232  std::unique_ptr<Kme[]> rgkme;
233  PlfKme(const PlfKme&) = delete;
234  PlfKme& operator = ( const PlfKme&) = delete;
235 
236 public:
237  explicit PlfKme();
238  virtual ~PlfKme() override;
239  bool Read(SvStream &rS) override;
240 };
241 
242 class TcgSttbfCore : public TBBase
243 {
244  struct SBBItem
245  {
246  sal_uInt16 cchData;
247  OUString data;
248  sal_uInt16 extraData;
249  SBBItem() : cchData(0), extraData(0){}
250  };
251 
252  sal_uInt16 fExtend;
253  sal_uInt16 cData;
254  sal_uInt16 cbExtra;
255  std::unique_ptr<SBBItem[]> dataItems;
256  TcgSttbfCore(const TcgSttbfCore&) = delete;
257  TcgSttbfCore& operator = ( const TcgSttbfCore&) = delete;
258 
259 public:
260  TcgSttbfCore();
261  virtual ~TcgSttbfCore() override;
262  bool Read(SvStream &rS) override;
263 };
264 
265 class TcgSttbf : public Tcg255SubStruct
266 {
268  TcgSttbf(const TcgSttbf&) = delete;
269  TcgSttbf& operator = ( const TcgSttbf&) = delete;
270 
271 public:
272  explicit TcgSttbf();
273  bool Read(SvStream &rS) override;
274 };
275 
276 class Xstz : public TBBase
277 {
278  Xst xst; //An Xst specifying the string with its pre-pended length.
279  sal_uInt16 chTerm;
280 
281  Xstz(const Xstz&) = delete;
282  Xstz& operator = ( const Xstz&) = delete;
283 
284 public:
285  Xstz();
286  bool Read(SvStream &rS) override;
287 };
288 
289 class MacroName : public TBBase
290 {
291  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.
293  MacroName(const MacroName&) = delete;
294  MacroName& operator = ( const MacroName&) = delete;
295 
296 public:
297  MacroName();
298  bool Read(SvStream &rS) override;
299 };
300 
302 {
303  sal_uInt16 iMac; //An unsigned integer that specifies the number of MacroName structures in rgNames.
304  std::unique_ptr<MacroName[]> rgNames;
305 
306  MacroNames(const MacroNames&) = delete;
307  MacroNames& operator = ( const MacroNames&) = delete;
308 
309 public:
310  explicit MacroNames();
311  virtual ~MacroNames() override;
312  bool Read(SvStream &rS) override;
313 };
314 
315 class Tcg255 : public TBBase
316 {
317  std::vector< std::unique_ptr<Tcg255SubStruct> > rgtcgData; // array of sub structures
318  Tcg255(const Tcg255&) = delete;
319  Tcg255& operator = ( const Tcg255&) = delete;
320  bool processSubStruct( sal_uInt8 nId, SvStream& );
321 
322 public:
323  Tcg255();
324  virtual ~Tcg255() override;
325  bool Read(SvStream &rS) override;
326  bool ImportCustomToolBar( SfxObjectShell& rDocSh );
327 };
328 
329 class Tcg: public TBBase
330 {
332  std::unique_ptr< Tcg255 > tcg;
333  Tcg(const Tcg&) = delete;
334  Tcg& operator = ( const Tcg&) = delete;
335 
336 public:
337  Tcg();
338  bool Read(SvStream &rS) override;
339  bool ImportCustomToolBar( SfxObjectShell& rDocSh );
340 };
341 
342 #endif
343 
344 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 cCust
Definition: ww8toolbar.hxx:135
sal_uInt16 fExtend
Definition: ww8toolbar.hxx:252
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:397
const OUString & getString() const
Definition: ww8toolbar.hxx:27
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:761
bool ImportToolBarControl(SwCTBWrapper &, const css::uno::Reference< css::container::XIndexContainer > &, CustomToolBarImportHelper &, bool)
Definition: ww8toolbar.cxx:513
sal_uInt8 ch
Definition: ww8toolbar.hxx:97
std::vector< sal_Int16 > dropDownMenuIndices
Definition: ww8toolbar.hxx:141
bool ControlDropsToolBar()
Definition: ww8toolbar.cxx:357
sal_uInt8 ibts
Definition: ww8toolbar.hxx:73
bool ImportCustomToolBar(SwCTBWrapper &, CustomToolBarImportHelper &)
Definition: ww8toolbar.cxx:327
virtual ~Kme() override
Definition: ww8toolbar.cxx:965
std::vector< TBVisualData > rVisualData
Definition: ww8toolbar.hxx:49
sal_uInt8 doprfatendFlags
Definition: ww8toolbar.hxx:71
SwCTBWrapper * pWrapper
Definition: ww8toolbar.hxx:112
Kme & operator=(const Kme &)=delete
PlfKme & operator=(const PlfKme &)=delete
virtual ~SwCTBWrapper() override
Definition: ww8toolbar.cxx:89
bool processSubStruct(sal_uInt8 nId, SvStream &)
Definition: ww8toolbar.cxx:658
Tcg & operator=(const Tcg &)=delete
signed char sal_Int8
virtual ~PlfAcd() override
Definition: ww8toolbar.cxx:792
std::unique_ptr< Tcg255 > tcg
Definition: ww8toolbar.hxx:332
sal_uInt16 CiTBDE
Definition: ww8toolbar.hxx:77
sal_Int32 iMac
Definition: ww8toolbar.hxx:176
sal_Int32 iMac
Definition: ww8toolbar.hxx:200
bool bIsDroppedMenuTB
Definition: ww8toolbar.hxx:115
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:371
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:620
MacroNames & operator=(const MacroNames &)=delete
PlfAcd & operator=(const PlfAcd &)=delete
sal_uInt16 reserved5
Definition: ww8toolbar.hxx:132
virtual ~SwTBC() override
Definition: ww8toolbar.cxx:487
sal_uInt16 fciBasedOnABC
Definition: ww8toolbar.hxx:189
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:749
SwCTB * GetCustomizationData(const OUString &name)
Definition: ww8toolbar.cxx:100
sal_uInt32 reserved5
Definition: ww8toolbar.hxx:165
std::vector< MCD > rgmcd
Definition: ww8toolbar.hxx:177
std::vector< std::unique_ptr< Tcg255SubStruct > > rgtcgData
Definition: ww8toolbar.hxx:317
sal_Int16 reserved2
Definition: ww8toolbar.hxx:214
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:905
std::vector< SwTBC > rtbdc
Definition: ww8toolbar.hxx:139
sal_Int8 reserved1
Definition: ww8toolbar.hxx:159
sal_Int16 ibst
Definition: ww8toolbar.hxx:188
sal_uInt16 ibstName
Definition: ww8toolbar.hxx:162
virtual ~SwCTB() override
Definition: ww8toolbar.cxx:388
Acd & operator=(const Acd &)=delete
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:491
OUString const & GetName()
Definition: ww8toolbar.hxx:66
sal_uInt32 reserved4
Definition: ww8toolbar.hxx:164
Tcg255SubStruct & operator=(const Tcg255SubStruct &)=delete
Xst xst
Definition: ww8toolbar.hxx:278
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:944
sal_uInt16 reserved1
Definition: ww8toolbar.hxx:110
sal_Int16 reserved1
Definition: ww8toolbar.hxx:213
sal_uInt16 ibst
Definition: ww8toolbar.hxx:291
Xst()
Definition: ww8toolbar.hxx:25
bool ImportMenu(SwCTBWrapper &, CustomToolBarImportHelper &)
Definition: ww8toolbar.cxx:254
sal_uInt16 reserved3
Definition: ww8toolbar.hxx:163
virtual ~MacroNames() override
Definition: ww8toolbar.cxx:901
sal_uInt16 cData
Definition: ww8toolbar.hxx:253
TcgSttbfCore & operator=(const TcgSttbfCore &)=delete
sal_uInt16 kcm1
Definition: ww8toolbar.hxx:215
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:983
SwTBC * GetTBCAtOffset(sal_uInt32 nStreamOffset)
Definition: ww8toolbar.cxx:174
sal_Int16 CustomizationIndex()
Definition: ww8toolbar.cxx:363
sal_uInt16 ctbds
Definition: ww8toolbar.hxx:111
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:796
PlfMcd & operator=(const PlfMcd &)=delete
sal_uInt32 reserved7
Definition: ww8toolbar.hxx:167
sal_uInt16 cbExtra
Definition: ww8toolbar.hxx:254
sal_Int32 cCtls
Definition: ww8toolbar.hxx:53
std::shared_ptr< SwCTB > customizationDataCTB
Definition: ww8toolbar.hxx:113
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:728
virtual ~Customization() override
Definition: ww8toolbar.cxx:219
std::shared_ptr< sal_uInt32 > cid
Definition: ww8toolbar.hxx:33
std::shared_ptr< TBCData > tbcd
Definition: ww8toolbar.hxx:34
sal_uInt16 reserved4
Definition: ww8toolbar.hxx:131
OUString GetCustomText()
Definition: ww8toolbar.cxx:612
sal_Int32 iWCTBl
Definition: ww8toolbar.hxx:50
Customization * GetCustomizaton(sal_Int16 index)
Definition: ww8toolbar.cxx:93
sal_uInt8 reserved3
Definition: ww8toolbar.hxx:130
bool ImportCustomToolBar(SfxObjectShell &rDocSh)
Definition: ww8toolbar.cxx:705
SwCTBWrapper & operator=(const SwCTBWrapper &)=delete
sal_uInt16 ibst
Definition: ww8toolbar.hxx:161
SwCTB & operator=(const SwCTB &)=delete
MacroName & operator=(const MacroName &)=delete
std::vector< Customization > rCustomizations
Definition: ww8toolbar.hxx:140
sal_Int32 cbTBData
Definition: ww8toolbar.hxx:47
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:831
sal_Int32 tbidForTBD
Definition: ww8toolbar.hxx:109
sal_uInt32 reserved6
Definition: ww8toolbar.hxx:166
std::vector< TBDelta > customizationDataTBDelta
Definition: ww8toolbar.hxx:114
std::vector< SwTBC > rTBC
Definition: ww8toolbar.hxx:54
sal_uInt16 cbTBC
Definition: ww8toolbar.hxx:78
TcgSttbf & operator=(const TcgSttbf &)=delete
bool Read(SvStream &rS) override
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:632
std::unique_ptr< MacroName[]> rgNames
Definition: ww8toolbar.hxx:304
sal_Int32 iMac
Definition: ww8toolbar.hxx:231
bool ImportCustomToolBar(SfxObjectShell &rDocSh)
Definition: ww8toolbar.cxx:643
sal_uInt16 unused
Definition: ww8toolbar.hxx:52
unsigned char sal_uInt8
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:876
sal_uInt8 id() const
Definition: ww8toolbar.hxx:101
std::unique_ptr< Acd[]> rgacd
Definition: ww8toolbar.hxx:201
sal_Int32 cbDTBC
Definition: ww8toolbar.hxx:137
virtual ~Tcg255() override
Definition: ww8toolbar.cxx:654
sal_uInt16 chTerm
Definition: ww8toolbar.hxx:279
sal_uInt16 reserved2
Definition: ww8toolbar.hxx:129
virtual ~PlfKme() override
Definition: ww8toolbar.cxx:827
Customization(SwCTBWrapper *rapper)
Definition: ww8toolbar.cxx:210
sal_Int8 nTcgVer
Definition: ww8toolbar.hxx:331
virtual ~TcgSttbfCore() override
Definition: ww8toolbar.cxx:872
WString & getName()
TcgSttbfCore sttbf
Definition: ww8toolbar.hxx:267
sal_Int32 TBCStreamOffset()
Definition: ww8toolbar.hxx:85
bool ImportMenuTB(SwCTBWrapper &, const css::uno::Reference< css::container::XIndexContainer > &, CustomToolBarImportHelper &)
Definition: ww8toolbar.cxx:472
sal_Int16 cbTBD
Definition: ww8toolbar.hxx:134
Tcg255 & operator=(const Tcg255 &)=delete
const OUString & getString() const
Xstz & operator=(const Xstz &)=delete
sal_uInt16 reserved
Definition: ww8toolbar.hxx:51
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:858
std::unique_ptr< SBBItem[]> dataItems
Definition: ww8toolbar.hxx:255
sal_uInt32 param
Definition: ww8toolbar.hxx:218
TBCHeader tbch
Definition: ww8toolbar.hxx:32
bool ImportCustomToolBar(SfxObjectShell &rDocSh)
Definition: ww8toolbar.cxx:183
std::unique_ptr< Kme[]> rgkme
Definition: ww8toolbar.hxx:232
sal_Int32 cid
Definition: ww8toolbar.hxx:75
sal_uInt16 kcm2
Definition: ww8toolbar.hxx:216
void InsertDropIndex(sal_Int32 aIndex)
Definition: ww8toolbar.hxx:148
sal_uInt16 kt
Definition: ww8toolbar.hxx:217
sal_uInt16 iMac
Definition: ww8toolbar.hxx:303
bool ControlIsInserted()
Definition: ww8toolbar.cxx:352
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:112
sal_Int32 cidNext
Definition: ww8toolbar.hxx:74
Xst name
Definition: ww8toolbar.hxx:46
bool ImportCustomToolBar(SwCTBWrapper &, CustomToolBarImportHelper &)
Definition: ww8toolbar.cxx:428
OUString sString
Definition: ww8toolbar.hxx:22
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:931
sal_Int32 fc
Definition: ww8toolbar.hxx:76
SwCTB * GetCustomizationData()
Definition: ww8toolbar.hxx:123
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:970
bool Read(SvStream &rS) override
Definition: ww8toolbar.cxx:223
sal_uInt8 reserved2
Definition: ww8toolbar.hxx:160
bool IsMenuToolbar() const
Definition: ww8toolbar.cxx:392