1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hfi_globalindex.cxx,v $
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 ************************************************************************/
32 #include "hfi_globalindex.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <cosv/tpl/tpltools.hxx>
37 #include <ary/idl/i_ce.hxx>
38 #include <ary/idl/i_types4idl.hxx>
39 #include <ary/idl/i_module.hxx>
40 #include <toolkit/hf_title.hxx>
41 #include "hfi_navibar.hxx"
42 #include "hfi_typetext.hxx"
43 #include "hi_linkhelper.hxx"
78 /* RC-Ids for IDL types (see reposy.cxx):
100 const int C_nNumberOfIdlTypes
= 17;
101 const char * C_sTypeNames
[C_nNumberOfIdlTypes
] =
102 { "module ", "interface ", "function ", "service ", "property ",
103 "enum ", "value ", "typedef ", "struct ", "field ",
104 "exception ", "constants group ", "constant ","singleton ", "attribute ",
105 "service", "singleton"
107 const char * C_sOwnerNames
[C_nNumberOfIdlTypes
] =
108 { "module ", "module ", "interface ", "module ", "service ",
109 "module ", "enum ", "module ", "module ", "", // could be struct or exception
110 "module ", "module ", "constants group ", "module ", "interface ",
113 const intt C_nNamesArrayOffset
= intt(ary::idl::Module::class_id
);
114 const int C_nIxField
= 9;
119 const char C_cAlphabet
[] =
120 "<a class=\"inverse\" href=\"index-1.html\"><B>A</B></a> <a class=\"inverse\" href=\"index-2.html\"><B>B</B></a> <a class=\"inverse\" href=\"index-3.html\"><B>C</B></a> <a class=\"inverse\" href=\"index-4.html\"><B>D</B></a> <a class=\"inverse\" href=\"index-5.html\"><B>E</B></a> "
121 "<a class=\"inverse\" href=\"index-6.html\"><B>F</B></a> <a class=\"inverse\" href=\"index-7.html\"><B>G</B></a> <a class=\"inverse\" href=\"index-8.html\"><B>H</B></a> <a class=\"inverse\" href=\"index-9.html\"><B>I</B></a> <a class=\"inverse\" href=\"index-10.html\"><B>J</B></a> "
122 "<a class=\"inverse\" href=\"index-11.html\"><B>K</B></a> <a class=\"inverse\" href=\"index-12.html\"><B>L</B></a> <a class=\"inverse\" href=\"index-13.html\"><B>M</B></a> <a class=\"inverse\" href=\"index-14.html\"><B>N</B></a> <a class=\"inverse\" href=\"index-15.html\"><B>O</B></a> "
123 "<a class=\"inverse\" href=\"index-16.html\"><B>P</B></a> <a class=\"inverse\" href=\"index-17.html\"><B>Q</B></a> <a class=\"inverse\" href=\"index-18.html\"><B>R</B></a> <a class=\"inverse\" href=\"index-19.html\"><B>S</B></a> <a class=\"inverse\" href=\"index-20.html\"><B>T</B></a> "
124 "<a class=\"inverse\" href=\"index-21.html\"><B>U</B></a> <a class=\"inverse\" href=\"index-22.html\"><B>V</B></a> <a class=\"inverse\" href=\"index-23.html\"><B>W</B></a> <a class=\"inverse\" href=\"index-24.html\"><B>X</B></a> <a class=\"inverse\" href=\"index-25.html\"><B>Y</B></a> "
125 "<a class=\"inverse\" href=\"index-26.html\"><B>Z</B></a>";
129 HF_IdlGlobalIndex::PageData G_PageData
;
131 } // end anonymous namespace
135 HF_IdlGlobalIndex::write_EntryItself( Xml::Element
& o_destination
,
136 const ary::idl::CodeEntity
& i_ce
,
137 const HF_IdlTypeText
& i_typeLinkWriter
) const
139 i_typeLinkWriter
.Produce_IndexLink(o_destination
, i_ce
);
140 o_destination
<< " - ";
144 HF_IdlGlobalIndex::HF_IdlGlobalIndex( Environment
& io_rEnv
,
145 Xml::Element
& o_rOut
)
146 : HtmlFactory_Idl(io_rEnv
, &o_rOut
)
150 HF_IdlGlobalIndex::~HF_IdlGlobalIndex()
155 HF_IdlGlobalIndex::Produce_Page(ary::idl::alphabetical_index::E_Letter i_letter
) const
162 aTitle
.Produce_Title( sl()
164 << ( i_letter
!= ary::idl::alphabetical_index::non_alpha
165 ? char(int(i_letter
)-'a'+'A')
172 "<p align=\"center\"><a href=\"index-1.html\"><b>A</b></a> <a href=\"index-2.html\"><b>B</b></a> <a href=\"index-3.html\"><b>C</b></a> <a href=\"index-4.html\"><b>D</b></a> <a href=\"index-5.html\"><b>E</b></a> <a href=\"index-6.html\"><b>F</b></a> <a href=\"index-7.html\"><b>G</b></a> <a href=\"index-8.html\"><b>H</b></a> <a href=\"index-9.html\"><b>I</b></a> <a href=\"index-10.html\"><b>J</b></a>"
173 " <a href=\"index-11.html\"><b>K</b></a> <a href=\"index-12.html\"><b>L</b></a> <a href=\"index-13.html\"><b>M</b></a> <a href=\"index-14.html\"><b>N</b></a> <a href=\"index-15.html\"><b>O</b></a> <a href=\"index-16.html\"><b>P</b></a> <a href=\"index-17.html\"><b>Q</b></a> <a href=\"index-18.html\"><b>R</b></a> <a href=\"index-19.html\"><b>S</b></a> <a href=\"index-20.html\"><b>T</b></a>"
174 " <a href=\"index-21.html\"><b>U</b></a> <a href=\"index-22.html\"><b>V</b></a> <a href=\"index-23.html\"><b>W</b></a> <a href=\"index-24.html\"><b>X</b></a> <a href=\"index-25.html\"><b>Y</b></a> <a href=\"index-26.html\"><b>Z</b></a> <a href=\"index-27.html\"><b>_</b></a></p>" );
176 Out().Enter(CurOut() >> *new Html::DefList
);
178 csv::erase_container(G_PageData
);
179 Env().Data().Get_IndexData(G_PageData
, i_letter
);
181 // Helper object to produce links to the index Entries.
182 HF_IdlTypeText
aTypeLinkWriter(Env(),HF_IdlTypeText::use_for_javacompatible_index
);
184 PageData::const_iterator itEnd
= G_PageData
.end();
185 for ( PageData::const_iterator iter
= G_PageData
.begin();
189 produce_Line(iter
, aTypeLinkWriter
);
193 CurOut() << new Html::HorizontalLine
;
197 HF_IdlGlobalIndex::make_Navibar() const
200 aNaviBar(Env(), CurOut());
201 aNaviBar
.Produce_IndexMainRow();
203 CurOut() << new Html::HorizontalLine();
207 HF_IdlGlobalIndex::produce_Line( PageData::const_iterator i_entry
,
208 const HF_IdlTypeText
& i_typeLinkWriter
) const
211 rCe
= Env().Data().Find_Ce(*i_entry
);
212 if (NOT rCe
.Owner().IsValid())
213 return; // Omit global namespace.
215 // The destination for the created output:
216 Xml::Element
& rDT
= CurOut() >> *new Html::DefListTerm
;
218 /** The following code is intended to produce an output that
219 will be recognized by the context help system of Forte.
220 That is reached by making it similar to the indices, that
222 If the link to the Entry contains a hashmark, the Forte-Help
223 requires following a link to the owner.
224 But if there is no hashmark, the following link must go to
225 the same Entry again. Doesn't make really sense :-(, but that's
228 write_EntryItself(rDT
,rCe
,i_typeLinkWriter
);
229 if (rCe
.SightLevel() == ary::idl::sl_Member
)
230 write_OwnerOfEntry(rDT
,rCe
,i_typeLinkWriter
);
232 write_EntrySecondTime(rDT
,rCe
,i_typeLinkWriter
);
234 // This produces an empty "<dd></dd>", which is also needed to reach
235 // similarity to the Javadoc index:
236 CurOut() << new Html::DefListDefinition
;
240 HF_IdlGlobalIndex::write_OwnerOfEntry( Xml::Element
& o_destination
,
241 const ary::idl::CodeEntity
& i_ce
,
242 const HF_IdlTypeText
& i_typeLinkWriter
) const
245 rOwner
= Env().Data().Find_Ce(i_ce
.Owner());
247 int nIx
= int(i_ce
.AryClass() - C_nNamesArrayOffset
);
248 csv_assert(csv::in_range(0,nIx
,C_nNumberOfIdlTypes
));
250 o_destination
<< C_sTypeNames
[nIx
]
252 if (nIx
!= C_nIxField
)
254 o_destination
<< C_sOwnerNames
[nIx
];
259 nOwnerIx
= rOwner
.AryClass() - C_nNamesArrayOffset
;
261 nOwnerIx
< static_cast< unsigned int >(C_nNumberOfIdlTypes
));
262 o_destination
<< C_sTypeNames
[nOwnerIx
];
264 i_typeLinkWriter
.Produce_IndexOwnerLink(o_destination
, rOwner
);
268 HF_IdlGlobalIndex::write_EntrySecondTime( Xml::Element
& o_destination
,
269 const ary::idl::CodeEntity
& i_ce
,
270 const HF_IdlTypeText
& i_typeLinkWriter
) const
272 int nIx
= int(i_ce
.AryClass() - C_nNamesArrayOffset
);
273 csv_assert(csv::in_range(0,nIx
,C_nNumberOfIdlTypes
));
275 o_destination
<< C_sTypeNames
[nIx
]
277 i_typeLinkWriter
.Produce_IndexSecondEntryLink(o_destination
, i_ce
);