Update ooo320-m1
[ooovba.git] / autodoc / source / display / toolkit / hf_navi_main.cxx
blob3f2caad75012bc7ec5b8d25225fe7284ddcc80d8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hf_navi_main.cxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <precomp.h>
32 #include <toolkit/hf_navi_main.hxx>
35 // NOT FULLY DEFINED SERVICES
36 #include <cosv/tpl/tpltools.hxx>
40 //******************** MainItem and derived ones ***************//
41 class HF_MainItem : public HtmlMaker
43 public:
44 virtual ~HF_MainItem() {}
45 void Produce_Item() const { do_ProduceItem(); }
46 protected:
47 HF_MainItem(
48 Xml::Element & o_out )
49 : HtmlMaker(o_out) {}
50 private:
51 virtual void do_ProduceItem() const = 0;
55 namespace
58 class StdItem : public HF_MainItem
60 public:
61 StdItem(
62 Xml::Element & o_out,
63 const char * i_sText,
64 const char * i_sLink );
66 ~StdItem();
67 private:
68 virtual void do_ProduceItem() const;
70 // DATA
71 String sText;
72 String sLink;
75 class SelfItem : public HF_MainItem
77 public:
78 SelfItem(
79 Xml::Element & o_out,
80 const char * i_sText );
81 ~SelfItem();
82 private:
83 virtual void do_ProduceItem() const;
85 // DATA
86 String sText;
89 class NoneItem : public HF_MainItem
91 public:
92 NoneItem(
93 Xml::Element & o_out,
94 const char * i_sText );
95 ~NoneItem();
96 private:
97 virtual void do_ProduceItem() const;
99 // DATA
100 String sText;
103 } // anonymous namespace
107 //******************** HF_NaviMainRow ***************//
111 HF_NaviMainRow::HF_NaviMainRow( Xml::Element & o_out )
112 : HtmlMaker(o_out),
113 aItems(),
114 pRow(0)
116 aItems.reserve(5);
118 pRow =
119 &( CurOut()
120 >> *new Html::Table
121 << new Html::ClassAttr("navimain")
122 << new Xml::AnAttribute( "border", "0" )
123 << new Xml::AnAttribute( "cellpadding", "3" )
124 >> *new Html::TableRow
128 HF_NaviMainRow::~HF_NaviMainRow()
130 csv::erase_container_of_heap_ptrs(aItems);
133 void
134 HF_NaviMainRow::Add_StdItem( const char * i_sText,
135 const char * i_sLink )
137 aItems.push_back(new StdItem( *pRow,i_sText,i_sLink ));
140 void
141 HF_NaviMainRow::Add_SelfItem( const char * i_sText )
143 aItems.push_back(new SelfItem( *pRow,i_sText ));
146 void
147 HF_NaviMainRow::Add_NoneItem( const char * i_sText )
149 aItems.push_back(new NoneItem( *pRow,i_sText ));
152 void
153 HF_NaviMainRow::Produce_Row()
155 ItemList::iterator itEnd = aItems.end();
156 for ( ItemList::iterator iter = aItems.begin();
157 iter != itEnd;
158 ++iter )
160 (*iter)->Produce_Item();
167 //******************** MainItem and derived ones ***************//
169 namespace
172 StdItem::StdItem( Xml::Element & o_out,
173 const char * i_sText,
174 const char * i_sLink )
175 : HF_MainItem(o_out),
176 sText(i_sText),
177 sLink(i_sLink)
181 StdItem::~StdItem()
185 void
186 StdItem::do_ProduceItem() const
188 Xml::Element &
189 rCell = CurOut() >>* new Html::TableCell;
190 rCell
191 << new Html::ClassAttr( "navimain" )
192 >> *new Html::Link(sLink.c_str())
193 << new Html::ClassAttr( "navimain" )
194 << sText.c_str();
197 SelfItem::SelfItem( Xml::Element & o_out,
198 const char * i_sText )
199 : HF_MainItem(o_out),
200 sText(i_sText)
204 SelfItem::~SelfItem()
208 void
209 SelfItem::do_ProduceItem() const
211 Xml::Element &
212 rCell = CurOut() >>* new Html::TableCell;
213 rCell
214 << new Html::ClassAttr( "navimainself" )
215 << sText.c_str();
218 NoneItem::NoneItem( Xml::Element & o_out,
219 const char * i_sText )
220 : HF_MainItem(o_out),
221 sText(i_sText)
225 NoneItem::~NoneItem()
229 void
230 NoneItem::do_ProduceItem() const
232 Xml::Element &
233 rCell = CurOut() >>* new Html::TableCell;
234 rCell
235 << new Html::ClassAttr( "navimainnone" )
236 << sText.c_str();
239 } // anonymous namespace