update dev300-m58
[ooovba.git] / udm / source / html / htmlitem.cxx
blobfaa35862778b71c9c10c795a96ec8ccfee18e230
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: htmlitem.cxx,v $
10 * $Revision: 1.7 $
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 #include <precomp.h>
32 #include <udm/html/htmlitem.hxx>
34 // NOT FULLY DECLARED SERVICES
37 namespace csi
39 namespace html
42 using namespace csi::xml;
44 template <class ELEM>
45 inline ELEM &
46 PushElem( Element & i_rMain,
47 DYN ELEM * let_dpSub,
48 DYN Item * let_dpItem )
50 i_rMain << let_dpSub;
51 if ( let_dpItem != 0 )
52 *let_dpSub << let_dpItem;
53 return *let_dpSub;
57 bool
58 Body::LineBreakAfterBeginTag() const
60 return true;
63 #ifndef COMPATIBLE_NETSCAPE_47
64 bool
65 HorizontalLine::LineBreakAfterBeginTag() const
67 return true;
69 #endif
72 Image::Image( const String & i_sSrc,
73 const String & i_sWidth,
74 const String & i_sHeight,
75 const String & i_sAlign,
76 const String & i_sBorder )
77 : AnEmptyElement( "img" )
79 *this << new AnAttribute(String("src"),i_sSrc)
80 << new AnAttribute(String("width"),i_sWidth)
81 << new AnAttribute(String("height"),i_sHeight)
82 << new AnAttribute(String("align"),i_sAlign)
83 << new AnAttribute(String("border"),i_sBorder);
86 bool
87 Paragraph::LineBreakAfterEndTag() const
89 return true;
92 const char *
93 Headline::sTags[6] = { "h1", "h2", "h3", "h4", "h5", "h6" };
95 bool
96 Headline::LineBreakAfterEndTag() const
98 return true;
101 #ifndef COMPATIBLE_NETSCAPE_47
102 bool
103 LineBreak::LineBreakAfterBeginTag() const
105 return true;
107 #endif
110 bool
111 TableCell::LineBreakAfterEndTag() const
113 return true;
118 TableCell &
119 TableRow::AddCell( DYN Item * let_dpItem )
121 return PushElem( *this, new TableCell, let_dpItem );
124 bool
125 TableRow::LineBreakAfterBeginTag() const
127 return true;
131 Table::Table( const String & i_sBorder,
132 const String & i_sWidth,
133 const String & i_sCellPadding,
134 const String & i_sCellSpacing )
135 : csi::xml::AnElement("table")
137 if ( i_sBorder.length() > 0 )
138 *this << new AnAttribute(String("border"),i_sBorder);
139 if ( i_sBorder.length() > 0 )
140 *this << new AnAttribute(String("width"),i_sWidth);
141 if ( i_sBorder.length() > 0 )
142 *this << new AnAttribute(String("cellpadding"),i_sCellPadding);
143 if ( i_sBorder.length() > 0 )
144 *this << new AnAttribute(String("cellspacing"),i_sCellSpacing);
147 TableRow &
148 Table::AddRow()
150 TableRow * ret = new TableRow;
151 *this << ret;
152 return *ret;
155 bool
156 Table::FinishEmptyTag_XmlStyle() const
158 return false;
161 bool
162 Table::LineBreakAfterBeginTag() const
164 return true;
169 bool
170 DefListTerm::LineBreakAfterEndTag() const
172 return true;
175 bool
176 DefListDefinition::LineBreakAfterEndTag() const
178 return true;
185 DefListTerm &
186 DefList::AddTerm( DYN csi::xml::Item* let_dpItem )
188 return PushElem( *this, new DefListTerm, let_dpItem );
191 DefListDefinition &
192 DefList::AddDefinition( DYN csi::xml::Item* let_dpItem )
194 return PushElem( *this, new DefListDefinition, let_dpItem );
197 bool
198 DefList::LineBreakAfterBeginTag() const
200 return true;
203 bool
204 DefList::FinishEmptyTag_XmlStyle() const
206 return false;
209 bool
210 ListItem::LineBreakAfterEndTag() const
212 return true;
218 ListItem &
219 NumeratedList::AddItem( DYN csi::xml::Item* let_dpItem )
221 return PushElem( *this, new ListItem, let_dpItem );
224 bool
225 NumeratedList::LineBreakAfterBeginTag() const
227 return true;
231 ListItem &
232 SimpleList::AddItem( DYN csi::xml::Item* let_dpItem )
234 return PushElem( *this, new ListItem, let_dpItem );
237 bool
238 SimpleList::LineBreakAfterBeginTag() const
240 return true;
245 } // namespace html
246 } // namespace csi