fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / autodoc / source / display / idl / hfi_interface.cxx
blob1d6f59ece10be2a0e1d16d1b4df4190e5df96f3a
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_interface.hxx"
24 // NOT FULLY DEFINED SERVICES
25 #include <ary/idl/i_ce.hxx>
26 #include <ary/idl/i_gate.hxx>
27 #include <ary/idl/ik_function.hxx>
28 #include <ary/idl/ik_interface.hxx>
29 #include <ary/idl/ip_ce.hxx>
30 #include <ary/idl/ip_type.hxx>
31 #include <toolkit/hf_docentry.hxx>
32 #include <toolkit/hf_linachain.hxx>
33 #include <toolkit/hf_navi_sub.hxx>
34 #include <toolkit/hf_title.hxx>
35 #include "hfi_doc.hxx"
36 #include "hfi_hierarchy.hxx"
37 #include "hfi_method.hxx"
38 #include "hfi_navibar.hxx"
39 #include "hfi_property.hxx"
40 #include "hfi_tag.hxx"
41 #include "hfi_typetext.hxx"
42 #include "hi_linkhelper.hxx"
45 extern const String
46 C_sCePrefix_Interface("interface");
48 namespace
51 const String
52 C_sBaseInterface("Base Interfaces");
53 const String
54 C_sList_BaseComments("Comments on Base Interfaces");
55 const String
56 C_sList_Methods("Methods' Summary");
57 const String
58 C_sList_Methods_Label("MethodsSummary");
59 const String
60 C_sDetails_Methods("Methods' Details");
61 const String
62 C_sDetails_Methods_Label("MethodsDetails");
64 const String
65 C_sList_Attributes("Attributes' Summary");
66 const String
67 C_sList_Attributes_Label("AttributesSummary");
68 const String
69 C_sList_AttributesDetails("Attributes' Details");
70 const String
71 C_sList_AttributesDetails_Label("AttributesDetails");
75 enum E_SubListIndices
77 sli_MethodsSummay = 0,
78 sli_AttributesSummary = 1,
79 sli_MethodDetails = 2,
80 sli_AttributesDetails = 3
83 } //anonymous namespace
88 HF_IdlInterface::HF_IdlInterface( Environment & io_rEnv,
89 Xml::Element & o_rOut )
90 : HtmlFactory_Idl(io_rEnv, &o_rOut),
91 eCurProducedMembers(mem_none)
95 HF_IdlInterface::~HF_IdlInterface()
99 void
100 HF_IdlInterface::Produce_byData( const client & i_ce ) const
102 Dyn<HF_NaviSubRow>
103 pNaviSubRow( &make_Navibar(i_ce) );
105 HF_TitleTable
106 aTitle(CurOut());
108 HF_LinkedNameChain
109 aNameChain(aTitle.Add_Row());
110 aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker);
112 produce_Title(aTitle, C_sCePrefix_Interface, i_ce);
114 produce_BaseHierarchy( aTitle.Add_Row(),
115 i_ce,
116 C_sBaseInterface );
118 write_Docu(aTitle.Add_Row(), i_ce);
119 CurOut() << new Html::HorizontalLine();
121 dyn_ce_list dpFunctions;
122 ary::idl::ifc_interface::attr::Get_Functions(dpFunctions, i_ce);
123 if ( (*dpFunctions).operator bool() )
125 eCurProducedMembers = mem_Functions;
127 produce_Members( *dpFunctions,
128 C_sList_Methods,
129 C_sList_Methods_Label,
130 C_sDetails_Methods,
131 C_sDetails_Methods_Label,
132 HtmlFactory_Idl::viewtype_summary );
133 pNaviSubRow->SwitchOn(sli_MethodsSummay);
136 dyn_ce_list
137 dpAttributes;
138 ary::idl::ifc_interface::attr::Get_Attributes(dpAttributes, i_ce);
139 if ( (*dpAttributes).operator bool() )
141 eCurProducedMembers = mem_Attributes;
143 produce_Members( *dpAttributes,
144 C_sList_Attributes,
145 C_sList_Attributes_Label,
146 C_sList_AttributesDetails,
147 C_sList_AttributesDetails_Label,
148 HtmlFactory_Idl::viewtype_summary );
149 pNaviSubRow->SwitchOn(sli_AttributesSummary);
152 ary::idl::ifc_interface::attr::Get_Functions(dpFunctions, i_ce);
153 if ( (*dpFunctions).operator bool() )
155 eCurProducedMembers = mem_Functions;
157 produce_Members( *dpFunctions,
158 C_sList_Methods,
159 C_sList_Methods_Label,
160 C_sDetails_Methods,
161 C_sDetails_Methods_Label,
162 HtmlFactory_Idl::viewtype_details );
163 pNaviSubRow->SwitchOn(sli_MethodDetails);
166 ary::idl::ifc_interface::attr::Get_Attributes(dpAttributes, i_ce);
167 if ( (*dpAttributes).operator bool() )
169 eCurProducedMembers = mem_Attributes;
171 produce_Members( *dpAttributes,
172 C_sList_Attributes,
173 C_sList_Attributes_Label,
174 C_sList_AttributesDetails,
175 C_sList_AttributesDetails_Label,
176 HtmlFactory_Idl::viewtype_details );
177 pNaviSubRow->SwitchOn(sli_AttributesDetails);
180 eCurProducedMembers = mem_none;
182 pNaviSubRow->Produce_Row();
185 DYN HF_NaviSubRow &
186 HF_IdlInterface::make_Navibar( const client & i_ce ) const
188 HF_IdlNavigationBar
189 aNaviBar(Env(), CurOut());
190 aNaviBar.Produce_CeMainRow(i_ce);
192 DYN HF_NaviSubRow &
193 ret = aNaviBar.Add_SubRow();
194 ret.AddItem(C_sList_Methods, C_sList_Methods_Label, false);
195 ret.AddItem(C_sList_Attributes, C_sList_Attributes_Label, false);
196 ret.AddItem(C_sDetails_Methods, C_sDetails_Methods_Label, false);
197 ret.AddItem(C_sList_AttributesDetails, C_sList_AttributesDetails_Label, false);
199 CurOut() << new Html::HorizontalLine();
200 return ret;
203 void
204 HF_IdlInterface::produce_MemberDetails( HF_SubTitleTable & o_table,
205 const client & i_ce ) const
207 switch (eCurProducedMembers)
209 case mem_Functions:
210 break;
211 case mem_Attributes:
213 HF_IdlAttribute
214 aAttribute( Env(), o_table);
215 aAttribute.Produce_byData( i_ce );
216 return;
218 default: //Won't happen.
219 return;
220 } // end switch
222 typedef ary::idl::ifc_function::attr funcAttr;
224 HF_IdlMethod
225 aFunction( Env(),
226 o_table.Add_Row()
227 >> *new Html::TableCell
228 << new Html::ClassAttr(C_sCellStyle_MDetail) );
230 ary::Dyn_StdConstIterator<ary::idl::Parameter>
231 pParameters;
232 funcAttr::Get_Parameters(pParameters, i_ce);
234 ary::Dyn_StdConstIterator<ary::idl::Type_id>
235 pExceptions;
236 funcAttr::Get_Exceptions(pExceptions, i_ce);
238 aFunction.Produce_byData( i_ce.LocalName(),
239 funcAttr::ReturnType(i_ce),
240 *pParameters,
241 *pExceptions,
242 funcAttr::IsOneway(i_ce),
243 funcAttr::HasEllipse(i_ce),
244 i_ce );
247 void
248 HF_IdlInterface::produce_BaseHierarchy( Xml::Element & o_screen,
249 const client & i_ce,
250 const String & i_sLabel ) const
252 ary::Dyn_StdConstIterator<ary::idl::CommentedRelation>
253 pHelp;
254 ary::idl::ifc_interface::attr::Get_Bases(pHelp, i_ce);
255 if (NOT (*pHelp).operator bool())
256 return;
258 // Check for XInterface as only base:
259 ary::StdConstIterator<ary::idl::CommentedRelation> &
260 itTest = *pHelp;
261 ary::idl::Ce_id
262 nCe = Env().Gate().Types().Search_CeRelatedTo((*itTest).Type());
263 if (nCe.IsValid())
265 // KORR_FUTURE
266 // Rather check for id(!) of com::sun::star::uno::XInterface.
267 if (Env().Gate().Ces().Find_Ce(nCe).LocalName() == "XInterface")
269 ++itTest;
270 if (NOT itTest.operator bool())
271 return;
275 // Write hierarchy:
277 HF_DocEntryList
278 aDocList( o_screen );
279 aDocList.Produce_Term(i_sLabel);
280 Xml::Element &
281 rBaseList = aDocList.Produce_Definition();
283 // NEW
284 Write_BaseHierarchy(rBaseList, Env(), i_ce);
286 // Write comments:
287 // KORR_FUTURE: Make sure, no empty table is constructed when comments list is empty.
288 HF_SubTitleTable
289 aBaseTable( aDocList.Produce_Definition(),
291 C_sList_BaseComments,
293 HF_SubTitleTable::sublevel_3 );
295 ary::Dyn_StdConstIterator<ary::idl::CommentedRelation>
296 pBases;
297 ary::idl::ifc_interface::attr::Get_Bases(pBases, i_ce);
298 for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *pBases;
299 it.operator bool();
300 ++it )
302 Xml::Element &
303 rRow = aBaseTable.Add_Row();
305 Xml::Element &
306 rTerm = rRow
307 >> *new Html::TableCell
308 << new Html::ClassAttr(C_sCellStyle_SummaryLeft);
309 HF_IdlTypeText
310 aTypeDisplay( Env(), rTerm, 0);
311 aTypeDisplay.Produce_byData((*it).Type());
313 Xml::Element &
314 rDocu = rRow
315 >> *new Html::TableCell
316 << new Html::ClassAttr(C_sCellStyle_SummaryRight);
318 HF_DocEntryList
319 aDocuList(rDocu);
321 if ((*it).Info() != 0)
323 // aDocuList.Produce_Term("Comment on Base Reference");
325 HF_IdlDocu
326 aDocuDisplay(Env(), aDocuList);
327 aDocuDisplay.Produce_fromReference(*(*it).Info(), i_ce);
329 else
331 const client *
332 pCe = Env().Linker().Search_CeFromType((*it).Type());
333 const ce_info *
334 pShort = pCe != 0
335 ? Get_IdlDocu(pCe->Docu())
336 : (const ce_info *)(0);
337 if ( pShort != 0 )
339 aDocuList.Produce_NormalTerm("(referenced interface's summary:)");
341 Xml::Element &
342 rDef = aDocuList.Produce_Definition();
343 HF_IdlDocuTextDisplay
344 aShortDisplay( Env(), &rDef, *pCe);
345 pShort->Short().DisplayAt(aShortDisplay);
346 } // end if (pShort != 0)
347 } // endif ( (*i_commentedRef).Info() != 0 ) else
348 } // end for
351 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */