fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / autodoc / source / display / idl / hfi_module.cxx
blobfc44003e826af1f97af0d1ce88020b74312eedb8
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_module.hxx"
24 // NOT FULLY DEFINED SERVICES
25 #include <ary/idl/i_ce.hxx>
26 #include <ary/idl/i_module.hxx>
27 #include <ary/idl/ik_module.hxx>
28 #include <ary/doc/d_oldidldocu.hxx>
29 #include <ary/getncast.hxx>
30 #include <toolkit/hf_docentry.hxx>
31 #include <toolkit/hf_linachain.hxx>
32 #include <toolkit/hf_navi_sub.hxx>
33 #include <toolkit/hf_title.hxx>
34 #include "hfi_doc.hxx"
35 #include "hfi_navibar.hxx"
36 #include "hfi_tag.hxx"
37 #include "hfi_typetext.hxx"
38 #include "hi_linkhelper.hxx"
41 extern const String
42 C_sCePrefix_Module("module");
44 namespace
47 const String
48 C_sList_NestedModules("Nested Modules");
49 const String
50 C_sList_NestedModules_Label("NestedModules");
51 const String
52 C_sList_Services("Services");
53 const String
54 C_sList_Singletons("Singletons");
55 const String
56 C_sList_Interfaces("Interfaces");
57 const String
58 C_sList_Structs("Structs");
59 const String
60 C_sList_Exceptions("Exceptions");
61 const String
62 C_sList_Enums("Enums");
63 const String
64 C_sList_Typedefs("Typedefs");
65 const String
66 C_sList_ConstGroups("Constant Groups");
67 const String
68 C_sList_ConstGroups_Label("ConstantGroups");
71 enum E_SubListIndices
72 { // In case of changes, also adapt make_Navibar() !!
73 sli_NestedModules = 0,
74 sli_Services = 1,
75 sli_Singletons = 2,
76 sli_Interfaces = 3,
77 sli_Structs = 4,
78 sli_Exceptions = 5,
79 sli_Enums = 6,
80 sli_Typedefs = 7,
81 sli_ConstGroups = 8
84 } //anonymous namespace
87 HF_IdlModule::HF_IdlModule( Environment & io_rEnv,
88 Xml::Element & o_rOut )
89 : HtmlFactory_Idl(io_rEnv, &o_rOut)
93 HF_IdlModule::~HF_IdlModule()
97 typedef ary::idl::ifc_module::attr ModuleAttr;
100 void
101 HF_IdlModule::Produce_byData( const client & i_ce ) const
103 Dyn<HF_NaviSubRow>
104 pNaviSubRow( &make_Navibar(i_ce) );
106 HF_TitleTable
107 aTitle(CurOut());
108 HF_LinkedNameChain
109 aNameChain(aTitle.Add_Row());
111 if ( Env().CurPosition().Depth() > 0 )
113 aNameChain.Produce_CompleteChain_forModule(Env().CurPosition(), nameChainLinker);
115 StreamLock
116 sl(200);
117 aTitle.Produce_Title( sl()
118 << C_sCePrefix_Module
119 << " "
120 << i_ce.LocalName()
121 << c_str );
123 else
125 aTitle.Produce_Title( "Global Module" );
128 write_Docu(aTitle.Add_Row(), i_ce);
129 CurOut() << new Html::HorizontalLine();
132 // Write children lists:
133 ce_ptr_list aNestedModules;
134 ce_ptr_list aServices;
135 ce_ptr_list aInterfaces;
136 ce_ptr_list aStructs;
137 ce_ptr_list aExceptions;
138 ce_ptr_list aEnums;
139 ce_ptr_list aTypedefs;
140 ce_ptr_list aConstantGroups;
141 ce_ptr_list aSingletons;
143 ModuleAttr::Get_AllChildrenSeparated(
144 aNestedModules,
145 aServices,
146 aInterfaces,
147 aStructs,
148 aExceptions,
149 aEnums,
150 aTypedefs,
151 aConstantGroups,
152 aSingletons,
153 Env().Data().Ces(),
154 i_ce );
156 // Has this to be in the order of enum E_SubListIndices ???
157 if (produce_ChildList(C_sList_NestedModules, C_sList_NestedModules_Label, aNestedModules ))
158 pNaviSubRow->SwitchOn(sli_NestedModules);
159 if (produce_ChildList(C_sList_Services, C_sList_Services, aServices))
160 pNaviSubRow->SwitchOn(sli_Services);
161 if (produce_ChildList(C_sList_Singletons, C_sList_Singletons, aSingletons))
162 pNaviSubRow->SwitchOn(sli_Singletons);
163 if (produce_ChildList(C_sList_Interfaces, C_sList_Interfaces, aInterfaces))
164 pNaviSubRow->SwitchOn(sli_Interfaces);
165 if (produce_ChildList(C_sList_Structs, C_sList_Structs, aStructs))
166 pNaviSubRow->SwitchOn(sli_Structs);
167 if (produce_ChildList(C_sList_Exceptions, C_sList_Exceptions, aExceptions))
168 pNaviSubRow->SwitchOn(sli_Exceptions);
169 if (produce_ChildList(C_sList_Enums, C_sList_Enums, aEnums))
170 pNaviSubRow->SwitchOn(sli_Enums);
171 if (produce_ChildList(C_sList_Typedefs, C_sList_Typedefs, aTypedefs))
172 pNaviSubRow->SwitchOn(sli_Typedefs);
173 if (produce_ChildList(C_sList_ConstGroups, C_sList_ConstGroups_Label, aConstantGroups))
174 pNaviSubRow->SwitchOn(sli_ConstGroups);
175 pNaviSubRow->Produce_Row();
178 DYN HF_NaviSubRow &
179 HF_IdlModule::make_Navibar( const client & i_ce ) const
181 HF_IdlNavigationBar
182 aNaviBar(Env(), CurOut());
183 aNaviBar.Produce_ModuleMainRow(i_ce);
185 DYN HF_NaviSubRow &
186 ret = aNaviBar.Add_SubRow();
188 // Has to be in the order of E_SubListIndices:
189 ret.AddItem(C_sList_NestedModules, C_sList_NestedModules_Label, false);
190 ret.AddItem(C_sList_Services, C_sList_Services, false);
191 ret.AddItem(C_sList_Singletons, C_sList_Singletons, false);
192 ret.AddItem(C_sList_Interfaces, C_sList_Interfaces, false);
193 ret.AddItem(C_sList_Structs, C_sList_Structs, false);
194 ret.AddItem(C_sList_Exceptions, C_sList_Exceptions, false);
195 ret.AddItem(C_sList_Enums, C_sList_Enums, false);
196 ret.AddItem(C_sList_Typedefs, C_sList_Typedefs, false);
197 ret.AddItem(C_sList_ConstGroups, C_sList_ConstGroups_Label, false);
199 CurOut() << new Html::HorizontalLine();
200 return ret;
203 bool
204 HF_IdlModule::produce_ChildList( const String & i_sName,
205 const String & i_sLabel,
206 const ce_ptr_list & i_list ) const
208 if ( i_list.empty() )
209 return false;
211 HF_SubTitleTable
212 aTable( CurOut(),
213 i_sLabel,
214 i_sName,
215 2 );
217 ce_ptr_list::const_iterator
218 itEnd = i_list.end();
219 for ( ce_ptr_list::const_iterator it = i_list.begin();
220 it != itEnd;
221 ++it )
223 Xml::Element &
224 rRow = aTable.Add_Row();
225 produce_Link(rRow, *it);
226 produce_LinkDoc(rRow, *it);
227 } // end for
229 return true;
232 void
233 HF_IdlModule::produce_Link( Xml::Element & o_row,
234 const client * i_ce ) const
236 csv_assert(i_ce != 0);
237 Xml::Element &
238 rCell = o_row
239 >> *new Html::TableCell
240 << new Html::ClassAttr(C_sCellStyle_SummaryLeft);
242 if ( NOT ary::is_type<ary::idl::Module>(*i_ce) )
244 HF_IdlTypeText
245 aText(Env(), rCell);
246 aText.Produce_byData(i_ce->CeId());
248 else
250 StreamLock slBuf(100);
251 rCell
252 >> *new Html::Link( slBuf() << i_ce->LocalName()
253 << "/module-ix.html"
254 << c_str )
255 << i_ce->LocalName();
259 void
260 HF_IdlModule::produce_LinkDoc( Xml::Element & o_row,
261 const client * i_ce ) const
263 csv_assert(i_ce != 0);
265 // We need the cell in any case, because, the rendering may be hurt else.
266 Xml::Element &
267 rCell = o_row
268 >> *new Html::TableCell
269 << new Html::ClassAttr(C_sCellStyle_SummaryRight);
271 const client &
272 rCe = *i_ce;
273 const ce_info *
274 pShort = Get_IdlDocu(rCe.Docu());
275 if ( pShort == 0 )
276 return;
279 if (pShort->IsDeprecated())
281 rCell << "[ DEPRECATED ]" << new Html::LineBreak;
283 if (pShort->IsOptional())
285 rCell << "[ OPTIONAL ]" << new Html::LineBreak;
288 HF_IdlDocuTextDisplay
289 aShortDisplay(Env(), &rCell, *i_ce);
290 pShort->Short().DisplayAt(aShortDisplay);
293 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */