merge the formfield patch from ooo-build
[ooovba.git] / svx / workben / msview / xmlconfig.hxx
blobc235abeee446a8d09376ce427b22428092d9500a
1 #ifndef _XMLCONFIG_HXX_
2 #define _XMLCONFIG_HXX_
4 #include <map>
5 #include <list>
6 #include <boost/shared_ptr.hpp>
8 ///////////////////////////////////////////////////////////////////////
10 enum ElementConfigType { ECT_HEXDUMP, ECT_BYTE, ECT_UINT, ECT_UNISTRING, ETC_FLOAT, ETC_CONTAINER };
12 class ElementConfig
14 public:
15 ElementConfig() : mnType( ECT_HEXDUMP ) {}
16 ElementConfig( const rtl::OUString& rName, ElementConfigType rType ) : maName( rName ), mnType( rType ) {}
17 ElementConfig( const rtl::OUString& rName ) : maName( rName ) {}
18 ElementConfig( ElementConfigType rType ) : mnType( rType ) {}
20 virtual rtl::OUString format( SvStream& rStream, sal_Size& nLength ) const;
22 const rtl::OUString& getName() const { return maName; }
23 ElementConfigType getType() const { return mnType; }
25 static rtl::OUString dump_hex( SvStream& rStream, sal_Size& nLength );
26 static rtl::OUString dump_byte( SvStream& rStream, sal_Size& nLength );
27 static rtl::OUString dump_uint( SvStream& rStream, sal_Size& nLength );
28 static rtl::OUString dump_unistring( SvStream& rStream, sal_Size& nLength );
29 static rtl::OUString dump_float( SvStream& rStream, sal_Size& nLength );
30 private:
31 rtl::OUString maName;
32 ElementConfigType mnType;
34 typedef boost::shared_ptr< ElementConfig > ElementConfigPtr;
35 typedef std::list< ElementConfigPtr > ElementConfigList;
37 ///////////////////////////////////////////////////////////////////////
39 class ElementValueConfig : public ElementConfig
41 public:
42 ElementValueConfig( const rtl::OUString& rName, const rtl::OUString& rValue ) : ElementConfig( rName ), maValue( rValue ) {}
44 const rtl::OUString& getValue() const { return maValue; }
46 private:
47 rtl::OUString maValue;
50 ///////////////////////////////////////////////////////////////////////
52 class ElementConfigContainer : public ElementConfig
54 public:
55 ElementConfigContainer() : ElementConfig( ETC_CONTAINER ) {}
56 ElementConfigContainer( const ::rtl::OUString& rName, ElementConfigType rType ) : ElementConfig( rName, rType ) {}
57 ElementConfigContainer( const ::rtl::OUString& rName ) : ElementConfig( rName, ETC_CONTAINER ) {}
58 ElementConfigContainer( ElementConfigType rType ) : ElementConfig( rType ) {}
60 virtual rtl::OUString format( SvStream& rStream, sal_Size& nLength ) const;
62 void addElementConfig( ElementConfigPtr p ) { maElementConfigList.push_back( p ); }
64 protected:
65 ElementConfigList maElementConfigList;
68 ///////////////////////////////////////////////////////////////////////
70 class CaseElementConfig : public ElementConfigContainer
72 public:
73 CaseElementConfig( const rtl::OUString& rValue ) : maValue( rValue ) {}
75 const rtl::OUString& getValue() const { return maValue; }
77 private:
78 rtl::OUString maValue;
81 ///////////////////////////////////////////////////////////////////////
83 class SwitchElementConfig : public ElementConfigContainer
85 public:
86 SwitchElementConfig( ElementConfigType rType ) : ElementConfigContainer( rType ) {}
88 virtual rtl::OUString format( SvStream& rStream, sal_Size& nLength ) const;
91 ///////////////////////////////////////////////////////////////////////
93 class AtomConfig : public ElementConfigContainer
95 public:
96 AtomConfig( const ::rtl::OUString& rName, bool bIsContainer ) : ElementConfigContainer( rName ), mbIsContainer( bIsContainer ) {}
98 bool isContainer() const { return mbIsContainer; }
100 protected:
101 bool mbIsContainer;
104 typedef std::map< UINT16, ElementConfigPtr > AtomConfigMap;
106 extern AtomConfigMap gAtomConfigMap;
108 #endif