fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / autodoc / source / display / idl / hfi_globalindex.cxx
blobe0ffd286a8a575122834e44806e331173e700755
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <precomp.h>
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"
37 namespace
40 /**
42 enum E_Types
44 t_service = 0,
45 t_interface = 1,
46 t_struct = 2,
47 t_exception = 3,
48 t_enum = 4,
49 t_typedef = 5,
50 t_constantsgroup = 6,
51 t_property = 7,
52 t_function = 8,
53 t_structelement = 9,
54 t_enumvalue = 10,
55 t_constant = 11,
56 t_module = 12,
57 t_singleton = 13,
58 t_attribute = 14,
59 t_siservice = 15,
60 t_sisingleton = 16,
61 t_MAX
64 String G_sDummy;
67 /* RC-Ids for IDL types (see reposy.cxx):
69 Module 2000
70 Interface 2001
71 Function 2002
72 Service 2003
73 Property 2004
75 Enum 2005
76 EnumValue 2006
77 Typedef 2007
78 Struct 2008
79 StructElement 2009
81 Exception 2010
82 ConstantGroup 2011
83 Constant 2012
84 Singleton 2013
85 Attribute 2014
86 SglIfcService 2015
87 SglIfcSingleton 2016
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 ",
100 "module", "module"
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
111 inline void
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()
131 void
132 HF_IdlGlobalIndex::Produce_Page(ary::idl::alphabetical_index::E_Letter i_letter) const
134 make_Navibar();
136 HF_TitleTable
137 aTitle(CurOut());
138 StreamLock sl(100);
139 aTitle.Produce_Title( sl()
140 << "Global Index "
141 << ( i_letter != ary::idl::alphabetical_index::non_alpha
142 ? char(int(i_letter)-'a'+'A')
143 : '_' )
144 << c_str );
146 // Letters Index
147 aTitle.Add_Row()
148 << new Xml::XmlCode(
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();
163 iter != itEnd;
164 ++iter )
166 produce_Line(iter, aTypeLinkWriter);
167 } // end for
169 Out().Leave();
170 CurOut() << new Html::HorizontalLine;
173 void
174 HF_IdlGlobalIndex::make_Navibar() const
176 HF_IdlNavigationBar
177 aNaviBar(Env(), CurOut());
178 aNaviBar.Produce_IndexMainRow();
180 CurOut() << new Html::HorizontalLine();
183 void
184 HF_IdlGlobalIndex::produce_Line( PageData::const_iterator i_entry,
185 const HF_IdlTypeText & i_typeLinkWriter) const
187 const client &
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
198 Javadoc produces.
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
203 like it is.
205 write_EntryItself(rDT,rCe,i_typeLinkWriter);
206 if (rCe.SightLevel() == ary::idl::sl_Member)
207 write_OwnerOfEntry(rDT,rCe,i_typeLinkWriter);
208 else
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;
216 void
217 HF_IdlGlobalIndex::write_OwnerOfEntry( Xml::Element & o_destination,
218 const ary::idl::CodeEntity & i_ce,
219 const HF_IdlTypeText & i_typeLinkWriter ) const
221 const client &
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]
228 << "in ";
229 if (nIx != C_nIxField)
231 o_destination << C_sOwnerNames[nIx];
233 else
235 uintt
236 nOwnerIx = rOwner.AryClass() - C_nNamesArrayOffset;
237 csv_assert(
238 nOwnerIx < static_cast< unsigned int >(C_nNumberOfIdlTypes));
239 o_destination << C_sTypeNames[nOwnerIx];
241 i_typeLinkWriter.Produce_IndexOwnerLink(o_destination, rOwner);
244 void
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]
253 << " ";
254 i_typeLinkWriter.Produce_IndexSecondEntryLink(o_destination, i_ce);
257 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */