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>
20 class Xst
: public TBBase
26 bool Read(SvStream
&rS
) override
;
27 const OUString
& getString() const { return m_sString
; }
30 class SwTBC
: public TBBase
33 std::shared_ptr
< sal_uInt32
> m_cid
; // optional
34 std::shared_ptr
<TBCData
> m_tbcd
;
38 bool Read(SvStream
&rS
) override
;
39 bool ImportToolBarControl( SwCTBWrapper
&, const css::uno::Reference
< css::container::XIndexContainer
>&, CustomToolBarImportHelper
&, bool );
40 const OUString
& GetCustomText();
43 class SwCTB
: public TBBase
48 std::vector
<TBVisualData
> m_rVisualData
;
50 sal_uInt16 m_reserved
;
53 std::vector
< SwTBC
> m_rTBC
;
55 SwCTB(const SwCTB
&) = delete;
56 SwCTB
& operator = ( const SwCTB
&) = delete;
60 virtual ~SwCTB() override
;
61 bool Read(SvStream
&rS
) override
;
62 bool IsMenuToolbar() const;
63 bool ImportCustomToolBar( SwCTBWrapper
&, CustomToolBarImportHelper
& );
64 bool ImportMenuTB( SwCTBWrapper
&, const css::uno::Reference
< css::container::XIndexContainer
>&, CustomToolBarImportHelper
& );
65 OUString
const & GetName() { return m_tb
.getName().getString(); }
68 class TBDelta
: public TBBase
70 sal_uInt8 m_doprfatendFlags
;
76 sal_uInt16 m_CiTBDE
; // careful of this ( endian matters etc. )
81 bool Read(SvStream
&rS
) override
;
82 bool ControlIsInserted();
83 bool ControlDropsToolBar();
84 sal_Int32
TBCStreamOffset() { return m_fc
;}
85 sal_Int16
CustomizationIndex();
88 class Tcg255SubStruct
: public TBBase
92 Tcg255SubStruct(const Tcg255SubStruct
&) = delete;
93 Tcg255SubStruct
& operator = ( const Tcg255SubStruct
&) = delete;
99 explicit Tcg255SubStruct();
100 sal_uInt8
id() const { return m_ch
; }
101 bool Read(SvStream
&rS
) override
;
104 class Customization
: public TBBase
106 friend class SwCTBWrapper
;
108 sal_Int32 m_tbidForTBD
;
109 sal_uInt16 m_reserved1
;
111 SwCTBWrapper
* m_pWrapper
;
112 std::shared_ptr
< SwCTB
> m_customizationDataCTB
;
113 std::vector
< TBDelta
> m_customizationDataTBDelta
;
114 bool m_bIsDroppedMenuTB
;
117 explicit Customization( SwCTBWrapper
* rapper
);
118 bool Read(SvStream
&rS
) override
;
119 bool ImportCustomToolBar( SwCTBWrapper
&, CustomToolBarImportHelper
& );
120 bool ImportMenu( SwCTBWrapper
&, CustomToolBarImportHelper
& );
121 SwCTB
* GetCustomizationData() { return m_customizationDataCTB
.get(); };
124 class SwCTBWrapper
: public Tcg255SubStruct
126 // reserved1 is the ch field of Tcg255SubStruct
127 sal_uInt16 m_reserved2
;
128 sal_uInt8 m_reserved3
;
129 sal_uInt16 m_reserved4
;
130 sal_uInt16 m_reserved5
;
137 std::vector
< SwTBC
> m_rtbdc
;
138 std::vector
< Customization
> m_rCustomizations
; // array of Customizations
139 std::vector
< sal_Int16
> m_dropDownMenuIndices
; // array of indexes of Customization toolbars that are dropped by a menu
140 SwCTBWrapper(const SwCTBWrapper
&) = delete;
141 SwCTBWrapper
& operator = ( const SwCTBWrapper
&) = delete;
144 explicit SwCTBWrapper();
145 virtual ~SwCTBWrapper() override
;
146 void InsertDropIndex( sal_Int32 aIndex
) { m_dropDownMenuIndices
.push_back( aIndex
); }
147 SwTBC
* GetTBCAtOffset( sal_uInt32 nStreamOffset
);
148 bool Read(SvStream
&rS
) override
;
149 bool ImportCustomToolBar( SfxObjectShell
& rDocSh
);
151 Customization
* GetCustomizaton( sal_Int16 index
);
152 SwCTB
* GetCustomizationData( const OUString
& name
);
155 class MCD
: public TBBase
157 sal_Int8 m_reserved1
; // A signed integer that MUST be 0x56.
158 sal_uInt8 m_reserved2
; // MUST be 0.
159 sal_uInt16 m_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 m_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 m_reserved3
; // An unsigned integer that MUST be 0xFFFF.
162 sal_uInt32 m_reserved4
; //MUST be ignored.
163 sal_uInt32 m_reserved5
; //MUST be 0.
164 sal_uInt32 m_reserved6
; //MUST be ignored.
165 sal_uInt32 m_reserved7
; //MUST be ignored
169 bool Read(SvStream
&rS
) override
;
172 class PlfMcd
: public Tcg255SubStruct
175 std::vector
<MCD
> m_rgmcd
; // array of MCD's
176 PlfMcd(const PlfMcd
&) = delete;
177 PlfMcd
& operator = ( const PlfMcd
&) = delete;
181 bool Read(SvStream
&rS
) override
;
184 class Acd
: public TBBase
187 sal_uInt16 m_fciBasedOnABC
; // fciBasedOn(13 bits) A(1bit)B(1bit)C(1Bit)
188 Acd(const Acd
&) = delete;
189 Acd
& operator = ( const Acd
&) = delete;
193 bool Read(SvStream
&rS
) override
;
196 class PlfAcd
: public Tcg255SubStruct
199 std::unique_ptr
<Acd
[]> m_rgacd
;
200 PlfAcd(const PlfAcd
&) = delete;
201 PlfAcd
& operator = ( const PlfAcd
&) = delete;
205 virtual ~PlfAcd() override
;
206 bool Read(SvStream
&rS
) override
;
209 class Kme
: public TBBase
211 sal_Int16 m_reserved1
; //MUST be zero.
212 sal_Int16 m_reserved2
; //MUST be zero.
213 sal_uInt16 m_kcm1
; //A Kcm that specifies the primary shortcut key.
214 sal_uInt16 m_kcm2
; //A Kcm that specifies the secondary shortcut key, or 0x00FF if there is no secondary shortcut key.
215 sal_uInt16 m_kt
; //A Kt that specifies the type of action to be taken when the key combination is pressed.
216 sal_uInt32 m_param
; //The meaning of this field depends on the value of kt
218 Kme(const Kme
&) = delete;
219 Kme
& operator = ( const Kme
&) = delete;
223 virtual ~Kme() override
;
224 bool Read(SvStream
&rS
) override
;
227 class PlfKme
: public Tcg255SubStruct
230 std::unique_ptr
<Kme
[]> m_rgkme
;
231 PlfKme(const PlfKme
&) = delete;
232 PlfKme
& operator = ( const PlfKme
&) = delete;
236 virtual ~PlfKme() override
;
237 bool Read(SvStream
&rS
) override
;
240 class TcgSttbfCore
: public TBBase
246 sal_uInt16 extraData
;
247 SBBItem() : cchData(0), extraData(0){}
250 sal_uInt16 m_fExtend
;
252 sal_uInt16 m_cbExtra
;
253 std::unique_ptr
<SBBItem
[]> m_dataItems
;
254 TcgSttbfCore(const TcgSttbfCore
&) = delete;
255 TcgSttbfCore
& operator = ( const TcgSttbfCore
&) = delete;
259 virtual ~TcgSttbfCore() override
;
260 bool Read(SvStream
&rS
) override
;
263 class TcgSttbf
: public Tcg255SubStruct
265 TcgSttbfCore m_sttbf
;
266 TcgSttbf(const TcgSttbf
&) = delete;
267 TcgSttbf
& operator = ( const TcgSttbf
&) = delete;
271 bool Read(SvStream
&rS
) override
;
274 class Xstz
: public TBBase
276 Xst m_xst
; //An Xst specifying the string with its pre-pended length.
279 Xstz(const Xstz
&) = delete;
280 Xstz
& operator = ( const Xstz
&) = delete;
284 bool Read(SvStream
&rS
) override
;
287 class MacroName
: public TBBase
289 sal_uInt16 m_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;
296 bool Read(SvStream
&rS
) override
;
299 class MacroNames
: public Tcg255SubStruct
301 sal_uInt16 m_iMac
; //An unsigned integer that specifies the number of MacroName structures in rgNames.
302 std::unique_ptr
<MacroName
[]> m_rgNames
;
304 MacroNames(const MacroNames
&) = delete;
305 MacroNames
& operator = ( const MacroNames
&) = delete;
308 explicit MacroNames();
309 virtual ~MacroNames() override
;
310 bool Read(SvStream
&rS
) override
;
313 class Tcg255
: public TBBase
315 std::vector
< std::unique_ptr
<Tcg255SubStruct
> > m_rgtcgData
; // array of sub structures
316 Tcg255(const Tcg255
&) = delete;
317 Tcg255
& operator = ( const Tcg255
&) = delete;
318 bool processSubStruct( sal_uInt8 nId
, SvStream
& );
322 virtual ~Tcg255() override
;
323 bool Read(SvStream
&rS
) override
;
324 bool ImportCustomToolBar( SfxObjectShell
& rDocSh
);
327 class Tcg
: public TBBase
330 std::unique_ptr
< Tcg255
> m_tcg
;
331 Tcg(const Tcg
&) = delete;
332 Tcg
& operator = ( const Tcg
&) = delete;
336 bool Read(SvStream
&rS
) override
;
337 bool ImportCustomToolBar( SfxObjectShell
& rDocSh
);
342 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */