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 "hfi_navibar.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES 33*cdf0e10cSrcweir #include <ary/idl/i_ce.hxx> 34*cdf0e10cSrcweir #include <toolkit/hf_navi_main.hxx> 35*cdf0e10cSrcweir #include <toolkit/hf_navi_sub.hxx> 36*cdf0e10cSrcweir #include "hfi_interface.hxx" 37*cdf0e10cSrcweir #include "hfi_module.hxx" 38*cdf0e10cSrcweir #include "hfi_service.hxx" 39*cdf0e10cSrcweir #include "hi_linkhelper.hxx" 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir extern const String 43*cdf0e10cSrcweir C_sLocalManualLinks("#devmanual"); 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir const String C_sTop = "Overview"; 47*cdf0e10cSrcweir const String C_sModule = "Module"; 48*cdf0e10cSrcweir const String C_sUse = "Use"; 49*cdf0e10cSrcweir const String C_sManual = "Devguide"; 50*cdf0e10cSrcweir const String C_sIndex = "Index"; 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir HF_IdlNavigationBar::HF_IdlNavigationBar( Environment & io_rEnv, 56*cdf0e10cSrcweir Xml::Element & o_rOut ) 57*cdf0e10cSrcweir : HtmlFactory_Idl(io_rEnv, &o_rOut) 58*cdf0e10cSrcweir { 59*cdf0e10cSrcweir } 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir HF_IdlNavigationBar::~HF_IdlNavigationBar() 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir } 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir void 66*cdf0e10cSrcweir HF_IdlNavigationBar::Produce_CeMainRow( const client & i_ce, 67*cdf0e10cSrcweir bool i_bNoUsePage ) 68*cdf0e10cSrcweir { 69*cdf0e10cSrcweir HF_NaviMainRow 70*cdf0e10cSrcweir aNaviMain( CurOut() ); 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir StreamLock aLink(500); 73*cdf0e10cSrcweir StreamStr & rLink = aLink(); 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir Env().Get_LinkTo( rLink.reset(), 76*cdf0e10cSrcweir Env().OutputTree().Overview() ); 77*cdf0e10cSrcweir aNaviMain.Add_StdItem( C_sTop, rLink.c_str() ); 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir Env().Get_LinkTo( rLink.reset(), 80*cdf0e10cSrcweir Env().Linker().PositionOf_CurModule() ); 81*cdf0e10cSrcweir aNaviMain.Add_StdItem( C_sModule, rLink.c_str() ); 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir if (i_bNoUsePage) 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir aNaviMain.Add_NoneItem( C_sUse ); 86*cdf0e10cSrcweir } 87*cdf0e10cSrcweir else 88*cdf0e10cSrcweir { 89*cdf0e10cSrcweir Env().Get_LinkTo( rLink.reset(), 90*cdf0e10cSrcweir Env().Linker().PositionOf_CurXRefs(i_ce.LocalName()) ); 91*cdf0e10cSrcweir aNaviMain.Add_StdItem( C_sUse, rLink.c_str() ); 92*cdf0e10cSrcweir } 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir const StringVector & 95*cdf0e10cSrcweir rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual(); 96*cdf0e10cSrcweir if (rManualDescrs.size() == 2) 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() )); 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir else if (rManualDescrs.size() > 2) 101*cdf0e10cSrcweir { 102*cdf0e10cSrcweir aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks); 103*cdf0e10cSrcweir } 104*cdf0e10cSrcweir else 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir aNaviMain.Add_NoneItem( C_sManual ); 107*cdf0e10cSrcweir } 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir Env().Get_LinkTo( rLink.reset(), 110*cdf0e10cSrcweir Env().Linker().PositionOf_Index() ); 111*cdf0e10cSrcweir aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() ); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir aNaviMain.Produce_Row(); 114*cdf0e10cSrcweir } 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir void 117*cdf0e10cSrcweir HF_IdlNavigationBar::Produce_CeXrefsMainRow( const client & i_ce ) 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir HF_NaviMainRow 120*cdf0e10cSrcweir aNaviMain( CurOut() ); 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir StreamLock aLink(500); 123*cdf0e10cSrcweir StreamStr & rLink = aLink(); 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir Env().Get_LinkTo( rLink.reset(), 126*cdf0e10cSrcweir Env().OutputTree().Overview() ); 127*cdf0e10cSrcweir aNaviMain.Add_StdItem( C_sTop, rLink.c_str() ); 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir Env().Get_LinkTo( rLink.reset(), 130*cdf0e10cSrcweir Env().Linker().PositionOf_CurModule() ); 131*cdf0e10cSrcweir aNaviMain.Add_StdItem( C_sModule, rLink.c_str() ); 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir aNaviMain.Add_SelfItem( C_sUse ); 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir const StringVector & 136*cdf0e10cSrcweir rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual(); 137*cdf0e10cSrcweir if (rManualDescrs.size() == 2) 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() )); 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir else if (rManualDescrs.size() > 2) 142*cdf0e10cSrcweir { 143*cdf0e10cSrcweir aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks); 144*cdf0e10cSrcweir } 145*cdf0e10cSrcweir else 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir aNaviMain.Add_NoneItem( C_sManual ); 148*cdf0e10cSrcweir } 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir Env().Get_LinkTo( rLink.reset(), 151*cdf0e10cSrcweir Env().Linker().PositionOf_Index() ); 152*cdf0e10cSrcweir aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() ); 153*cdf0e10cSrcweir 154*cdf0e10cSrcweir aNaviMain.Produce_Row(); 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir void 158*cdf0e10cSrcweir HF_IdlNavigationBar::Produce_ModuleMainRow( const client & i_ce ) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir HF_NaviMainRow 161*cdf0e10cSrcweir aNaviMain( CurOut() ); 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir StreamLock aLink(500); 164*cdf0e10cSrcweir StreamStr & rLink = aLink(); 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir Env().Get_LinkTo( rLink.reset(), 167*cdf0e10cSrcweir Env().OutputTree().Overview() ); 168*cdf0e10cSrcweir aNaviMain.Add_StdItem( C_sTop, rLink.c_str() ); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir aNaviMain.Add_SelfItem( C_sModule ); 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir aNaviMain.Add_NoneItem( C_sUse ); 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir const StringVector & 175*cdf0e10cSrcweir rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual(); 176*cdf0e10cSrcweir if (rManualDescrs.size() == 1) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() )); 179*cdf0e10cSrcweir } 180*cdf0e10cSrcweir else if (rManualDescrs.size() > 1) 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks); 183*cdf0e10cSrcweir } 184*cdf0e10cSrcweir else 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir aNaviMain.Add_NoneItem( C_sManual ); 187*cdf0e10cSrcweir } 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir Env().Get_LinkTo( rLink.reset(), 190*cdf0e10cSrcweir Env().Linker().PositionOf_Index() ); 191*cdf0e10cSrcweir aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() ); 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir aNaviMain.Produce_Row(); 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir void 197*cdf0e10cSrcweir HF_IdlNavigationBar::Produce_IndexMainRow() 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir HF_NaviMainRow 200*cdf0e10cSrcweir aNaviMain( CurOut() ); 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir StreamLock aLink(500); 203*cdf0e10cSrcweir StreamStr & rLink = aLink(); 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir Env().Get_LinkTo( rLink.reset(), 206*cdf0e10cSrcweir Env().OutputTree().Overview() ); 207*cdf0e10cSrcweir aNaviMain.Add_StdItem( C_sTop, rLink.c_str() ); 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir aNaviMain.Add_NoneItem( C_sModule ); 210*cdf0e10cSrcweir aNaviMain.Add_NoneItem( C_sUse ); 211*cdf0e10cSrcweir aNaviMain.Add_NoneItem( C_sManual ); 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir aNaviMain.Add_SelfItem( C_sIndex ); 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir aNaviMain.Produce_Row(); 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir CurOut() << new Html::HorizontalLine(); 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir DYN HF_NaviSubRow & 221*cdf0e10cSrcweir HF_IdlNavigationBar::Add_SubRow() 222*cdf0e10cSrcweir { 223*cdf0e10cSrcweir return *new HF_NaviSubRow( CurOut() ); 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir 226