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 "opageenv.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
33*cdf0e10cSrcweir #include <cosv/ploc_dir.hxx>
34*cdf0e10cSrcweir #include <ary/cpp/c_ce.hxx>
35*cdf0e10cSrcweir #include <ary/cpp/c_class.hxx>
36*cdf0e10cSrcweir #include <ary/cpp/c_enum.hxx>
37*cdf0e10cSrcweir #include <ary/cpp/c_gate.hxx>
38*cdf0e10cSrcweir #include <ary/cpp/c_namesp.hxx>
39*cdf0e10cSrcweir #include <ary/cpp/c_tydef.hxx>
40*cdf0e10cSrcweir #include <ary/cpp/cp_ce.hxx>
41*cdf0e10cSrcweir #include <ary/loc/loc_file.hxx>
42*cdf0e10cSrcweir #include <udm/html/htmlitem.hxx>
43*cdf0e10cSrcweir #include <estack.hxx>
44*cdf0e10cSrcweir #include "hdimpl.hxx"
45*cdf0e10cSrcweir #include "strconst.hxx"
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir const String  C_sCppDir( "names" );
49*cdf0e10cSrcweir const String  C_sIndexDir( "ix" );
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir //************************         Implementation          ********************//
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir namespace
55*cdf0e10cSrcweir {
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir void    CreateDirectory( const csv::ploc::Path &    i_rPath );
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir void
60*cdf0e10cSrcweir CreateDirectory( const csv::ploc::Path & i_rPath )
61*cdf0e10cSrcweir {
62*cdf0e10cSrcweir     csv::ploc::Directory aDirectory(i_rPath);
63*cdf0e10cSrcweir 	if (NOT aDirectory.Exists())
64*cdf0e10cSrcweir         aDirectory.PhysicalCreate();
65*cdf0e10cSrcweir }
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir //************************         CheshireCat          ********************//
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir struct InNamespaceTree
70*cdf0e10cSrcweir {
71*cdf0e10cSrcweir     enum E_Type
72*cdf0e10cSrcweir     {
73*cdf0e10cSrcweir         t_unknown,
74*cdf0e10cSrcweir         t_namespace,
75*cdf0e10cSrcweir         t_type,
76*cdf0e10cSrcweir         t_operations,
77*cdf0e10cSrcweir         t_data
78*cdf0e10cSrcweir     };
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir     EStack< const ary::cpp::Namespace * >
81*cdf0e10cSrcweir                         aNamespaces; /// never empty.
82*cdf0e10cSrcweir     EStack< const ary::cpp::Class * >
83*cdf0e10cSrcweir                         aClasses;      /// maybe empty.
84*cdf0e10cSrcweir     const ary::cpp::CodeEntity *
85*cdf0e10cSrcweir                         pCe;        /// CurFileCe, maybe 0
86*cdf0e10cSrcweir     E_Type              eType;
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir                         InNamespaceTree(
89*cdf0e10cSrcweir                             const ary::cpp::Namespace &
90*cdf0e10cSrcweir                                                 i_rNsp );
91*cdf0e10cSrcweir                         ~InNamespaceTree();
92*cdf0e10cSrcweir     void                GoDown(
93*cdf0e10cSrcweir                             const ary::cpp::Namespace &
94*cdf0e10cSrcweir                                                 i_rNsp );
95*cdf0e10cSrcweir     void                GoDown(
96*cdf0e10cSrcweir                             const ary::cpp::Class &
97*cdf0e10cSrcweir                                                 i_rClass );
98*cdf0e10cSrcweir     void                GoUp();
99*cdf0e10cSrcweir };
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir InNamespaceTree::InNamespaceTree( const ary::cpp::Namespace & i_rNsp )
102*cdf0e10cSrcweir     :   // aNamespaces,
103*cdf0e10cSrcweir         // aClasses,
104*cdf0e10cSrcweir         pCe(0),
105*cdf0e10cSrcweir         eType(t_unknown)
106*cdf0e10cSrcweir {
107*cdf0e10cSrcweir     aNamespaces.push( &i_rNsp );
108*cdf0e10cSrcweir }
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir InNamespaceTree::~InNamespaceTree()
111*cdf0e10cSrcweir {
112*cdf0e10cSrcweir }
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir void
115*cdf0e10cSrcweir InNamespaceTree::GoDown( const ary::cpp::Namespace & i_rNsp )
116*cdf0e10cSrcweir {
117*cdf0e10cSrcweir     aNamespaces.push(&i_rNsp);
118*cdf0e10cSrcweir     aClasses.erase_all();
119*cdf0e10cSrcweir     pCe = 0;
120*cdf0e10cSrcweir     eType = t_unknown;
121*cdf0e10cSrcweir }
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir void
124*cdf0e10cSrcweir InNamespaceTree::GoDown( const ary::cpp::Class & i_rClass )
125*cdf0e10cSrcweir {
126*cdf0e10cSrcweir     aClasses.push(&i_rClass);
127*cdf0e10cSrcweir     pCe = 0;
128*cdf0e10cSrcweir     eType = t_unknown;
129*cdf0e10cSrcweir }
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir void
132*cdf0e10cSrcweir InNamespaceTree::GoUp()
133*cdf0e10cSrcweir {
134*cdf0e10cSrcweir     if ( NOT aClasses.empty() )
135*cdf0e10cSrcweir         aClasses.pop();
136*cdf0e10cSrcweir     else
137*cdf0e10cSrcweir         aNamespaces.pop();
138*cdf0e10cSrcweir     pCe = 0;
139*cdf0e10cSrcweir     eType = t_unknown;
140*cdf0e10cSrcweir }
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir struct InIndex
143*cdf0e10cSrcweir {
144*cdf0e10cSrcweir     char                cLetter;
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir                         InIndex() : cLetter('A') {}
147*cdf0e10cSrcweir };
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir }   // anonymous namespace
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir struct OuputPage_Environment::CheshireCat
157*cdf0e10cSrcweir {
158*cdf0e10cSrcweir     csv::ploc::Path     aOutputRoot;
159*cdf0e10cSrcweir     csv::ploc::Path     aMyPath;
160*cdf0e10cSrcweir     csv::StreamStr      aFileName;
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir     const ary::cpp::Gate *
163*cdf0e10cSrcweir                         pGate;
164*cdf0e10cSrcweir     const display::CorporateFrame *
165*cdf0e10cSrcweir                         pLayout;
166*cdf0e10cSrcweir     intt                nDepth;
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir     Dyn<InNamespaceTree>
169*cdf0e10cSrcweir                         pInNamespace;
170*cdf0e10cSrcweir     Dyn<InIndex>        pInIndex;
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir                         CheshireCat(
173*cdf0e10cSrcweir                             const csv::ploc::Path &
174*cdf0e10cSrcweir                                                 io_rOutputDir,
175*cdf0e10cSrcweir                             const ary::cpp::Gate &
176*cdf0e10cSrcweir                                                 i_rGate,
177*cdf0e10cSrcweir                             const display::CorporateFrame &
178*cdf0e10cSrcweir                                                 i_rLayout );
179*cdf0e10cSrcweir                         ~CheshireCat();
180*cdf0e10cSrcweir     void                AddQualifiedName2Path(
181*cdf0e10cSrcweir                             const ary::cpp::CodeEntity &
182*cdf0e10cSrcweir                                                 i_rCe,
183*cdf0e10cSrcweir                             bool                i_bIncludeLocalName );
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir     const Dyn<InNamespaceTree> &
186*cdf0e10cSrcweir                         NspEnv() const          { return pInNamespace; }
187*cdf0e10cSrcweir     Dyn<InNamespaceTree> &
188*cdf0e10cSrcweir                         NspEnv()                { return pInNamespace; }
189*cdf0e10cSrcweir     const ary::cpp::Namespace *
190*cdf0e10cSrcweir                         Namespace() const       { return pInNamespace ? pInNamespace->aNamespaces.top() : 0; }
191*cdf0e10cSrcweir     const ary::cpp::Class *
192*cdf0e10cSrcweir                         Class() const           { return pInNamespace ? (pInNamespace->aClasses.empty() ? 0 : pInNamespace->aClasses.top()) : 0; }
193*cdf0e10cSrcweir };
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir OuputPage_Environment::
196*cdf0e10cSrcweir CheshireCat::CheshireCat( const csv::ploc::Path &         io_rOutputDir,
197*cdf0e10cSrcweir                           const ary::cpp::Gate &   i_rGate,
198*cdf0e10cSrcweir                           const display::CorporateFrame & i_rLayout )
199*cdf0e10cSrcweir     :   aOutputRoot(io_rOutputDir),
200*cdf0e10cSrcweir         aMyPath(io_rOutputDir),
201*cdf0e10cSrcweir         aFileName(500),
202*cdf0e10cSrcweir         pGate(&i_rGate),
203*cdf0e10cSrcweir         pLayout(&i_rLayout),
204*cdf0e10cSrcweir         nDepth(0),
205*cdf0e10cSrcweir         pInNamespace(),
206*cdf0e10cSrcweir         pInIndex()
207*cdf0e10cSrcweir {
208*cdf0e10cSrcweir }
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir OuputPage_Environment::
211*cdf0e10cSrcweir CheshireCat::~CheshireCat()
212*cdf0e10cSrcweir {
213*cdf0e10cSrcweir }
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir void
216*cdf0e10cSrcweir OuputPage_Environment::
217*cdf0e10cSrcweir CheshireCat::AddQualifiedName2Path( const ary::cpp::CodeEntity & i_rCe,
218*cdf0e10cSrcweir                                     bool                    i_bIncludeLocalName )
219*cdf0e10cSrcweir {
220*cdf0e10cSrcweir     if (NOT i_rCe.Owner().IsValid())
221*cdf0e10cSrcweir     {
222*cdf0e10cSrcweir         aMyPath.DirChain().PushBack( C_sCppDir );
223*cdf0e10cSrcweir         return;
224*cdf0e10cSrcweir     }
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir     const ary::cpp::CodeEntity &
227*cdf0e10cSrcweir         rParent = pGate->Ces().Find_Ce( i_rCe.Owner() );
228*cdf0e10cSrcweir     AddQualifiedName2Path( rParent, true );
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir     if ( i_bIncludeLocalName )
231*cdf0e10cSrcweir         aMyPath.DirChain().PushBack( i_rCe.LocalName() );
232*cdf0e10cSrcweir }
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir //************************         OuputPage_Environment          ********************//
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir OuputPage_Environment::OuputPage_Environment( const csv::ploc::Path &           io_rOutputDir,
239*cdf0e10cSrcweir                                               const ary::cpp::Gate &            i_rGate,
240*cdf0e10cSrcweir                                               const display::CorporateFrame &   i_rLayout )
241*cdf0e10cSrcweir     :   pi( new CheshireCat(io_rOutputDir, i_rGate, i_rLayout) )
242*cdf0e10cSrcweir {
243*cdf0e10cSrcweir }
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir OuputPage_Environment::~OuputPage_Environment()
246*cdf0e10cSrcweir {
247*cdf0e10cSrcweir }
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir void
250*cdf0e10cSrcweir OuputPage_Environment::MoveDir_2Root()
251*cdf0e10cSrcweir {
252*cdf0e10cSrcweir     pi->NspEnv() = 0;
253*cdf0e10cSrcweir     pi->pInIndex = 0;
254*cdf0e10cSrcweir     pi->nDepth = 0;
255*cdf0e10cSrcweir     while ( pi->aMyPath.DirChain().Size() > pi->aOutputRoot.DirChain().Size() )
256*cdf0e10cSrcweir         pi->aMyPath.DirChain().PopBack();
257*cdf0e10cSrcweir     pi->aMyPath.SetFile(String ::Null_());
258*cdf0e10cSrcweir }
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir void
261*cdf0e10cSrcweir OuputPage_Environment::MoveDir_2Names()
262*cdf0e10cSrcweir {
263*cdf0e10cSrcweir     pi->NspEnv() = new InNamespaceTree( Gate().Ces().GlobalNamespace() );
264*cdf0e10cSrcweir     pi->aMyPath.DirChain().PushBack( C_sCppDir );
265*cdf0e10cSrcweir     pi->aMyPath.SetFile(String ::Null_());
266*cdf0e10cSrcweir     ++pi->nDepth;
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir    	CreateDirectory( pi->aMyPath );
269*cdf0e10cSrcweir }
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir void
272*cdf0e10cSrcweir OuputPage_Environment::MoveDir_Down2( const ary::cpp::Namespace & i_rNsp )
273*cdf0e10cSrcweir {
274*cdf0e10cSrcweir     csv_assert(i_rNsp.Depth() > 0);
275*cdf0e10cSrcweir     csv_assert( pi->NspEnv() );
276*cdf0e10cSrcweir     csv_assert( pi->Namespace()->CeId() == i_rNsp.Owner() );
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir     pi->NspEnv()->GoDown( i_rNsp );
279*cdf0e10cSrcweir     pi->aMyPath.DirChain().PushBack(i_rNsp.LocalName());
280*cdf0e10cSrcweir     ++pi->nDepth;
281*cdf0e10cSrcweir     pi->aMyPath.SetFile(String ::Null_());
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir    	CreateDirectory( pi->aMyPath );
284*cdf0e10cSrcweir }
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir void
287*cdf0e10cSrcweir OuputPage_Environment::MoveDir_Down2( const ary::cpp::Class & i_rClass )
288*cdf0e10cSrcweir {
289*cdf0e10cSrcweir     csv_assert( pi->NspEnv() );
290*cdf0e10cSrcweir     if ( i_rClass.Protection() == ary::cpp::PROTECT_global )
291*cdf0e10cSrcweir     {
292*cdf0e10cSrcweir         csv_assert( pi->Namespace()->CeId() == i_rClass.Owner() );
293*cdf0e10cSrcweir     }
294*cdf0e10cSrcweir     else
295*cdf0e10cSrcweir     {
296*cdf0e10cSrcweir         csv_assert( pi->Class() != 0 );
297*cdf0e10cSrcweir         csv_assert( pi->Class()->CeId() == i_rClass.Owner() );
298*cdf0e10cSrcweir     }
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir     pi->NspEnv()->GoDown(i_rClass);
301*cdf0e10cSrcweir     pi->aMyPath.DirChain().PushBack(i_rClass.LocalName());
302*cdf0e10cSrcweir     pi->aMyPath.SetFile(String ::Null_());
303*cdf0e10cSrcweir     ++pi->nDepth;
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir    	CreateDirectory( pi->aMyPath );
306*cdf0e10cSrcweir }
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir void
309*cdf0e10cSrcweir OuputPage_Environment::MoveDir_2Index()
310*cdf0e10cSrcweir {
311*cdf0e10cSrcweir     MoveDir_2Root();
312*cdf0e10cSrcweir     pi->pInIndex = new InIndex;
313*cdf0e10cSrcweir     pi->aMyPath.DirChain().PushBack( String (C_sDIR_Index) );
314*cdf0e10cSrcweir     pi->aMyPath.SetFile(String ::Null_());
315*cdf0e10cSrcweir     pi->nDepth = 1;
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir    	CreateDirectory( pi->aMyPath );
318*cdf0e10cSrcweir }
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir void
321*cdf0e10cSrcweir OuputPage_Environment::MoveDir_Up()
322*cdf0e10cSrcweir {
323*cdf0e10cSrcweir  	if ( pi->nDepth == 1 )
324*cdf0e10cSrcweir     {
325*cdf0e10cSrcweir      	MoveDir_2Root();
326*cdf0e10cSrcweir         return;
327*cdf0e10cSrcweir     }
328*cdf0e10cSrcweir     else if ( pi->NspEnv() )
329*cdf0e10cSrcweir     {
330*cdf0e10cSrcweir         pi->NspEnv()->GoUp();
331*cdf0e10cSrcweir         pi->aMyPath.DirChain().PopBack();
332*cdf0e10cSrcweir         pi->aMyPath.SetFile(String ::Null_());
333*cdf0e10cSrcweir         --pi->nDepth;
334*cdf0e10cSrcweir     }
335*cdf0e10cSrcweir }
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir void
338*cdf0e10cSrcweir OuputPage_Environment::SetFile_Css()
339*cdf0e10cSrcweir {
340*cdf0e10cSrcweir     pi->aMyPath.SetFile( C_sHFN_Css );
341*cdf0e10cSrcweir }
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir void
344*cdf0e10cSrcweir OuputPage_Environment::SetFile_Overview()
345*cdf0e10cSrcweir {
346*cdf0e10cSrcweir     pi->aMyPath.SetFile( C_sHFN_Overview );
347*cdf0e10cSrcweir }
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir void
350*cdf0e10cSrcweir OuputPage_Environment::SetFile_AllDefs()
351*cdf0e10cSrcweir {
352*cdf0e10cSrcweir     // Provisorium
353*cdf0e10cSrcweir     pi->aMyPath.SetFile("def-all.html");
354*cdf0e10cSrcweir }
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir void
357*cdf0e10cSrcweir OuputPage_Environment::SetFile_Index( char i_cLetter )
358*cdf0e10cSrcweir {
359*cdf0e10cSrcweir     csv_assert( 'A' <= i_cLetter AND i_cLetter <= 'Z' OR i_cLetter == '_' );
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir     static StreamStr sIndexFileName(40);
362*cdf0e10cSrcweir     sIndexFileName.seekp(0);
363*cdf0e10cSrcweir     sIndexFileName << "index-";
364*cdf0e10cSrcweir     if ( i_cLetter == '_' )
365*cdf0e10cSrcweir     {
366*cdf0e10cSrcweir         sIndexFileName << "27";
367*cdf0e10cSrcweir     }
368*cdf0e10cSrcweir     else
369*cdf0e10cSrcweir     {
370*cdf0e10cSrcweir         sIndexFileName << int(i_cLetter -'A' + 1);
371*cdf0e10cSrcweir     }
372*cdf0e10cSrcweir     sIndexFileName << ".html";
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir     pi->aMyPath.SetFile( sIndexFileName.c_str() );
375*cdf0e10cSrcweir }
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir void
378*cdf0e10cSrcweir OuputPage_Environment::SetFile_Help()
379*cdf0e10cSrcweir {
380*cdf0e10cSrcweir     pi->aMyPath.SetFile( C_sHFN_Help );
381*cdf0e10cSrcweir }
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir void
384*cdf0e10cSrcweir OuputPage_Environment::SetFile_CurNamespace()
385*cdf0e10cSrcweir {
386*cdf0e10cSrcweir     csv_assert( pi->NspEnv() );
387*cdf0e10cSrcweir     pi->aMyPath.SetFile("index.html");
388*cdf0e10cSrcweir     pi->NspEnv()->pCe = pi->Namespace();
389*cdf0e10cSrcweir     pi->NspEnv()->eType = InNamespaceTree::t_namespace;
390*cdf0e10cSrcweir }
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir void
393*cdf0e10cSrcweir OuputPage_Environment::SetFile_Class( const ary::cpp::Class & i_rClass )
394*cdf0e10cSrcweir {
395*cdf0e10cSrcweir     csv_assert( pi->NspEnv() );
396*cdf0e10cSrcweir     pi->aMyPath.SetFile( ClassFileName(i_rClass.LocalName()) );
397*cdf0e10cSrcweir     pi->NspEnv()->pCe = &i_rClass;
398*cdf0e10cSrcweir     pi->NspEnv()->eType = InNamespaceTree::t_type;
399*cdf0e10cSrcweir }
400*cdf0e10cSrcweir 
401*cdf0e10cSrcweir void
402*cdf0e10cSrcweir OuputPage_Environment::SetFile_Enum( const ary::cpp::Enum & i_rEnum )
403*cdf0e10cSrcweir {
404*cdf0e10cSrcweir     csv_assert( pi->NspEnv() );
405*cdf0e10cSrcweir     pi->aMyPath.SetFile( EnumFileName(i_rEnum.LocalName()) );
406*cdf0e10cSrcweir     pi->NspEnv()->pCe = &i_rEnum;
407*cdf0e10cSrcweir     pi->NspEnv()->eType = InNamespaceTree::t_type;
408*cdf0e10cSrcweir }
409*cdf0e10cSrcweir 
410*cdf0e10cSrcweir void
411*cdf0e10cSrcweir OuputPage_Environment::SetFile_Typedef( const ary::cpp::Typedef & i_rTypedef )
412*cdf0e10cSrcweir {
413*cdf0e10cSrcweir     csv_assert( pi->NspEnv() );
414*cdf0e10cSrcweir     pi->aMyPath.SetFile( TypedefFileName(i_rTypedef.LocalName()) );
415*cdf0e10cSrcweir     pi->NspEnv()->pCe = &i_rTypedef;
416*cdf0e10cSrcweir     pi->NspEnv()->eType = InNamespaceTree::t_type;
417*cdf0e10cSrcweir }
418*cdf0e10cSrcweir 
419*cdf0e10cSrcweir void
420*cdf0e10cSrcweir OuputPage_Environment::SetFile_Operations( const ary::loc::File * i_pFile )
421*cdf0e10cSrcweir {
422*cdf0e10cSrcweir     csv_assert( pi->NspEnv() );
423*cdf0e10cSrcweir     if ( CurClass() != 0 )
424*cdf0e10cSrcweir         pi->aMyPath.SetFile( "o.html" );
425*cdf0e10cSrcweir 	else
426*cdf0e10cSrcweir     {
427*cdf0e10cSrcweir         csv_assert( i_pFile != 0 );
428*cdf0e10cSrcweir         pi->aMyPath.SetFile( HtmlFileName("o-", i_pFile->LocalName()) );
429*cdf0e10cSrcweir     }
430*cdf0e10cSrcweir     pi->NspEnv()->pCe = 0;
431*cdf0e10cSrcweir     pi->NspEnv()->eType = InNamespaceTree::t_operations;
432*cdf0e10cSrcweir }
433*cdf0e10cSrcweir 
434*cdf0e10cSrcweir void
435*cdf0e10cSrcweir OuputPage_Environment::SetFile_Data( const ary::loc::File * i_pFile )
436*cdf0e10cSrcweir {
437*cdf0e10cSrcweir     csv_assert( pi->NspEnv() );
438*cdf0e10cSrcweir     if ( CurClass() != 0 )
439*cdf0e10cSrcweir         pi->aMyPath.SetFile( "d.html" );
440*cdf0e10cSrcweir     else
441*cdf0e10cSrcweir     {
442*cdf0e10cSrcweir         csv_assert( i_pFile != 0 );
443*cdf0e10cSrcweir         pi->aMyPath.SetFile( HtmlFileName("d-", i_pFile->LocalName()) );
444*cdf0e10cSrcweir     }
445*cdf0e10cSrcweir     pi->NspEnv()->pCe = 0;
446*cdf0e10cSrcweir     pi->NspEnv()->eType = InNamespaceTree::t_data;
447*cdf0e10cSrcweir }
448*cdf0e10cSrcweir 
449*cdf0e10cSrcweir const ary::cpp::Namespace *
450*cdf0e10cSrcweir OuputPage_Environment::CurNamespace() const
451*cdf0e10cSrcweir {
452*cdf0e10cSrcweir     return pi->Namespace();
453*cdf0e10cSrcweir }
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir const ary::cpp::Class *
456*cdf0e10cSrcweir OuputPage_Environment::CurClass() const
457*cdf0e10cSrcweir {
458*cdf0e10cSrcweir     return pi->Class();
459*cdf0e10cSrcweir }
460*cdf0e10cSrcweir 
461*cdf0e10cSrcweir const csv::ploc::Path &
462*cdf0e10cSrcweir OuputPage_Environment::CurPath() const
463*cdf0e10cSrcweir {
464*cdf0e10cSrcweir     return pi->aMyPath;
465*cdf0e10cSrcweir }
466*cdf0e10cSrcweir 
467*cdf0e10cSrcweir const ary::cpp::Gate &
468*cdf0e10cSrcweir OuputPage_Environment::Gate() const
469*cdf0e10cSrcweir {
470*cdf0e10cSrcweir     return *pi->pGate;
471*cdf0e10cSrcweir }
472*cdf0e10cSrcweir 
473*cdf0e10cSrcweir const display::CorporateFrame &
474*cdf0e10cSrcweir OuputPage_Environment::Layout() const
475*cdf0e10cSrcweir {
476*cdf0e10cSrcweir     return *pi->pLayout;
477*cdf0e10cSrcweir }
478*cdf0e10cSrcweir 
479*cdf0e10cSrcweir uintt
480*cdf0e10cSrcweir OuputPage_Environment::Depth() const
481*cdf0e10cSrcweir {
482*cdf0e10cSrcweir     return static_cast<uintt>(pi->nDepth);
483*cdf0e10cSrcweir }
484*cdf0e10cSrcweir 
485*cdf0e10cSrcweir const String &
486*cdf0e10cSrcweir OuputPage_Environment::RepositoryTitle() const
487*cdf0e10cSrcweir {
488*cdf0e10cSrcweir     return Gate().RepositoryTitle();
489*cdf0e10cSrcweir }
490