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 "outfile.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir // NOT FULLY DECLARED SERVICES
32*cdf0e10cSrcweir #include <cosv/file.hxx>
33*cdf0e10cSrcweir #include <udm/html/htmlitem.hxx>
34*cdf0e10cSrcweir #include <toolkit/out_position.hxx>
35*cdf0e10cSrcweir #include "strconst.hxx"
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir namespace
39*cdf0e10cSrcweir {
40*cdf0e10cSrcweir bool            bUse_OOoFrameDiv = true;
41*cdf0e10cSrcweir const String    C_sOOoFrameDiv_CppId("adc-cppref");
42*cdf0e10cSrcweir }
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir using namespace csi;
46*cdf0e10cSrcweir using csi::xml::AnAttribute;
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir #define CRLF "\n"
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir const char * const
53*cdf0e10cSrcweir     C_sStdStyle =
54*cdf0e10cSrcweir     "body   { background-color:#ffffff; }"CRLF
55*cdf0e10cSrcweir     "h1     { font-size:20pt; margin-top:3pt; margin-bottom:7pt; }"CRLF
56*cdf0e10cSrcweir     "h2     { font-family:Arial; font-size:16pt; margin-top:3pt; margin-bottom:5pt; }"CRLF
57*cdf0e10cSrcweir     "h3     { font-size:13pt; margin-top:2pt; margin-bottom:3pt; }"CRLF
58*cdf0e10cSrcweir     "h4     { font-size:10pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF
59*cdf0e10cSrcweir 	"dl     { margin-top:1pt; margin-bottom:1pt; }"CRLF
60*cdf0e10cSrcweir 	"dl.member  { margin-top:1pt; margin-bottom:1pt; background-color:#eeeeff; }"CRLF
61*cdf0e10cSrcweir     "dt     { font-size:10pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF
62*cdf0e10cSrcweir     "dt.member  { font-size:13pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF
63*cdf0e10cSrcweir     "dt.simple  { font-size:10pt; font-weight:normal; margin-top:2pt; margin-bottom:1pt; }"CRLF
64*cdf0e10cSrcweir     "dd     { font-size:10pt; margin-top:1pt; margin-bottom:1pt; }"CRLF
65*cdf0e10cSrcweir     "dd.member  { font-size:10pt; margin-top:1pt; margin-bottom:1pt; background-color:#ffffff; }"CRLF
66*cdf0e10cSrcweir     "p      { font-size:10pt; margin-top:3pt; margin-bottom:1pt; }"CRLF
67*cdf0e10cSrcweir     "pre    { font-family:monospace; font-size:10pt; margin-top:1pt; margin-bottom:1pt; }"CRLF
68*cdf0e10cSrcweir     "tr     { font-size:10pt; }"CRLF
69*cdf0e10cSrcweir     "td     { font-size:10pt; }"CRLF
70*cdf0e10cSrcweir     CRLF
71*cdf0e10cSrcweir     "dt.attention   { color:#dd0000; }"CRLF
72*cdf0e10cSrcweir     CRLF
73*cdf0e10cSrcweir     "div.title      { text-align:center;  line-height:26pt; background-color:#ccccff; }"CRLF
74*cdf0e10cSrcweir     ".subtitle      { background-color:#ccccff; }"CRLF
75*cdf0e10cSrcweir     CRLF
76*cdf0e10cSrcweir     "td.flagname    { background-color:#eeeeff; font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF
77*cdf0e10cSrcweir     "td.flagyes     { font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF
78*cdf0e10cSrcweir     "td.flagno      { font-family:Arial; font-size:8pt; }"CRLF
79*cdf0e10cSrcweir     "td.flagtext    { font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF
80*cdf0e10cSrcweir     CRLF
81*cdf0e10cSrcweir     "td.navimain, td.navimain a"CRLF
82*cdf0e10cSrcweir     "               { background-color:#eeeeff; color:#000000;"CRLF
83*cdf0e10cSrcweir     "                 font-family:Arial; font-size:12pt; font-weight:bold; }"CRLF
84*cdf0e10cSrcweir     "td.navimainself"CRLF
85*cdf0e10cSrcweir     "               { background-color:#2222ad; color:#ffffff;"CRLF
86*cdf0e10cSrcweir     "                 font-family:Arial; font-size:12pt; font-weight:bold; }"CRLF
87*cdf0e10cSrcweir     "td.navimainnone"CRLF
88*cdf0e10cSrcweir     "               { background-color:#eeeeff; color:#000000;"CRLF
89*cdf0e10cSrcweir     "                 font-family:Arial; font-size:12pt; }"CRLF
90*cdf0e10cSrcweir     CRLF
91*cdf0e10cSrcweir     "div.define     { font-family:Arial; background-color:#ccccff; }"CRLF
92*cdf0e10cSrcweir     CRLF
93*cdf0e10cSrcweir     ".nqclass       { color:#008800; }"CRLF
94*cdf0e10cSrcweir     CRLF
95*cdf0e10cSrcweir     "h3.help        { background-color:#eeeeff; margin-top:12pt; }"CRLF
96*cdf0e10cSrcweir     CRLF
97*cdf0e10cSrcweir     ".btpubl        { color:#33ff33; }"CRLF
98*cdf0e10cSrcweir     ".btprot        { color:#cc9933; }"CRLF
99*cdf0e10cSrcweir     ".btpriv        { color:#ff6666; }"CRLF
100*cdf0e10cSrcweir     ".btvpubl       { color:#33ff33; font-style:italic; }"CRLF
101*cdf0e10cSrcweir     ".btvprot       { color:#cc9933; font-style:italic; }"CRLF
102*cdf0e10cSrcweir     ".btvpriv       { color:#ff6666; font-style:italic; }"CRLF
103*cdf0e10cSrcweir     ".btself        { font-weight:bold; }"CRLF
104*cdf0e10cSrcweir     ;
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir const char * const
108*cdf0e10cSrcweir     C_sCssExplanations =
109*cdf0e10cSrcweir     "/* Explanation of CSS classes:"CRLF
110*cdf0e10cSrcweir     CRLF
111*cdf0e10cSrcweir     "dl.member       provides coloured frame for function descriptions."CRLF
112*cdf0e10cSrcweir     "dd.member       makes the content of this frame white"CRLF
113*cdf0e10cSrcweir     CRLF
114*cdf0e10cSrcweir     "dt.attention    special colour for @attention remarks"CRLF
115*cdf0e10cSrcweir     CRLF
116*cdf0e10cSrcweir     "div.title       HTML page headline"CRLF
117*cdf0e10cSrcweir     ".subtitle       headline of lists of members and similar"CRLF
118*cdf0e10cSrcweir     CRLF
119*cdf0e10cSrcweir     "                These are for the flagtables in classes:"CRLF
120*cdf0e10cSrcweir     "td.flagname     Flag name."CRLF
121*cdf0e10cSrcweir     "td.flagyes      flag value \"yes\""CRLF
122*cdf0e10cSrcweir     "td.flagno       flag value \"no\""CRLF
123*cdf0e10cSrcweir     "td.flagtext     other flag value"CRLF
124*cdf0e10cSrcweir     CRLF
125*cdf0e10cSrcweir     CRLF
126*cdf0e10cSrcweir     "                These are for the main navigationbar:"CRLF
127*cdf0e10cSrcweir     "td.navimain, td.navimain a"CRLF
128*cdf0e10cSrcweir     "                Links in navibar."CRLF
129*cdf0e10cSrcweir     "td.navimainself Text in navibar which refers to current page."CRLF
130*cdf0e10cSrcweir     "td.navimainnone Text which links to nothing."CRLF
131*cdf0e10cSrcweir     CRLF
132*cdf0e10cSrcweir     CRLF
133*cdf0e10cSrcweir     "div.define      Subtitles on the #define/macro descriptions page"CRLF
134*cdf0e10cSrcweir     CRLF
135*cdf0e10cSrcweir     ".nqclass        special color for classes in the qualification"CRLF
136*cdf0e10cSrcweir     "                on top of type pages like in:"CRLF
137*cdf0e10cSrcweir     "                ::nsp1::nsp2::_ClassXY_::"CRLF
138*cdf0e10cSrcweir     CRLF
139*cdf0e10cSrcweir     "h3.help         Subtitles on the help page"CRLF
140*cdf0e10cSrcweir     CRLF
141*cdf0e10cSrcweir     "                These are for the base class tree on class pages:"CRLF
142*cdf0e10cSrcweir     ".btpubl         public base class"CRLF
143*cdf0e10cSrcweir     ".btprot         protected"CRLF
144*cdf0e10cSrcweir     ".btpriv         private"CRLF
145*cdf0e10cSrcweir     ".btvpubl        virtual public"CRLF
146*cdf0e10cSrcweir     ".btvprot        virtual protected"CRLF
147*cdf0e10cSrcweir     ".btvpriv        virtual private"CRLF
148*cdf0e10cSrcweir     ".btself         placeholder for currently displayed class"CRLF
149*cdf0e10cSrcweir     CRLF
150*cdf0e10cSrcweir     "*/"CRLF
151*cdf0e10cSrcweir     ;
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir const char * const
155*cdf0e10cSrcweir     C_sStdStyle_withDivFrame =
156*cdf0e10cSrcweir     "body   { background-color:#ffffff; }"CRLF
157*cdf0e10cSrcweir     "#adc-cppref h1     { font-size:20pt; margin-top:3pt; margin-bottom:7pt; }"CRLF
158*cdf0e10cSrcweir     "#adc-cppref h2     { font-family:Arial; font-size:16pt; margin-top:3pt; margin-bottom:5pt; }"CRLF
159*cdf0e10cSrcweir     "#adc-cppref h3     { font-size:13pt; margin-top:2pt; margin-bottom:3pt; }"CRLF
160*cdf0e10cSrcweir     "#adc-cppref h4     { font-size:10pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF
161*cdf0e10cSrcweir 	"#adc-cppref dl     { margin-top:1pt; margin-bottom:1pt; }"CRLF
162*cdf0e10cSrcweir 	"#adc-cppref dl.member  { margin-top:1pt; margin-bottom:1pt; background-color:#eeeeff; }"CRLF
163*cdf0e10cSrcweir     "#adc-cppref dt     { font-size:10pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF
164*cdf0e10cSrcweir     "#adc-cppref dt.member  { font-size:13pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF
165*cdf0e10cSrcweir     "#adc-cppref dt.simple  { font-size:10pt; font-weight:normal; margin-top:2pt; margin-bottom:1pt; }"CRLF
166*cdf0e10cSrcweir     "#adc-cppref dd     { font-size:10pt; margin-top:1pt; margin-bottom:1pt; }"CRLF
167*cdf0e10cSrcweir     "#adc-cppref dd.member  { font-size:10pt; margin-top:1pt; margin-bottom:1pt; background-color:#ffffff; }"CRLF
168*cdf0e10cSrcweir     "#adc-cppref p      { font-size:10pt; margin-top:3pt; margin-bottom:1pt; }"CRLF
169*cdf0e10cSrcweir     "#adc-cppref pre    { font-family:monospace; font-size:10pt; margin-top:1pt; margin-bottom:1pt; }"CRLF
170*cdf0e10cSrcweir     "#adc-cppref tr     { font-size:10pt; }"CRLF
171*cdf0e10cSrcweir     "#adc-cppref td     { font-size:10pt; }"CRLF
172*cdf0e10cSrcweir     CRLF
173*cdf0e10cSrcweir     "#adc-cppref dt.attention   { color:#dd0000; }"CRLF
174*cdf0e10cSrcweir     CRLF
175*cdf0e10cSrcweir     "#adc-cppref div.title      { text-align:center;  line-height:26pt; background-color:#ccccff; }"CRLF
176*cdf0e10cSrcweir     "#adc-cppref .subtitle      { background-color:#ccccff; }"CRLF
177*cdf0e10cSrcweir     CRLF
178*cdf0e10cSrcweir     "#adc-cppref td.flagname    { background-color:#eeeeff; font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF
179*cdf0e10cSrcweir     "#adc-cppref td.flagyes     { font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF
180*cdf0e10cSrcweir     "#adc-cppref td.flagno      { font-family:Arial; font-size:8pt; }"CRLF
181*cdf0e10cSrcweir     "#adc-cppref td.flagtext    { font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF
182*cdf0e10cSrcweir     CRLF
183*cdf0e10cSrcweir     "#adc-cppref td.navimain, #adc-cppref td.navimain a"CRLF
184*cdf0e10cSrcweir     "               { background-color:#eeeeff; color:#000000;"CRLF
185*cdf0e10cSrcweir     "                 font-family:Arial; font-size:12pt; font-weight:bold; }"CRLF
186*cdf0e10cSrcweir     "#adc-cppref td.navimainself"CRLF
187*cdf0e10cSrcweir     "               { background-color:#2222ad; color:#ffffff;"CRLF
188*cdf0e10cSrcweir     "                 font-family:Arial; font-size:12pt; font-weight:bold; }"CRLF
189*cdf0e10cSrcweir     "#adc-cppref td.navimainnone"CRLF
190*cdf0e10cSrcweir     "               { background-color:#eeeeff; color:#000000;"CRLF
191*cdf0e10cSrcweir     "                 font-family:Arial; font-size:12pt; }"CRLF
192*cdf0e10cSrcweir     CRLF
193*cdf0e10cSrcweir     "#adc-cppref div.define     { font-family:Arial; background-color:#ccccff; }"CRLF
194*cdf0e10cSrcweir     CRLF
195*cdf0e10cSrcweir     "#adc-cppref .nqclass       { color:#008800; }"CRLF
196*cdf0e10cSrcweir     CRLF
197*cdf0e10cSrcweir     "#adc-cppref h3.help        { background-color:#eeeeff; margin-top:12pt; }"CRLF
198*cdf0e10cSrcweir     CRLF
199*cdf0e10cSrcweir     "#adc-cppref .btpubl        { color:#33ff33; }"CRLF
200*cdf0e10cSrcweir     "#adc-cppref .btprot        { color:#cc9933; }"CRLF
201*cdf0e10cSrcweir     "#adc-cppref .btpriv        { color:#ff6666; }"CRLF
202*cdf0e10cSrcweir     "#adc-cppref .btvpubl       { color:#33ff33; font-style:italic; }"CRLF
203*cdf0e10cSrcweir     "#adc-cppref .btvprot       { color:#cc9933; font-style:italic; }"CRLF
204*cdf0e10cSrcweir     "#adc-cppref .btvpriv       { color:#ff6666; font-style:italic; }"CRLF
205*cdf0e10cSrcweir     "#adc-cppref .btself        { font-weight:bold; }"CRLF
206*cdf0e10cSrcweir     ""CRLF
207*cdf0e10cSrcweir     "#adc-cppref table { empty-cells:show; }"CRLF
208*cdf0e10cSrcweir     ""CRLF
209*cdf0e10cSrcweir 	"#adc-cppref .childlist td, "CRLF
210*cdf0e10cSrcweir 	"#adc-cppref .commentedlinks td, "CRLF
211*cdf0e10cSrcweir 	"#adc-cppref .memberlist td, "CRLF
212*cdf0e10cSrcweir 	"#adc-cppref .subtitle td, "CRLF
213*cdf0e10cSrcweir 	"#adc-cppref .crosstitle td  { border: .1pt solid #000000; }"CRLF
214*cdf0e10cSrcweir     ""CRLF
215*cdf0e10cSrcweir 	"#adc-cppref .flag-table td { border: .1pt solid #cccccc; } "CRLF
216*cdf0e10cSrcweir     ""CRLF
217*cdf0e10cSrcweir 	"#adc-cppref .title-table td, "CRLF
218*cdf0e10cSrcweir 	"#adc-cppref .table-in-method td, "CRLF
219*cdf0e10cSrcweir 	"#adc-cppref .table-in-data td, "CRLF
220*cdf0e10cSrcweir 	"#adc-cppref .navimain td, "CRLF
221*cdf0e10cSrcweir 	"#adc-cppref .navisub td, "CRLF
222*cdf0e10cSrcweir 	"#adc-cppref .expl-table td, "CRLF
223*cdf0e10cSrcweir 	"#adc-cppref .param-table td  { border: none; }"CRLF
224*cdf0e10cSrcweir     ;
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir HtmlDocuFile::HtmlDocuFile()
229*cdf0e10cSrcweir 	:	sFilePath(),
230*cdf0e10cSrcweir 	    sTitle(),
231*cdf0e10cSrcweir         sLocation(),
232*cdf0e10cSrcweir         sCopyright(),
233*cdf0e10cSrcweir         nDepthInOutputTree(0),
234*cdf0e10cSrcweir         aBodyData(),
235*cdf0e10cSrcweir         aBuffer(60000)  // Grows dynamically when necessary.
236*cdf0e10cSrcweir {
237*cdf0e10cSrcweir }
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir void
240*cdf0e10cSrcweir HtmlDocuFile::SetLocation( const csv::ploc::Path &  i_rFilePath,
241*cdf0e10cSrcweir                            uintt                    i_depthInOutputTree )
242*cdf0e10cSrcweir {
243*cdf0e10cSrcweir     static StreamStr sPath_(1000);
244*cdf0e10cSrcweir     sPath_.seekp(0);
245*cdf0e10cSrcweir     i_rFilePath.Get( sPath_ );
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir 	sFilePath = sPath_.c_str();
248*cdf0e10cSrcweir 	nDepthInOutputTree = i_depthInOutputTree;
249*cdf0e10cSrcweir }
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir void
252*cdf0e10cSrcweir HtmlDocuFile::SetTitle( const char * i_sTitle )
253*cdf0e10cSrcweir {
254*cdf0e10cSrcweir 	sTitle = i_sTitle;
255*cdf0e10cSrcweir }
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir void
258*cdf0e10cSrcweir HtmlDocuFile::SetCopyright( const char * i_sCopyright )
259*cdf0e10cSrcweir {
260*cdf0e10cSrcweir 	sCopyright = i_sCopyright;
261*cdf0e10cSrcweir }
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir void
264*cdf0e10cSrcweir HtmlDocuFile::EmptyBody()
265*cdf0e10cSrcweir {
266*cdf0e10cSrcweir  	aBodyData.SetContent(0);
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir  	if (bUse_OOoFrameDiv)
269*cdf0e10cSrcweir  	{
270*cdf0e10cSrcweir         // Insert <div> tag to allow better formatting for OOo.
271*cdf0e10cSrcweir         aBodyData
272*cdf0e10cSrcweir             << new xml::XmlCode("<div id=\"")
273*cdf0e10cSrcweir             << new xml::XmlCode(C_sOOoFrameDiv_CppId)
274*cdf0e10cSrcweir             << new xml::XmlCode("\">\n\n");
275*cdf0e10cSrcweir  	}
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir     aBodyData
278*cdf0e10cSrcweir         >> *new html::Label( "_top_" )
279*cdf0e10cSrcweir         << " ";
280*cdf0e10cSrcweir }
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir bool
283*cdf0e10cSrcweir HtmlDocuFile::CreateFile()
284*cdf0e10cSrcweir {
285*cdf0e10cSrcweir 	csv::File aFile(sFilePath, csv::CFM_CREATE);
286*cdf0e10cSrcweir 	if (NOT aFile.open())
287*cdf0e10cSrcweir 	{
288*cdf0e10cSrcweir 		Cerr() << "Can't create file " << sFilePath << "." << Endl();
289*cdf0e10cSrcweir 		return false;
290*cdf0e10cSrcweir 	}
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir 	WriteHeader(aFile);
293*cdf0e10cSrcweir 	WriteBody(aFile);
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir     // Write end
296*cdf0e10cSrcweir     static const char sCompletion[] = "\n</html>\n";
297*cdf0e10cSrcweir 	aFile.write( sCompletion );
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir 	aFile.close();
300*cdf0e10cSrcweir     Cout() << '.' << Flush();
301*cdf0e10cSrcweir     return true;
302*cdf0e10cSrcweir }
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir void
305*cdf0e10cSrcweir HtmlDocuFile::WriteCssFile(	const csv::ploc::Path & i_rFilePath )
306*cdf0e10cSrcweir {
307*cdf0e10cSrcweir     Cout() << "\nCreate css file ..." << Endl();
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir     csv::File
310*cdf0e10cSrcweir         aCssFile(i_rFilePath, csv::CFM_CREATE);
311*cdf0e10cSrcweir     csv::OpenCloseGuard
312*cdf0e10cSrcweir         aOpenGuard(aCssFile);
313*cdf0e10cSrcweir     if (NOT aOpenGuard)
314*cdf0e10cSrcweir     {
315*cdf0e10cSrcweir         Cerr() << "Can't create file " << "cpp.css" << "." << Endl();
316*cdf0e10cSrcweir         return;
317*cdf0e10cSrcweir     }
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir     aCssFile.write("/*      Autodoc css file for C++ documentation      */\n\n\n");
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir     if (bUse_OOoFrameDiv)
322*cdf0e10cSrcweir         aCssFile.write(C_sStdStyle_withDivFrame);
323*cdf0e10cSrcweir     else
324*cdf0e10cSrcweir         aCssFile.write(C_sStdStyle);
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir     aCssFile.write("\n\n\n");
327*cdf0e10cSrcweir     aCssFile.write(C_sCssExplanations);
328*cdf0e10cSrcweir }
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir void
331*cdf0e10cSrcweir HtmlDocuFile::WriteHeader( csv::File & io_aFile )
332*cdf0e10cSrcweir {
333*cdf0e10cSrcweir     aBuffer.reset();
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir     static const char s1[] =
336*cdf0e10cSrcweir         "<html>\n<head>\n"
337*cdf0e10cSrcweir         "<title>";
338*cdf0e10cSrcweir     static const char s2[] =
339*cdf0e10cSrcweir         "</title>\n"
340*cdf0e10cSrcweir         "<link rel=\"stylesheet\" type=\"text/css\" href=\"";
341*cdf0e10cSrcweir     static const char s3[] =
342*cdf0e10cSrcweir         "\">\n</head>\n";
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir 	aBuffer.write( s1 );
345*cdf0e10cSrcweir     aBuffer.write( sTitle );
346*cdf0e10cSrcweir     aBuffer.write( s2 );
347*cdf0e10cSrcweir     aBuffer.write( output::get_UpLink(nDepthInOutputTree) );
348*cdf0e10cSrcweir     aBuffer.write( C_sHFN_Css );
349*cdf0e10cSrcweir     aBuffer.write( s3 );
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir     io_aFile.write(aBuffer.c_str(), aBuffer.size());
352*cdf0e10cSrcweir }
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir void
355*cdf0e10cSrcweir HtmlDocuFile::WriteBody( csv::File & io_aFile )
356*cdf0e10cSrcweir {
357*cdf0e10cSrcweir     aBuffer.reset();
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir 	aBodyData
360*cdf0e10cSrcweir         >> *new html::Link( "#_top_" )
361*cdf0e10cSrcweir                 << new html::ClassAttr( "objchapter" )
362*cdf0e10cSrcweir                 << "Top of Page";
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir     if ( sCopyright.length() > 0 )
365*cdf0e10cSrcweir     {
366*cdf0e10cSrcweir         aBodyData
367*cdf0e10cSrcweir #ifndef COMPATIBLE_NETSCAPE_47
368*cdf0e10cSrcweir             >> *new html::HorizontalLine
369*cdf0e10cSrcweir                     <<  new html::SizeAttr( "3" );
370*cdf0e10cSrcweir #else
371*cdf0e10cSrcweir             << new xml::XmlCode("<hr size=\"3\">");
372*cdf0e10cSrcweir #endif
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir         aBodyData
375*cdf0e10cSrcweir             >> *new html::Paragraph
376*cdf0e10cSrcweir                     << new html::ClassAttr( "copyright" )
377*cdf0e10cSrcweir                     << new xml::AnAttribute( "align", "center" )
378*cdf0e10cSrcweir                     << new xml::XmlCode(sCopyright);
379*cdf0e10cSrcweir     }
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir  	if (bUse_OOoFrameDiv)
382*cdf0e10cSrcweir     {
383*cdf0e10cSrcweir         // Insert <div> tag to allow better formatting for OOo.
384*cdf0e10cSrcweir     	aBodyData
385*cdf0e10cSrcweir             << new xml::XmlCode("\n</div> <!-- id=\"")
386*cdf0e10cSrcweir             << new xml::XmlCode(C_sOOoFrameDiv_CppId)
387*cdf0e10cSrcweir             << new xml::XmlCode("\" -->\n");
388*cdf0e10cSrcweir     }
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir 	aBodyData.WriteOut(aBuffer);
391*cdf0e10cSrcweir     io_aFile.write(aBuffer.c_str(), aBuffer.size());
392*cdf0e10cSrcweir }
393