fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / autodoc / source / display / idl / hfi_service.cxx
blob97073b691279592c5935d4b065015e40cfbf5171
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <precomp.h>
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"
42 extern const String
43 C_sCePrefix_Service("service");
45 namespace
48 const String
49 C_sList_IncludedServices("Services' Summary");
50 const String
51 C_sList_IncludedServices_Heading("Included Services - Summary");
52 const String
53 C_sList_IncludedServices_Label("ServicesSummary");
54 const String
55 C_sList_IncludedServicesDetails("Services' Details");
56 const String
57 C_sList_IncludedServicesDetails_Heading("Included Services - Details");
58 const String
59 C_sList_IncludedServicesDetails_Label("ServicesDetails");
60 const String
61 C_sList_ExportedInterfaces("Interfaces' Summary");
62 const String
63 C_sList_ExportedInterfaces_Heading("Exported Interfaces - Summary");
64 const String
65 C_sList_ExportedInterfaces_Label("InterfacesSummary");
66 const String
67 C_sList_ExportedInterfacesDetails("Interfaces' Details");
68 const String
69 C_sList_ExportedInterfacesDetails_Heading("Exported Interfaces - Details");
70 const String
71 C_sList_ExportedInterfacesDetails_Label("InterfacesDetails");
72 const String
73 C_sList_Properties("Properties' Summary");
74 const String
75 C_sList_Properties_Label("PropertiesSummary");
76 const String
77 C_sList_PropertiesDetails("Properties' Details");
78 const String
79 C_sList_PropertiesDetails_Label("PropertiesDetails");
82 enum E_SubListIndices
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
107 ServiceAttr;
108 typedef ::ary::Dyn_StdConstIterator< ::ary::idl::CommentedRelation >
109 dyn_comref_list;
111 void
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(
124 CurOut(),
125 bSummaryOnly ? i_summaryLabel : i_detailsLabel,
126 bSummaryOnly ? i_summaryTitle : i_detailsTitle,
127 2 );
129 for ( ; it_list; ++it_list )
131 Xml::Element &
132 rRow = aTable.Add_Row();
134 if ( bSummaryOnly )
136 produce_Link(rRow, (*it_list).Type());
137 produce_LinkSummary(i_ce, rRow, *it_list);
139 else
141 HF_IdlCommentedRelationElement
142 aRelation( Env(), aTable, *it_list );
143 aRelation.Produce_byData( i_ce );
145 } // end for
148 void
149 HF_IdlService::Produce_byData( const client & i_ce ) const
151 Dyn<HF_NaviSubRow>
152 pNaviSubRow( &make_Navibar(i_ce) );
154 HF_TitleTable
155 aTitle(CurOut());
156 HF_LinkedNameChain
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();
165 // produce ...
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,
200 C_sList_Properties,
201 C_sList_Properties_Label,
202 C_sList_PropertiesDetails,
203 C_sList_PropertiesDetails_Label,
204 viewtype_summary );
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,
217 doctype_complete );
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,
230 doctype_complete );
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,
239 C_sList_Properties,
240 C_sList_Properties_Label,
241 C_sList_PropertiesDetails,
242 C_sList_PropertiesDetails_Label,
243 viewtype_details );
244 pNaviSubRow->SwitchOn(sli_PropertiesDetails);
247 pNaviSubRow->Produce_Row();
248 CurOut() << new Xml::XmlCode("<br>&nbsp;");
251 typedef ary::idl::ifc_property::attr PropertyAttr;
253 void
254 HF_IdlService::produce_SummaryDeclaration( Xml::Element & o_row,
255 const client & i_property ) const
257 // KORR_FUTURE
258 // Put this in to HF_IdlProperty!
260 Xml::Element &
261 rCell = o_row
262 >> *new Html::TableCell
263 << new Html::ClassAttr( C_sCellStyle_SummaryLeft );
265 if (PropertyAttr::HasAnyStereotype(i_property))
267 rCell << "[ ";
268 if (PropertyAttr::IsReadOnly(i_property))
269 rCell << "readonly ";
270 if (PropertyAttr::IsBound(i_property))
271 rCell << "bound ";
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 ";
284 rCell << "] ";
285 } // end if
287 HF_IdlTypeText
288 aType( Env(), rCell );
289 aType.Produce_byData( PropertyAttr::Type(i_property) );
291 StreamLock aLocalLink(100);
292 aLocalLink() << "#" << i_property.LocalName();
293 rCell
294 << new Html::LineBreak
295 >> *new Html::Link( aLocalLink().c_str() )
296 << i_property.LocalName();
299 DYN HF_NaviSubRow &
300 HF_IdlService::make_Navibar( const client & i_ce ) const
302 HF_IdlNavigationBar
303 aNaviBar(Env(), CurOut());
304 aNaviBar.Produce_CeMainRow(i_ce);
306 DYN HF_NaviSubRow &
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();
316 return ret;
319 void
320 HF_IdlService::produce_Link( Xml::Element & o_row,
321 type_id i_type ) const
323 Xml::Element &
324 rCell = o_row
325 >> *new Html::TableCell
326 << new Html::ClassAttr(C_sCellStyle_SummaryLeft);
327 HF_IdlTypeText
328 aText(Env(), rCell);
329 aText.Produce_byData(i_type);
332 void
333 HF_IdlService::produce_LinkSummary( const client & i_ce,
334 Xml::Element & o_row,
335 const comref & i_commentedRef ) const
337 Xml::Element &
338 rCell = o_row
339 >> *new Html::TableCell
340 << new Html::ClassAttr(C_sCellStyle_SummaryRight);
342 HF_IdlCommentedRelationElement::produce_LinkDoc( Env(), i_ce, rCell, i_commentedRef, doctype_summaryOnly );
345 void
346 HF_IdlService::produce_MemberDetails( HF_SubTitleTable & o_table,
347 const client & i_ce ) const
349 HF_IdlProperty
350 aProperty( Env(), o_table);
351 aProperty.Produce_byData( i_ce );
356 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */