Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <precomp.h>
21 : #include <toolkit/hf_navi_sub.hxx>
22 :
23 :
24 : // NOT FULLY DEFINED SERVICES
25 :
26 :
27 4220 : HF_NaviSubRow::HF_NaviSubRow( Xml::Element & o_rOut )
28 : : HtmlMaker(o_rOut),
29 : aRow(),
30 4220 : pMyRow(0)
31 : {
32 4220 : Setup_Row();
33 4220 : }
34 :
35 8440 : HF_NaviSubRow::~HF_NaviSubRow()
36 : {
37 8440 : }
38 :
39 : void
40 16861 : HF_NaviSubRow::AddItem( const String & i_sText,
41 : const String & i_sLink,
42 : bool i_bSwitchOn )
43 : {
44 : aRow.push_back( SubRow_Item( SubRow_Data(i_sText,i_sLink),
45 16861 : i_bSwitchOn ));
46 16861 : }
47 :
48 : void
49 9185 : HF_NaviSubRow::SwitchOn( int i_nIndex )
50 : {
51 9185 : if ( i_nIndex < int(aRow.size()) )
52 9185 : aRow[i_nIndex].second = true;
53 9185 : }
54 :
55 : void
56 4220 : HF_NaviSubRow::Setup_Row()
57 : {
58 : Html::Table *
59 4220 : pTable = new Html::Table;
60 4220 : CurOut()
61 8440 : >> *pTable
62 12660 : << new Html::ClassAttr("navisub")
63 8440 : << new Xml::AnAttribute( "border", "0" )
64 8440 : << new Xml::AnAttribute( "cellpadding", "0" );
65 4220 : pMyRow = &pTable->AddRow();
66 4220 : }
67 :
68 : void
69 4220 : HF_NaviSubRow::Produce_Row()
70 : {
71 63243 : for ( SubRow::const_iterator it = aRow.begin();
72 42162 : it != aRow.end();
73 : ++it )
74 : {
75 : Xml::Element &
76 : rCell = *pMyRow
77 16861 : >> *new Html::TableCell
78 33722 : << new Html::ClassAttr("navisub");
79 16861 : StreamLock sl(100);
80 : Xml::Element &
81 16861 : rGoon = (*it).second
82 : ? ( rCell
83 9185 : >> *new Html::Link( sl()
84 9185 : << "#"
85 18370 : << (*it).first.second
86 26046 : << c_str )
87 26046 : << new Html::ClassAttr("navisub")
88 : )
89 26046 : : rCell;
90 : rGoon
91 16861 : << (*it).first.first;
92 16861 : }
93 4223 : }
94 :
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|