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_main.hxx>
24cdf0e10cSrcweir
25cdf0e10cSrcweir
26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
27cdf0e10cSrcweir #include <cosv/tpl/tpltools.hxx>
28cdf0e10cSrcweir
29cdf0e10cSrcweir
30cdf0e10cSrcweir
31cdf0e10cSrcweir //******************** MainItem and derived ones ***************//
32cdf0e10cSrcweir class HF_MainItem : public HtmlMaker
33cdf0e10cSrcweir {
34cdf0e10cSrcweir public:
~HF_MainItem()35cdf0e10cSrcweir virtual ~HF_MainItem() {}
Produce_Item() const36cdf0e10cSrcweir void Produce_Item() const { do_ProduceItem(); }
37cdf0e10cSrcweir protected:
HF_MainItem(Xml::Element & o_out)38cdf0e10cSrcweir HF_MainItem(
39cdf0e10cSrcweir Xml::Element & o_out )
40cdf0e10cSrcweir : HtmlMaker(o_out) {}
41cdf0e10cSrcweir private:
42cdf0e10cSrcweir virtual void do_ProduceItem() const = 0;
43cdf0e10cSrcweir };
44cdf0e10cSrcweir
45cdf0e10cSrcweir
46cdf0e10cSrcweir namespace
47cdf0e10cSrcweir {
48cdf0e10cSrcweir
49cdf0e10cSrcweir class StdItem : public HF_MainItem
50cdf0e10cSrcweir {
51cdf0e10cSrcweir public:
52cdf0e10cSrcweir StdItem(
53cdf0e10cSrcweir Xml::Element & o_out,
54cdf0e10cSrcweir const char * i_sText,
55cdf0e10cSrcweir const char * i_sLink );
56cdf0e10cSrcweir
57cdf0e10cSrcweir ~StdItem();
58cdf0e10cSrcweir private:
59cdf0e10cSrcweir virtual void do_ProduceItem() const;
60cdf0e10cSrcweir
61cdf0e10cSrcweir // DATA
62cdf0e10cSrcweir String sText;
63cdf0e10cSrcweir String sLink;
64cdf0e10cSrcweir };
65cdf0e10cSrcweir
66cdf0e10cSrcweir class SelfItem : public HF_MainItem
67cdf0e10cSrcweir {
68cdf0e10cSrcweir public:
69cdf0e10cSrcweir SelfItem(
70cdf0e10cSrcweir Xml::Element & o_out,
71cdf0e10cSrcweir const char * i_sText );
72cdf0e10cSrcweir ~SelfItem();
73cdf0e10cSrcweir private:
74cdf0e10cSrcweir virtual void do_ProduceItem() const;
75cdf0e10cSrcweir
76cdf0e10cSrcweir // DATA
77cdf0e10cSrcweir String sText;
78cdf0e10cSrcweir };
79cdf0e10cSrcweir
80cdf0e10cSrcweir class NoneItem : public HF_MainItem
81cdf0e10cSrcweir {
82cdf0e10cSrcweir public:
83cdf0e10cSrcweir NoneItem(
84cdf0e10cSrcweir Xml::Element & o_out,
85cdf0e10cSrcweir const char * i_sText );
86cdf0e10cSrcweir ~NoneItem();
87cdf0e10cSrcweir private:
88cdf0e10cSrcweir virtual void do_ProduceItem() const;
89cdf0e10cSrcweir
90cdf0e10cSrcweir // DATA
91cdf0e10cSrcweir String sText;
92cdf0e10cSrcweir };
93cdf0e10cSrcweir
94cdf0e10cSrcweir } // anonymous namespace
95cdf0e10cSrcweir
96cdf0e10cSrcweir
97cdf0e10cSrcweir
98cdf0e10cSrcweir //******************** HF_NaviMainRow ***************//
99cdf0e10cSrcweir
100cdf0e10cSrcweir
101cdf0e10cSrcweir
HF_NaviMainRow(Xml::Element & o_out)102cdf0e10cSrcweir HF_NaviMainRow::HF_NaviMainRow( Xml::Element & o_out )
103cdf0e10cSrcweir : HtmlMaker(o_out),
104cdf0e10cSrcweir aItems(),
105cdf0e10cSrcweir pRow(0)
106cdf0e10cSrcweir {
107cdf0e10cSrcweir aItems.reserve(5);
108cdf0e10cSrcweir
109cdf0e10cSrcweir pRow =
110cdf0e10cSrcweir &( CurOut()
111cdf0e10cSrcweir >> *new Html::Table
112cdf0e10cSrcweir << new Html::ClassAttr("navimain")
113cdf0e10cSrcweir << new Xml::AnAttribute( "border", "0" )
114cdf0e10cSrcweir << new Xml::AnAttribute( "cellpadding", "3" )
115cdf0e10cSrcweir >> *new Html::TableRow
116cdf0e10cSrcweir );
117cdf0e10cSrcweir }
118cdf0e10cSrcweir
~HF_NaviMainRow()119cdf0e10cSrcweir HF_NaviMainRow::~HF_NaviMainRow()
120cdf0e10cSrcweir {
121cdf0e10cSrcweir csv::erase_container_of_heap_ptrs(aItems);
122cdf0e10cSrcweir }
123cdf0e10cSrcweir
124cdf0e10cSrcweir void
Add_StdItem(const char * i_sText,const char * i_sLink)125cdf0e10cSrcweir HF_NaviMainRow::Add_StdItem( const char * i_sText,
126cdf0e10cSrcweir const char * i_sLink )
127cdf0e10cSrcweir {
128cdf0e10cSrcweir aItems.push_back(new StdItem( *pRow,i_sText,i_sLink ));
129cdf0e10cSrcweir }
130cdf0e10cSrcweir
131cdf0e10cSrcweir void
Add_SelfItem(const char * i_sText)132cdf0e10cSrcweir HF_NaviMainRow::Add_SelfItem( const char * i_sText )
133cdf0e10cSrcweir {
134cdf0e10cSrcweir aItems.push_back(new SelfItem( *pRow,i_sText ));
135cdf0e10cSrcweir }
136cdf0e10cSrcweir
137cdf0e10cSrcweir void
Add_NoneItem(const char * i_sText)138cdf0e10cSrcweir HF_NaviMainRow::Add_NoneItem( const char * i_sText )
139cdf0e10cSrcweir {
140cdf0e10cSrcweir aItems.push_back(new NoneItem( *pRow,i_sText ));
141cdf0e10cSrcweir }
142cdf0e10cSrcweir
143cdf0e10cSrcweir void
Produce_Row()144cdf0e10cSrcweir HF_NaviMainRow::Produce_Row()
145cdf0e10cSrcweir {
146cdf0e10cSrcweir ItemList::iterator itEnd = aItems.end();
147cdf0e10cSrcweir for ( ItemList::iterator iter = aItems.begin();
148cdf0e10cSrcweir iter != itEnd;
149cdf0e10cSrcweir ++iter )
150cdf0e10cSrcweir {
151cdf0e10cSrcweir (*iter)->Produce_Item();
152cdf0e10cSrcweir }
153cdf0e10cSrcweir }
154cdf0e10cSrcweir
155cdf0e10cSrcweir
156cdf0e10cSrcweir
157cdf0e10cSrcweir
158cdf0e10cSrcweir //******************** MainItem and derived ones ***************//
159cdf0e10cSrcweir
160cdf0e10cSrcweir namespace
161cdf0e10cSrcweir {
162cdf0e10cSrcweir
StdItem(Xml::Element & o_out,const char * i_sText,const char * i_sLink)163cdf0e10cSrcweir StdItem::StdItem( Xml::Element & o_out,
164cdf0e10cSrcweir const char * i_sText,
165cdf0e10cSrcweir const char * i_sLink )
166cdf0e10cSrcweir : HF_MainItem(o_out),
167cdf0e10cSrcweir sText(i_sText),
168cdf0e10cSrcweir sLink(i_sLink)
169cdf0e10cSrcweir {
170cdf0e10cSrcweir }
171cdf0e10cSrcweir
~StdItem()172cdf0e10cSrcweir StdItem::~StdItem()
173cdf0e10cSrcweir {
174cdf0e10cSrcweir }
175cdf0e10cSrcweir
176cdf0e10cSrcweir void
do_ProduceItem() const177cdf0e10cSrcweir StdItem::do_ProduceItem() const
178cdf0e10cSrcweir {
179cdf0e10cSrcweir Xml::Element &
180cdf0e10cSrcweir rCell = CurOut() >>* new Html::TableCell;
181cdf0e10cSrcweir rCell
182cdf0e10cSrcweir << new Html::ClassAttr( "navimain" )
183cdf0e10cSrcweir >> *new Html::Link(sLink.c_str())
184cdf0e10cSrcweir << new Html::ClassAttr( "navimain" )
185cdf0e10cSrcweir << sText.c_str();
186cdf0e10cSrcweir }
187cdf0e10cSrcweir
SelfItem(Xml::Element & o_out,const char * i_sText)188cdf0e10cSrcweir SelfItem::SelfItem( Xml::Element & o_out,
189cdf0e10cSrcweir const char * i_sText )
190cdf0e10cSrcweir : HF_MainItem(o_out),
191cdf0e10cSrcweir sText(i_sText)
192cdf0e10cSrcweir {
193cdf0e10cSrcweir }
194cdf0e10cSrcweir
~SelfItem()195cdf0e10cSrcweir SelfItem::~SelfItem()
196cdf0e10cSrcweir {
197cdf0e10cSrcweir }
198cdf0e10cSrcweir
199cdf0e10cSrcweir void
do_ProduceItem() const200cdf0e10cSrcweir SelfItem::do_ProduceItem() const
201cdf0e10cSrcweir {
202cdf0e10cSrcweir Xml::Element &
203cdf0e10cSrcweir rCell = CurOut() >>* new Html::TableCell;
204cdf0e10cSrcweir rCell
205cdf0e10cSrcweir << new Html::ClassAttr( "navimainself" )
206cdf0e10cSrcweir << sText.c_str();
207cdf0e10cSrcweir }
208cdf0e10cSrcweir
NoneItem(Xml::Element & o_out,const char * i_sText)209cdf0e10cSrcweir NoneItem::NoneItem( Xml::Element & o_out,
210cdf0e10cSrcweir const char * i_sText )
211cdf0e10cSrcweir : HF_MainItem(o_out),
212cdf0e10cSrcweir sText(i_sText)
213cdf0e10cSrcweir {
214cdf0e10cSrcweir }
215cdf0e10cSrcweir
~NoneItem()216cdf0e10cSrcweir NoneItem::~NoneItem()
217cdf0e10cSrcweir {
218cdf0e10cSrcweir }
219cdf0e10cSrcweir
220cdf0e10cSrcweir void
do_ProduceItem() const221cdf0e10cSrcweir NoneItem::do_ProduceItem() const
222cdf0e10cSrcweir {
223cdf0e10cSrcweir Xml::Element &
224cdf0e10cSrcweir rCell = CurOut() >>* new Html::TableCell;
225cdf0e10cSrcweir rCell
226cdf0e10cSrcweir << new Html::ClassAttr( "navimainnone" )
227cdf0e10cSrcweir << sText.c_str();
228cdf0e10cSrcweir }
229cdf0e10cSrcweir
230cdf0e10cSrcweir } // anonymous namespace
231cdf0e10cSrcweir
232cdf0e10cSrcweir
233