xref: /aoo41x/main/udm/source/html/htmlitem.cxx (revision cdf0e10c)
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 <udm/html/htmlitem.hxx>
30 
31 // NOT FULLY DECLARED SERVICES
32 
33 
34 namespace csi
35 {
36 namespace html
37 {
38 
39 using namespace csi::xml;
40 
41 template <class ELEM>
42 inline ELEM &
43 PushElem( Element & 	i_rMain,
44 		  DYN ELEM * 	let_dpSub,
45 		  DYN Item *	let_dpItem )
46 {
47 	i_rMain << let_dpSub;
48 	if ( let_dpItem != 0 )
49 		*let_dpSub << let_dpItem;
50 	return *let_dpSub;
51 }
52 
53 
54 bool
55 Body::LineBreakAfterBeginTag() const
56 {
57  	return true;
58 }
59 
60 #ifndef COMPATIBLE_NETSCAPE_47
61 bool
62 HorizontalLine::LineBreakAfterBeginTag() const
63 {
64  	return true;
65 }
66 #endif
67 
68 
69 Image::Image( const String &   i_sSrc,
70 			  const String &   i_sWidth,
71 			  const String &   i_sHeight,
72 			  const String &   i_sAlign,
73 			  const String &   i_sBorder )
74 	:	AnEmptyElement( "img" )
75 {
76 	*this << new AnAttribute(String("src"),i_sSrc)
77 		  << new AnAttribute(String("width"),i_sWidth)
78 		  << new AnAttribute(String("height"),i_sHeight)
79 		  << new AnAttribute(String("align"),i_sAlign)
80 		  << new AnAttribute(String("border"),i_sBorder);
81 }
82 
83 bool
84 Paragraph::LineBreakAfterEndTag() const
85 {
86  	return true;
87 }
88 
89 const char *
90 Headline::sTags[6] = { "h1", "h2", "h3", "h4", "h5", "h6" };
91 
92 bool
93 Headline::LineBreakAfterEndTag() const
94 {
95  	return true;
96 }
97 
98 #ifndef COMPATIBLE_NETSCAPE_47
99 bool
100 LineBreak::LineBreakAfterBeginTag() const
101 {
102  	return true;
103 }
104 #endif
105 
106 
107 bool
108 TableCell::LineBreakAfterEndTag() const
109 {
110  	return true;
111 }
112 
113 
114 
115 TableCell &
116 TableRow::AddCell( DYN Item * let_dpItem )
117 {
118 	return PushElem( *this, new TableCell, let_dpItem );
119 }
120 
121 bool
122 TableRow::LineBreakAfterBeginTag() const
123 {
124  	return true;
125 }
126 
127 
128 Table::Table( const String &   i_sBorder,
129 			  const String &   i_sWidth,
130 			  const String &   i_sCellPadding,
131 			  const String &   i_sCellSpacing  )
132 	: 	csi::xml::AnElement("table")
133 {
134 	if ( i_sBorder.length() > 0 )
135 		*this << new AnAttribute(String("border"),i_sBorder);
136 	if ( i_sBorder.length() > 0 )
137 		*this << new AnAttribute(String("width"),i_sWidth);
138 	if ( i_sBorder.length() > 0 )
139 		*this << new AnAttribute(String("cellpadding"),i_sCellPadding);
140 	if ( i_sBorder.length() > 0 )
141 		*this << new AnAttribute(String("cellspacing"),i_sCellSpacing);
142 }
143 
144 TableRow &
145 Table::AddRow()
146 {
147 	TableRow * ret = new TableRow;
148 	*this << ret;
149 	return *ret;
150 }
151 
152 bool
153 Table::FinishEmptyTag_XmlStyle() const
154 {
155  	return false;
156 }
157 
158 bool
159 Table::LineBreakAfterBeginTag() const
160 {
161  	return true;
162 }
163 
164 
165 
166 bool
167 DefListTerm::LineBreakAfterEndTag() const
168 {
169  	return true;
170 }
171 
172 bool
173 DefListDefinition::LineBreakAfterEndTag() const
174 {
175  	return true;
176 }
177 
178 
179 
180 
181 
182 DefListTerm &
183 DefList::AddTerm( DYN csi::xml::Item* let_dpItem )
184 {
185 	return PushElem( *this, new DefListTerm, let_dpItem );
186 }
187 
188 DefListDefinition &
189 DefList::AddDefinition( DYN csi::xml::Item* let_dpItem )
190 {
191 	return PushElem( *this, new DefListDefinition, let_dpItem );
192 }
193 
194 bool
195 DefList::LineBreakAfterBeginTag() const
196 {
197  	return true;
198 }
199 
200 bool
201 DefList::FinishEmptyTag_XmlStyle() const
202 {
203  	return false;
204 }
205 
206 bool
207 ListItem::LineBreakAfterEndTag() const
208 {
209  	return true;
210 }
211 
212 
213 
214 
215 ListItem &
216 NumeratedList::AddItem( DYN csi::xml::Item* let_dpItem )
217 {
218 	return PushElem( *this, new ListItem, let_dpItem );
219 }
220 
221 bool
222 NumeratedList::LineBreakAfterBeginTag() const
223 {
224  	return true;
225 }
226 
227 
228 ListItem &
229 SimpleList::AddItem( DYN csi::xml::Item* let_dpItem )
230 {
231 	return PushElem( *this, new ListItem, let_dpItem );
232 }
233 
234 bool
235 SimpleList::LineBreakAfterBeginTag() const
236 {
237  	return true;
238 }
239 
240 
241 
242 }   // namespace html
243 }   // namespace csi
244