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