1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlelem.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef X2C_XMLELEM_HXX
32 #define X2C_XMLELEM_HXX
39 #include "../support/sistr.hxx"
40 #include "../support/list.hxx"
41 #include "../support/syshelp.hxx"
52 virtual ~XmlElement() {}
54 X2CParser
& io_rParser
) = 0;
55 virtual void Write2Html(
56 HtmlCreator
& io_rHC
) const = 0;
57 virtual void Insert2Index(
58 Index
& o_rIndex
) const; // Default: Does nothing, but can be overwritten.
60 // virtual void Put2Dependy() = 0;
62 const Simstr
& Name() const { return sName
; }
66 const char * i_sName
);
72 class MultipleElement
: public XmlElement
79 const Simstr
& i_sChildName
);
83 typedef DynamicList
<XmlElement
> ChildList
;
86 const char * i_sName
);
89 XmlElement
& let_drElement
);
91 const ChildList
& Children() const { return aChildren
; }
92 ChildList
& Children() { return aChildren
; }
98 class SequenceElement
: public MultipleElement
102 X2CParser
& io_rParser
);
103 virtual void Write2Html(
104 HtmlCreator
& io_rHC
) const;
108 const char * i_sName
,
109 unsigned i_nIndexNameElement
= 0 );
111 unsigned nIndexNameElement
;
114 class FreeChoiceElement
: public MultipleElement
118 using MultipleElement::AddChild
;
121 X2CParser
& io_rParser
);
122 virtual void Write2Html(
123 HtmlCreator
& io_rHC
) const;
126 class ListElement
: public MultipleElement
129 typedef XmlElement
* (*F_CREATE
)(const Simstr
&);
132 const char * i_sElementsName
,
133 F_CREATE i_fCreateNewElement
);
136 X2CParser
& io_rParser
);
137 virtual void Write2Html(
138 HtmlCreator
& io_rHC
) const;
140 Create_and_Add_NewElement();
142 F_CREATE fCreateNewElement
;
145 class TextElement
: public XmlElement
148 E_LinkType
LinkType() const { return eLinkType
; }
149 bool IsReversedName() const { return bReverseName
; }
152 const char * i_sName
,
153 E_LinkType i_eLinkType
,
154 bool i_bReverseName
);
156 E_LinkType eLinkType
;
160 class SglTextElement
: public TextElement
164 const char * i_sName
,
165 E_LinkType i_eLinkType
,
166 bool i_bReverseName
);
169 X2CParser
& io_rParser
);
170 virtual void Write2Html(
171 HtmlCreator
& io_rHC
) const;
172 virtual const Simstr
&
173 Data() const { return sContent
; }
178 class MultipleTextElement
: public TextElement
182 const char * i_sName
,
183 E_LinkType i_eLinkType
,
184 bool i_bReverseName
);
187 X2CParser
& io_rParser
);
188 virtual void Write2Html(
189 HtmlCreator
& io_rHC
) const;
190 virtual const Simstr
&
192 unsigned i_nNr
) const;
193 virtual unsigned Size() const { return aContent
.size(); }
196 List
<Simstr
> aContent
;
199 class EmptyElement
: public XmlElement
203 const char * i_sName
);
206 class SglAttrElement
: public EmptyElement
210 const char * i_sName
,
211 const char * i_sAttrName
);
214 X2CParser
& io_rParser
);
215 virtual void Write2Html(
216 HtmlCreator
& io_rHC
) const;
223 class MultipleAttrElement
: public EmptyElement
227 const char * i_sName
,
228 const char ** i_sAttrNames
,
232 X2CParser
& io_rParser
);
233 virtual void Write2Html(
234 HtmlCreator
& io_rHC
) const;
236 List
<Simstr
> aAttrNames
;
237 List
<Simstr
> aAttrValues
;