Update ooo320-m1
[ooovba.git] / autodoc / source / display / idl / hfi_service.cxx
blobfd103e2d9d01a92b130869ab76c5f01b55366ddc
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hfi_service.cxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <precomp.h>
32 #include "hfi_service.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <ary/idl/i_ce.hxx>
37 #include <ary/idl/ik_property.hxx>
38 #include <ary/idl/ik_service.hxx>
39 #include <toolkit/hf_docentry.hxx>
40 #include <toolkit/hf_linachain.hxx>
41 #include <toolkit/hf_navi_sub.hxx>
42 #include <toolkit/hf_title.hxx>
43 #include "hfi_doc.hxx"
44 #include "hfi_navibar.hxx"
45 #include "hfi_property.hxx"
46 #include "hfi_tag.hxx"
47 #include "hfi_typetext.hxx"
48 #include "hi_linkhelper.hxx"
53 extern const String
54 C_sCePrefix_Service("service");
56 namespace
59 const String
60 C_sList_IncludedServices("Services' Summary");
61 const String
62 C_sList_IncludedServices_Heading("Included Services - Summary");
63 const String
64 C_sList_IncludedServices_Label("ServicesSummary");
65 const String
66 C_sList_IncludedServicesDetails("Services' Details");
67 const String
68 C_sList_IncludedServicesDetails_Heading("Included Services - Details");
69 const String
70 C_sList_IncludedServicesDetails_Label("ServicesDetails");
71 const String
72 C_sList_ExportedInterfaces("Interfaces' Summary");
73 const String
74 C_sList_ExportedInterfaces_Heading("Exported Interfaces - Summary");
75 const String
76 C_sList_ExportedInterfaces_Label("InterfacesSummary");
77 const String
78 C_sList_ExportedInterfacesDetails("Interfaces' Details");
79 const String
80 C_sList_ExportedInterfacesDetails_Heading("Exported Interfaces - Details");
81 const String
82 C_sList_ExportedInterfacesDetails_Label("InterfacesDetails");
83 const String
84 C_sList_Properties("Properties' Summary");
85 const String
86 C_sList_Properties_Label("PropertiesSummary");
87 const String
88 C_sList_PropertiesDetails("Properties' Details");
89 const String
90 C_sList_PropertiesDetails_Label("PropertiesDetails");
93 enum E_SubListIndices
95 sli_IncludedServicesSummary = 0,
96 sli_InterfacesSummary = 1,
97 sli_PropertiesSummary = 2,
98 sli_IncludedServicesDetails = 3,
99 sli_InterfacesDetails = 4,
100 sli_PropertiesDetails = 5
103 } //anonymous namespace
106 HF_IdlService::HF_IdlService( Environment & io_rEnv,
107 Xml::Element & o_rOut )
108 : HtmlFactory_Idl(io_rEnv, &o_rOut)
112 HF_IdlService::~HF_IdlService()
117 typedef ::ary::idl::ifc_service::attr
118 ServiceAttr;
119 typedef ::ary::Dyn_StdConstIterator< ::ary::idl::CommentedRelation >
120 dyn_comref_list;
122 void
123 HF_IdlService::produce_CommentedRelations( const client & i_ce,
124 comref_list & it_list,
125 const String & i_summaryTitle,
126 const String & i_summaryLabel,
127 const String & i_detailsTitle,
128 const String & i_detailsLabel,
129 const E_DocType i_docType ) const
131 csv_assert( it_list );
133 bool bSummaryOnly = ( i_docType == doctype_summaryOnly );
134 HF_SubTitleTable aTable(
135 CurOut(),
136 bSummaryOnly ? i_summaryLabel : i_detailsLabel,
137 bSummaryOnly ? i_summaryTitle : i_detailsTitle,
138 2 );
140 for ( ; it_list; ++it_list )
142 Xml::Element &
143 rRow = aTable.Add_Row();
145 if ( bSummaryOnly )
147 produce_Link(rRow, (*it_list).Type());
148 produce_LinkSummary(i_ce, rRow, *it_list);
150 else
152 HF_IdlCommentedRelationElement
153 aRelation( Env(), aTable, *it_list );
154 aRelation.Produce_byData( i_ce );
156 } // end for
159 void
160 HF_IdlService::Produce_byData( const client & i_ce ) const
162 Dyn<HF_NaviSubRow>
163 pNaviSubRow( &make_Navibar(i_ce) );
165 HF_TitleTable
166 aTitle(CurOut());
167 HF_LinkedNameChain
168 aNameChain(aTitle.Add_Row());
170 aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker);
171 produce_Title(aTitle, C_sCePrefix_Service, i_ce);
173 write_Docu(aTitle.Add_Row(), i_ce);
174 CurOut() << new Html::HorizontalLine();
176 // produce ...
177 // - included services: summary
178 dyn_comref_list dpIncludedServices;
179 ServiceAttr::Get_IncludedServices(dpIncludedServices, i_ce);
180 if ( (*dpIncludedServices).operator bool() )
182 produce_CommentedRelations( i_ce, *dpIncludedServices,
183 C_sList_IncludedServices_Heading,
184 C_sList_IncludedServices_Label,
185 C_sList_IncludedServicesDetails_Heading,
186 C_sList_IncludedServicesDetails_Label,
187 doctype_summaryOnly );
188 pNaviSubRow->SwitchOn(sli_IncludedServicesSummary);
191 // - exported interfaces: summary
192 dyn_comref_list dpExportedInterfaces;
193 ServiceAttr::Get_ExportedInterfaces(dpExportedInterfaces, i_ce);
194 if ( (*dpExportedInterfaces).operator bool() )
196 produce_CommentedRelations( i_ce, *dpExportedInterfaces,
197 C_sList_ExportedInterfaces_Heading,
198 C_sList_ExportedInterfaces_Label,
199 C_sList_ExportedInterfacesDetails_Heading,
200 C_sList_ExportedInterfacesDetails_Label,
201 doctype_summaryOnly );
202 pNaviSubRow->SwitchOn(sli_InterfacesSummary);
205 // - supported properties: summary
206 dyn_ce_list dpProperties;
207 ServiceAttr::Get_Properties(dpProperties, i_ce);
208 if ( (*dpProperties).operator bool() )
210 produce_Members( *dpProperties,
211 C_sList_Properties,
212 C_sList_Properties_Label,
213 C_sList_PropertiesDetails,
214 C_sList_PropertiesDetails_Label,
215 viewtype_summary );
216 pNaviSubRow->SwitchOn(sli_PropertiesSummary);
219 // - included services: details
220 ServiceAttr::Get_IncludedServices(dpIncludedServices, i_ce);
221 if ( (*dpIncludedServices).operator bool() )
223 produce_CommentedRelations( i_ce, *dpIncludedServices,
224 C_sList_IncludedServices_Heading,
225 C_sList_IncludedServices_Label,
226 C_sList_IncludedServicesDetails_Heading,
227 C_sList_IncludedServicesDetails_Label,
228 doctype_complete );
229 pNaviSubRow->SwitchOn(sli_IncludedServicesDetails);
232 // - exported interfaces: details
233 ServiceAttr::Get_ExportedInterfaces(dpExportedInterfaces, i_ce);
234 if ( (*dpExportedInterfaces).operator bool() )
236 produce_CommentedRelations( i_ce, *dpExportedInterfaces,
237 C_sList_ExportedInterfaces_Heading,
238 C_sList_ExportedInterfaces_Label,
239 C_sList_ExportedInterfacesDetails_Heading,
240 C_sList_ExportedInterfacesDetails_Label,
241 doctype_complete );
242 pNaviSubRow->SwitchOn(sli_InterfacesDetails);
245 // supported properties: details
246 ServiceAttr::Get_Properties(dpProperties, i_ce);
247 if ( (*dpProperties).operator bool() )
249 produce_Members( *dpProperties,
250 C_sList_Properties,
251 C_sList_Properties_Label,
252 C_sList_PropertiesDetails,
253 C_sList_PropertiesDetails_Label,
254 viewtype_details );
255 pNaviSubRow->SwitchOn(sli_PropertiesDetails);
258 pNaviSubRow->Produce_Row();
259 CurOut() << new Xml::XmlCode("<br>&nbsp;");
262 typedef ary::idl::ifc_property::attr PropertyAttr;
264 void
265 HF_IdlService::produce_SummaryDeclaration( Xml::Element & o_row,
266 const client & i_property ) const
268 // KORR_FUTURE
269 // Put this in to HF_IdlProperty!
271 Xml::Element &
272 rCell = o_row
273 >> *new Html::TableCell
274 << new Html::ClassAttr( C_sCellStyle_SummaryLeft );
276 if (PropertyAttr::HasAnyStereotype(i_property))
278 rCell << "[ ";
279 if (PropertyAttr::IsReadOnly(i_property))
280 rCell << "readonly ";
281 if (PropertyAttr::IsBound(i_property))
282 rCell << "bound ";
283 if (PropertyAttr::IsConstrained(i_property))
284 rCell << "constrained ";
285 if (PropertyAttr::IsMayBeAmbiguous(i_property))
286 rCell << "maybeambiguous ";
287 if (PropertyAttr::IsMayBeDefault(i_property))
288 rCell << "maybedefault ";
289 if (PropertyAttr::IsMayBeVoid(i_property))
290 rCell << "maybevoid ";
291 if (PropertyAttr::IsRemovable(i_property))
292 rCell << "removable ";
293 if (PropertyAttr::IsTransient(i_property))
294 rCell << "transient ";
295 rCell << "] ";
296 } // end if
298 HF_IdlTypeText
299 aType( Env(), rCell, true );
300 aType.Produce_byData( PropertyAttr::Type(i_property) );
302 StreamLock aLocalLink(100);
303 aLocalLink() << "#" << i_property.LocalName();
304 rCell
305 << new Html::LineBreak
306 >> *new Html::Link( aLocalLink().c_str() )
307 << i_property.LocalName();
310 DYN HF_NaviSubRow &
311 HF_IdlService::make_Navibar( const client & i_ce ) const
313 HF_IdlNavigationBar
314 aNaviBar(Env(), CurOut());
315 aNaviBar.Produce_CeMainRow(i_ce);
317 DYN HF_NaviSubRow &
318 ret = aNaviBar.Add_SubRow();
319 ret.AddItem(C_sList_IncludedServices, C_sList_IncludedServices_Label, false);
320 ret.AddItem(C_sList_ExportedInterfaces, C_sList_ExportedInterfaces_Label, false);
321 ret.AddItem(C_sList_Properties, C_sList_Properties_Label, false);
322 ret.AddItem(C_sList_IncludedServicesDetails, C_sList_IncludedServicesDetails_Label, false);
323 ret.AddItem(C_sList_ExportedInterfacesDetails, C_sList_ExportedInterfacesDetails_Label, false);
324 ret.AddItem(C_sList_PropertiesDetails, C_sList_PropertiesDetails_Label, false);
326 CurOut() << new Html::HorizontalLine();
327 return ret;
330 void
331 HF_IdlService::produce_Link( Xml::Element & o_row,
332 type_id i_type ) const
334 Xml::Element &
335 rCell = o_row
336 >> *new Html::TableCell
337 << new Html::ClassAttr(C_sCellStyle_SummaryLeft);
338 HF_IdlTypeText
339 aText(Env(), rCell, true);
340 aText.Produce_byData(i_type);
343 void
344 HF_IdlService::produce_LinkSummary( const client & i_ce,
345 Xml::Element & o_row,
346 const comref & i_commentedRef ) const
348 Xml::Element &
349 rCell = o_row
350 >> *new Html::TableCell
351 << new Html::ClassAttr(C_sCellStyle_SummaryRight);
353 HF_IdlCommentedRelationElement::produce_LinkDoc( Env(), i_ce, rCell, i_commentedRef, doctype_summaryOnly );
356 void
357 HF_IdlService::produce_MemberDetails( HF_SubTitleTable & o_table,
358 const client & i_ce ) const
360 HF_IdlProperty
361 aProperty( Env(), o_table);
362 aProperty.Produce_byData( i_ce );