tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / sw / source / filter / ww8 / ww8toolbar.hxx
blob4905b1584fd44e89c99a730f3ce345c4318f78aa
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>
17 class SfxObjectShell;
18 class SwCTBWrapper;
20 class Xst : public TBBase
22 OUString m_sString;
24 public:
25 Xst(){}
26 bool Read(SvStream &rS) override;
27 const OUString& getString() const { return m_sString; }
30 class SwTBC : public TBBase
32 TBCHeader m_tbch;
33 std::shared_ptr< sal_uInt32 > m_cid; // optional
34 std::shared_ptr<TBCData> m_tbcd;
36 public:
37 SwTBC();
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
45 Xst m_name;
46 sal_Int32 m_cbTBData;
47 TB m_tb;
48 std::vector<TBVisualData> m_rVisualData;
49 sal_Int32 m_iWCTBl;
50 sal_uInt16 m_reserved;
51 sal_uInt16 m_unused;
52 sal_Int32 m_cCtls;
53 std::vector< SwTBC > m_rTBC;
55 SwCTB(const SwCTB&) = delete;
56 SwCTB& operator = ( const SwCTB&) = delete;
58 public:
59 SwCTB();
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;
72 sal_uInt8 m_ibts;
73 sal_Int32 m_cidNext;
74 sal_Int32 m_cid;
75 sal_Int32 m_fc;
76 sal_uInt16 m_CiTBDE; // careful of this ( endian matters etc. )
77 sal_uInt16 m_cbTBC;
79 public:
80 TBDelta();
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
90 friend class Tcg255;
92 Tcg255SubStruct(const Tcg255SubStruct&) = delete;
93 Tcg255SubStruct& operator = ( const Tcg255SubStruct&) = delete;
95 protected:
96 sal_uInt8 m_ch;
98 public:
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;
110 sal_uInt16 m_ctbds;
111 SwCTBWrapper* m_pWrapper;
112 std::shared_ptr< SwCTB > m_customizationDataCTB;
113 std::vector< TBDelta > m_customizationDataTBDelta;
114 bool m_bIsDroppedMenuTB;
116 public:
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;
132 sal_Int16 m_cbTBD;
133 sal_uInt16 m_cCust;
135 sal_Int32 m_cbDTBC;
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;
143 public:
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
167 public:
168 MCD();
169 bool Read(SvStream &rS) override;
172 class PlfMcd : public Tcg255SubStruct
174 sal_Int32 m_iMac;
175 std::vector<MCD> m_rgmcd; // array of MCD's
176 PlfMcd(const PlfMcd&) = delete;
177 PlfMcd& operator = ( const PlfMcd&) = delete;
179 public:
180 explicit PlfMcd();
181 bool Read(SvStream &rS) override;
184 class Acd : public TBBase
186 sal_Int16 m_ibst;
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;
191 public:
192 Acd();
193 bool Read(SvStream &rS) override;
196 class PlfAcd: public Tcg255SubStruct
198 sal_Int32 m_iMac;
199 std::unique_ptr<Acd[]> m_rgacd;
200 PlfAcd(const PlfAcd&) = delete;
201 PlfAcd& operator = ( const PlfAcd&) = delete;
203 public:
204 explicit PlfAcd();
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;
221 public:
222 Kme();
223 virtual ~Kme() override;
224 bool Read(SvStream &rS) override;
227 class PlfKme : public Tcg255SubStruct
229 sal_Int32 m_iMac;
230 std::unique_ptr<Kme[]> m_rgkme;
231 PlfKme(const PlfKme&) = delete;
232 PlfKme& operator = ( const PlfKme&) = delete;
234 public:
235 explicit PlfKme();
236 virtual ~PlfKme() override;
237 bool Read(SvStream &rS) override;
240 class TcgSttbfCore : public TBBase
242 struct SBBItem
244 sal_uInt16 cchData;
245 OUString data;
246 sal_uInt16 extraData;
247 SBBItem() : cchData(0), extraData(0){}
250 sal_uInt16 m_fExtend;
251 sal_uInt16 m_cData;
252 sal_uInt16 m_cbExtra;
253 std::unique_ptr<SBBItem[]> m_dataItems;
254 TcgSttbfCore(const TcgSttbfCore&) = delete;
255 TcgSttbfCore& operator = ( const TcgSttbfCore&) = delete;
257 public:
258 TcgSttbfCore();
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;
269 public:
270 explicit TcgSttbf();
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.
277 sal_uInt16 m_chTerm;
279 Xstz(const Xstz&) = delete;
280 Xstz& operator = ( const Xstz&) = delete;
282 public:
283 Xstz();
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.
290 Xstz m_xstz;
291 MacroName(const MacroName&) = delete;
292 MacroName& operator = ( const MacroName&) = delete;
294 public:
295 MacroName();
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;
307 public:
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& );
320 public:
321 Tcg255();
322 virtual ~Tcg255() override;
323 bool Read(SvStream &rS) override;
324 bool ImportCustomToolBar( SfxObjectShell& rDocSh );
327 class Tcg: public TBBase
329 sal_Int8 m_nTcgVer;
330 std::unique_ptr< Tcg255 > m_tcg;
331 Tcg(const Tcg&) = delete;
332 Tcg& operator = ( const Tcg&) = delete;
334 public:
335 Tcg();
336 bool Read(SvStream &rS) override;
337 bool ImportCustomToolBar( SfxObjectShell& rDocSh );
340 #endif
342 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */