1*0841af79SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*0841af79SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*0841af79SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*0841af79SAndrew Rist  * distributed with this work for additional information
6*0841af79SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*0841af79SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*0841af79SAndrew Rist  * "License"); you may not use this file except in compliance
9*0841af79SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*0841af79SAndrew Rist  *
11*0841af79SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*0841af79SAndrew Rist  *
13*0841af79SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*0841af79SAndrew Rist  * software distributed under the License is distributed on an
15*0841af79SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*0841af79SAndrew Rist  * KIND, either express or implied.  See the License for the
17*0841af79SAndrew Rist  * specific language governing permissions and limitations
18*0841af79SAndrew Rist  * under the License.
19*0841af79SAndrew Rist  *
20*0841af79SAndrew 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 =
48cdf0e10cSrcweir     "body   { background-color:#ffffff; }"CRLF
49cdf0e10cSrcweir     "h1     { font-size:20pt; margin-top:3pt; margin-bottom:7pt; }"CRLF
50cdf0e10cSrcweir     "h2     { font-family:Arial; font-size:16pt; margin-top:3pt; margin-bottom:5pt; }"CRLF
51cdf0e10cSrcweir     "h3     { font-size:13pt; margin-top:2pt; margin-bottom:3pt; }"CRLF
52cdf0e10cSrcweir     "h4     { font-size:10pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF
53cdf0e10cSrcweir 	"dl     { margin-top:1pt; margin-bottom:1pt; }"CRLF
54cdf0e10cSrcweir 	"dl.member  { margin-top:1pt; margin-bottom:1pt; background-color:#eeeeff; }"CRLF
55cdf0e10cSrcweir     "dt     { font-size:10pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF
56cdf0e10cSrcweir     "dt.member  { font-size:13pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF
57cdf0e10cSrcweir     "dt.simple  { font-size:10pt; font-weight:normal; margin-top:2pt; margin-bottom:1pt; }"CRLF
58cdf0e10cSrcweir     "dd     { font-size:10pt; margin-top:1pt; margin-bottom:1pt; }"CRLF
59cdf0e10cSrcweir     "dd.member  { font-size:10pt; margin-top:1pt; margin-bottom:1pt; background-color:#ffffff; }"CRLF
60cdf0e10cSrcweir     "p      { font-size:10pt; margin-top:3pt; margin-bottom:1pt; }"CRLF
61cdf0e10cSrcweir     "pre    { font-family:monospace; font-size:10pt; margin-top:1pt; margin-bottom:1pt; }"CRLF
62cdf0e10cSrcweir     "tr     { font-size:10pt; }"CRLF
63cdf0e10cSrcweir     "td     { font-size:10pt; }"CRLF
64cdf0e10cSrcweir     CRLF
65cdf0e10cSrcweir     "dt.attention   { color:#dd0000; }"CRLF
66cdf0e10cSrcweir     CRLF
67cdf0e10cSrcweir     "div.title      { text-align:center;  line-height:26pt; background-color:#ccccff; }"CRLF
68cdf0e10cSrcweir     ".subtitle      { background-color:#ccccff; }"CRLF
69cdf0e10cSrcweir     CRLF
70cdf0e10cSrcweir     "td.flagname    { background-color:#eeeeff; font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF
71cdf0e10cSrcweir     "td.flagyes     { font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF
72cdf0e10cSrcweir     "td.flagno      { font-family:Arial; font-size:8pt; }"CRLF
73cdf0e10cSrcweir     "td.flagtext    { font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF
74cdf0e10cSrcweir     CRLF
75cdf0e10cSrcweir     "td.navimain, td.navimain a"CRLF
76cdf0e10cSrcweir     "               { background-color:#eeeeff; color:#000000;"CRLF
77cdf0e10cSrcweir     "                 font-family:Arial; font-size:12pt; font-weight:bold; }"CRLF
78cdf0e10cSrcweir     "td.navimainself"CRLF
79cdf0e10cSrcweir     "               { background-color:#2222ad; color:#ffffff;"CRLF
80cdf0e10cSrcweir     "                 font-family:Arial; font-size:12pt; font-weight:bold; }"CRLF
81cdf0e10cSrcweir     "td.navimainnone"CRLF
82cdf0e10cSrcweir     "               { background-color:#eeeeff; color:#000000;"CRLF
83cdf0e10cSrcweir     "                 font-family:Arial; font-size:12pt; }"CRLF
84cdf0e10cSrcweir     CRLF
85cdf0e10cSrcweir     "div.define     { font-family:Arial; background-color:#ccccff; }"CRLF
86cdf0e10cSrcweir     CRLF
87cdf0e10cSrcweir     ".nqclass       { color:#008800; }"CRLF
88cdf0e10cSrcweir     CRLF
89cdf0e10cSrcweir     "h3.help        { background-color:#eeeeff; margin-top:12pt; }"CRLF
90cdf0e10cSrcweir     CRLF
91cdf0e10cSrcweir     ".btpubl        { color:#33ff33; }"CRLF
92cdf0e10cSrcweir     ".btprot        { color:#cc9933; }"CRLF
93cdf0e10cSrcweir     ".btpriv        { color:#ff6666; }"CRLF
94cdf0e10cSrcweir     ".btvpubl       { color:#33ff33; font-style:italic; }"CRLF
95cdf0e10cSrcweir     ".btvprot       { color:#cc9933; font-style:italic; }"CRLF
96cdf0e10cSrcweir     ".btvpriv       { color:#ff6666; font-style:italic; }"CRLF
97cdf0e10cSrcweir     ".btself        { font-weight:bold; }"CRLF
98cdf0e10cSrcweir     ;
99cdf0e10cSrcweir 
100cdf0e10cSrcweir 
101cdf0e10cSrcweir const char * const
102cdf0e10cSrcweir     C_sCssExplanations =
103cdf0e10cSrcweir     "/* Explanation of CSS classes:"CRLF
104cdf0e10cSrcweir     CRLF
105cdf0e10cSrcweir     "dl.member       provides coloured frame for function descriptions."CRLF
106cdf0e10cSrcweir     "dd.member       makes the content of this frame white"CRLF
107cdf0e10cSrcweir     CRLF
108cdf0e10cSrcweir     "dt.attention    special colour for @attention remarks"CRLF
109cdf0e10cSrcweir     CRLF
110cdf0e10cSrcweir     "div.title       HTML page headline"CRLF
111cdf0e10cSrcweir     ".subtitle       headline of lists of members and similar"CRLF
112cdf0e10cSrcweir     CRLF
113cdf0e10cSrcweir     "                These are for the flagtables in classes:"CRLF
114cdf0e10cSrcweir     "td.flagname     Flag name."CRLF
115cdf0e10cSrcweir     "td.flagyes      flag value \"yes\""CRLF
116cdf0e10cSrcweir     "td.flagno       flag value \"no\""CRLF
117cdf0e10cSrcweir     "td.flagtext     other flag value"CRLF
118cdf0e10cSrcweir     CRLF
119cdf0e10cSrcweir     CRLF
120cdf0e10cSrcweir     "                These are for the main navigationbar:"CRLF
121cdf0e10cSrcweir     "td.navimain, td.navimain a"CRLF
122cdf0e10cSrcweir     "                Links in navibar."CRLF
123cdf0e10cSrcweir     "td.navimainself Text in navibar which refers to current page."CRLF
124cdf0e10cSrcweir     "td.navimainnone Text which links to nothing."CRLF
125cdf0e10cSrcweir     CRLF
126cdf0e10cSrcweir     CRLF
127cdf0e10cSrcweir     "div.define      Subtitles on the #define/macro descriptions page"CRLF
128cdf0e10cSrcweir     CRLF
129cdf0e10cSrcweir     ".nqclass        special color for classes in the qualification"CRLF
130cdf0e10cSrcweir     "                on top of type pages like in:"CRLF
131cdf0e10cSrcweir     "                ::nsp1::nsp2::_ClassXY_::"CRLF
132cdf0e10cSrcweir     CRLF
133cdf0e10cSrcweir     "h3.help         Subtitles on the help page"CRLF
134cdf0e10cSrcweir     CRLF
135cdf0e10cSrcweir     "                These are for the base class tree on class pages:"CRLF
136cdf0e10cSrcweir     ".btpubl         public base class"CRLF
137cdf0e10cSrcweir     ".btprot         protected"CRLF
138cdf0e10cSrcweir     ".btpriv         private"CRLF
139cdf0e10cSrcweir     ".btvpubl        virtual public"CRLF
140cdf0e10cSrcweir     ".btvprot        virtual protected"CRLF
141cdf0e10cSrcweir     ".btvpriv        virtual private"CRLF
142cdf0e10cSrcweir     ".btself         placeholder for currently displayed class"CRLF
143cdf0e10cSrcweir     CRLF
144cdf0e10cSrcweir     "*/"CRLF
145cdf0e10cSrcweir     ;
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 
148cdf0e10cSrcweir const char * const
149cdf0e10cSrcweir     C_sStdStyle_withDivFrame =
150cdf0e10cSrcweir     "body   { background-color:#ffffff; }"CRLF
151cdf0e10cSrcweir     "#adc-cppref h1     { font-size:20pt; margin-top:3pt; margin-bottom:7pt; }"CRLF
152cdf0e10cSrcweir     "#adc-cppref h2     { font-family:Arial; font-size:16pt; margin-top:3pt; margin-bottom:5pt; }"CRLF
153cdf0e10cSrcweir     "#adc-cppref h3     { font-size:13pt; margin-top:2pt; margin-bottom:3pt; }"CRLF
154cdf0e10cSrcweir     "#adc-cppref h4     { font-size:10pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF
155cdf0e10cSrcweir 	"#adc-cppref dl     { margin-top:1pt; margin-bottom:1pt; }"CRLF
156cdf0e10cSrcweir 	"#adc-cppref dl.member  { margin-top:1pt; margin-bottom:1pt; background-color:#eeeeff; }"CRLF
157cdf0e10cSrcweir     "#adc-cppref dt     { font-size:10pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF
158cdf0e10cSrcweir     "#adc-cppref dt.member  { font-size:13pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF
159cdf0e10cSrcweir     "#adc-cppref dt.simple  { font-size:10pt; font-weight:normal; margin-top:2pt; margin-bottom:1pt; }"CRLF
160cdf0e10cSrcweir     "#adc-cppref dd     { font-size:10pt; margin-top:1pt; margin-bottom:1pt; }"CRLF
161cdf0e10cSrcweir     "#adc-cppref dd.member  { font-size:10pt; margin-top:1pt; margin-bottom:1pt; background-color:#ffffff; }"CRLF
162cdf0e10cSrcweir     "#adc-cppref p      { font-size:10pt; margin-top:3pt; margin-bottom:1pt; }"CRLF
163cdf0e10cSrcweir     "#adc-cppref pre    { font-family:monospace; font-size:10pt; margin-top:1pt; margin-bottom:1pt; }"CRLF
164cdf0e10cSrcweir     "#adc-cppref tr     { font-size:10pt; }"CRLF
165cdf0e10cSrcweir     "#adc-cppref td     { font-size:10pt; }"CRLF
166cdf0e10cSrcweir     CRLF
167cdf0e10cSrcweir     "#adc-cppref dt.attention   { color:#dd0000; }"CRLF
168cdf0e10cSrcweir     CRLF
169cdf0e10cSrcweir     "#adc-cppref div.title      { text-align:center;  line-height:26pt; background-color:#ccccff; }"CRLF
170cdf0e10cSrcweir     "#adc-cppref .subtitle      { background-color:#ccccff; }"CRLF
171cdf0e10cSrcweir     CRLF
172cdf0e10cSrcweir     "#adc-cppref td.flagname    { background-color:#eeeeff; font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF
173cdf0e10cSrcweir     "#adc-cppref td.flagyes     { font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF
174cdf0e10cSrcweir     "#adc-cppref td.flagno      { font-family:Arial; font-size:8pt; }"CRLF
175cdf0e10cSrcweir     "#adc-cppref td.flagtext    { font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF
176cdf0e10cSrcweir     CRLF
177cdf0e10cSrcweir     "#adc-cppref td.navimain, #adc-cppref td.navimain a"CRLF
178cdf0e10cSrcweir     "               { background-color:#eeeeff; color:#000000;"CRLF
179cdf0e10cSrcweir     "                 font-family:Arial; font-size:12pt; font-weight:bold; }"CRLF
180cdf0e10cSrcweir     "#adc-cppref td.navimainself"CRLF
181cdf0e10cSrcweir     "               { background-color:#2222ad; color:#ffffff;"CRLF
182cdf0e10cSrcweir     "                 font-family:Arial; font-size:12pt; font-weight:bold; }"CRLF
183cdf0e10cSrcweir     "#adc-cppref td.navimainnone"CRLF
184cdf0e10cSrcweir     "               { background-color:#eeeeff; color:#000000;"CRLF
185cdf0e10cSrcweir     "                 font-family:Arial; font-size:12pt; }"CRLF
186cdf0e10cSrcweir     CRLF
187cdf0e10cSrcweir     "#adc-cppref div.define     { font-family:Arial; background-color:#ccccff; }"CRLF
188cdf0e10cSrcweir     CRLF
189cdf0e10cSrcweir     "#adc-cppref .nqclass       { color:#008800; }"CRLF
190cdf0e10cSrcweir     CRLF
191cdf0e10cSrcweir     "#adc-cppref h3.help        { background-color:#eeeeff; margin-top:12pt; }"CRLF
192cdf0e10cSrcweir     CRLF
193cdf0e10cSrcweir     "#adc-cppref .btpubl        { color:#33ff33; }"CRLF
194cdf0e10cSrcweir     "#adc-cppref .btprot        { color:#cc9933; }"CRLF
195cdf0e10cSrcweir     "#adc-cppref .btpriv        { color:#ff6666; }"CRLF
196cdf0e10cSrcweir     "#adc-cppref .btvpubl       { color:#33ff33; font-style:italic; }"CRLF
197cdf0e10cSrcweir     "#adc-cppref .btvprot       { color:#cc9933; font-style:italic; }"CRLF
198cdf0e10cSrcweir     "#adc-cppref .btvpriv       { color:#ff6666; font-style:italic; }"CRLF
199cdf0e10cSrcweir     "#adc-cppref .btself        { font-weight:bold; }"CRLF
200cdf0e10cSrcweir     ""CRLF
201cdf0e10cSrcweir     "#adc-cppref table { empty-cells:show; }"CRLF
202cdf0e10cSrcweir     ""CRLF
203cdf0e10cSrcweir 	"#adc-cppref .childlist td, "CRLF
204cdf0e10cSrcweir 	"#adc-cppref .commentedlinks td, "CRLF
205cdf0e10cSrcweir 	"#adc-cppref .memberlist td, "CRLF
206cdf0e10cSrcweir 	"#adc-cppref .subtitle td, "CRLF
207cdf0e10cSrcweir 	"#adc-cppref .crosstitle td  { border: .1pt solid #000000; }"CRLF
208cdf0e10cSrcweir     ""CRLF
209cdf0e10cSrcweir 	"#adc-cppref .flag-table td { border: .1pt solid #cccccc; } "CRLF
210cdf0e10cSrcweir     ""CRLF
211cdf0e10cSrcweir 	"#adc-cppref .title-table td, "CRLF
212cdf0e10cSrcweir 	"#adc-cppref .table-in-method td, "CRLF
213cdf0e10cSrcweir 	"#adc-cppref .table-in-data td, "CRLF
214cdf0e10cSrcweir 	"#adc-cppref .navimain td, "CRLF
215cdf0e10cSrcweir 	"#adc-cppref .navisub td, "CRLF
216cdf0e10cSrcweir 	"#adc-cppref .expl-table td, "CRLF
217cdf0e10cSrcweir 	"#adc-cppref .param-table td  { border: none; }"CRLF
218cdf0e10cSrcweir     ;
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 
221cdf0e10cSrcweir 
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
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
246cdf0e10cSrcweir HtmlDocuFile::SetTitle( const char * i_sTitle )
247cdf0e10cSrcweir {
248cdf0e10cSrcweir 	sTitle = i_sTitle;
249cdf0e10cSrcweir }
250cdf0e10cSrcweir 
251cdf0e10cSrcweir void
252cdf0e10cSrcweir HtmlDocuFile::SetCopyright( const char * i_sCopyright )
253cdf0e10cSrcweir {
254cdf0e10cSrcweir 	sCopyright = i_sCopyright;
255cdf0e10cSrcweir }
256cdf0e10cSrcweir 
257cdf0e10cSrcweir void
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
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
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
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
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