Update ooo320-m1
[ooovba.git] / autodoc / source / display / idl / hfi_module.cxx
blob84bf6c284b590bb96eedad951696d7ade868a219
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hfi_module.cxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <precomp.h>
32 #include "hfi_module.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <ary/idl/i_ce.hxx>
37 #include <ary/idl/i_module.hxx>
38 #include <ary/idl/ik_module.hxx>
39 #include <ary/doc/d_oldidldocu.hxx>
40 #include <ary/getncast.hxx>
41 #include <toolkit/hf_docentry.hxx>
42 #include <toolkit/hf_linachain.hxx>
43 #include <toolkit/hf_navi_sub.hxx>
44 #include <toolkit/hf_title.hxx>
45 #include "hfi_doc.hxx"
46 #include "hfi_navibar.hxx"
47 #include "hfi_tag.hxx"
48 #include "hfi_typetext.hxx"
49 #include "hi_linkhelper.hxx"
52 extern const String
53 C_sCePrefix_Module("module");
55 namespace
58 const String
59 C_sList_NestedModules("Nested Modules");
60 const String
61 C_sList_NestedModules_Label("NestedModules");
62 const String
63 C_sList_Services("Services");
64 const String
65 C_sList_Singletons("Singletons");
66 const String
67 C_sList_Interfaces("Interfaces");
68 const String
69 C_sList_Structs("Structs");
70 const String
71 C_sList_Exceptions("Exceptions");
72 const String
73 C_sList_Enums("Enums");
74 const String
75 C_sList_Typedefs("Typedefs");
76 const String
77 C_sList_ConstGroups("Constant Groups");
78 const String
79 C_sList_ConstGroups_Label("ConstantGroups");
82 enum E_SubListIndices
83 { // In case of changes, also adapt make_Navibar() !!
84 sli_NestedModules = 0,
85 sli_Services = 1,
86 sli_Singletons = 2,
87 sli_Interfaces = 3,
88 sli_Structs = 4,
89 sli_Exceptions = 5,
90 sli_Enums = 6,
91 sli_Typedefs = 7,
92 sli_ConstGroups = 8
95 } //anonymous namespace
98 HF_IdlModule::HF_IdlModule( Environment & io_rEnv,
99 Xml::Element & o_rOut )
100 : HtmlFactory_Idl(io_rEnv, &o_rOut)
104 HF_IdlModule::~HF_IdlModule()
108 typedef ary::idl::ifc_module::attr ModuleAttr;
111 void
112 HF_IdlModule::Produce_byData( const client & i_ce ) const
114 Dyn<HF_NaviSubRow>
115 pNaviSubRow( &make_Navibar(i_ce) );
117 HF_TitleTable
118 aTitle(CurOut());
119 HF_LinkedNameChain
120 aNameChain(aTitle.Add_Row());
122 if ( Env().CurPosition().Depth() > 0 )
124 aNameChain.Produce_CompleteChain_forModule(Env().CurPosition(), nameChainLinker);
126 StreamLock
127 sl(200);
128 aTitle.Produce_Title( sl()
129 << C_sCePrefix_Module
130 << " "
131 << i_ce.LocalName()
132 << c_str );
134 else
136 aTitle.Produce_Title( "Global Module" );
139 write_Docu(aTitle.Add_Row(), i_ce);
140 CurOut() << new Html::HorizontalLine();
143 // Write children lists:
144 ce_ptr_list aNestedModules;
145 ce_ptr_list aServices;
146 ce_ptr_list aInterfaces;
147 ce_ptr_list aStructs;
148 ce_ptr_list aExceptions;
149 ce_ptr_list aEnums;
150 ce_ptr_list aTypedefs;
151 ce_ptr_list aConstantGroups;
152 ce_ptr_list aSingletons;
154 ModuleAttr::Get_AllChildrenSeparated(
155 aNestedModules,
156 aServices,
157 aInterfaces,
158 aStructs,
159 aExceptions,
160 aEnums,
161 aTypedefs,
162 aConstantGroups,
163 aSingletons,
164 Env().Data().Ces(),
165 i_ce );
167 // Has this to be in the order of enum E_SubListIndices ???
168 if (produce_ChildList(C_sList_NestedModules, C_sList_NestedModules_Label, aNestedModules ))
169 pNaviSubRow->SwitchOn(sli_NestedModules);
170 if (produce_ChildList(C_sList_Services, C_sList_Services, aServices))
171 pNaviSubRow->SwitchOn(sli_Services);
172 if (produce_ChildList(C_sList_Singletons, C_sList_Singletons, aSingletons))
173 pNaviSubRow->SwitchOn(sli_Singletons);
174 if (produce_ChildList(C_sList_Interfaces, C_sList_Interfaces, aInterfaces))
175 pNaviSubRow->SwitchOn(sli_Interfaces);
176 if (produce_ChildList(C_sList_Structs, C_sList_Structs, aStructs))
177 pNaviSubRow->SwitchOn(sli_Structs);
178 if (produce_ChildList(C_sList_Exceptions, C_sList_Exceptions, aExceptions))
179 pNaviSubRow->SwitchOn(sli_Exceptions);
180 if (produce_ChildList(C_sList_Enums, C_sList_Enums, aEnums))
181 pNaviSubRow->SwitchOn(sli_Enums);
182 if (produce_ChildList(C_sList_Typedefs, C_sList_Typedefs, aTypedefs))
183 pNaviSubRow->SwitchOn(sli_Typedefs);
184 if (produce_ChildList(C_sList_ConstGroups, C_sList_ConstGroups_Label, aConstantGroups))
185 pNaviSubRow->SwitchOn(sli_ConstGroups);
186 pNaviSubRow->Produce_Row();
189 DYN HF_NaviSubRow &
190 HF_IdlModule::make_Navibar( const client & i_ce ) const
192 HF_IdlNavigationBar
193 aNaviBar(Env(), CurOut());
194 aNaviBar.Produce_ModuleMainRow(i_ce);
196 DYN HF_NaviSubRow &
197 ret = aNaviBar.Add_SubRow();
199 // Has to be in the order of E_SubListIndices:
200 ret.AddItem(C_sList_NestedModules, C_sList_NestedModules_Label, false);
201 ret.AddItem(C_sList_Services, C_sList_Services, false);
202 ret.AddItem(C_sList_Singletons, C_sList_Singletons, false);
203 ret.AddItem(C_sList_Interfaces, C_sList_Interfaces, false);
204 ret.AddItem(C_sList_Structs, C_sList_Structs, false);
205 ret.AddItem(C_sList_Exceptions, C_sList_Exceptions, false);
206 ret.AddItem(C_sList_Enums, C_sList_Enums, false);
207 ret.AddItem(C_sList_Typedefs, C_sList_Typedefs, false);
208 ret.AddItem(C_sList_ConstGroups, C_sList_ConstGroups_Label, false);
210 CurOut() << new Html::HorizontalLine();
211 return ret;
214 bool
215 HF_IdlModule::produce_ChildList( const String & i_sName,
216 const String & i_sLabel,
217 const ce_ptr_list & i_list ) const
219 if ( i_list.size() == 0 )
220 return false;
222 HF_SubTitleTable
223 aTable( CurOut(),
224 i_sLabel,
225 i_sName,
226 2 );
228 ce_ptr_list::const_iterator
229 itEnd = i_list.end();
230 for ( ce_ptr_list::const_iterator it = i_list.begin();
231 it != itEnd;
232 ++it )
234 Xml::Element &
235 rRow = aTable.Add_Row();
236 produce_Link(rRow, *it);
237 produce_LinkDoc(rRow, *it);
238 } // end for
240 return true;
243 void
244 HF_IdlModule::produce_Link( Xml::Element & o_row,
245 const client * i_ce ) const
247 csv_assert(i_ce != 0);
248 Xml::Element &
249 rCell = o_row
250 >> *new Html::TableCell
251 << new Html::ClassAttr(C_sCellStyle_SummaryLeft);
253 if ( NOT ary::is_type<ary::idl::Module>(*i_ce) )
255 HF_IdlTypeText
256 aText(Env(), rCell, true);
257 aText.Produce_byData(i_ce->CeId());
259 else
261 StreamLock slBuf(100);
262 rCell
263 >> *new Html::Link( slBuf() << i_ce->LocalName()
264 << "/module-ix.html"
265 << c_str )
266 << i_ce->LocalName();
270 void
271 HF_IdlModule::produce_LinkDoc( Xml::Element & o_row,
272 const client * i_ce ) const
274 csv_assert(i_ce != 0);
276 // We need the cell in any case, because, the rendering may be hurt else.
277 Xml::Element &
278 rCell = o_row
279 >> *new Html::TableCell
280 << new Html::ClassAttr(C_sCellStyle_SummaryRight);
282 const client &
283 rCe = *i_ce;
284 const ce_info *
285 pShort = Get_IdlDocu(rCe.Docu());
286 if ( pShort == 0 )
287 return;
290 if (pShort->IsDeprecated())
292 rCell << "[ DEPRECATED ]" << new Html::LineBreak;
294 if (pShort->IsOptional())
296 rCell << "[ OPTIONAL ]" << new Html::LineBreak;
299 HF_IdlDocuTextDisplay
300 aShortDisplay(Env(), &rCell, *i_ce);
301 pShort->Short().DisplayAt(aShortDisplay);