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