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 #include <precomp.h> 23 #include <toolkit/hf_navi_sub.hxx> 24 25 26 // NOT FULLY DEFINED SERVICES 27 28 29 HF_NaviSubRow::HF_NaviSubRow( Xml::Element & o_rOut ) 30 : HtmlMaker(o_rOut), 31 aRow(), 32 pMyRow(0) 33 { 34 Setup_Row(); 35 } 36 37 HF_NaviSubRow::~HF_NaviSubRow() 38 { 39 } 40 41 void 42 HF_NaviSubRow::AddItem( const String & i_sText, 43 const String & i_sLink, 44 bool i_bSwitchOn ) 45 { 46 aRow.push_back( SubRow_Item( SubRow_Data(i_sText,i_sLink), 47 i_bSwitchOn )); 48 } 49 50 void 51 HF_NaviSubRow::SwitchOn( int i_nIndex ) 52 { 53 if ( i_nIndex < int(aRow.size()) ) 54 aRow[i_nIndex].second = true; 55 } 56 57 void 58 HF_NaviSubRow::Setup_Row() 59 { 60 Html::Table * 61 pTable = new Html::Table; 62 CurOut() 63 >> *pTable 64 << new Html::ClassAttr("navisub") 65 << new Xml::AnAttribute( "border", "0" ) 66 << new Xml::AnAttribute( "cellpadding", "0" ); 67 pMyRow = &pTable->AddRow(); 68 } 69 70 void 71 HF_NaviSubRow::Produce_Row() 72 { 73 for ( SubRow::const_iterator it = aRow.begin(); 74 it != aRow.end(); 75 ++it ) 76 { 77 Xml::Element & 78 rCell = *pMyRow 79 >> *new Html::TableCell 80 << new Html::ClassAttr("navisub"); 81 StreamLock sl(100); 82 Xml::Element & 83 rGoon = (*it).second 84 ? ( rCell 85 >> *new Html::Link( sl() 86 << "#" 87 << (*it).first.second 88 << c_str ) 89 << new Html::ClassAttr("navisub") 90 ) 91 : rCell; 92 rGoon 93 << (*it).first.first; 94 } 95 } 96 97 98