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