Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / svx / workben / msview / xmlconfig.hxx
blob3bc270fe820d1a565a7386bb758ca273da4e1ee0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 #ifndef _XMLCONFIG_HXX_
3 #define _XMLCONFIG_HXX_
5 #include <map>
6 #include <list>
7 #include <boost/shared_ptr.hpp>
9 ///////////////////////////////////////////////////////////////////////
11 enum ElementConfigType { ECT_HEXDUMP, ECT_BYTE, ECT_UINT, ECT_UNISTRING, ETC_FLOAT, ETC_CONTAINER };
13 class ElementConfig
15 public:
16 ElementConfig() : mnType( ECT_HEXDUMP ) {}
17 ElementConfig( const rtl::OUString& rName, ElementConfigType rType ) : maName( rName ), mnType( rType ) {}
18 ElementConfig( const rtl::OUString& rName ) : maName( rName ) {}
19 ElementConfig( ElementConfigType rType ) : mnType( rType ) {}
21 virtual rtl::OUString format( SvStream& rStream, sal_Size& nLength ) const;
23 const rtl::OUString& getName() const { return maName; }
24 ElementConfigType getType() const { return mnType; }
26 static rtl::OUString dump_hex( SvStream& rStream, sal_Size& nLength );
27 static rtl::OUString dump_byte( SvStream& rStream, sal_Size& nLength );
28 static rtl::OUString dump_uint( SvStream& rStream, sal_Size& nLength );
29 static rtl::OUString dump_unistring( SvStream& rStream, sal_Size& nLength );
30 static rtl::OUString dump_float( SvStream& rStream, sal_Size& nLength );
31 private:
32 rtl::OUString maName;
33 ElementConfigType mnType;
35 typedef boost::shared_ptr< ElementConfig > ElementConfigPtr;
36 typedef std::list< ElementConfigPtr > ElementConfigList;
38 ///////////////////////////////////////////////////////////////////////
40 class ElementValueConfig : public ElementConfig
42 public:
43 ElementValueConfig( const rtl::OUString& rName, const rtl::OUString& rValue ) : ElementConfig( rName ), maValue( rValue ) {}
45 const rtl::OUString& getValue() const { return maValue; }
47 private:
48 rtl::OUString maValue;
51 ///////////////////////////////////////////////////////////////////////
53 class ElementConfigContainer : public ElementConfig
55 public:
56 ElementConfigContainer() : ElementConfig( ETC_CONTAINER ) {}
57 ElementConfigContainer( const ::rtl::OUString& rName, ElementConfigType rType ) : ElementConfig( rName, rType ) {}
58 ElementConfigContainer( const ::rtl::OUString& rName ) : ElementConfig( rName, ETC_CONTAINER ) {}
59 ElementConfigContainer( ElementConfigType rType ) : ElementConfig( rType ) {}
61 virtual rtl::OUString format( SvStream& rStream, sal_Size& nLength ) const;
63 void addElementConfig( ElementConfigPtr p ) { maElementConfigList.push_back( p ); }
65 protected:
66 ElementConfigList maElementConfigList;
69 ///////////////////////////////////////////////////////////////////////
71 class CaseElementConfig : public ElementConfigContainer
73 public:
74 CaseElementConfig( const rtl::OUString& rValue ) : maValue( rValue ) {}
76 const rtl::OUString& getValue() const { return maValue; }
78 private:
79 rtl::OUString maValue;
82 ///////////////////////////////////////////////////////////////////////
84 class SwitchElementConfig : public ElementConfigContainer
86 public:
87 SwitchElementConfig( ElementConfigType rType ) : ElementConfigContainer( rType ) {}
89 virtual rtl::OUString format( SvStream& rStream, sal_Size& nLength ) const;
92 ///////////////////////////////////////////////////////////////////////
94 class AtomConfig : public ElementConfigContainer
96 public:
97 AtomConfig( const ::rtl::OUString& rName, bool bIsContainer ) : ElementConfigContainer( rName ), mbIsContainer( bIsContainer ) {}
99 bool isContainer() const { return mbIsContainer; }
101 protected:
102 bool mbIsContainer;
105 typedef std::map< UINT16, ElementConfigPtr > AtomConfigMap;
107 extern AtomConfigMap gAtomConfigMap;
109 #endif
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */