Update ooo320-m1
[ooovba.git] / autodoc / source / display / idl / hfi_linklist.cxx
blob5bfc4325c7cb692685a7ab0eab932c35374dc54c
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_linklist.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_linklist.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <ary/idl/i_ce.hxx>
37 #include <ary/idl/i_gate.hxx>
38 #include <ary/idl/ip_ce.hxx>
39 #include <ary/idl/ip_type.hxx>
40 #include <toolkit/hf_docentry.hxx>
41 #include <toolkit/hf_title.hxx>
42 #include "hfi_doc.hxx"
43 #include "hfi_tag.hxx"
44 #include "hfi_typetext.hxx"
45 #include "hi_ary.hxx"
46 #include "hi_env.hxx"
51 //******************* HF_CommentedLink_Table **********************************//
53 HF_CommentedLink_Table::HF_CommentedLink_Table( Environment & io_rEnv,
54 Xml::Element & o_rOut,
55 const String & i_sTitle,
56 const String & i_sLabel,
57 bool i_bBorder )
58 : HtmlFactory_Idl(io_rEnv,&o_rOut),
59 pTable( new Html::Table( (i_bBorder ? "1" : "0"), "100%", "5", "0") ),
60 pCurLinkColumn(0),
61 pCurCommentColumn(0)
63 *pTable
64 << new Html::ClassAttr("commentedlinks");
66 CurOut()
67 >> *new Html::Label(i_sLabel)
68 << new Html::LineBreak;
69 CurOut()
70 << pTable;
71 // HF_SubTitle aTitle(*pTable);
72 // aTitle.Produce_it(i_sTitle);
75 HF_CommentedLink_Table::~HF_CommentedLink_Table()
79 void
80 HF_CommentedLink_Table::Add_Line()
82 Html::TableRow &
83 rRow = pTable->AddRow();
85 pCurLinkColumn = & (rRow.AddCell()
86 << new Html::WidthAttr("30%")
87 << new Xml::AnAttribute("valign","top") );
88 pCurCommentColumn = & rRow.AddCell();
91 Xml::Element &
92 HF_CommentedLink_Table::Cur_LinkColumn()
94 csv_assert(pCurLinkColumn != 0);
95 return *pCurLinkColumn;
98 Xml::Element &
99 HF_CommentedLink_Table::Cur_CommentColumn()
101 csv_assert(pCurCommentColumn != 0);
102 return *pCurCommentColumn;
106 //******************* HF_MemberTable **********************************//
108 HF_MemberTable::HF_MemberTable( Environment & io_rEnv,
109 Xml::Element & o_rOut,
110 const String & i_sTitle,
111 const String & i_sLabel,
112 bool i_bInline )
113 : HtmlFactory_Idl(io_rEnv,&o_rOut),
114 pTable( new Html::Table("1", "100%", "5", "0") ),
115 pCurDeclaration(0),
116 pCurDescription(0),
117 bInline(i_bInline)
119 *pTable
120 << new Html::ClassAttr("memberlist");
122 CurOut()
123 >> *new Html::Label(i_sLabel)
124 << new Html::LineBreak;
125 CurOut()
126 << pTable;
127 // HF_SubTitle aTitle(*pTable);
128 // aTitle.Produce_it(i_sTitle);
131 HF_MemberTable::~HF_MemberTable()
135 void
136 HF_MemberTable::Add_Line()
138 if (bInline)
140 Html::TableRow & rRow = pTable->AddRow();
142 pCurDeclaration = &( rRow.AddCell()
143 << new Xml::AnAttribute("valign","top")
144 << new Html::WidthAttr("30%") );
145 pCurDescription = & rRow.AddCell();
147 else
149 Html::DefList *
150 pMemberSpace = new Html::DefList;
151 *pMemberSpace
152 << new Html::ClassAttr("member");
154 pTable->AddRow().AddCell() << pMemberSpace;
156 pCurDeclaration =
157 & ( *pMemberSpace
158 >> *new Html::DefListTerm
159 << new Html::ClassAttr("member") );
160 pCurDescription =
161 & ( *pMemberSpace
162 >> *new Html::DefListDefinition()
163 << new Html::ClassAttr("member") );
167 Xml::Element &
168 HF_MemberTable::Cur_Declaration()
170 csv_assert(pCurDeclaration != 0);
171 return *pCurDeclaration;
174 Xml::Element &
175 HF_MemberTable::Cur_Description()
177 csv_assert(pCurDescription != 0);
178 return *pCurDescription;
183 //******************* HF_IdlLinkList **********************************//
185 HF_IdlLinkList::HF_IdlLinkList( Environment & io_rEnv,
186 Xml::Element * o_pOut )
187 : HtmlFactory_Idl(io_rEnv,o_pOut)
191 HF_IdlLinkList::~HF_IdlLinkList()
195 void
196 HF_IdlLinkList::Produce_NamespaceMembers( const String & i_sTitle,
197 const String & i_sLabel,
198 const std::vector<ary::idl::Ce_id> & i_rList,
199 bool i_bNestedNamespaces ) const
201 HF_CommentedLink_Table
202 aTableMaker( Env(), CurOut(),
203 i_sTitle, i_sLabel,
204 true );
206 std::vector<ary::idl::Ce_id>::const_iterator itEnd = i_rList.end();
207 for ( std::vector<ary::idl::Ce_id>::const_iterator it = i_rList.begin();
208 it != itEnd;
209 ++it )
211 static String sEntryName;
212 static String sEntryLink;
213 const ce_info *
214 pDocu = 0;
215 Get_EntryData_NamespaceMembers( sEntryName, sEntryLink, pDocu, *it, i_bNestedNamespaces );
216 aTableMaker.Add_Line();
218 aTableMaker.Cur_LinkColumn()
219 >> *new Html::Link(sEntryLink)
220 << sEntryName;
222 if ( pDocu != 0 )
224 HF_IdlShortDocu
225 aTextDisplay(Env(), aTableMaker.Cur_CommentColumn() );
226 aTextDisplay.Produce_byData( pDocu );
228 } // end for
231 void
232 HF_IdlLinkList::Produce_GlobalLinks( const String & i_sTitle,
233 const String & i_sLabel,
234 ce_list & i_rList ) const
236 HF_CommentedLink_Table
237 aTableMaker( Env(), CurOut(),
238 i_sTitle, i_sLabel,
239 true );
241 for ( ; i_rList; ++i_rList )
243 aTableMaker.Add_Line();
244 HF_IdlTypeText
245 aLinkText( Env(), aTableMaker.Cur_LinkColumn(), true );
246 aLinkText.Produce_byData(*i_rList);
248 const ce_info *
249 pDocu = Get_EntryDocu(*i_rList);
250 if ( pDocu != 0 )
252 HF_IdlShortDocu
253 aTextDisplay(Env(), aTableMaker.Cur_CommentColumn() );
254 aTextDisplay.Produce_byData( pDocu, *i_rList );
259 void
260 HF_IdlLinkList::Produce_GlobalCommentedLinks( const String & i_sTitle,
261 const String & i_sLabel,
262 comref_list & i_rList ) const
264 HF_CommentedLink_Table
265 aTableMaker( Env(), CurOut(),
266 i_sTitle, i_sLabel,
267 true );
269 for ( ; i_rList; ++i_rList )
271 aTableMaker.Add_Line();
272 HF_IdlTypeText
273 aLinkText( Env(), aTableMaker.Cur_LinkColumn(), true );
274 aLinkText.Produce_byData( (*i_rList).first );
276 HF_DocEntryList
277 aDocList( aTableMaker.Cur_CommentColumn() );
278 if ( (*i_rList).second != 0 )
280 HF_IdlDocu
281 aDocuDisplay( Env(), aDocList );
282 aDocuDisplay.Produce_byData( (*i_rList).second );
284 else
286 const ce_info *
287 pShort = Get_EntryDocu(
288 Env().Gate().Types().Search_CeRelatedTo(
289 (*i_rList).first) );
290 if ( pShort != 0 )
292 if (pShort->IsDeprecated())
294 aDocList.Produce_Term()
295 << "[ DEPRECATED ]";
297 if (pShort->IsOptional())
299 aDocList.Produce_Term()
300 << "[ OPTIONAL ]";
303 aDocList.Produce_Term()
304 << "Description";
306 HF_IdlDocuTextDisplay
307 aShortDisplay( Env(), &aDocList.Produce_Definition() );
308 aShortDisplay.Set_CurScopeTo(
309 Env().Gate().Types().Search_CeRelatedTo((*i_rList).first) );
310 pShort->Short().DisplayAt(aShortDisplay);
317 void
318 HF_IdlLinkList::Produce_MemberLinks( const String & i_sTitle,
319 const String & i_sLabel,
320 ce_list & i_rList ) const
322 HF_CommentedLink_Table
323 aTableMaker( Env(), CurOut(),
324 i_sTitle, i_sLabel,
325 true );
328 for ( ; i_rList; ++i_rList )
330 const ary::idl::CodeEntity &
331 rCe = Env().Gate().Ces().Find_Ce(*i_rList);
333 aTableMaker.Add_Line();
334 aTableMaker.Cur_LinkColumn()
335 >> *new Html::Link(
336 StreamLock(200)() << "#" << rCe.LocalName() << c_str)
337 << rCe.LocalName();
339 const ce_info *
340 pDocu = rCe.Docu();
341 if ( pDocu != 0 )
343 HF_IdlShortDocu
344 aTextDisplay(Env(), aTableMaker.Cur_CommentColumn() );
345 aTextDisplay.Produce_byData( *pDocu );
347 } // end for
351 void
352 HF_IdlLinkList::Get_EntryData_NamespaceMembers(
353 String & o_sEntryName,
354 String & o_sEntryLink,
355 const ce_info * & o_pDocu,
356 ce_id i_nMemberId,
357 bool i_bIsNestedNamespace ) const
359 const ary::idl::CodeEntity &
360 rCe = Env().Data().Find_Ce(i_nMemberId);
362 o_sEntryName = rCe.LocalName();
363 o_sEntryLink = StreamLock(200)() << rCe.LocalName()
364 << ( i_bIsNestedNamespace
365 ? "/module-ix"
366 : "" )
367 << ".html"
368 << c_str;
369 o_pDocu = rCe.Docu();
372 const ary::doc::OldIdlDocu *
373 HF_IdlLinkList::Get_EntryDocu(ce_id i_nMemberId) const
375 if (i_nMemberId.IsValid())
376 return Env().Data().Find_Ce(i_nMemberId).Docu();
377 else
378 return 0;