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 <html/chd_udk2.hxx>
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
33*cdf0e10cSrcweir #include <cosv/tpl/tpltools.hxx>
34*cdf0e10cSrcweir #include <ary/ary_disp.hxx>
35*cdf0e10cSrcweir #include <ary/ceslot.hxx>
36*cdf0e10cSrcweir #include <ary/cpp/c_gate.hxx>
37*cdf0e10cSrcweir #include <ary/cpp/c_namesp.hxx>
38*cdf0e10cSrcweir #include <ary/cpp/cp_ce.hxx>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir #include "dsply_cl.hxx"
41*cdf0e10cSrcweir #include "dsply_da.hxx"
42*cdf0e10cSrcweir #include "dsply_op.hxx"
43*cdf0e10cSrcweir #include "opageenv.hxx"
44*cdf0e10cSrcweir #include "outfile.hxx"
45*cdf0e10cSrcweir #include "pagemake.hxx"
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir //********************      CppHtmlDisplay_Udk2     ********************//
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir CppHtmlDisplay_Udk2::CppHtmlDisplay_Udk2()
53*cdf0e10cSrcweir     :   pCurPageEnv(0)
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir }
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir CppHtmlDisplay_Udk2::~CppHtmlDisplay_Udk2()
58*cdf0e10cSrcweir {
59*cdf0e10cSrcweir }
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir void
62*cdf0e10cSrcweir CppHtmlDisplay_Udk2::do_Run( const char *                      i_sOutputDirectory,
63*cdf0e10cSrcweir                              const ary::cpp::Gate &            i_rAryGate,
64*cdf0e10cSrcweir                              const display::CorporateFrame &   i_rLayout )
65*cdf0e10cSrcweir {
66*cdf0e10cSrcweir     SetRunData( i_sOutputDirectory, i_rAryGate, i_rLayout );
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir     Create_Css_File();
69*cdf0e10cSrcweir     Create_Overview_File();
70*cdf0e10cSrcweir     Create_Help_File();
71*cdf0e10cSrcweir     Create_AllDefs_File();
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir     CreateFiles_InSubTree_Namespaces();
74*cdf0e10cSrcweir     CreateFiles_InSubTree_Index();
75*cdf0e10cSrcweir }
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir void
78*cdf0e10cSrcweir CppHtmlDisplay_Udk2::SetRunData( const char *                       i_sOutputDirectory,
79*cdf0e10cSrcweir                                  const ary::cpp::Gate &             i_rAryGate,
80*cdf0e10cSrcweir                                  const display::CorporateFrame &    i_rLayout )
81*cdf0e10cSrcweir {
82*cdf0e10cSrcweir     csv::ploc::Path aOutputDir( i_sOutputDirectory, true );
83*cdf0e10cSrcweir     pCurPageEnv = new OuputPage_Environment( aOutputDir, i_rAryGate, i_rLayout );
84*cdf0e10cSrcweir }
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir void
87*cdf0e10cSrcweir CppHtmlDisplay_Udk2::Create_Css_File()
88*cdf0e10cSrcweir {
89*cdf0e10cSrcweir     pCurPageEnv->MoveDir_2Root();
90*cdf0e10cSrcweir     pCurPageEnv->SetFile_Css();
91*cdf0e10cSrcweir     HtmlDocuFile::WriteCssFile(pCurPageEnv->CurPath());
92*cdf0e10cSrcweir }
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir void
95*cdf0e10cSrcweir CppHtmlDisplay_Udk2::Create_Overview_File()
96*cdf0e10cSrcweir {
97*cdf0e10cSrcweir     pCurPageEnv->MoveDir_2Root();
98*cdf0e10cSrcweir     PageDisplay aPageMaker( *pCurPageEnv );
99*cdf0e10cSrcweir     aPageMaker.Create_OverviewFile();
100*cdf0e10cSrcweir }
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir void
103*cdf0e10cSrcweir CppHtmlDisplay_Udk2::Create_Help_File()
104*cdf0e10cSrcweir {
105*cdf0e10cSrcweir     PageDisplay aPageMaker( *pCurPageEnv );
106*cdf0e10cSrcweir     aPageMaker.Create_HelpFile();
107*cdf0e10cSrcweir }
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir void
110*cdf0e10cSrcweir CppHtmlDisplay_Udk2::Create_AllDefs_File()
111*cdf0e10cSrcweir {
112*cdf0e10cSrcweir     PageDisplay aPageMaker( *pCurPageEnv );
113*cdf0e10cSrcweir     aPageMaker.Create_AllDefsFile();
114*cdf0e10cSrcweir }
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir void
117*cdf0e10cSrcweir CppHtmlDisplay_Udk2::CreateFiles_InSubTree_Namespaces()
118*cdf0e10cSrcweir {
119*cdf0e10cSrcweir     Cout() << "\nCreate files in subtree namespaces" << Endl();
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir     const ary::cpp::Namespace &
122*cdf0e10cSrcweir         rGlobalNsp = Gate().Ces().GlobalNamespace();
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir     RecursiveDisplay_Namespace(rGlobalNsp);
125*cdf0e10cSrcweir     Cout() << Endl();
126*cdf0e10cSrcweir }
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir void
129*cdf0e10cSrcweir CppHtmlDisplay_Udk2::CreateFiles_InSubTree_Index()
130*cdf0e10cSrcweir {
131*cdf0e10cSrcweir     Cout() << "\nCreate files in subtree index" << Endl();
132*cdf0e10cSrcweir     Cout() << Endl();
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir     PageDisplay aPageMaker( *pCurPageEnv );
135*cdf0e10cSrcweir     aPageMaker.Create_IndexFiles();
136*cdf0e10cSrcweir }
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir void
139*cdf0e10cSrcweir CppHtmlDisplay_Udk2::RecursiveDisplay_Namespace( const ary::cpp::Namespace & i_rNsp )
140*cdf0e10cSrcweir {
141*cdf0e10cSrcweir     if (i_rNsp.Owner().IsValid())
142*cdf0e10cSrcweir         pCurPageEnv->MoveDir_Down2( i_rNsp );
143*cdf0e10cSrcweir     else
144*cdf0e10cSrcweir         pCurPageEnv->MoveDir_2Names();
145*cdf0e10cSrcweir     DisplayFiles_InNamespace( i_rNsp );
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir     typedef std::vector< const ary::cpp::Namespace* > NspList;
148*cdf0e10cSrcweir     NspList     aSubNspList;
149*cdf0e10cSrcweir     i_rNsp.Get_SubNamespaces( aSubNspList );
150*cdf0e10cSrcweir     for ( NspList::const_iterator it = aSubNspList.begin();
151*cdf0e10cSrcweir           it != aSubNspList.end();
152*cdf0e10cSrcweir           ++it )
153*cdf0e10cSrcweir     {
154*cdf0e10cSrcweir         RecursiveDisplay_Namespace( *(*it) );
155*cdf0e10cSrcweir     }   // end for
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 	pCurPageEnv->MoveDir_Up();
158*cdf0e10cSrcweir }
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir void
161*cdf0e10cSrcweir CppHtmlDisplay_Udk2::DisplayFiles_InNamespace( const ary::cpp::Namespace & i_rNsp )
162*cdf0e10cSrcweir {
163*cdf0e10cSrcweir     PageDisplay aPageMaker( *pCurPageEnv );
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir     ary::Slot_AutoPtr pSlot;
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir     // Namespace
168*cdf0e10cSrcweir     aPageMaker.Create_NamespaceFile();
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir     // Classes
171*cdf0e10cSrcweir     ClassDisplayer aClassDisplayer( *pCurPageEnv );
172*cdf0e10cSrcweir     DisplaySlot( aClassDisplayer, i_rNsp, ary::cpp::Namespace::SLOT_Classes );
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir     // Enums
175*cdf0e10cSrcweir     DisplaySlot( aPageMaker, i_rNsp, ary::cpp::Namespace::SLOT_Enums );
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir     // Typedefs
178*cdf0e10cSrcweir     DisplaySlot( aPageMaker, i_rNsp, ary::cpp::Namespace::SLOT_Typedefs );
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir     // Operations
181*cdf0e10cSrcweir     OperationsDisplay aOperationsDisplayer( *pCurPageEnv );
182*cdf0e10cSrcweir     DisplaySlot( aOperationsDisplayer, i_rNsp, ary::cpp::Namespace::SLOT_Operations );
183*cdf0e10cSrcweir     aOperationsDisplayer.Create_Files();
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir     // Data
186*cdf0e10cSrcweir     DataDisplay aDataDisplayer( *pCurPageEnv );
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir     aDataDisplayer.PrepareForConstants();
189*cdf0e10cSrcweir     DisplaySlot( aDataDisplayer, i_rNsp, ary::cpp::Namespace::SLOT_Constants );
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir     aDataDisplayer.PrepareForVariables();
192*cdf0e10cSrcweir     DisplaySlot( aDataDisplayer, i_rNsp, ary::cpp::Namespace::SLOT_Variables );
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir     aDataDisplayer.Create_Files();
195*cdf0e10cSrcweir }
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir const ary::cpp::Gate &
198*cdf0e10cSrcweir CppHtmlDisplay_Udk2::Gate() const
199*cdf0e10cSrcweir {
200*cdf0e10cSrcweir     return pCurPageEnv->Gate();
201*cdf0e10cSrcweir }
202