1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include <precomp.h>
29 #include <s2_dsapi/tk_xml.hxx>
30 
31 
32 // NOT FULLY DEFINED SERVICES
33 #include <s2_dsapi/tokintpr.hxx>
34 
35 using csi::dsapi::Tok_XmlConst;
36 using csi::dsapi::Tok_XmlLink_Tag;
37 using csi::dsapi::Tok_XmlFormat_Tag;
38 
39 
40 lux::EnumValueMap			G_aTok_XmlConst_EV_TokenId_Values;
41 Tok_XmlConst::EV_TokenId    ev_consts_none(Tok_XmlConst::e_none,"");
42 Tok_XmlConst::EV_TokenId    ev_e_true(Tok_XmlConst::e_true,"true");
43 Tok_XmlConst::EV_TokenId    ev_e_false(Tok_XmlConst::e_false,"false");
44 Tok_XmlConst::EV_TokenId    ev_e_null(Tok_XmlConst::e_null,"NULL");
45 Tok_XmlConst::EV_TokenId    ev_e_void(Tok_XmlConst::e_void,"void");
46 
47 lux::EnumValueMap	        G_aTok_XmlLink_Tag_EV_TokenId_Values;
48 Tok_XmlLink_Tag::EV_TokenId ev_linktags_none(Tok_XmlLink_Tag::e_none,"");
49 Tok_XmlLink_Tag::EV_TokenId ev_e_const(Tok_XmlLink_Tag::e_const,"const");
50 Tok_XmlLink_Tag::EV_TokenId ev_member(Tok_XmlLink_Tag::member,"member");
51 Tok_XmlLink_Tag::EV_TokenId ev_type(Tok_XmlLink_Tag::type,"type");
52 
53 lux::EnumValueMap	        	G_aTok_XmlFormat_Tag_EV_TokenId_Values;
54 Tok_XmlFormat_Tag::EV_TokenId   ev_formattags_none(Tok_XmlFormat_Tag::e_none,"");
55 Tok_XmlFormat_Tag::EV_TokenId   ev_code(Tok_XmlFormat_Tag::code,"code");
56 Tok_XmlFormat_Tag::EV_TokenId   ev_listing(Tok_XmlFormat_Tag::listing,"listing");
57 Tok_XmlFormat_Tag::EV_TokenId   ev_atom(Tok_XmlFormat_Tag::atom,"code");
58 
59 
60 namespace lux
61 {
62 
63 template<> EnumValueMap &
64 Tok_XmlConst::EV_TokenId::Values_()	        { return G_aTok_XmlConst_EV_TokenId_Values; }
65 template<> EnumValueMap &
66 Tok_XmlLink_Tag::EV_TokenId::Values_()	    { return G_aTok_XmlLink_Tag_EV_TokenId_Values; }
67 template<> EnumValueMap &
68 Tok_XmlFormat_Tag::EV_TokenId::Values_()	{ return G_aTok_XmlFormat_Tag_EV_TokenId_Values; }
69 
70 }   // namespace lux
71 
72 
73 
74 namespace csi
75 {
76 namespace dsapi
77 {
78 
79 void
80 Tok_XmlConst::Trigger( TokenInterpreter &	io_rInterpreter ) const
81 {
82 	io_rInterpreter.Process_XmlConst(*this);
83 }
84 
85 const char *
86 Tok_XmlConst::Text() const
87 {
88 	return eTag.Text();
89 }
90 
91 void
92 Tok_XmlLink_BeginTag::Trigger( TokenInterpreter &	io_rInterpreter ) const
93 {
94 	io_rInterpreter.Process_XmlLink_BeginTag(*this);
95 }
96 
97 const char *
98 Tok_XmlLink_BeginTag::Text() const
99 {
100     static StreamStr ret(120);
101     ret.seekp(0);
102 	if (sScope.length() > 0)
103 	{
104         ret << "<"
105             << eTag.Text()
106             << " scope=\""
107             << sScope
108             << "\">";
109     }
110 	else
111     {
112         ret << "<"
113             << eTag.Text()
114             << ">";
115     }
116     return ret.c_str();
117 }
118 
119 void
120 Tok_XmlLink_EndTag::Trigger( TokenInterpreter &	io_rInterpreter ) const
121 {
122 	io_rInterpreter.Process_XmlLink_EndTag(*this);
123 }
124 
125 const char *
126 Tok_XmlLink_EndTag::Text() const
127 {
128     static StreamStr ret(120);
129     ret.seekp(0);
130     ret << "</"
131         << eTag.Text()
132         << ">";
133     return ret.c_str();
134 }
135 
136 void
137 Tok_XmlFormat_BeginTag::Trigger( TokenInterpreter &	io_rInterpreter ) const
138 {
139 	io_rInterpreter.Process_XmlFormat_BeginTag(*this);
140 }
141 
142 const char *
143 Tok_XmlFormat_BeginTag::Text() const
144 {
145     static StreamStr ret(120);
146     ret.seekp(0);
147     ret << "<"
148         << eTag.Text()
149         << ">";
150     return ret.c_str();
151 }
152 
153 void
154 Tok_XmlFormat_EndTag::Trigger( TokenInterpreter &	io_rInterpreter ) const
155 {
156 	io_rInterpreter.Process_XmlFormat_EndTag(*this);
157 }
158 
159 const char *
160 Tok_XmlFormat_EndTag::Text() const
161 {
162     static StreamStr ret(120);
163     ret.seekp(0);
164     ret << "</"
165         << eTag.Text()
166         << ">";
167     return ret.c_str();
168 }
169 
170 
171 }   // namespace dsapi
172 }   // namespace csi
173 
174 
175