1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "hfi_service.hxx"
24 // NOT FULLY DEFINED SERVICES
25 #include <ary/idl/i_ce.hxx>
26 #include <ary/idl/ik_property.hxx>
27 #include <ary/idl/ik_service.hxx>
28 #include <toolkit/hf_docentry.hxx>
29 #include <toolkit/hf_linachain.hxx>
30 #include <toolkit/hf_navi_sub.hxx>
31 #include <toolkit/hf_title.hxx>
32 #include "hfi_doc.hxx"
33 #include "hfi_navibar.hxx"
34 #include "hfi_property.hxx"
35 #include "hfi_tag.hxx"
36 #include "hfi_typetext.hxx"
37 #include "hi_linkhelper.hxx"
43 C_sCePrefix_Service("service");
49 C_sList_IncludedServices("Services' Summary");
51 C_sList_IncludedServices_Heading("Included Services - Summary");
53 C_sList_IncludedServices_Label("ServicesSummary");
55 C_sList_IncludedServicesDetails("Services' Details");
57 C_sList_IncludedServicesDetails_Heading("Included Services - Details");
59 C_sList_IncludedServicesDetails_Label("ServicesDetails");
61 C_sList_ExportedInterfaces("Interfaces' Summary");
63 C_sList_ExportedInterfaces_Heading("Exported Interfaces - Summary");
65 C_sList_ExportedInterfaces_Label("InterfacesSummary");
67 C_sList_ExportedInterfacesDetails("Interfaces' Details");
69 C_sList_ExportedInterfacesDetails_Heading("Exported Interfaces - Details");
71 C_sList_ExportedInterfacesDetails_Label("InterfacesDetails");
73 C_sList_Properties("Properties' Summary");
75 C_sList_Properties_Label("PropertiesSummary");
77 C_sList_PropertiesDetails("Properties' Details");
79 C_sList_PropertiesDetails_Label("PropertiesDetails");
84 sli_IncludedServicesSummary
= 0,
85 sli_InterfacesSummary
= 1,
86 sli_PropertiesSummary
= 2,
87 sli_IncludedServicesDetails
= 3,
88 sli_InterfacesDetails
= 4,
89 sli_PropertiesDetails
= 5
92 } //anonymous namespace
95 HF_IdlService::HF_IdlService( Environment
& io_rEnv
,
96 Xml::Element
& o_rOut
)
97 : HtmlFactory_Idl(io_rEnv
, &o_rOut
)
101 HF_IdlService::~HF_IdlService()
106 typedef ::ary::idl::ifc_service::attr
108 typedef ::ary::Dyn_StdConstIterator
< ::ary::idl::CommentedRelation
>
112 HF_IdlService::produce_CommentedRelations( const client
& i_ce
,
113 comref_list
& it_list
,
114 const String
& i_summaryTitle
,
115 const String
& i_summaryLabel
,
116 const String
& i_detailsTitle
,
117 const String
& i_detailsLabel
,
118 const E_DocType i_docType
) const
120 csv_assert( it_list
);
122 bool bSummaryOnly
= ( i_docType
== doctype_summaryOnly
);
123 HF_SubTitleTable
aTable(
125 bSummaryOnly
? i_summaryLabel
: i_detailsLabel
,
126 bSummaryOnly
? i_summaryTitle
: i_detailsTitle
,
129 for ( ; it_list
; ++it_list
)
132 rRow
= aTable
.Add_Row();
136 produce_Link(rRow
, (*it_list
).Type());
137 produce_LinkSummary(i_ce
, rRow
, *it_list
);
141 HF_IdlCommentedRelationElement
142 aRelation( Env(), aTable
, *it_list
);
143 aRelation
.Produce_byData( i_ce
);
149 HF_IdlService::Produce_byData( const client
& i_ce
) const
152 pNaviSubRow( &make_Navibar(i_ce
) );
157 aNameChain(aTitle
.Add_Row());
159 aNameChain
.Produce_CompleteChain(Env().CurPosition(), nameChainLinker
);
160 produce_Title(aTitle
, C_sCePrefix_Service
, i_ce
);
162 write_Docu(aTitle
.Add_Row(), i_ce
);
163 CurOut() << new Html::HorizontalLine();
166 // - included services: summary
167 dyn_comref_list dpIncludedServices
;
168 ServiceAttr::Get_IncludedServices(dpIncludedServices
, i_ce
);
169 if ( (*dpIncludedServices
).operator bool() )
171 produce_CommentedRelations( i_ce
, *dpIncludedServices
,
172 C_sList_IncludedServices_Heading
,
173 C_sList_IncludedServices_Label
,
174 C_sList_IncludedServicesDetails_Heading
,
175 C_sList_IncludedServicesDetails_Label
,
176 doctype_summaryOnly
);
177 pNaviSubRow
->SwitchOn(sli_IncludedServicesSummary
);
180 // - exported interfaces: summary
181 dyn_comref_list dpExportedInterfaces
;
182 ServiceAttr::Get_ExportedInterfaces(dpExportedInterfaces
, i_ce
);
183 if ( (*dpExportedInterfaces
).operator bool() )
185 produce_CommentedRelations( i_ce
, *dpExportedInterfaces
,
186 C_sList_ExportedInterfaces_Heading
,
187 C_sList_ExportedInterfaces_Label
,
188 C_sList_ExportedInterfacesDetails_Heading
,
189 C_sList_ExportedInterfacesDetails_Label
,
190 doctype_summaryOnly
);
191 pNaviSubRow
->SwitchOn(sli_InterfacesSummary
);
194 // - supported properties: summary
195 dyn_ce_list dpProperties
;
196 ServiceAttr::Get_Properties(dpProperties
, i_ce
);
197 if ( (*dpProperties
).operator bool() )
199 produce_Members( *dpProperties
,
201 C_sList_Properties_Label
,
202 C_sList_PropertiesDetails
,
203 C_sList_PropertiesDetails_Label
,
205 pNaviSubRow
->SwitchOn(sli_PropertiesSummary
);
208 // - included services: details
209 ServiceAttr::Get_IncludedServices(dpIncludedServices
, i_ce
);
210 if ( (*dpIncludedServices
).operator bool() )
212 produce_CommentedRelations( i_ce
, *dpIncludedServices
,
213 C_sList_IncludedServices_Heading
,
214 C_sList_IncludedServices_Label
,
215 C_sList_IncludedServicesDetails_Heading
,
216 C_sList_IncludedServicesDetails_Label
,
218 pNaviSubRow
->SwitchOn(sli_IncludedServicesDetails
);
221 // - exported interfaces: details
222 ServiceAttr::Get_ExportedInterfaces(dpExportedInterfaces
, i_ce
);
223 if ( (*dpExportedInterfaces
).operator bool() )
225 produce_CommentedRelations( i_ce
, *dpExportedInterfaces
,
226 C_sList_ExportedInterfaces_Heading
,
227 C_sList_ExportedInterfaces_Label
,
228 C_sList_ExportedInterfacesDetails_Heading
,
229 C_sList_ExportedInterfacesDetails_Label
,
231 pNaviSubRow
->SwitchOn(sli_InterfacesDetails
);
234 // supported properties: details
235 ServiceAttr::Get_Properties(dpProperties
, i_ce
);
236 if ( (*dpProperties
).operator bool() )
238 produce_Members( *dpProperties
,
240 C_sList_Properties_Label
,
241 C_sList_PropertiesDetails
,
242 C_sList_PropertiesDetails_Label
,
244 pNaviSubRow
->SwitchOn(sli_PropertiesDetails
);
247 pNaviSubRow
->Produce_Row();
248 CurOut() << new Xml::XmlCode("<br> ");
251 typedef ary::idl::ifc_property::attr PropertyAttr
;
254 HF_IdlService::produce_SummaryDeclaration( Xml::Element
& o_row
,
255 const client
& i_property
) const
258 // Put this in to HF_IdlProperty!
262 >> *new Html::TableCell
263 << new Html::ClassAttr( C_sCellStyle_SummaryLeft
);
265 if (PropertyAttr::HasAnyStereotype(i_property
))
268 if (PropertyAttr::IsReadOnly(i_property
))
269 rCell
<< "readonly ";
270 if (PropertyAttr::IsBound(i_property
))
272 if (PropertyAttr::IsConstrained(i_property
))
273 rCell
<< "constrained ";
274 if (PropertyAttr::IsMayBeAmbiguous(i_property
))
275 rCell
<< "maybeambiguous ";
276 if (PropertyAttr::IsMayBeDefault(i_property
))
277 rCell
<< "maybedefault ";
278 if (PropertyAttr::IsMayBeVoid(i_property
))
279 rCell
<< "maybevoid ";
280 if (PropertyAttr::IsRemovable(i_property
))
281 rCell
<< "removable ";
282 if (PropertyAttr::IsTransient(i_property
))
283 rCell
<< "transient ";
288 aType( Env(), rCell
);
289 aType
.Produce_byData( PropertyAttr::Type(i_property
) );
291 StreamLock
aLocalLink(100);
292 aLocalLink() << "#" << i_property
.LocalName();
294 << new Html::LineBreak
295 >> *new Html::Link( aLocalLink().c_str() )
296 << i_property
.LocalName();
300 HF_IdlService::make_Navibar( const client
& i_ce
) const
303 aNaviBar(Env(), CurOut());
304 aNaviBar
.Produce_CeMainRow(i_ce
);
307 ret
= aNaviBar
.Add_SubRow();
308 ret
.AddItem(C_sList_IncludedServices
, C_sList_IncludedServices_Label
, false);
309 ret
.AddItem(C_sList_ExportedInterfaces
, C_sList_ExportedInterfaces_Label
, false);
310 ret
.AddItem(C_sList_Properties
, C_sList_Properties_Label
, false);
311 ret
.AddItem(C_sList_IncludedServicesDetails
, C_sList_IncludedServicesDetails_Label
, false);
312 ret
.AddItem(C_sList_ExportedInterfacesDetails
, C_sList_ExportedInterfacesDetails_Label
, false);
313 ret
.AddItem(C_sList_PropertiesDetails
, C_sList_PropertiesDetails_Label
, false);
315 CurOut() << new Html::HorizontalLine();
320 HF_IdlService::produce_Link( Xml::Element
& o_row
,
321 type_id i_type
) const
325 >> *new Html::TableCell
326 << new Html::ClassAttr(C_sCellStyle_SummaryLeft
);
329 aText
.Produce_byData(i_type
);
333 HF_IdlService::produce_LinkSummary( const client
& i_ce
,
334 Xml::Element
& o_row
,
335 const comref
& i_commentedRef
) const
339 >> *new Html::TableCell
340 << new Html::ClassAttr(C_sCellStyle_SummaryRight
);
342 HF_IdlCommentedRelationElement::produce_LinkDoc( Env(), i_ce
, rCell
, i_commentedRef
, doctype_summaryOnly
);
346 HF_IdlService::produce_MemberDetails( HF_SubTitleTable
& o_table
,
347 const client
& i_ce
) const
350 aProperty( Env(), o_table
);
351 aProperty
.Produce_byData( i_ce
);
356 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */