1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #include <precomp.h> 29*cdf0e10cSrcweir #include <toolkit/hf_navi_main.hxx> 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES 33*cdf0e10cSrcweir #include <cosv/tpl/tpltools.hxx> 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir //******************** MainItem and derived ones ***************// 38*cdf0e10cSrcweir class HF_MainItem : public HtmlMaker 39*cdf0e10cSrcweir { 40*cdf0e10cSrcweir public: 41*cdf0e10cSrcweir virtual ~HF_MainItem() {} 42*cdf0e10cSrcweir void Produce_Item() const { do_ProduceItem(); } 43*cdf0e10cSrcweir protected: 44*cdf0e10cSrcweir HF_MainItem( 45*cdf0e10cSrcweir Xml::Element & o_out ) 46*cdf0e10cSrcweir : HtmlMaker(o_out) {} 47*cdf0e10cSrcweir private: 48*cdf0e10cSrcweir virtual void do_ProduceItem() const = 0; 49*cdf0e10cSrcweir }; 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir namespace 53*cdf0e10cSrcweir { 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir class StdItem : public HF_MainItem 56*cdf0e10cSrcweir { 57*cdf0e10cSrcweir public: 58*cdf0e10cSrcweir StdItem( 59*cdf0e10cSrcweir Xml::Element & o_out, 60*cdf0e10cSrcweir const char * i_sText, 61*cdf0e10cSrcweir const char * i_sLink ); 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir ~StdItem(); 64*cdf0e10cSrcweir private: 65*cdf0e10cSrcweir virtual void do_ProduceItem() const; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir // DATA 68*cdf0e10cSrcweir String sText; 69*cdf0e10cSrcweir String sLink; 70*cdf0e10cSrcweir }; 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir class SelfItem : public HF_MainItem 73*cdf0e10cSrcweir { 74*cdf0e10cSrcweir public: 75*cdf0e10cSrcweir SelfItem( 76*cdf0e10cSrcweir Xml::Element & o_out, 77*cdf0e10cSrcweir const char * i_sText ); 78*cdf0e10cSrcweir ~SelfItem(); 79*cdf0e10cSrcweir private: 80*cdf0e10cSrcweir virtual void do_ProduceItem() const; 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir // DATA 83*cdf0e10cSrcweir String sText; 84*cdf0e10cSrcweir }; 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir class NoneItem : public HF_MainItem 87*cdf0e10cSrcweir { 88*cdf0e10cSrcweir public: 89*cdf0e10cSrcweir NoneItem( 90*cdf0e10cSrcweir Xml::Element & o_out, 91*cdf0e10cSrcweir const char * i_sText ); 92*cdf0e10cSrcweir ~NoneItem(); 93*cdf0e10cSrcweir private: 94*cdf0e10cSrcweir virtual void do_ProduceItem() const; 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir // DATA 97*cdf0e10cSrcweir String sText; 98*cdf0e10cSrcweir }; 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir } // anonymous namespace 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir //******************** HF_NaviMainRow ***************// 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir HF_NaviMainRow::HF_NaviMainRow( Xml::Element & o_out ) 109*cdf0e10cSrcweir : HtmlMaker(o_out), 110*cdf0e10cSrcweir aItems(), 111*cdf0e10cSrcweir pRow(0) 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir aItems.reserve(5); 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir pRow = 116*cdf0e10cSrcweir &( CurOut() 117*cdf0e10cSrcweir >> *new Html::Table 118*cdf0e10cSrcweir << new Html::ClassAttr("navimain") 119*cdf0e10cSrcweir << new Xml::AnAttribute( "border", "0" ) 120*cdf0e10cSrcweir << new Xml::AnAttribute( "cellpadding", "3" ) 121*cdf0e10cSrcweir >> *new Html::TableRow 122*cdf0e10cSrcweir ); 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir HF_NaviMainRow::~HF_NaviMainRow() 126*cdf0e10cSrcweir { 127*cdf0e10cSrcweir csv::erase_container_of_heap_ptrs(aItems); 128*cdf0e10cSrcweir } 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir void 131*cdf0e10cSrcweir HF_NaviMainRow::Add_StdItem( const char * i_sText, 132*cdf0e10cSrcweir const char * i_sLink ) 133*cdf0e10cSrcweir { 134*cdf0e10cSrcweir aItems.push_back(new StdItem( *pRow,i_sText,i_sLink )); 135*cdf0e10cSrcweir } 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir void 138*cdf0e10cSrcweir HF_NaviMainRow::Add_SelfItem( const char * i_sText ) 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir aItems.push_back(new SelfItem( *pRow,i_sText )); 141*cdf0e10cSrcweir } 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir void 144*cdf0e10cSrcweir HF_NaviMainRow::Add_NoneItem( const char * i_sText ) 145*cdf0e10cSrcweir { 146*cdf0e10cSrcweir aItems.push_back(new NoneItem( *pRow,i_sText )); 147*cdf0e10cSrcweir } 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir void 150*cdf0e10cSrcweir HF_NaviMainRow::Produce_Row() 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir ItemList::iterator itEnd = aItems.end(); 153*cdf0e10cSrcweir for ( ItemList::iterator iter = aItems.begin(); 154*cdf0e10cSrcweir iter != itEnd; 155*cdf0e10cSrcweir ++iter ) 156*cdf0e10cSrcweir { 157*cdf0e10cSrcweir (*iter)->Produce_Item(); 158*cdf0e10cSrcweir } 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir //******************** MainItem and derived ones ***************// 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir namespace 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir StdItem::StdItem( Xml::Element & o_out, 170*cdf0e10cSrcweir const char * i_sText, 171*cdf0e10cSrcweir const char * i_sLink ) 172*cdf0e10cSrcweir : HF_MainItem(o_out), 173*cdf0e10cSrcweir sText(i_sText), 174*cdf0e10cSrcweir sLink(i_sLink) 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir StdItem::~StdItem() 179*cdf0e10cSrcweir { 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir void 183*cdf0e10cSrcweir StdItem::do_ProduceItem() const 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir Xml::Element & 186*cdf0e10cSrcweir rCell = CurOut() >>* new Html::TableCell; 187*cdf0e10cSrcweir rCell 188*cdf0e10cSrcweir << new Html::ClassAttr( "navimain" ) 189*cdf0e10cSrcweir >> *new Html::Link(sLink.c_str()) 190*cdf0e10cSrcweir << new Html::ClassAttr( "navimain" ) 191*cdf0e10cSrcweir << sText.c_str(); 192*cdf0e10cSrcweir } 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir SelfItem::SelfItem( Xml::Element & o_out, 195*cdf0e10cSrcweir const char * i_sText ) 196*cdf0e10cSrcweir : HF_MainItem(o_out), 197*cdf0e10cSrcweir sText(i_sText) 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir } 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir SelfItem::~SelfItem() 202*cdf0e10cSrcweir { 203*cdf0e10cSrcweir } 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir void 206*cdf0e10cSrcweir SelfItem::do_ProduceItem() const 207*cdf0e10cSrcweir { 208*cdf0e10cSrcweir Xml::Element & 209*cdf0e10cSrcweir rCell = CurOut() >>* new Html::TableCell; 210*cdf0e10cSrcweir rCell 211*cdf0e10cSrcweir << new Html::ClassAttr( "navimainself" ) 212*cdf0e10cSrcweir << sText.c_str(); 213*cdf0e10cSrcweir } 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir NoneItem::NoneItem( Xml::Element & o_out, 216*cdf0e10cSrcweir const char * i_sText ) 217*cdf0e10cSrcweir : HF_MainItem(o_out), 218*cdf0e10cSrcweir sText(i_sText) 219*cdf0e10cSrcweir { 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir NoneItem::~NoneItem() 223*cdf0e10cSrcweir { 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir void 227*cdf0e10cSrcweir NoneItem::do_ProduceItem() const 228*cdf0e10cSrcweir { 229*cdf0e10cSrcweir Xml::Element & 230*cdf0e10cSrcweir rCell = CurOut() >>* new Html::TableCell; 231*cdf0e10cSrcweir rCell 232*cdf0e10cSrcweir << new Html::ClassAttr( "navimainnone" ) 233*cdf0e10cSrcweir << sText.c_str(); 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir } // anonymous namespace 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir 239