1*0841af79SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*0841af79SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*0841af79SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*0841af79SAndrew Rist * distributed with this work for additional information 6*0841af79SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*0841af79SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*0841af79SAndrew Rist * "License"); you may not use this file except in compliance 9*0841af79SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*0841af79SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*0841af79SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*0841af79SAndrew Rist * software distributed under the License is distributed on an 15*0841af79SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*0841af79SAndrew Rist * KIND, either express or implied. See the License for the 17*0841af79SAndrew Rist * specific language governing permissions and limitations 18*0841af79SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*0841af79SAndrew Rist *************************************************************/ 21cdf0e10cSrcweir 22cdf0e10cSrcweir #include <precomp.h> 23cdf0e10cSrcweir #include "html_kit.hxx" 24cdf0e10cSrcweir 25cdf0e10cSrcweir 26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES 27cdf0e10cSrcweir #include <stdio.h> 28cdf0e10cSrcweir #include <ary/cpp/c_slntry.hxx> 29cdf0e10cSrcweir #include "hdimpl.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir 32cdf0e10cSrcweir namespace adcdisp 33cdf0e10cSrcweir { 34cdf0e10cSrcweir 35cdf0e10cSrcweir 36cdf0e10cSrcweir using namespace csi::xml; 37cdf0e10cSrcweir using namespace csi::html; 38cdf0e10cSrcweir 39cdf0e10cSrcweir 40cdf0e10cSrcweir void 41cdf0e10cSrcweir PageTitle_Left::operator()( XmlElement & o_rOwner, 42cdf0e10cSrcweir const char * i_sTypeTitle, 43cdf0e10cSrcweir const String & i_sLocalName ) 44cdf0e10cSrcweir { 45cdf0e10cSrcweir o_rOwner 46cdf0e10cSrcweir >> *new Headline(2) 47cdf0e10cSrcweir << i_sTypeTitle 48cdf0e10cSrcweir << " " 49cdf0e10cSrcweir << i_sLocalName; 50cdf0e10cSrcweir } 51cdf0e10cSrcweir 52cdf0e10cSrcweir void 53cdf0e10cSrcweir PageTitle_Std::operator()( XmlElement & o_rOwner, 54cdf0e10cSrcweir const char * i_sTypeTitle, 55cdf0e10cSrcweir const String & i_sLocalName ) 56cdf0e10cSrcweir { 57cdf0e10cSrcweir o_rOwner 58cdf0e10cSrcweir >> *new AnElement("div") 59cdf0e10cSrcweir << new ClassAttr("title") 60cdf0e10cSrcweir >> *new Headline(2) 61cdf0e10cSrcweir << i_sTypeTitle 62cdf0e10cSrcweir << " " 63cdf0e10cSrcweir << i_sLocalName; 64cdf0e10cSrcweir } 65cdf0e10cSrcweir 66cdf0e10cSrcweir XmlElement & 67cdf0e10cSrcweir PageTitle_Std::operator()( XmlElement & o_rOwner ) 68cdf0e10cSrcweir { 69cdf0e10cSrcweir XmlElement & ret = 70cdf0e10cSrcweir o_rOwner 71cdf0e10cSrcweir >> *new AnElement("div") 72cdf0e10cSrcweir << new ClassAttr("title") 73cdf0e10cSrcweir >> *new Headline(2); 74cdf0e10cSrcweir return ret; 75cdf0e10cSrcweir } 76cdf0e10cSrcweir 77cdf0e10cSrcweir void 78cdf0e10cSrcweir OperationTitle::operator()( XmlElement & o_owner, 79cdf0e10cSrcweir const char * i_itemName, 80cdf0e10cSrcweir ary::cpp::Ce_id i_id, 81cdf0e10cSrcweir const ::ary::cpp::Gate & i_gate ) 82cdf0e10cSrcweir { 83cdf0e10cSrcweir o_owner 84cdf0e10cSrcweir >> *new Label( OperationLabel(i_itemName, i_id, i_gate) ) 85cdf0e10cSrcweir << " "; 86cdf0e10cSrcweir o_owner 87cdf0e10cSrcweir << i_itemName; 88cdf0e10cSrcweir } 89cdf0e10cSrcweir 90cdf0e10cSrcweir 91cdf0e10cSrcweir void 92cdf0e10cSrcweir TemplateClause::operator()( XmlElement & o_rOwner, 93cdf0e10cSrcweir const List_TplParams & i_rTplParams ) 94cdf0e10cSrcweir { 95cdf0e10cSrcweir if ( i_rTplParams.size() == 0 ) 96cdf0e10cSrcweir return; 97cdf0e10cSrcweir 98cdf0e10cSrcweir Element & rOut = 99cdf0e10cSrcweir o_rOwner 100cdf0e10cSrcweir << new LineBreak 101cdf0e10cSrcweir >> *new Paragraph 102cdf0e10cSrcweir >> *new Strong 103cdf0e10cSrcweir << "template< "; 104cdf0e10cSrcweir 105cdf0e10cSrcweir List_TplParams::const_iterator 106cdf0e10cSrcweir it = i_rTplParams.begin(); 107cdf0e10cSrcweir List_TplParams::const_iterator 108cdf0e10cSrcweir itEnd = i_rTplParams.end(); 109cdf0e10cSrcweir 110cdf0e10cSrcweir rOut 111cdf0e10cSrcweir << (*it).Name(); 112cdf0e10cSrcweir for ( ++it; it != itEnd; ++it ) 113cdf0e10cSrcweir { 114cdf0e10cSrcweir rOut 115cdf0e10cSrcweir << ", " 116cdf0e10cSrcweir << (*it).Name(); 117cdf0e10cSrcweir } // end for 118cdf0e10cSrcweir rOut << " >"; 119cdf0e10cSrcweir } 120cdf0e10cSrcweir 121cdf0e10cSrcweir ExplanationList::ExplanationList( XmlElement & o_rOwner, 122cdf0e10cSrcweir bool i_bMemberStyle ) 123cdf0e10cSrcweir : pList( new DefList), 124cdf0e10cSrcweir pTerm(0), 125cdf0e10cSrcweir pDefinition(0), 126cdf0e10cSrcweir bMemberStyle(i_bMemberStyle) 127cdf0e10cSrcweir { 128cdf0e10cSrcweir if (bMemberStyle) 129cdf0e10cSrcweir *pList << new ClassAttr("member"); 130cdf0e10cSrcweir 131cdf0e10cSrcweir o_rOwner << pList; 132cdf0e10cSrcweir } 133cdf0e10cSrcweir 134cdf0e10cSrcweir void 135cdf0e10cSrcweir ExplanationList::AddEntry( const char * i_sTerm, 136cdf0e10cSrcweir const char * i_sDifferentClass ) 137cdf0e10cSrcweir { 138cdf0e10cSrcweir DefListTerm & rNewTerm = pList->AddTerm(); 139cdf0e10cSrcweir if ( i_sDifferentClass != 0 ) 140cdf0e10cSrcweir { 141cdf0e10cSrcweir rNewTerm << new ClassAttr(i_sDifferentClass); 142cdf0e10cSrcweir } 143cdf0e10cSrcweir else if (bMemberStyle) 144cdf0e10cSrcweir { 145cdf0e10cSrcweir rNewTerm << new ClassAttr("member"); 146cdf0e10cSrcweir } 147cdf0e10cSrcweir if ( i_sTerm != 0 ) 148cdf0e10cSrcweir rNewTerm << i_sTerm; 149cdf0e10cSrcweir 150cdf0e10cSrcweir pTerm = &rNewTerm; 151cdf0e10cSrcweir pDefinition = &pList->AddDefinition(); 152cdf0e10cSrcweir if (bMemberStyle) 153cdf0e10cSrcweir *pDefinition << new ClassAttr("member"); 154cdf0e10cSrcweir } 155cdf0e10cSrcweir 156cdf0e10cSrcweir void 157cdf0e10cSrcweir ExplanationList::AddEntry_NoTerm() 158cdf0e10cSrcweir { 159cdf0e10cSrcweir pTerm = 0; 160cdf0e10cSrcweir pDefinition = &pList->AddDefinition(); 161cdf0e10cSrcweir if (bMemberStyle) 162cdf0e10cSrcweir *pDefinition << new ClassAttr("member"); 163cdf0e10cSrcweir } 164cdf0e10cSrcweir 165cdf0e10cSrcweir ExplanationTable::ExplanationTable( XmlElement & o_rOwner ) 166cdf0e10cSrcweir : pTable(0), 167cdf0e10cSrcweir pTerm(0), 168cdf0e10cSrcweir pDefinition(0) 169cdf0e10cSrcweir { 170cdf0e10cSrcweir pTable = new Table("0", "100%", "3", "0"); 171cdf0e10cSrcweir *pTable << new AnAttribute("class", "expl-table"); 172cdf0e10cSrcweir o_rOwner << pTable; 173cdf0e10cSrcweir } 174cdf0e10cSrcweir 175cdf0e10cSrcweir void 176cdf0e10cSrcweir ExplanationTable::AddEntry( const char * i_sTerm, 177cdf0e10cSrcweir const char * i_sDifferentStyle ) 178cdf0e10cSrcweir { 179cdf0e10cSrcweir TableRow & 180cdf0e10cSrcweir rNewRow = pTable->AddRow(); 181cdf0e10cSrcweir TableCell & 182cdf0e10cSrcweir rNewTerm = rNewRow.AddCell(); 183cdf0e10cSrcweir TableCell & 184cdf0e10cSrcweir rNewDefinition = rNewRow.AddCell(); 185cdf0e10cSrcweir 186cdf0e10cSrcweir if ( i_sDifferentStyle == 0 ) 187cdf0e10cSrcweir { 188cdf0e10cSrcweir rNewTerm << new WidthAttr("15%") 189cdf0e10cSrcweir << new StyleAttr("vertical-align:top; font-weight:bold"); 190cdf0e10cSrcweir } 191cdf0e10cSrcweir else 192cdf0e10cSrcweir { 193cdf0e10cSrcweir rNewTerm << new StyleAttr(i_sDifferentStyle); 194cdf0e10cSrcweir } 195cdf0e10cSrcweir if ( i_sTerm != 0 ) 196cdf0e10cSrcweir rNewTerm << i_sTerm; 197cdf0e10cSrcweir 198cdf0e10cSrcweir pTerm = &rNewTerm; 199cdf0e10cSrcweir pDefinition = & (rNewDefinition >> *new APureElement("pre")); 200cdf0e10cSrcweir } 201cdf0e10cSrcweir 202cdf0e10cSrcweir ParameterTable::ParameterTable( XmlElement & o_rOwner ) 203cdf0e10cSrcweir : pTable(0), 204cdf0e10cSrcweir pTerm(0), 205cdf0e10cSrcweir pDefinition(0) 206cdf0e10cSrcweir { 207cdf0e10cSrcweir pTable = new Table; 208cdf0e10cSrcweir *pTable << new AnAttribute("class", "param-table"); 209cdf0e10cSrcweir o_rOwner << pTable; 210cdf0e10cSrcweir } 211cdf0e10cSrcweir 212cdf0e10cSrcweir void 213cdf0e10cSrcweir ParameterTable::AddEntry() 214cdf0e10cSrcweir { 215cdf0e10cSrcweir TableRow & 216cdf0e10cSrcweir rNewRow = pTable->AddRow(); 217cdf0e10cSrcweir TableCell & 218cdf0e10cSrcweir rNewTerm = rNewRow.AddCell(); 219cdf0e10cSrcweir TableCell & 220cdf0e10cSrcweir rNewDefinition = rNewRow.AddCell(); 221cdf0e10cSrcweir 222cdf0e10cSrcweir pTerm = &rNewTerm; 223cdf0e10cSrcweir pDefinition = &rNewDefinition; 224cdf0e10cSrcweir } 225cdf0e10cSrcweir 226cdf0e10cSrcweir FlagTable::FlagTable( XmlElement & o_rOwner, 227cdf0e10cSrcweir uintt i_nNrOfColumns ) 228cdf0e10cSrcweir { 229cdf0e10cSrcweir pTable = new Table; 230cdf0e10cSrcweir *pTable << new AnAttribute("class", "flag-table"); 231cdf0e10cSrcweir *pTable << new AnAttribute("border", "1"); 232cdf0e10cSrcweir *pTable << new AnAttribute("cellspacing", "0"); 233cdf0e10cSrcweir o_rOwner << pTable; 234cdf0e10cSrcweir 235cdf0e10cSrcweir TableRow & rRow1 = pTable->AddRow(); 236cdf0e10cSrcweir TableRow & rRow2 = pTable->AddRow(); 237cdf0e10cSrcweir 238cdf0e10cSrcweir for ( uintt c = 0; c < i_nNrOfColumns; ++c ) 239cdf0e10cSrcweir { 240cdf0e10cSrcweir TableCell & rCell1 = rRow1.AddCell(); 241cdf0e10cSrcweir int nWidth = 100 / i_nNrOfColumns; 242cdf0e10cSrcweir static char sWidth[20]; 243cdf0e10cSrcweir sprintf( sWidth, "%d%%", nWidth ); // SAFE SPRINTF (#100211# - checked) 244cdf0e10cSrcweir 245cdf0e10cSrcweir rCell1 246cdf0e10cSrcweir << new WidthAttr( sWidth ) 247cdf0e10cSrcweir << new ClassAttr( "flagname" ); 248cdf0e10cSrcweir TableCell & rCell2 = rRow2.AddCell(); 249cdf0e10cSrcweir aCells.push_back( CellPair(&rCell1, &rCell2) ); 250cdf0e10cSrcweir } // end for 251cdf0e10cSrcweir } 252cdf0e10cSrcweir 253cdf0e10cSrcweir void 254cdf0e10cSrcweir FlagTable::SetColumn( uintt i_nColumnPosition, 255cdf0e10cSrcweir const char * i_sColumnName, 256cdf0e10cSrcweir bool i_bValue ) 257cdf0e10cSrcweir { 258cdf0e10cSrcweir csv_assert( i_nColumnPosition < aCells.size() ); 259cdf0e10cSrcweir 260cdf0e10cSrcweir TableCell & 261cdf0e10cSrcweir rCell1 = *aCells[i_nColumnPosition].first; 262cdf0e10cSrcweir TableCell & 263cdf0e10cSrcweir rCell2 = *aCells[i_nColumnPosition].second; 264cdf0e10cSrcweir rCell1 265cdf0e10cSrcweir << i_sColumnName; 266cdf0e10cSrcweir if (i_bValue) 267cdf0e10cSrcweir { 268cdf0e10cSrcweir rCell2 269cdf0e10cSrcweir << new ClassAttr("flagyes") 270cdf0e10cSrcweir << "YES"; 271cdf0e10cSrcweir } 272cdf0e10cSrcweir else // 273cdf0e10cSrcweir { 274cdf0e10cSrcweir rCell2 275cdf0e10cSrcweir << new ClassAttr("flagno") 276cdf0e10cSrcweir << "NO"; 277cdf0e10cSrcweir } // endif 278cdf0e10cSrcweir } 279cdf0e10cSrcweir 280cdf0e10cSrcweir IndexList::IndexList( XmlElement & o_rOwner ) 281cdf0e10cSrcweir : pList( new DefList ), 282cdf0e10cSrcweir pTerm(0), 283cdf0e10cSrcweir pDefinition(0) 284cdf0e10cSrcweir { 285cdf0e10cSrcweir o_rOwner << pList; 286cdf0e10cSrcweir } 287cdf0e10cSrcweir 288cdf0e10cSrcweir void 289cdf0e10cSrcweir IndexList::AddEntry() 290cdf0e10cSrcweir { 291cdf0e10cSrcweir pTerm = &pList->AddTerm(); 292cdf0e10cSrcweir pDefinition = &pList->AddDefinition(); 293cdf0e10cSrcweir } 294cdf0e10cSrcweir 295cdf0e10cSrcweir 296cdf0e10cSrcweir } // namespace adcdisp 297cdf0e10cSrcweir 298cdf0e10cSrcweir 299cdf0e10cSrcweir 300