1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #include <precomp.h>
29*cdf0e10cSrcweir #include "hdimpl.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
33*cdf0e10cSrcweir #include <stdlib.h>
34*cdf0e10cSrcweir #include <stdio.h>
35*cdf0e10cSrcweir #include <ary/ceslot.hxx>
36*cdf0e10cSrcweir #include <ary/qualiname.hxx>
37*cdf0e10cSrcweir #include <ary/cpp/c_class.hxx>
38*cdf0e10cSrcweir #include <ary/cpp/c_de.hxx>
39*cdf0e10cSrcweir #include <ary/cpp/c_enum.hxx>
40*cdf0e10cSrcweir #include <ary/cpp/c_funct.hxx>
41*cdf0e10cSrcweir #include <ary/cpp/c_gate.hxx>
42*cdf0e10cSrcweir #include <ary/cpp/cp_ce.hxx>
43*cdf0e10cSrcweir #include <udm/html/htmlitem.hxx>
44*cdf0e10cSrcweir #include "cre_link.hxx"
45*cdf0e10cSrcweir #include "hd_docu.hxx"
46*cdf0e10cSrcweir #include "html_kit.hxx"
47*cdf0e10cSrcweir #include "opageenv.hxx"
48*cdf0e10cSrcweir #include "pagemake.hxx"
49*cdf0e10cSrcweir #include "strconst.hxx"
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir using namespace csi;
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir //********************       HtmlDisplay_Impl        *********************//
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir HtmlDisplay_Impl::~HtmlDisplay_Impl()
58*cdf0e10cSrcweir {
59*cdf0e10cSrcweir }
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir HtmlDisplay_Impl::HtmlDisplay_Impl( OuputPage_Environment & io_rEnv )
62*cdf0e10cSrcweir     :   pEnv(&io_rEnv)
63*cdf0e10cSrcweir         // aWriteHelper
64*cdf0e10cSrcweir {
65*cdf0e10cSrcweir }
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir //********************       Free Functions        *********************//
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir namespace dshelp
73*cdf0e10cSrcweir {
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir void
76*cdf0e10cSrcweir DisplaySlot( ary::Display &          o_rDisplay,
77*cdf0e10cSrcweir              const ary::AryGroup &   i_rGroup,
78*cdf0e10cSrcweir              ary::SlotAccessId       i_nSlot )
79*cdf0e10cSrcweir {
80*cdf0e10cSrcweir  	ary::Slot_AutoPtr pSlot( i_rGroup.Create_Slot(i_nSlot) );
81*cdf0e10cSrcweir     pSlot->StoreAt( o_rDisplay );
82*cdf0e10cSrcweir }
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir const char *
86*cdf0e10cSrcweir PathUp( uintt i_nLevels )
87*cdf0e10cSrcweir {
88*cdf0e10cSrcweir     static char sResult[300];
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir     sResult[0] = NULCH;
91*cdf0e10cSrcweir     for ( uintt lev = 0; lev < i_nLevels; ++lev )
92*cdf0e10cSrcweir     {
93*cdf0e10cSrcweir         strcat( sResult, "../");        // SAFE STRCAT (#100211# - checked)
94*cdf0e10cSrcweir     }
95*cdf0e10cSrcweir     return sResult;
96*cdf0e10cSrcweir }
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir const char *
99*cdf0e10cSrcweir PathPerLevelsUp( uintt                   i_nLevels,
100*cdf0e10cSrcweir                  const char *            i_nPathBelowDestinationLevel )
101*cdf0e10cSrcweir {
102*cdf0e10cSrcweir     static char sResult[500];
103*cdf0e10cSrcweir     strcpy( sResult, PathUp(i_nLevels) );               // SAFE STRCPY (#100211# - checked)
104*cdf0e10cSrcweir     // KORR_FUTURE: Make it still safer here:
105*cdf0e10cSrcweir     strcat( sResult, i_nPathBelowDestinationLevel );    // SAFE STRCAT (#100211# - checked)
106*cdf0e10cSrcweir     return sResult;
107*cdf0e10cSrcweir }
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir const char *
111*cdf0e10cSrcweir PathPerRoot( const OuputPage_Environment & i_rEnv,
112*cdf0e10cSrcweir              const char *                  i_sPathFromRootDir )
113*cdf0e10cSrcweir {
114*cdf0e10cSrcweir     return PathPerLevelsUp( i_rEnv.Depth(), i_sPathFromRootDir );
115*cdf0e10cSrcweir }
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir const char *
118*cdf0e10cSrcweir PathPerNamespace( const OuputPage_Environment & i_rEnv,
119*cdf0e10cSrcweir                   const char *                  i_sPathFromNamespaceDir )
120*cdf0e10cSrcweir {
121*cdf0e10cSrcweir     const ary::cpp::Namespace * pNsp = i_rEnv.CurNamespace();
122*cdf0e10cSrcweir     if ( pNsp == 0 )
123*cdf0e10cSrcweir         return "";
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir     uintt nCount = i_rEnv.Depth() - (pNsp->Depth() + 1) ;
126*cdf0e10cSrcweir     csv_assert( nCount < 100 );
127*cdf0e10cSrcweir     return PathPerLevelsUp( nCount, i_sPathFromNamespaceDir );
128*cdf0e10cSrcweir }
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir const char *
131*cdf0e10cSrcweir HtmlFileName( const char *            i_sPrefix,
132*cdf0e10cSrcweir               const char *            i_sEntityName )
133*cdf0e10cSrcweir {
134*cdf0e10cSrcweir     // KORR_FUTURE: Make it still safer here:
135*cdf0e10cSrcweir     static char sResult[300];
136*cdf0e10cSrcweir     strcpy( sResult, i_sPrefix );       // SAFE STRCPY (#100211# - checked)
137*cdf0e10cSrcweir     strcat( sResult, i_sEntityName );   // SAFE STRCAT (#100211# - checked)
138*cdf0e10cSrcweir     strcat( sResult, ".html" );         // SAFE STRCAT (#100211# - checked)
139*cdf0e10cSrcweir     return sResult;
140*cdf0e10cSrcweir }
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir const char *
143*cdf0e10cSrcweir Path2Class( uintt                   i_nLevelsUp,
144*cdf0e10cSrcweir             const char *            i_sClassLocalName )
145*cdf0e10cSrcweir {
146*cdf0e10cSrcweir     return PathPerLevelsUp( i_nLevelsUp, ClassFileName(i_sClassLocalName) );
147*cdf0e10cSrcweir }
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir const char *
150*cdf0e10cSrcweir Path2Child( const char *            i_sFileName,
151*cdf0e10cSrcweir             const char *            i_sSubDir )
152*cdf0e10cSrcweir {
153*cdf0e10cSrcweir     static char sResult[400];
154*cdf0e10cSrcweir     if ( i_sSubDir != 0 )
155*cdf0e10cSrcweir     {
156*cdf0e10cSrcweir         // KORR_FUTURE: Make it still safer here:
157*cdf0e10cSrcweir         strcpy( sResult, i_sSubDir );       // SAFE STRCPY (#100211# - checked)
158*cdf0e10cSrcweir         strcat( sResult, "/" );             // SAFE STRCAT (#100211# - checked)
159*cdf0e10cSrcweir     }
160*cdf0e10cSrcweir     else
161*cdf0e10cSrcweir     {
162*cdf0e10cSrcweir         sResult[0] = NULCH;
163*cdf0e10cSrcweir     }
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir     strcat( sResult, i_sFileName );         // SAFE STRCAT (#100211# - checked)
166*cdf0e10cSrcweir     return sResult;
167*cdf0e10cSrcweir }
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir const char *
170*cdf0e10cSrcweir Path2ChildNamespace( const char * i_sLocalName )
171*cdf0e10cSrcweir {
172*cdf0e10cSrcweir     return Path2Child( C_sHFN_Namespace, i_sLocalName );
173*cdf0e10cSrcweir }
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir String
176*cdf0e10cSrcweir OperationLink( const ary::cpp::Gate &               ,
177*cdf0e10cSrcweir                const String  &                      i_sOpName,
178*cdf0e10cSrcweir                ary::cpp::Ce_id                      i_nOpId,
179*cdf0e10cSrcweir                const char *                         i_sPrePath )
180*cdf0e10cSrcweir {
181*cdf0e10cSrcweir     StreamLock
182*cdf0e10cSrcweir         slResult(3000);
183*cdf0e10cSrcweir     StreamStr &
184*cdf0e10cSrcweir         sResult = slResult();
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir     sResult
187*cdf0e10cSrcweir         << i_sPrePath
188*cdf0e10cSrcweir         << "#"
189*cdf0e10cSrcweir         << i_sOpName
190*cdf0e10cSrcweir         << "-"
191*cdf0e10cSrcweir         << i_nOpId.Value();
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir     return sResult.c_str();
196*cdf0e10cSrcweir }
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir const char *
199*cdf0e10cSrcweir DataLink( const String  &         i_sLocalName,
200*cdf0e10cSrcweir           const char *            i_sPrePath )
201*cdf0e10cSrcweir {
202*cdf0e10cSrcweir     StreamLock
203*cdf0e10cSrcweir         slResult(3000);
204*cdf0e10cSrcweir     StreamStr &
205*cdf0e10cSrcweir         sResult = slResult();
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir     sResult
208*cdf0e10cSrcweir         << i_sPrePath
209*cdf0e10cSrcweir         << "#"
210*cdf0e10cSrcweir         << i_sLocalName;
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir     return sResult.c_str();
213*cdf0e10cSrcweir }
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir void
216*cdf0e10cSrcweir Get_LinkedTypeText( csi::xml::Element &             o_rOut,
217*cdf0e10cSrcweir                     const OuputPage_Environment &   i_rEnv,
218*cdf0e10cSrcweir                     ary::cpp::Type_id               i_nId,
219*cdf0e10cSrcweir                     bool                            i_bWithAbsolutifier )
220*cdf0e10cSrcweir {
221*cdf0e10cSrcweir     if (NOT i_nId.IsValid())
222*cdf0e10cSrcweir         return;
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir  	const char * sPreName = "";
225*cdf0e10cSrcweir  	const char * sName = "";
226*cdf0e10cSrcweir  	const char * sPostName = "";
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir     bool bTypeExists = Get_TypeText( sPreName,
229*cdf0e10cSrcweir                                      sName,
230*cdf0e10cSrcweir                                      sPostName,
231*cdf0e10cSrcweir                                      i_nId,
232*cdf0e10cSrcweir                                      i_rEnv.Gate() );
233*cdf0e10cSrcweir     if ( NOT bTypeExists )
234*cdf0e10cSrcweir         return;
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir     if ( NOT i_bWithAbsolutifier AND strncmp(sPreName,"::",2) == 0 )
237*cdf0e10cSrcweir         sPreName+=2;
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir     const ary::cpp::CodeEntity *
240*cdf0e10cSrcweir         pCe = i_rEnv.Gate().Search_RelatedCe(i_nId);
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir     String  sLink;
243*cdf0e10cSrcweir     if ( pCe != 0 )
244*cdf0e10cSrcweir     {
245*cdf0e10cSrcweir         sLink = Link2Ce(i_rEnv,*pCe);
246*cdf0e10cSrcweir     }
247*cdf0e10cSrcweir     else
248*cdf0e10cSrcweir     {
249*cdf0e10cSrcweir         if ( strstr(sPreName,"com::sun::star") != 0 )
250*cdf0e10cSrcweir         {
251*cdf0e10cSrcweir             static StreamStr aLink(400);
252*cdf0e10cSrcweir             aLink.seekp(0);
253*cdf0e10cSrcweir             aLink << PathPerRoot(i_rEnv, "../../common/ref");
254*cdf0e10cSrcweir             if ( *sPreName != ':' )
255*cdf0e10cSrcweir                 aLink << '/';
256*cdf0e10cSrcweir             for ( const char * s = sPreName;
257*cdf0e10cSrcweir                   *s != 0;
258*cdf0e10cSrcweir                   ++s )
259*cdf0e10cSrcweir             {
260*cdf0e10cSrcweir                 if ( *s == ':' )
261*cdf0e10cSrcweir                 {
262*cdf0e10cSrcweir                  	aLink << '/';
263*cdf0e10cSrcweir                     ++s;
264*cdf0e10cSrcweir                 }
265*cdf0e10cSrcweir                 else
266*cdf0e10cSrcweir                 {
267*cdf0e10cSrcweir                  	aLink << *s;
268*cdf0e10cSrcweir                 }
269*cdf0e10cSrcweir             }   // end for
270*cdf0e10cSrcweir             aLink << sName
271*cdf0e10cSrcweir                   << ".html";
272*cdf0e10cSrcweir             sLink = aLink.c_str();
273*cdf0e10cSrcweir         }
274*cdf0e10cSrcweir     }   // endif( pCe != 0 )
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir     o_rOut
277*cdf0e10cSrcweir         << sPreName;
278*cdf0e10cSrcweir     csi::xml::Element &
279*cdf0e10cSrcweir         o_Goon = sLink.length() > 0
280*cdf0e10cSrcweir                      ?   o_rOut >> * new html::Link( sLink.c_str() )
281*cdf0e10cSrcweir                      :   o_rOut;
282*cdf0e10cSrcweir     o_Goon
283*cdf0e10cSrcweir         <<  sName;
284*cdf0e10cSrcweir     o_rOut
285*cdf0e10cSrcweir         << sPostName;
286*cdf0e10cSrcweir }
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir void
289*cdf0e10cSrcweir Create_ChildListLabel( csi::xml::Element &     o_rParentElement,
290*cdf0e10cSrcweir                        const char *            i_sLabel )
291*cdf0e10cSrcweir {
292*cdf0e10cSrcweir     if ( NOT csv::no_str(i_sLabel) )
293*cdf0e10cSrcweir     {
294*cdf0e10cSrcweir         o_rParentElement
295*cdf0e10cSrcweir             >> *new html::Label(i_sLabel)
296*cdf0e10cSrcweir                     << " ";
297*cdf0e10cSrcweir     }
298*cdf0e10cSrcweir }
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir DYN csi::html::Table &
301*cdf0e10cSrcweir Create_ChildListTable( const char * i_sTitle )
302*cdf0e10cSrcweir {
303*cdf0e10cSrcweir     html::Table *
304*cdf0e10cSrcweir             dpTable = new html::Table;
305*cdf0e10cSrcweir     *dpTable
306*cdf0e10cSrcweir         << new html::ClassAttr( "childlist")
307*cdf0e10cSrcweir         << new xml::AnAttribute( "border", "1" )
308*cdf0e10cSrcweir         << new xml::AnAttribute( "cellpadding", "5" )
309*cdf0e10cSrcweir         << new xml::AnAttribute( "cellspacing", "0" )
310*cdf0e10cSrcweir         << new html::WidthAttr( "100%" );
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir     html::TableRow &
313*cdf0e10cSrcweir             rRow = dpTable->AddRow();
314*cdf0e10cSrcweir     rRow
315*cdf0e10cSrcweir         << new html::ClassAttr("subtitle")
316*cdf0e10cSrcweir         >> *new html::TableCell
317*cdf0e10cSrcweir                 << new xml::AnAttribute( "colspan","2" )
318*cdf0e10cSrcweir                 >> *new html::Headline(4)
319*cdf0e10cSrcweir                         << i_sTitle;
320*cdf0e10cSrcweir     return *dpTable;
321*cdf0e10cSrcweir }
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir const char *
324*cdf0e10cSrcweir Link2Ce( const OuputPage_Environment & i_rEnv,
325*cdf0e10cSrcweir          const ary::cpp::CodeEntity &  i_rCe )
326*cdf0e10cSrcweir {
327*cdf0e10cSrcweir     const uintt         nMaxSize
328*cdf0e10cSrcweir                             = 3000;
329*cdf0e10cSrcweir     static char         sLink[nMaxSize];
330*cdf0e10cSrcweir     static LinkCreator  aLinkCreator( &sLink[0], nMaxSize );
331*cdf0e10cSrcweir     sLink[0] = NULCH;
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir     aLinkCreator.SetEnv(i_rEnv);
334*cdf0e10cSrcweir     i_rCe.Accept(aLinkCreator);
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir     return sLink;
337*cdf0e10cSrcweir }
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir const char *
340*cdf0e10cSrcweir Link2CppDefinition( const OuputPage_Environment & i_rEnv,
341*cdf0e10cSrcweir                     const ary::cpp::DefineEntity &    i_rDef )
342*cdf0e10cSrcweir {
343*cdf0e10cSrcweir     const uintt         nMaxSize
344*cdf0e10cSrcweir                             = 1000;
345*cdf0e10cSrcweir     static char         sLink[nMaxSize];
346*cdf0e10cSrcweir     static LinkCreator  aLinkCreator( &sLink[0], nMaxSize );
347*cdf0e10cSrcweir     sLink[0] = NULCH;
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir     aLinkCreator.SetEnv(i_rEnv);
350*cdf0e10cSrcweir     i_rDef.Accept(aLinkCreator);
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir     return sLink;
353*cdf0e10cSrcweir }
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir const ary::cpp::CodeEntity *
356*cdf0e10cSrcweir FindUnambiguousCe( const OuputPage_Environment & i_rEnv,
357*cdf0e10cSrcweir                    const ary::QualifiedName &    i_rQuName,
358*cdf0e10cSrcweir                    const ary::cpp::Class *       i_pJustDocumentedClass )
359*cdf0e10cSrcweir {
360*cdf0e10cSrcweir  	if ( i_rEnv.CurNamespace() == 0 )
361*cdf0e10cSrcweir 		return 0;
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir 	const ary::cpp::CodeEntity * ret = 0;
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir     if ( NOT i_rQuName.IsQualified() )
366*cdf0e10cSrcweir     {
367*cdf0e10cSrcweir         if ( i_pJustDocumentedClass != 0 )
368*cdf0e10cSrcweir             ret = i_rEnv.Gate().Ces().Search_CeLocal( i_rQuName.LocalName(),
369*cdf0e10cSrcweir                                                       i_rQuName.IsFunction(),
370*cdf0e10cSrcweir                                                       *i_rEnv.CurNamespace(),
371*cdf0e10cSrcweir                                                       i_pJustDocumentedClass );
372*cdf0e10cSrcweir         if (ret != 0)
373*cdf0e10cSrcweir             return ret;
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir         ret = i_rEnv.Gate().Ces().Search_CeLocal( i_rQuName.LocalName(),
376*cdf0e10cSrcweir                                                   i_rQuName.IsFunction(),
377*cdf0e10cSrcweir                                                   *i_rEnv.CurNamespace(),
378*cdf0e10cSrcweir                                                   i_rEnv.CurClass() );
379*cdf0e10cSrcweir     }
380*cdf0e10cSrcweir     if (ret != 0)
381*cdf0e10cSrcweir         return ret;
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir     return i_rEnv.Gate().Ces().Search_CeAbsolute( *i_rEnv.CurNamespace(),
384*cdf0e10cSrcweir                                                   i_rQuName );
385*cdf0e10cSrcweir }
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir void
388*cdf0e10cSrcweir ShowDocu_On( csi::xml::Element &            o_rOut,
389*cdf0e10cSrcweir              Docu_Display &                 io_rDisplay,
390*cdf0e10cSrcweir              const ary::cpp::CppEntity &    i_rRE )
391*cdf0e10cSrcweir {
392*cdf0e10cSrcweir     if (i_rRE.Docu().Data() != 0)
393*cdf0e10cSrcweir     {
394*cdf0e10cSrcweir         io_rDisplay.Assign_Out( o_rOut );
395*cdf0e10cSrcweir         io_rDisplay.Process(i_rRE.Docu());
396*cdf0e10cSrcweir         io_rDisplay.Unassign_Out();
397*cdf0e10cSrcweir     }
398*cdf0e10cSrcweir }
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir void
401*cdf0e10cSrcweir WriteOut_TokenList( csi::xml::Element &     o_rOut,
402*cdf0e10cSrcweir                     const StringVector &    i_rTokens,
403*cdf0e10cSrcweir                     const char *            i_sSeparator )
404*cdf0e10cSrcweir {
405*cdf0e10cSrcweir     if ( i_rTokens.size() > 0 )
406*cdf0e10cSrcweir     {
407*cdf0e10cSrcweir         StringVector::const_iterator
408*cdf0e10cSrcweir             it      = i_rTokens.begin();
409*cdf0e10cSrcweir         StringVector::const_iterator
410*cdf0e10cSrcweir             itEnd   = i_rTokens.end();
411*cdf0e10cSrcweir 
412*cdf0e10cSrcweir         o_rOut << *it;
413*cdf0e10cSrcweir         for ( ++it; it != itEnd; ++it )
414*cdf0e10cSrcweir         {
415*cdf0e10cSrcweir             o_rOut << i_sSeparator << *it;
416*cdf0e10cSrcweir         }
417*cdf0e10cSrcweir     };
418*cdf0e10cSrcweir 
419*cdf0e10cSrcweir }
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir void
422*cdf0e10cSrcweir EraseLeadingSpace( String  & io_rStr )
423*cdf0e10cSrcweir {
424*cdf0e10cSrcweir     if ( *io_rStr.c_str() < 33 AND io_rStr.length() > 0 )
425*cdf0e10cSrcweir     {
426*cdf0e10cSrcweir         const unsigned char * pNew;
427*cdf0e10cSrcweir         for ( pNew = (const unsigned char * ) io_rStr.c_str();
428*cdf0e10cSrcweir               *pNew < 33 AND *pNew != 0;
429*cdf0e10cSrcweir               ++pNew ) {}
430*cdf0e10cSrcweir         String  sNew( (const char*)pNew );
431*cdf0e10cSrcweir         io_rStr = sNew;
432*cdf0e10cSrcweir     }
433*cdf0e10cSrcweir }
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir void
436*cdf0e10cSrcweir WriteOut_LinkedFunctionText( csi::xml::Element &            o_rTitleOut,
437*cdf0e10cSrcweir                              adcdisp::ParameterTable &      o_rParameters,
438*cdf0e10cSrcweir                              const ary::cpp::Function &     i_rFunction,
439*cdf0e10cSrcweir                              const OuputPage_Environment &  i_rEnv,
440*cdf0e10cSrcweir                              bool *                         o_bIsConst,
441*cdf0e10cSrcweir                              bool *                         o_bIsVirtual )
442*cdf0e10cSrcweir {
443*cdf0e10cSrcweir     // write pre-name:
444*cdf0e10cSrcweir     const ary::cpp::FunctionFlags & rFlags = i_rFunction.Flags();
445*cdf0e10cSrcweir     if ( rFlags.IsStaticLocal() OR rFlags.IsStaticMember() )
446*cdf0e10cSrcweir         o_rTitleOut << "static ";
447*cdf0e10cSrcweir     if ( rFlags.IsExplicit() )
448*cdf0e10cSrcweir         o_rTitleOut << "explicit ";
449*cdf0e10cSrcweir     if ( rFlags.IsMutable() )
450*cdf0e10cSrcweir         o_rTitleOut << "mutable ";
451*cdf0e10cSrcweir     if ( i_rFunction.Virtuality() != ary::cpp::VIRTUAL_none )
452*cdf0e10cSrcweir         o_rTitleOut << "virtual ";
453*cdf0e10cSrcweir //    o_rTitleOut << new html::LineBreak;
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir     Get_LinkedTypeText( o_rTitleOut, i_rEnv, i_rFunction.ReturnType() );
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir     // write name:
458*cdf0e10cSrcweir     o_rTitleOut
459*cdf0e10cSrcweir         << " "
460*cdf0e10cSrcweir         >> *new html::Strong
461*cdf0e10cSrcweir             << i_rFunction.LocalName();
462*cdf0e10cSrcweir     o_rTitleOut
463*cdf0e10cSrcweir             << "(";
464*cdf0e10cSrcweir 
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir     csi::xml::Element * pOutLast = &o_rTitleOut;
467*cdf0e10cSrcweir 
468*cdf0e10cSrcweir     // write post-name:
469*cdf0e10cSrcweir     FunctionParam_Iterator fit;
470*cdf0e10cSrcweir     fit.Assign(i_rFunction);
471*cdf0e10cSrcweir 
472*cdf0e10cSrcweir     if (fit)
473*cdf0e10cSrcweir     {
474*cdf0e10cSrcweir         o_rParameters.AddEntry();
475*cdf0e10cSrcweir         Get_LinkedTypeText( o_rParameters.Type(), i_rEnv, fit.CurType() );
476*cdf0e10cSrcweir         o_rParameters.Type() << " ";
477*cdf0e10cSrcweir         o_rParameters.Name() << " " << fit.CurName();
478*cdf0e10cSrcweir 
479*cdf0e10cSrcweir         for ( ++fit; fit; ++fit )
480*cdf0e10cSrcweir         {
481*cdf0e10cSrcweir             o_rParameters.Name() << ",";
482*cdf0e10cSrcweir             o_rParameters.AddEntry();
483*cdf0e10cSrcweir             Get_LinkedTypeText( o_rParameters.Type(), i_rEnv, fit.CurType() );
484*cdf0e10cSrcweir             o_rParameters.Name() << fit.CurName();
485*cdf0e10cSrcweir         }
486*cdf0e10cSrcweir 
487*cdf0e10cSrcweir         pOutLast = &o_rParameters.Name();
488*cdf0e10cSrcweir         o_rParameters.Name() << " ";
489*cdf0e10cSrcweir     }
490*cdf0e10cSrcweir 
491*cdf0e10cSrcweir     *pOutLast  << ")";
492*cdf0e10cSrcweir     if ( fit.IsFunctionConst() )
493*cdf0e10cSrcweir     {
494*cdf0e10cSrcweir         *pOutLast << " const";
495*cdf0e10cSrcweir         if ( o_bIsConst != 0 )
496*cdf0e10cSrcweir             *o_bIsConst = true;
497*cdf0e10cSrcweir     }
498*cdf0e10cSrcweir     if ( fit.IsFunctionVolatile() )
499*cdf0e10cSrcweir     {
500*cdf0e10cSrcweir         *pOutLast << " volatile";
501*cdf0e10cSrcweir         if ( o_bIsVirtual != 0 )
502*cdf0e10cSrcweir             *o_bIsVirtual = true;
503*cdf0e10cSrcweir     }
504*cdf0e10cSrcweir 
505*cdf0e10cSrcweir     // write Exceptions:
506*cdf0e10cSrcweir     const std::vector< ary::cpp::Type_id > *
507*cdf0e10cSrcweir             pThrow = i_rFunction.Exceptions();
508*cdf0e10cSrcweir     if ( pThrow)
509*cdf0e10cSrcweir     {
510*cdf0e10cSrcweir         std::vector< ary::cpp::Type_id >::const_iterator
511*cdf0e10cSrcweir 		    	it = pThrow->begin();
512*cdf0e10cSrcweir         std::vector< ary::cpp::Type_id >::const_iterator
513*cdf0e10cSrcweir 	    		it_end = pThrow->end();
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir         if (it != it_end)
516*cdf0e10cSrcweir         {
517*cdf0e10cSrcweir             o_rParameters.AddEntry();
518*cdf0e10cSrcweir             pOutLast = &o_rParameters.Name();
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir             o_rParameters.Name() << " throw( ";
521*cdf0e10cSrcweir             Get_LinkedTypeText(o_rParameters.Name(), i_rEnv, *it);
522*cdf0e10cSrcweir 
523*cdf0e10cSrcweir             for ( ++it; it != it_end; ++it )
524*cdf0e10cSrcweir             {
525*cdf0e10cSrcweir                 o_rParameters.Name() << ", ";
526*cdf0e10cSrcweir                 Get_LinkedTypeText(o_rParameters.Name(), i_rEnv, *it);
527*cdf0e10cSrcweir             }
528*cdf0e10cSrcweir             o_rParameters.Name() << " )";
529*cdf0e10cSrcweir         }
530*cdf0e10cSrcweir         else
531*cdf0e10cSrcweir         {
532*cdf0e10cSrcweir             *pOutLast << " throw()";
533*cdf0e10cSrcweir         }
534*cdf0e10cSrcweir     }   // endif // pThrow
535*cdf0e10cSrcweir 
536*cdf0e10cSrcweir     // abstractness:
537*cdf0e10cSrcweir     if ( i_rFunction.Virtuality() == ary::cpp::VIRTUAL_abstract )
538*cdf0e10cSrcweir         *pOutLast << " = 0";
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir     // finish:
541*cdf0e10cSrcweir     *pOutLast << ";";
542*cdf0e10cSrcweir }
543*cdf0e10cSrcweir 
544*cdf0e10cSrcweir 
545*cdf0e10cSrcweir 
546*cdf0e10cSrcweir }   // namespace dshelp
547