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