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_linklist.hxx" 30 31 32 // NOT FULLY DEFINED SERVICES 33 #include <ary/idl/i_ce.hxx> 34 #include <ary/idl/i_gate.hxx> 35 #include <ary/idl/ip_ce.hxx> 36 #include <ary/idl/ip_type.hxx> 37 #include <toolkit/hf_docentry.hxx> 38 #include <toolkit/hf_title.hxx> 39 #include "hfi_doc.hxx" 40 #include "hfi_tag.hxx" 41 #include "hfi_typetext.hxx" 42 #include "hi_ary.hxx" 43 #include "hi_env.hxx" 44 45 46 47 48 //******************* HF_CommentedLink_Table **********************************// 49 50 HF_CommentedLink_Table::HF_CommentedLink_Table( Environment & io_rEnv, 51 Xml::Element & o_rOut, 52 const String & i_sTitle, 53 const String & i_sLabel, 54 bool i_bBorder ) 55 : HtmlFactory_Idl(io_rEnv,&o_rOut), 56 pTable( new Html::Table( (i_bBorder ? "1" : "0"), "100%", "5", "0") ), 57 pCurLinkColumn(0), 58 pCurCommentColumn(0) 59 { 60 *pTable 61 << new Html::ClassAttr("commentedlinks"); 62 63 CurOut() 64 >> *new Html::Label(i_sLabel) 65 << new Html::LineBreak; 66 CurOut() 67 << pTable; 68 // HF_SubTitle aTitle(*pTable); 69 // aTitle.Produce_it(i_sTitle); 70 } 71 72 HF_CommentedLink_Table::~HF_CommentedLink_Table() 73 { 74 } 75 76 void 77 HF_CommentedLink_Table::Add_Line() 78 { 79 Html::TableRow & 80 rRow = pTable->AddRow(); 81 82 pCurLinkColumn = & (rRow.AddCell() 83 << new Html::WidthAttr("30%") 84 << new Xml::AnAttribute("valign","top") ); 85 pCurCommentColumn = & rRow.AddCell(); 86 } 87 88 Xml::Element & 89 HF_CommentedLink_Table::Cur_LinkColumn() 90 { 91 csv_assert(pCurLinkColumn != 0); 92 return *pCurLinkColumn; 93 } 94 95 Xml::Element & 96 HF_CommentedLink_Table::Cur_CommentColumn() 97 { 98 csv_assert(pCurCommentColumn != 0); 99 return *pCurCommentColumn; 100 } 101 102 103 //******************* HF_MemberTable **********************************// 104 105 HF_MemberTable::HF_MemberTable( Environment & io_rEnv, 106 Xml::Element & o_rOut, 107 const String & i_sTitle, 108 const String & i_sLabel, 109 bool i_bInline ) 110 : HtmlFactory_Idl(io_rEnv,&o_rOut), 111 pTable( new Html::Table("1", "100%", "5", "0") ), 112 pCurDeclaration(0), 113 pCurDescription(0), 114 bInline(i_bInline) 115 { 116 *pTable 117 << new Html::ClassAttr("memberlist"); 118 119 CurOut() 120 >> *new Html::Label(i_sLabel) 121 << new Html::LineBreak; 122 CurOut() 123 << pTable; 124 // HF_SubTitle aTitle(*pTable); 125 // aTitle.Produce_it(i_sTitle); 126 } 127 128 HF_MemberTable::~HF_MemberTable() 129 { 130 } 131 132 void 133 HF_MemberTable::Add_Line() 134 { 135 if (bInline) 136 { 137 Html::TableRow & rRow = pTable->AddRow(); 138 139 pCurDeclaration = &( rRow.AddCell() 140 << new Xml::AnAttribute("valign","top") 141 << new Html::WidthAttr("30%") ); 142 pCurDescription = & rRow.AddCell(); 143 } 144 else 145 { 146 Html::DefList * 147 pMemberSpace = new Html::DefList; 148 *pMemberSpace 149 << new Html::ClassAttr("member"); 150 151 pTable->AddRow().AddCell() << pMemberSpace; 152 153 pCurDeclaration = 154 & ( *pMemberSpace 155 >> *new Html::DefListTerm 156 << new Html::ClassAttr("member") ); 157 pCurDescription = 158 & ( *pMemberSpace 159 >> *new Html::DefListDefinition() 160 << new Html::ClassAttr("member") ); 161 } 162 } 163 164 Xml::Element & 165 HF_MemberTable::Cur_Declaration() 166 { 167 csv_assert(pCurDeclaration != 0); 168 return *pCurDeclaration; 169 } 170 171 Xml::Element & 172 HF_MemberTable::Cur_Description() 173 { 174 csv_assert(pCurDescription != 0); 175 return *pCurDescription; 176 } 177 178 179 180 //******************* HF_IdlLinkList **********************************// 181 182 HF_IdlLinkList::HF_IdlLinkList( Environment & io_rEnv, 183 Xml::Element * o_pOut ) 184 : HtmlFactory_Idl(io_rEnv,o_pOut) 185 { 186 } 187 188 HF_IdlLinkList::~HF_IdlLinkList() 189 { 190 } 191 192 void 193 HF_IdlLinkList::Produce_NamespaceMembers( const String & i_sTitle, 194 const String & i_sLabel, 195 const std::vector<ary::idl::Ce_id> & i_rList, 196 bool i_bNestedNamespaces ) const 197 { 198 HF_CommentedLink_Table 199 aTableMaker( Env(), CurOut(), 200 i_sTitle, i_sLabel, 201 true ); 202 203 std::vector<ary::idl::Ce_id>::const_iterator itEnd = i_rList.end(); 204 for ( std::vector<ary::idl::Ce_id>::const_iterator it = i_rList.begin(); 205 it != itEnd; 206 ++it ) 207 { 208 static String sEntryName; 209 static String sEntryLink; 210 const ce_info * 211 pDocu = 0; 212 Get_EntryData_NamespaceMembers( sEntryName, sEntryLink, pDocu, *it, i_bNestedNamespaces ); 213 aTableMaker.Add_Line(); 214 215 aTableMaker.Cur_LinkColumn() 216 >> *new Html::Link(sEntryLink) 217 << sEntryName; 218 219 if ( pDocu != 0 ) 220 { 221 HF_IdlShortDocu 222 aTextDisplay(Env(), aTableMaker.Cur_CommentColumn() ); 223 aTextDisplay.Produce_byData( pDocu ); 224 } 225 } // end for 226 } 227 228 void 229 HF_IdlLinkList::Produce_GlobalLinks( const String & i_sTitle, 230 const String & i_sLabel, 231 ce_list & i_rList ) const 232 { 233 HF_CommentedLink_Table 234 aTableMaker( Env(), CurOut(), 235 i_sTitle, i_sLabel, 236 true ); 237 238 for ( ; i_rList; ++i_rList ) 239 { 240 aTableMaker.Add_Line(); 241 HF_IdlTypeText 242 aLinkText( Env(), aTableMaker.Cur_LinkColumn(), true ); 243 aLinkText.Produce_byData(*i_rList); 244 245 const ce_info * 246 pDocu = Get_EntryDocu(*i_rList); 247 if ( pDocu != 0 ) 248 { 249 HF_IdlShortDocu 250 aTextDisplay(Env(), aTableMaker.Cur_CommentColumn() ); 251 aTextDisplay.Produce_byData( pDocu, *i_rList ); 252 } 253 } 254 } 255 256 void 257 HF_IdlLinkList::Produce_GlobalCommentedLinks( const String & i_sTitle, 258 const String & i_sLabel, 259 comref_list & i_rList ) const 260 { 261 HF_CommentedLink_Table 262 aTableMaker( Env(), CurOut(), 263 i_sTitle, i_sLabel, 264 true ); 265 /* 266 for ( ; i_rList; ++i_rList ) 267 { 268 aTableMaker.Add_Line(); 269 HF_IdlTypeText 270 aLinkText( Env(), aTableMaker.Cur_LinkColumn(), true ); 271 aLinkText.Produce_byData( (*i_rList).first ); 272 273 HF_DocEntryList 274 aDocList( aTableMaker.Cur_CommentColumn() ); 275 if ( (*i_rList).second != 0 ) 276 { 277 HF_IdlDocu 278 aDocuDisplay( Env(), aDocList ); 279 aDocuDisplay.Produce_byData( (*i_rList).second ); 280 } 281 else 282 { 283 const ce_info * 284 pShort = Get_EntryDocu( 285 Env().Gate().Types().Search_CeRelatedTo( 286 (*i_rList).first) ); 287 if ( pShort != 0 ) 288 { 289 if (pShort->IsDeprecated()) 290 { 291 aDocList.Produce_Term() 292 << "[ DEPRECATED ]"; 293 } 294 if (pShort->IsOptional()) 295 { 296 aDocList.Produce_Term() 297 << "[ OPTIONAL ]"; 298 } 299 300 aDocList.Produce_Term() 301 << "Description"; 302 303 HF_IdlDocuTextDisplay 304 aShortDisplay( Env(), &aDocList.Produce_Definition() ); 305 aShortDisplay.Set_CurScopeTo( 306 Env().Gate().Types().Search_CeRelatedTo((*i_rList).first) ); 307 pShort->Short().DisplayAt(aShortDisplay); 308 } 309 } 310 } 311 */ 312 } 313 314 void 315 HF_IdlLinkList::Produce_MemberLinks( const String & i_sTitle, 316 const String & i_sLabel, 317 ce_list & i_rList ) const 318 { 319 HF_CommentedLink_Table 320 aTableMaker( Env(), CurOut(), 321 i_sTitle, i_sLabel, 322 true ); 323 324 /* 325 for ( ; i_rList; ++i_rList ) 326 { 327 const ary::idl::CodeEntity & 328 rCe = Env().Gate().Ces().Find_Ce(*i_rList); 329 330 aTableMaker.Add_Line(); 331 aTableMaker.Cur_LinkColumn() 332 >> *new Html::Link( 333 StreamLock(200)() << "#" << rCe.LocalName() << c_str) 334 << rCe.LocalName(); 335 336 const ce_info * 337 pDocu = rCe.Docu(); 338 if ( pDocu != 0 ) 339 { 340 HF_IdlShortDocu 341 aTextDisplay(Env(), aTableMaker.Cur_CommentColumn() ); 342 aTextDisplay.Produce_byData( *pDocu ); 343 } 344 } // end for 345 */ 346 } 347 348 void 349 HF_IdlLinkList::Get_EntryData_NamespaceMembers( 350 String & o_sEntryName, 351 String & o_sEntryLink, 352 const ce_info * & o_pDocu, 353 ce_id i_nMemberId, 354 bool i_bIsNestedNamespace ) const 355 { 356 const ary::idl::CodeEntity & 357 rCe = Env().Data().Find_Ce(i_nMemberId); 358 359 o_sEntryName = rCe.LocalName(); 360 o_sEntryLink = StreamLock(200)() << rCe.LocalName() 361 << ( i_bIsNestedNamespace 362 ? "/module-ix" 363 : "" ) 364 << ".html" 365 << c_str; 366 o_pDocu = rCe.Docu(); 367 } 368 369 const ary::doc::OldIdlDocu * 370 HF_IdlLinkList::Get_EntryDocu(ce_id i_nMemberId) const 371 { 372 if (i_nMemberId.IsValid()) 373 return Env().Data().Find_Ce(i_nMemberId).Docu(); 374 else 375 return 0; 376 } 377 378 379