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