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 #ifndef CSI_HTML_HTMLITEM_HXX 25 #define CSI_HTML_HTMLITEM_HXX 26 27 // USED SERVICES 28 // BASE CLASSES 29 #include <udm/xml/xmlitem.hxx> 30 // COMPONENTS 31 // PARAMETERS 32 33 34 #define COMPATIBLE_NETSCAPE_47 35 36 namespace csi 37 { 38 namespace html 39 { 40 41 42 43 /** <BODY> 44 */ 45 class Body : public csi::xml::AnElement 46 { 47 public: Body()48 Body() 49 : csi::xml::AnElement( "body" ) {} 50 private: 51 virtual bool LineBreakAfterBeginTag() const; 52 }; 53 54 55 #ifdef COMPATIBLE_NETSCAPE_47 56 /** <BR> 57 */ 58 class HorizontalLine : public xml::XmlCode 59 { 60 public: HorizontalLine()61 HorizontalLine() 62 : xml::XmlCode("<hr>\n") {} 63 }; 64 65 #else 66 /** <HR> 67 */ 68 class HorizontalLine : public csi::xml::AnEmptyElement 69 { 70 public: HorizontalLine()71 HorizontalLine() 72 : csi::xml::AnEmptyElement("hr") {} 73 private: 74 virtual bool LineBreakAfterBeginTag() const; 75 }; 76 #endif 77 78 79 /** <IMG .... > 80 */ 81 class Image : public csi::xml::AnEmptyElement 82 { 83 public: 84 Image( 85 const ::csv::String & i_sSrc, 86 const ::csv::String & i_sWidth, 87 const ::csv::String & i_sHeight, 88 const ::csv::String & i_sAlign, 89 const ::csv::String & i_sBorder ); 90 }; 91 92 /** <A name=""> 93 */ 94 class Label : public csi::xml::AnElement 95 { 96 public: Label(const::csv::String & i_sLabel)97 Label( 98 const ::csv::String & i_sLabel ) 99 : csi::xml::AnElement("a") 100 { *this << new csi::xml::AnAttribute(String("name"), i_sLabel); } 101 }; 102 103 /** <p> 104 */ 105 class Paragraph : public csi::xml::AnElement 106 { 107 public: Paragraph()108 Paragraph() 109 : csi::xml::AnElement("p") {} 110 private: 111 virtual bool LineBreakAfterEndTag() const; 112 }; 113 114 /** <H1-6> 115 */ 116 class Headline : public csi::xml::APureElement 117 { 118 public: Headline(int i_nNr)119 Headline( 120 int i_nNr ) 121 : csi::xml::APureElement(sTags[i_nNr-1]) { csv_assert(1 <= i_nNr AND i_nNr < 7); } 122 private: 123 static const char * sTags[6]; 124 virtual bool LineBreakAfterEndTag() const; 125 }; 126 127 #ifdef COMPATIBLE_NETSCAPE_47 128 /** <BR> 129 */ 130 class LineBreak : public xml::XmlCode 131 { 132 public: LineBreak()133 LineBreak() 134 : xml::XmlCode("<br>\n") {} 135 }; 136 137 #else 138 /** <BR> 139 */ 140 class LineBreak : public csi::xml::ASglTag 141 { 142 public: LineBreak()143 LineBreak() 144 : csi::xml::ASglTag("br") {} 145 private: 146 virtual bool LineBreakAfterBeginTag() const; 147 }; 148 #endif 149 150 151 /** <b> 152 */ 153 class Bold : public csi::xml::APureElement 154 { 155 public: Bold()156 Bold() 157 : csi::xml::APureElement("b") {} 158 }; 159 160 /** <i> 161 */ 162 class Italic : public csi::xml::APureElement 163 { 164 public: Italic()165 Italic() 166 : csi::xml::APureElement("i") {} 167 }; 168 169 /** <strong> 170 */ 171 class Strong : public csi::xml::APureElement 172 { 173 public: Strong()174 Strong() 175 : csi::xml::APureElement("strong") {} 176 }; 177 178 /** <em> 179 */ 180 class Emphasized : public csi::xml::APureElement 181 { 182 public: Emphasized()183 Emphasized() 184 : csi::xml::APureElement("em") {} 185 }; 186 187 /** <font> 188 */ 189 class Font : public csi::xml::AnElement 190 { 191 public: Font()192 Font() 193 : csi::xml::AnElement("font") {} 194 }; 195 196 197 /** <A href=""> 198 */ 199 class Link : public csi::xml::AnElement 200 { 201 public: Link(const::csv::String & i_sDestinaton)202 Link( 203 const ::csv::String &i_sDestinaton ) 204 : csi::xml::AnElement("a") 205 { *this << new csi::xml::AnAttribute(String("href"), i_sDestinaton); } 206 }; 207 208 class TableCell : public csi::xml::AnElement 209 { 210 public: TableCell()211 TableCell() 212 : csi::xml::AnElement("td") {} 213 private: 214 virtual bool LineBreakAfterEndTag() const; 215 }; 216 217 class TableRow : public csi::xml::AnElement 218 { 219 public: TableRow()220 TableRow() 221 : csi::xml::AnElement("tr") {} 222 223 TableCell & AddCell( 224 DYN csi::xml::Item* let_dpItem = 0 ); 225 private: 226 virtual bool LineBreakAfterBeginTag() const; 227 }; 228 229 /** <table ....> 230 */ 231 class Table : public csi::xml::AnElement 232 { 233 public: Table()234 Table() 235 : csi::xml::AnElement("table") {} 236 Table( 237 const ::csv::String & i_sBorder, 238 const ::csv::String & i_sWidth, 239 const ::csv::String & i_sCellPadding, 240 const ::csv::String & i_sCellSpacing ); 241 TableRow & AddRow(); 242 private: 243 virtual bool FinishEmptyTag_XmlStyle() const; 244 virtual bool LineBreakAfterBeginTag() const; 245 }; 246 247 248 249 class DefListTerm : public csi::xml::AnElement 250 { 251 public: DefListTerm()252 DefListTerm() 253 : csi::xml::AnElement("dt") {} 254 private: 255 virtual bool LineBreakAfterEndTag() const; 256 }; 257 258 class DefListDefinition : public csi::xml::AnElement 259 { 260 public: DefListDefinition()261 DefListDefinition() 262 : csi::xml::AnElement("dd") {} 263 private: 264 virtual bool LineBreakAfterEndTag() const; 265 }; 266 267 /** <DL> 268 */ 269 class DefList : public csi::xml::AnElement 270 { 271 public: DefList()272 DefList() 273 : csi::xml::AnElement("dl") {} 274 275 DefListTerm & AddTerm( 276 DYN csi::xml::Item* let_dpItem = 0 ); 277 DefListDefinition & AddDefinition( 278 DYN csi::xml::Item* let_dpItem = 0 ); 279 private: 280 virtual bool LineBreakAfterBeginTag() const; 281 virtual bool FinishEmptyTag_XmlStyle() const; 282 }; 283 284 285 class ListItem : public csi::xml::AnElement 286 { 287 public: ListItem()288 ListItem() 289 : csi::xml::AnElement("li") {} 290 private: 291 virtual bool LineBreakAfterEndTag() const; 292 }; 293 294 /** <OL> 295 */ 296 class NumeratedList : public csi::xml::AnElement 297 { 298 public: NumeratedList()299 NumeratedList() 300 : csi::xml::AnElement("ol") {} 301 302 ListItem & AddItem( 303 DYN csi::xml::Item* let_dpItem = 0 ); 304 private: 305 virtual bool LineBreakAfterBeginTag() const; 306 }; 307 308 /** <UL> 309 */ 310 class SimpleList : public csi::xml::AnElement 311 { 312 public: SimpleList()313 SimpleList() 314 : csi::xml::AnElement("ul") {} 315 316 ListItem & AddItem( 317 DYN csi::xml::Item* let_dpItem = 0 ); 318 private: 319 virtual bool LineBreakAfterBeginTag() const; 320 }; 321 322 323 class ClassAttr : public csi::xml::AnAttribute 324 { 325 public: ClassAttr(const::csv::String & i_sValue)326 ClassAttr( 327 const ::csv::String & i_sValue ) 328 : csi::xml::AnAttribute( String("class"), i_sValue ) {} 329 }; 330 331 class StyleAttr : public csi::xml::AnAttribute 332 { 333 public: StyleAttr(const::csv::String & i_sValue)334 StyleAttr( 335 const ::csv::String & i_sValue ) 336 : csi::xml::AnAttribute( String("style"), i_sValue ) {} 337 }; 338 339 class SizeAttr : public csi::xml::AnAttribute 340 { 341 public: SizeAttr(const::csv::String & i_sValue)342 SizeAttr( 343 const ::csv::String & i_sValue ) 344 : csi::xml::AnAttribute( String("size"), i_sValue ) {} 345 }; 346 347 class ColorAttr : public csi::xml::AnAttribute 348 { 349 public: ColorAttr(const::csv::String & i_sValue)350 ColorAttr( 351 const ::csv::String & i_sValue ) 352 : csi::xml::AnAttribute( String("color"), i_sValue ) {} 353 }; 354 355 class BgColorAttr : public csi::xml::AnAttribute 356 { 357 public: BgColorAttr(const::csv::String & i_sValue)358 BgColorAttr( 359 const ::csv::String & i_sValue ) 360 : csi::xml::AnAttribute( String("bgcolor"), i_sValue ) {} 361 }; 362 363 class AlignAttr : public csi::xml::AnAttribute 364 { 365 public: AlignAttr(const::csv::String & i_sValue)366 AlignAttr( 367 const ::csv::String & i_sValue ) 368 : csi::xml::AnAttribute( String("align"), i_sValue ) {} 369 }; 370 371 class VAlignAttr : public csi::xml::AnAttribute 372 { 373 public: VAlignAttr(const::csv::String & i_sValue)374 VAlignAttr( 375 const ::csv::String & i_sValue ) 376 : csi::xml::AnAttribute( String("valign"), i_sValue ) {} 377 }; 378 379 class WidthAttr : public csi::xml::AnAttribute 380 { 381 public: WidthAttr(const::csv::String & i_sValue)382 WidthAttr( 383 const ::csv::String & i_sValue ) 384 : csi::xml::AnAttribute( String("width"), i_sValue ) {} 385 }; 386 387 388 389 class Sbr : public csi::xml::XmlCode // Sourcefile lineBreak 390 { 391 public: Sbr()392 Sbr() 393 : csi::xml::XmlCode("\n") {} 394 }; 395 396 397 } // namespace html 398 } // namespace csi 399 400 namespace Html = csi::html; 401 402 #endif 403 404 405