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_service.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES 33*cdf0e10cSrcweir #include <ary/idl/i_ce.hxx> 34*cdf0e10cSrcweir #include <ary/idl/ik_property.hxx> 35*cdf0e10cSrcweir #include <ary/idl/ik_service.hxx> 36*cdf0e10cSrcweir #include <toolkit/hf_docentry.hxx> 37*cdf0e10cSrcweir #include <toolkit/hf_linachain.hxx> 38*cdf0e10cSrcweir #include <toolkit/hf_navi_sub.hxx> 39*cdf0e10cSrcweir #include <toolkit/hf_title.hxx> 40*cdf0e10cSrcweir #include "hfi_doc.hxx" 41*cdf0e10cSrcweir #include "hfi_navibar.hxx" 42*cdf0e10cSrcweir #include "hfi_property.hxx" 43*cdf0e10cSrcweir #include "hfi_tag.hxx" 44*cdf0e10cSrcweir #include "hfi_typetext.hxx" 45*cdf0e10cSrcweir #include "hi_linkhelper.hxx" 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir extern const String 51*cdf0e10cSrcweir C_sCePrefix_Service("service"); 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir namespace 54*cdf0e10cSrcweir { 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir const String 57*cdf0e10cSrcweir C_sList_IncludedServices("Services' Summary"); 58*cdf0e10cSrcweir const String 59*cdf0e10cSrcweir C_sList_IncludedServices_Heading("Included Services - Summary"); 60*cdf0e10cSrcweir const String 61*cdf0e10cSrcweir C_sList_IncludedServices_Label("ServicesSummary"); 62*cdf0e10cSrcweir const String 63*cdf0e10cSrcweir C_sList_IncludedServicesDetails("Services' Details"); 64*cdf0e10cSrcweir const String 65*cdf0e10cSrcweir C_sList_IncludedServicesDetails_Heading("Included Services - Details"); 66*cdf0e10cSrcweir const String 67*cdf0e10cSrcweir C_sList_IncludedServicesDetails_Label("ServicesDetails"); 68*cdf0e10cSrcweir const String 69*cdf0e10cSrcweir C_sList_ExportedInterfaces("Interfaces' Summary"); 70*cdf0e10cSrcweir const String 71*cdf0e10cSrcweir C_sList_ExportedInterfaces_Heading("Exported Interfaces - Summary"); 72*cdf0e10cSrcweir const String 73*cdf0e10cSrcweir C_sList_ExportedInterfaces_Label("InterfacesSummary"); 74*cdf0e10cSrcweir const String 75*cdf0e10cSrcweir C_sList_ExportedInterfacesDetails("Interfaces' Details"); 76*cdf0e10cSrcweir const String 77*cdf0e10cSrcweir C_sList_ExportedInterfacesDetails_Heading("Exported Interfaces - Details"); 78*cdf0e10cSrcweir const String 79*cdf0e10cSrcweir C_sList_ExportedInterfacesDetails_Label("InterfacesDetails"); 80*cdf0e10cSrcweir const String 81*cdf0e10cSrcweir C_sList_Properties("Properties' Summary"); 82*cdf0e10cSrcweir const String 83*cdf0e10cSrcweir C_sList_Properties_Label("PropertiesSummary"); 84*cdf0e10cSrcweir const String 85*cdf0e10cSrcweir C_sList_PropertiesDetails("Properties' Details"); 86*cdf0e10cSrcweir const String 87*cdf0e10cSrcweir C_sList_PropertiesDetails_Label("PropertiesDetails"); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir enum E_SubListIndices 91*cdf0e10cSrcweir { 92*cdf0e10cSrcweir sli_IncludedServicesSummary = 0, 93*cdf0e10cSrcweir sli_InterfacesSummary = 1, 94*cdf0e10cSrcweir sli_PropertiesSummary = 2, 95*cdf0e10cSrcweir sli_IncludedServicesDetails = 3, 96*cdf0e10cSrcweir sli_InterfacesDetails = 4, 97*cdf0e10cSrcweir sli_PropertiesDetails = 5 98*cdf0e10cSrcweir }; 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir } //anonymous namespace 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir HF_IdlService::HF_IdlService( Environment & io_rEnv, 104*cdf0e10cSrcweir Xml::Element & o_rOut ) 105*cdf0e10cSrcweir : HtmlFactory_Idl(io_rEnv, &o_rOut) 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir } 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir HF_IdlService::~HF_IdlService() 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir typedef ::ary::idl::ifc_service::attr 115*cdf0e10cSrcweir ServiceAttr; 116*cdf0e10cSrcweir typedef ::ary::Dyn_StdConstIterator< ::ary::idl::CommentedRelation > 117*cdf0e10cSrcweir dyn_comref_list; 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir void 120*cdf0e10cSrcweir HF_IdlService::produce_CommentedRelations( const client & i_ce, 121*cdf0e10cSrcweir comref_list & it_list, 122*cdf0e10cSrcweir const String & i_summaryTitle, 123*cdf0e10cSrcweir const String & i_summaryLabel, 124*cdf0e10cSrcweir const String & i_detailsTitle, 125*cdf0e10cSrcweir const String & i_detailsLabel, 126*cdf0e10cSrcweir const E_DocType i_docType ) const 127*cdf0e10cSrcweir { 128*cdf0e10cSrcweir csv_assert( it_list ); 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir bool bSummaryOnly = ( i_docType == doctype_summaryOnly ); 131*cdf0e10cSrcweir HF_SubTitleTable aTable( 132*cdf0e10cSrcweir CurOut(), 133*cdf0e10cSrcweir bSummaryOnly ? i_summaryLabel : i_detailsLabel, 134*cdf0e10cSrcweir bSummaryOnly ? i_summaryTitle : i_detailsTitle, 135*cdf0e10cSrcweir 2 ); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir for ( ; it_list; ++it_list ) 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir Xml::Element & 140*cdf0e10cSrcweir rRow = aTable.Add_Row(); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir if ( bSummaryOnly ) 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir produce_Link(rRow, (*it_list).Type()); 145*cdf0e10cSrcweir produce_LinkSummary(i_ce, rRow, *it_list); 146*cdf0e10cSrcweir } 147*cdf0e10cSrcweir else 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir HF_IdlCommentedRelationElement 150*cdf0e10cSrcweir aRelation( Env(), aTable, *it_list ); 151*cdf0e10cSrcweir aRelation.Produce_byData( i_ce ); 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir } // end for 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir void 157*cdf0e10cSrcweir HF_IdlService::Produce_byData( const client & i_ce ) const 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir Dyn<HF_NaviSubRow> 160*cdf0e10cSrcweir pNaviSubRow( &make_Navibar(i_ce) ); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir HF_TitleTable 163*cdf0e10cSrcweir aTitle(CurOut()); 164*cdf0e10cSrcweir HF_LinkedNameChain 165*cdf0e10cSrcweir aNameChain(aTitle.Add_Row()); 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); 168*cdf0e10cSrcweir produce_Title(aTitle, C_sCePrefix_Service, i_ce); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir write_Docu(aTitle.Add_Row(), i_ce); 171*cdf0e10cSrcweir CurOut() << new Html::HorizontalLine(); 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir // produce ... 174*cdf0e10cSrcweir // - included services: summary 175*cdf0e10cSrcweir dyn_comref_list dpIncludedServices; 176*cdf0e10cSrcweir ServiceAttr::Get_IncludedServices(dpIncludedServices, i_ce); 177*cdf0e10cSrcweir if ( (*dpIncludedServices).operator bool() ) 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir produce_CommentedRelations( i_ce, *dpIncludedServices, 180*cdf0e10cSrcweir C_sList_IncludedServices_Heading, 181*cdf0e10cSrcweir C_sList_IncludedServices_Label, 182*cdf0e10cSrcweir C_sList_IncludedServicesDetails_Heading, 183*cdf0e10cSrcweir C_sList_IncludedServicesDetails_Label, 184*cdf0e10cSrcweir doctype_summaryOnly ); 185*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_IncludedServicesSummary); 186*cdf0e10cSrcweir } 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir // - exported interfaces: summary 189*cdf0e10cSrcweir dyn_comref_list dpExportedInterfaces; 190*cdf0e10cSrcweir ServiceAttr::Get_ExportedInterfaces(dpExportedInterfaces, i_ce); 191*cdf0e10cSrcweir if ( (*dpExportedInterfaces).operator bool() ) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir produce_CommentedRelations( i_ce, *dpExportedInterfaces, 194*cdf0e10cSrcweir C_sList_ExportedInterfaces_Heading, 195*cdf0e10cSrcweir C_sList_ExportedInterfaces_Label, 196*cdf0e10cSrcweir C_sList_ExportedInterfacesDetails_Heading, 197*cdf0e10cSrcweir C_sList_ExportedInterfacesDetails_Label, 198*cdf0e10cSrcweir doctype_summaryOnly ); 199*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_InterfacesSummary); 200*cdf0e10cSrcweir } 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir // - supported properties: summary 203*cdf0e10cSrcweir dyn_ce_list dpProperties; 204*cdf0e10cSrcweir ServiceAttr::Get_Properties(dpProperties, i_ce); 205*cdf0e10cSrcweir if ( (*dpProperties).operator bool() ) 206*cdf0e10cSrcweir { 207*cdf0e10cSrcweir produce_Members( *dpProperties, 208*cdf0e10cSrcweir C_sList_Properties, 209*cdf0e10cSrcweir C_sList_Properties_Label, 210*cdf0e10cSrcweir C_sList_PropertiesDetails, 211*cdf0e10cSrcweir C_sList_PropertiesDetails_Label, 212*cdf0e10cSrcweir viewtype_summary ); 213*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_PropertiesSummary); 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir // - included services: details 217*cdf0e10cSrcweir ServiceAttr::Get_IncludedServices(dpIncludedServices, i_ce); 218*cdf0e10cSrcweir if ( (*dpIncludedServices).operator bool() ) 219*cdf0e10cSrcweir { 220*cdf0e10cSrcweir produce_CommentedRelations( i_ce, *dpIncludedServices, 221*cdf0e10cSrcweir C_sList_IncludedServices_Heading, 222*cdf0e10cSrcweir C_sList_IncludedServices_Label, 223*cdf0e10cSrcweir C_sList_IncludedServicesDetails_Heading, 224*cdf0e10cSrcweir C_sList_IncludedServicesDetails_Label, 225*cdf0e10cSrcweir doctype_complete ); 226*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_IncludedServicesDetails); 227*cdf0e10cSrcweir } 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir // - exported interfaces: details 230*cdf0e10cSrcweir ServiceAttr::Get_ExportedInterfaces(dpExportedInterfaces, i_ce); 231*cdf0e10cSrcweir if ( (*dpExportedInterfaces).operator bool() ) 232*cdf0e10cSrcweir { 233*cdf0e10cSrcweir produce_CommentedRelations( i_ce, *dpExportedInterfaces, 234*cdf0e10cSrcweir C_sList_ExportedInterfaces_Heading, 235*cdf0e10cSrcweir C_sList_ExportedInterfaces_Label, 236*cdf0e10cSrcweir C_sList_ExportedInterfacesDetails_Heading, 237*cdf0e10cSrcweir C_sList_ExportedInterfacesDetails_Label, 238*cdf0e10cSrcweir doctype_complete ); 239*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_InterfacesDetails); 240*cdf0e10cSrcweir } 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir // supported properties: details 243*cdf0e10cSrcweir ServiceAttr::Get_Properties(dpProperties, i_ce); 244*cdf0e10cSrcweir if ( (*dpProperties).operator bool() ) 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir produce_Members( *dpProperties, 247*cdf0e10cSrcweir C_sList_Properties, 248*cdf0e10cSrcweir C_sList_Properties_Label, 249*cdf0e10cSrcweir C_sList_PropertiesDetails, 250*cdf0e10cSrcweir C_sList_PropertiesDetails_Label, 251*cdf0e10cSrcweir viewtype_details ); 252*cdf0e10cSrcweir pNaviSubRow->SwitchOn(sli_PropertiesDetails); 253*cdf0e10cSrcweir } 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir pNaviSubRow->Produce_Row(); 256*cdf0e10cSrcweir CurOut() << new Xml::XmlCode("<br> "); 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir typedef ary::idl::ifc_property::attr PropertyAttr; 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir void 262*cdf0e10cSrcweir HF_IdlService::produce_SummaryDeclaration( Xml::Element & o_row, 263*cdf0e10cSrcweir const client & i_property ) const 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir // KORR_FUTURE 266*cdf0e10cSrcweir // Put this in to HF_IdlProperty! 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir Xml::Element & 269*cdf0e10cSrcweir rCell = o_row 270*cdf0e10cSrcweir >> *new Html::TableCell 271*cdf0e10cSrcweir << new Html::ClassAttr( C_sCellStyle_SummaryLeft ); 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir if (PropertyAttr::HasAnyStereotype(i_property)) 274*cdf0e10cSrcweir { 275*cdf0e10cSrcweir rCell << "[ "; 276*cdf0e10cSrcweir if (PropertyAttr::IsReadOnly(i_property)) 277*cdf0e10cSrcweir rCell << "readonly "; 278*cdf0e10cSrcweir if (PropertyAttr::IsBound(i_property)) 279*cdf0e10cSrcweir rCell << "bound "; 280*cdf0e10cSrcweir if (PropertyAttr::IsConstrained(i_property)) 281*cdf0e10cSrcweir rCell << "constrained "; 282*cdf0e10cSrcweir if (PropertyAttr::IsMayBeAmbiguous(i_property)) 283*cdf0e10cSrcweir rCell << "maybeambiguous "; 284*cdf0e10cSrcweir if (PropertyAttr::IsMayBeDefault(i_property)) 285*cdf0e10cSrcweir rCell << "maybedefault "; 286*cdf0e10cSrcweir if (PropertyAttr::IsMayBeVoid(i_property)) 287*cdf0e10cSrcweir rCell << "maybevoid "; 288*cdf0e10cSrcweir if (PropertyAttr::IsRemovable(i_property)) 289*cdf0e10cSrcweir rCell << "removable "; 290*cdf0e10cSrcweir if (PropertyAttr::IsTransient(i_property)) 291*cdf0e10cSrcweir rCell << "transient "; 292*cdf0e10cSrcweir rCell << "] "; 293*cdf0e10cSrcweir } // end if 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir HF_IdlTypeText 296*cdf0e10cSrcweir aType( Env(), rCell, true ); 297*cdf0e10cSrcweir aType.Produce_byData( PropertyAttr::Type(i_property) ); 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir StreamLock aLocalLink(100); 300*cdf0e10cSrcweir aLocalLink() << "#" << i_property.LocalName(); 301*cdf0e10cSrcweir rCell 302*cdf0e10cSrcweir << new Html::LineBreak 303*cdf0e10cSrcweir >> *new Html::Link( aLocalLink().c_str() ) 304*cdf0e10cSrcweir << i_property.LocalName(); 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir DYN HF_NaviSubRow & 308*cdf0e10cSrcweir HF_IdlService::make_Navibar( const client & i_ce ) const 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir HF_IdlNavigationBar 311*cdf0e10cSrcweir aNaviBar(Env(), CurOut()); 312*cdf0e10cSrcweir aNaviBar.Produce_CeMainRow(i_ce); 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir DYN HF_NaviSubRow & 315*cdf0e10cSrcweir ret = aNaviBar.Add_SubRow(); 316*cdf0e10cSrcweir ret.AddItem(C_sList_IncludedServices, C_sList_IncludedServices_Label, false); 317*cdf0e10cSrcweir ret.AddItem(C_sList_ExportedInterfaces, C_sList_ExportedInterfaces_Label, false); 318*cdf0e10cSrcweir ret.AddItem(C_sList_Properties, C_sList_Properties_Label, false); 319*cdf0e10cSrcweir ret.AddItem(C_sList_IncludedServicesDetails, C_sList_IncludedServicesDetails_Label, false); 320*cdf0e10cSrcweir ret.AddItem(C_sList_ExportedInterfacesDetails, C_sList_ExportedInterfacesDetails_Label, false); 321*cdf0e10cSrcweir ret.AddItem(C_sList_PropertiesDetails, C_sList_PropertiesDetails_Label, false); 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir CurOut() << new Html::HorizontalLine(); 324*cdf0e10cSrcweir return ret; 325*cdf0e10cSrcweir } 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir void 328*cdf0e10cSrcweir HF_IdlService::produce_Link( Xml::Element & o_row, 329*cdf0e10cSrcweir type_id i_type ) const 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir Xml::Element & 332*cdf0e10cSrcweir rCell = o_row 333*cdf0e10cSrcweir >> *new Html::TableCell 334*cdf0e10cSrcweir << new Html::ClassAttr(C_sCellStyle_SummaryLeft); 335*cdf0e10cSrcweir HF_IdlTypeText 336*cdf0e10cSrcweir aText(Env(), rCell, true); 337*cdf0e10cSrcweir aText.Produce_byData(i_type); 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir void 341*cdf0e10cSrcweir HF_IdlService::produce_LinkSummary( const client & i_ce, 342*cdf0e10cSrcweir Xml::Element & o_row, 343*cdf0e10cSrcweir const comref & i_commentedRef ) const 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir Xml::Element & 346*cdf0e10cSrcweir rCell = o_row 347*cdf0e10cSrcweir >> *new Html::TableCell 348*cdf0e10cSrcweir << new Html::ClassAttr(C_sCellStyle_SummaryRight); 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir HF_IdlCommentedRelationElement::produce_LinkDoc( Env(), i_ce, rCell, i_commentedRef, doctype_summaryOnly ); 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir void 354*cdf0e10cSrcweir HF_IdlService::produce_MemberDetails( HF_SubTitleTable & o_table, 355*cdf0e10cSrcweir const client & i_ce ) const 356*cdf0e10cSrcweir { 357*cdf0e10cSrcweir HF_IdlProperty 358*cdf0e10cSrcweir aProperty( Env(), o_table); 359*cdf0e10cSrcweir aProperty.Produce_byData( i_ce ); 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir 364