fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / filter / msfilter / mstoolbar.hxx
blobb76d7790c37990f9967e365d384f9eaf65c68355
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 _MSTOOLBAR_HXX
10 #define _MSTOOLBAR_HXX
11 #include "filter/msfilter/msfilterdllapi.h"
12 #include <sot/storage.hxx>
13 #include <ostream>
14 #include <memory>
15 #include <vector>
16 #include <boost/shared_ptr.hpp>
17 #include <com/sun/star/frame/XModel.hpp>
18 #include <com/sun/star/container/XIndexContainer.hpp>
19 #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
20 #include <com/sun/star/ui/ImageType.hpp>
21 #include <com/sun/star/graphic/XGraphic.hpp>
22 #include <com/sun/star/beans/XPropertySet.hpp>
23 #include <vcl/bitmap.hxx>
24 #include <cppuhelper/implbase1.hxx>
26 class TBCHeader;
29 class MSOCommandConvertor
31 public:
32 virtual ~MSOCommandConvertor() {}
33 virtual OUString MSOCommandToOOCommand( sal_Int16 msoCmd ) = 0;
34 virtual OUString MSOTCIDToOOCommand( sal_Int16 msoTCID ) = 0;
37 class SfxObjectShell;
39 class MSFILTER_DLLPUBLIC CustomToolBarImportHelper
41 struct iconcontrolitem
43 OUString sCommand;
44 css::uno::Reference< css::graphic::XGraphic > image;
46 std::vector< iconcontrolitem > iconcommands;
47 std::auto_ptr< MSOCommandConvertor > pMSOCmdConvertor;
48 css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > m_xCfgSupp;
49 css::uno::Reference< css::ui::XUIConfigurationManager > m_xAppCfgMgr;
50 SfxObjectShell& mrDocSh;
51 void ScaleImage( css::uno::Reference< css::graphic::XGraphic >& xGraphic, long nNewSize );
52 public:
53 CustomToolBarImportHelper( SfxObjectShell& rDocSh, const css::uno::Reference< css::ui::XUIConfigurationManager >& rxAppCfgMgr );
55 void setMSOCommandMap( MSOCommandConvertor* pCnvtr ) { pMSOCmdConvertor.reset( pCnvtr ); }
56 css::uno::Reference< css::ui::XUIConfigurationManager > getCfgManager();
57 css::uno::Reference< css::ui::XUIConfigurationManager > getAppCfgManager();
60 css::uno::Any createCommandFromMacro( const OUString& sCmd );
62 void addIcon( const css::uno::Reference< css::graphic::XGraphic >& xImage, const OUString& sString );
63 void applyIcons();
64 OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
65 OUString MSOTCIDToOOCommand( sal_Int16 msoTCID );
66 SfxObjectShell& GetDocShell() { return mrDocSh; }
67 bool createMenu( const OUString& rName, const css::uno::Reference< css::container::XIndexAccess >& xMenuDesc, bool bPersist );
70 class MSFILTER_DLLPUBLIC TBBase
72 friend class Indent;
73 static int nIndent; // num spaces to indent before printing
74 protected:
75 void indent_printf(FILE* fp, const char* format, ... );
76 sal_uInt32 nOffSet; // usually for debug we can store the offset in the stream to this record
77 public:
78 TBBase() : nOffSet( 0 ) {}
79 virtual ~TBBase(){}
81 virtual bool Read(SvStream &rS) = 0;
82 virtual void Print( FILE* ) {} // #FIXME remove this an implement the debug routines in all the classes below to enable some sort of readable output
83 sal_uInt32 GetOffset() { return nOffSet; }
86 class Indent
88 public:
89 Indent( bool binit = false )
91 if ( binit )
92 init();
93 else
94 TBBase::nIndent = TBBase::nIndent + 2;
96 ~Indent() { TBBase::nIndent = TBBase::nIndent - 2; }
97 void init() { TBBase::nIndent = 0; }
101 class MSFILTER_DLLPUBLIC WString : public TBBase
103 OUString sString;
105 public:
106 WString(){};
107 ~WString(){};
108 bool Read(SvStream &rS);
109 OUString getString(){ return sString; }
112 class MSFILTER_DLLPUBLIC TBCExtraInfo : public TBBase
114 WString wstrHelpFile;
115 sal_Int32 idHelpContext;
116 WString wstrTag;
117 WString wstrOnAction;
118 WString wstrParam;
119 sal_Int8 tbcu;
120 sal_Int8 tbmg;
122 TBCExtraInfo(const TBCExtraInfo&);
123 TBCExtraInfo& operator = ( const TBCExtraInfo&);
124 public:
125 TBCExtraInfo();
126 ~TBCExtraInfo(){}
127 bool Read(SvStream &rS);
128 void Print( FILE* );
129 OUString getOnAction();
132 class MSFILTER_DLLPUBLIC TBCGeneralInfo : public TBBase
134 sal_uInt8 bFlags;
135 WString customText;
136 WString descriptionText;
137 WString tooltip;
138 TBCExtraInfo extraInfo;
140 public:
141 TBCGeneralInfo();
142 ~TBCGeneralInfo() {}
143 bool Read(SvStream &rS);
144 void Print( FILE* );
145 bool ImportToolBarControlData( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >& );
146 OUString CustomText() { return customText.getString(); }
147 OUString DescriptionText() { return descriptionText.getString(); }
148 OUString Tooltip() { return tooltip.getString(); }
151 class MSFILTER_DLLPUBLIC TBCBitMap : public TBBase
153 friend class TBCBSpecific; // #FIXME hacky access, need to fix
154 sal_Int32 cbDIB;
155 Bitmap mBitMap;
156 public:
157 TBCBitMap();
158 ~TBCBitMap();
159 bool Read(SvStream &rS);
160 void Print( FILE* );
161 Bitmap& getBitMap();
164 class MSFILTER_DLLPUBLIC TBCMenuSpecific : public TBBase
166 sal_Int32 tbid;
167 boost::shared_ptr< WString > name; //exist only if tbid equals 0x00000001
168 public:
169 TBCMenuSpecific();
170 ~TBCMenuSpecific(){}
171 bool Read(SvStream &rS);
172 void Print( FILE* );
173 OUString Name();
176 class MSFILTER_DLLPUBLIC TBCCDData : public TBBase
178 sal_Int16 cwstrItems; //Signed integer that specifies the number of items in wstrList. MUST be positive.
179 std::vector< WString > wstrList; // Zero-based index array of WString structures. Number of elements MUST be equal to cwstrItems.
180 sal_Int16 cwstrMRU; // Signed integer that specifies the number of most recently used string
181 sal_Int16 iSel ; // Signed integer that specifies the zero-based index of the selected item in the wstrList field. MUST be equal to 0xFFFF (-1) or greater than or equal to 0x0000.
182 sal_Int16 cLines; // Signed integer that specifies the suggested number of lines that the toolbar control will display at any time when displaying the elements of wstrList of available items.
183 sal_Int16 dxWidth; // Signed integer that specifies the width in pixels that the interior of the dropdown has. This excludes the width of the toolbar control border and scroll bar.
184 WString wstrEdit; //Structure of type WString. Editable text for editable area of the ComboBox toolbar control.
186 public:
187 TBCCDData();
188 ~TBCCDData();
189 bool Read(SvStream &rS);
190 void Print( FILE* );
193 class TBCComboDropdownSpecific : public TBBase
195 boost::shared_ptr< TBCCDData > data;
196 public:
197 TBCComboDropdownSpecific( const TBCHeader& header );
198 TBCComboDropdownSpecific(){}
199 bool Read(SvStream &rS);
200 void Print( FILE* );
203 class TBCBSpecific : public TBBase
205 sal_uInt8 bFlags;
206 boost::shared_ptr< TBCBitMap > icon; // optional
207 boost::shared_ptr< TBCBitMap > iconMask; // optional
208 boost::shared_ptr< sal_uInt16 > iBtnFace; // optional
209 boost::shared_ptr< WString > wstrAcc; // optional
211 public:
212 TBCBSpecific();
213 ~TBCBSpecific(){}
214 bool Read(SvStream &rS);
215 void Print( FILE* );
216 // #TODO just add a getGraphic member here
217 TBCBitMap* getIcon();
218 TBCBitMap* getIconMask();
219 sal_uInt16* getBtnFace() { return iBtnFace.get(); }
222 /* TBCHeader.tct controlSpecificInfo type
224 0x01 (Button control) TBCBSpecific
225 0x10 (ExpandingGrid control) TBCBSpecific
226 0x0A (Popup control) TBCMenuSpecific
227 0x0C (ButtonPopup control) TBCMenuSpecific
228 0x0D (SplitButtonPopup control) TBCMenuSpecific
229 0x0E (SplitButtonMRUPopup control) TBCMenuSpecific
230 0x02 (Edit control) TBCComboDropdow nSpecific
231 0x04 (ComboBox control) TBCComboDropdow nSpecific
232 0x14 (GraphicCombo control) TBCComboDropdow nSpecific
233 0x03 (DropDown control) TBCComboDropdow nSpecific
234 0x06 (SplitDropDown control) TBCComboDropdow nSpecific
235 0x09 (GraphicDropDown control) TBCComboDropdow nSpecific
236 0x07 (OCXDropDown control) controlSpecificInfo MUST NOT exist
237 0x0F (Label control) controlSpecificInfo MUST NOT exist
238 0x12 (Grid control) controlSpecificInfo MUST NOT exist
239 0x13 (Gauge control) controlSpecificInfo MUST NOT exist
240 0x16 (ActiveX control) controlSpecificInfo MUST NOT exist
243 class MSFILTER_DLLPUBLIC TBCHeader : public TBBase
245 sal_Int8 bSignature;
246 sal_Int8 bVersion;
247 sal_uInt8 bFlagsTCR;
248 sal_uInt8 tct;
249 sal_uInt16 tcid;
250 sal_uInt32 tbct;
251 sal_uInt8 bPriority;
252 boost::shared_ptr< sal_uInt16 > width; //optional
253 boost::shared_ptr< sal_uInt16 > height; //optional
255 public:
256 TBCHeader();
257 ~TBCHeader();
258 sal_uInt8 getTct() const { return tct; }
259 sal_uInt16 getTcID() const { return tcid; }
260 bool isVisible() { return !( bFlagsTCR & 0x1 ); }
261 bool isBeginGroup() { return ( bFlagsTCR & 0x2 ); }
262 bool Read(SvStream &rS);
263 void Print( FILE* );
264 sal_uInt32 getTbct() { return tbct; };
267 class MSFILTER_DLLPUBLIC TBCData : public TBBase
269 TBCHeader rHeader;
270 TBCGeneralInfo controlGeneralInfo;
271 boost::shared_ptr< TBBase > controlSpecificInfo; // can be one of TBCBSpecific, TBCMenuSpecific or TBCComboDropdow nSpecific depending on the control type specified by TBCHeader.tct
272 TBCData(const TBCData&);
273 TBCData& operator = ( const TBCData&);
274 public:
275 TBCData( const TBCHeader& Header );
276 ~TBCData(){}
277 bool Read(SvStream &rS);
278 void Print( FILE* );
279 bool ImportToolBarControl( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >&, bool& bBeginGroup, bool bIsMenuBar );
280 TBCGeneralInfo& getGeneralInfo() { return controlGeneralInfo; }
281 TBCMenuSpecific* getMenuSpecific();
284 class MSFILTER_DLLPUBLIC TB : public TBBase
286 sal_uInt8 bSignature;// Signed integer that specifies the toolbar signature number. MUST be 0x02.
287 sal_uInt8 bVersion; // Signed integer that specifies the toolbar version number. MUST be 0x01.
288 sal_Int16 cCL; // Signed integer that SHOULD specify the number of toolbar controls contained in this toolbar.
289 sal_Int32 ltbid;// Signed integer that specifies the toolbar ID. MUST be 0x0001 (custom toolbar ID).
290 sal_uInt32 ltbtr;// Unsigned integer of type TBTRFlags that specifies the toolbar type and toolbar restrictions.
291 sal_uInt16 cRowsDefault;// Unsigned integer that specifies the number of preferred rows for the toolbar when the toolbar is not docked. MUST be less than or equal to 255.
292 sal_uInt16 bFlags; //Unsigned integer of type TBFlags.
293 WString name; //Structure of type WString that specifies the toolbar name
294 public:
295 TB();
296 ~TB(){}
297 bool Read(SvStream &rS);
298 void Print( FILE* );
299 sal_Int16 getcCL(){ return cCL; }
300 WString& getName(){ return name; }
301 bool IsEnabled();
302 bool IsMenuToolbar(){ return ( ( ltbtr & 0x2000000 ) == 0x2000000 ); }
305 class MSFILTER_DLLPUBLIC SRECT : public TBBase
307 public:
308 SRECT() : left(0), top(0), right(0), bottom(0) {}
309 sal_Int16 left;
310 sal_Int16 top;
311 sal_Int16 right;
312 sal_Int16 bottom;
313 bool Read( SvStream &rS ) { rS >> left >> top >> right >> bottom; return true; }
314 void Print( FILE* fo );
317 typedef cppu::WeakImplHelper1< css::container::XIndexContainer > PropertyValueIndexContainer_BASE;
319 class MSFILTER_DLLPUBLIC TBVisualData : public TBBase
321 sal_Int8 tbds;
322 sal_Int8 tbv;
323 sal_Int8 tbdsDock;
324 sal_Int8 iRow;
326 SRECT rcDock;
327 SRECT rcFloat;
329 public:
330 TBVisualData();
331 ~TBVisualData(){}
332 bool Read(SvStream &rS);
333 void Print( FILE* );
335 #endif
337 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */