xref: /aoo41x/main/udm/source/html/htmlitem.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #include <precomp.h>
29*cdf0e10cSrcweir #include <udm/html/htmlitem.hxx>
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir // NOT FULLY DECLARED SERVICES
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir namespace csi
35*cdf0e10cSrcweir {
36*cdf0e10cSrcweir namespace html
37*cdf0e10cSrcweir {
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir using namespace csi::xml;
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir template <class ELEM>
42*cdf0e10cSrcweir inline ELEM &
43*cdf0e10cSrcweir PushElem( Element & 	i_rMain,
44*cdf0e10cSrcweir 		  DYN ELEM * 	let_dpSub,
45*cdf0e10cSrcweir 		  DYN Item *	let_dpItem )
46*cdf0e10cSrcweir {
47*cdf0e10cSrcweir 	i_rMain << let_dpSub;
48*cdf0e10cSrcweir 	if ( let_dpItem != 0 )
49*cdf0e10cSrcweir 		*let_dpSub << let_dpItem;
50*cdf0e10cSrcweir 	return *let_dpSub;
51*cdf0e10cSrcweir }
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir bool
55*cdf0e10cSrcweir Body::LineBreakAfterBeginTag() const
56*cdf0e10cSrcweir {
57*cdf0e10cSrcweir  	return true;
58*cdf0e10cSrcweir }
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir #ifndef COMPATIBLE_NETSCAPE_47
61*cdf0e10cSrcweir bool
62*cdf0e10cSrcweir HorizontalLine::LineBreakAfterBeginTag() const
63*cdf0e10cSrcweir {
64*cdf0e10cSrcweir  	return true;
65*cdf0e10cSrcweir }
66*cdf0e10cSrcweir #endif
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir Image::Image( const String &   i_sSrc,
70*cdf0e10cSrcweir 			  const String &   i_sWidth,
71*cdf0e10cSrcweir 			  const String &   i_sHeight,
72*cdf0e10cSrcweir 			  const String &   i_sAlign,
73*cdf0e10cSrcweir 			  const String &   i_sBorder )
74*cdf0e10cSrcweir 	:	AnEmptyElement( "img" )
75*cdf0e10cSrcweir {
76*cdf0e10cSrcweir 	*this << new AnAttribute(String("src"),i_sSrc)
77*cdf0e10cSrcweir 		  << new AnAttribute(String("width"),i_sWidth)
78*cdf0e10cSrcweir 		  << new AnAttribute(String("height"),i_sHeight)
79*cdf0e10cSrcweir 		  << new AnAttribute(String("align"),i_sAlign)
80*cdf0e10cSrcweir 		  << new AnAttribute(String("border"),i_sBorder);
81*cdf0e10cSrcweir }
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir bool
84*cdf0e10cSrcweir Paragraph::LineBreakAfterEndTag() const
85*cdf0e10cSrcweir {
86*cdf0e10cSrcweir  	return true;
87*cdf0e10cSrcweir }
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir const char *
90*cdf0e10cSrcweir Headline::sTags[6] = { "h1", "h2", "h3", "h4", "h5", "h6" };
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir bool
93*cdf0e10cSrcweir Headline::LineBreakAfterEndTag() const
94*cdf0e10cSrcweir {
95*cdf0e10cSrcweir  	return true;
96*cdf0e10cSrcweir }
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir #ifndef COMPATIBLE_NETSCAPE_47
99*cdf0e10cSrcweir bool
100*cdf0e10cSrcweir LineBreak::LineBreakAfterBeginTag() const
101*cdf0e10cSrcweir {
102*cdf0e10cSrcweir  	return true;
103*cdf0e10cSrcweir }
104*cdf0e10cSrcweir #endif
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir bool
108*cdf0e10cSrcweir TableCell::LineBreakAfterEndTag() const
109*cdf0e10cSrcweir {
110*cdf0e10cSrcweir  	return true;
111*cdf0e10cSrcweir }
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir TableCell &
116*cdf0e10cSrcweir TableRow::AddCell( DYN Item * let_dpItem )
117*cdf0e10cSrcweir {
118*cdf0e10cSrcweir 	return PushElem( *this, new TableCell, let_dpItem );
119*cdf0e10cSrcweir }
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir bool
122*cdf0e10cSrcweir TableRow::LineBreakAfterBeginTag() const
123*cdf0e10cSrcweir {
124*cdf0e10cSrcweir  	return true;
125*cdf0e10cSrcweir }
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir Table::Table( const String &   i_sBorder,
129*cdf0e10cSrcweir 			  const String &   i_sWidth,
130*cdf0e10cSrcweir 			  const String &   i_sCellPadding,
131*cdf0e10cSrcweir 			  const String &   i_sCellSpacing  )
132*cdf0e10cSrcweir 	: 	csi::xml::AnElement("table")
133*cdf0e10cSrcweir {
134*cdf0e10cSrcweir 	if ( i_sBorder.length() > 0 )
135*cdf0e10cSrcweir 		*this << new AnAttribute(String("border"),i_sBorder);
136*cdf0e10cSrcweir 	if ( i_sBorder.length() > 0 )
137*cdf0e10cSrcweir 		*this << new AnAttribute(String("width"),i_sWidth);
138*cdf0e10cSrcweir 	if ( i_sBorder.length() > 0 )
139*cdf0e10cSrcweir 		*this << new AnAttribute(String("cellpadding"),i_sCellPadding);
140*cdf0e10cSrcweir 	if ( i_sBorder.length() > 0 )
141*cdf0e10cSrcweir 		*this << new AnAttribute(String("cellspacing"),i_sCellSpacing);
142*cdf0e10cSrcweir }
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir TableRow &
145*cdf0e10cSrcweir Table::AddRow()
146*cdf0e10cSrcweir {
147*cdf0e10cSrcweir 	TableRow * ret = new TableRow;
148*cdf0e10cSrcweir 	*this << ret;
149*cdf0e10cSrcweir 	return *ret;
150*cdf0e10cSrcweir }
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir bool
153*cdf0e10cSrcweir Table::FinishEmptyTag_XmlStyle() const
154*cdf0e10cSrcweir {
155*cdf0e10cSrcweir  	return false;
156*cdf0e10cSrcweir }
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir bool
159*cdf0e10cSrcweir Table::LineBreakAfterBeginTag() const
160*cdf0e10cSrcweir {
161*cdf0e10cSrcweir  	return true;
162*cdf0e10cSrcweir }
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir bool
167*cdf0e10cSrcweir DefListTerm::LineBreakAfterEndTag() const
168*cdf0e10cSrcweir {
169*cdf0e10cSrcweir  	return true;
170*cdf0e10cSrcweir }
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir bool
173*cdf0e10cSrcweir DefListDefinition::LineBreakAfterEndTag() const
174*cdf0e10cSrcweir {
175*cdf0e10cSrcweir  	return true;
176*cdf0e10cSrcweir }
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir DefListTerm &
183*cdf0e10cSrcweir DefList::AddTerm( DYN csi::xml::Item* let_dpItem )
184*cdf0e10cSrcweir {
185*cdf0e10cSrcweir 	return PushElem( *this, new DefListTerm, let_dpItem );
186*cdf0e10cSrcweir }
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir DefListDefinition &
189*cdf0e10cSrcweir DefList::AddDefinition( DYN csi::xml::Item* let_dpItem )
190*cdf0e10cSrcweir {
191*cdf0e10cSrcweir 	return PushElem( *this, new DefListDefinition, let_dpItem );
192*cdf0e10cSrcweir }
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir bool
195*cdf0e10cSrcweir DefList::LineBreakAfterBeginTag() const
196*cdf0e10cSrcweir {
197*cdf0e10cSrcweir  	return true;
198*cdf0e10cSrcweir }
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir bool
201*cdf0e10cSrcweir DefList::FinishEmptyTag_XmlStyle() const
202*cdf0e10cSrcweir {
203*cdf0e10cSrcweir  	return false;
204*cdf0e10cSrcweir }
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir bool
207*cdf0e10cSrcweir ListItem::LineBreakAfterEndTag() const
208*cdf0e10cSrcweir {
209*cdf0e10cSrcweir  	return true;
210*cdf0e10cSrcweir }
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir ListItem &
216*cdf0e10cSrcweir NumeratedList::AddItem( DYN csi::xml::Item* let_dpItem )
217*cdf0e10cSrcweir {
218*cdf0e10cSrcweir 	return PushElem( *this, new ListItem, let_dpItem );
219*cdf0e10cSrcweir }
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir bool
222*cdf0e10cSrcweir NumeratedList::LineBreakAfterBeginTag() const
223*cdf0e10cSrcweir {
224*cdf0e10cSrcweir  	return true;
225*cdf0e10cSrcweir }
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir ListItem &
229*cdf0e10cSrcweir SimpleList::AddItem( DYN csi::xml::Item* let_dpItem )
230*cdf0e10cSrcweir {
231*cdf0e10cSrcweir 	return PushElem( *this, new ListItem, let_dpItem );
232*cdf0e10cSrcweir }
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir bool
235*cdf0e10cSrcweir SimpleList::LineBreakAfterBeginTag() const
236*cdf0e10cSrcweir {
237*cdf0e10cSrcweir  	return true;
238*cdf0e10cSrcweir }
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir }   // namespace html
243*cdf0e10cSrcweir }   // namespace csi
244