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 "html_kit.hxx" 30 31 32 // NOT FULLY DEFINED SERVICES 33 #include <stdio.h> 34 #include <ary/cpp/c_slntry.hxx> 35 #include "hdimpl.hxx" 36 37 38 namespace adcdisp 39 { 40 41 42 using namespace csi::xml; 43 using namespace csi::html; 44 45 46 void 47 PageTitle_Left::operator()( XmlElement & o_rOwner, 48 const char * i_sTypeTitle, 49 const String & i_sLocalName ) 50 { 51 o_rOwner 52 >> *new Headline(2) 53 << i_sTypeTitle 54 << " " 55 << i_sLocalName; 56 } 57 58 void 59 PageTitle_Std::operator()( XmlElement & o_rOwner, 60 const char * i_sTypeTitle, 61 const String & i_sLocalName ) 62 { 63 o_rOwner 64 >> *new AnElement("div") 65 << new ClassAttr("title") 66 >> *new Headline(2) 67 << i_sTypeTitle 68 << " " 69 << i_sLocalName; 70 } 71 72 XmlElement & 73 PageTitle_Std::operator()( XmlElement & o_rOwner ) 74 { 75 XmlElement & ret = 76 o_rOwner 77 >> *new AnElement("div") 78 << new ClassAttr("title") 79 >> *new Headline(2); 80 return ret; 81 } 82 83 void 84 OperationTitle::operator()( XmlElement & o_owner, 85 const char * i_itemName, 86 ary::cpp::Ce_id i_id, 87 const ::ary::cpp::Gate & i_gate ) 88 { 89 o_owner 90 >> *new Label( OperationLabel(i_itemName, i_id, i_gate) ) 91 << " "; 92 o_owner 93 << i_itemName; 94 } 95 96 97 void 98 TemplateClause::operator()( XmlElement & o_rOwner, 99 const List_TplParams & i_rTplParams ) 100 { 101 if ( i_rTplParams.size() == 0 ) 102 return; 103 104 Element & rOut = 105 o_rOwner 106 << new LineBreak 107 >> *new Paragraph 108 >> *new Strong 109 << "template< "; 110 111 List_TplParams::const_iterator 112 it = i_rTplParams.begin(); 113 List_TplParams::const_iterator 114 itEnd = i_rTplParams.end(); 115 116 rOut 117 << (*it).Name(); 118 for ( ++it; it != itEnd; ++it ) 119 { 120 rOut 121 << ", " 122 << (*it).Name(); 123 } // end for 124 rOut << " >"; 125 } 126 127 ExplanationList::ExplanationList( XmlElement & o_rOwner, 128 bool i_bMemberStyle ) 129 : pList( new DefList), 130 pTerm(0), 131 pDefinition(0), 132 bMemberStyle(i_bMemberStyle) 133 { 134 if (bMemberStyle) 135 *pList << new ClassAttr("member"); 136 137 o_rOwner << pList; 138 } 139 140 void 141 ExplanationList::AddEntry( const char * i_sTerm, 142 const char * i_sDifferentClass ) 143 { 144 DefListTerm & rNewTerm = pList->AddTerm(); 145 if ( i_sDifferentClass != 0 ) 146 { 147 rNewTerm << new ClassAttr(i_sDifferentClass); 148 } 149 else if (bMemberStyle) 150 { 151 rNewTerm << new ClassAttr("member"); 152 } 153 if ( i_sTerm != 0 ) 154 rNewTerm << i_sTerm; 155 156 pTerm = &rNewTerm; 157 pDefinition = &pList->AddDefinition(); 158 if (bMemberStyle) 159 *pDefinition << new ClassAttr("member"); 160 } 161 162 void 163 ExplanationList::AddEntry_NoTerm() 164 { 165 pTerm = 0; 166 pDefinition = &pList->AddDefinition(); 167 if (bMemberStyle) 168 *pDefinition << new ClassAttr("member"); 169 } 170 171 ExplanationTable::ExplanationTable( XmlElement & o_rOwner ) 172 : pTable(0), 173 pTerm(0), 174 pDefinition(0) 175 { 176 pTable = new Table("0", "100%", "3", "0"); 177 *pTable << new AnAttribute("class", "expl-table"); 178 o_rOwner << pTable; 179 } 180 181 void 182 ExplanationTable::AddEntry( const char * i_sTerm, 183 const char * i_sDifferentStyle ) 184 { 185 TableRow & 186 rNewRow = pTable->AddRow(); 187 TableCell & 188 rNewTerm = rNewRow.AddCell(); 189 TableCell & 190 rNewDefinition = rNewRow.AddCell(); 191 192 if ( i_sDifferentStyle == 0 ) 193 { 194 rNewTerm << new WidthAttr("15%") 195 << new StyleAttr("vertical-align:top; font-weight:bold"); 196 } 197 else 198 { 199 rNewTerm << new StyleAttr(i_sDifferentStyle); 200 } 201 if ( i_sTerm != 0 ) 202 rNewTerm << i_sTerm; 203 204 pTerm = &rNewTerm; 205 pDefinition = & (rNewDefinition >> *new APureElement("pre")); 206 } 207 208 ParameterTable::ParameterTable( XmlElement & o_rOwner ) 209 : pTable(0), 210 pTerm(0), 211 pDefinition(0) 212 { 213 pTable = new Table; 214 *pTable << new AnAttribute("class", "param-table"); 215 o_rOwner << pTable; 216 } 217 218 void 219 ParameterTable::AddEntry() 220 { 221 TableRow & 222 rNewRow = pTable->AddRow(); 223 TableCell & 224 rNewTerm = rNewRow.AddCell(); 225 TableCell & 226 rNewDefinition = rNewRow.AddCell(); 227 228 pTerm = &rNewTerm; 229 pDefinition = &rNewDefinition; 230 } 231 232 FlagTable::FlagTable( XmlElement & o_rOwner, 233 uintt i_nNrOfColumns ) 234 { 235 pTable = new Table; 236 *pTable << new AnAttribute("class", "flag-table"); 237 *pTable << new AnAttribute("border", "1"); 238 *pTable << new AnAttribute("cellspacing", "0"); 239 o_rOwner << pTable; 240 241 TableRow & rRow1 = pTable->AddRow(); 242 TableRow & rRow2 = pTable->AddRow(); 243 244 for ( uintt c = 0; c < i_nNrOfColumns; ++c ) 245 { 246 TableCell & rCell1 = rRow1.AddCell(); 247 int nWidth = 100 / i_nNrOfColumns; 248 static char sWidth[20]; 249 sprintf( sWidth, "%d%%", nWidth ); // SAFE SPRINTF (#100211# - checked) 250 251 rCell1 252 << new WidthAttr( sWidth ) 253 << new ClassAttr( "flagname" ); 254 TableCell & rCell2 = rRow2.AddCell(); 255 aCells.push_back( CellPair(&rCell1, &rCell2) ); 256 } // end for 257 } 258 259 void 260 FlagTable::SetColumn( uintt i_nColumnPosition, 261 const char * i_sColumnName, 262 bool i_bValue ) 263 { 264 csv_assert( i_nColumnPosition < aCells.size() ); 265 266 TableCell & 267 rCell1 = *aCells[i_nColumnPosition].first; 268 TableCell & 269 rCell2 = *aCells[i_nColumnPosition].second; 270 rCell1 271 << i_sColumnName; 272 if (i_bValue) 273 { 274 rCell2 275 << new ClassAttr("flagyes") 276 << "YES"; 277 } 278 else // 279 { 280 rCell2 281 << new ClassAttr("flagno") 282 << "NO"; 283 } // endif 284 } 285 286 IndexList::IndexList( XmlElement & o_rOwner ) 287 : pList( new DefList ), 288 pTerm(0), 289 pDefinition(0) 290 { 291 o_rOwner << pList; 292 } 293 294 void 295 IndexList::AddEntry() 296 { 297 pTerm = &pList->AddTerm(); 298 pDefinition = &pList->AddDefinition(); 299 } 300 301 302 } // namespace adcdisp 303 304 305 306