1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
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>
16 class Xst
: public TBBase
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
;
31 class SwTBC
: public TBBase
34 std::shared_ptr
< sal_uInt32
> cid
; // optional
35 std::shared_ptr
<TBCData
> tbcd
;
39 virtual ~SwTBC() override
;
40 bool Read(SvStream
&rS
) override
;
41 #if OSL_DEBUG_LEVEL > 1
42 virtual void Print( FILE* ) override
;
44 bool ImportToolBarControl( SwCTBWrapper
&, const css::uno::Reference
< css::container::XIndexContainer
>&, CustomToolBarImportHelper
&, bool );
45 OUString
GetCustomText();
48 class SwCTB
: public TBBase
53 std::vector
<TBVisualData
> rVisualData
;
58 std::vector
< SwTBC
> rTBC
;
60 SwCTB(const SwCTB
&) = delete;
61 SwCTB
& operator = ( const SwCTB
&) = delete;
65 virtual ~SwCTB() override
;
66 bool Read(SvStream
&rS
) override
;
67 #if OSL_DEBUG_LEVEL > 1
68 virtual void Print( FILE* fp
) override
;
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
;
84 sal_uInt16 CiTBDE
; // careful of this ( endian matters etc. )
89 virtual ~TBDelta() override
{}
90 bool Read(SvStream
&rS
) override
;
91 #if OSL_DEBUG_LEVEL > 1
92 virtual void Print( FILE* ) override
;
94 bool ControlIsInserted();
95 bool ControlDropsToolBar();
96 sal_Int32
TBCStreamOffset() { return fc
;}
97 sal_Int16
CustomizationIndex();
100 class Tcg255SubStruct
: public TBBase
104 Tcg255SubStruct(const Tcg255SubStruct
&) = delete;
105 Tcg255SubStruct
& operator = ( const Tcg255SubStruct
&) = delete;
111 explicit Tcg255SubStruct();
112 virtual ~Tcg255SubStruct() override
{}
113 sal_uInt8
id() const { return ch
; }
114 bool Read(SvStream
&rS
) override
;
119 class Customization
: public TBBase
121 friend class SwCTBWrapper
;
123 sal_Int32 tbidForTBD
;
124 sal_uInt16 reserved1
;
126 SwCTBWrapper
* pWrapper
;
127 std::shared_ptr
< SwCTB
> customizationDataCTB
;
128 std::vector
< TBDelta
> customizationDataTBDelta
;
129 bool bIsDroppedMenuTB
;
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
;
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
;
150 sal_uInt16 reserved4
;
151 sal_uInt16 reserved5
;
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;
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
;
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
194 MCD
& operator = ( const MCD
&);
195 bool Read(SvStream
&rS
) override
;
196 #if OSL_DEBUG_LEVEL > 1
197 virtual void Print( FILE* ) override
;
201 class PlfMcd
: public Tcg255SubStruct
204 std::vector
<MCD
> rgmcd
; // array of MCD's
205 PlfMcd(const PlfMcd
&) = delete;
206 PlfMcd
& operator = ( const PlfMcd
&) = delete;
210 bool Read(SvStream
&rS
) override
;
211 #if OSL_DEBUG_LEVEL > 1
212 virtual void Print( FILE* ) override
;
216 class Acd
: public TBBase
219 sal_uInt16 fciBasedOnABC
; // fciBasedOn(13 bits) A(1bit)B(1bit)C(1Bit)
220 Acd(const Acd
&) = delete;
221 Acd
& operator = ( const Acd
&) = delete;
225 virtual ~Acd() override
{}
226 bool Read(SvStream
&rS
) override
;
227 #if OSL_DEBUG_LEVEL > 1
228 virtual void Print( FILE* ) override
;
232 class PlfAcd
: public Tcg255SubStruct
236 PlfAcd(const PlfAcd
&) = delete;
237 PlfAcd
& operator = ( const PlfAcd
&) = delete;
241 virtual ~PlfAcd() override
;
242 bool Read(SvStream
&rS
) override
;
243 #if OSL_DEBUG_LEVEL > 1
244 virtual void Print(FILE*) override
;
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;
262 virtual ~Kme() override
;
263 bool Read(SvStream
&rS
) override
;
264 #if OSL_DEBUG_LEVEL > 1
265 virtual void Print( FILE* ) override
;
269 class PlfKme
: public Tcg255SubStruct
273 PlfKme(const PlfKme
&) = delete;
274 PlfKme
& operator = ( const PlfKme
&) = delete;
278 virtual ~PlfKme() override
;
279 bool Read(SvStream
&rS
) override
;
280 #if OSL_DEBUG_LEVEL > 1
281 virtual void Print( FILE* ) override
;
285 class TcgSttbfCore
: public TBBase
291 sal_uInt16 extraData
;
292 SBBItem() : cchData(0), extraData(0){}
298 std::unique_ptr
<SBBItem
[]> dataItems
;
299 TcgSttbfCore(const TcgSttbfCore
&) = delete;
300 TcgSttbfCore
& operator = ( const TcgSttbfCore
&) = delete;
304 virtual ~TcgSttbfCore() override
;
305 bool Read(SvStream
&rS
) override
;
306 #if OSL_DEBUG_LEVEL > 1
307 virtual void Print( FILE* fp
) override
;
311 class TcgSttbf
: public Tcg255SubStruct
314 TcgSttbf(const TcgSttbf
&) = delete;
315 TcgSttbf
& operator = ( const TcgSttbf
&) = delete;
319 virtual ~TcgSttbf() override
{}
320 bool Read(SvStream
&rS
) override
;
321 #if OSL_DEBUG_LEVEL > 1
322 virtual void Print( FILE* fp
) override
;
326 class Xstz
: public TBBase
328 Xst xst
; //An Xst specifying the string with its pre-pended length.
331 Xstz(const Xstz
&) = delete;
332 Xstz
& operator = ( const Xstz
&) = delete;
336 virtual ~Xstz() override
{}
337 bool Read(SvStream
&rS
) override
;
338 #if OSL_DEBUG_LEVEL > 1
339 virtual void Print( FILE* fp
) override
;
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.
347 MacroName(const MacroName
&) = delete;
348 MacroName
& operator = ( const MacroName
&) = delete;
352 virtual ~MacroName() override
{}
353 bool Read(SvStream
&rS
) override
;
354 #if OSL_DEBUG_LEVEL > 1
355 virtual void Print( FILE* ) override
;
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;
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
;
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
& );
385 virtual ~Tcg255() override
;
386 bool Read(SvStream
&rS
) override
;
387 #if OSL_DEBUG_LEVEL > 1
388 virtual void Print( FILE* ) override
;
390 bool ImportCustomToolBar( SfxObjectShell
& rDocSh
);
393 class Tcg
: public TBBase
396 std::unique_ptr
< Tcg255
> tcg
;
397 Tcg(const Tcg
&) = delete;
398 Tcg
& operator = ( const Tcg
&) = delete;
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
;
412 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */