/************************************************************************* * * $RCSfile: outfile.cxx,v $ * * $Revision: 1.4 $ * * last change: $Author: vg $ $Date: 2005-03-23 08:58:31 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses * * - GNU Lesser General Public License Version 2.1 * - Sun Industry Standards Source License Version 1.1 * * Sun Microsystems Inc., October, 2000 * * GNU Lesser General Public License Version 2.1 * ============================================= * Copyright 2000 by Sun Microsystems, Inc. * 901 San Antonio Road, Palo Alto, CA 94303, USA * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * * * Sun Industry Standards Source License Version 1.1 * ================================================= * The contents of this file are subject to the Sun Industry Standards * Source License Version 1.1 (the "License"); You may not use this file * except in compliance with the License. You may obtain a copy of the * License at http://www.openoffice.org/license.html. * * Software provided under this License is provided on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. * See the License for the specific provisions governing your rights and * obligations concerning the Software. * * The Initial Developer of the Original Code is: Sun Microsystems, Inc. * * Copyright: 2000 by Sun Microsystems, Inc. * * All Rights Reserved. * * Contributor(s): _______________________________________ * * ************************************************************************/ #include #include "outfile.hxx" // NOT FULLY DECLARED SERVICES #include #include #include #include "strconst.hxx" using namespace csi; using csi::xml::AnAttribute; #define CRLF "\n" const char * const C_sStdStyle = "body { background-color:#ffffff; }"CRLF "h1 { font-size:20pt; margin-top:3pt; margin-bottom:7pt; }"CRLF "h2 { font-family:Arial; font-size:16pt; margin-top:3pt; margin-bottom:5pt; }"CRLF "h3 { font-size:13pt; margin-top:2pt; margin-bottom:3pt; }"CRLF "h4 { font-size:10pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF "dl { margin-top:1pt; margin-bottom:1pt; }"CRLF "dl.member { margin-top:1pt; margin-bottom:1pt; background-color:#eeeeff; }"CRLF "dt { font-size:10pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF "dt.member { font-size:13pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF "dt.simple { font-size:10pt; font-weight:normal; margin-top:2pt; margin-bottom:1pt; }"CRLF "dd { font-size:10pt; margin-top:1pt; margin-bottom:1pt; }"CRLF "dd.member { font-size:10pt; margin-top:1pt; margin-bottom:1pt; background-color:#ffffff; }"CRLF "p { font-size:10pt; margin-top:3pt; margin-bottom:1pt; }"CRLF "pre { font-family:monospace; font-size:10pt; margin-top:1pt; margin-bottom:1pt; }"CRLF "tr { font-size:10pt; }"CRLF "td { font-size:10pt; }"CRLF CRLF "dt.attention { color:#dd0000; }"CRLF CRLF "div.title { text-align:center; line-height:26pt; background-color:#ccccff; }"CRLF ".subtitle { background-color:#ccccff; }"CRLF CRLF "td.flagname { background-color:#eeeeff; font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF "td.flagyes { font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF "td.flagno { font-family:Arial; font-size:8pt; }"CRLF "td.flagtext { font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF CRLF "td.navimain, td.navimain a"CRLF " { background-color:#eeeeff; color:#000000;"CRLF " font-family:Arial; font-size:12pt; font-weight:bold; }"CRLF "td.navimainself"CRLF " { background-color:#2222ad; color:#ffffff;"CRLF " font-family:Arial; font-size:12pt; font-weight:bold; }"CRLF "td.navimainnone"CRLF " { background-color:#eeeeff; color:#000000;"CRLF " font-family:Arial; font-size:12pt; }"CRLF CRLF "div.define { font-family:Arial; background-color:#ccccff; }"CRLF CRLF ".nqclass { color:#008800; }"CRLF CRLF "h3.help { background-color:#eeeeff; margin-top:12pt; }"CRLF CRLF ".btpubl { color:#33ff33; }"CRLF ".btprot { color:#cc9933; }"CRLF ".btpriv { color:#ff6666; }"CRLF ".btvpubl { color:#33ff33; font-style:italic; }"CRLF ".btvprot { color:#cc9933; font-style:italic; }"CRLF ".btvpriv { color:#ff6666; font-style:italic; }"CRLF ".btself { font-weight:bold; }"CRLF ; const char * const C_sCssExplanations = "/* Explanation of CSS classes:"CRLF CRLF "dl.member provides coloured frame for function descriptions."CRLF "dd.member makes the content of this frame white"CRLF CRLF "dt.attention special colour for @attention remarks"CRLF CRLF "div.title HTML page headline"CRLF ".subtitle headline of lists of members and similar"CRLF CRLF " These are for the flagtables in classes:"CRLF "td.flagname Flag name."CRLF "td.flagyes flag value \"yes\""CRLF "td.flagno flag value \"no\""CRLF "td.flagtext other flag value"CRLF CRLF CRLF " These are for the main navigationbar:"CRLF "td.navimain, td.navimain a"CRLF " Links in navibar."CRLF "td.navimainself Text in navibar which refers to current page."CRLF "td.navimainnone Text which links to nothing."CRLF CRLF CRLF "div.define Subtitles on the #define/macro descriptions page"CRLF CRLF ".nqclass special color for classes in the qualification"CRLF " on top of type pages like in:"CRLF " ::nsp1::nsp2::_ClassXY_::"CRLF CRLF "h3.help Subtitles on the help page"CRLF CRLF " These are for the base class tree on class pages:"CRLF ".btpubl public base class"CRLF ".btprot protected"CRLF ".btpriv private"CRLF ".btvpubl virtual public"CRLF ".btvprot virtual protected"CRLF ".btvpriv virtual private"CRLF ".btself placeholder for currently displayed class"CRLF CRLF "*/"CRLF ; HtmlDocuFile::HtmlDocuFile() : sFilePath(), sTitle(), sCopyright(), nDepth(0), aBodyData() { } void HtmlDocuFile::SetLocation( const csv::ploc::Path & i_rFilePath, uintt i_depthInOutputTree ) { static StreamStr sPath_(1000); sPath_.seekp(0); i_rFilePath.Get( sPath_ ); sFilePath = sPath_.c_str(); nDepth = i_depthInOutputTree; } void HtmlDocuFile::SetTitle( const char * i_sTitle ) { sTitle = i_sTitle; } void HtmlDocuFile::SetBodyAttr( const char * i_sAttrName, const char * i_sAttrValue ) { aBodyData << new AnAttribute( i_sAttrName, i_sAttrValue ); } void HtmlDocuFile::SetCopyright( const char * i_sCopyright ) { sCopyright = i_sCopyright; } void HtmlDocuFile::EmptyBody() { aBodyData.SetContent(0); aBodyData >> *new html::Label( "_top_" ) << " "; } bool HtmlDocuFile::CreateFile() { csv::File aFile(sFilePath, csv::CFM_CREATE); if (NOT aFile.open()) { Cerr() << "Can't create file " << sFilePath << "." << Endl(); return false; } WriteHeader(aFile); WriteBody(aFile); // Write end static const char sCompletion[] = "\n\n"; aFile.write( sCompletion ); aFile.close(); Cout() << '.' << Flush(); return true; } void HtmlDocuFile::WriteCssFile( const csv::ploc::Path & i_rFilePath ) { Cout() << "\nCreate css file ..." << Endl(); csv::File aCssFile(i_rFilePath, csv::CFM_CREATE); csv::OpenCloseGuard aOpenGuard(aCssFile); if (NOT aOpenGuard) { Cerr() << "Can't create file " << "cpp.css" << "." << Endl(); return; } aCssFile.write("/* Autodoc css file for C++ documentation */\n\n\n"); aCssFile.write(C_sStdStyle); aCssFile.write("\n\n\n"); aCssFile.write(C_sCssExplanations); } void HtmlDocuFile::WriteHeader( csv::File & io_aFile ) { static const char s1[] = "\n\n" ""; static const char s2[] = "\n" "\n\n"; io_aFile.write( s1 ); io_aFile.write( sTitle ); io_aFile.write( s2 ); io_aFile.write( output::get_UpLink(nDepth) ); io_aFile.write( C_sHFN_Css ); io_aFile.write( s3 ); } void HtmlDocuFile::WriteBody( csv::File & io_aFile ) { aBodyData >> *new html::Link( "#_top_" ) << new html::ClassAttr( "objchapter" ) << "Top of Page"; if ( sCopyright.length() > 0 ) { aBodyData #ifndef COMPATIBLE_NETSCAPE_47 >> *new html::HorizontalLine << new html::SizeAttr( "3" ); #else << new xml::XmlCode("
"); #endif aBodyData >> *new html::Paragraph << new html::ClassAttr( "copyright" ) << new xml::AnAttribute( "align", "center" ) << new xml::XmlCode(sCopyright); } aBodyData.WriteOut(io_aFile); }