xref: /aoo41x/main/udm/source/html/htmlitem.cxx (revision 898949d6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include <precomp.h>
25 #include <udm/html/htmlitem.hxx>
26 
27 // NOT FULLY DECLARED SERVICES
28 
29 
30 namespace csi
31 {
32 namespace html
33 {
34 
35 using namespace csi::xml;
36 
37 template <class ELEM>
38 inline ELEM &
PushElem(Element & i_rMain,DYN ELEM * let_dpSub,DYN Item * let_dpItem)39 PushElem( Element & 	i_rMain,
40 		  DYN ELEM * 	let_dpSub,
41 		  DYN Item *	let_dpItem )
42 {
43 	i_rMain << let_dpSub;
44 	if ( let_dpItem != 0 )
45 		*let_dpSub << let_dpItem;
46 	return *let_dpSub;
47 }
48 
49 
50 bool
LineBreakAfterBeginTag() const51 Body::LineBreakAfterBeginTag() const
52 {
53  	return true;
54 }
55 
56 #ifndef COMPATIBLE_NETSCAPE_47
57 bool
LineBreakAfterBeginTag() const58 HorizontalLine::LineBreakAfterBeginTag() const
59 {
60  	return true;
61 }
62 #endif
63 
64 
Image(const String & i_sSrc,const String & i_sWidth,const String & i_sHeight,const String & i_sAlign,const String & i_sBorder)65 Image::Image( const String &   i_sSrc,
66 			  const String &   i_sWidth,
67 			  const String &   i_sHeight,
68 			  const String &   i_sAlign,
69 			  const String &   i_sBorder )
70 	:	AnEmptyElement( "img" )
71 {
72 	*this << new AnAttribute(String("src"),i_sSrc)
73 		  << new AnAttribute(String("width"),i_sWidth)
74 		  << new AnAttribute(String("height"),i_sHeight)
75 		  << new AnAttribute(String("align"),i_sAlign)
76 		  << new AnAttribute(String("border"),i_sBorder);
77 }
78 
79 bool
LineBreakAfterEndTag() const80 Paragraph::LineBreakAfterEndTag() const
81 {
82  	return true;
83 }
84 
85 const char *
86 Headline::sTags[6] = { "h1", "h2", "h3", "h4", "h5", "h6" };
87 
88 bool
LineBreakAfterEndTag() const89 Headline::LineBreakAfterEndTag() const
90 {
91  	return true;
92 }
93 
94 #ifndef COMPATIBLE_NETSCAPE_47
95 bool
LineBreakAfterBeginTag() const96 LineBreak::LineBreakAfterBeginTag() const
97 {
98  	return true;
99 }
100 #endif
101 
102 
103 bool
LineBreakAfterEndTag() const104 TableCell::LineBreakAfterEndTag() const
105 {
106  	return true;
107 }
108 
109 
110 
111 TableCell &
AddCell(DYN Item * let_dpItem)112 TableRow::AddCell( DYN Item * let_dpItem )
113 {
114 	return PushElem( *this, new TableCell, let_dpItem );
115 }
116 
117 bool
LineBreakAfterBeginTag() const118 TableRow::LineBreakAfterBeginTag() const
119 {
120  	return true;
121 }
122 
123 
Table(const String & i_sBorder,const String & i_sWidth,const String & i_sCellPadding,const String & i_sCellSpacing)124 Table::Table( const String &   i_sBorder,
125 			  const String &   i_sWidth,
126 			  const String &   i_sCellPadding,
127 			  const String &   i_sCellSpacing  )
128 	: 	csi::xml::AnElement("table")
129 {
130 	if ( i_sBorder.length() > 0 )
131 		*this << new AnAttribute(String("border"),i_sBorder);
132 	if ( i_sBorder.length() > 0 )
133 		*this << new AnAttribute(String("width"),i_sWidth);
134 	if ( i_sBorder.length() > 0 )
135 		*this << new AnAttribute(String("cellpadding"),i_sCellPadding);
136 	if ( i_sBorder.length() > 0 )
137 		*this << new AnAttribute(String("cellspacing"),i_sCellSpacing);
138 }
139 
140 TableRow &
AddRow()141 Table::AddRow()
142 {
143 	TableRow * ret = new TableRow;
144 	*this << ret;
145 	return *ret;
146 }
147 
148 bool
FinishEmptyTag_XmlStyle() const149 Table::FinishEmptyTag_XmlStyle() const
150 {
151  	return false;
152 }
153 
154 bool
LineBreakAfterBeginTag() const155 Table::LineBreakAfterBeginTag() const
156 {
157  	return true;
158 }
159 
160 
161 
162 bool
LineBreakAfterEndTag() const163 DefListTerm::LineBreakAfterEndTag() const
164 {
165  	return true;
166 }
167 
168 bool
LineBreakAfterEndTag() const169 DefListDefinition::LineBreakAfterEndTag() const
170 {
171  	return true;
172 }
173 
174 
175 
176 
177 
178 DefListTerm &
AddTerm(DYN csi::xml::Item * let_dpItem)179 DefList::AddTerm( DYN csi::xml::Item* let_dpItem )
180 {
181 	return PushElem( *this, new DefListTerm, let_dpItem );
182 }
183 
184 DefListDefinition &
AddDefinition(DYN csi::xml::Item * let_dpItem)185 DefList::AddDefinition( DYN csi::xml::Item* let_dpItem )
186 {
187 	return PushElem( *this, new DefListDefinition, let_dpItem );
188 }
189 
190 bool
LineBreakAfterBeginTag() const191 DefList::LineBreakAfterBeginTag() const
192 {
193  	return true;
194 }
195 
196 bool
FinishEmptyTag_XmlStyle() const197 DefList::FinishEmptyTag_XmlStyle() const
198 {
199  	return false;
200 }
201 
202 bool
LineBreakAfterEndTag() const203 ListItem::LineBreakAfterEndTag() const
204 {
205  	return true;
206 }
207 
208 
209 
210 
211 ListItem &
AddItem(DYN csi::xml::Item * let_dpItem)212 NumeratedList::AddItem( DYN csi::xml::Item* let_dpItem )
213 {
214 	return PushElem( *this, new ListItem, let_dpItem );
215 }
216 
217 bool
LineBreakAfterBeginTag() const218 NumeratedList::LineBreakAfterBeginTag() const
219 {
220  	return true;
221 }
222 
223 
224 ListItem &
AddItem(DYN csi::xml::Item * let_dpItem)225 SimpleList::AddItem( DYN csi::xml::Item* let_dpItem )
226 {
227 	return PushElem( *this, new ListItem, let_dpItem );
228 }
229 
230 bool
LineBreakAfterBeginTag() const231 SimpleList::LineBreakAfterBeginTag() const
232 {
233  	return true;
234 }
235 
236 
237 
238 }   // namespace html
239 }   // namespace csi
240