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