1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include "hfi_service.hxx"
33 // NOT FULLY DEFINED SERVICES
34 #include <ary/idl/i_ce.hxx>
35 #include <ary/idl/ik_property.hxx>
36 #include <ary/idl/ik_service.hxx>
37 #include <toolkit/hf_docentry.hxx>
38 #include <toolkit/hf_linachain.hxx>
39 #include <toolkit/hf_navi_sub.hxx>
40 #include <toolkit/hf_title.hxx>
41 #include "hfi_doc.hxx"
42 #include "hfi_navibar.hxx"
43 #include "hfi_property.hxx"
44 #include "hfi_tag.hxx"
45 #include "hfi_typetext.hxx"
46 #include "hi_linkhelper.hxx"
52 C_sCePrefix_Service("service");
58 C_sList_IncludedServices("Services' Summary");
60 C_sList_IncludedServices_Heading("Included Services - Summary");
62 C_sList_IncludedServices_Label("ServicesSummary");
64 C_sList_IncludedServicesDetails("Services' Details");
66 C_sList_IncludedServicesDetails_Heading("Included Services - Details");
68 C_sList_IncludedServicesDetails_Label("ServicesDetails");
70 C_sList_ExportedInterfaces("Interfaces' Summary");
72 C_sList_ExportedInterfaces_Heading("Exported Interfaces - Summary");
74 C_sList_ExportedInterfaces_Label("InterfacesSummary");
76 C_sList_ExportedInterfacesDetails("Interfaces' Details");
78 C_sList_ExportedInterfacesDetails_Heading("Exported Interfaces - Details");
80 C_sList_ExportedInterfacesDetails_Label("InterfacesDetails");
82 C_sList_Properties("Properties' Summary");
84 C_sList_Properties_Label("PropertiesSummary");
86 C_sList_PropertiesDetails("Properties' Details");
88 C_sList_PropertiesDetails_Label("PropertiesDetails");
93 sli_IncludedServicesSummary
= 0,
94 sli_InterfacesSummary
= 1,
95 sli_PropertiesSummary
= 2,
96 sli_IncludedServicesDetails
= 3,
97 sli_InterfacesDetails
= 4,
98 sli_PropertiesDetails
= 5
101 } //anonymous namespace
104 HF_IdlService::HF_IdlService( Environment
& io_rEnv
,
105 Xml::Element
& o_rOut
)
106 : HtmlFactory_Idl(io_rEnv
, &o_rOut
)
110 HF_IdlService::~HF_IdlService()
115 typedef ::ary::idl::ifc_service::attr
117 typedef ::ary::Dyn_StdConstIterator
< ::ary::idl::CommentedRelation
>
121 HF_IdlService::produce_CommentedRelations( const client
& i_ce
,
122 comref_list
& it_list
,
123 const String
& i_summaryTitle
,
124 const String
& i_summaryLabel
,
125 const String
& i_detailsTitle
,
126 const String
& i_detailsLabel
,
127 const E_DocType i_docType
) const
129 csv_assert( it_list
);
131 bool bSummaryOnly
= ( i_docType
== doctype_summaryOnly
);
132 HF_SubTitleTable
aTable(
134 bSummaryOnly
? i_summaryLabel
: i_detailsLabel
,
135 bSummaryOnly
? i_summaryTitle
: i_detailsTitle
,
138 for ( ; it_list
; ++it_list
)
141 rRow
= aTable
.Add_Row();
145 produce_Link(rRow
, (*it_list
).Type());
146 produce_LinkSummary(i_ce
, rRow
, *it_list
);
150 HF_IdlCommentedRelationElement
151 aRelation( Env(), aTable
, *it_list
);
152 aRelation
.Produce_byData( i_ce
);
158 HF_IdlService::Produce_byData( const client
& i_ce
) const
161 pNaviSubRow( &make_Navibar(i_ce
) );
166 aNameChain(aTitle
.Add_Row());
168 aNameChain
.Produce_CompleteChain(Env().CurPosition(), nameChainLinker
);
169 produce_Title(aTitle
, C_sCePrefix_Service
, i_ce
);
171 write_Docu(aTitle
.Add_Row(), i_ce
);
172 CurOut() << new Html::HorizontalLine();
175 // - included services: summary
176 dyn_comref_list dpIncludedServices
;
177 ServiceAttr::Get_IncludedServices(dpIncludedServices
, i_ce
);
178 if ( (*dpIncludedServices
).operator bool() )
180 produce_CommentedRelations( i_ce
, *dpIncludedServices
,
181 C_sList_IncludedServices_Heading
,
182 C_sList_IncludedServices_Label
,
183 C_sList_IncludedServicesDetails_Heading
,
184 C_sList_IncludedServicesDetails_Label
,
185 doctype_summaryOnly
);
186 pNaviSubRow
->SwitchOn(sli_IncludedServicesSummary
);
189 // - exported interfaces: summary
190 dyn_comref_list dpExportedInterfaces
;
191 ServiceAttr::Get_ExportedInterfaces(dpExportedInterfaces
, i_ce
);
192 if ( (*dpExportedInterfaces
).operator bool() )
194 produce_CommentedRelations( i_ce
, *dpExportedInterfaces
,
195 C_sList_ExportedInterfaces_Heading
,
196 C_sList_ExportedInterfaces_Label
,
197 C_sList_ExportedInterfacesDetails_Heading
,
198 C_sList_ExportedInterfacesDetails_Label
,
199 doctype_summaryOnly
);
200 pNaviSubRow
->SwitchOn(sli_InterfacesSummary
);
203 // - supported properties: summary
204 dyn_ce_list dpProperties
;
205 ServiceAttr::Get_Properties(dpProperties
, i_ce
);
206 if ( (*dpProperties
).operator bool() )
208 produce_Members( *dpProperties
,
210 C_sList_Properties_Label
,
211 C_sList_PropertiesDetails
,
212 C_sList_PropertiesDetails_Label
,
214 pNaviSubRow
->SwitchOn(sli_PropertiesSummary
);
217 // - included services: details
218 ServiceAttr::Get_IncludedServices(dpIncludedServices
, i_ce
);
219 if ( (*dpIncludedServices
).operator bool() )
221 produce_CommentedRelations( i_ce
, *dpIncludedServices
,
222 C_sList_IncludedServices_Heading
,
223 C_sList_IncludedServices_Label
,
224 C_sList_IncludedServicesDetails_Heading
,
225 C_sList_IncludedServicesDetails_Label
,
227 pNaviSubRow
->SwitchOn(sli_IncludedServicesDetails
);
230 // - exported interfaces: details
231 ServiceAttr::Get_ExportedInterfaces(dpExportedInterfaces
, i_ce
);
232 if ( (*dpExportedInterfaces
).operator bool() )
234 produce_CommentedRelations( i_ce
, *dpExportedInterfaces
,
235 C_sList_ExportedInterfaces_Heading
,
236 C_sList_ExportedInterfaces_Label
,
237 C_sList_ExportedInterfacesDetails_Heading
,
238 C_sList_ExportedInterfacesDetails_Label
,
240 pNaviSubRow
->SwitchOn(sli_InterfacesDetails
);
243 // supported properties: details
244 ServiceAttr::Get_Properties(dpProperties
, i_ce
);
245 if ( (*dpProperties
).operator bool() )
247 produce_Members( *dpProperties
,
249 C_sList_Properties_Label
,
250 C_sList_PropertiesDetails
,
251 C_sList_PropertiesDetails_Label
,
253 pNaviSubRow
->SwitchOn(sli_PropertiesDetails
);
256 pNaviSubRow
->Produce_Row();
257 CurOut() << new Xml::XmlCode("<br> ");
260 typedef ary::idl::ifc_property::attr PropertyAttr
;
263 HF_IdlService::produce_SummaryDeclaration( Xml::Element
& o_row
,
264 const client
& i_property
) const
267 // Put this in to HF_IdlProperty!
271 >> *new Html::TableCell
272 << new Html::ClassAttr( C_sCellStyle_SummaryLeft
);
274 if (PropertyAttr::HasAnyStereotype(i_property
))
277 if (PropertyAttr::IsReadOnly(i_property
))
278 rCell
<< "readonly ";
279 if (PropertyAttr::IsBound(i_property
))
281 if (PropertyAttr::IsConstrained(i_property
))
282 rCell
<< "constrained ";
283 if (PropertyAttr::IsMayBeAmbiguous(i_property
))
284 rCell
<< "maybeambiguous ";
285 if (PropertyAttr::IsMayBeDefault(i_property
))
286 rCell
<< "maybedefault ";
287 if (PropertyAttr::IsMayBeVoid(i_property
))
288 rCell
<< "maybevoid ";
289 if (PropertyAttr::IsRemovable(i_property
))
290 rCell
<< "removable ";
291 if (PropertyAttr::IsTransient(i_property
))
292 rCell
<< "transient ";
297 aType( Env(), rCell
, true );
298 aType
.Produce_byData( PropertyAttr::Type(i_property
) );
300 StreamLock
aLocalLink(100);
301 aLocalLink() << "#" << i_property
.LocalName();
303 << new Html::LineBreak
304 >> *new Html::Link( aLocalLink().c_str() )
305 << i_property
.LocalName();
309 HF_IdlService::make_Navibar( const client
& i_ce
) const
312 aNaviBar(Env(), CurOut());
313 aNaviBar
.Produce_CeMainRow(i_ce
);
316 ret
= aNaviBar
.Add_SubRow();
317 ret
.AddItem(C_sList_IncludedServices
, C_sList_IncludedServices_Label
, false);
318 ret
.AddItem(C_sList_ExportedInterfaces
, C_sList_ExportedInterfaces_Label
, false);
319 ret
.AddItem(C_sList_Properties
, C_sList_Properties_Label
, false);
320 ret
.AddItem(C_sList_IncludedServicesDetails
, C_sList_IncludedServicesDetails_Label
, false);
321 ret
.AddItem(C_sList_ExportedInterfacesDetails
, C_sList_ExportedInterfacesDetails_Label
, false);
322 ret
.AddItem(C_sList_PropertiesDetails
, C_sList_PropertiesDetails_Label
, false);
324 CurOut() << new Html::HorizontalLine();
329 HF_IdlService::produce_Link( Xml::Element
& o_row
,
330 type_id i_type
) const
334 >> *new Html::TableCell
335 << new Html::ClassAttr(C_sCellStyle_SummaryLeft
);
337 aText(Env(), rCell
, true);
338 aText
.Produce_byData(i_type
);
342 HF_IdlService::produce_LinkSummary( const client
& i_ce
,
343 Xml::Element
& o_row
,
344 const comref
& i_commentedRef
) const
348 >> *new Html::TableCell
349 << new Html::ClassAttr(C_sCellStyle_SummaryRight
);
351 HF_IdlCommentedRelationElement::produce_LinkDoc( Env(), i_ce
, rCell
, i_commentedRef
, doctype_summaryOnly
);
355 HF_IdlService::produce_MemberDetails( HF_SubTitleTable
& o_table
,
356 const client
& i_ce
) const
359 aProperty( Env(), o_table
);
360 aProperty
.Produce_byData( i_ce
);
365 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */