1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #include "hfi_globalindex.hxx"
24 // NOT FULLY DEFINED SERVICES
25 #include <cosv/tpl/tpltools.hxx>
26 #include <ary/idl/i_ce.hxx>
27 #include <ary/idl/i_types4idl.hxx>
28 #include <ary/idl/i_module.hxx>
29 #include <toolkit/hf_title.hxx>
30 #include "hfi_navibar.hxx"
31 #include "hfi_typetext.hxx"
32 #include "hi_linkhelper.hxx"
67 /* RC-Ids for IDL types (see reposy.cxx):
89 const int C_nNumberOfIdlTypes
= 17;
90 const char * C_sTypeNames
[C_nNumberOfIdlTypes
] =
91 { "module ", "interface ", "function ", "service ", "property ",
92 "enum ", "value ", "typedef ", "struct ", "field ",
93 "exception ", "constants group ", "constant ","singleton ", "attribute ",
94 "service", "singleton"
96 const char * C_sOwnerNames
[C_nNumberOfIdlTypes
] =
97 { "module ", "module ", "interface ", "module ", "service ",
98 "module ", "enum ", "module ", "module ", "", // could be struct or exception
99 "module ", "module ", "constants group ", "module ", "interface ",
102 const intt C_nNamesArrayOffset
= intt(ary::idl::Module::class_id
);
103 const int C_nIxField
= 9;
106 HF_IdlGlobalIndex::PageData G_PageData
;
108 } // end anonymous namespace
112 HF_IdlGlobalIndex::write_EntryItself( Xml::Element
& o_destination
,
113 const ary::idl::CodeEntity
& i_ce
,
114 const HF_IdlTypeText
& i_typeLinkWriter
) const
116 i_typeLinkWriter
.Produce_IndexLink(o_destination
, i_ce
);
117 o_destination
<< " - ";
121 HF_IdlGlobalIndex::HF_IdlGlobalIndex( Environment
& io_rEnv
,
122 Xml::Element
& o_rOut
)
123 : HtmlFactory_Idl(io_rEnv
, &o_rOut
)
127 HF_IdlGlobalIndex::~HF_IdlGlobalIndex()
132 HF_IdlGlobalIndex::Produce_Page(ary::idl::alphabetical_index::E_Letter i_letter
) const
139 aTitle
.Produce_Title( sl()
141 << ( i_letter
!= ary::idl::alphabetical_index::non_alpha
142 ? char(int(i_letter
)-'a'+'A')
149 "<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>"
150 " <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>"
151 " <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>" );
153 Out().Enter(CurOut() >> *new Html::DefList
);
155 csv::erase_container(G_PageData
);
156 Env().Data().Get_IndexData(G_PageData
, i_letter
);
158 // Helper object to produce links to the index Entries.
159 HF_IdlTypeText
aTypeLinkWriter(Env(),HF_IdlTypeText::use_for_javacompatible_index
);
161 PageData::const_iterator itEnd
= G_PageData
.end();
162 for ( PageData::const_iterator iter
= G_PageData
.begin();
166 produce_Line(iter
, aTypeLinkWriter
);
170 CurOut() << new Html::HorizontalLine
;
174 HF_IdlGlobalIndex::make_Navibar() const
177 aNaviBar(Env(), CurOut());
178 aNaviBar
.Produce_IndexMainRow();
180 CurOut() << new Html::HorizontalLine();
184 HF_IdlGlobalIndex::produce_Line( PageData::const_iterator i_entry
,
185 const HF_IdlTypeText
& i_typeLinkWriter
) const
188 rCe
= Env().Data().Find_Ce(*i_entry
);
189 if (NOT rCe
.Owner().IsValid())
190 return; // Omit global namespace.
192 // The destination for the created output:
193 Xml::Element
& rDT
= CurOut() >> *new Html::DefListTerm
;
195 /** The following code is intended to produce an output that
196 will be recognized by the context help system of Forte.
197 That is reached by making it similar to the indices, that
199 If the link to the Entry contains a hashmark, the Forte-Help
200 requires following a link to the owner.
201 But if there is no hashmark, the following link must go to
202 the same Entry again. Doesn't make really sense :-(, but that's
205 write_EntryItself(rDT
,rCe
,i_typeLinkWriter
);
206 if (rCe
.SightLevel() == ary::idl::sl_Member
)
207 write_OwnerOfEntry(rDT
,rCe
,i_typeLinkWriter
);
209 write_EntrySecondTime(rDT
,rCe
,i_typeLinkWriter
);
211 // This produces an empty "<dd></dd>", which is also needed to reach
212 // similarity to the Javadoc index:
213 CurOut() << new Html::DefListDefinition
;
217 HF_IdlGlobalIndex::write_OwnerOfEntry( Xml::Element
& o_destination
,
218 const ary::idl::CodeEntity
& i_ce
,
219 const HF_IdlTypeText
& i_typeLinkWriter
) const
222 rOwner
= Env().Data().Find_Ce(i_ce
.Owner());
224 int nIx
= int(i_ce
.AryClass() - C_nNamesArrayOffset
);
225 csv_assert(csv::in_range(0,nIx
,C_nNumberOfIdlTypes
));
227 o_destination
<< C_sTypeNames
[nIx
]
229 if (nIx
!= C_nIxField
)
231 o_destination
<< C_sOwnerNames
[nIx
];
236 nOwnerIx
= rOwner
.AryClass() - C_nNamesArrayOffset
;
238 nOwnerIx
< static_cast< unsigned int >(C_nNumberOfIdlTypes
));
239 o_destination
<< C_sTypeNames
[nOwnerIx
];
241 i_typeLinkWriter
.Produce_IndexOwnerLink(o_destination
, rOwner
);
245 HF_IdlGlobalIndex::write_EntrySecondTime( Xml::Element
& o_destination
,
246 const ary::idl::CodeEntity
& i_ce
,
247 const HF_IdlTypeText
& i_typeLinkWriter
) const
249 int nIx
= int(i_ce
.AryClass() - C_nNamesArrayOffset
);
250 csv_assert(csv::in_range(0,nIx
,C_nNumberOfIdlTypes
));
252 o_destination
<< C_sTypeNames
[nIx
]
254 i_typeLinkWriter
.Produce_IndexSecondEntryLink(o_destination
, i_ce
);
257 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */