1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hfi_service.cxx,v $
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 ************************************************************************/
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"
54 C_sCePrefix_Service("service");
60 C_sList_IncludedServices("Services' Summary");
62 C_sList_IncludedServices_Heading("Included Services - Summary");
64 C_sList_IncludedServices_Label("ServicesSummary");
66 C_sList_IncludedServicesDetails("Services' Details");
68 C_sList_IncludedServicesDetails_Heading("Included Services - Details");
70 C_sList_IncludedServicesDetails_Label("ServicesDetails");
72 C_sList_ExportedInterfaces("Interfaces' Summary");
74 C_sList_ExportedInterfaces_Heading("Exported Interfaces - Summary");
76 C_sList_ExportedInterfaces_Label("InterfacesSummary");
78 C_sList_ExportedInterfacesDetails("Interfaces' Details");
80 C_sList_ExportedInterfacesDetails_Heading("Exported Interfaces - Details");
82 C_sList_ExportedInterfacesDetails_Label("InterfacesDetails");
84 C_sList_Properties("Properties' Summary");
86 C_sList_Properties_Label("PropertiesSummary");
88 C_sList_PropertiesDetails("Properties' Details");
90 C_sList_PropertiesDetails_Label("PropertiesDetails");
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
119 typedef ::ary::Dyn_StdConstIterator
< ::ary::idl::CommentedRelation
>
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(
136 bSummaryOnly
? i_summaryLabel
: i_detailsLabel
,
137 bSummaryOnly
? i_summaryTitle
: i_detailsTitle
,
140 for ( ; it_list
; ++it_list
)
143 rRow
= aTable
.Add_Row();
147 produce_Link(rRow
, (*it_list
).Type());
148 produce_LinkSummary(i_ce
, rRow
, *it_list
);
152 HF_IdlCommentedRelationElement
153 aRelation( Env(), aTable
, *it_list
);
154 aRelation
.Produce_byData( i_ce
);
160 HF_IdlService::Produce_byData( const client
& i_ce
) const
163 pNaviSubRow( &make_Navibar(i_ce
) );
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();
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
,
212 C_sList_Properties_Label
,
213 C_sList_PropertiesDetails
,
214 C_sList_PropertiesDetails_Label
,
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
,
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
,
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
,
251 C_sList_Properties_Label
,
252 C_sList_PropertiesDetails
,
253 C_sList_PropertiesDetails_Label
,
255 pNaviSubRow
->SwitchOn(sli_PropertiesDetails
);
258 pNaviSubRow
->Produce_Row();
259 CurOut() << new Xml::XmlCode("<br> ");
262 typedef ary::idl::ifc_property::attr PropertyAttr
;
265 HF_IdlService::produce_SummaryDeclaration( Xml::Element
& o_row
,
266 const client
& i_property
) const
269 // Put this in to HF_IdlProperty!
273 >> *new Html::TableCell
274 << new Html::ClassAttr( C_sCellStyle_SummaryLeft
);
276 if (PropertyAttr::HasAnyStereotype(i_property
))
279 if (PropertyAttr::IsReadOnly(i_property
))
280 rCell
<< "readonly ";
281 if (PropertyAttr::IsBound(i_property
))
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 ";
299 aType( Env(), rCell
, true );
300 aType
.Produce_byData( PropertyAttr::Type(i_property
) );
302 StreamLock
aLocalLink(100);
303 aLocalLink() << "#" << i_property
.LocalName();
305 << new Html::LineBreak
306 >> *new Html::Link( aLocalLink().c_str() )
307 << i_property
.LocalName();
311 HF_IdlService::make_Navibar( const client
& i_ce
) const
314 aNaviBar(Env(), CurOut());
315 aNaviBar
.Produce_CeMainRow(i_ce
);
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();
331 HF_IdlService::produce_Link( Xml::Element
& o_row
,
332 type_id i_type
) const
336 >> *new Html::TableCell
337 << new Html::ClassAttr(C_sCellStyle_SummaryLeft
);
339 aText(Env(), rCell
, true);
340 aText
.Produce_byData(i_type
);
344 HF_IdlService::produce_LinkSummary( const client
& i_ce
,
345 Xml::Element
& o_row
,
346 const comref
& i_commentedRef
) const
350 >> *new Html::TableCell
351 << new Html::ClassAttr(C_sCellStyle_SummaryRight
);
353 HF_IdlCommentedRelationElement::produce_LinkDoc( Env(), i_ce
, rCell
, i_commentedRef
, doctype_summaryOnly
);
357 HF_IdlService::produce_MemberDetails( HF_SubTitleTable
& o_table
,
358 const client
& i_ce
) const
361 aProperty( Env(), o_table
);
362 aProperty
.Produce_byData( i_ce
);