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_interface.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_gate.hxx> 35*cdf0e10cSrcweir #include <ary/idl/ik_function.hxx> 36*cdf0e10cSrcweir #include <ary/idl/ik_interface.hxx> 37*cdf0e10cSrcweir #include <ary/idl/ip_ce.hxx> 38*cdf0e10cSrcweir #include <ary/idl/ip_type.hxx> 39*cdf0e10cSrcweir #include <toolkit/hf_docentry.hxx> 40*cdf0e10cSrcweir #include <toolkit/hf_linachain.hxx> 41*cdf0e10cSrcweir #include <toolkit/hf_navi_sub.hxx> 42*cdf0e10cSrcweir #include <toolkit/hf_title.hxx> 43*cdf0e10cSrcweir #include "hfi_doc.hxx" 44*cdf0e10cSrcweir #include "hfi_hierarchy.hxx" 45*cdf0e10cSrcweir #include "hfi_method.hxx" 46*cdf0e10cSrcweir #include "hfi_navibar.hxx" 47*cdf0e10cSrcweir #include "hfi_property.hxx" 48*cdf0e10cSrcweir #include "hfi_tag.hxx" 49*cdf0e10cSrcweir #include "hfi_typetext.hxx" 50*cdf0e10cSrcweir #include "hi_linkhelper.hxx" 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir extern const String 54*cdf0e10cSrcweir C_sCePrefix_Interface("interface"); 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir namespace 57*cdf0e10cSrcweir { 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir const String 60*cdf0e10cSrcweir C_sBaseInterface("Base Interfaces"); 61*cdf0e10cSrcweir const String 62*cdf0e10cSrcweir C_sList_BaseComments("Comments on Base Interfaces"); 63*cdf0e10cSrcweir const String 64*cdf0e10cSrcweir C_sList_Methods("Methods' Summary"); 65*cdf0e10cSrcweir const String 66*cdf0e10cSrcweir C_sList_Methods_Label("MethodsSummary"); 67*cdf0e10cSrcweir const String 68*cdf0e10cSrcweir C_sDetails_Methods("Methods' Details"); 69*cdf0e10cSrcweir const String 70*cdf0e10cSrcweir C_sDetails_Methods_Label("MethodsDetails"); 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir const String 73*cdf0e10cSrcweir C_sList_Attributes("Attributes' Summary"); 74*cdf0e10cSrcweir const String 75*cdf0e10cSrcweir C_sList_Attributes_Label("AttributesSummary"); 76*cdf0e10cSrcweir const String 77*cdf0e10cSrcweir C_sList_AttributesDetails("Attributes' Details"); 78*cdf0e10cSrcweir const String 79*cdf0e10cSrcweir C_sList_AttributesDetails_Label("AttributesDetails"); 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir enum E_SubListIndices 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir sli_MethodsSummay = 0, 86*cdf0e10cSrcweir sli_AttributesSummary = 1, 87*cdf0e10cSrcweir sli_MethodDetails = 2, 88*cdf0e10cSrcweir sli_AttributesDetails = 3 89*cdf0e10cSrcweir }; 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir } //anonymous namespace 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir HF_IdlInterface::HF_IdlInterface( Environment & io_rEnv, 97*cdf0e10cSrcweir Xml::Element & o_rOut ) 98*cdf0e10cSrcweir : HtmlFactory_Idl(io_rEnv, &o_rOut), 99*cdf0e10cSrcweir eCurProducedMembers(mem_none) 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir } 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir HF_IdlInterface::~HF_IdlInterface() 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir } 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir void 108*cdf0e10cSrcweir HF_IdlInterface::Produce_byData( const client & i_ce ) const 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir Dyn<HF_NaviSubRow> 111*cdf0e10cSrcweir pNaviSubRow( &make_Navibar(i_ce) ); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir HF_TitleTable 114*cdf0e10cSrcweir aTitle(CurOut()); 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir HF_LinkedNameChain 117*cdf0e10cSrcweir aNameChain(aTitle.Add_Row()); 118*cdf0e10cSrcweir aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir produce_Title(aTitle, C_sCePrefix_Interface, i_ce); 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir produce_BaseHierarchy( aTitle.Add_Row(), 123*cdf0e10cSrcweir i_ce, 124*cdf0e10cSrcweir C_sBaseInterface ); 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir write_Docu(aTitle.Add_Row(), i_ce); 127*cdf0e10cSrcweir CurOut() << new Html::HorizontalLine(); 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir dyn_ce_list dpFunctions; 130*cdf0e10cSrcweir ary::idl::ifc_interface::attr::Get_Functions(dpFunctions, i_ce); 131*cdf0e10cSrcweir if ( (*dpFunctions).operator bool() ) 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir eCurProducedMembers = mem_Functions; 134*cdf0e10cSrcweir 135*cdf0e10cSrcweir produce_Members( *dpFunctions, 136*cdf0e10cSrcweir C_sList_Methods, 137*cdf0e10cSrcweir C_sList_Methods_Label, 138*cdf0e10cSrcweir C_sDetails_Methods, 139*cdf0e10cSrcweir C_sDetails_Methods_Label, 140*cdf0e10cSrcweir HtmlFactory_Idl::viewtype_summary ); 141*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_MethodsSummay); 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir dyn_ce_list 145*cdf0e10cSrcweir dpAttributes; 146*cdf0e10cSrcweir ary::idl::ifc_interface::attr::Get_Attributes(dpAttributes, i_ce); 147*cdf0e10cSrcweir if ( (*dpAttributes).operator bool() ) 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir eCurProducedMembers = mem_Attributes; 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir produce_Members( *dpAttributes, 152*cdf0e10cSrcweir C_sList_Attributes, 153*cdf0e10cSrcweir C_sList_Attributes_Label, 154*cdf0e10cSrcweir C_sList_AttributesDetails, 155*cdf0e10cSrcweir C_sList_AttributesDetails_Label, 156*cdf0e10cSrcweir HtmlFactory_Idl::viewtype_summary ); 157*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_AttributesSummary); 158*cdf0e10cSrcweir } 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir ary::idl::ifc_interface::attr::Get_Functions(dpFunctions, i_ce); 161*cdf0e10cSrcweir if ( (*dpFunctions).operator bool() ) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir eCurProducedMembers = mem_Functions; 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir produce_Members( *dpFunctions, 166*cdf0e10cSrcweir C_sList_Methods, 167*cdf0e10cSrcweir C_sList_Methods_Label, 168*cdf0e10cSrcweir C_sDetails_Methods, 169*cdf0e10cSrcweir C_sDetails_Methods_Label, 170*cdf0e10cSrcweir HtmlFactory_Idl::viewtype_details ); 171*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_MethodDetails); 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir ary::idl::ifc_interface::attr::Get_Attributes(dpAttributes, i_ce); 175*cdf0e10cSrcweir if ( (*dpAttributes).operator bool() ) 176*cdf0e10cSrcweir { 177*cdf0e10cSrcweir eCurProducedMembers = mem_Attributes; 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir produce_Members( *dpAttributes, 180*cdf0e10cSrcweir C_sList_Attributes, 181*cdf0e10cSrcweir C_sList_Attributes_Label, 182*cdf0e10cSrcweir C_sList_AttributesDetails, 183*cdf0e10cSrcweir C_sList_AttributesDetails_Label, 184*cdf0e10cSrcweir HtmlFactory_Idl::viewtype_details ); 185*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_AttributesDetails); 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir eCurProducedMembers = mem_none; 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir pNaviSubRow->Produce_Row(); 191*cdf0e10cSrcweir } 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir DYN HF_NaviSubRow & 194*cdf0e10cSrcweir HF_IdlInterface::make_Navibar( const client & i_ce ) const 195*cdf0e10cSrcweir { 196*cdf0e10cSrcweir HF_IdlNavigationBar 197*cdf0e10cSrcweir aNaviBar(Env(), CurOut()); 198*cdf0e10cSrcweir aNaviBar.Produce_CeMainRow(i_ce); 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir DYN HF_NaviSubRow & 201*cdf0e10cSrcweir ret = aNaviBar.Add_SubRow(); 202*cdf0e10cSrcweir ret.AddItem(C_sList_Methods, C_sList_Methods_Label, false); 203*cdf0e10cSrcweir ret.AddItem(C_sList_Attributes, C_sList_Attributes_Label, false); 204*cdf0e10cSrcweir ret.AddItem(C_sDetails_Methods, C_sDetails_Methods_Label, false); 205*cdf0e10cSrcweir ret.AddItem(C_sList_AttributesDetails, C_sList_AttributesDetails_Label, false); 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir CurOut() << new Html::HorizontalLine(); 208*cdf0e10cSrcweir return ret; 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir void 212*cdf0e10cSrcweir HF_IdlInterface::produce_MemberDetails( HF_SubTitleTable & o_table, 213*cdf0e10cSrcweir const client & i_ce ) const 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir switch (eCurProducedMembers) 216*cdf0e10cSrcweir { 217*cdf0e10cSrcweir case mem_Functions: 218*cdf0e10cSrcweir break; 219*cdf0e10cSrcweir case mem_Attributes: 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir HF_IdlAttribute 222*cdf0e10cSrcweir aAttribute( Env(), o_table); 223*cdf0e10cSrcweir aAttribute.Produce_byData( i_ce ); 224*cdf0e10cSrcweir return; 225*cdf0e10cSrcweir }; 226*cdf0e10cSrcweir default: //Won't happen. 227*cdf0e10cSrcweir return; 228*cdf0e10cSrcweir } // end switch 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir typedef ary::idl::ifc_function::attr funcAttr; 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir HF_IdlMethod 233*cdf0e10cSrcweir aFunction( Env(), 234*cdf0e10cSrcweir o_table.Add_Row() 235*cdf0e10cSrcweir >> *new Html::TableCell 236*cdf0e10cSrcweir << new Html::ClassAttr(C_sCellStyle_MDetail) ); 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir ary::Dyn_StdConstIterator<ary::idl::Parameter> 239*cdf0e10cSrcweir pParameters; 240*cdf0e10cSrcweir funcAttr::Get_Parameters(pParameters, i_ce); 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir ary::Dyn_StdConstIterator<ary::idl::Type_id> 243*cdf0e10cSrcweir pExceptions; 244*cdf0e10cSrcweir funcAttr::Get_Exceptions(pExceptions, i_ce); 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir aFunction.Produce_byData( i_ce.LocalName(), 247*cdf0e10cSrcweir funcAttr::ReturnType(i_ce), 248*cdf0e10cSrcweir *pParameters, 249*cdf0e10cSrcweir *pExceptions, 250*cdf0e10cSrcweir funcAttr::IsOneway(i_ce), 251*cdf0e10cSrcweir funcAttr::HasEllipse(i_ce), 252*cdf0e10cSrcweir i_ce ); 253*cdf0e10cSrcweir } 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir void 256*cdf0e10cSrcweir HF_IdlInterface::produce_BaseHierarchy( Xml::Element & o_screen, 257*cdf0e10cSrcweir const client & i_ce, 258*cdf0e10cSrcweir const String & i_sLabel ) const 259*cdf0e10cSrcweir { 260*cdf0e10cSrcweir ary::Dyn_StdConstIterator<ary::idl::CommentedRelation> 261*cdf0e10cSrcweir pHelp; 262*cdf0e10cSrcweir ary::idl::ifc_interface::attr::Get_Bases(pHelp, i_ce); 263*cdf0e10cSrcweir if (NOT (*pHelp).operator bool()) 264*cdf0e10cSrcweir return; 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir // Check for XInterface as only base: 267*cdf0e10cSrcweir ary::StdConstIterator<ary::idl::CommentedRelation> & 268*cdf0e10cSrcweir itTest = *pHelp; 269*cdf0e10cSrcweir ary::idl::Ce_id 270*cdf0e10cSrcweir nCe = Env().Gate().Types().Search_CeRelatedTo((*itTest).Type()); 271*cdf0e10cSrcweir if (nCe.IsValid()) 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir // KORR_FUTURE 274*cdf0e10cSrcweir // Rather check for id(!) of com::sun::star::uno::XInterface. 275*cdf0e10cSrcweir if (Env().Gate().Ces().Find_Ce(nCe).LocalName() == "XInterface") 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir ++itTest; 278*cdf0e10cSrcweir if (NOT itTest.operator bool()) 279*cdf0e10cSrcweir return; 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir } 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir // Write hierarchy: 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir HF_DocEntryList 286*cdf0e10cSrcweir aDocList( o_screen ); 287*cdf0e10cSrcweir aDocList.Produce_Term(i_sLabel); 288*cdf0e10cSrcweir Xml::Element & 289*cdf0e10cSrcweir rBaseList = aDocList.Produce_Definition(); 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir // NEW 292*cdf0e10cSrcweir Write_BaseHierarchy(rBaseList, Env(), i_ce); 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir // Write comments: 295*cdf0e10cSrcweir // KORR_FUTURE: Make sure, no empty table is constructed when comments list is empty. 296*cdf0e10cSrcweir HF_SubTitleTable 297*cdf0e10cSrcweir aBaseTable( aDocList.Produce_Definition(), 298*cdf0e10cSrcweir "", 299*cdf0e10cSrcweir C_sList_BaseComments, 300*cdf0e10cSrcweir 2, 301*cdf0e10cSrcweir HF_SubTitleTable::sublevel_3 ); 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir ary::Dyn_StdConstIterator<ary::idl::CommentedRelation> 304*cdf0e10cSrcweir pBases; 305*cdf0e10cSrcweir ary::idl::ifc_interface::attr::Get_Bases(pBases, i_ce); 306*cdf0e10cSrcweir for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *pBases; 307*cdf0e10cSrcweir it.operator bool(); 308*cdf0e10cSrcweir ++it ) 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir Xml::Element & 311*cdf0e10cSrcweir rRow = aBaseTable.Add_Row(); 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir Xml::Element & 314*cdf0e10cSrcweir rTerm = rRow 315*cdf0e10cSrcweir >> *new Html::TableCell 316*cdf0e10cSrcweir << new Html::ClassAttr(C_sCellStyle_SummaryLeft); 317*cdf0e10cSrcweir HF_IdlTypeText 318*cdf0e10cSrcweir aTypeDisplay( Env(), rTerm, false, 0); 319*cdf0e10cSrcweir aTypeDisplay.Produce_byData((*it).Type()); 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir Xml::Element & 322*cdf0e10cSrcweir rDocu = rRow 323*cdf0e10cSrcweir >> *new Html::TableCell 324*cdf0e10cSrcweir << new Html::ClassAttr(C_sCellStyle_SummaryRight); 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir HF_DocEntryList 327*cdf0e10cSrcweir aDocuList(rDocu); 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir if ((*it).Info() != 0) 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir // aDocuList.Produce_Term("Comment on Base Reference"); 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir HF_IdlDocu 334*cdf0e10cSrcweir aDocuDisplay(Env(), aDocuList); 335*cdf0e10cSrcweir aDocuDisplay.Produce_fromReference(*(*it).Info(), i_ce); 336*cdf0e10cSrcweir } 337*cdf0e10cSrcweir else 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir const client * 340*cdf0e10cSrcweir pCe = Env().Linker().Search_CeFromType((*it).Type()); 341*cdf0e10cSrcweir const ce_info * 342*cdf0e10cSrcweir pShort = pCe != 0 343*cdf0e10cSrcweir ? Get_IdlDocu(pCe->Docu()) 344*cdf0e10cSrcweir : (const ce_info *)(0); 345*cdf0e10cSrcweir if ( pShort != 0 ) 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir aDocuList.Produce_NormalTerm("(referenced interface's summary:)"); 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir Xml::Element & 350*cdf0e10cSrcweir rDef = aDocuList.Produce_Definition(); 351*cdf0e10cSrcweir HF_IdlDocuTextDisplay 352*cdf0e10cSrcweir aShortDisplay( Env(), &rDef, *pCe); 353*cdf0e10cSrcweir pShort->Short().DisplayAt(aShortDisplay); 354*cdf0e10cSrcweir } // end if (pShort != 0) 355*cdf0e10cSrcweir } // endif ( (*i_commentedRef).Info() != 0 ) else 356*cdf0e10cSrcweir } // end for 357*cdf0e10cSrcweir } 358