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_module.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES 33*cdf0e10cSrcweir #include <ary/idl/i_ce.hxx> 34*cdf0e10cSrcweir #include <ary/idl/i_module.hxx> 35*cdf0e10cSrcweir #include <ary/idl/ik_module.hxx> 36*cdf0e10cSrcweir #include <ary/doc/d_oldidldocu.hxx> 37*cdf0e10cSrcweir #include <ary/getncast.hxx> 38*cdf0e10cSrcweir #include <toolkit/hf_docentry.hxx> 39*cdf0e10cSrcweir #include <toolkit/hf_linachain.hxx> 40*cdf0e10cSrcweir #include <toolkit/hf_navi_sub.hxx> 41*cdf0e10cSrcweir #include <toolkit/hf_title.hxx> 42*cdf0e10cSrcweir #include "hfi_doc.hxx" 43*cdf0e10cSrcweir #include "hfi_navibar.hxx" 44*cdf0e10cSrcweir #include "hfi_tag.hxx" 45*cdf0e10cSrcweir #include "hfi_typetext.hxx" 46*cdf0e10cSrcweir #include "hi_linkhelper.hxx" 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir extern const String 50*cdf0e10cSrcweir C_sCePrefix_Module("module"); 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir namespace 53*cdf0e10cSrcweir { 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir const String 56*cdf0e10cSrcweir C_sList_NestedModules("Nested Modules"); 57*cdf0e10cSrcweir const String 58*cdf0e10cSrcweir C_sList_NestedModules_Label("NestedModules"); 59*cdf0e10cSrcweir const String 60*cdf0e10cSrcweir C_sList_Services("Services"); 61*cdf0e10cSrcweir const String 62*cdf0e10cSrcweir C_sList_Singletons("Singletons"); 63*cdf0e10cSrcweir const String 64*cdf0e10cSrcweir C_sList_Interfaces("Interfaces"); 65*cdf0e10cSrcweir const String 66*cdf0e10cSrcweir C_sList_Structs("Structs"); 67*cdf0e10cSrcweir const String 68*cdf0e10cSrcweir C_sList_Exceptions("Exceptions"); 69*cdf0e10cSrcweir const String 70*cdf0e10cSrcweir C_sList_Enums("Enums"); 71*cdf0e10cSrcweir const String 72*cdf0e10cSrcweir C_sList_Typedefs("Typedefs"); 73*cdf0e10cSrcweir const String 74*cdf0e10cSrcweir C_sList_ConstGroups("Constant Groups"); 75*cdf0e10cSrcweir const String 76*cdf0e10cSrcweir C_sList_ConstGroups_Label("ConstantGroups"); 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir enum E_SubListIndices 80*cdf0e10cSrcweir { // In case of changes, also adapt make_Navibar() !! 81*cdf0e10cSrcweir sli_NestedModules = 0, 82*cdf0e10cSrcweir sli_Services = 1, 83*cdf0e10cSrcweir sli_Singletons = 2, 84*cdf0e10cSrcweir sli_Interfaces = 3, 85*cdf0e10cSrcweir sli_Structs = 4, 86*cdf0e10cSrcweir sli_Exceptions = 5, 87*cdf0e10cSrcweir sli_Enums = 6, 88*cdf0e10cSrcweir sli_Typedefs = 7, 89*cdf0e10cSrcweir sli_ConstGroups = 8 90*cdf0e10cSrcweir }; 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir } //anonymous namespace 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir HF_IdlModule::HF_IdlModule( Environment & io_rEnv, 96*cdf0e10cSrcweir Xml::Element & o_rOut ) 97*cdf0e10cSrcweir : HtmlFactory_Idl(io_rEnv, &o_rOut) 98*cdf0e10cSrcweir { 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir HF_IdlModule::~HF_IdlModule() 102*cdf0e10cSrcweir { 103*cdf0e10cSrcweir } 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir typedef ary::idl::ifc_module::attr ModuleAttr; 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir void 109*cdf0e10cSrcweir HF_IdlModule::Produce_byData( const client & i_ce ) const 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir Dyn<HF_NaviSubRow> 112*cdf0e10cSrcweir pNaviSubRow( &make_Navibar(i_ce) ); 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir HF_TitleTable 115*cdf0e10cSrcweir aTitle(CurOut()); 116*cdf0e10cSrcweir HF_LinkedNameChain 117*cdf0e10cSrcweir aNameChain(aTitle.Add_Row()); 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir if ( Env().CurPosition().Depth() > 0 ) 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir aNameChain.Produce_CompleteChain_forModule(Env().CurPosition(), nameChainLinker); 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir StreamLock 124*cdf0e10cSrcweir sl(200); 125*cdf0e10cSrcweir aTitle.Produce_Title( sl() 126*cdf0e10cSrcweir << C_sCePrefix_Module 127*cdf0e10cSrcweir << " " 128*cdf0e10cSrcweir << i_ce.LocalName() 129*cdf0e10cSrcweir << c_str ); 130*cdf0e10cSrcweir } 131*cdf0e10cSrcweir else 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir aTitle.Produce_Title( "Global Module" ); 134*cdf0e10cSrcweir } 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir write_Docu(aTitle.Add_Row(), i_ce); 137*cdf0e10cSrcweir CurOut() << new Html::HorizontalLine(); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir // Write children lists: 141*cdf0e10cSrcweir ce_ptr_list aNestedModules; 142*cdf0e10cSrcweir ce_ptr_list aServices; 143*cdf0e10cSrcweir ce_ptr_list aInterfaces; 144*cdf0e10cSrcweir ce_ptr_list aStructs; 145*cdf0e10cSrcweir ce_ptr_list aExceptions; 146*cdf0e10cSrcweir ce_ptr_list aEnums; 147*cdf0e10cSrcweir ce_ptr_list aTypedefs; 148*cdf0e10cSrcweir ce_ptr_list aConstantGroups; 149*cdf0e10cSrcweir ce_ptr_list aSingletons; 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir ModuleAttr::Get_AllChildrenSeparated( 152*cdf0e10cSrcweir aNestedModules, 153*cdf0e10cSrcweir aServices, 154*cdf0e10cSrcweir aInterfaces, 155*cdf0e10cSrcweir aStructs, 156*cdf0e10cSrcweir aExceptions, 157*cdf0e10cSrcweir aEnums, 158*cdf0e10cSrcweir aTypedefs, 159*cdf0e10cSrcweir aConstantGroups, 160*cdf0e10cSrcweir aSingletons, 161*cdf0e10cSrcweir Env().Data().Ces(), 162*cdf0e10cSrcweir i_ce ); 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir // Has this to be in the order of enum E_SubListIndices ??? 165*cdf0e10cSrcweir if (produce_ChildList(C_sList_NestedModules, C_sList_NestedModules_Label, aNestedModules )) 166*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_NestedModules); 167*cdf0e10cSrcweir if (produce_ChildList(C_sList_Services, C_sList_Services, aServices)) 168*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_Services); 169*cdf0e10cSrcweir if (produce_ChildList(C_sList_Singletons, C_sList_Singletons, aSingletons)) 170*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_Singletons); 171*cdf0e10cSrcweir if (produce_ChildList(C_sList_Interfaces, C_sList_Interfaces, aInterfaces)) 172*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_Interfaces); 173*cdf0e10cSrcweir if (produce_ChildList(C_sList_Structs, C_sList_Structs, aStructs)) 174*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_Structs); 175*cdf0e10cSrcweir if (produce_ChildList(C_sList_Exceptions, C_sList_Exceptions, aExceptions)) 176*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_Exceptions); 177*cdf0e10cSrcweir if (produce_ChildList(C_sList_Enums, C_sList_Enums, aEnums)) 178*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_Enums); 179*cdf0e10cSrcweir if (produce_ChildList(C_sList_Typedefs, C_sList_Typedefs, aTypedefs)) 180*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_Typedefs); 181*cdf0e10cSrcweir if (produce_ChildList(C_sList_ConstGroups, C_sList_ConstGroups_Label, aConstantGroups)) 182*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_ConstGroups); 183*cdf0e10cSrcweir pNaviSubRow->Produce_Row(); 184*cdf0e10cSrcweir } 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir DYN HF_NaviSubRow & 187*cdf0e10cSrcweir HF_IdlModule::make_Navibar( const client & i_ce ) const 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir HF_IdlNavigationBar 190*cdf0e10cSrcweir aNaviBar(Env(), CurOut()); 191*cdf0e10cSrcweir aNaviBar.Produce_ModuleMainRow(i_ce); 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir DYN HF_NaviSubRow & 194*cdf0e10cSrcweir ret = aNaviBar.Add_SubRow(); 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir // Has to be in the order of E_SubListIndices: 197*cdf0e10cSrcweir ret.AddItem(C_sList_NestedModules, C_sList_NestedModules_Label, false); 198*cdf0e10cSrcweir ret.AddItem(C_sList_Services, C_sList_Services, false); 199*cdf0e10cSrcweir ret.AddItem(C_sList_Singletons, C_sList_Singletons, false); 200*cdf0e10cSrcweir ret.AddItem(C_sList_Interfaces, C_sList_Interfaces, false); 201*cdf0e10cSrcweir ret.AddItem(C_sList_Structs, C_sList_Structs, false); 202*cdf0e10cSrcweir ret.AddItem(C_sList_Exceptions, C_sList_Exceptions, false); 203*cdf0e10cSrcweir ret.AddItem(C_sList_Enums, C_sList_Enums, false); 204*cdf0e10cSrcweir ret.AddItem(C_sList_Typedefs, C_sList_Typedefs, false); 205*cdf0e10cSrcweir ret.AddItem(C_sList_ConstGroups, C_sList_ConstGroups_Label, false); 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir CurOut() << new Html::HorizontalLine(); 208*cdf0e10cSrcweir return ret; 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir bool 212*cdf0e10cSrcweir HF_IdlModule::produce_ChildList( const String & i_sName, 213*cdf0e10cSrcweir const String & i_sLabel, 214*cdf0e10cSrcweir const ce_ptr_list & i_list ) const 215*cdf0e10cSrcweir { 216*cdf0e10cSrcweir if ( i_list.size() == 0 ) 217*cdf0e10cSrcweir return false; 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir HF_SubTitleTable 220*cdf0e10cSrcweir aTable( CurOut(), 221*cdf0e10cSrcweir i_sLabel, 222*cdf0e10cSrcweir i_sName, 223*cdf0e10cSrcweir 2 ); 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir ce_ptr_list::const_iterator 226*cdf0e10cSrcweir itEnd = i_list.end(); 227*cdf0e10cSrcweir for ( ce_ptr_list::const_iterator it = i_list.begin(); 228*cdf0e10cSrcweir it != itEnd; 229*cdf0e10cSrcweir ++it ) 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir Xml::Element & 232*cdf0e10cSrcweir rRow = aTable.Add_Row(); 233*cdf0e10cSrcweir produce_Link(rRow, *it); 234*cdf0e10cSrcweir produce_LinkDoc(rRow, *it); 235*cdf0e10cSrcweir } // end for 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir return true; 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir void 241*cdf0e10cSrcweir HF_IdlModule::produce_Link( Xml::Element & o_row, 242*cdf0e10cSrcweir const client * i_ce ) const 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir csv_assert(i_ce != 0); 245*cdf0e10cSrcweir Xml::Element & 246*cdf0e10cSrcweir rCell = o_row 247*cdf0e10cSrcweir >> *new Html::TableCell 248*cdf0e10cSrcweir << new Html::ClassAttr(C_sCellStyle_SummaryLeft); 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir if ( NOT ary::is_type<ary::idl::Module>(*i_ce) ) 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir HF_IdlTypeText 253*cdf0e10cSrcweir aText(Env(), rCell, true); 254*cdf0e10cSrcweir aText.Produce_byData(i_ce->CeId()); 255*cdf0e10cSrcweir } 256*cdf0e10cSrcweir else 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir StreamLock slBuf(100); 259*cdf0e10cSrcweir rCell 260*cdf0e10cSrcweir >> *new Html::Link( slBuf() << i_ce->LocalName() 261*cdf0e10cSrcweir << "/module-ix.html" 262*cdf0e10cSrcweir << c_str ) 263*cdf0e10cSrcweir << i_ce->LocalName(); 264*cdf0e10cSrcweir } 265*cdf0e10cSrcweir } 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir void 268*cdf0e10cSrcweir HF_IdlModule::produce_LinkDoc( Xml::Element & o_row, 269*cdf0e10cSrcweir const client * i_ce ) const 270*cdf0e10cSrcweir { 271*cdf0e10cSrcweir csv_assert(i_ce != 0); 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir // We need the cell in any case, because, the rendering may be hurt else. 274*cdf0e10cSrcweir Xml::Element & 275*cdf0e10cSrcweir rCell = o_row 276*cdf0e10cSrcweir >> *new Html::TableCell 277*cdf0e10cSrcweir << new Html::ClassAttr(C_sCellStyle_SummaryRight); 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir const client & 280*cdf0e10cSrcweir rCe = *i_ce; 281*cdf0e10cSrcweir const ce_info * 282*cdf0e10cSrcweir pShort = Get_IdlDocu(rCe.Docu()); 283*cdf0e10cSrcweir if ( pShort == 0 ) 284*cdf0e10cSrcweir return; 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir if (pShort->IsDeprecated()) 288*cdf0e10cSrcweir { 289*cdf0e10cSrcweir rCell << "[ DEPRECATED ]" << new Html::LineBreak; 290*cdf0e10cSrcweir } 291*cdf0e10cSrcweir if (pShort->IsOptional()) 292*cdf0e10cSrcweir { 293*cdf0e10cSrcweir rCell << "[ OPTIONAL ]" << new Html::LineBreak; 294*cdf0e10cSrcweir } 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir HF_IdlDocuTextDisplay 297*cdf0e10cSrcweir aShortDisplay(Env(), &rCell, *i_ce); 298*cdf0e10cSrcweir pShort->Short().DisplayAt(aShortDisplay); 299*cdf0e10cSrcweir } 300