Bump for 3.6-28
[LibreOffice.git] / autodoc / source / display / idl / hfi_module.cxx
blob85be9cb9fb3727471e26b037ffb34f786d72a519
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_module.hxx"
33 // NOT FULLY DEFINED SERVICES
34 #include <ary/idl/i_ce.hxx>
35 #include <ary/idl/i_module.hxx>
36 #include <ary/idl/ik_module.hxx>
37 #include <ary/doc/d_oldidldocu.hxx>
38 #include <ary/getncast.hxx>
39 #include <toolkit/hf_docentry.hxx>
40 #include <toolkit/hf_linachain.hxx>
41 #include <toolkit/hf_navi_sub.hxx>
42 #include <toolkit/hf_title.hxx>
43 #include "hfi_doc.hxx"
44 #include "hfi_navibar.hxx"
45 #include "hfi_tag.hxx"
46 #include "hfi_typetext.hxx"
47 #include "hi_linkhelper.hxx"
50 extern const String
51 C_sCePrefix_Module("module");
53 namespace
56 const String
57 C_sList_NestedModules("Nested Modules");
58 const String
59 C_sList_NestedModules_Label("NestedModules");
60 const String
61 C_sList_Services("Services");
62 const String
63 C_sList_Singletons("Singletons");
64 const String
65 C_sList_Interfaces("Interfaces");
66 const String
67 C_sList_Structs("Structs");
68 const String
69 C_sList_Exceptions("Exceptions");
70 const String
71 C_sList_Enums("Enums");
72 const String
73 C_sList_Typedefs("Typedefs");
74 const String
75 C_sList_ConstGroups("Constant Groups");
76 const String
77 C_sList_ConstGroups_Label("ConstantGroups");
80 enum E_SubListIndices
81 { // In case of changes, also adapt make_Navibar() !!
82 sli_NestedModules = 0,
83 sli_Services = 1,
84 sli_Singletons = 2,
85 sli_Interfaces = 3,
86 sli_Structs = 4,
87 sli_Exceptions = 5,
88 sli_Enums = 6,
89 sli_Typedefs = 7,
90 sli_ConstGroups = 8
93 } //anonymous namespace
96 HF_IdlModule::HF_IdlModule( Environment & io_rEnv,
97 Xml::Element & o_rOut )
98 : HtmlFactory_Idl(io_rEnv, &o_rOut)
102 HF_IdlModule::~HF_IdlModule()
106 typedef ary::idl::ifc_module::attr ModuleAttr;
109 void
110 HF_IdlModule::Produce_byData( const client & i_ce ) const
112 Dyn<HF_NaviSubRow>
113 pNaviSubRow( &make_Navibar(i_ce) );
115 HF_TitleTable
116 aTitle(CurOut());
117 HF_LinkedNameChain
118 aNameChain(aTitle.Add_Row());
120 if ( Env().CurPosition().Depth() > 0 )
122 aNameChain.Produce_CompleteChain_forModule(Env().CurPosition(), nameChainLinker);
124 StreamLock
125 sl(200);
126 aTitle.Produce_Title( sl()
127 << C_sCePrefix_Module
128 << " "
129 << i_ce.LocalName()
130 << c_str );
132 else
134 aTitle.Produce_Title( "Global Module" );
137 write_Docu(aTitle.Add_Row(), i_ce);
138 CurOut() << new Html::HorizontalLine();
141 // Write children lists:
142 ce_ptr_list aNestedModules;
143 ce_ptr_list aServices;
144 ce_ptr_list aInterfaces;
145 ce_ptr_list aStructs;
146 ce_ptr_list aExceptions;
147 ce_ptr_list aEnums;
148 ce_ptr_list aTypedefs;
149 ce_ptr_list aConstantGroups;
150 ce_ptr_list aSingletons;
152 ModuleAttr::Get_AllChildrenSeparated(
153 aNestedModules,
154 aServices,
155 aInterfaces,
156 aStructs,
157 aExceptions,
158 aEnums,
159 aTypedefs,
160 aConstantGroups,
161 aSingletons,
162 Env().Data().Ces(),
163 i_ce );
165 // Has this to be in the order of enum E_SubListIndices ???
166 if (produce_ChildList(C_sList_NestedModules, C_sList_NestedModules_Label, aNestedModules ))
167 pNaviSubRow->SwitchOn(sli_NestedModules);
168 if (produce_ChildList(C_sList_Services, C_sList_Services, aServices))
169 pNaviSubRow->SwitchOn(sli_Services);
170 if (produce_ChildList(C_sList_Singletons, C_sList_Singletons, aSingletons))
171 pNaviSubRow->SwitchOn(sli_Singletons);
172 if (produce_ChildList(C_sList_Interfaces, C_sList_Interfaces, aInterfaces))
173 pNaviSubRow->SwitchOn(sli_Interfaces);
174 if (produce_ChildList(C_sList_Structs, C_sList_Structs, aStructs))
175 pNaviSubRow->SwitchOn(sli_Structs);
176 if (produce_ChildList(C_sList_Exceptions, C_sList_Exceptions, aExceptions))
177 pNaviSubRow->SwitchOn(sli_Exceptions);
178 if (produce_ChildList(C_sList_Enums, C_sList_Enums, aEnums))
179 pNaviSubRow->SwitchOn(sli_Enums);
180 if (produce_ChildList(C_sList_Typedefs, C_sList_Typedefs, aTypedefs))
181 pNaviSubRow->SwitchOn(sli_Typedefs);
182 if (produce_ChildList(C_sList_ConstGroups, C_sList_ConstGroups_Label, aConstantGroups))
183 pNaviSubRow->SwitchOn(sli_ConstGroups);
184 pNaviSubRow->Produce_Row();
187 DYN HF_NaviSubRow &
188 HF_IdlModule::make_Navibar( const client & i_ce ) const
190 HF_IdlNavigationBar
191 aNaviBar(Env(), CurOut());
192 aNaviBar.Produce_ModuleMainRow(i_ce);
194 DYN HF_NaviSubRow &
195 ret = aNaviBar.Add_SubRow();
197 // Has to be in the order of E_SubListIndices:
198 ret.AddItem(C_sList_NestedModules, C_sList_NestedModules_Label, false);
199 ret.AddItem(C_sList_Services, C_sList_Services, false);
200 ret.AddItem(C_sList_Singletons, C_sList_Singletons, false);
201 ret.AddItem(C_sList_Interfaces, C_sList_Interfaces, false);
202 ret.AddItem(C_sList_Structs, C_sList_Structs, false);
203 ret.AddItem(C_sList_Exceptions, C_sList_Exceptions, false);
204 ret.AddItem(C_sList_Enums, C_sList_Enums, false);
205 ret.AddItem(C_sList_Typedefs, C_sList_Typedefs, false);
206 ret.AddItem(C_sList_ConstGroups, C_sList_ConstGroups_Label, false);
208 CurOut() << new Html::HorizontalLine();
209 return ret;
212 bool
213 HF_IdlModule::produce_ChildList( const String & i_sName,
214 const String & i_sLabel,
215 const ce_ptr_list & i_list ) const
217 if ( i_list.empty() )
218 return false;
220 HF_SubTitleTable
221 aTable( CurOut(),
222 i_sLabel,
223 i_sName,
224 2 );
226 ce_ptr_list::const_iterator
227 itEnd = i_list.end();
228 for ( ce_ptr_list::const_iterator it = i_list.begin();
229 it != itEnd;
230 ++it )
232 Xml::Element &
233 rRow = aTable.Add_Row();
234 produce_Link(rRow, *it);
235 produce_LinkDoc(rRow, *it);
236 } // end for
238 return true;
241 void
242 HF_IdlModule::produce_Link( Xml::Element & o_row,
243 const client * i_ce ) const
245 csv_assert(i_ce != 0);
246 Xml::Element &
247 rCell = o_row
248 >> *new Html::TableCell
249 << new Html::ClassAttr(C_sCellStyle_SummaryLeft);
251 if ( NOT ary::is_type<ary::idl::Module>(*i_ce) )
253 HF_IdlTypeText
254 aText(Env(), rCell, true);
255 aText.Produce_byData(i_ce->CeId());
257 else
259 StreamLock slBuf(100);
260 rCell
261 >> *new Html::Link( slBuf() << i_ce->LocalName()
262 << "/module-ix.html"
263 << c_str )
264 << i_ce->LocalName();
268 void
269 HF_IdlModule::produce_LinkDoc( Xml::Element & o_row,
270 const client * i_ce ) const
272 csv_assert(i_ce != 0);
274 // We need the cell in any case, because, the rendering may be hurt else.
275 Xml::Element &
276 rCell = o_row
277 >> *new Html::TableCell
278 << new Html::ClassAttr(C_sCellStyle_SummaryRight);
280 const client &
281 rCe = *i_ce;
282 const ce_info *
283 pShort = Get_IdlDocu(rCe.Docu());
284 if ( pShort == 0 )
285 return;
288 if (pShort->IsDeprecated())
290 rCell << "[ DEPRECATED ]" << new Html::LineBreak;
292 if (pShort->IsOptional())
294 rCell << "[ OPTIONAL ]" << new Html::LineBreak;
297 HF_IdlDocuTextDisplay
298 aShortDisplay(Env(), &rCell, *i_ce);
299 pShort->Short().DisplayAt(aShortDisplay);
302 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */