build fix
[LibreOffice.git] / sw / source / filter / ww8 / ww8toolbar.hxx
blob01f3e8fc6aa27e9385a7bdc1ce10d5e0ab1d04dc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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
12 #include <com/sun/star/container/XIndexContainer.hpp>
13 #include <filter/msfilter/mstoolbar.hxx>
14 #include <memory>
16 class Xst : public TBBase
18 OUString sString;
20 public:
21 Xst(){}
22 bool Read(SvStream &rS) override;
23 const OUString& getString() const { return sString; }
24 #if OSL_DEBUG_LEVEL > 1
25 virtual void Print( FILE* fp ) override;
26 #endif
29 class SwCTBWrapper;
31 class SwTBC : public TBBase
33 TBCHeader tbch;
34 std::shared_ptr< sal_uInt32 > cid; // optional
35 std::shared_ptr<TBCData> tbcd;
37 public:
38 SwTBC();
39 virtual ~SwTBC() override;
40 bool Read(SvStream &rS) override;
41 #if OSL_DEBUG_LEVEL > 1
42 virtual void Print( FILE* ) override;
43 #endif
44 bool ImportToolBarControl( SwCTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper&, bool );
45 OUString GetCustomText();
48 class SwCTB : public TBBase
50 Xst name;
51 sal_Int32 cbTBData;
52 TB tb;
53 std::vector<TBVisualData> rVisualData;
54 sal_Int32 iWCTBl;
55 sal_uInt16 reserved;
56 sal_uInt16 unused;
57 sal_Int32 cCtls;
58 std::vector< SwTBC > rTBC;
60 SwCTB(const SwCTB&) = delete;
61 SwCTB& operator = ( const SwCTB&) = delete;
63 public:
64 SwCTB();
65 virtual ~SwCTB() override;
66 bool Read(SvStream &rS) override;
67 #if OSL_DEBUG_LEVEL > 1
68 virtual void Print( FILE* fp ) override;
69 #endif
70 bool IsMenuToolbar();
71 bool ImportCustomToolBar( SwCTBWrapper&, CustomToolBarImportHelper& );
72 bool ImportMenuTB( SwCTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper& );
73 OUString GetName() { return tb.getName().getString(); }
76 class TBDelta : public TBBase
78 sal_uInt8 doprfatendFlags;
80 sal_uInt8 ibts;
81 sal_Int32 cidNext;
82 sal_Int32 cid;
83 sal_Int32 fc;
84 sal_uInt16 CiTBDE; // careful of this ( endian matters etc. )
85 sal_uInt16 cbTBC;
87 public:
88 TBDelta();
89 virtual ~TBDelta() override {}
90 bool Read(SvStream &rS) override;
91 #if OSL_DEBUG_LEVEL > 1
92 virtual void Print( FILE* ) override;
93 #endif
94 bool ControlIsInserted();
95 bool ControlDropsToolBar();
96 sal_Int32 TBCStreamOffset() { return fc;}
97 sal_Int16 CustomizationIndex();
100 class Tcg255SubStruct : public TBBase
102 friend class Tcg255;
104 Tcg255SubStruct(const Tcg255SubStruct&) = delete;
105 Tcg255SubStruct& operator = ( const Tcg255SubStruct&) = delete;
107 protected:
108 sal_uInt8 ch;
110 public:
111 explicit Tcg255SubStruct();
112 virtual ~Tcg255SubStruct() override {}
113 sal_uInt8 id() const { return ch; }
114 bool Read(SvStream &rS) override;
117 class SwCTBWrapper;
119 class Customization : public TBBase
121 friend class SwCTBWrapper;
123 sal_Int32 tbidForTBD;
124 sal_uInt16 reserved1;
125 sal_uInt16 ctbds;
126 SwCTBWrapper* pWrapper;
127 std::shared_ptr< SwCTB > customizationDataCTB;
128 std::vector< TBDelta > customizationDataTBDelta;
129 bool bIsDroppedMenuTB;
131 public:
132 explicit Customization( SwCTBWrapper* rapper );
133 virtual ~Customization() override;
134 bool Read(SvStream &rS) override;
135 bool ImportCustomToolBar( SwCTBWrapper&, CustomToolBarImportHelper& );
136 bool ImportMenu( SwCTBWrapper&, CustomToolBarImportHelper& );
137 #if OSL_DEBUG_LEVEL > 1
138 virtual void Print( FILE* ) override;
139 #endif
140 SwCTB* GetCustomizationData() { return customizationDataCTB.get(); };
143 class SfxObjectShell;
145 class SwCTBWrapper : public Tcg255SubStruct
147 // reserved1 is the ch field of Tcg255SubStruct
148 sal_uInt16 reserved2;
149 sal_uInt8 reserved3;
150 sal_uInt16 reserved4;
151 sal_uInt16 reserved5;
153 sal_Int16 cbTBD;
154 sal_uInt16 cCust;
156 sal_Int32 cbDTBC;
158 std::vector< SwTBC > rtbdc;
159 std::vector< Customization > rCustomizations; // array of Customizations
160 std::vector< sal_Int16 > dropDownMenuIndices; // array of indexes of Customization toolbars that are dropped by a menu
161 SwCTBWrapper(const SwCTBWrapper&) = delete;
162 SwCTBWrapper& operator = ( const SwCTBWrapper&) = delete;
164 public:
165 explicit SwCTBWrapper();
166 virtual ~SwCTBWrapper() override;
167 void InsertDropIndex( sal_Int32 aIndex ) { dropDownMenuIndices.push_back( aIndex ); }
168 SwTBC* GetTBCAtOffset( sal_uInt32 nStreamOffset );
169 bool Read(SvStream &rS) override;
170 bool ImportCustomToolBar( SfxObjectShell& rDocSh );
172 Customization* GetCustomizaton( sal_Int16 index );
173 SwCTB* GetCustomizationData( const OUString& name );
174 #if OSL_DEBUG_LEVEL > 1
175 virtual void Print( FILE* ) override;
176 #endif
179 class MCD : public TBBase
181 sal_Int8 reserved1; // A signed integer that MUST be 0x56.
182 sal_uInt8 reserved2; // MUST be 0.
183 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.
184 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.
185 sal_uInt16 reserved3; // An unsigned integer that MUST be 0xFFFF.
186 sal_uInt32 reserved4; //MUST be ignored.
187 sal_uInt32 reserved5; //MUST be 0.
188 sal_uInt32 reserved6; //MUST be ignored.
189 sal_uInt32 reserved7; //MUST be ignored
191 public:
192 MCD();
193 MCD(const MCD&);
194 MCD& operator = ( const MCD&);
195 bool Read(SvStream &rS) override;
196 #if OSL_DEBUG_LEVEL > 1
197 virtual void Print( FILE* ) override;
198 #endif
201 class PlfMcd : public Tcg255SubStruct
203 sal_Int32 iMac;
204 std::vector<MCD> rgmcd; // array of MCD's
205 PlfMcd(const PlfMcd&) = delete;
206 PlfMcd& operator = ( const PlfMcd&) = delete;
208 public:
209 explicit PlfMcd();
210 bool Read(SvStream &rS) override;
211 #if OSL_DEBUG_LEVEL > 1
212 virtual void Print( FILE* ) override;
213 #endif
216 class Acd : public TBBase
218 sal_Int16 ibst;
219 sal_uInt16 fciBasedOnABC; // fciBasedOn(13 bits) A(1bit)B(1bit)C(1Bit)
220 Acd(const Acd&) = delete;
221 Acd& operator = ( const Acd&) = delete;
223 public:
224 Acd();
225 virtual ~Acd() override {}
226 bool Read(SvStream &rS) override;
227 #if OSL_DEBUG_LEVEL > 1
228 virtual void Print( FILE* ) override;
229 #endif
232 class PlfAcd: public Tcg255SubStruct
234 sal_Int32 iMac;
235 Acd* rgacd;
236 PlfAcd(const PlfAcd&) = delete;
237 PlfAcd& operator = ( const PlfAcd&) = delete;
239 public:
240 explicit PlfAcd();
241 virtual ~PlfAcd() override;
242 bool Read(SvStream &rS) override;
243 #if OSL_DEBUG_LEVEL > 1
244 virtual void Print(FILE*) override;
245 #endif
248 class Kme : public TBBase
250 sal_Int16 reserved1; //MUST be zero.
251 sal_Int16 reserved2; //MUST be zero.
252 sal_uInt16 kcm1; //A Kcm that specifies the primary shortcut key.
253 sal_uInt16 kcm2; //A Kcm that specifies the secondary shortcut key, or 0x00FF if there is no secondary shortcut key.
254 sal_uInt16 kt; //A Kt that specifies the type of action to be taken when the key combination is pressed.
255 sal_uInt32 param; //The meaning of this field depends on the value of kt
257 Kme(const Kme&) = delete;
258 Kme& operator = ( const Kme&) = delete;
260 public:
261 Kme();
262 virtual ~Kme() override;
263 bool Read(SvStream &rS) override;
264 #if OSL_DEBUG_LEVEL > 1
265 virtual void Print( FILE* ) override;
266 #endif
269 class PlfKme : public Tcg255SubStruct
271 sal_Int32 iMac;
272 Kme* rgkme;
273 PlfKme(const PlfKme&) = delete;
274 PlfKme& operator = ( const PlfKme&) = delete;
276 public:
277 explicit PlfKme();
278 virtual ~PlfKme() override;
279 bool Read(SvStream &rS) override;
280 #if OSL_DEBUG_LEVEL > 1
281 virtual void Print( FILE* ) override;
282 #endif
285 class TcgSttbfCore : public TBBase
287 struct SBBItem
289 sal_uInt16 cchData;
290 OUString data;
291 sal_uInt16 extraData;
292 SBBItem() : cchData(0), extraData(0){}
295 sal_uInt16 fExtend;
296 sal_uInt16 cData;
297 sal_uInt16 cbExtra;
298 std::unique_ptr<SBBItem[]> dataItems;
299 TcgSttbfCore(const TcgSttbfCore&) = delete;
300 TcgSttbfCore& operator = ( const TcgSttbfCore&) = delete;
302 public:
303 TcgSttbfCore();
304 virtual ~TcgSttbfCore() override;
305 bool Read(SvStream &rS) override;
306 #if OSL_DEBUG_LEVEL > 1
307 virtual void Print( FILE* fp ) override;
308 #endif
311 class TcgSttbf : public Tcg255SubStruct
313 TcgSttbfCore sttbf;
314 TcgSttbf(const TcgSttbf&) = delete;
315 TcgSttbf& operator = ( const TcgSttbf&) = delete;
317 public:
318 explicit TcgSttbf();
319 virtual ~TcgSttbf() override {}
320 bool Read(SvStream &rS) override;
321 #if OSL_DEBUG_LEVEL > 1
322 virtual void Print( FILE* fp ) override;
323 #endif
326 class Xstz : public TBBase
328 Xst xst; //An Xst specifying the string with its pre-pended length.
329 sal_uInt16 chTerm;
331 Xstz(const Xstz&) = delete;
332 Xstz& operator = ( const Xstz&) = delete;
334 public:
335 Xstz();
336 virtual ~Xstz() override {}
337 bool Read(SvStream &rS) override;
338 #if OSL_DEBUG_LEVEL > 1
339 virtual void Print( FILE* fp ) override;
340 #endif
343 class MacroName : public TBBase
345 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.
346 Xstz xstz;
347 MacroName(const MacroName&) = delete;
348 MacroName& operator = ( const MacroName&) = delete;
350 public:
351 MacroName();
352 virtual ~MacroName() override {}
353 bool Read(SvStream &rS) override;
354 #if OSL_DEBUG_LEVEL > 1
355 virtual void Print( FILE* ) override;
356 #endif
359 class MacroNames : public Tcg255SubStruct
361 sal_uInt16 iMac; //An unsigned integer that specifies the number of MacroName structures in rgNames.
362 std::unique_ptr<MacroName[]> rgNames;
364 MacroNames(const MacroNames&) = delete;
365 MacroNames& operator = ( const MacroNames&) = delete;
367 public:
368 explicit MacroNames();
369 virtual ~MacroNames() override;
370 bool Read(SvStream &rS) override;
371 #if OSL_DEBUG_LEVEL > 1
372 virtual void Print( FILE* ) override;
373 #endif
376 class Tcg255 : public TBBase
378 std::vector< Tcg255SubStruct* > rgtcgData; // array of sub structures
379 Tcg255(const Tcg255&) = delete;
380 Tcg255& operator = ( const Tcg255&) = delete;
381 bool processSubStruct( sal_uInt8 nId, SvStream& );
383 public:
384 Tcg255();
385 virtual ~Tcg255() override;
386 bool Read(SvStream &rS) override;
387 #if OSL_DEBUG_LEVEL > 1
388 virtual void Print( FILE* ) override;
389 #endif
390 bool ImportCustomToolBar( SfxObjectShell& rDocSh );
393 class Tcg: public TBBase
395 sal_Int8 nTcgVer;
396 std::unique_ptr< Tcg255 > tcg;
397 Tcg(const Tcg&) = delete;
398 Tcg& operator = ( const Tcg&) = delete;
400 public:
401 Tcg();
402 virtual ~Tcg() override {}
403 bool Read(SvStream &rS) override;
404 bool ImportCustomToolBar( SfxObjectShell& rDocSh );
405 #if OSL_DEBUG_LEVEL > 1
406 virtual void Print( FILE* ) override;
407 #endif
410 #endif
412 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */