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 "adc_cmds.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
33*cdf0e10cSrcweir #include <ary/ary.hxx>
34*cdf0e10cSrcweir #include <autodoc/displaying.hxx>
35*cdf0e10cSrcweir #include <autodoc/dsp_html_std.hxx>
36*cdf0e10cSrcweir #include <display/corframe.hxx>
37*cdf0e10cSrcweir #include <adc_cl.hxx>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir namespace autodoc
41*cdf0e10cSrcweir {
42*cdf0e10cSrcweir namespace command
43*cdf0e10cSrcweir {
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir extern const String C_opt_Include("-I:");
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir extern const String C_opt_Verbose("-v");
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir extern const String C_opt_Parse("-parse");
50*cdf0e10cSrcweir extern const String C_opt_Name("-name");
51*cdf0e10cSrcweir extern const String C_opt_LangAll("-lg");
52*cdf0e10cSrcweir extern const String C_opt_ExtensionsAll("-extg");
53*cdf0e10cSrcweir extern const String C_opt_DevmanFile("-dvgfile");
54*cdf0e10cSrcweir extern const String C_opt_SinceFile("-sincefile");
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir extern const String C_arg_Cplusplus("c++");
57*cdf0e10cSrcweir extern const String C_arg_Idl("idl");
58*cdf0e10cSrcweir extern const String C_arg_Java("java");
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir extern const String C_opt_Project("-p");
61*cdf0e10cSrcweir //extern const String C_opt_Lang;
62*cdf0e10cSrcweir //extern const String C_opt_Extensions;
63*cdf0e10cSrcweir extern const String C_opt_SourceDir("-d");
64*cdf0e10cSrcweir extern const String C_opt_SourceTree("-t");
65*cdf0e10cSrcweir extern const String C_opt_SourceFile("-f");
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir extern const String C_opt_CreateHtml("-html");
68*cdf0e10cSrcweir extern const String C_opt_DevmanRoot("-dvgroot");
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir //extern const String C_opt_CreateXml("-xml");
71*cdf0e10cSrcweir //extern const String C_opt_Load("-load");
72*cdf0e10cSrcweir //extern const String C_opt_Save("-save");
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir extern const String C_opt_ExternNamespace("-extnsp");
75*cdf0e10cSrcweir extern const String C_opt_ExternRoot("-extroot");
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir //**************************        CreateHTML    ***********************//
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir CreateHtml::CreateHtml()
82*cdf0e10cSrcweir     :   sOutputRootDirectory(),
83*cdf0e10cSrcweir         sDevelopersManual_HtmlRoot()
84*cdf0e10cSrcweir {
85*cdf0e10cSrcweir }
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir CreateHtml::~CreateHtml()
88*cdf0e10cSrcweir {
89*cdf0e10cSrcweir }
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir void
92*cdf0e10cSrcweir CreateHtml::do_Init( opt_iter &          it,
93*cdf0e10cSrcweir                      opt_iter            itEnd )
94*cdf0e10cSrcweir {
95*cdf0e10cSrcweir     ++it;
96*cdf0e10cSrcweir     CHECKOPT( it != itEnd && (*it).char_at(0) != '-',
97*cdf0e10cSrcweir               "output directory", C_opt_CreateHtml );
98*cdf0e10cSrcweir     sOutputRootDirectory = *it;
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir     for ( ++it;
101*cdf0e10cSrcweir           it != itEnd AND (*it == C_opt_DevmanRoot);
102*cdf0e10cSrcweir           ++it )
103*cdf0e10cSrcweir     {
104*cdf0e10cSrcweir         if (*it == C_opt_DevmanRoot)
105*cdf0e10cSrcweir         {
106*cdf0e10cSrcweir             ++it;
107*cdf0e10cSrcweir             CHECKOPT( it != itEnd AND (*it).char_at(0) != '-',
108*cdf0e10cSrcweir                       "HTML root directory of Developers Guide",
109*cdf0e10cSrcweir                       C_opt_DevmanRoot );
110*cdf0e10cSrcweir             sDevelopersManual_HtmlRoot = *it;
111*cdf0e10cSrcweir         }
112*cdf0e10cSrcweir     }   // end for
113*cdf0e10cSrcweir }
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir bool
116*cdf0e10cSrcweir CreateHtml::do_Run() const
117*cdf0e10cSrcweir {
118*cdf0e10cSrcweir     if ( CommandLine::Get_().IdlUsed() )
119*cdf0e10cSrcweir         run_Idl();
120*cdf0e10cSrcweir     if ( CommandLine::Get_().CppUsed() )
121*cdf0e10cSrcweir         run_Cpp();
122*cdf0e10cSrcweir     return true;
123*cdf0e10cSrcweir }
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir int
126*cdf0e10cSrcweir CreateHtml::inq_RunningRank() const
127*cdf0e10cSrcweir {
128*cdf0e10cSrcweir     return static_cast<int>(rank_CreateHtml);
129*cdf0e10cSrcweir }
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir void
132*cdf0e10cSrcweir CreateHtml::run_Idl() const
133*cdf0e10cSrcweir {
134*cdf0e10cSrcweir     const ary::idl::Gate &
135*cdf0e10cSrcweir         rGate = CommandLine::Get_().TheRepository().Gate_Idl();
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir     Cout() << "Creating HTML-output into the directory "
138*cdf0e10cSrcweir               << sOutputRootDirectory
139*cdf0e10cSrcweir               << "."
140*cdf0e10cSrcweir               << Endl();
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir     const DisplayToolsFactory_Ifc &
143*cdf0e10cSrcweir         rToolsFactory = DisplayToolsFactory_Ifc::GetIt_();
144*cdf0e10cSrcweir     Dyn<autodoc::HtmlDisplay_Idl_Ifc>
145*cdf0e10cSrcweir         pDisplay( rToolsFactory.Create_HtmlDisplay_Idl() );
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir     DYN display::CorporateFrame &   // KORR_FUTURE: Remove the need for const_cast
148*cdf0e10cSrcweir         drFrame = const_cast< display::CorporateFrame& >(rToolsFactory.Create_StdFrame());
149*cdf0e10cSrcweir     if (NOT DevelopersManual_HtmlRoot().empty())
150*cdf0e10cSrcweir         drFrame.Set_DevelopersGuideHtmlRoot( DevelopersManual_HtmlRoot() );
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir     pDisplay->Run( sOutputRootDirectory,
153*cdf0e10cSrcweir                    rGate,
154*cdf0e10cSrcweir                    drFrame );
155*cdf0e10cSrcweir }
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir void
158*cdf0e10cSrcweir CreateHtml::run_Cpp() const
159*cdf0e10cSrcweir {
160*cdf0e10cSrcweir     const ary::Repository &
161*cdf0e10cSrcweir         rReposy = CommandLine::Get_().TheRepository();
162*cdf0e10cSrcweir     const ary::cpp::Gate &
163*cdf0e10cSrcweir         rGate = rReposy.Gate_Cpp();
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir     const DisplayToolsFactory_Ifc &
166*cdf0e10cSrcweir         rToolsFactory = DisplayToolsFactory_Ifc::GetIt_();
167*cdf0e10cSrcweir     Dyn< autodoc::HtmlDisplay_UdkStd >
168*cdf0e10cSrcweir         pDisplay( rToolsFactory.Create_HtmlDisplay_UdkStd() );
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir     pDisplay->Run( sOutputRootDirectory,
171*cdf0e10cSrcweir                    rGate,
172*cdf0e10cSrcweir                    rToolsFactory.Create_StdFrame() );
173*cdf0e10cSrcweir }
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir }   // namespace command
177*cdf0e10cSrcweir }   // namespace autodoc
178