merge the formfield patch from ooo-build
[ooovba.git] / autodoc / source / exes / adc_uni / adc_cmds.cxx
blob39245a29864d43ca2a9cc2ec58e3bf622dd3bdf7
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: adc_cmds.cxx,v $
10 * $Revision: 1.10 $
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 "adc_cmds.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <ary/ary.hxx>
37 #include <autodoc/displaying.hxx>
38 #include <autodoc/dsp_html_std.hxx>
39 #include <display/corframe.hxx>
40 #include <adc_cl.hxx>
43 namespace autodoc
45 namespace command
48 extern const String C_opt_Include("-I:");
50 extern const String C_opt_Verbose("-v");
52 extern const String C_opt_Parse("-parse");
53 extern const String C_opt_Name("-name");
54 extern const String C_opt_LangAll("-lg");
55 extern const String C_opt_ExtensionsAll("-extg");
56 extern const String C_opt_DevmanFile("-dvgfile");
57 extern const String C_opt_SinceFile("-sincefile");
59 extern const String C_arg_Cplusplus("c++");
60 extern const String C_arg_Idl("idl");
61 extern const String C_arg_Java("java");
63 extern const String C_opt_Project("-p");
64 //extern const String C_opt_Lang;
65 //extern const String C_opt_Extensions;
66 extern const String C_opt_SourceDir("-d");
67 extern const String C_opt_SourceTree("-t");
68 extern const String C_opt_SourceFile("-f");
70 extern const String C_opt_CreateHtml("-html");
71 extern const String C_opt_DevmanRoot("-dvgroot");
73 //extern const String C_opt_CreateXml("-xml");
74 //extern const String C_opt_Load("-load");
75 //extern const String C_opt_Save("-save");
77 extern const String C_opt_ExternNamespace("-extnsp");
78 extern const String C_opt_ExternRoot("-extroot");
82 //************************** CreateHTML ***********************//
84 CreateHtml::CreateHtml()
85 : sOutputRootDirectory(),
86 sDevelopersManual_HtmlRoot()
90 CreateHtml::~CreateHtml()
94 void
95 CreateHtml::do_Init( opt_iter & it,
96 opt_iter itEnd )
98 ++it;
99 CHECKOPT( it != itEnd && (*it).char_at(0) != '-',
100 "output directory", C_opt_CreateHtml );
101 sOutputRootDirectory = *it;
103 for ( ++it;
104 it != itEnd AND (*it == C_opt_DevmanRoot);
105 ++it )
107 if (*it == C_opt_DevmanRoot)
109 ++it;
110 CHECKOPT( it != itEnd AND (*it).char_at(0) != '-',
111 "HTML root directory of Developers Guide",
112 C_opt_DevmanRoot );
113 sDevelopersManual_HtmlRoot = *it;
115 } // end for
118 bool
119 CreateHtml::do_Run() const
121 if ( CommandLine::Get_().IdlUsed() )
122 run_Idl();
123 if ( CommandLine::Get_().CppUsed() )
124 run_Cpp();
125 return true;
129 CreateHtml::inq_RunningRank() const
131 return static_cast<int>(rank_CreateHtml);
134 void
135 CreateHtml::run_Idl() const
137 const ary::idl::Gate &
138 rGate = CommandLine::Get_().TheRepository().Gate_Idl();
140 Cout() << "Creating HTML-output into the directory "
141 << sOutputRootDirectory
142 << "."
143 << Endl();
145 const DisplayToolsFactory_Ifc &
146 rToolsFactory = DisplayToolsFactory_Ifc::GetIt_();
147 Dyn<autodoc::HtmlDisplay_Idl_Ifc>
148 pDisplay( rToolsFactory.Create_HtmlDisplay_Idl() );
150 DYN display::CorporateFrame & // KORR_FUTURE: Remove the need for const_cast
151 drFrame = const_cast< display::CorporateFrame& >(rToolsFactory.Create_StdFrame());
152 if (NOT DevelopersManual_HtmlRoot().empty())
153 drFrame.Set_DevelopersGuideHtmlRoot( DevelopersManual_HtmlRoot() );
155 pDisplay->Run( sOutputRootDirectory,
156 rGate,
157 drFrame );
160 void
161 CreateHtml::run_Cpp() const
163 const ary::Repository &
164 rReposy = CommandLine::Get_().TheRepository();
165 const ary::cpp::Gate &
166 rGate = rReposy.Gate_Cpp();
168 const DisplayToolsFactory_Ifc &
169 rToolsFactory = DisplayToolsFactory_Ifc::GetIt_();
170 Dyn< autodoc::HtmlDisplay_UdkStd >
171 pDisplay( rToolsFactory.Create_HtmlDisplay_UdkStd() );
173 pDisplay->Run( sOutputRootDirectory,
174 rGate,
175 rToolsFactory.Create_StdFrame() );
179 } // namespace command
180 } // namespace autodoc