merge the formfield patch from ooo-build
[ooovba.git] / autodoc / source / display / idl / hfi_xrefpage.cxx
blob745b786382c2de8388f3b2de59788e98a090e7a3
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_xrefpage.cxx,v $
10 * $Revision: 1.11 $
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_xrefpage.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 <toolkit/hf_title.hxx>
40 #include "hfi_navibar.hxx"
41 #include "hfi_typetext.hxx"
42 #include "hi_env.hxx"
45 namespace
48 const String
49 C_sTitleStart("uses of ");
50 const String
51 C_sCRLF("\n");
52 const String
53 C_sDevMan("References in Developers Guide");
55 } // anonymous namespace
59 HF_IdlXrefs::HF_IdlXrefs( Environment & io_rEnv,
60 Xml::Element & o_rOut,
61 const String & i_prefix,
62 const client & i_ce )
63 : HtmlFactory_Idl(io_rEnv, &o_rOut),
64 rContentDirectory(*new Html::Paragraph),
65 pClient(&i_ce)
67 produce_Main(i_prefix, i_ce);
70 HF_IdlXrefs::~HF_IdlXrefs()
74 void
75 HF_IdlXrefs::Write_ManualLinks( const client & i_ce ) const
77 const StringVector &
78 rLinks2Refs = i_ce.Secondaries().Links2RefsInManual();
79 if ( rLinks2Refs.size() == 0 )
81 rContentDirectory
82 << C_sDevMan
83 << new Html::LineBreak
84 << C_sCRLF;
85 return;
89 rContentDirectory
90 >> *new Html::Link("#devmanrefs")
91 << C_sDevMan
92 << new Html::LineBreak
93 << C_sCRLF;
95 HF_SubTitleTable
96 aList(CurOut(), "devmanrefs", C_sDevMan, 1);
97 Xml::Element &
98 rOutCell = aList.Add_Row() >>* new Html::TableCell;
100 csv_assert(rLinks2Refs.size() % 2 == 0);
101 for ( StringVector::const_iterator it = rLinks2Refs.begin();
102 it != rLinks2Refs.end();
103 ++it )
105 Xml::Element &
106 rLink = rOutCell >> *new Html::Link( Env().Link2Manual(*it));
107 if ( (*(it+1)).empty() )
109 // HACK KORR_FUTURE
110 // Research what happens with manual links which contain normal characters
111 // in non-utf-8 texts. And research, why utfF-8 does not work here.
112 rLink << new Xml::XmlCode(*it);
113 else
114 // HACK KORR_FUTURE, see above.
115 rLink << new Xml::XmlCode( *(it+1) );
116 rOutCell
117 << new Html::LineBreak
118 << C_sCRLF;
119 ++it;
120 } // end for
123 void
124 HF_IdlXrefs::Produce_List( const char * i_title,
125 const char * i_label,
126 ce_list & i_iterator ) const
128 if (NOT i_iterator)
130 rContentDirectory
131 << i_title
132 << new Html::LineBreak
133 << C_sCRLF;
134 return;
137 csv_assert(*i_label == '#');
139 rContentDirectory
140 >> *new Html::Link(i_label)
141 << i_title
142 << new Html::LineBreak
143 << C_sCRLF;
145 HF_SubTitleTable
146 aList(CurOut(), i_label+1, i_title, 1);
147 Xml::Element &
148 rOutCell = aList.Add_Row() >>* new Html::TableCell;
149 HF_IdlTypeText
150 aTypeWriter(Env(), rOutCell, true, pClient);
151 for ( ce_list & it = i_iterator; it; ++it )
153 aTypeWriter.Produce_byData(*it);
154 rOutCell << new Html::LineBreak;
155 } // end for
158 void
159 HF_IdlXrefs::Produce_Tree( const char * i_title,
160 const char * i_label,
161 const client & i_ce,
162 F_GET_SUBLIST i_sublistcreator ) const
164 dyn_ce_list pResult;
165 (*i_sublistcreator)(pResult, i_ce);
167 if (NOT (*pResult).operator bool())
169 rContentDirectory
170 << i_title
171 << new Html::LineBreak
172 << C_sCRLF;
173 return;
176 csv_assert(*i_label == '#');
178 rContentDirectory
179 >> *new Html::Link(i_label)
180 << i_title
181 << new Html::LineBreak
182 << C_sCRLF;
184 HF_SubTitleTable
185 aList(CurOut(), i_label+1, i_title, 1);
186 Xml::Element &
187 rOut = aList.Add_Row()
188 >>* new Html::TableCell
189 >> *new csi::xml::AnElement("pre")
190 << new csi::html::StyleAttr("font-family:monospace;");
192 recursive_make_ListInTree( rOut,
194 i_ce,
195 *pResult,
196 i_sublistcreator );
199 void
200 HF_IdlXrefs::produce_Main( const String & i_prefix,
201 const client & i_ce ) const
203 make_Navibar(i_ce);
205 HF_TitleTable
206 aTitle(CurOut());
207 StreamLock sl(200);
208 aTitle.Produce_Title( sl()
209 << C_sTitleStart
210 << i_prefix
211 << " "
212 << i_ce.LocalName()
213 << c_str );
215 aTitle.Add_Row() << &rContentDirectory;
216 sl().reset();
217 rContentDirectory
218 >> *new Html::Link( sl() << i_ce.LocalName()
219 << ".html"
220 << c_str )
221 >> *new Html::Bold
222 << "back to "
223 << i_prefix
224 << " "
225 << i_ce.LocalName();
226 rContentDirectory
227 << new Html::LineBreak
228 << new Html::LineBreak
229 << C_sCRLF;
231 CurOut() << new Html::HorizontalLine();
234 void
235 HF_IdlXrefs::make_Navibar( const client & i_ce ) const
237 HF_IdlNavigationBar
238 aNaviBar(Env(), CurOut());
239 aNaviBar.Produce_CeXrefsMainRow(i_ce);
240 CurOut() << new Html::HorizontalLine();
243 void
244 HF_IdlXrefs::recursive_make_ListInTree( Xml::Element & o_rDisplay,
245 uintt i_level,
246 const client & i_ce,
247 ce_list & i_iterator,
248 F_GET_SUBLIST i_sublistcreator ) const
250 const char * sLevelIndentation = " ";
252 HF_IdlTypeText
253 aTypeWriter(Env(), o_rDisplay, true, &i_ce);
254 for ( ; i_iterator.operator bool(); ++i_iterator )
256 for (uintt i = 0; i < i_level; ++i)
258 o_rDisplay << sLevelIndentation;
259 } // end for
261 aTypeWriter.Produce_byData(*i_iterator);
262 o_rDisplay << C_sCRLF;
264 dyn_ce_list pResult;
265 const client & rCe = Env().Gate().Ces().Find_Ce(*i_iterator);
266 (*i_sublistcreator)(pResult, rCe);
267 if ( (*pResult).operator bool() )
269 recursive_make_ListInTree( o_rDisplay,
270 i_level + 1,
271 rCe,
272 *pResult,
273 i_sublistcreator );
275 } // end for