Bump for 3.6-28
[LibreOffice.git] / autodoc / source / display / idl / hfi_service.cxx
blobad19d336e7f1297cd729ddc0a8de0e6facfda512
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 ************************************************************************/
29 #include <precomp.h>
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"
51 extern const String
52 C_sCePrefix_Service("service");
54 namespace
57 const String
58 C_sList_IncludedServices("Services' Summary");
59 const String
60 C_sList_IncludedServices_Heading("Included Services - Summary");
61 const String
62 C_sList_IncludedServices_Label("ServicesSummary");
63 const String
64 C_sList_IncludedServicesDetails("Services' Details");
65 const String
66 C_sList_IncludedServicesDetails_Heading("Included Services - Details");
67 const String
68 C_sList_IncludedServicesDetails_Label("ServicesDetails");
69 const String
70 C_sList_ExportedInterfaces("Interfaces' Summary");
71 const String
72 C_sList_ExportedInterfaces_Heading("Exported Interfaces - Summary");
73 const String
74 C_sList_ExportedInterfaces_Label("InterfacesSummary");
75 const String
76 C_sList_ExportedInterfacesDetails("Interfaces' Details");
77 const String
78 C_sList_ExportedInterfacesDetails_Heading("Exported Interfaces - Details");
79 const String
80 C_sList_ExportedInterfacesDetails_Label("InterfacesDetails");
81 const String
82 C_sList_Properties("Properties' Summary");
83 const String
84 C_sList_Properties_Label("PropertiesSummary");
85 const String
86 C_sList_PropertiesDetails("Properties' Details");
87 const String
88 C_sList_PropertiesDetails_Label("PropertiesDetails");
91 enum E_SubListIndices
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
116 ServiceAttr;
117 typedef ::ary::Dyn_StdConstIterator< ::ary::idl::CommentedRelation >
118 dyn_comref_list;
120 void
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(
133 CurOut(),
134 bSummaryOnly ? i_summaryLabel : i_detailsLabel,
135 bSummaryOnly ? i_summaryTitle : i_detailsTitle,
136 2 );
138 for ( ; it_list; ++it_list )
140 Xml::Element &
141 rRow = aTable.Add_Row();
143 if ( bSummaryOnly )
145 produce_Link(rRow, (*it_list).Type());
146 produce_LinkSummary(i_ce, rRow, *it_list);
148 else
150 HF_IdlCommentedRelationElement
151 aRelation( Env(), aTable, *it_list );
152 aRelation.Produce_byData( i_ce );
154 } // end for
157 void
158 HF_IdlService::Produce_byData( const client & i_ce ) const
160 Dyn<HF_NaviSubRow>
161 pNaviSubRow( &make_Navibar(i_ce) );
163 HF_TitleTable
164 aTitle(CurOut());
165 HF_LinkedNameChain
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();
174 // produce ...
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,
209 C_sList_Properties,
210 C_sList_Properties_Label,
211 C_sList_PropertiesDetails,
212 C_sList_PropertiesDetails_Label,
213 viewtype_summary );
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,
226 doctype_complete );
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,
239 doctype_complete );
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,
248 C_sList_Properties,
249 C_sList_Properties_Label,
250 C_sList_PropertiesDetails,
251 C_sList_PropertiesDetails_Label,
252 viewtype_details );
253 pNaviSubRow->SwitchOn(sli_PropertiesDetails);
256 pNaviSubRow->Produce_Row();
257 CurOut() << new Xml::XmlCode("<br>&nbsp;");
260 typedef ary::idl::ifc_property::attr PropertyAttr;
262 void
263 HF_IdlService::produce_SummaryDeclaration( Xml::Element & o_row,
264 const client & i_property ) const
266 // KORR_FUTURE
267 // Put this in to HF_IdlProperty!
269 Xml::Element &
270 rCell = o_row
271 >> *new Html::TableCell
272 << new Html::ClassAttr( C_sCellStyle_SummaryLeft );
274 if (PropertyAttr::HasAnyStereotype(i_property))
276 rCell << "[ ";
277 if (PropertyAttr::IsReadOnly(i_property))
278 rCell << "readonly ";
279 if (PropertyAttr::IsBound(i_property))
280 rCell << "bound ";
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 ";
293 rCell << "] ";
294 } // end if
296 HF_IdlTypeText
297 aType( Env(), rCell, true );
298 aType.Produce_byData( PropertyAttr::Type(i_property) );
300 StreamLock aLocalLink(100);
301 aLocalLink() << "#" << i_property.LocalName();
302 rCell
303 << new Html::LineBreak
304 >> *new Html::Link( aLocalLink().c_str() )
305 << i_property.LocalName();
308 DYN HF_NaviSubRow &
309 HF_IdlService::make_Navibar( const client & i_ce ) const
311 HF_IdlNavigationBar
312 aNaviBar(Env(), CurOut());
313 aNaviBar.Produce_CeMainRow(i_ce);
315 DYN HF_NaviSubRow &
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();
325 return ret;
328 void
329 HF_IdlService::produce_Link( Xml::Element & o_row,
330 type_id i_type ) const
332 Xml::Element &
333 rCell = o_row
334 >> *new Html::TableCell
335 << new Html::ClassAttr(C_sCellStyle_SummaryLeft);
336 HF_IdlTypeText
337 aText(Env(), rCell, true);
338 aText.Produce_byData(i_type);
341 void
342 HF_IdlService::produce_LinkSummary( const client & i_ce,
343 Xml::Element & o_row,
344 const comref & i_commentedRef ) const
346 Xml::Element &
347 rCell = o_row
348 >> *new Html::TableCell
349 << new Html::ClassAttr(C_sCellStyle_SummaryRight);
351 HF_IdlCommentedRelationElement::produce_LinkDoc( Env(), i_ce, rCell, i_commentedRef, doctype_summaryOnly );
354 void
355 HF_IdlService::produce_MemberDetails( HF_SubTitleTable & o_table,
356 const client & i_ce ) const
358 HF_IdlProperty
359 aProperty( Env(), o_table);
360 aProperty.Produce_byData( i_ce );
365 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */