1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #include <precomp.h> 29 #include "hfi_navibar.hxx" 30 31 32 // NOT FULLY DEFINED SERVICES 33 #include <ary/idl/i_ce.hxx> 34 #include <toolkit/hf_navi_main.hxx> 35 #include <toolkit/hf_navi_sub.hxx> 36 #include "hfi_interface.hxx" 37 #include "hfi_module.hxx" 38 #include "hfi_service.hxx" 39 #include "hi_linkhelper.hxx" 40 41 42 extern const String 43 C_sLocalManualLinks("#devmanual"); 44 45 46 const String C_sTop = "Overview"; 47 const String C_sModule = "Module"; 48 const String C_sUse = "Use"; 49 const String C_sManual = "Devguide"; 50 const String C_sIndex = "Index"; 51 52 53 54 55 HF_IdlNavigationBar::HF_IdlNavigationBar( Environment & io_rEnv, 56 Xml::Element & o_rOut ) 57 : HtmlFactory_Idl(io_rEnv, &o_rOut) 58 { 59 } 60 61 HF_IdlNavigationBar::~HF_IdlNavigationBar() 62 { 63 } 64 65 void 66 HF_IdlNavigationBar::Produce_CeMainRow( const client & i_ce, 67 bool i_bNoUsePage ) 68 { 69 HF_NaviMainRow 70 aNaviMain( CurOut() ); 71 72 StreamLock aLink(500); 73 StreamStr & rLink = aLink(); 74 75 Env().Get_LinkTo( rLink.reset(), 76 Env().OutputTree().Overview() ); 77 aNaviMain.Add_StdItem( C_sTop, rLink.c_str() ); 78 79 Env().Get_LinkTo( rLink.reset(), 80 Env().Linker().PositionOf_CurModule() ); 81 aNaviMain.Add_StdItem( C_sModule, rLink.c_str() ); 82 83 if (i_bNoUsePage) 84 { 85 aNaviMain.Add_NoneItem( C_sUse ); 86 } 87 else 88 { 89 Env().Get_LinkTo( rLink.reset(), 90 Env().Linker().PositionOf_CurXRefs(i_ce.LocalName()) ); 91 aNaviMain.Add_StdItem( C_sUse, rLink.c_str() ); 92 } 93 94 const StringVector & 95 rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual(); 96 if (rManualDescrs.size() == 2) 97 { 98 aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() )); 99 } 100 else if (rManualDescrs.size() > 2) 101 { 102 aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks); 103 } 104 else 105 { 106 aNaviMain.Add_NoneItem( C_sManual ); 107 } 108 109 Env().Get_LinkTo( rLink.reset(), 110 Env().Linker().PositionOf_Index() ); 111 aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() ); 112 113 aNaviMain.Produce_Row(); 114 } 115 116 void 117 HF_IdlNavigationBar::Produce_CeXrefsMainRow( const client & i_ce ) 118 { 119 HF_NaviMainRow 120 aNaviMain( CurOut() ); 121 122 StreamLock aLink(500); 123 StreamStr & rLink = aLink(); 124 125 Env().Get_LinkTo( rLink.reset(), 126 Env().OutputTree().Overview() ); 127 aNaviMain.Add_StdItem( C_sTop, rLink.c_str() ); 128 129 Env().Get_LinkTo( rLink.reset(), 130 Env().Linker().PositionOf_CurModule() ); 131 aNaviMain.Add_StdItem( C_sModule, rLink.c_str() ); 132 133 aNaviMain.Add_SelfItem( C_sUse ); 134 135 const StringVector & 136 rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual(); 137 if (rManualDescrs.size() == 2) 138 { 139 aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() )); 140 } 141 else if (rManualDescrs.size() > 2) 142 { 143 aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks); 144 } 145 else 146 { 147 aNaviMain.Add_NoneItem( C_sManual ); 148 } 149 150 Env().Get_LinkTo( rLink.reset(), 151 Env().Linker().PositionOf_Index() ); 152 aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() ); 153 154 aNaviMain.Produce_Row(); 155 } 156 157 void 158 HF_IdlNavigationBar::Produce_ModuleMainRow( const client & i_ce ) 159 { 160 HF_NaviMainRow 161 aNaviMain( CurOut() ); 162 163 StreamLock aLink(500); 164 StreamStr & rLink = aLink(); 165 166 Env().Get_LinkTo( rLink.reset(), 167 Env().OutputTree().Overview() ); 168 aNaviMain.Add_StdItem( C_sTop, rLink.c_str() ); 169 170 aNaviMain.Add_SelfItem( C_sModule ); 171 172 aNaviMain.Add_NoneItem( C_sUse ); 173 174 const StringVector & 175 rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual(); 176 if (rManualDescrs.size() == 1) 177 { 178 aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() )); 179 } 180 else if (rManualDescrs.size() > 1) 181 { 182 aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks); 183 } 184 else 185 { 186 aNaviMain.Add_NoneItem( C_sManual ); 187 } 188 189 Env().Get_LinkTo( rLink.reset(), 190 Env().Linker().PositionOf_Index() ); 191 aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() ); 192 193 aNaviMain.Produce_Row(); 194 } 195 196 void 197 HF_IdlNavigationBar::Produce_IndexMainRow() 198 { 199 HF_NaviMainRow 200 aNaviMain( CurOut() ); 201 202 StreamLock aLink(500); 203 StreamStr & rLink = aLink(); 204 205 Env().Get_LinkTo( rLink.reset(), 206 Env().OutputTree().Overview() ); 207 aNaviMain.Add_StdItem( C_sTop, rLink.c_str() ); 208 209 aNaviMain.Add_NoneItem( C_sModule ); 210 aNaviMain.Add_NoneItem( C_sUse ); 211 aNaviMain.Add_NoneItem( C_sManual ); 212 213 aNaviMain.Add_SelfItem( C_sIndex ); 214 215 aNaviMain.Produce_Row(); 216 217 CurOut() << new Html::HorizontalLine(); 218 } 219 220 DYN HF_NaviSubRow & 221 HF_IdlNavigationBar::Add_SubRow() 222 { 223 return *new HF_NaviSubRow( CurOut() ); 224 } 225 226