diff options
Diffstat (limited to 'autodoc/source/display/html')
50 files changed, 10997 insertions, 0 deletions
diff --git a/autodoc/source/display/html/aryattrs.cxx b/autodoc/source/display/html/aryattrs.cxx new file mode 100644 index 000000000000..2eef10ded2e9 --- /dev/null +++ b/autodoc/source/display/html/aryattrs.cxx @@ -0,0 +1,251 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "aryattrs.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/getncast.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <ary/cpp/cp_type.hxx> +#include "strconst.hxx" + + + + +//******************** HtmlDisplay_Impl *********************// + +const char * +Get_ClassTypeKey( const ary::cpp::Class & i_rClass ) +{ + return i_rClass.ClassKey() == ary::cpp::CK_class + ? C_sHFTypeTitle_Class + : i_rClass.ClassKey() == ary::cpp::CK_struct + ? C_sHFTypeTitle_Struct + : C_sHFTypeTitle_Union; + +} + +const char * +Get_TypeKey( const ary::cpp::CodeEntity & i_rCe ) +{ + if ( ary::is_type<ary::cpp::Class>(i_rCe) ) + { + return Get_ClassTypeKey( + ary::ary_cast<ary::cpp::Class>(i_rCe) ); + } + if ( ary::is_type<ary::cpp::Enum>(i_rCe) ) + { + return "enum"; + } + return ""; +} + +bool +Ce_IsInternal( const ary::cpp::CodeEntity & i_rCe ) +{ + return NOT i_rCe.IsVisible(); +} + +const char * +SyntaxText_PreName( const ary::cpp::Function & i_rFunction, + const ary::cpp::Gate & i_rAryGate ) +{ + static StreamStr sResult( 150 ); + sResult.seekp(0); + + // write pre-name: + const ary::cpp::FunctionFlags & rFlags = i_rFunction.Flags(); + if ( rFlags.IsStaticLocal() OR rFlags.IsStaticMember() ) + sResult << "static "; + if ( rFlags.IsExplicit() ) + sResult << "explicit "; + if ( rFlags.IsMutable() ) + sResult << "mutable "; + if ( i_rFunction.Virtuality() != ary::cpp::VIRTUAL_none ) + sResult << "virtual "; + i_rAryGate.Types().Get_TypeText( sResult, i_rFunction.ReturnType() ); + sResult << " "; + + return sResult.c_str(); +} + +const char * +SyntaxText_PostName( const ary::cpp::Function & i_rFunction, + const ary::cpp::Gate & i_rAryGate ) +{ + static StreamStr sResult( 850 ); + sResult.seekp(0); + + // parameters and con_vol + i_rAryGate.Ces().Get_SignatureText( sResult, i_rFunction.Signature(), &i_rFunction.ParamInfos() ); + + // write Exceptions: + const std::vector< ary::cpp::Type_id > * + pThrow = i_rFunction.Exceptions(); + if ( pThrow) + { + + std::vector< ary::cpp::Type_id >::const_iterator + it = pThrow->begin(); + std::vector< ary::cpp::Type_id >::const_iterator + it_end = pThrow->end(); + + if (it != it_end) + { + sResult << " throw( "; + i_rAryGate.Types().Get_TypeText(sResult, *it); + + for ( ++it; it != it_end; ++it ) + { + sResult << ", "; + i_rAryGate.Types().Get_TypeText(sResult, *it); + } + sResult << " )"; + } + else + { + sResult << " throw( )"; + } + } // endif // pThrow + + // abstractness: + if ( i_rFunction.Virtuality() == ary::cpp::VIRTUAL_abstract ) + sResult << " = 0"; + + // finish: + sResult << ";"; + + return sResult.c_str(); +} + +bool +Get_TypeText( const char * & o_rPreName, + const char * & o_rName, + const char * & o_rPostName, + ary::cpp::Type_id i_nTypeid, + const ary::cpp::Gate & i_rAryGate ) +{ + static StreamStr sResult_PreName(250); + static StreamStr sResult_Name(250); + static StreamStr sResult_PostName(250); + + sResult_PreName.seekp(0); + sResult_Name.seekp(0); + sResult_PostName.seekp(0); + + bool ret = i_rAryGate.Types().Get_TypeText( + sResult_PreName, + sResult_Name, + sResult_PostName, + i_nTypeid ); + if ( sResult_PreName.tellp() > 0 ) + { + char cLast = *( sResult_PreName.c_str() + (sResult_PreName.tellp() - 1) ); + if (cLast != ':' AND cLast != ' ') + sResult_PreName << " "; + } + + + if (ret) + { + o_rPreName = sResult_PreName.c_str(); + o_rName = sResult_Name.c_str(); + o_rPostName = sResult_PostName.c_str(); + } + else + { + o_rPreName = o_rName = o_rPostName = ""; + } + return ret; +} + + + + +//********************* FunctionParam_Iterator *****************// + + +FunctionParam_Iterator::FunctionParam_Iterator() + : // itTypes + // itTypes_end + // itNames_andMore + // itNames_andMore_end + eConVol(ary::cpp::CONVOL_none) +{ + static std::vector<ary::cpp::Type_id> aTypesNull_; + static StringVector aNamesNull_; + + itTypes = itTypes_end = aTypesNull_.end(); + itNames_andMore = itNames_andMore_end = aNamesNull_.end(); +} + +FunctionParam_Iterator::~FunctionParam_Iterator() +{ +} + +FunctionParam_Iterator & +FunctionParam_Iterator::operator++() +{ + if ( IsValid() ) + { + ++itTypes; + ++itNames_andMore; + } + return *this; +} + +void +FunctionParam_Iterator::Assign( const ary::cpp::Function & i_rFunction ) +{ + const ary::cpp::OperationSignature & + rSigna = i_rFunction.Signature(); + + const std::vector<ary::cpp::Type_id> & + rTypes = rSigna.Parameters(); + const StringVector & + rNames = i_rFunction.ParamInfos(); + + if ( rTypes.size() != rNames.size() OR rTypes.size() == 0 ) + return; + + itTypes = rTypes.begin(); + itTypes_end = rTypes.end(); + itNames_andMore = rNames.begin(); + itNames_andMore_end = rNames.end(); + + eConVol = rSigna.ConVol(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/aryattrs.hxx b/autodoc/source/display/html/aryattrs.hxx new file mode 100644 index 000000000000..16d762f750a2 --- /dev/null +++ b/autodoc/source/display/html/aryattrs.hxx @@ -0,0 +1,157 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_ARYATTRS_HXX +#define ADC_DISPLAY_ARYATTRS_HXX + +// USED SERVICES +#include <ary/cpp/c_types4cpp.hxx> +#include <ary/doc/d_docu.hxx> +#include <ary/doc/d_oldcppdocu.hxx> + +namespace ary +{ + namespace cpp + { + class CodeEntity; + class Class; + class DisplayGate; + class Function; + class Namespace; + } +} + + + + +const char * Get_ClassTypeKey( + const ary::cpp::Class & i_rClass ); +const char * Get_TypeKey( + const ary::cpp::CodeEntity & + i_rCe ); +bool Ce_IsInternal( + const ary::cpp::CodeEntity & + i_rCe ); +const char * SyntaxText_PreName( + const ary::cpp::Function & + i_rFunction, + const ary::cpp::Gate & i_rAryGate ); +const char * SyntaxText_PostName( + const ary::cpp::Function & + i_rFunction, + const ary::cpp::Gate & i_rAryGate ); + +bool Get_TypeText( + const char * & o_rPreName, + const char * & o_rName, + const char * & o_rPostName, + ary::cpp::Type_id i_nTypeid, + const ary::cpp::Gate & i_rAryGate ); + + +inline const ary::doc::OldCppDocu * +Get_CppDocu(const ary::doc::Documentation & i_doc) +{ + return dynamic_cast< const ary::doc::OldCppDocu* >(i_doc.Data()); +} + + +class FunctionParam_Iterator +{ + public: + FunctionParam_Iterator(); + ~FunctionParam_Iterator(); + + operator bool() const; + FunctionParam_Iterator & + operator++(); + + void Assign( + const ary::cpp::Function & + i_rFunction ); + + ary::cpp::Type_id + CurType() const; + const String & CurName() const; + + bool IsFunctionConst() const; + bool IsFunctionVolatile() const; + + private: + typedef std::vector<ary::cpp::Type_id>::const_iterator Type_Iterator; + typedef StringVector::const_iterator Name_Iterator; + + bool IsValid() const; + + // Forbidden + FunctionParam_Iterator & + operator++(int); + // DATA + Type_Iterator itTypes; + Type_Iterator itTypes_end; + Name_Iterator itNames_andMore; /// Name, init-value. + Name_Iterator itNames_andMore_end; + + ary::cpp::E_ConVol eConVol; +}; + + + + +// IMPLEMENTATION +inline +FunctionParam_Iterator::operator bool() const + { return IsValid(); } + +inline bool +FunctionParam_Iterator::IsValid() const +{ + // By C'tor and Assign(), it is assured, that + // both iterators are valid, if one is valid. + return itTypes != itTypes_end; +} + +inline ary::cpp::Type_id +FunctionParam_Iterator::CurType() const + { return IsValid() ? *itTypes : ary::cpp::Type_id(0); } +inline const String & +FunctionParam_Iterator::CurName() const + { return IsValid() ? *itNames_andMore : String::Null_(); } +inline bool +FunctionParam_Iterator::IsFunctionConst() const + { return (eConVol & ary::cpp::CONVOL_const) != 0; } +inline bool +FunctionParam_Iterator::IsFunctionVolatile() const + { return (eConVol & ary::cpp::CONVOL_volatile) != 0; } + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/cfrstd.cxx b/autodoc/source/display/html/cfrstd.cxx new file mode 100644 index 000000000000..8a4a9f6bc91f --- /dev/null +++ b/autodoc/source/display/html/cfrstd.cxx @@ -0,0 +1,347 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <cfrstd.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <time.h> + + +/* CSS Styles + ---------- + +Colors: +- light background color #eeeeff +- dark background color #ccccff +- self in navibar background color #2222ad + + +Fonts: +- page title 20, bold, Arial +- navibar main 12, bold, Arial +- navibar sub 8, Arial, kapitälchen +- attrtable title line 8, bold, Arial, kapitälchen +- attrtable value line 8, Arial kapitälchen + +- namespace chain 13, bold +- table title 13, bold +- template line 13 + +- member paragraph title 12, bold + +- docu paragraph title 11, bold +- standard text 11 + +- hierarchy 11, monospace + + +classes: + + td.title page title + h3 table title + h4 member paragraph title + + td.nmain navigation main bar + td.nsub navigation sub bar + a.nmain links in navigation main bar + a.nsub links in navigation sub bar + + td.attr1 attribute table head line + td.attr2 attribute table value line + + p.namechain namespace chain in head of pages + p.tpl template line in head of pages + + pre.doc preformatted docu + pre.hierarchy class bases hierarchy graphic + + dl.syntax function- or variable-declaration field + a.syntax link in function- or variable-declaration field + + p.dt docu paragraph title + dl.dt docu paragraph title + + p standard text + dl standard text + dd standard text +*/ + + +#define CRLF "\n" + +namespace +{ + +bool bUse_OOoFrameDiv = true; + + +//*************** These are used for IDL currently only! ******************** + +const char * const C_sStdStyle = + "/*See bottom of file for explanations.*/"CRLF + CRLF + "body { background-color:#ffffff; }"CRLF + CRLF + "h3 { font-size:13pt; font-weight:bold;"CRLF + " margin-top:3pt; margin-bottom:1pt; }"CRLF + "p, dt, dd, pre { font-size:11pt;"CRLF + " margin-top:3pt; margin-bottom:1pt; }"CRLF + "pre { font-family:monospace; }"CRLF + CRLF + "table.navimain { background-color:#eeeeff; }"CRLF + "table.subtitle { margin-top:6pt; margin-bottom:6pt; }"CRLF + CRLF + "td { font-size:11pt; }"CRLF + "td.title { font-family: Arial; font-size:19pt; font-weight:bold;"CRLF + " line-height:30pt; background-color:#ccccff; text-align:center; }"CRLF + "td.subtitle { font-family: Arial; font-size:13pt;"CRLF + " line-height:20pt; background-color:#ccccff; }"CRLF + "td.crosstitle { font-size:12pt; font-weight:bold;"CRLF + " line-height:15pt; background-color:#eeeeff; }"CRLF + "td.imdetail { width:100%; background-color:#eeeeff; }"CRLF + CRLF + "td.imsum_left { width:30%; }"CRLF + "td.imsum_right { width:70%; }"CRLF + CRLF + "td.navimain, a.navimain"CRLF + " { text-align:center; font-family: Arial; font-size:12pt; font-weight:bold; }"CRLF + "td.navimainself { text-align:center; font-family: Arial; font-size:12pt; font-weight:bold;"CRLF + " color:#ffffff; background-color:#2222ad; }"CRLF + "td.navimainnone { text-align:center; font-family: Arial; font-size:12pt; }"CRLF + "td.navisub, a.navisub"CRLF + " { text-align:center; font-family: Arial; font-size:9pt; font-variant:small-caps; }"CRLF + "td.navimain, td.navisub"CRLF + " { padding-left:7pt; padding-right:7pt; }"CRLF + CRLF + "a.membertitle { font-size:12pt; font-weight:bold; line-height:18pt; }"CRLF + "a.navimain, a.navisub { color:#000000; }"CRLF + ".dt { font-weight:bold; }"CRLF + ".namechain { font-size:13pt; font-weight:bold;"CRLF + " margin-top:3pt; margin-bottom:6pt; }"CRLF + ".title2 { font-size:13pt; font-style:italic; font-weight:bold; text-align:left; }"CRLF + ; + + +const char * const C_sCssExplanations = + "/* Explanation of CSS classes:"CRLF + CRLF + ".navimain Text in main navigation bar."CRLF + ".navisub Text in lower navigation bar."CRLF + "td.navimainself Cell in main navigation bar with \"selected\" shadow: You are here."CRLF + "td.navimainnone Cell in main navigation bar with no link."CRLF + CRLF + ".namechain Line with current module path."CRLF + CRLF + "td.crosstitle Comment box for bases (base interfaces etc.)"CRLF + "td.imsum_left Left part of such boxes."CRLF + "td.imsum_right Right part of such boxes."CRLF + CRLF + "td.title Main title of the page like \"interface XYz\""CRLF + ".subtitle Tables, and head cells of those, which list members"CRLF + " like \"method summary\" and \"method details\"."CRLF + CRLF + "td.imdetail Background table of method's detail description."CRLF + "a.membertitle Method name (as jump label) in method's detail"CRLF + " description."CRLF + ".title2 smaller font prefixes to page titles"CRLF + "*/"CRLF + ; + +const char * const C_sStdStyle_withDivFrame = + "/*See bottom of file for explanations.*/"CRLF + CRLF + "body { background-color:#ffffff; }"CRLF + CRLF + "#adc-idlref h3 { font-size:13pt; font-weight:bold;"CRLF + " margin-top:3pt; margin-bottom:1pt; }"CRLF + "#adc-idlref p, #adc-idlref dt, #adc-idlref dd, #adc-idlref pre"CRLF + " { font-size:11pt;"CRLF + " margin-top:3pt; margin-bottom:1pt; }"CRLF + "#adc-idlref pre { font-family:monospace; }"CRLF + CRLF + "#adc-idlref table.navimain { background-color:#eeeeff; }"CRLF + "#adc-idlref table.subtitle { margin-top:6pt; margin-bottom:6pt; }"CRLF + CRLF + "#adc-idlref td { font-size:11pt; }"CRLF + "#adc-idlref td.title { font-family: Arial; font-size:19pt; font-weight:bold;"CRLF + " line-height:30pt; background-color:#ccccff; text-align:center; }"CRLF + "#adc-idlref td.subtitle { font-family: Arial; font-size:13pt;"CRLF + " line-height:20pt; background-color:#ccccff; }"CRLF + "#adc-idlref td.crosstitle { font-size:12pt; font-weight:bold;"CRLF + " line-height:15pt; background-color:#eeeeff; }"CRLF + "#adc-idlref td.imdetail { width:100%; background-color:#eeeeff; }"CRLF + CRLF + "#adc-idlref td.imsum_left { width:30%; }"CRLF + "#adc-idlref td.imsum_right { width:70%; }"CRLF + CRLF + "#adc-idlref td.navimain, #adc-idlref a.navimain"CRLF + " { text-align:center; font-family: Arial; font-size:12pt; font-weight:bold; }"CRLF + "#adc-idlref td.navimainself { text-align:center; font-family: Arial; font-size:12pt; font-weight:bold;"CRLF + " color:#ffffff; background-color:#2222ad; }"CRLF + "#adc-idlref td.navimainnone { text-align:center; font-family: Arial; font-size:12pt; }"CRLF + "#adc-idlref td.navisub, #adc-idlref a.navisub"CRLF + " { text-align:center; font-family: Arial; font-size:9pt; font-variant:small-caps; }"CRLF + "#adc-idlref td.navimain, #adc-idlref td.navisub"CRLF + " { padding-left:7pt; padding-right:7pt; }"CRLF + CRLF + "#adc-idlref a.membertitle { font-size:12pt; font-weight:bold; line-height:18pt; }"CRLF + "#adc-idlref a.navimain, #adc-idlref a.navisub { color:#000000; }"CRLF + "#adc-idlref .dt { font-weight:bold; }"CRLF + "#adc-idlref .namechain { font-size:13pt; font-weight:bold;"CRLF + " margin-top:3pt; margin-bottom:6pt; }"CRLF + "#adc-idlref .title2 { font-size:13pt; font-style:italic; font-weight:bold; text-align:left; }"CRLF + ""CRLF + "#adc-idlref table { empty-cells:show; }"CRLF + ""CRLF + "#adc-idlref .childlist td, "CRLF + "#adc-idlref .commentedlinks td, "CRLF + "#adc-idlref .memberlist td, "CRLF + "#adc-idlref .subtitle td, "CRLF + "#adc-idlref .crosstitle td { border: .1pt solid #000000; }"CRLF + ""CRLF + "#adc-idlref .flag-table td { border: .1pt solid #cccccc; } "CRLF + ""CRLF + "#adc-idlref .title-table td, "CRLF + "#adc-idlref .table-in-method td, "CRLF + "#adc-idlref .table-in-data td, "CRLF + "#adc-idlref .navimain td, "CRLF + "#adc-idlref .navisub td, "CRLF + "#adc-idlref .expl-table td, "CRLF + "#adc-idlref .param-table td { border: none; }"CRLF + ; + + +} // anonymous namespace + + +StdFrame::StdFrame() + : sDevelopersGuideHtmlRoot(), + bSimpleLinks(false) +{ +} + +DYN Html_Image * +StdFrame::LogoSrc() const +{ + return 0; + +// return new Html_Image( "logodot-blu.gif", +// "109", +// "54", +// "RIGHT", +// "0", +// "OpenOffice" ); + +} + +const char * +StdFrame::LogoLink() const +{ + return ""; +// return "http://www.sun.com"; +// return "http://www.openoffice.org"; +} + + +String MakeCopyRight(); + +const char * +StdFrame::CopyrightText() const +{ + static String sCopyRight_( MakeCopyRight() ); + return sCopyRight_.c_str(); +} + +const char * +StdFrame::CssStyle() const +{ + if (bUse_OOoFrameDiv) + return C_sStdStyle_withDivFrame; + else + return C_sStdStyle; +} + +const char * +StdFrame::CssStylesExplanation() const +{ + return C_sCssExplanations; +} + +const char * +StdFrame::DevelopersGuideHtmlRoot() const +{ + return sDevelopersGuideHtmlRoot; +} + +bool +StdFrame::SimpleLinks() const +{ + return bSimpleLinks; +} + +void +StdFrame::Set_DevelopersGuideHtmlRoot( const String & i_directory ) +{ + if (NOT i_directory.empty()) + { + if (i_directory.char_at(i_directory.length()-1) == '/') + { + sDevelopersGuideHtmlRoot.assign(i_directory,i_directory.length()-1); + return; + } + } + sDevelopersGuideHtmlRoot = i_directory; +} + +void +StdFrame::Set_SimpleLinks() +{ + bSimpleLinks = true; +} + +String +MakeCopyRight() +{ + StreamStr cr(700); + time_t + gt; + time(>); + tm * + plt = localtime(>); + int year = 1900 + plt->tm_year; + + cr << "Copyright © 1995, " + << year + << ", Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners."; + return String(cr.c_str()); + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/chd_udk2.cxx b/autodoc/source/display/html/chd_udk2.cxx new file mode 100644 index 000000000000..76380aecc6fa --- /dev/null +++ b/autodoc/source/display/html/chd_udk2.cxx @@ -0,0 +1,204 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include <html/chd_udk2.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/ary_disp.hxx> +#include <ary/ceslot.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/cp_ce.hxx> + +#include "dsply_cl.hxx" +#include "dsply_da.hxx" +#include "dsply_op.hxx" +#include "opageenv.hxx" +#include "outfile.hxx" +#include "pagemake.hxx" + + + +//******************** CppHtmlDisplay_Udk2 ********************// + + +CppHtmlDisplay_Udk2::CppHtmlDisplay_Udk2() + : pCurPageEnv(0) +{ +} + +CppHtmlDisplay_Udk2::~CppHtmlDisplay_Udk2() +{ +} + +void +CppHtmlDisplay_Udk2::do_Run( const char * i_sOutputDirectory, + const ary::cpp::Gate & i_rAryGate, + const display::CorporateFrame & i_rLayout ) +{ + SetRunData( i_sOutputDirectory, i_rAryGate, i_rLayout ); + + Create_Css_File(); + Create_Overview_File(); + Create_Help_File(); + Create_AllDefs_File(); + + CreateFiles_InSubTree_Namespaces(); + CreateFiles_InSubTree_Index(); +} + +void +CppHtmlDisplay_Udk2::SetRunData( const char * i_sOutputDirectory, + const ary::cpp::Gate & i_rAryGate, + const display::CorporateFrame & i_rLayout ) +{ + csv::ploc::Path aOutputDir( i_sOutputDirectory, true ); + pCurPageEnv = new OuputPage_Environment( aOutputDir, i_rAryGate, i_rLayout ); +} + +void +CppHtmlDisplay_Udk2::Create_Css_File() +{ + pCurPageEnv->MoveDir_2Root(); + pCurPageEnv->SetFile_Css(); + HtmlDocuFile::WriteCssFile(pCurPageEnv->CurPath()); +} + +void +CppHtmlDisplay_Udk2::Create_Overview_File() +{ + pCurPageEnv->MoveDir_2Root(); + PageDisplay aPageMaker( *pCurPageEnv ); + aPageMaker.Create_OverviewFile(); +} + +void +CppHtmlDisplay_Udk2::Create_Help_File() +{ + PageDisplay aPageMaker( *pCurPageEnv ); + aPageMaker.Create_HelpFile(); +} + +void +CppHtmlDisplay_Udk2::Create_AllDefs_File() +{ + PageDisplay aPageMaker( *pCurPageEnv ); + aPageMaker.Create_AllDefsFile(); +} + +void +CppHtmlDisplay_Udk2::CreateFiles_InSubTree_Namespaces() +{ + Cout() << "\nCreate files in subtree namespaces" << Endl(); + + const ary::cpp::Namespace & + rGlobalNsp = Gate().Ces().GlobalNamespace(); + + RecursiveDisplay_Namespace(rGlobalNsp); + Cout() << Endl(); +} + +void +CppHtmlDisplay_Udk2::CreateFiles_InSubTree_Index() +{ + Cout() << "\nCreate files in subtree index" << Endl(); + Cout() << Endl(); + + PageDisplay aPageMaker( *pCurPageEnv ); + aPageMaker.Create_IndexFiles(); +} + +void +CppHtmlDisplay_Udk2::RecursiveDisplay_Namespace( const ary::cpp::Namespace & i_rNsp ) +{ + if (i_rNsp.Owner().IsValid()) + pCurPageEnv->MoveDir_Down2( i_rNsp ); + else + pCurPageEnv->MoveDir_2Names(); + DisplayFiles_InNamespace( i_rNsp ); + + typedef std::vector< const ary::cpp::Namespace* > NspList; + NspList aSubNspList; + i_rNsp.Get_SubNamespaces( aSubNspList ); + for ( NspList::const_iterator it = aSubNspList.begin(); + it != aSubNspList.end(); + ++it ) + { + RecursiveDisplay_Namespace( *(*it) ); + } // end for + + pCurPageEnv->MoveDir_Up(); +} + +void +CppHtmlDisplay_Udk2::DisplayFiles_InNamespace( const ary::cpp::Namespace & i_rNsp ) +{ + PageDisplay aPageMaker( *pCurPageEnv ); + + ary::Slot_AutoPtr pSlot; + + // Namespace + aPageMaker.Create_NamespaceFile(); + + // Classes + ClassDisplayer aClassDisplayer( *pCurPageEnv ); + DisplaySlot( aClassDisplayer, i_rNsp, ary::cpp::Namespace::SLOT_Classes ); + + // Enums + DisplaySlot( aPageMaker, i_rNsp, ary::cpp::Namespace::SLOT_Enums ); + + // Typedefs + DisplaySlot( aPageMaker, i_rNsp, ary::cpp::Namespace::SLOT_Typedefs ); + + // Operations + OperationsDisplay aOperationsDisplayer( *pCurPageEnv ); + DisplaySlot( aOperationsDisplayer, i_rNsp, ary::cpp::Namespace::SLOT_Operations ); + aOperationsDisplayer.Create_Files(); + + // Data + DataDisplay aDataDisplayer( *pCurPageEnv ); + + aDataDisplayer.PrepareForConstants(); + DisplaySlot( aDataDisplayer, i_rNsp, ary::cpp::Namespace::SLOT_Constants ); + + aDataDisplayer.PrepareForVariables(); + DisplaySlot( aDataDisplayer, i_rNsp, ary::cpp::Namespace::SLOT_Variables ); + + aDataDisplayer.Create_Files(); +} + +const ary::cpp::Gate & +CppHtmlDisplay_Udk2::Gate() const +{ + return pCurPageEnv->Gate(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/cre_link.cxx b/autodoc/source/display/html/cre_link.cxx new file mode 100644 index 000000000000..74561b027e73 --- /dev/null +++ b/autodoc/source/display/html/cre_link.cxx @@ -0,0 +1,272 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "cre_link.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_define.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_enuval.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_macro.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/c_vari.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <ary/loc/loc_file.hxx> +#include <ary/loc/locp_le.hxx> +#include "hdimpl.hxx" +#include "opageenv.hxx" +#include "strconst.hxx" + + + + + +LinkCreator::LinkCreator( char * o_rOutput, + uintt i_nOutputSize ) + : pOut(o_rOutput), + nOutMaxSize(i_nOutputSize), + pEnv(0) +{ +} + +LinkCreator::~LinkCreator() +{ +} + +void +LinkCreator::do_Process( const ary::cpp::Namespace & i_rData ) +{ + Create_PrePath( i_rData ); + strcat( pOut, "index.html" ); // KORR_FUTURE // SAFE STRCAT (#100211# - checked) +} + +void +LinkCreator::do_Process( const ary::cpp::Class & i_rData ) +{ + Create_PrePath( i_rData ); + strcat( pOut, ClassFileName(i_rData.LocalName().c_str()) ); // SAFE STRCAT (#100211# - checked) +} + +void +LinkCreator::do_Process( const ary::cpp::Enum & i_rData ) +{ + Create_PrePath( i_rData ); + strcat( pOut, EnumFileName(i_rData.LocalName().c_str()) ); // SAFE STRCAT (#100211# - checked) +} + +void +LinkCreator::do_Process( const ary::cpp::Typedef & i_rData ) +{ + Create_PrePath( i_rData ); + strcat( pOut, TypedefFileName(i_rData.LocalName().c_str()) ); // SAFE STRCAT (#100211# - checked) +} + +void +LinkCreator::do_Process( const ary::cpp::Function & i_rData ) +{ + Create_PrePath( i_rData ); + + if ( i_rData.Protection() != ary::cpp::PROTECT_global ) + { + strcat( pOut, "o.html" ); // SAFE STRCAT (#100211# - checked) + } + else + { + csv_assert(i_rData.Location().IsValid()); + const ary::loc::File & + rFile = pEnv->Gate().Locations().Find_File(i_rData.Location()); + strcat( pOut, HtmlFileName("o-", rFile.LocalName().c_str()) ); // SAFE STRCAT (#100211# - checked) + } + + csv_assert(pEnv != 0); + strcat( pOut, OperationLink(pEnv->Gate(), i_rData.LocalName(), i_rData.CeId()) ); // SAFE STRCAT (#100211# - checked) +} + +void +LinkCreator::do_Process( const ary::cpp::Variable & i_rData ) +{ + Create_PrePath( i_rData ); + + if ( i_rData.Protection() != ary::cpp::PROTECT_global ) + { + strcat( pOut, "d.html" ); // SAFE STRCAT (#100211# - checked) + } + else + { + csv_assert(i_rData.Location().IsValid()); + const ary::loc::File & + rFile = pEnv->Gate().Locations().Find_File(i_rData.Location()); + strcat( pOut, HtmlFileName("d-", rFile.LocalName().c_str()) ); // SAFE STRCAT (#100211# - checked) + } + + strcat( pOut, DataLink(i_rData.LocalName()) ); // SAFE STRCAT (#100211# - checked) +} + +void +LinkCreator::do_Process( const ary::cpp::EnumValue & i_rData ) +{ + const ary::cpp::CodeEntity * + pEnum = pEnv->Gate().Ces().Search_Ce(i_rData.Owner()); + if (pEnum == 0) + return; + + pEnum->Accept(*this); + strcat(pOut, "#"); // SAFE STRCAT (#100211# - checked) + strcat(pOut, i_rData.LocalName().c_str()); // SAFE STRCAT (#100211# - checked) +} + +void +LinkCreator::do_Process( const ary::cpp::Define & i_rData ) +{ + // KORR_FUTURE + // Only valid from Index: + + *pOut = '\0'; + strcat(pOut, "../def-all.html#"); // SAFE STRCAT (#100211# - checked) + strcat(pOut, i_rData.LocalName().c_str()); // SAFE STRCAT (#100211# - checked) +} + +void +LinkCreator::do_Process( const ary::cpp::Macro & i_rData ) +{ + // KORR_FUTURE + // Only valid from Index: + + *pOut = '\0'; + strcat(pOut, "../def-all.html#"); // SAFE STRCAT (#100211# - checked) + strcat(pOut, i_rData.LocalName().c_str()); // SAFE STRCAT (#100211# - checked) +} + + +namespace +{ + +class NameScope_const_iterator +{ + public: + NameScope_const_iterator( + ary::cpp::Ce_id i_nId, + const ary::cpp::Gate & + i_rGate ); + + operator bool() const { return pCe != 0; } + const String & operator*() const; + + void go_up(); + + private: + const ary::cpp::CodeEntity * + pCe; + const ary::cpp::Gate * + pGate; +}; + + +NameScope_const_iterator::NameScope_const_iterator( + ary::cpp::Ce_id i_nId, + const ary::cpp::Gate & i_rGate ) + : pCe(i_rGate.Ces().Search_Ce(i_nId)), + pGate(&i_rGate) +{ +} + +const String & +NameScope_const_iterator::operator*() const +{ + return pCe ? pCe->LocalName() + : String::Null_(); +} + +void +NameScope_const_iterator::go_up() +{ + if (pCe == 0) + return; + pCe = pGate->Ces().Search_Ce(pCe->Owner()); +} + + +void Recursive_CreatePath( + char * o_pOut, + const NameScope_const_iterator & + i_it ); + +void +Recursive_CreatePath( char * o_pOut, + const NameScope_const_iterator & i_it ) +{ + if (NOT i_it) + return; + + NameScope_const_iterator it( i_it ); + it.go_up(); + if (NOT it) + return; // Global Namespace + Recursive_CreatePath( o_pOut, it ); + + strcat( o_pOut, (*i_it).c_str() ); // SAFE STRCAT (#100211# - checked) + strcat( o_pOut, "/" ); // SAFE STRCAT (#100211# - checked) +} + + +} // anonymous namespace + + + + + +void +LinkCreator::Create_PrePath( const ary::cpp::CodeEntity & i_rData ) +{ + *pOut = NULCH; + + if ( pEnv->CurNamespace() != 0 ) + { + if ( pEnv->CurClass() + ? pEnv->CurClass()->CeId() == i_rData.Owner() + : pEnv->CurNamespace()->CeId() == i_rData.Owner() ) + return; + + strcat( pOut, PathUp(pEnv->Depth() - 1) ); // SAFE STRCAT (#100211# - checked) + } + else + { // Within Index + strcat( pOut, "../names/" ); // SAFE STRCAT (#100211# - checked) + } + + NameScope_const_iterator it( i_rData.Owner(), pEnv->Gate() ); + Recursive_CreatePath( pOut, it ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/cre_link.hxx b/autodoc/source/display/html/cre_link.hxx new file mode 100644 index 000000000000..c79523ff655f --- /dev/null +++ b/autodoc/source/display/html/cre_link.hxx @@ -0,0 +1,136 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_CRE_LINK_HXX +#define ADC_DISPLAY_CRE_LINK_HXX + + +// USED SERVICES + // BASE CLASSES +#include <cosv/tpl/processor.hxx> + // COMPONENTS + // PARAMETERS + +namespace ary +{ +namespace cpp +{ + class CodeEntity; + class Namespace; + class Class; + class Enum; + class Typedef; + class Function; + class Variable; + class EnumValue; + class Define; + class Macro; +} +} + + +class OuputPage_Environment; + + + +/** Displays links to ->{ary::cpp::CodeEntity CodeEntites}. +*/ +class LinkCreator : public csv::ProcessorIfc, + public csv::ConstProcessor<ary::cpp::Namespace>, + public csv::ConstProcessor<ary::cpp::Class>, + public csv::ConstProcessor<ary::cpp::Enum>, + public csv::ConstProcessor<ary::cpp::Typedef>, + public csv::ConstProcessor<ary::cpp::Function>, + public csv::ConstProcessor<ary::cpp::Variable>, + public csv::ConstProcessor<ary::cpp::EnumValue>, + public csv::ConstProcessor<ary::cpp::Define>, + public csv::ConstProcessor<ary::cpp::Macro> +{ + public: + LinkCreator( + char * o_rOutput, + uintt i_nOutputSize ); + ~LinkCreator(); + + + void SetEnv( + const OuputPage_Environment & + i_rEnv ); + private: + void Create_PrePath( + const ary::cpp::CodeEntity & + i_rData ); + // Interface csv::ConstProcessor<> + virtual void do_Process( + const ary::cpp::Namespace & + i_rData ); + virtual void do_Process( + const ary::cpp::Class & + i_rData ); + virtual void do_Process( + const ary::cpp::Enum & + i_rData ); + virtual void do_Process( + const ary::cpp::Typedef & + i_rData ); + virtual void do_Process( + const ary::cpp::Function & + i_rData ); + virtual void do_Process( + const ary::cpp::Variable & + i_rData ); + virtual void do_Process( + const ary::cpp::EnumValue & + i_rData ); + virtual void do_Process( + const ary::cpp::Define & + i_rData ); + virtual void do_Process( + const ary::cpp::Macro & + i_rData ); + // DATA + char * pOut; + uintt nOutMaxSize; + const OuputPage_Environment * + pEnv; +}; + + + + +// IMPLEMENTATION +inline void +LinkCreator::SetEnv( const OuputPage_Environment & i_rEnv ) + { pEnv = &i_rEnv; } + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/dsply_cl.cxx b/autodoc/source/display/html/dsply_cl.cxx new file mode 100644 index 000000000000..f590889683c4 --- /dev/null +++ b/autodoc/source/display/html/dsply_cl.cxx @@ -0,0 +1,111 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "dsply_cl.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_gate.hxx> +#include "dsply_da.hxx" +#include "dsply_op.hxx" +#include "hdimpl.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" + + + + +ClassDisplayer::ClassDisplayer( OuputPage_Environment & io_rEnv ) + : pEnv(&io_rEnv) +{ +} + +ClassDisplayer::~ClassDisplayer() +{ +} + +void +ClassDisplayer::DisplayFiles_InClass( const ary::cpp::Class & i_rData, + PageDisplay & io_rPageMaker ) +{ + // Classes + ClassDisplayer aClassDisplayer( Env() ); + DisplaySlot( aClassDisplayer, i_rData, ary::cpp::Class::SLOT_NestedClasses ); + + // Enums + DisplaySlot( io_rPageMaker, i_rData, ary::cpp::Class::SLOT_Enums ); + + // Typedefs + DisplaySlot( io_rPageMaker, i_rData, ary::cpp::Class::SLOT_Typedefs ); + + // Operations + OperationsDisplay aOperationsDisplayer( Env() ); + + aOperationsDisplayer.PrepareForStdMembers(); + DisplaySlot( aOperationsDisplayer, i_rData, ary::cpp::Class::SLOT_Operations ); + + aOperationsDisplayer.PrepareForStaticMembers(); + DisplaySlot( aOperationsDisplayer, i_rData, ary::cpp::Class::SLOT_StaticOperations ); + + aOperationsDisplayer.Create_Files(); + + // Data + DataDisplay aDataDisplayer( Env() ); + + aDataDisplayer.PrepareForStdMembers(); + DisplaySlot( aDataDisplayer, i_rData, ary::cpp::Class::SLOT_Data ); + + aDataDisplayer.PrepareForStaticMembers(); + DisplaySlot( aDataDisplayer, i_rData, ary::cpp::Class::SLOT_StaticData ); + + aDataDisplayer.Create_Files(); +} + +void +ClassDisplayer::do_Process( const ary::cpp::Class & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + PageDisplay aPageMaker( Env() ); + aPageMaker.Process(i_rData); + + Env().MoveDir_Down2( i_rData ); + DisplayFiles_InClass( i_rData, aPageMaker ); + Env().MoveDir_Up(); +} + +const ary::cpp::Gate * +ClassDisplayer::inq_Get_ReFinder() const +{ + return & pEnv->Gate(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/dsply_cl.hxx b/autodoc/source/display/html/dsply_cl.hxx new file mode 100644 index 000000000000..f2be896d2564 --- /dev/null +++ b/autodoc/source/display/html/dsply_cl.hxx @@ -0,0 +1,90 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_HD_PAGE_HXX +#define ADC_DISPLAY_HTML_HD_PAGE_HXX + +// BASE CLASSES +#include <ary/ary_disp.hxx> +#include <cosv/tpl/processor.hxx> +// USED SERVICES +#include <ary/types.hxx> + +class OuputPage_Environment; + +namespace ary +{ +namespace cpp +{ + class Class; +} +} + +class PageDisplay; + + + + +class ClassDisplayer : public ary::Display, + public csv::ConstProcessor<ary::cpp::Class> +{ + public: + ClassDisplayer( // TODO + OuputPage_Environment & + io_rEnv ); + virtual ~ClassDisplayer(); + + private: + // Interface csv::ConstProcessor<>: + virtual void do_Process( + const ary::cpp::Class & + i_data ); + // Interface ary::Display: + virtual const ary::cpp::Gate * + inq_Get_ReFinder() const; + + // Locals + void DisplayFiles_InClass( + const ary::cpp::Class & + i_rData, + PageDisplay & io_rPageMaker ); + + OuputPage_Environment & + Env() { return *pEnv; } + + // DATA + OuputPage_Environment * + pEnv; +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/dsply_da.cxx b/autodoc/source/display/html/dsply_da.cxx new file mode 100644 index 000000000000..4989e774f946 --- /dev/null +++ b/autodoc/source/display/html/dsply_da.cxx @@ -0,0 +1,202 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "dsply_da.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_vari.hxx> +#include <ary/doc/d_docu.hxx> +#include <ary/loc/loc_file.hxx> +#include <ary/loc/locp_le.hxx> +#include <udm/html/htmlitem.hxx> +#include "hd_docu.hxx" +#include "hdimpl.hxx" +#include "html_kit.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" + + +using namespace csi; + + + +DataDisplay::DataDisplay( OuputPage_Environment & io_rEnv ) + : aMap_GlobalDataDisplay(), + pClassMembersDisplay(0), + pEnv( &io_rEnv ), + pDocuShow( new Docu_Display(io_rEnv) ) +{ +} + +DataDisplay::~DataDisplay() +{ + csv::erase_map_of_heap_ptrs( aMap_GlobalDataDisplay ); +} + +void +DataDisplay::PrepareForConstants() +{ + if (pClassMembersDisplay) + pClassMembersDisplay = 0; + + csv::erase_map_of_heap_ptrs( aMap_GlobalDataDisplay ); +} + +void +DataDisplay::PrepareForVariables() +{ + // Doesn't need to do anything yet. +} + +void +DataDisplay::PrepareForStdMembers() +{ + csv::erase_map_of_heap_ptrs( aMap_GlobalDataDisplay ); + + pClassMembersDisplay = new PageDisplay(*pEnv); + const ary::cpp::Class * pClass = pEnv->CurClass(); + csv_assert( pClass != 0 ); + pClassMembersDisplay->Setup_DataFile_for(*pClass); +} + +void +DataDisplay::PrepareForStaticMembers() +{ + // Doesn't need to do anything yet. +} + +void +DataDisplay::Create_Files() +{ + if (pClassMembersDisplay) + { + pClassMembersDisplay->Create_File(); + pClassMembersDisplay = 0; + } + else + { + for ( Map_FileId2PagePtr::const_iterator it = aMap_GlobalDataDisplay.begin(); + it != aMap_GlobalDataDisplay.end(); + ++it ) + { + (*it).second->Create_File(); + } + csv::erase_map_of_heap_ptrs( aMap_GlobalDataDisplay ); + } +} + +void +DataDisplay::do_Process( const ary::cpp::Variable & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + PageDisplay & rPage = FindPage_for( i_rData ); + + csi::xml::Element & rOut = rPage.CurOut(); + Display_SglDatum( rOut, i_rData ); +} + +const ary::cpp::Gate * +DataDisplay::inq_Get_ReFinder() const +{ + return & pEnv->Gate(); +} + +PageDisplay & +DataDisplay::FindPage_for( const ary::cpp::Variable & i_rData ) +{ + if ( pClassMembersDisplay ) + return *pClassMembersDisplay; + + SourceFileId + nSourceFile = i_rData.Location(); + PageDisplay * + pFound = csv::value_from_map( aMap_GlobalDataDisplay, nSourceFile, (PageDisplay*)0 ); + if ( pFound == 0 ) + { + pFound = new PageDisplay( *pEnv ); + const ary::loc::File & + rFile = pEnv->Gate().Locations().Find_File( nSourceFile ); + pFound->Setup_DataFile_for(rFile); + aMap_GlobalDataDisplay[nSourceFile] = pFound; + } + + return *pFound; +} + +void +DataDisplay::Display_SglDatum( csi::xml::Element & rOut, + const ary::cpp::Variable & i_rData ) +{ + adcdisp::ExplanationList aDocu(rOut, true); + aDocu.AddEntry( 0 ); + + aDocu.Term() + >> *new html::Label( DataLabel(i_rData.LocalName()) ) + << " "; + aDocu.Term() + << i_rData.LocalName(); + + dshelp::Get_LinkedTypeText( aDocu.Def(), *pEnv, i_rData.Type() ); + aDocu.Def() + << " " + >> *new html::Strong + << i_rData.LocalName(); + if ( i_rData.ArraySize().length() > 0 ) + { + aDocu.Def() + << "[" + << i_rData.ArraySize() + << "]"; + } + if ( i_rData.Initialisation().length() > 0 ) + { + aDocu.Def() + << " = " + << i_rData.Initialisation(); + } + aDocu.Def() + << ";" + << new html::LineBreak + << new html::LineBreak; + + aDocu.AddEntry_NoTerm(); + + pDocuShow->Assign_Out(aDocu.Def()); + pDocuShow->Process(i_rData.Docu()); + pDocuShow->Unassign_Out(); + + rOut << new html::HorizontalLine; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/dsply_da.hxx b/autodoc/source/display/html/dsply_da.hxx new file mode 100644 index 000000000000..45f0b15f9503 --- /dev/null +++ b/autodoc/source/display/html/dsply_da.hxx @@ -0,0 +1,110 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_DSPLY_DA_HXX +#define ADC_DISPLAY_HTML_DSPLY_DA_HXX + +// BASE CLASSES +#include <ary/ary_disp.hxx> +#include <cosv/tpl/processor.hxx> +// USED SERVICES +#include <ary/cpp/c_ce.hxx> + +namespace ary +{ + namespace cpp + { + class Variable; + } +} +namespace csi +{ + namespace xml + { + class Element; + } +} + + + + +class OuputPage_Environment; +class PageDisplay; +class Docu_Display; + +class DataDisplay : public ary::Display, + public csv::ConstProcessor<ary::cpp::Variable> +{ + public: + DataDisplay( + OuputPage_Environment & + io_rInfo ); + virtual ~DataDisplay(); + + void PrepareForConstants(); + void PrepareForVariables(); + void PrepareForStdMembers(); + void PrepareForStaticMembers(); + + void Create_Files(); + + private: + // Interface csv::ConstProcessor<>: + virtual void do_Process( + const ary::cpp::Variable & + i_rData ); + // Interface ary::cpp::Display: + virtual const ary::cpp::Gate * + inq_Get_ReFinder() const; + + // Locals + typedef ary::cpp::Lid SourceFileId; + typedef std::map< SourceFileId, DYN PageDisplay* > Map_FileId2PagePtr; + + PageDisplay & FindPage_for( + const ary::cpp::Variable & + i_rData ); + void Display_SglDatum( + csi::xml::Element & rOut, + const ary::cpp::Variable & + i_rData ); + // DATA + Map_FileId2PagePtr aMap_GlobalDataDisplay; + Dyn<PageDisplay> pClassMembersDisplay; + + OuputPage_Environment * + pEnv; + Dyn<Docu_Display> pDocuShow; +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/dsply_op.cxx b/autodoc/source/display/html/dsply_op.cxx new file mode 100644 index 000000000000..e34db602ff6a --- /dev/null +++ b/autodoc/source/display/html/dsply_op.cxx @@ -0,0 +1,210 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "dsply_op.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/loc/locp_le.hxx> +#include <udm/html/htmlitem.hxx> +#include "hd_docu.hxx" +#include "hdimpl.hxx" +#include "html_kit.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" + +using namespace csi; +using namespace adcdisp; + + + + +OperationsDisplay::OperationsDisplay( OuputPage_Environment & io_rEnv ) + : // aMap_GlobalFunctionsDisplay, + // pClassMembersDisplay, + pEnv( &io_rEnv ), + pDocuShow( new Docu_Display(io_rEnv) ) +{ +} + +OperationsDisplay::~OperationsDisplay() +{ + csv::erase_map_of_heap_ptrs( aMap_GlobalFunctionsDisplay ); +} + +void +OperationsDisplay::PrepareForStdMembers() +{ + csv::erase_map_of_heap_ptrs( aMap_GlobalFunctionsDisplay ); + + pClassMembersDisplay = new PageDisplay(*pEnv); + const ary::cpp::Class * pClass = pEnv->CurClass(); + csv_assert( pClass != 0 ); + pClassMembersDisplay->Setup_OperationsFile_for(*pClass); +} + +void +OperationsDisplay::PrepareForStaticMembers() +{ + // Doesn't need to do anything yet. +} + +void +OperationsDisplay::Create_Files() +{ + if (pClassMembersDisplay) + pClassMembersDisplay->Create_File(); + else + { + for ( Map_FileId2PagePtr::const_iterator it = aMap_GlobalFunctionsDisplay.begin(); + it != aMap_GlobalFunctionsDisplay.end(); + ++it ) + { + (*it).second->Create_File(); + } + } +} + +void +OperationsDisplay::do_Process( const ary::cpp::Function & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + PageDisplay & rPage = FindPage_for( i_rData ); + + csi::xml::Element & rOut = rPage.CurOut(); + Display_SglOperation( rOut, i_rData ); +} + +const ary::cpp::Gate * +OperationsDisplay::inq_Get_ReFinder() const +{ + return & pEnv->Gate(); +} + +PageDisplay & +OperationsDisplay::FindPage_for( const ary::cpp::Function & i_rData ) +{ + if ( pClassMembersDisplay ) + return *pClassMembersDisplay; + + SourceFileId + nSourceFile = i_rData.Location(); + PageDisplay * + pFound = csv::value_from_map( aMap_GlobalFunctionsDisplay, nSourceFile, (PageDisplay*)0 ); + if ( pFound == 0 ) + { + pFound = new PageDisplay( *pEnv ); + const ary::loc::File & + rFile = pEnv->Gate().Locations().Find_File( nSourceFile ); + pFound->Setup_OperationsFile_for(rFile); + aMap_GlobalFunctionsDisplay[nSourceFile] = pFound; + } + + return *pFound; +} + +void +OperationsDisplay::Display_SglOperation( csi::xml::Element & rOut, + const ary::cpp::Function & i_rData ) +{ + adcdisp::ExplanationList aDocu(rOut, true); + aDocu.AddEntry( 0 ); + + + adcdisp::OperationTitle fTitle; + fTitle( aDocu.Term(), + i_rData.LocalName(), + i_rData.CeId(), + pEnv->Gate() ); + + // Syntax + adcdisp::ExplanationList aSyntaxHeader(aDocu.Def()); + aSyntaxHeader.AddEntry( 0, "simple" ); + csi::xml::Element & rHeader = aSyntaxHeader.Term(); + + adcdisp::ParameterTable + aParams( aSyntaxHeader.Def() ); + + if (i_rData.TemplateParameters().size() > 0) + { + TemplateClause fTemplateClause; + fTemplateClause( rHeader, i_rData.TemplateParameters() ); + rHeader << new html::LineBreak; + } + if ( i_rData.Flags().IsExternC() ) + { + rHeader + << "extern \"C\"" + << new html::LineBreak; + } + + bool bConst = false; + bool bVolatile = false; + WriteOut_LinkedFunctionText( rHeader, aParams, i_rData, *pEnv, + &bConst, &bVolatile ); + aDocu.Def() << new html::LineBreak; + + // Flags + aDocu.AddEntry_NoTerm(); + adcdisp::FlagTable + aFlags( aDocu.Def(), 8 ); + + const ary::cpp::FunctionFlags & + rFFlags = i_rData.Flags(); + aFlags.SetColumn( 0, "virtual", + i_rData.Virtuality() != ary::cpp::VIRTUAL_none ); + aFlags.SetColumn( 1, "abstract", + i_rData.Virtuality() == ary::cpp::VIRTUAL_abstract ); + aFlags.SetColumn( 2, "const", bConst ); + aFlags.SetColumn( 3, "volatile", bVolatile ); + aFlags.SetColumn( 4, "template", + i_rData.TemplateParameters().size() > 0 ); + aFlags.SetColumn( 5, "static", + rFFlags.IsStaticLocal() OR rFFlags.IsStaticMember() ); + aFlags.SetColumn( 6, "inline", + rFFlags.IsInline() ); + aFlags.SetColumn( 7, "C-linkage", + rFFlags.IsExternC() ); + aDocu.Def() << new html::LineBreak; + + // Docu + aDocu.AddEntry_NoTerm(); + pDocuShow->Assign_Out(aDocu.Def()); + pDocuShow->Process(i_rData.Docu()); + pDocuShow->Unassign_Out(); + + rOut << new html::HorizontalLine; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/dsply_op.hxx b/autodoc/source/display/html/dsply_op.hxx new file mode 100644 index 000000000000..27f2657a0f57 --- /dev/null +++ b/autodoc/source/display/html/dsply_op.hxx @@ -0,0 +1,107 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_DSPLY_OP_HXX +#define ADC_DISPLAY_HTML_DSPLY_OP_HXX + +// BASE CLASSES +#include <ary/ary_disp.hxx> +#include <cosv/tpl/processor.hxx> +// USED SERVICES +#include <ary/cpp/c_ce.hxx> + +namespace ary +{ + namespace cpp + { + class Function; + } +} +namespace csi +{ + namespace xml + { + class Element; + } +} + +class OuputPage_Environment; +class PageDisplay; +class Docu_Display; + + + + +class OperationsDisplay : public ary::Display, + public csv::ConstProcessor<ary::cpp::Function> +{ + public: + OperationsDisplay( + OuputPage_Environment & + io_rInfo ); + virtual ~OperationsDisplay(); + + void PrepareForStdMembers(); + void PrepareForStaticMembers(); + void Create_Files(); + + private: + // Interface csv::ConstProcessor<>: + virtual void do_Process( + const ary::cpp::Function & + i_rData ); + // Interface ary::Display: + virtual const ary::cpp::Gate * + inq_Get_ReFinder() const; + + // Locals + typedef ary::cpp::Lid SourceFileId; + typedef std::map< SourceFileId, DYN PageDisplay* > Map_FileId2PagePtr; + + PageDisplay & FindPage_for( + const ary::cpp::Function & + i_rData ); + void Display_SglOperation( + csi::xml::Element & rOut, + const ary::cpp::Function & + i_rData ); + // DATA + Map_FileId2PagePtr aMap_GlobalFunctionsDisplay; + Dyn<PageDisplay> pClassMembersDisplay; + + OuputPage_Environment * + pEnv; + Dyn<Docu_Display> pDocuShow; +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/easywri.cxx b/autodoc/source/display/html/easywri.cxx new file mode 100644 index 000000000000..b68b36d011d4 --- /dev/null +++ b/autodoc/source/display/html/easywri.cxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "easywri.hxx" + + +// NOT FULLY DEFINED SERVICES + + +using namespace csi::html; + + +EasyWriter::EasyWriter() +{ +} + +EasyWriter::~EasyWriter() +{ +} + +void +EasyWriter::Open_OutputNode( csi::xml::Element & io_rDestination ) +{ + aCurDestination.push(&io_rDestination); +} + +void +EasyWriter::Finish_OutputNode() +{ + csv_assert( NOT aCurDestination.empty() ); + aCurDestination.pop(); +} + +csi::xml::Element & +EasyWriter::Out() +{ + csv_assert( aCurDestination.size() > 0); + return *aCurDestination.top(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/easywri.hxx b/autodoc/source/display/html/easywri.hxx new file mode 100644 index 000000000000..9a70a3c5b91c --- /dev/null +++ b/autodoc/source/display/html/easywri.hxx @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_EASYWRI_HXX +#define ADC_DISPLAY_HTML_EASYWRI_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <estack.hxx> + // PARAMETERS +#include <udm/html/htmlitem.hxx> + + +class EasyWriter +{ + public: + // LIFECYCLE + EasyWriter(); + ~EasyWriter(); + + // OPERATIONS + /// Pushes csi::xml::Element on stack. + void Open_OutputNode( + csi::xml::Element & io_rDestination ); + /// Pops front csi::xml::Element from stack. + void Finish_OutputNode(); + + void Enter( + csi::xml::Element & io_rDestination ) + { Open_OutputNode(io_rDestination); } + void Leave() { Finish_OutputNode(); } + + // ACCESS + csi::xml::Element & Out(); // CurOutputNode + + private: + EStack< csi::xml::Element * > + aCurDestination; // The front element is the currently used. + // The later ones are the parents. +}; + +/* +inline csi::xml::Element & +EasyWriter::Out() + { csv_assert( aCurDestination.size() > 0 ); + return *aCurDestination.top(); } +*/ + +// IMPLEMENTATION + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/hd_chlst.cxx b/autodoc/source/display/html/hd_chlst.cxx new file mode 100644 index 000000000000..8e3c3c95ced1 --- /dev/null +++ b/autodoc/source/display/html/hd_chlst.cxx @@ -0,0 +1,592 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "hd_chlst.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/ceslot.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_vari.hxx> +#include <ary/cpp/c_enuval.hxx> +#include <ary/loc/loc_file.hxx> +#include <ary/loc/locp_le.hxx> +#include <ary/doc/d_oldcppdocu.hxx> +#include <ary/info/ci_attag.hxx> +#include <ary/info/ci_text.hxx> +#include <ary/info/all_dts.hxx> +#include "hd_docu.hxx" +#include "opageenv.hxx" +#include "protarea.hxx" +#include "strconst.hxx" + + +using namespace csi; +using html::Table; +using html::TableRow; +using html::TableCell; +using html::Font; +using html::SizeAttr; +using html::BgColorAttr; +using html::WidthAttr; + + +const int ixPublic = 0; +const int ixProtected = 1; +const int ixPrivate = 2; + +struct ChildList_Display::S_AreaCo +{ + public: + ProtectionArea aArea; + Area_Result * pResult; + + S_AreaCo( + Area_Result & o_rResult, + const char * i_sLabel, + const char * i_sTitle ); + ~S_AreaCo(); + + void PerformResult(); + + private: + csi::xml::Element & Out() { return pResult->rOut; } +}; + + +const ary::info::DocuText & +ShortDocu( const ary::cpp::CodeEntity & i_rCe ) +{ + static const ary::info::DocuText + aNull_; + + const ary::doc::OldCppDocu * + pInfo = dynamic_cast< const ary::doc::OldCppDocu* >( i_rCe.Docu().Data() ); + if (pInfo == 0) + return aNull_; + + return pInfo->Short().CText(); +} + + +ChildList_Display::ChildList_Display( OuputPage_Environment & io_rEnv ) + : HtmlDisplay_Impl( io_rEnv ), + pShortDocu_Display( new Docu_Display(io_rEnv) ), + pActiveParentClass(0), + pActiveParentEnum(0), + // pSglArea, + // aMemberAreas, + peClassesFilter(0) +{ +} + +ChildList_Display::ChildList_Display( OuputPage_Environment & io_rEnv, + const ary::cpp::Class & i_rClass ) + : HtmlDisplay_Impl( io_rEnv ), + pShortDocu_Display( new Docu_Display(io_rEnv) ), + pActiveParentClass(&i_rClass), + pActiveParentEnum(0), + // pSglArea, + // aMemberAreas, + peClassesFilter(0) +{ +} + +ChildList_Display::ChildList_Display( OuputPage_Environment & io_rEnv, + const ary::cpp::Enum & i_rEnum ) + : HtmlDisplay_Impl( io_rEnv ), + pShortDocu_Display( new Docu_Display(io_rEnv) ), + pActiveParentClass(0), + pActiveParentEnum(&i_rEnum), + // pSglArea, + // aMemberAreas, + peClassesFilter(0) +{ +} + +ChildList_Display::~ChildList_Display() +{ +} + +void +ChildList_Display::Run_Simple( Area_Result & o_rResult, + ary::SlotAccessId i_nSlot, + const char * i_sListLabel, + const char * i_sListTitle ) +{ + ary::Slot_AutoPtr + pSlot( ActiveParent().Create_Slot( i_nSlot ) ); + if ( pSlot->Size() == 0 ) + return; + + pSglArea = new S_AreaCo( o_rResult, + i_sListLabel, + i_sListTitle ); + + pSlot->StoreAt(*this); + + pSglArea->PerformResult(); + pSglArea = 0; +} + +void +ChildList_Display::Run_GlobalClasses( Area_Result & o_rResult, + ary::SlotAccessId i_nSlot, + const char * i_sListLabel, + const char * i_sListTitle, + ary::cpp::E_ClassKey i_eFilter ) +{ + ary::Slot_AutoPtr + pSlot( ActiveParent().Create_Slot( i_nSlot ) ); + if ( pSlot->Size() == 0 ) + return; + + pSglArea = new S_AreaCo( o_rResult, + i_sListLabel, + i_sListTitle ); + + SetClassesFilter(i_eFilter); + pSlot->StoreAt(*this); + UnsetClassesFilter(); + + pSglArea->PerformResult(); + pSglArea = 0; +} + +void +ChildList_Display::Run_Members( Area_Result & o_rResult_public, + Area_Result & o_rResult_protected, + Area_Result & o_rResult_private, + ary::SlotAccessId i_nSlot, + const char * i_sListLabel_public, + const char * i_sListLabel_protected, + const char * i_sListLabel_private, + const char * i_sListTitle ) +{ + ary::Slot_AutoPtr + pSlot( ActiveParent().Create_Slot(i_nSlot) ); + if ( pSlot->Size() == 0 ) + return; + + aMemberAreas[ixPublic] = new S_AreaCo( o_rResult_public, + i_sListLabel_public, + i_sListTitle ); + aMemberAreas[ixProtected] = new S_AreaCo( o_rResult_protected, + i_sListLabel_protected, + i_sListTitle ); + aMemberAreas[ixPrivate] = new S_AreaCo( o_rResult_private, + i_sListLabel_private, + i_sListTitle ); + + pSlot->StoreAt(*this); + + aMemberAreas[ixPublic]->PerformResult(); + aMemberAreas[ixProtected]->PerformResult(); + aMemberAreas[ixPrivate]->PerformResult(); + + aMemberAreas[ixPublic] = 0; + aMemberAreas[ixProtected] = 0; + aMemberAreas[ixPrivate] = 0; +} + +void +ChildList_Display::Run_MemberClasses( Area_Result & o_rResult_public, + Area_Result & o_rResult_protected, + Area_Result & o_rResult_private, + ary::SlotAccessId i_nSlot, + const char * i_sListLabel_public, + const char * i_sListLabel_protected, + const char * i_sListLabel_private, + const char * i_sListTitle, + ary::cpp::E_ClassKey i_eFilter ) +{ + ary::Slot_AutoPtr + pSlot( ActiveParent().Create_Slot(i_nSlot) ); + if ( pSlot->Size() == 0 ) + return; + + aMemberAreas[ixPublic] = new S_AreaCo( o_rResult_public, + i_sListLabel_public, + i_sListTitle ); + aMemberAreas[ixProtected] = new S_AreaCo( o_rResult_protected, + i_sListLabel_protected, + i_sListTitle ); + aMemberAreas[ixPrivate] = new S_AreaCo( o_rResult_private, + i_sListLabel_private, + i_sListTitle ); + + SetClassesFilter(i_eFilter); + pSlot->StoreAt(*this); + UnsetClassesFilter(); + + aMemberAreas[ixPublic]->PerformResult(); + aMemberAreas[ixProtected]->PerformResult(); + aMemberAreas[ixPrivate]->PerformResult(); + + aMemberAreas[ixPublic] = 0; + aMemberAreas[ixProtected] = 0; + aMemberAreas[ixPrivate] = 0; +} + +void +ChildList_Display::do_Process( const ary::cpp::Namespace & i_rData ) +{ + Write_ListItem( i_rData.LocalName(), + Path2ChildNamespace(i_rData.LocalName()), + ShortDocu( i_rData ), + GetArea().GetTable() ); +} + +void +ChildList_Display::do_Process( const ary::cpp::Class & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + if (peClassesFilter) + { + if (*peClassesFilter != i_rData.ClassKey() ) + return; + } + + String sLink; + if ( i_rData.Protection() == ary::cpp::PROTECT_global ) + { + sLink = ClassFileName(i_rData.LocalName()); + + } + else + { + csv_assert( pActiveParentClass != 0 ); + sLink = Path2Child( ClassFileName(i_rData.LocalName()), pActiveParentClass->LocalName() ); + } + + if (peClassesFilter) + { + Write_ListItem( i_rData.LocalName(), + sLink, + ShortDocu( i_rData ), + GetArea(i_rData.Protection()) + .GetTable() ); + } + else + { + Write_ListItem( i_rData.LocalName(), + sLink, + ShortDocu( i_rData ), + GetArea(i_rData.Protection()) + .GetTable(i_rData.ClassKey()) ); + } +} + +void +ChildList_Display::do_Process( const ary::cpp::Enum & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + String sLink; + if ( i_rData.Protection() == ary::cpp::PROTECT_global ) + { + sLink = EnumFileName(i_rData.LocalName()); + } + else + { + csv_assert( pActiveParentClass != 0 ); + sLink = Path2Child( EnumFileName(i_rData.LocalName()), + pActiveParentClass->LocalName() ); + } + + Write_ListItem( i_rData.LocalName(), + sLink, + ShortDocu( i_rData ), + GetArea(i_rData.Protection()).GetTable() ); +} + +void +ChildList_Display::do_Process( const ary::cpp::Typedef & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + String sLink; + if ( i_rData.Protection() == ary::cpp::PROTECT_global ) + { + sLink = TypedefFileName(i_rData.LocalName()); + } + else + { + csv_assert( pActiveParentClass != 0 ); + sLink = Path2Child( TypedefFileName(i_rData.LocalName()), + pActiveParentClass->LocalName() ); + } + + Write_ListItem( i_rData.LocalName(), + sLink, + ShortDocu( i_rData ), + GetArea(i_rData.Protection()).GetTable() ); +} + +void +ChildList_Display::do_Process( const ary::cpp::Function & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + String sLinkPrePath; + if ( i_rData.Protection() == ary::cpp::PROTECT_global ) + { + const ary::loc::File & + rFile = Env().Gate().Locations().Find_File( i_rData.Location() ); + sLinkPrePath = HtmlFileName( "o-", rFile.LocalName() ); + } + else + { + csv_assert( pActiveParentClass != 0 ); + sLinkPrePath = Path2Child( HtmlFileName( "o", "" ), + pActiveParentClass->LocalName() ); + } + + // Out + Table & rOut = GetArea(i_rData.Protection()).GetTable(); + TableRow * dpRow = new TableRow; + rOut << dpRow; + TableCell & rCell1 = dpRow->AddCell(); + + rCell1 + << SyntaxText_PreName( i_rData, Env().Gate() ) + << new html::LineBreak; + rCell1 + >> *new html::Link( OperationLink( + Env().Gate(), + i_rData.LocalName(), + i_rData.CeId(), + sLinkPrePath) ) + << i_rData.LocalName(); + rCell1 + << SyntaxText_PostName( i_rData, Env().Gate() ); + TableCell & + rCell2 = dpRow->AddCell(); + rCell2 + << new WidthAttr("50%") + << " "; + + pShortDocu_Display->Assign_Out( rCell2 ); + ShortDocu( i_rData ).StoreAt( *pShortDocu_Display ); + pShortDocu_Display->Unassign_Out(); +} + +void +ChildList_Display::do_Process( const ary::cpp::Variable & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + String sLinkPrePath; + if ( i_rData.Protection() == ary::cpp::PROTECT_global ) + { + const ary::loc::File & + rFile = Env().Gate().Locations().Find_File( i_rData.Location() ); + sLinkPrePath = HtmlFileName( "d-", rFile.LocalName() ); + } + else + { + csv_assert( pActiveParentClass != 0 ); + sLinkPrePath = Path2Child( HtmlFileName( "d", "" ), + pActiveParentClass->LocalName() ); + } + + TableRow * dpRow = new TableRow; + GetArea(i_rData.Protection()).GetTable() << dpRow; + + *dpRow << new html::BgColorAttr("white"); + csi::xml::Element & + rCell1 = dpRow->AddCell(); + + dshelp::Get_LinkedTypeText( rCell1, Env(), i_rData.Type() ); + rCell1 + << " " + >> *new html::Link( DataLink(i_rData.LocalName(), sLinkPrePath.c_str()) ) + >> *new html::Strong + << i_rData.LocalName() + << ";"; + + TableCell & rShortDocu = dpRow->AddCell(); + pShortDocu_Display->Assign_Out( rShortDocu ); + ShortDocu( i_rData ).StoreAt( *pShortDocu_Display ); + pShortDocu_Display->Unassign_Out(); +} + +void +ChildList_Display::do_Process( const ary::cpp::EnumValue & i_rData ) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + Table & rOut = GetArea().GetTable(); + + TableRow * dpRow = new TableRow; + rOut << dpRow; + + *dpRow << new html::BgColorAttr("white"); + dpRow->AddCell() + << new WidthAttr("20%") + << new xml::AnAttribute("valign", "top") + >> *new html::Label(i_rData.LocalName()) + >> *new html::Bold + << i_rData.LocalName(); + + TableCell & rValueDocu = dpRow->AddCell(); + pShortDocu_Display->Assign_Out( rValueDocu ); + i_rData.Docu().Accept( *pShortDocu_Display ); + pShortDocu_Display->Unassign_Out(); +} + +void +ChildList_Display::do_StartSlot() +{ +} + +void +ChildList_Display::do_FinishSlot() +{ +} + +const ary::cpp::Gate * +ChildList_Display::inq_Get_ReFinder() const +{ + return & Env().Gate(); +} + +void +ChildList_Display::Write_ListItem( const String & i_sLeftText, + const char * i_sLink, + const ary::info::DocuText & i_rRightText, + csi::xml::Element & o_rOut ) +{ + TableRow * dpRow = new TableRow; + o_rOut << dpRow; + + *dpRow << new html::BgColorAttr("white"); + dpRow->AddCell() + << new WidthAttr("20%") + >> *new html::Link( i_sLink ) + >> *new html::Bold + << i_sLeftText; + + TableCell & rShortDocu = dpRow->AddCell(); + pShortDocu_Display->Assign_Out( rShortDocu ); + i_rRightText.StoreAt( *pShortDocu_Display ); + pShortDocu_Display->Unassign_Out(); +} + +const ary::AryGroup & +ChildList_Display::ActiveParent() +{ + return pActiveParentClass != 0 + ? static_cast< const ary::AryGroup& >(*pActiveParentClass) + : pActiveParentEnum != 0 + ? static_cast< const ary::AryGroup& >(*pActiveParentEnum) + : static_cast< const ary::AryGroup& >(*Env().CurNamespace()); +} + +ProtectionArea & +ChildList_Display::GetArea() +{ + return pSglArea->aArea; +} + +ProtectionArea & +ChildList_Display::GetArea( ary::cpp::E_Protection i_eProtection ) +{ + switch ( i_eProtection ) + { + case ary::cpp::PROTECT_public: + return aMemberAreas[ixPublic]->aArea; + case ary::cpp::PROTECT_protected: + return aMemberAreas[ixProtected]->aArea; + case ary::cpp::PROTECT_private: + return aMemberAreas[ixPrivate]->aArea; + default: + return pSglArea->aArea; + } +} + + +//******************* ********************// + +ChildList_Display:: +S_AreaCo::S_AreaCo( Area_Result & o_rResult, + const char * i_sLabel, + const char * i_sTitle ) + : aArea(i_sLabel, i_sTitle), + pResult(&o_rResult) +{ +} + +ChildList_Display:: +S_AreaCo::~S_AreaCo() +{ +} + +void +ChildList_Display:: +S_AreaCo::PerformResult() +{ + bool bUsed = aArea.WasUsed_Area(); + pResult->rChildrenExist = bUsed; + if ( bUsed ) + { + Create_ChildListLabel( Out(), aArea.Label() ); + + if ( aArea.Size() == 1 ) + { + Out() << aArea.ReleaseTable(); + } + else + { + Table * pTable = aArea.ReleaseTable( ary::cpp::CK_class ); + if (pTable != 0) + Out() << pTable; + pTable = aArea.ReleaseTable( ary::cpp::CK_struct ); + if (pTable != 0) + Out() << pTable; + pTable = aArea.ReleaseTable( ary::cpp::CK_union ); + if (pTable != 0) + Out() << pTable; + } + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/hd_chlst.hxx b/autodoc/source/display/html/hd_chlst.hxx new file mode 100644 index 000000000000..cbd784d4ed2c --- /dev/null +++ b/autodoc/source/display/html/hd_chlst.hxx @@ -0,0 +1,209 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_HD_CHLST_HXX +#define ADC_DISPLAY_HTML_HD_CHLST_HXX + +// BASE CLASSES +#include <ary/ary_disp.hxx> +#include <cosv/tpl/processor.hxx> + +// USED SERVICES +#include <ary/cpp/c_types4cpp.hxx> +#include "hdimpl.hxx" + + + +namespace ary +{ + namespace cpp + { + class Namespace; + class Class; + class Enum; + class Typedef; + class Function; + class Variable; + class EnumValue; + } + namespace info + { + class DocuText; + } +} + +class Docu_Display; +class ProtectionArea; + +class ChildList_Display : public ary::Display, + public csv::ConstProcessor<ary::cpp::Namespace>, + public csv::ConstProcessor<ary::cpp::Class>, + public csv::ConstProcessor<ary::cpp::Enum>, + public csv::ConstProcessor<ary::cpp::Typedef>, + public csv::ConstProcessor<ary::cpp::Function>, + public csv::ConstProcessor<ary::cpp::Variable>, + public csv::ConstProcessor<ary::cpp::EnumValue>, + private HtmlDisplay_Impl +{ + public: + struct Area_Result + { + bool & rChildrenExist; + csi::xml::Element & rOut; + + Area_Result( + bool & o_rChildrenExist, + csi::xml::Element & o_rOut ) + : rChildrenExist(o_rChildrenExist), + rOut(o_rOut) {} + }; + + + ChildList_Display( + OuputPage_Environment & + io_rEnv ); + ChildList_Display( + OuputPage_Environment & + io_rEnv, + const ary::cpp::Class & + i_rClass ); + ChildList_Display( + OuputPage_Environment & + io_rEnv, + const ary::cpp::Enum & + i_rEnum ); + + virtual ~ChildList_Display(); + + void Run_Simple( + Area_Result & o_rResult, + ary::SlotAccessId i_nSlot, + const char * i_sListLabel, + const char * i_sListTitle ); + void Run_GlobalClasses( + Area_Result & o_rResult, + ary::SlotAccessId i_nSlot, + const char * i_sListLabel, + const char * i_sListTitle, + ary::cpp::E_ClassKey + i_eFilter ); + void Run_Members( + Area_Result & o_rResult_public, + Area_Result & o_rResult_protected, + Area_Result & o_rResult_private, + ary::SlotAccessId i_nSlot, + const char * i_sListLabel_public, + const char * i_sListLabel_protected, + const char * i_sListLabel_private, + const char * i_sListTitle ); + void Run_MemberClasses( + Area_Result & o_rResult_public, + Area_Result & o_rResult_protected, + Area_Result & o_rResult_private, + ary::SlotAccessId i_nSlot, + const char * i_sListLabel_public, + const char * i_sListLabel_protected, + const char * i_sListLabel_private, + const char * i_sListTitle, + ary::cpp::E_ClassKey + i_eFilter ); + private: + // Interface csv::ConstProcessor<>: + virtual void do_Process( + const ary::cpp::Namespace & + i_rData ); + /** i_rData is shown only, if it passes two filters: + it must have the right protection, checked with pFilter, + and the right class key (class,struct,union), checked with + pClassFilter. A not exsting filter allows i_rData to be + displayed. + */ + virtual void do_Process( + const ary::cpp::Class & + i_rData ); + virtual void do_Process( + const ary::cpp::Enum & + i_rData ); + virtual void do_Process( + const ary::cpp::Typedef & + i_rData ); + virtual void do_Process( + const ary::cpp::Function & + i_rData ); + virtual void do_Process( + const ary::cpp::Variable & + i_rData ); + virtual void do_Process( + const ary::cpp::EnumValue & + i_rData ); + private: + // Interface ary::Display: + virtual void do_StartSlot(); + virtual void do_FinishSlot(); + virtual const ary::cpp::Gate * + inq_Get_ReFinder() const; + // Locals + struct S_AreaCo; + void Write_ListItem( + const String & i_sLeftText, + const char * i_sLink, + const ary::info::DocuText & + i_rRightText, + csi::xml::Element & rOut ); + const ary::AryGroup & + ActiveParent(); + ProtectionArea & GetArea(); + ProtectionArea & GetArea( + ary::cpp::E_Protection + i_eProtection ); + void SetClassesFilter( + ary::cpp::E_ClassKey + i_eFilter ) + { peClassesFilter = new ary::cpp::E_ClassKey(i_eFilter); } + void UnsetClassesFilter() { peClassesFilter = 0; } + + // DATA + Dyn<Docu_Display> pShortDocu_Display; + const ary::cpp::Class * + pActiveParentClass; + const ary::cpp::Enum * + pActiveParentEnum; + + Dyn<S_AreaCo> pSglArea; + Dyn<S_AreaCo> aMemberAreas[3]; + + Dyn<ary::cpp::E_ClassKey> + peClassesFilter; +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/hd_docu.cxx b/autodoc/source/display/html/hd_docu.cxx new file mode 100644 index 000000000000..0e0cb97dd047 --- /dev/null +++ b/autodoc/source/display/html/hd_docu.cxx @@ -0,0 +1,488 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "hd_docu.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_vari.hxx> +#include <ary/cpp/c_enuval.hxx> +#include <ary/doc/d_oldcppdocu.hxx> +#include <ary/info/all_tags.hxx> +#include <ary/info/all_dts.hxx> +#include <adc_cl.hxx> +#include "html_kit.hxx" +#include "opageenv.hxx" + + + +using namespace ary::info; +using namespace csi; + +using html::DefList; +using html::DefListTerm; +using html::DefListDefinition; +using html::Headline; +using html::Link; + + +const char * +C_sTagHeadlines[ ary::info::C_eAtTag_NrOfClasses ] = + { + "ATTENTION!", "Author", "Changes", "Collaborators", + "Contact", // Contact may be unused + "Copyright", "Deprecated", "Description", "Date of Documentation", + "How to Derive from this Class", + "Heap object - owner is responsible for deletion.", + "Important Instances", + "Interface Only", + "Invariant", "Lifecycle", + "Multiplicity", "On Error", "Persistency", "Postcondition", + "Precondition", + "Responsibilities", + "Return", "Summary", "Todos", "Version", + "Base Classes", "Exceptions", "Implements", "Keywords", "Parameters", + "See Also", "Template Parameters", + "", "Since " + }; + + + +Docu_Display::Docu_Display( OuputPage_Environment & io_rEnv ) + : HtmlDisplay_Impl(io_rEnv), + bUseHtmlInDocuTokens(false), + pCurClassOverwrite(0) +{ +} + +Docu_Display::~Docu_Display() +{ +} + +void +Docu_Display::Assign_Out( csi::xml::Element & o_rOut ) +{ + Easy().Enter(o_rOut); +} + +void +Docu_Display::Unassign_Out() +{ + Easy().Leave(); +} + +void +Docu_Display::do_Process( const ary::cpp::Namespace & i_rData ) +{ + Process(i_rData.Docu()); +} + +void +Docu_Display::do_Process( const ary::cpp::Class & i_rData ) +{ + pCurClassOverwrite = &i_rData; + Process(i_rData.Docu()); + pCurClassOverwrite = 0; +} + +void +Docu_Display::do_Process( const ary::cpp::Enum & i_rData ) +{ + Process(i_rData.Docu()); +} + +void +Docu_Display::do_Process( const ary::cpp::Typedef & i_rData ) +{ + Process(i_rData.Docu()); +} + +void +Docu_Display::do_Process( const ary::cpp::Function & i_rData ) +{ + Process(i_rData.Docu()); +} + +void +Docu_Display::do_Process( const ary::cpp::Variable & i_rData ) +{ + Process(i_rData.Docu()); +} + + + +// -------------- Interface ary::info::DocuDisplay ------------------ // + + +void +Docu_Display::do_Process(const ary::doc::Documentation & i_rData) +{ + if (i_rData.Data() == 0) + return; + + const ary::doc::OldCppDocu * + docdata = dynamic_cast< const ary::doc::OldCppDocu* >(i_rData.Data()); + csv_assert(docdata != 0); + + Start_DocuBlock(); + + if ( docdata->IsObsolete() ) + { + CurOut() + >> *new html::DefListTerm + >> *new html::Strong + << "D E P R E C A T E D"; + + } + + ary::doc::OldCppDocu::TagList::const_iterator + itEnd = docdata->Tags().end(); + for ( ary::doc::OldCppDocu::TagList::const_iterator it = docdata->Tags().begin(); + it != itEnd; + ++it ) + { + (*it)->StoreAt( *this ); + } + + Finish_DocuBlock(); +} + +void +Docu_Display::Display_StdTag( const StdTag & i_rData ) +{ + csv_assert( uintt(i_rData.Std_Id()) < uintt(ary::info::C_eAtTag_NrOfClasses) ); + + const ary::info::DocuText::TokenList & + rText = i_rData.CText().Tokens(); + typedef ary::info::DocuText::TokenList::const_iterator TokenIterator; + + if ( rText.empty() ) + return; + else if ( rText.size() < 3 ) + { + bool bIsWhite = true; + for ( TokenIterator it = rText.begin(); + it != rText.end(); + ++it ) + { + if (bIsWhite) + bIsWhite = (*it)->IsWhite(); + } + if (bIsWhite) + return; + } + + Write_TagTitle( C_sTagHeadlines[i_rData.Std_Id()] ); + Write_TagContents( i_rData.CText() ); +} + +void +Docu_Display::Display_BaseTag( const BaseTag & ) +{ +} + +void +Docu_Display::Display_ExceptionTag( const ExceptionTag & ) +{ +} + +void +Docu_Display::Display_ImplementsTag( const ImplementsTag & ) +{ +} + +void +Docu_Display::Display_KeywordTag( const KeywordTag & ) +{ +} + +void +Docu_Display::Display_ParameterTag( const ParameterTag & i_rData ) +{ + Write_TagTitle( "Parameters" ); + + adcdisp::ExplanationTable + aParams( CurOut() >> *new DefListDefinition ); + + for ( const ParameterTag * pParam = &i_rData; + pParam != 0; + pParam = pParam->GetNext() ) // KORR_FUTURE + { + aParams.AddEntry( pParam->ParamName().c_str() ); + + Easy().Enter( aParams.Def() ); + Write_Text( pParam->CText() ); + Easy().Leave(); + } // end for +} + +void +Docu_Display::Display_SeeTag( const SeeTag & i_rData ) +{ + Write_TagTitle( "See Also" ); + + DefListDefinition * dpDef = new DefListDefinition; + CurOut() << dpDef; + Easy().Enter(*dpDef); + + for ( std::vector< ary::QualifiedName >::const_iterator + it = i_rData.References().begin(); + it != i_rData.References().end(); + ++it ) + { + Write_LinkableText( (*it) ); + CurOut() << new html::LineBreak; + } + + Easy().Leave(); +} + +void +Docu_Display::Display_TemplateTag( const TemplateTag & i_rData ) +{ + Write_TagTitle( "Template Parameters" ); + + adcdisp::ExplanationTable + aTplParams( CurOut() >> *new DefListDefinition ); + + for ( const TemplateTag * pTplParam = &i_rData; + pTplParam != 0; + pTplParam = pTplParam->GetNext() ) + { + aTplParams.AddEntry( pTplParam->TplParamName().c_str() ); + + Easy().Enter( aTplParams.Def() ); + Write_Text( pTplParam->CText() ); + Easy().Leave(); + } // end for +} + +void +Docu_Display::Display_LabelTag( const LabelTag & ) +{ +} + +void +Docu_Display::Display_SinceTag( const ary::info::SinceTag & i_rData ) +{ + if ( i_rData.Version().empty() ) + { + return; + } + + // Transform the value of the @since tag into the text to be displayed. + String sDisplay; + if ( autodoc::CommandLine::Get_().DoesTransform_SinceTag() ) + { + sDisplay = autodoc::CommandLine::Get_() + .DisplayOf_SinceTagValue( i_rData.Version() ); + } + else + { + sDisplay = i_rData.Version(); + } + + if (sDisplay.empty()) + return; + + Write_TagTitle( "Since " ); + + DefListDefinition * dpDef = new DefListDefinition; + CurOut() << dpDef; + + Easy().Enter(*dpDef); + CurOut() << sDisplay; + Easy().Leave(); +} + +void +Docu_Display::Display_DT_Text( const DT_Text & i_rData ) +{ + Write_TextToken( i_rData.Text() ); +} + +void +Docu_Display::Display_DT_MaybeLink( const DT_MaybeLink & i_rData ) +{ + // KORR_FUTURE + Write_TextToken( i_rData.Text() ); +} + +void +Docu_Display::Display_DT_Whitespace( const DT_Whitespace & i_rData ) +{ + static char sSpace[300] = + " " + " " + " " + " " + " " + " "; + UINT8 nLength = i_rData.Length(); + sSpace[nLength] = NULCH; + CurOut() << sSpace; + sSpace[nLength] = ' '; +} + +void +Docu_Display::Display_DT_Eol( const DT_Eol & ) +{ + CurOut() << new html::Sbr; +} + +void +Docu_Display::Display_DT_Xml( const ary::info::DT_Xml & i_rData ) +{ + CurOut() << new xml::XmlCode( i_rData.Text() ); +} + +const ary::cpp::Gate * +Docu_Display::inq_Get_ReFinder() const +{ + return &Env().Gate(); +} + +void +Docu_Display::Start_DocuBlock() +{ + DYN DefList * dpDefList = new DefList; + CurOut() << dpDefList; + Easy().Enter( *dpDefList ); +} + +void +Docu_Display::Finish_DocuBlock() +{ + Easy().Leave(); +} + +void +Docu_Display::Write_TagTitle( const char * i_sText, + const char * ) +{ + if ( strcmp(i_sText,"ATTENTION!") == 0 ) + { + CurOut() + >> *new html::DefListTerm + << new html::ClassAttr("attention") + << i_sText; + } + else + { + CurOut() + >> *new html::DefListTerm + << i_sText; + } +} + +void +Docu_Display::Write_TagContents( const DocuText & i_rDocuText ) +{ + DefListDefinition * dpDef = new DefListDefinition; + CurOut() << dpDef; + + Easy().Enter(*dpDef); + Write_Text(i_rDocuText); + Easy().Leave(); +} + +void +Docu_Display::Write_Text( const ary::info::DocuText & i_rDocuText ) +{ + if ( i_rDocuText.IsNoHtml() ) + { + CurOut() + << new xml::XmlCode("<pre>"); + bUseHtmlInDocuTokens = false; + } + else + { + bUseHtmlInDocuTokens = true; + } + i_rDocuText.StoreAt( *this ); + if ( i_rDocuText.IsNoHtml() ) + { + CurOut() + << new xml::XmlCode("</pre>"); + } +} + +void +Docu_Display::Write_TextToken( const String & i_sText ) +{ + if ( bUseHtmlInDocuTokens ) + CurOut() << new xml::XmlCode(i_sText); + else + CurOut() << i_sText; +} + +void +Docu_Display::Write_LinkableText( const ary::QualifiedName & i_sQuName ) +{ + const ary::cpp::CodeEntity * + pCe = FindUnambiguousCe( Env(), i_sQuName, pCurClassOverwrite ); + if ( pCe != 0 ) + { + csi::xml::Element * + pLink = new csi::html::Link( Link2Ce(Env(), *pCe) ); + CurOut() << pLink; + Easy().Enter(*pLink); + Write_QualifiedName(i_sQuName); + Easy().Leave(); + } + else + { + Write_QualifiedName(i_sQuName); + } + CurOut() << " "; +} + +void +Docu_Display::Write_QualifiedName( const ary::QualifiedName & i_sQuName ) +{ + if ( i_sQuName.IsAbsolute() ) + CurOut() << "::"; + for ( ary::QualifiedName::namespace_iterator it = i_sQuName.first_namespace(); + it != i_sQuName.end_namespace(); + ++it ) + { + CurOut() << (*it) << "::"; + } + CurOut() << i_sQuName.LocalName(); + if ( i_sQuName.IsFunction() ) + CurOut() << "()"; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/hd_docu.hxx b/autodoc/source/display/html/hd_docu.hxx new file mode 100644 index 000000000000..1eb00ae1c449 --- /dev/null +++ b/autodoc/source/display/html/hd_docu.hxx @@ -0,0 +1,199 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_HD_DOCU_HXX +#define ADC_DISPLAY_HTML_HD_DOCU_HXX + +// BASE CLASSES +#include <ary/ary_disp.hxx> +#include <ary/info/infodisp.hxx> +#include <cosv/tpl/processor.hxx> +#include "hdimpl.hxx" + +namespace ary +{ + namespace cpp + { + class Namespace; + class Class; + class Enum; + class Typedef; + class Function; + class Variable; + } + + namespace doc + { + class Documentation; + } + namespace info + { + class DocuText; + } + + class QualifiedName; +} + +class OuputPage_Environment; + + +class Docu_Display : public ary::Display, + public csv::ConstProcessor<ary::cpp::Namespace>, + public csv::ConstProcessor<ary::cpp::Class>, + public csv::ConstProcessor<ary::cpp::Enum>, + public csv::ConstProcessor<ary::cpp::Typedef>, + public csv::ConstProcessor<ary::cpp::Function>, + public csv::ConstProcessor<ary::cpp::Variable>, + public csv::ConstProcessor<ary::doc::Documentation>, + public ary::info::DocuDisplay, + private HtmlDisplay_Impl +{ + public: + Docu_Display( + OuputPage_Environment & + io_rEnv ); + virtual ~Docu_Display(); + + void Assign_Out( + csi::xml::Element & o_rOut ); + void Unassign_Out(); + + virtual void Display_StdTag( + const ary::info::StdTag & + i_rData ); + virtual void Display_BaseTag( + const ary::info::BaseTag & + i_rData ); + virtual void Display_ExceptionTag( + const ary::info::ExceptionTag & + i_rData ); + virtual void Display_ImplementsTag( + const ary::info::ImplementsTag & + i_rData ); + virtual void Display_KeywordTag( + const ary::info::KeywordTag & + i_rData ); + virtual void Display_ParameterTag( + const ary::info::ParameterTag & + i_rData ); + virtual void Display_SeeTag( + const ary::info::SeeTag & + i_rData ); + virtual void Display_TemplateTag( + const ary::info::TemplateTag & + i_rData ); + virtual void Display_LabelTag( + const ary::info::LabelTag & + i_rData ); + virtual void Display_SinceTag( + const ary::info::SinceTag & + i_rData ); + + virtual void Display_DT_Text( + const ary::info::DT_Text & + i_rData ); + virtual void Display_DT_MaybeLink( + const ary::info::DT_MaybeLink & + i_rData ); + virtual void Display_DT_Whitespace( + const ary::info::DT_Whitespace & + i_rData ); + virtual void Display_DT_Eol( + const ary::info::DT_Eol & + i_rData ); + virtual void Display_DT_Xml( + const ary::info::DT_Xml & + i_rData ); + + using csv::ConstProcessor<ary::doc::Documentation>::Process; + + private: + // Interface csv::ConstProcessor<>: + virtual void do_Process( + const ary::cpp::Namespace & + i_rData ); + virtual void do_Process( + const ary::cpp::Class & + i_rData ); + virtual void do_Process( + const ary::cpp::Enum & + i_rData ); + virtual void do_Process( + const ary::cpp::Typedef & + i_rData ); + virtual void do_Process( + const ary::cpp::Function & + i_rData ); + virtual void do_Process( + const ary::cpp::Variable & + i_rData ); + virtual void do_Process( + const ary::doc::Documentation & + i_rData ); + // Interface ary::Display: + virtual const ary::cpp::Gate * + inq_Get_ReFinder() const; + // Locals + void Start_DocuBlock(); + void Finish_DocuBlock(); + + void Write_TagTitle( + const char * i_sText, + const char * i_nFontSize = "+0" ); + void Write_TagContents( + const ary::info::DocuText & + i_rDocuText ); + void Write_Text( + const ary::info::DocuText & + i_rDocuText ); + void Write_TextToken( + const String & i_sText ); + void Write_LinkableText( + const ary::QualifiedName & + i_sQuName ); + void Write_QualifiedName( + const ary::QualifiedName & + i_sQuName ); + + // DATA + bool bUseHtmlInDocuTokens; + + /** This is used, if a class documentation is displayed, + because for links to members then the "current class" + is not the parent, but this class itself. + */ + const ary::cpp::Class * + pCurClassOverwrite; +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/hdimpl.cxx b/autodoc/source/display/html/hdimpl.cxx new file mode 100644 index 000000000000..f9d2b0f1636a --- /dev/null +++ b/autodoc/source/display/html/hdimpl.cxx @@ -0,0 +1,549 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "hdimpl.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <stdlib.h> +#include <stdio.h> +#include <ary/ceslot.hxx> +#include <ary/qualiname.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_de.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <udm/html/htmlitem.hxx> +#include "cre_link.hxx" +#include "hd_docu.hxx" +#include "html_kit.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" +#include "strconst.hxx" + + +using namespace csi; + + +//******************** HtmlDisplay_Impl *********************// + +HtmlDisplay_Impl::~HtmlDisplay_Impl() +{ +} + +HtmlDisplay_Impl::HtmlDisplay_Impl( OuputPage_Environment & io_rEnv ) + : pEnv(&io_rEnv) + // aWriteHelper +{ +} + + +//******************** Free Functions *********************// + + + +namespace dshelp +{ + +void +DisplaySlot( ary::Display & o_rDisplay, + const ary::AryGroup & i_rGroup, + ary::SlotAccessId i_nSlot ) +{ + ary::Slot_AutoPtr pSlot( i_rGroup.Create_Slot(i_nSlot) ); + pSlot->StoreAt( o_rDisplay ); +} + + +const char * +PathUp( uintt i_nLevels ) +{ + static char sResult[300]; + + sResult[0] = NULCH; + for ( uintt lev = 0; lev < i_nLevels; ++lev ) + { + strcat( sResult, "../"); // SAFE STRCAT (#100211# - checked) + } + return sResult; +} + +const char * +PathPerLevelsUp( uintt i_nLevels, + const char * i_nPathBelowDestinationLevel ) +{ + static char sResult[500]; + strcpy( sResult, PathUp(i_nLevels) ); // SAFE STRCPY (#100211# - checked) + // KORR_FUTURE: Make it still safer here: + strcat( sResult, i_nPathBelowDestinationLevel ); // SAFE STRCAT (#100211# - checked) + return sResult; +} + + +const char * +PathPerRoot( const OuputPage_Environment & i_rEnv, + const char * i_sPathFromRootDir ) +{ + return PathPerLevelsUp( i_rEnv.Depth(), i_sPathFromRootDir ); +} + +const char * +PathPerNamespace( const OuputPage_Environment & i_rEnv, + const char * i_sPathFromNamespaceDir ) +{ + const ary::cpp::Namespace * pNsp = i_rEnv.CurNamespace(); + if ( pNsp == 0 ) + return ""; + + uintt nCount = i_rEnv.Depth() - (pNsp->Depth() + 1) ; + csv_assert( nCount < 100 ); + return PathPerLevelsUp( nCount, i_sPathFromNamespaceDir ); +} + +const char * +HtmlFileName( const char * i_sPrefix, + const char * i_sEntityName ) +{ + // KORR_FUTURE: Make it still safer here: + static char sResult[300]; + strcpy( sResult, i_sPrefix ); // SAFE STRCPY (#100211# - checked) + strcat( sResult, i_sEntityName ); // SAFE STRCAT (#100211# - checked) + strcat( sResult, ".html" ); // SAFE STRCAT (#100211# - checked) + return sResult; +} + +const char * +Path2Class( uintt i_nLevelsUp, + const char * i_sClassLocalName ) +{ + return PathPerLevelsUp( i_nLevelsUp, ClassFileName(i_sClassLocalName) ); +} + +const char * +Path2Child( const char * i_sFileName, + const char * i_sSubDir ) +{ + static char sResult[400]; + if ( i_sSubDir != 0 ) + { + // KORR_FUTURE: Make it still safer here: + strcpy( sResult, i_sSubDir ); // SAFE STRCPY (#100211# - checked) + strcat( sResult, "/" ); // SAFE STRCAT (#100211# - checked) + } + else + { + sResult[0] = NULCH; + } + + strcat( sResult, i_sFileName ); // SAFE STRCAT (#100211# - checked) + return sResult; +} + +const char * +Path2ChildNamespace( const char * i_sLocalName ) +{ + return Path2Child( C_sHFN_Namespace, i_sLocalName ); +} + +String +OperationLink( const ary::cpp::Gate & , + const String & i_sOpName, + ary::cpp::Ce_id i_nOpId, + const char * i_sPrePath ) +{ + StreamLock + slResult(3000); + StreamStr & + sResult = slResult(); + + sResult + << i_sPrePath + << "#" + << i_sOpName + << "-" + << i_nOpId.Value(); + + + + return sResult.c_str(); +} + +const char * +DataLink( const String & i_sLocalName, + const char * i_sPrePath ) +{ + StreamLock + slResult(3000); + StreamStr & + sResult = slResult(); + + sResult + << i_sPrePath + << "#" + << i_sLocalName; + + return sResult.c_str(); +} + +void +Get_LinkedTypeText( csi::xml::Element & o_rOut, + const OuputPage_Environment & i_rEnv, + ary::cpp::Type_id i_nId, + bool i_bWithAbsolutifier ) +{ + if (NOT i_nId.IsValid()) + return; + + const char * sPreName = ""; + const char * sName = ""; + const char * sPostName = ""; + + bool bTypeExists = Get_TypeText( sPreName, + sName, + sPostName, + i_nId, + i_rEnv.Gate() ); + if ( NOT bTypeExists ) + return; + + if ( NOT i_bWithAbsolutifier AND strncmp(sPreName,"::",2) == 0 ) + sPreName+=2; + + const ary::cpp::CodeEntity * + pCe = i_rEnv.Gate().Search_RelatedCe(i_nId); + + String sLink; + if ( pCe != 0 ) + { + sLink = Link2Ce(i_rEnv,*pCe); + } + else + { + if ( strstr(sPreName,"com::sun::star") != 0 ) + { + static StreamStr aLink(400); + aLink.seekp(0); + aLink << PathPerRoot(i_rEnv, "../../common/ref"); + if ( *sPreName != ':' ) + aLink << '/'; + for ( const char * s = sPreName; + *s != 0; + ++s ) + { + if ( *s == ':' ) + { + aLink << '/'; + ++s; + } + else + { + aLink << *s; + } + } // end for + aLink << sName + << ".html"; + sLink = aLink.c_str(); + } + } // endif( pCe != 0 ) + + o_rOut + << sPreName; + csi::xml::Element & + o_Goon = sLink.length() > 0 + ? o_rOut >> * new html::Link( sLink.c_str() ) + : o_rOut; + o_Goon + << sName; + o_rOut + << sPostName; +} + +void +Create_ChildListLabel( csi::xml::Element & o_rParentElement, + const char * i_sLabel ) +{ + if ( NOT csv::no_str(i_sLabel) ) + { + o_rParentElement + >> *new html::Label(i_sLabel) + << " "; + } +} + +DYN csi::html::Table & +Create_ChildListTable( const char * i_sTitle ) +{ + html::Table * + dpTable = new html::Table; + *dpTable + << new html::ClassAttr( "childlist") + << new xml::AnAttribute( "border", "1" ) + << new xml::AnAttribute( "cellpadding", "5" ) + << new xml::AnAttribute( "cellspacing", "0" ) + << new html::WidthAttr( "100%" ); + + html::TableRow & + rRow = dpTable->AddRow(); + rRow + << new html::ClassAttr("subtitle") + >> *new html::TableCell + << new xml::AnAttribute( "colspan","2" ) + >> *new html::Headline(4) + << i_sTitle; + return *dpTable; +} + +const char * +Link2Ce( const OuputPage_Environment & i_rEnv, + const ary::cpp::CodeEntity & i_rCe ) +{ + const uintt nMaxSize + = 3000; + static char sLink[nMaxSize]; + static LinkCreator aLinkCreator( &sLink[0], nMaxSize ); + sLink[0] = NULCH; + + aLinkCreator.SetEnv(i_rEnv); + i_rCe.Accept(aLinkCreator); + + return sLink; +} + +const char * +Link2CppDefinition( const OuputPage_Environment & i_rEnv, + const ary::cpp::DefineEntity & i_rDef ) +{ + const uintt nMaxSize + = 1000; + static char sLink[nMaxSize]; + static LinkCreator aLinkCreator( &sLink[0], nMaxSize ); + sLink[0] = NULCH; + + aLinkCreator.SetEnv(i_rEnv); + i_rDef.Accept(aLinkCreator); + + return sLink; +} + +const ary::cpp::CodeEntity * +FindUnambiguousCe( const OuputPage_Environment & i_rEnv, + const ary::QualifiedName & i_rQuName, + const ary::cpp::Class * i_pJustDocumentedClass ) +{ + if ( i_rEnv.CurNamespace() == 0 ) + return 0; + + const ary::cpp::CodeEntity * ret = 0; + + if ( NOT i_rQuName.IsQualified() ) + { + if ( i_pJustDocumentedClass != 0 ) + ret = i_rEnv.Gate().Ces().Search_CeLocal( i_rQuName.LocalName(), + i_rQuName.IsFunction(), + *i_rEnv.CurNamespace(), + i_pJustDocumentedClass ); + if (ret != 0) + return ret; + + ret = i_rEnv.Gate().Ces().Search_CeLocal( i_rQuName.LocalName(), + i_rQuName.IsFunction(), + *i_rEnv.CurNamespace(), + i_rEnv.CurClass() ); + } + if (ret != 0) + return ret; + + return i_rEnv.Gate().Ces().Search_CeAbsolute( *i_rEnv.CurNamespace(), + i_rQuName ); +} + +void +ShowDocu_On( csi::xml::Element & o_rOut, + Docu_Display & io_rDisplay, + const ary::cpp::CppEntity & i_rRE ) +{ + if (i_rRE.Docu().Data() != 0) + { + io_rDisplay.Assign_Out( o_rOut ); + io_rDisplay.Process(i_rRE.Docu()); + io_rDisplay.Unassign_Out(); + } +} + +void +WriteOut_TokenList( csi::xml::Element & o_rOut, + const StringVector & i_rTokens, + const char * i_sSeparator ) +{ + if ( i_rTokens.size() > 0 ) + { + StringVector::const_iterator + it = i_rTokens.begin(); + StringVector::const_iterator + itEnd = i_rTokens.end(); + + o_rOut << *it; + for ( ++it; it != itEnd; ++it ) + { + o_rOut << i_sSeparator << *it; + } + }; + +} + +void +EraseLeadingSpace( String & io_rStr ) +{ + if ( *io_rStr.c_str() < 33 AND io_rStr.length() > 0 ) + { + const unsigned char * pNew; + for ( pNew = (const unsigned char * ) io_rStr.c_str(); + *pNew < 33 AND *pNew != 0; + ++pNew ) {} + String sNew( (const char*)pNew ); + io_rStr = sNew; + } +} + +void +WriteOut_LinkedFunctionText( csi::xml::Element & o_rTitleOut, + adcdisp::ParameterTable & o_rParameters, + const ary::cpp::Function & i_rFunction, + const OuputPage_Environment & i_rEnv, + bool * o_bIsConst, + bool * o_bIsVirtual ) +{ + // write pre-name: + const ary::cpp::FunctionFlags & rFlags = i_rFunction.Flags(); + if ( rFlags.IsStaticLocal() OR rFlags.IsStaticMember() ) + o_rTitleOut << "static "; + if ( rFlags.IsExplicit() ) + o_rTitleOut << "explicit "; + if ( rFlags.IsMutable() ) + o_rTitleOut << "mutable "; + if ( i_rFunction.Virtuality() != ary::cpp::VIRTUAL_none ) + o_rTitleOut << "virtual "; +// o_rTitleOut << new html::LineBreak; + + Get_LinkedTypeText( o_rTitleOut, i_rEnv, i_rFunction.ReturnType() ); + + // write name: + o_rTitleOut + << " " + >> *new html::Strong + << i_rFunction.LocalName(); + o_rTitleOut + << "("; + + + csi::xml::Element * pOutLast = &o_rTitleOut; + + // write post-name: + FunctionParam_Iterator fit; + fit.Assign(i_rFunction); + + if (fit) + { + o_rParameters.AddEntry(); + Get_LinkedTypeText( o_rParameters.Type(), i_rEnv, fit.CurType() ); + o_rParameters.Type() << " "; + o_rParameters.Name() << " " << fit.CurName(); + + for ( ++fit; fit; ++fit ) + { + o_rParameters.Name() << ","; + o_rParameters.AddEntry(); + Get_LinkedTypeText( o_rParameters.Type(), i_rEnv, fit.CurType() ); + o_rParameters.Name() << fit.CurName(); + } + + pOutLast = &o_rParameters.Name(); + o_rParameters.Name() << " "; + } + + *pOutLast << ")"; + if ( fit.IsFunctionConst() ) + { + *pOutLast << " const"; + if ( o_bIsConst != 0 ) + *o_bIsConst = true; + } + if ( fit.IsFunctionVolatile() ) + { + *pOutLast << " volatile"; + if ( o_bIsVirtual != 0 ) + *o_bIsVirtual = true; + } + + // write Exceptions: + const std::vector< ary::cpp::Type_id > * + pThrow = i_rFunction.Exceptions(); + if ( pThrow) + { + std::vector< ary::cpp::Type_id >::const_iterator + it = pThrow->begin(); + std::vector< ary::cpp::Type_id >::const_iterator + it_end = pThrow->end(); + + if (it != it_end) + { + o_rParameters.AddEntry(); + pOutLast = &o_rParameters.Name(); + + o_rParameters.Name() << " throw( "; + Get_LinkedTypeText(o_rParameters.Name(), i_rEnv, *it); + + for ( ++it; it != it_end; ++it ) + { + o_rParameters.Name() << ", "; + Get_LinkedTypeText(o_rParameters.Name(), i_rEnv, *it); + } + o_rParameters.Name() << " )"; + } + else + { + *pOutLast << " throw()"; + } + } // endif // pThrow + + // abstractness: + if ( i_rFunction.Virtuality() == ary::cpp::VIRTUAL_abstract ) + *pOutLast << " = 0"; + + // finish: + *pOutLast << ";"; +} + + + +} // namespace dshelp + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/hdimpl.hxx b/autodoc/source/display/html/hdimpl.hxx new file mode 100644 index 000000000000..6caf652d499f --- /dev/null +++ b/autodoc/source/display/html/hdimpl.hxx @@ -0,0 +1,250 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HDIMPL_HXX +#define ADC_DISPLAY_HDIMPL_HXX + +// BASE CLASSES +#include <udm/html/htmlitem.hxx> +// USED SERVICES +#include "easywri.hxx" +#include <cosv/bstream.hxx> +#include <ary/ary_disp.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_ce.hxx> +#include "aryattrs.hxx" // For compatibility with earlier times, when those funtions were in this header. + + +namespace ary +{ + namespace cpp + { + class CodeEntity; + class Class; + class DisplayGate; + class Function; + class DefineEntity; + class OperationSignature; + } + + class QualifiedName; +} +namespace csi +{ + namespace xml + { + class Element; + } + namespace html + { + class Table; + } +} + +namespace adcdisp +{ + class ParameterTable; +} + +class OuputPage_Environment; +class Docu_Display; + +class HtmlDisplay_Impl +{ + public: + ~HtmlDisplay_Impl(); + + const OuputPage_Environment & + Env() const { return *pEnv; } + + // ACCESS + OuputPage_Environment & + Env() { return *pEnv; } + EasyWriter & Easy() { return aWriteHelper; } + csi::xml::Element & CurOut() { return aWriteHelper.Out(); } + + protected: + HtmlDisplay_Impl( + OuputPage_Environment & + io_rEnv ); + private: + // DATA + OuputPage_Environment * + pEnv; + EasyWriter aWriteHelper; +}; + + +namespace dshelp +{ + +void DisplaySlot( + ary::Display & o_rDisplay, + const ary::AryGroup & + i_rGroup, + ary::SlotAccessId i_nSlot ); + + +const char * PathUp( + uintt i_nLevels ); +const char * PathPerLevelsUp( + uintt i_nLevels, + const char * i_nPathBelowDestinationLevel ); + +const char * PathPerRoot( + const OuputPage_Environment & + i_rEnv, + const char * i_sPathFromRootDir ); +const char * PathPerNamespace( + const OuputPage_Environment & + i_rEnv, + const char * i_sPathFromNamespaceDir ); + +void Create_ChildListLabel( + csi::xml::Element & o_rParentElement, + const char * i_sLabel ); +DYN csi::html::Table & + Create_ChildListTable( + const char * i_sTitle ); + +const char * HtmlFileName( + const char * i_sPrefix, + const char * i_sEntityName ); + +inline const char * +ClassFileName( const char * i_sClassLocalName ) + { return HtmlFileName( "c-", i_sClassLocalName); } +inline const char * +EnumFileName( const char * i_sEnumLocalName ) + { return HtmlFileName( "e-", i_sEnumLocalName); } +inline const char * +TypedefFileName( const char * i_sTypedefLocalName ) + { return HtmlFileName( "t-", i_sTypedefLocalName); } +inline const char * +FileFileName( const char * i_sFileLocalName ) + { return HtmlFileName( "f-", i_sFileLocalName); } + +const char * Path2Class( + uintt i_nLevelsUp, + const char * i_sClassLocalName ); + +const char * Path2Child( + const char * i_sFileName, + const char * i_sSubDir = 0 ); + +const char * Path2ChildNamespace( + const char * i_sLocalName ); + +String OperationLink( + const ary::cpp::Gate & i_gate, + const String & i_sOpName, + ary::cpp::Ce_id i_nOpId, + const char * i_sPrePath = "" ); +const char * DataLink( + const String & i_sLocalName, + const char * i_sPrePath = "" ); + +inline String +OperationLabel( const String & i_sOpName, + ary::cpp::Ce_id i_nOpId, + const ary::cpp::Gate & i_gate ) + { return String(OperationLink(i_gate, i_sOpName, i_nOpId) + 1); } // Skip '#' in front. +inline const char * +DataLabel( const String & i_sLocalName ) + { return DataLink(i_sLocalName) + 1; } // Skip '#' in front. + + +void Get_LinkedTypeText( + csi::xml::Element & o_rOut, + const OuputPage_Environment & + i_rEnv, + ary::cpp::Type_id i_nId, + bool i_bWithAbsolutifier = true ); + + +const char * Link2Ce( + const OuputPage_Environment & + i_rEnv, + const ary::cpp::CodeEntity & + i_rCe ); + +const char * Link2CppDefinition( + const OuputPage_Environment & + i_rEnv, + const ary::cpp::DefineEntity & + i_rDef ); + +const ary::cpp::CodeEntity * + FindUnambiguousCe( + const OuputPage_Environment & + i_rEnv, + const ary::QualifiedName & + i_rQuName, + const ary::cpp::Class * i_pJustDocumentedClass ); + +void ShowDocu_On( + csi::xml::Element & o_rOut, + Docu_Display & io_rDisplay, + const ary::cpp::CppEntity & + i_rRE ); + +void WriteOut_TokenList( + csi::xml::Element & o_rOut, + const StringVector & i_rTokens, + const char * i_sSeparator ); + +void EraseLeadingSpace( + String & io_rStr ); + +/** @param o_bIsConst + *o_bIsConst will be set to true, if o_bIsConst != 0 and function is const. + If the function is not const, *o_bIsConst remains unchanged! + + @param o_bIsVirtual + The same as o_bIsConst. +*/ +void WriteOut_LinkedFunctionText( + csi::xml::Element & o_rTitleOut, + adcdisp::ParameterTable & + o_rParameters, + const ary::cpp::Function & + i_rFunction, + const OuputPage_Environment & + i_rEnv, + bool * o_bIsConst = 0, + bool * o_bIsVirtual = 0 ); + + + +} // namespace dshelp + +using namespace dshelp; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/html_kit.cxx b/autodoc/source/display/html/html_kit.cxx new file mode 100644 index 000000000000..32ab5252a00c --- /dev/null +++ b/autodoc/source/display/html/html_kit.cxx @@ -0,0 +1,307 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "html_kit.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <stdio.h> +#include <ary/cpp/c_slntry.hxx> +#include "hdimpl.hxx" + + +namespace adcdisp +{ + + +using namespace csi::xml; +using namespace csi::html; + + +void +PageTitle_Left::operator()( XmlElement & o_rOwner, + const char * i_sTypeTitle, + const String & i_sLocalName ) +{ + o_rOwner + >> *new Headline(2) + << i_sTypeTitle + << " " + << i_sLocalName; +} + +void +PageTitle_Std::operator()( XmlElement & o_rOwner, + const char * i_sTypeTitle, + const String & i_sLocalName ) +{ + o_rOwner + >> *new AnElement("div") + << new ClassAttr("title") + >> *new Headline(2) + << i_sTypeTitle + << " " + << i_sLocalName; +} + +XmlElement & +PageTitle_Std::operator()( XmlElement & o_rOwner ) +{ + XmlElement & ret = + o_rOwner + >> *new AnElement("div") + << new ClassAttr("title") + >> *new Headline(2); + return ret; +} + +void +OperationTitle::operator()( XmlElement & o_owner, + const char * i_itemName, + ary::cpp::Ce_id i_id, + const ::ary::cpp::Gate & i_gate ) +{ + o_owner + >> *new Label( OperationLabel(i_itemName, i_id, i_gate) ) + << " "; + o_owner + << i_itemName; +} + + +void +TemplateClause::operator()( XmlElement & o_rOwner, + const List_TplParams & i_rTplParams ) +{ + if ( i_rTplParams.size() == 0 ) + return; + + Element & rOut = + o_rOwner + << new LineBreak + >> *new Paragraph + >> *new Strong + << "template< "; + + List_TplParams::const_iterator + it = i_rTplParams.begin(); + List_TplParams::const_iterator + itEnd = i_rTplParams.end(); + + rOut + << (*it).Name(); + for ( ++it; it != itEnd; ++it ) + { + rOut + << ", " + << (*it).Name(); + } // end for + rOut << " >"; +} + +ExplanationList::ExplanationList( XmlElement & o_rOwner, + bool i_bMemberStyle ) + : pList( new DefList), + pTerm(0), + pDefinition(0), + bMemberStyle(i_bMemberStyle) +{ + if (bMemberStyle) + *pList << new ClassAttr("member"); + + o_rOwner << pList; +} + +void +ExplanationList::AddEntry( const char * i_sTerm, + const char * i_sDifferentClass ) +{ + DefListTerm & rNewTerm = pList->AddTerm(); + if ( i_sDifferentClass != 0 ) + { + rNewTerm << new ClassAttr(i_sDifferentClass); + } + else if (bMemberStyle) + { + rNewTerm << new ClassAttr("member"); + } + if ( i_sTerm != 0 ) + rNewTerm << i_sTerm; + + pTerm = &rNewTerm; + pDefinition = &pList->AddDefinition(); + if (bMemberStyle) + *pDefinition << new ClassAttr("member"); +} + +void +ExplanationList::AddEntry_NoTerm() +{ + pTerm = 0; + pDefinition = &pList->AddDefinition(); + if (bMemberStyle) + *pDefinition << new ClassAttr("member"); +} + +ExplanationTable::ExplanationTable( XmlElement & o_rOwner ) + : pTable(0), + pTerm(0), + pDefinition(0) +{ + pTable = new Table("0", "100%", "3", "0"); + *pTable << new AnAttribute("class", "expl-table"); + o_rOwner << pTable; +} + +void +ExplanationTable::AddEntry( const char * i_sTerm, + const char * i_sDifferentStyle ) +{ + TableRow & + rNewRow = pTable->AddRow(); + TableCell & + rNewTerm = rNewRow.AddCell(); + TableCell & + rNewDefinition = rNewRow.AddCell(); + + if ( i_sDifferentStyle == 0 ) + { + rNewTerm << new WidthAttr("15%") + << new StyleAttr("vertical-align:top; font-weight:bold"); + } + else + { + rNewTerm << new StyleAttr(i_sDifferentStyle); + } + if ( i_sTerm != 0 ) + rNewTerm << i_sTerm; + + pTerm = &rNewTerm; + pDefinition = & (rNewDefinition >> *new APureElement("pre")); +} + +ParameterTable::ParameterTable( XmlElement & o_rOwner ) + : pTable(0), + pTerm(0), + pDefinition(0) +{ + pTable = new Table; + *pTable << new AnAttribute("class", "param-table"); + o_rOwner << pTable; +} + +void +ParameterTable::AddEntry() +{ + TableRow & + rNewRow = pTable->AddRow(); + TableCell & + rNewTerm = rNewRow.AddCell(); + TableCell & + rNewDefinition = rNewRow.AddCell(); + + pTerm = &rNewTerm; + pDefinition = &rNewDefinition; +} + +FlagTable::FlagTable( XmlElement & o_rOwner, + uintt i_nNrOfColumns ) +{ + pTable = new Table; + *pTable << new AnAttribute("class", "flag-table"); + *pTable << new AnAttribute("border", "1"); + *pTable << new AnAttribute("cellspacing", "0"); + o_rOwner << pTable; + + TableRow & rRow1 = pTable->AddRow(); + TableRow & rRow2 = pTable->AddRow(); + + for ( uintt c = 0; c < i_nNrOfColumns; ++c ) + { + TableCell & rCell1 = rRow1.AddCell(); + int nWidth = 100 / i_nNrOfColumns; + static char sWidth[20]; + sprintf( sWidth, "%d%%", nWidth ); // SAFE SPRINTF (#100211# - checked) + + rCell1 + << new WidthAttr( sWidth ) + << new ClassAttr( "flagname" ); + TableCell & rCell2 = rRow2.AddCell(); + aCells.push_back( CellPair(&rCell1, &rCell2) ); + } // end for +} + +void +FlagTable::SetColumn( uintt i_nColumnPosition, + const char * i_sColumnName, + bool i_bValue ) +{ + csv_assert( i_nColumnPosition < aCells.size() ); + + TableCell & + rCell1 = *aCells[i_nColumnPosition].first; + TableCell & + rCell2 = *aCells[i_nColumnPosition].second; + rCell1 + << i_sColumnName; + if (i_bValue) + { + rCell2 + << new ClassAttr("flagyes") + << "YES"; + } + else // + { + rCell2 + << new ClassAttr("flagno") + << "NO"; + } // endif +} + +IndexList::IndexList( XmlElement & o_rOwner ) + : pList( new DefList ), + pTerm(0), + pDefinition(0) +{ + o_rOwner << pList; +} + +void +IndexList::AddEntry() +{ + pTerm = &pList->AddTerm(); + pDefinition = &pList->AddDefinition(); +} + + +} // namespace adcdisp + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/html_kit.hxx b/autodoc/source/display/html/html_kit.hxx new file mode 100644 index 000000000000..35aba2887cdb --- /dev/null +++ b/autodoc/source/display/html/html_kit.hxx @@ -0,0 +1,201 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_KIT_HXX +#define ADC_DISPLAY_HTML_KIT_HXX + +// BASE CLASSES +#include <udm/xml/xmlitem.hxx> +#include <udm/html/htmlitem.hxx> +// USED SERVICES +#include <ary/cpp/c_types4cpp.hxx> + +namespace ary +{ + namespace cpp + { + struct S_TplParam; + class OperationSignature; + class Gate; + } +} + + + + +namespace adcdisp +{ + +typedef csi::xml::Element XmlElement; + +class PageTitle_Left +{ + public: + void operator()( + XmlElement & o_rOwner, + const char * i_sTypeTitle, + const String & i_sLocalName ); +}; + +class PageTitle_Std +{ + public: + void operator()( + XmlElement & o_rOwner, + const char * i_sTypeTitle, + const String & i_sLocalName ); + XmlElement & operator()( + XmlElement & o_rOwner ); +}; + +class OperationTitle +{ + public: + void operator()( + XmlElement & o_rOwner, + const char * i_sItemName, + ary::cpp::Ce_id i_nId, + const ::ary::cpp::Gate & + i_gate ); +}; + + +class TemplateClause +{ + public: + typedef std::vector< ary::cpp::S_TplParam> List_TplParams; + + void operator()( + XmlElement & o_rOwner, + const List_TplParams & + i_rTplParams ); +}; + + +class ExplanationList +{ + public: + ExplanationList( + XmlElement & o_rOwner, + bool i_bMemberStyle = false ); + + void AddEntry( + const char * i_sTerm = 0, + const char * i_sDifferentClass = 0 ); + void AddEntry_NoTerm(); + + XmlElement & Term() { return *pTerm; } + XmlElement & Def() { return *pDefinition; } + + private: + csi::html::DefList* pList; + XmlElement * pTerm; + XmlElement * pDefinition; + bool bMemberStyle; +}; + +class ExplanationTable +{ + public: + ExplanationTable( + XmlElement & o_rOwner ); + + void AddEntry( + const char * i_sTerm = 0, + const char * i_sDifferentStyle = 0 ); + + XmlElement & Term() { return *pTerm; } + XmlElement & Def() { return *pDefinition; } + + private: + csi::html::Table* pTable; + XmlElement * pTerm; + XmlElement * pDefinition; +}; + +class ParameterTable +{ + public: + ParameterTable( + XmlElement & o_rOwner ); + + void AddEntry(); + + XmlElement & Type() { return *pTerm; } + XmlElement & Name() { return *pDefinition; } + + private: + csi::html::Table* pTable; + XmlElement * pTerm; + XmlElement * pDefinition; +}; + +class FlagTable +{ + public: + FlagTable( + XmlElement & o_rOwner, + uintt i_nNrOfColumns ); + + void SetColumn( + uintt i_nColumnPosition, /// Starting with 0. + const char * i_sColumnName, + bool i_bValue ); /// "YES" or "NO" + private: + typedef std::pair< csi::html::TableCell*, csi::html::TableCell* > CellPair; + + // DATA + csi::html::Table* pTable; + std::vector<CellPair> + aCells; +}; + +class IndexList +{ + public: + IndexList( + XmlElement & o_rOwner ); + + void AddEntry(); + + XmlElement & Term() { return *pTerm; } + XmlElement & Def() { return *pDefinition; } + + private: + csi::html::DefList* pList; + XmlElement * pTerm; + XmlElement * pDefinition; +}; + + + + +} // namespace adcdisp +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/makefile.mk b/autodoc/source/display/html/makefile.mk new file mode 100644 index 000000000000..58046760ebd7 --- /dev/null +++ b/autodoc/source/display/html/makefile.mk @@ -0,0 +1,78 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org 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 version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=autodoc +TARGET=display_html + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/aryattrs.obj \ + $(OBJ)$/cfrstd.obj \ + $(OBJ)$/chd_udk2.obj \ + $(OBJ)$/cre_link.obj \ + $(OBJ)$/dsply_cl.obj \ + $(OBJ)$/dsply_da.obj \ + $(OBJ)$/dsply_op.obj \ + $(OBJ)$/easywri.obj \ + $(OBJ)$/hd_chlst.obj \ + $(OBJ)$/hd_docu.obj \ + $(OBJ)$/hdimpl.obj \ + $(OBJ)$/html_kit.obj \ + $(OBJ)$/nav_main.obj \ + $(OBJ)$/navibar.obj \ + $(OBJ)$/outfile.obj \ + $(OBJ)$/opageenv.obj \ + $(OBJ)$/pagemake.obj \ + $(OBJ)$/pm_aldef.obj \ + $(OBJ)$/pm_base.obj \ + $(OBJ)$/pm_class.obj \ + $(OBJ)$/pm_help.obj \ + $(OBJ)$/pm_index.obj \ + $(OBJ)$/pm_namsp.obj \ + $(OBJ)$/pm_start.obj \ + $(OBJ)$/protarea.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/display/html/nav_main.cxx b/autodoc/source/display/html/nav_main.cxx new file mode 100644 index 000000000000..781636fc9844 --- /dev/null +++ b/autodoc/source/display/html/nav_main.cxx @@ -0,0 +1,379 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "nav_main.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/cpp/c_ce.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/loc/loc_file.hxx> +#include <udm/html/htmlitem.hxx> +#include "hdimpl.hxx" +#include "opageenv.hxx" +#include "strconst.hxx" + + +using namespace ::csi::html; +using namespace ::csi::xml; + + +const String sOverview("Overview"); +const String sNamespace("Namespace"); +const String sClass("Class"); +const String sTree("Tree"); +const String sProject("Project"); +const String sFile("File"); +const String sIndex("Index"); +const String sHelp("Help"); + + + +//******************** MainItem and derived ones ***************// +class MainItem +{ + public: + virtual ~MainItem() {} + void Write2( + TableRow & o_rOut ); + private: + virtual void do_Write2( + TableRow & o_rOut ) = 0; +}; + +inline void +MainItem::Write2( TableRow & o_rOut ) + { do_Write2(o_rOut); } + + +namespace +{ + +class MainRowItem : public MainItem +{ + public: + MainRowItem( + const String & i_sText, + const char * i_sLink, + const char * i_sTip ); + ~MainRowItem(); + private: + enum E_Style { eSelf, eNo, eStd }; + + virtual void do_Write2( + TableRow & o_rOut ); + String sText; + String sLink; + String sTip; +}; + +MainRowItem::MainRowItem( const String & i_sText, + const char * i_sLink, + const char * i_sTip ) + : sText(i_sText), + sLink(i_sLink), + sTip(i_sTip) +{ +} + +MainRowItem::~MainRowItem() +{ +} + +void +MainRowItem::do_Write2( TableRow & o_rOut ) +{ + TableCell & rCell = o_rOut.AddCell(); + + rCell + << new ClassAttr( "navimain" ) + << new XmlCode(" ") + >> *new Link(sLink.c_str()) + << sText.c_str(); + rCell + << new XmlCode(" "); +} + + +class SelectedItem : public MainItem +{ + public: + SelectedItem( + const String & i_sText ) + : sText(i_sText) {} + private: + virtual void do_Write2( + TableRow & o_rOut ); + String sText; +}; + +void +SelectedItem::do_Write2( TableRow & o_rOut ) +{ + TableCell & rCell = o_rOut.AddCell(); + + rCell + << new ClassAttr( "navimainself" ) + << new XmlCode(" ") + << sText.c_str() + << new XmlCode(" "); +} + +class UnavailableItem : public MainItem +{ + public: + UnavailableItem( + const String & i_sText ) + : sText(i_sText) {} + private: + virtual void do_Write2( + TableRow & o_rOut ); + String sText; +}; + +void +UnavailableItem::do_Write2( TableRow & o_rOut ) +{ + TableCell & rCell = o_rOut.AddCell(); + + rCell + << new ClassAttr( "navimainnone" ) + << new XmlCode(" ") + << sText.c_str() + << new XmlCode(" "); +} + +} // anonymous namespace + +//************************ MainRow ***************************// + +MainRow::MainRow( const OuputPage_Environment & i_rEnv ) + : // aItems, + pEnv(&i_rEnv) +{ +} + +MainRow::~MainRow() +{ + csv::erase_container_of_heap_ptrs(aItems); +} + +void +MainRow::SetupItems_Overview() +{ + Create_ItemList_Global( eSelf, eStd, eStd ); +} + +void +MainRow::SetupItems_AllDefs() +{ + Create_ItemList_Global( eStd, eStd, eStd ); +} + +void +MainRow::SetupItems_Index() +{ + Create_ItemList_Global( eStd, eSelf, eStd ); +} + +void +MainRow::SetupItems_Help() +{ + Create_ItemList_Global( eStd, eStd, eSelf ); +} + +void +MainRow::SetupItems_Ce( const ary::cpp::CodeEntity & i_rCe ) +{ + csv_assert( pEnv->CurNamespace() != 0 ); + bool bIsNamespace = i_rCe.Id() == pEnv->CurNamespace()->Id(); + bool bHasClass = pEnv->CurClass() != 0; + bool bIsClass = dynamic_cast< const ary::cpp::Class * >(&i_rCe) != 0; + + Create_ItemList_InDirTree_Cpp( + ( bIsNamespace ? eSelf : eStd ), + ( bIsClass ? eSelf : bHasClass ? eStd : eNo ), + eNo, 0 ); +} + +void +MainRow::SetupItems_FunctionGroup() +{ + Create_ItemList_InDirTree_Cpp( + eStd, + (pEnv->CurClass() != 0 ? eStd : eNo), + eNo, 0 ); +} + +void +MainRow::SetupItems_DataGroup() +{ + SetupItems_FunctionGroup(); +} + +void +MainRow::Write2( csi::xml::Element & o_rOut ) const +{ + Table * pTable = new Table; + o_rOut + >> *pTable + << new AnAttribute( "class", "navimain" ) + << new AnAttribute( "border", "0" ) + << new AnAttribute( "cellpadding", "1" ) + << new AnAttribute( "cellspacing", "0" ); + TableRow & rRow = pTable->AddRow(); + rRow + << new AnAttribute( "align", "center" ) + << new AnAttribute( "valign", "top" ); + for ( ItemList::const_iterator it = aItems.begin(); + it != aItems.end(); + ++it ) + { + (*it)->Write2( rRow ); + } +} + +void +MainRow::Create_ItemList_Global( E_Style i_eOverview, + E_Style i_eIndex, + E_Style i_eHelp ) +{ + if ( i_eOverview == eStd ) + { + String sLinkOverview = ( i_eIndex == eSelf + ? dshelp::PathPerLevelsUp( + 1, + C_sHFN_Overview ) + : C_sHFN_Overview ); + Add_Item( i_eOverview, sOverview, sLinkOverview.c_str(), "" ); + } + else + { + Add_Item( i_eOverview, sOverview, "", "" ); + } + + if ( i_eIndex == eSelf ) + Add_Item( eStd, sNamespace, "../names/index.html", "" ); + else + Add_Item( eStd, sNamespace, "names/index.html", "" ); + + Add_Item( eNo, sClass, "", "" ); + + if ( i_eIndex == eStd ) + { + Add_Item( i_eIndex, sIndex, C_sPath_Index, "" ); + } + else + { + Add_Item( i_eIndex, sIndex, "", "" ); + } + + if ( i_eHelp == eStd ) + { + String sLinkHelp = ( i_eIndex == eSelf + ? PathPerLevelsUp(1,C_sHFN_Help) + : C_sHFN_Help ); + Add_Item( i_eHelp, sHelp, sLinkHelp.c_str(), "" ); + } + else + { + Add_Item( i_eHelp, sHelp, "", "" ); + } +} + +void +MainRow::Create_ItemList_InDirTree_Cpp( E_Style i_eNsp, + E_Style i_eClass, + E_Style , + const char * ) +{ + String + sLinkOverview = PathPerRoot(*pEnv, C_sHFN_Overview); + Add_Item( eStd, sOverview, sLinkOverview.c_str(), "" ); + + if (i_eNsp == eStd) + { + String sLinkNamespace = PathPerNamespace(*pEnv, "index.html"); + Add_Item( i_eNsp, sNamespace, sLinkNamespace.c_str(), "" ); + } + else + { + Add_Item( i_eNsp, sNamespace, "", "" ); + } + + if (i_eClass == eStd) + { + csv_assert( pEnv->CurClass() != 0 ); + + StreamLock sLinkClass(300); + sLinkClass() << PathPerNamespace(*pEnv, "c-") + << pEnv->CurClass()->LocalName() + << ".html"; + StreamLock sTipClass(300); + sTipClass() << "Class " + << pEnv->CurClass()->LocalName(); + Add_Item( i_eClass, sClass, sLinkClass().c_str(), sTipClass().c_str() ); + } + else + { + Add_Item( i_eClass, sClass, "", "" ); + } + + + Add_Item( eStd, sIndex, PathPerRoot(*pEnv, C_sPath_Index), "" ); + String + sLinkHelp = PathPerRoot(*pEnv, "help.html"); + Add_Item( eStd, sHelp, sLinkHelp.c_str(), "" ); +} + +void +MainRow::Add_Item( E_Style i_eStyle, + const String & i_sText, + const char * i_sLink, + const char * i_sTip ) +{ + switch (i_eStyle) + { + case eStd: aItems.push_back( new MainRowItem(i_sText, i_sLink, i_sTip) ); + break; + case eNo: aItems.push_back( new UnavailableItem(i_sText) ); + break; + case eSelf: aItems.push_back( new SelectedItem(i_sText) ); + break; + default: + csv_assert(false); + } +} + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/nav_main.hxx b/autodoc/source/display/html/nav_main.hxx new file mode 100644 index 000000000000..fe3e79c822e4 --- /dev/null +++ b/autodoc/source/display/html/nav_main.hxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_NAV_MAIN_HXX +#define ADC_DISPLAY_HTML_NAV_MAIN_HXX + +// USED SERVICES + +namespace ary +{ +namespace cpp +{ + class CodeEntity; +} +namespace loc +{ + class File; +} +} +namespace csi +{ +namespace xml +{ + class Element; +} +} + +class OuputPage_Environment; +class MainItem; + + + + +class MainRow +{ + public: + MainRow( + const OuputPage_Environment & + i_rEnv ); + ~MainRow(); + + void SetupItems_Overview(); + void SetupItems_AllDefs(); + void SetupItems_Index(); + void SetupItems_Help(); + + void SetupItems_Ce( + const ary::cpp::CodeEntity & + i_rCe ); + void SetupItems_FunctionGroup(); /// For class member methods. + void SetupItems_DataGroup(); /// For class member data. + + void Write2( + csi::xml::Element & o_rOut ) const; + private: + // Local + enum E_Style + { + eSelf, + eNo, + eStd + }; + + /** @precond + Only combinations of 1 eSelf and 2 eStd are allowed + as arguments, here. + */ + void Create_ItemList_Global( + E_Style i_eOverview, + E_Style i_eIndex, + E_Style i_eHelp ); + void Create_ItemList_InDirTree_Cpp( + E_Style i_eNsp, + E_Style i_eClass, + E_Style i_eTree, + const char * i_sTreeLink ); + void Add_Item( + E_Style i_eStyle, + const String & i_sText, + const char * i_sLink, + const char * i_sTip ); + // DATA + typedef std::vector< DYN MainItem* > ItemList; + + + ItemList aItems; + const OuputPage_Environment * + pEnv; +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/navibar.cxx b/autodoc/source/display/html/navibar.cxx new file mode 100644 index 000000000000..8490e834b6d8 --- /dev/null +++ b/autodoc/source/display/html/navibar.cxx @@ -0,0 +1,318 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "navibar.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include "nav_main.hxx" +#include "opageenv.hxx" + + +using namespace csi::xml; +using namespace csi::html; + + +namespace +{ + +//************************ SubRowItem ***************************// + +class SubRowItem +{ + public: + SubRowItem( + const char * i_sText, + const char * i_sLink, + bool i_bActive, + bool i_bFirstOfRow = false ); + ~SubRowItem(); + + void Write2( + Element & o_rOut ) const; + private: + String sText; + String sLink; + bool bIsActive; + bool bFirstOfRow; +}; + +SubRowItem::SubRowItem( const char * i_sText, + const char * i_sLink, + bool i_bActive, + bool i_bFirstOfRow ) + : sText(i_sText), + sLink(i_sLink), + bIsActive(i_bActive), + bFirstOfRow(i_bFirstOfRow) +{ + csv_assert( NOT csv::no_str(i_sLink) ); +} + +SubRowItem::~SubRowItem() +{ +} + +void +SubRowItem::Write2( Element & o_rOut ) const +{ + o_rOut << new Sbr; + if ( NOT bFirstOfRow ) + o_rOut << new XmlCode( "| " ); + else + o_rOut << new XmlCode( " " ); + + if ( bIsActive ) + { + o_rOut + >> *new Link( sLink.c_str() ) + >> *new AnElement( "font" ) + << new AnAttribute("size","-2") + >> *new Bold + << sText.c_str(); + } + else + { + o_rOut + >> *new AnElement( "font" ) + << new AnAttribute("size","-2") + << sText.c_str(); + } +} + + + +//************************ SubRow ***************************// + +class SubRow +{ + public: + SubRow( + const char * i_sTitle ); + ~SubRow(); + + void AddItem( + const char * i_sText, + const char * i_sLink, + bool i_bActive ); + void Write2( + Table & o_rOut ) const; + private: + typedef std::vector< DYN SubRowItem * > List_Items; + + List_Items aItemList; + String sTitle; +}; + +SubRow::SubRow( const char * i_sTitle ) +// : // aItemList, + // sTitle +{ + StreamStr sUp(i_sTitle,0); + sUp.to_upper(); + sTitle = sUp.c_str(); +} + +SubRow::~SubRow() +{ + for ( List_Items::iterator it = aItemList.begin(); + it != aItemList.end(); + ++it ) + { + delete (*it); + } +} + +inline void +SubRow::AddItem( const char * i_sText, + const char * i_sLink, + bool i_bActive ) +{ + aItemList.push_back( new SubRowItem(i_sText, i_sLink, i_bActive, aItemList.empty()) ); +} + +void +SubRow::Write2( Table & o_rOut ) const +{ + TableRow * pRow = new TableRow; + o_rOut << pRow; + + if (sTitle.length() > 0) + { + Element & rCell1 = pRow->AddCell(); + rCell1 + << new WidthAttr("20%") + >> *new AnElement( "font" ) + << new AnAttribute("size","-2") + << sTitle + << ":"; + } + + Element & rCell2 = pRow->AddCell(); + for ( List_Items::const_iterator it = aItemList.begin(); + it != aItemList.end(); + ++it ) + { + (*it)->Write2( rCell2 ); + } +} + + +} // anonymous namespace + + + +//************************* CheshireCat ***********************// + + +typedef std::vector< DYN SubRow * > List_SubRows; + +struct NavigationBar::CheshireCat +{ + MainRow aMainRow; + List_SubRows aSubRows; + const OuputPage_Environment * + pEnv; + + + CheshireCat( + const OuputPage_Environment & + i_rEnv ); + ~CheshireCat(); +}; + +NavigationBar:: +CheshireCat::CheshireCat( const OuputPage_Environment & i_rEnv ) + : aMainRow( i_rEnv ), + pEnv( & i_rEnv ) +{ +} + +NavigationBar:: +CheshireCat::~CheshireCat() +{ + csv::erase_container_of_heap_ptrs( aSubRows ); +} + + +//************************ NavigationBar *******************// + +NavigationBar::NavigationBar( const OuputPage_Environment & i_rEnv, + E_GlobalLocation i_eLocation ) + : pi( new CheshireCat(i_rEnv) ) +{ + switch (i_eLocation) + { + case LOC_Overview: pi->aMainRow.SetupItems_Overview(); break; + case LOC_AllDefs: pi->aMainRow.SetupItems_AllDefs(); break; + case LOC_Index: pi->aMainRow.SetupItems_Index(); break; + case LOC_Help: pi->aMainRow.SetupItems_Help(); break; + default: + csv_assert(false); + } +} + +NavigationBar::NavigationBar( const OuputPage_Environment & i_rEnv, + const ary::cpp::CodeEntity & i_rCe ) + : pi( new CheshireCat(i_rEnv) ) +{ + pi->aMainRow.SetupItems_Ce( i_rCe ); +} + +NavigationBar::NavigationBar( const OuputPage_Environment & i_rEnv, + E_CeGatheringType i_eCeGatheringType ) + : pi( new CheshireCat(i_rEnv) ) +{ + switch (i_eCeGatheringType) + { + case CEGT_operations: pi->aMainRow.SetupItems_FunctionGroup(); break; + case CEGT_data: pi->aMainRow.SetupItems_DataGroup(); break; + default: + csv_assert(false); + } +} + +NavigationBar::~NavigationBar() +{ + csv::erase_container_of_heap_ptrs( pi->aSubRows ); +} + +void +NavigationBar::MakeSubRow( const char * i_sTitle ) +{ + pi->aSubRows.push_back( new SubRow(i_sTitle) ); +} + +void +NavigationBar::AddItem( const char * i_sName, + const char * i_sLink, + bool i_bValid ) +{ + csv_assert( pi->aSubRows.size() > 0 ); + StreamStr sName(i_sName, 0); + sName.to_upper(); + + StreamLock aSum(100); + pi->aSubRows.back()->AddItem( sName.c_str(), + aSum() << "#" << i_sLink << c_str, + i_bValid ); +} + +void +NavigationBar::Write( Element & o_rOut, + bool i_bWithSubRows ) const +{ + pi->aMainRow.Write2( o_rOut ); + + const_cast< NavigationBar* >(this)->pSubRowsTable = new Table; + o_rOut << pSubRowsTable; + *pSubRowsTable + << new AnAttribute( "class", "navisub" ) + << new AnAttribute( "cellpadding", "0" ) + << new AnAttribute( "cellspacing", "3" ); + + if (i_bWithSubRows) + { + Write_SubRows(); + } +} + +void +NavigationBar::Write_SubRows() const +{ + for ( List_SubRows::const_iterator it = pi->aSubRows.begin(); + it != pi->aSubRows.end(); + ++it ) + { + (*it)->Write2( *pSubRowsTable ); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/navibar.hxx b/autodoc/source/display/html/navibar.hxx new file mode 100644 index 000000000000..ec81e6e94e5c --- /dev/null +++ b/autodoc/source/display/html/navibar.hxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_NAVIBAR_HXX +#define ADC_DISPLAY_HTML_NAVIBAR_HXX + +// BASE CLASSES +#include "hdimpl.hxx" + +namespace ary +{ +namespace cpp +{ + class CodeEntity; +} +namespace loc +{ + class File; +} +} + + + + +/** Creates a HTML navigation bar wth the following parts: + + A main bar with fixed items. + Zero to several subbars with user defined items, depending of + the contents of the page. + + The main bar contains those items: + + Overview | Namespace | Class | Tree | Project | File | Index | Help +*/ +class NavigationBar +{ + public: + enum E_GlobalLocation + { + LOC_Overview, + LOC_AllDefs, + LOC_Index, + LOC_Help + }; + enum E_CeGatheringType + { + CEGT_operations, + CEGT_data + }; + + /// Used for Overview, Index and Help. + NavigationBar( + const OuputPage_Environment & + i_rEnv, + E_GlobalLocation i_eLocation ); + /// Used for all Ces except operations and data. + NavigationBar( + const OuputPage_Environment & + i_rEnv, + const ary::cpp::CodeEntity & + i_rCe ); + /** Used for operations and data. + */ + NavigationBar( + const OuputPage_Environment & + i_rEnv, + E_CeGatheringType i_eCeGatheringType ); + ~NavigationBar(); + + void MakeSubRow( + const char * i_sTitle ); + void AddItem( /// Items are added to last made sub-row. + const char * i_sName, + const char * i_sLink, + bool i_bValid ); + /** This writes the main bar and the pSubRowTable to o_rOut. + The pSubRowsTable stays in memory and can be filled later, + when all SubRow items are known. + */ + void Write( + csi::xml::Element & o_rOut, + bool i_bWithSubRows = false ) const; + void Write_SubRows() const; + + private: + struct CheshireCat; + Dyn<CheshireCat> pi; + csi::html::Table * pSubRowsTable; +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/opageenv.cxx b/autodoc/source/display/html/opageenv.cxx new file mode 100644 index 000000000000..4f48ca138217 --- /dev/null +++ b/autodoc/source/display/html/opageenv.cxx @@ -0,0 +1,492 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "opageenv.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/ploc_dir.hxx> +#include <ary/cpp/c_ce.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <ary/loc/loc_file.hxx> +#include <udm/html/htmlitem.hxx> +#include <estack.hxx> +#include "hdimpl.hxx" +#include "strconst.hxx" + + +const String C_sCppDir( "names" ); +const String C_sIndexDir( "ix" ); + + +//************************ Implementation ********************// + +namespace +{ + +void CreateDirectory( const csv::ploc::Path & i_rPath ); + +void +CreateDirectory( const csv::ploc::Path & i_rPath ) +{ + csv::ploc::Directory aDirectory(i_rPath); + if (NOT aDirectory.Exists()) + aDirectory.PhysicalCreate(); +} + +//************************ CheshireCat ********************// + +struct InNamespaceTree +{ + enum E_Type + { + t_unknown, + t_namespace, + t_type, + t_operations, + t_data + }; + + EStack< const ary::cpp::Namespace * > + aNamespaces; /// never empty. + EStack< const ary::cpp::Class * > + aClasses; /// maybe empty. + const ary::cpp::CodeEntity * + pCe; /// CurFileCe, maybe 0 + E_Type eType; + + InNamespaceTree( + const ary::cpp::Namespace & + i_rNsp ); + ~InNamespaceTree(); + void GoDown( + const ary::cpp::Namespace & + i_rNsp ); + void GoDown( + const ary::cpp::Class & + i_rClass ); + void GoUp(); +}; + +InNamespaceTree::InNamespaceTree( const ary::cpp::Namespace & i_rNsp ) + : // aNamespaces, + // aClasses, + pCe(0), + eType(t_unknown) +{ + aNamespaces.push( &i_rNsp ); +} + +InNamespaceTree::~InNamespaceTree() +{ +} + +void +InNamespaceTree::GoDown( const ary::cpp::Namespace & i_rNsp ) +{ + aNamespaces.push(&i_rNsp); + aClasses.erase_all(); + pCe = 0; + eType = t_unknown; +} + +void +InNamespaceTree::GoDown( const ary::cpp::Class & i_rClass ) +{ + aClasses.push(&i_rClass); + pCe = 0; + eType = t_unknown; +} + +void +InNamespaceTree::GoUp() +{ + if ( NOT aClasses.empty() ) + aClasses.pop(); + else + aNamespaces.pop(); + pCe = 0; + eType = t_unknown; +} + +struct InIndex +{ + char cLetter; + + InIndex() : cLetter('A') {} +}; + + +} // anonymous namespace + + + + + +struct OuputPage_Environment::CheshireCat +{ + csv::ploc::Path aOutputRoot; + csv::ploc::Path aMyPath; + csv::StreamStr aFileName; + + const ary::cpp::Gate * + pGate; + const display::CorporateFrame * + pLayout; + intt nDepth; + + Dyn<InNamespaceTree> + pInNamespace; + Dyn<InIndex> pInIndex; + + CheshireCat( + const csv::ploc::Path & + io_rOutputDir, + const ary::cpp::Gate & + i_rGate, + const display::CorporateFrame & + i_rLayout ); + ~CheshireCat(); + void AddQualifiedName2Path( + const ary::cpp::CodeEntity & + i_rCe, + bool i_bIncludeLocalName ); + + const Dyn<InNamespaceTree> & + NspEnv() const { return pInNamespace; } + Dyn<InNamespaceTree> & + NspEnv() { return pInNamespace; } + const ary::cpp::Namespace * + Namespace() const { return pInNamespace ? pInNamespace->aNamespaces.top() : 0; } + const ary::cpp::Class * + Class() const { return pInNamespace ? (pInNamespace->aClasses.empty() ? 0 : pInNamespace->aClasses.top()) : 0; } +}; + +OuputPage_Environment:: +CheshireCat::CheshireCat( const csv::ploc::Path & io_rOutputDir, + const ary::cpp::Gate & i_rGate, + const display::CorporateFrame & i_rLayout ) + : aOutputRoot(io_rOutputDir), + aMyPath(io_rOutputDir), + aFileName(500), + pGate(&i_rGate), + pLayout(&i_rLayout), + nDepth(0), + pInNamespace(), + pInIndex() +{ +} + +OuputPage_Environment:: +CheshireCat::~CheshireCat() +{ +} + +void +OuputPage_Environment:: +CheshireCat::AddQualifiedName2Path( const ary::cpp::CodeEntity & i_rCe, + bool i_bIncludeLocalName ) +{ + if (NOT i_rCe.Owner().IsValid()) + { + aMyPath.DirChain().PushBack( C_sCppDir ); + return; + } + + const ary::cpp::CodeEntity & + rParent = pGate->Ces().Find_Ce( i_rCe.Owner() ); + AddQualifiedName2Path( rParent, true ); + + if ( i_bIncludeLocalName ) + aMyPath.DirChain().PushBack( i_rCe.LocalName() ); +} + + + +//************************ OuputPage_Environment ********************// + +OuputPage_Environment::OuputPage_Environment( const csv::ploc::Path & io_rOutputDir, + const ary::cpp::Gate & i_rGate, + const display::CorporateFrame & i_rLayout ) + : pi( new CheshireCat(io_rOutputDir, i_rGate, i_rLayout) ) +{ +} + +OuputPage_Environment::~OuputPage_Environment() +{ +} + +void +OuputPage_Environment::MoveDir_2Root() +{ + pi->NspEnv() = 0; + pi->pInIndex = 0; + pi->nDepth = 0; + while ( pi->aMyPath.DirChain().Size() > pi->aOutputRoot.DirChain().Size() ) + pi->aMyPath.DirChain().PopBack(); + pi->aMyPath.SetFile(String ::Null_()); +} + +void +OuputPage_Environment::MoveDir_2Names() +{ + pi->NspEnv() = new InNamespaceTree( Gate().Ces().GlobalNamespace() ); + pi->aMyPath.DirChain().PushBack( C_sCppDir ); + pi->aMyPath.SetFile(String ::Null_()); + ++pi->nDepth; + + CreateDirectory( pi->aMyPath ); +} + +void +OuputPage_Environment::MoveDir_Down2( const ary::cpp::Namespace & i_rNsp ) +{ + csv_assert(i_rNsp.Depth() > 0); + csv_assert( pi->NspEnv() ); + csv_assert( pi->Namespace()->CeId() == i_rNsp.Owner() ); + + pi->NspEnv()->GoDown( i_rNsp ); + pi->aMyPath.DirChain().PushBack(i_rNsp.LocalName()); + ++pi->nDepth; + pi->aMyPath.SetFile(String ::Null_()); + + CreateDirectory( pi->aMyPath ); +} + +void +OuputPage_Environment::MoveDir_Down2( const ary::cpp::Class & i_rClass ) +{ + csv_assert( pi->NspEnv() ); + if ( i_rClass.Protection() == ary::cpp::PROTECT_global ) + { + csv_assert( pi->Namespace()->CeId() == i_rClass.Owner() ); + } + else + { + csv_assert( pi->Class() != 0 ); + csv_assert( pi->Class()->CeId() == i_rClass.Owner() ); + } + + pi->NspEnv()->GoDown(i_rClass); + pi->aMyPath.DirChain().PushBack(i_rClass.LocalName()); + pi->aMyPath.SetFile(String ::Null_()); + ++pi->nDepth; + + CreateDirectory( pi->aMyPath ); +} + +void +OuputPage_Environment::MoveDir_2Index() +{ + MoveDir_2Root(); + pi->pInIndex = new InIndex; + pi->aMyPath.DirChain().PushBack( String (C_sDIR_Index) ); + pi->aMyPath.SetFile(String ::Null_()); + pi->nDepth = 1; + + CreateDirectory( pi->aMyPath ); +} + +void +OuputPage_Environment::MoveDir_Up() +{ + if ( pi->nDepth == 1 ) + { + MoveDir_2Root(); + return; + } + else if ( pi->NspEnv() ) + { + pi->NspEnv()->GoUp(); + pi->aMyPath.DirChain().PopBack(); + pi->aMyPath.SetFile(String ::Null_()); + --pi->nDepth; + } +} + +void +OuputPage_Environment::SetFile_Css() +{ + pi->aMyPath.SetFile( C_sHFN_Css ); +} + +void +OuputPage_Environment::SetFile_Overview() +{ + pi->aMyPath.SetFile( C_sHFN_Overview ); +} + +void +OuputPage_Environment::SetFile_AllDefs() +{ + // Provisorium + pi->aMyPath.SetFile("def-all.html"); +} + +void +OuputPage_Environment::SetFile_Index( char i_cLetter ) +{ + csv_assert( ( 'A' <= i_cLetter AND i_cLetter <= 'Z' ) OR i_cLetter == '_' ); + + static StreamStr sIndexFileName(40); + sIndexFileName.seekp(0); + sIndexFileName << "index-"; + if ( i_cLetter == '_' ) + { + sIndexFileName << "27"; + } + else + { + sIndexFileName << int(i_cLetter -'A' + 1); + } + sIndexFileName << ".html"; + + pi->aMyPath.SetFile( sIndexFileName.c_str() ); +} + +void +OuputPage_Environment::SetFile_Help() +{ + pi->aMyPath.SetFile( C_sHFN_Help ); +} + +void +OuputPage_Environment::SetFile_CurNamespace() +{ + csv_assert( pi->NspEnv() ); + pi->aMyPath.SetFile("index.html"); + pi->NspEnv()->pCe = pi->Namespace(); + pi->NspEnv()->eType = InNamespaceTree::t_namespace; +} + +void +OuputPage_Environment::SetFile_Class( const ary::cpp::Class & i_rClass ) +{ + csv_assert( pi->NspEnv() ); + pi->aMyPath.SetFile( ClassFileName(i_rClass.LocalName()) ); + pi->NspEnv()->pCe = &i_rClass; + pi->NspEnv()->eType = InNamespaceTree::t_type; +} + +void +OuputPage_Environment::SetFile_Enum( const ary::cpp::Enum & i_rEnum ) +{ + csv_assert( pi->NspEnv() ); + pi->aMyPath.SetFile( EnumFileName(i_rEnum.LocalName()) ); + pi->NspEnv()->pCe = &i_rEnum; + pi->NspEnv()->eType = InNamespaceTree::t_type; +} + +void +OuputPage_Environment::SetFile_Typedef( const ary::cpp::Typedef & i_rTypedef ) +{ + csv_assert( pi->NspEnv() ); + pi->aMyPath.SetFile( TypedefFileName(i_rTypedef.LocalName()) ); + pi->NspEnv()->pCe = &i_rTypedef; + pi->NspEnv()->eType = InNamespaceTree::t_type; +} + +void +OuputPage_Environment::SetFile_Operations( const ary::loc::File * i_pFile ) +{ + csv_assert( pi->NspEnv() ); + if ( CurClass() != 0 ) + pi->aMyPath.SetFile( "o.html" ); + else + { + csv_assert( i_pFile != 0 ); + pi->aMyPath.SetFile( HtmlFileName("o-", i_pFile->LocalName()) ); + } + pi->NspEnv()->pCe = 0; + pi->NspEnv()->eType = InNamespaceTree::t_operations; +} + +void +OuputPage_Environment::SetFile_Data( const ary::loc::File * i_pFile ) +{ + csv_assert( pi->NspEnv() ); + if ( CurClass() != 0 ) + pi->aMyPath.SetFile( "d.html" ); + else + { + csv_assert( i_pFile != 0 ); + pi->aMyPath.SetFile( HtmlFileName("d-", i_pFile->LocalName()) ); + } + pi->NspEnv()->pCe = 0; + pi->NspEnv()->eType = InNamespaceTree::t_data; +} + +const ary::cpp::Namespace * +OuputPage_Environment::CurNamespace() const +{ + return pi->Namespace(); +} + +const ary::cpp::Class * +OuputPage_Environment::CurClass() const +{ + return pi->Class(); +} + +const csv::ploc::Path & +OuputPage_Environment::CurPath() const +{ + return pi->aMyPath; +} + +const ary::cpp::Gate & +OuputPage_Environment::Gate() const +{ + return *pi->pGate; +} + +const display::CorporateFrame & +OuputPage_Environment::Layout() const +{ + return *pi->pLayout; +} + +uintt +OuputPage_Environment::Depth() const +{ + return static_cast<uintt>(pi->nDepth); +} + +const String & +OuputPage_Environment::RepositoryTitle() const +{ + return Gate().RepositoryTitle(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/opageenv.hxx b/autodoc/source/display/html/opageenv.hxx new file mode 100644 index 000000000000..c0bb48ef5962 --- /dev/null +++ b/autodoc/source/display/html/opageenv.hxx @@ -0,0 +1,131 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_OPAGEENV_HXX +#define ADC_DISPLAY_HTML_OPAGEENV_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <cosv/ploc.hxx> + // PARAMETERS + +namespace ary +{ + namespace cpp + { + class Gate; + + class Namespace; + class Class; + class Enum; + class Typedef; + } + namespace loc + { + class File; + } +} +namespace display +{ + class CorporateFrame; +} + +class OuputPage_Environment +{ + public: + // LIFECYCLE + OuputPage_Environment( + const csv::ploc::Path & + io_rOutputDir, + const ary::cpp::Gate & + i_rGate, + const display::CorporateFrame & + i_rLayout ); + ~OuputPage_Environment(); + + // OPERATIONS + void MoveDir_2Root(); + void MoveDir_2Names(); + void MoveDir_Down2( /// Only one level. + const ary::cpp::Namespace & + i_rNsp ); + void MoveDir_Down2( /// Only one level. + const ary::cpp::Class & + i_rClass ); + void MoveDir_2Index(); + void MoveDir_Up(); + + void SetFile_Css(); + void SetFile_Overview(); + void SetFile_AllDefs(); + void SetFile_Index( + char i_cLetter ); + void SetFile_Help(); + void SetFile_CurNamespace(); + void SetFile_Class( + const ary::cpp::Class & + i_rClass ); + void SetFile_Enum( + const ary::cpp::Enum & + i_rEnum ); + void SetFile_Typedef( + const ary::cpp::Typedef & + i_typedef ); + void SetFile_Operations( + const ary::loc::File * + i_pFile = 0 ); /// Only needed for global functions. + void SetFile_Data( + const ary::loc::File * + i_pFile = 0 ); /// Only needed for global variables. + // INQUIRY + const ary::cpp::Namespace * + CurNamespace() const; + const ary::cpp::Class * + CurClass() const; + const csv::ploc::Path & + CurPath() const; + const ary::cpp::Gate & + Gate() const; + const display::CorporateFrame & + Layout() const; + uintt Depth() const; + const String & RepositoryTitle() const; + + private: + struct CheshireCat; + Dyn<CheshireCat> pi; +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/outfile.cxx b/autodoc/source/display/html/outfile.cxx new file mode 100644 index 000000000000..82ab2eac7749 --- /dev/null +++ b/autodoc/source/display/html/outfile.cxx @@ -0,0 +1,395 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "outfile.hxx" + +// NOT FULLY DECLARED SERVICES +#include <cosv/file.hxx> +#include <udm/html/htmlitem.hxx> +#include <toolkit/out_position.hxx> +#include "strconst.hxx" + + +namespace +{ +bool bUse_OOoFrameDiv = true; +const String C_sOOoFrameDiv_CppId("adc-cppref"); +} + + +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 + ; + + +const char * const + C_sStdStyle_withDivFrame = + "body { background-color:#ffffff; }"CRLF + "#adc-cppref h1 { font-size:20pt; margin-top:3pt; margin-bottom:7pt; }"CRLF + "#adc-cppref h2 { font-family:Arial; font-size:16pt; margin-top:3pt; margin-bottom:5pt; }"CRLF + "#adc-cppref h3 { font-size:13pt; margin-top:2pt; margin-bottom:3pt; }"CRLF + "#adc-cppref h4 { font-size:10pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF + "#adc-cppref dl { margin-top:1pt; margin-bottom:1pt; }"CRLF + "#adc-cppref dl.member { margin-top:1pt; margin-bottom:1pt; background-color:#eeeeff; }"CRLF + "#adc-cppref dt { font-size:10pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF + "#adc-cppref dt.member { font-size:13pt; font-weight:bold; margin-top:2pt; margin-bottom:1pt; }"CRLF + "#adc-cppref dt.simple { font-size:10pt; font-weight:normal; margin-top:2pt; margin-bottom:1pt; }"CRLF + "#adc-cppref dd { font-size:10pt; margin-top:1pt; margin-bottom:1pt; }"CRLF + "#adc-cppref dd.member { font-size:10pt; margin-top:1pt; margin-bottom:1pt; background-color:#ffffff; }"CRLF + "#adc-cppref p { font-size:10pt; margin-top:3pt; margin-bottom:1pt; }"CRLF + "#adc-cppref pre { font-family:monospace; font-size:10pt; margin-top:1pt; margin-bottom:1pt; }"CRLF + "#adc-cppref tr { font-size:10pt; }"CRLF + "#adc-cppref td { font-size:10pt; }"CRLF + CRLF + "#adc-cppref dt.attention { color:#dd0000; }"CRLF + CRLF + "#adc-cppref div.title { text-align:center; line-height:26pt; background-color:#ccccff; }"CRLF + "#adc-cppref .subtitle { background-color:#ccccff; }"CRLF + CRLF + "#adc-cppref td.flagname { background-color:#eeeeff; font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF + "#adc-cppref td.flagyes { font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF + "#adc-cppref td.flagno { font-family:Arial; font-size:8pt; }"CRLF + "#adc-cppref td.flagtext { font-family:Arial; font-size:8pt; font-weight:bold; }"CRLF + CRLF + "#adc-cppref td.navimain, #adc-cppref td.navimain a"CRLF + " { background-color:#eeeeff; color:#000000;"CRLF + " font-family:Arial; font-size:12pt; font-weight:bold; }"CRLF + "#adc-cppref td.navimainself"CRLF + " { background-color:#2222ad; color:#ffffff;"CRLF + " font-family:Arial; font-size:12pt; font-weight:bold; }"CRLF + "#adc-cppref td.navimainnone"CRLF + " { background-color:#eeeeff; color:#000000;"CRLF + " font-family:Arial; font-size:12pt; }"CRLF + CRLF + "#adc-cppref div.define { font-family:Arial; background-color:#ccccff; }"CRLF + CRLF + "#adc-cppref .nqclass { color:#008800; }"CRLF + CRLF + "#adc-cppref h3.help { background-color:#eeeeff; margin-top:12pt; }"CRLF + CRLF + "#adc-cppref .btpubl { color:#33ff33; }"CRLF + "#adc-cppref .btprot { color:#cc9933; }"CRLF + "#adc-cppref .btpriv { color:#ff6666; }"CRLF + "#adc-cppref .btvpubl { color:#33ff33; font-style:italic; }"CRLF + "#adc-cppref .btvprot { color:#cc9933; font-style:italic; }"CRLF + "#adc-cppref .btvpriv { color:#ff6666; font-style:italic; }"CRLF + "#adc-cppref .btself { font-weight:bold; }"CRLF + ""CRLF + "#adc-cppref table { empty-cells:show; }"CRLF + ""CRLF + "#adc-cppref .childlist td, "CRLF + "#adc-cppref .commentedlinks td, "CRLF + "#adc-cppref .memberlist td, "CRLF + "#adc-cppref .subtitle td, "CRLF + "#adc-cppref .crosstitle td { border: .1pt solid #000000; }"CRLF + ""CRLF + "#adc-cppref .flag-table td { border: .1pt solid #cccccc; } "CRLF + ""CRLF + "#adc-cppref .title-table td, "CRLF + "#adc-cppref .table-in-method td, "CRLF + "#adc-cppref .table-in-data td, "CRLF + "#adc-cppref .navimain td, "CRLF + "#adc-cppref .navisub td, "CRLF + "#adc-cppref .expl-table td, "CRLF + "#adc-cppref .param-table td { border: none; }"CRLF + ; + + + +HtmlDocuFile::HtmlDocuFile() + : sFilePath(), + sTitle(), + sLocation(), + sCopyright(), + nDepthInOutputTree(0), + aBodyData(), + aBuffer(60000) // Grows dynamically when necessary. +{ +} + +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(); + nDepthInOutputTree = i_depthInOutputTree; +} + +void +HtmlDocuFile::SetTitle( const char * i_sTitle ) +{ + sTitle = i_sTitle; +} + +void +HtmlDocuFile::SetCopyright( const char * i_sCopyright ) +{ + sCopyright = i_sCopyright; +} + +void +HtmlDocuFile::EmptyBody() +{ + aBodyData.SetContent(0); + + if (bUse_OOoFrameDiv) + { + // Insert <div> tag to allow better formatting for OOo. + aBodyData + << new xml::XmlCode("<div id=\"") + << new xml::XmlCode(C_sOOoFrameDiv_CppId) + << new xml::XmlCode("\">\n\n"); + } + + 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</html>\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"); + + if (bUse_OOoFrameDiv) + aCssFile.write(C_sStdStyle_withDivFrame); + else + aCssFile.write(C_sStdStyle); + + aCssFile.write("\n\n\n"); + aCssFile.write(C_sCssExplanations); +} + +void +HtmlDocuFile::WriteHeader( csv::File & io_aFile ) +{ + aBuffer.reset(); + + static const char s1[] = + "<html>\n<head>\n" + "<title>"; + static const char s2[] = + "</title>\n" + "<link rel=\"stylesheet\" type=\"text/css\" href=\""; + static const char s3[] = + "\">\n</head>\n"; + + aBuffer.write( s1 ); + aBuffer.write( sTitle ); + aBuffer.write( s2 ); + aBuffer.write( output::get_UpLink(nDepthInOutputTree) ); + aBuffer.write( C_sHFN_Css ); + aBuffer.write( s3 ); + + io_aFile.write(aBuffer.c_str(), aBuffer.size()); +} + +void +HtmlDocuFile::WriteBody( csv::File & io_aFile ) +{ + aBuffer.reset(); + + 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("<hr size=\"3\">"); +#endif + + aBodyData + >> *new html::Paragraph + << new html::ClassAttr( "copyright" ) + << new xml::AnAttribute( "align", "center" ) + << new xml::XmlCode(sCopyright); + } + + if (bUse_OOoFrameDiv) + { + // Insert <div> tag to allow better formatting for OOo. + aBodyData + << new xml::XmlCode("\n</div> <!-- id=\"") + << new xml::XmlCode(C_sOOoFrameDiv_CppId) + << new xml::XmlCode("\" -->\n"); + } + + aBodyData.WriteOut(aBuffer); + io_aFile.write(aBuffer.c_str(), aBuffer.size()); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/outfile.hxx b/autodoc/source/display/html/outfile.hxx new file mode 100644 index 000000000000..033e92954a3d --- /dev/null +++ b/autodoc/source/display/html/outfile.hxx @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_OUTFILE_HXX +#define ADC_DISPLAY_HTML_OUTFILE_HXX + +// USED SERVICES +#include <udm/html/htmlitem.hxx> +#include <cosv/ploc.hxx> + + +namespace csv +{ + class File; +} + + + + +class HtmlDocuFile +{ + public: + // LIFECYCLE + HtmlDocuFile(); + + void SetLocation( + const csv::ploc::Path & + i_rFilePath, + uintt i_depthInOutputTree ); + void SetTitle( + const char * i_sTitle ); + void SetCopyright( + const char * i_sCopyright ); + void EmptyBody(); + + Html::Body & Body() { return aBodyData; } + bool CreateFile(); + + static void WriteCssFile( + const csv::ploc::Path & + i_rFilePath ); + private: + void WriteHeader( + csv::File & io_aFile ); + void WriteBody( + csv::File & io_aFile ); + + // DATA + String sFilePath; + String sTitle; + String sLocation; + String sCopyright; + uintt nDepthInOutputTree; + + Html::Body aBodyData; + StreamStr aBuffer; // Output buffer, should be transfered into csv::File. +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/pagemake.cxx b/autodoc/source/display/html/pagemake.cxx new file mode 100644 index 000000000000..52d05fb0b19c --- /dev/null +++ b/autodoc/source/display/html/pagemake.cxx @@ -0,0 +1,578 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "pagemake.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <ary/loc/loc_file.hxx> +#include <display/corframe.hxx> +#include "hd_chlst.hxx" +#include "hd_docu.hxx" +#include "hdimpl.hxx" +#include "html_kit.hxx" +#include "navibar.hxx" +#include "opageenv.hxx" +#include "outfile.hxx" +#include "pm_aldef.hxx" +#include "pm_class.hxx" +#include "pm_help.hxx" +#include "pm_index.hxx" +#include "pm_namsp.hxx" +#include "pm_start.hxx" +#include "strconst.hxx" + + +using namespace csi; +using csi::html::Link; +using csi::html::HorizontalLine; + + +const int C_nNrOfIndexLetters = 27; + + +template <class SPECIAL_MAKER> +inline void +Make_SpecialPage( DYN SPECIAL_MAKER * let_dpMaker ) +{ + Dyn< SPECIAL_MAKER > pMaker( let_dpMaker ); + pMaker->MakePage(); + pMaker = 0; +} + + +PageDisplay::PageDisplay( OuputPage_Environment & io_rEnv ) + : HtmlDisplay_Impl( io_rEnv ), + pMyFile( new HtmlDocuFile ) +{ +} + +PageDisplay::~PageDisplay() +{ + +} + +void +PageDisplay::Create_OverviewFile() +{ + Env().SetFile_Overview(); + File().SetLocation( Env().CurPath(), 0 ); + + SetupFileOnCurEnv( C_sHFTitle_Overview ); + Make_SpecialPage( new PageMaker_Overview(*this) ); + Create_File(); +} + +void +PageDisplay::Create_AllDefsFile() +{ + // This method is a provisorium, because later this will + // be spreaded over the files. + + Env().MoveDir_2Root(); + Env().SetFile_AllDefs(); + File().SetLocation( Env().CurPath(), 0 ); + + SetupFileOnCurEnv( "Defines and Macros" ); + Make_SpecialPage( new PageMaker_AllDefs(*this) ); + Create_File(); +} + +void +PageDisplay::Create_IndexFiles() +{ + Env().MoveDir_2Index(); + + for ( int i = 0; i < C_nNrOfIndexLetters; ++i ) + Create_IndexFile(i); +} + +void +PageDisplay::Create_HelpFile() +{ + Env().SetFile_Help(); + File().SetLocation( Env().CurPath(), 0 ); + + SetupFileOnCurEnv( C_sHFTitle_Help ); + Make_SpecialPage( new PageMaker_Help(*this) ); + Create_File(); +} + +void +PageDisplay::Create_NamespaceFile() +{ + csv_assert( Env().CurNamespace() != 0 ); + Env().SetFile_CurNamespace(); + File().SetLocation( Env().CurPath(), Env().Depth() ); + if (Env().CurNamespace()->Owner().IsValid()) + { + StreamLock sNsp(100); + SetupFileOnCurEnv( sNsp() << C_sHFTypeTitle_Namespace + << " " + << Env().CurNamespace()->LocalName() + << c_str ); + } + else + { + SetupFileOnCurEnv( C_sHFTitle_GlobalNamespaceCpp ); + } + + Make_SpecialPage( new PageMaker_Namespace(*this) ); + + Create_File(); +} + +void +PageDisplay::Setup_OperationsFile_for( const ary::loc::File & i_rFile ) +{ + csv_assert( Env().CurNamespace() != 0 ); + Env().SetFile_Operations(&i_rFile); + File().SetLocation( Env().CurPath(), Env().Depth() ); + + StreamLock sOpFile(100); + SetupFileOnCurEnv( sOpFile() << "Global Functions in Namespace " + << Env().CurNamespace()->LocalName() + << " in Sourcefile " + << i_rFile.LocalName() + << c_str ); + NavigationBar + aNavi( Env(), + NavigationBar::CEGT_operations ); + aNavi.Write( CurOut() ); + CurOut() << new HorizontalLine; + + adcdisp::PageTitle_Std fTitle; + csi::xml::Element & rTitle = fTitle( CurOut() ); + if (Env().CurNamespace()->Owner().IsValid()) + { + rTitle << "Global Functions in Namespace " + << Env().CurNamespace()->LocalName(); + } + else + { + rTitle << "Global Functions in Global Namespace C++"; + } + + rTitle << new html::LineBreak + << "in Sourcefile " + << i_rFile.LocalName(); + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Setup_OperationsFile_for( const ary::cpp::Class & i_rClass ) +{ + csv_assert( Env().CurNamespace() != 0 ); + Env().SetFile_Operations(0); + File().SetLocation( Env().CurPath(), Env().Depth() ); + + StreamLock sOpFile(100); + SetupFileOnCurEnv( sOpFile() << "Methods of Class " + << i_rClass.LocalName() + << c_str ); + NavigationBar + aNavi( Env(), + NavigationBar::CEGT_operations ); + aNavi.Write( CurOut() ); + CurOut() << new HorizontalLine; + + adcdisp::PageTitle_Std fTitle; + fTitle( CurOut(), "Methods of Class", i_rClass.LocalName() ); + + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Setup_DataFile_for( const ary::loc::File & i_rFile ) +{ + csv_assert( Env().CurNamespace() != 0 ); + Env().SetFile_Data(&i_rFile); + File().SetLocation( Env().CurPath(), Env().Depth() ); + + StreamLock sDataFile(100); + SetupFileOnCurEnv( sDataFile() << "Global Data in Namespace " + << Env().CurNamespace()->LocalName() + << " in Sourcefile " + << i_rFile.LocalName() + << c_str ); + NavigationBar + aNavi( Env(), + NavigationBar::CEGT_data ); + aNavi.Write( CurOut() ); + CurOut() << new HorizontalLine; + + adcdisp::PageTitle_Std fTitle; + csi::xml::Element & rTitle = fTitle( CurOut() ); + if ( Env().CurNamespace()->Owner().IsValid() ) + { + rTitle << "Global Data in Namespace " + << Env().CurNamespace()->LocalName(); + } + else + { + rTitle << "Global Data in Global Namespace C++"; + } + + rTitle + << new html::LineBreak + << "in Sourcefile " + << i_rFile.LocalName(); + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Setup_DataFile_for( const ary::cpp::Class & i_rClass ) +{ + csv_assert( Env().CurNamespace() != 0 ); + Env().SetFile_Data(0); + File().SetLocation( Env().CurPath(), Env().Depth() ); + + StreamLock sDataFile(100); + SetupFileOnCurEnv( sDataFile() << "Data of Class " + << i_rClass.LocalName() + << c_str ); + + NavigationBar + aNavi( Env(), + NavigationBar::CEGT_data ); + aNavi.Write( CurOut() ); + CurOut() << new HorizontalLine; + + adcdisp::PageTitle_Std fTitle; + fTitle( CurOut(), "Data of Class", i_rClass.LocalName() ); + + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Create_File() +{ + Easy().Leave(); + File().CreateFile(); +} + +void +PageDisplay::do_Process(const ary::cpp::Class & i_rData) +{ + Env().SetFile_Class(i_rData); + File().SetLocation( Env().CurPath(), Env().Depth() ); + + const char * + sTypeTitle = i_rData.ClassKey() == ary::cpp::CK_class + ? C_sHFTypeTitle_Class + : i_rData.ClassKey() == ary::cpp::CK_struct + ? C_sHFTypeTitle_Struct + : C_sHFTypeTitle_Union; + StreamLock sClassFile(60); + SetupFileOnCurEnv( sClassFile() << sTypeTitle + << " " + << i_rData.LocalName() + << c_str ); + + Make_SpecialPage( new PageMaker_Class(*this, i_rData) ); + + Create_File(); +} + +void +PageDisplay::do_Process(const ary::cpp::Enum & i_rData) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + Env().SetFile_Enum(i_rData); + File().SetLocation( Env().CurPath(), Env().Depth() ); + + StreamLock sEnumFile(100); + SetupFileOnCurEnv( sEnumFile() << C_sHFTypeTitle_Enum + << " " + << i_rData.LocalName() + << c_str ); + Write_NavBar_Enum(i_rData); + Write_TopArea_Enum(i_rData); + Write_DocuArea_Enum(i_rData); + Write_ChildList_Enum(i_rData); + + Create_File(); +} + +void +PageDisplay::do_Process(const ary::cpp::Typedef & i_rData) +{ + if ( Ce_IsInternal(i_rData) ) + return; + + Env().SetFile_Typedef(i_rData); + File().SetLocation( Env().CurPath(), Env().Depth() ); + + StreamLock sTypedefFile(100); + SetupFileOnCurEnv( sTypedefFile() << C_sHFTypeTitle_Typedef + << " " + << i_rData.LocalName() + << c_str ); + Write_NavBar_Typedef(i_rData); + Write_TopArea_Typedef(i_rData); + Write_DocuArea_Typedef(i_rData); + + + Create_File(); +} + +void +PageDisplay::Write_NameChainWithLinks( const ary::cpp::CodeEntity & i_rCe ) +{ + if ( Env().CurNamespace()->Id() != i_rCe.Id() ) + { + RecursiveWrite_NamespaceLink( Env().CurNamespace() ); + if ( Env().CurClass() != 0 ) + { + CurOut() << new html::Sbr; + RecursiveWrite_ClassLink( Env().CurClass(), 1 ); + } + } + else + { + RecursiveWrite_NamespaceLink( Env().CurNamespace()->Parent() ); + } +} + +const ary::cpp::Gate * +PageDisplay::inq_Get_ReFinder() const +{ + return &Env().Gate(); +} + +void +PageDisplay::RecursiveWrite_NamespaceLink( const ary::cpp::Namespace * i_pNamespace ) +{ + if ( i_pNamespace == 0 ) + { + return; + } + else if (NOT i_pNamespace->Owner().IsValid()) + { // Global namespace: + StreamLock sNspDir(50); + CurOut() + >> *new Link( PathPerRoot(Env(), + sNspDir() << C_sDIR_NamespacesCpp + << "/" + << C_sHFN_Namespace + << c_str) ) + << new xml::AnAttribute( "alt", C_sHFTitle_GlobalNamespaceCpp ) + >> *new html::Font + << new html::SizeAttr("+1") + >> *new html::Bold + << "::"; + CurOut() + << " "; + return; + } + else + { + RecursiveWrite_NamespaceLink( i_pNamespace->Parent() ); + } + + uintt nLevelDistance = Env().Depth() - ( i_pNamespace->Depth() + 1 ); + csv_assert( nLevelDistance < 100 ); + CurOut() + >> *new Link( PathPerLevelsUp(nLevelDistance, C_sHFN_Namespace) ) + << new xml::AnAttribute( "alt", C_sHFTypeTitle_Namespace) + >> *new html::Font + << new html::SizeAttr("+1") + >> *new html::Bold + << i_pNamespace->LocalName(); + CurOut() + >> *new html::Font + << new html::SizeAttr("+1") + << " :: "; +} + +void +PageDisplay::RecursiveWrite_ClassLink( const ary::cpp::Class * i_pClass, + uintt i_nLevelDistance ) +{ + if ( i_pClass == 0 ) + return; + + if ( i_pClass->Protection() != ary::cpp::PROTECT_global ) + { + RecursiveWrite_ClassLink( + dynamic_cast< const ary::cpp::Class* >( + Env().Gate().Ces().Search_Ce(i_pClass->Owner())), + i_nLevelDistance + 1 ); + } + + CurOut() + >> *new Link( Path2Class(i_nLevelDistance, i_pClass->LocalName()) ) + << new html::ClassAttr("nqclass") + << i_pClass->LocalName() + << " :: "; +} + +void +PageDisplay::SetupFileOnCurEnv( const char * i_sTitle ) +{ + File().SetLocation( Env().CurPath(), Env().Depth() ); + File().SetTitle( i_sTitle ); + File().SetCopyright( Env().Layout().CopyrightText() ); + File().EmptyBody(); + + // This sets CurOut() to the contents of <body></body> + // in File() : + Easy().Enter( File().Body() ); +} + +void +PageDisplay::Write_NavBar_Enum( const ary::cpp::Enum & i_rData ) +{ + NavigationBar aNavi( Env(), i_rData ); + aNavi.MakeSubRow("List of"); + aNavi.AddItem( C_sTitle_EnumValues, C_sLabel_EnumValues, true ); + aNavi.Write( CurOut(), true ); + + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Write_TopArea_Enum( const ary::cpp::Enum & i_rData ) +{ + Write_NameChainWithLinks( i_rData ); + + adcdisp::PageTitle_Std fTitle; + fTitle( CurOut(), C_sHFTypeTitle_Enum, i_rData.LocalName() ); + + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Write_DocuArea_Enum( const ary::cpp::Enum & i_rData ) +{ + Docu_Display aDocuShow( Env() ); + + aDocuShow.Assign_Out(CurOut()); + aDocuShow.Process(i_rData.Docu()); + aDocuShow.Unassign_Out(); + + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Write_ChildList_Enum( const ary::cpp::Enum & i_rData ) +{ + bool bChildrenExist = false; + ChildList_Display::Area_Result + aResult( bChildrenExist, CurOut() ); + + ChildList_Display aDisplay(Env(), i_rData); + aDisplay.Run_Simple( aResult, + ary::cpp::Enum::SLOT_Values, + C_sLabel_EnumValues, + C_sTitle_EnumValues ); + + if (NOT bChildrenExist) + CurOut() >> *new html::Headline(4) << "This enum has no values."; + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Write_NavBar_Typedef( const ary::cpp::Typedef & i_rData ) +{ + NavigationBar aNavi( Env(), i_rData ); + aNavi.Write( CurOut(), true ); + + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Write_TopArea_Typedef( const ary::cpp::Typedef & i_rData ) +{ + Write_NameChainWithLinks( i_rData ); + + adcdisp::PageTitle_Std fTitle; + fTitle( CurOut(), C_sHFTypeTitle_Typedef, i_rData.LocalName() ); + + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Write_DocuArea_Typedef( const ary::cpp::Typedef & i_rData ) +{ + adcdisp::ExplanationList aDef( CurOut() ); + aDef.AddEntry("Definition:"); + xml::Element & rDef = aDef.Def(); + + ary::cpp::Type_id + nDefiningType = i_rData.DescribingType(); + + const ary::cpp::CodeEntity * + pRelatedCe = Env().Gate().Search_RelatedCe(nDefiningType); + if ( pRelatedCe != 0 ) + { + const char * sTypeKey = Get_TypeKey(*pRelatedCe); + if ( NOT csv::no_str(sTypeKey) ) + rDef << sTypeKey << " "; + } + + dshelp::Get_LinkedTypeText( rDef, Env(), nDefiningType ); + + Docu_Display aDocuShow( Env() ); + + aDocuShow.Assign_Out(CurOut()); + aDocuShow.Process(i_rData.Docu()); + aDocuShow.Unassign_Out(); + + CurOut() << new HorizontalLine; +} + +void +PageDisplay::Create_IndexFile( int i_nLetter ) +{ + static char aLetters[C_nNrOfIndexLetters+1] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_"; + csv_assert( 0 <= i_nLetter AND i_nLetter < C_nNrOfIndexLetters ); + + char cCurLetter = aLetters[i_nLetter]; + Env().SetFile_Index( cCurLetter ); + + static char sIndexFileTitle[] = "Global Index X"; + const int nPositionOfLetterInTitle = 13; + sIndexFileTitle[nPositionOfLetterInTitle] = cCurLetter; + SetupFileOnCurEnv( sIndexFileTitle ); + + Make_SpecialPage( new PageMaker_Index(*this, cCurLetter ) ); + + Create_File(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/pagemake.hxx b/autodoc/source/display/html/pagemake.hxx new file mode 100644 index 000000000000..72cdbe56e739 --- /dev/null +++ b/autodoc/source/display/html/pagemake.hxx @@ -0,0 +1,167 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_PAGEMAKE_HXX +#define ADC_DISPLAY_HTML_PAGEMAKE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <ary/ary_disp.hxx> +#include <cosv/tpl/processor.hxx> +#include "hdimpl.hxx" + // COMPONENTS + // PARAMETERS +#include <ary/cpp/c_namesp.hxx> + +namespace ary +{ + namespace cpp + { + class Namespace; + class Class; + class Enum; + class Typedef; + } + namespace loc + { + class File; + } +} + + +class OuputPage_Environment; +class HtmlDocuFile; + + + +class PageDisplay : public ary::Display, + public csv::ConstProcessor<ary::cpp::Class>, + public csv::ConstProcessor<ary::cpp::Enum>, + public csv::ConstProcessor<ary::cpp::Typedef>, + public HtmlDisplay_Impl +{ + public: + PageDisplay( + OuputPage_Environment & + io_rEnv ); + virtual ~PageDisplay(); + + void Create_OverviewFile(); + void Create_AllDefsFile(); + void Create_IndexFiles(); + void Create_HelpFile(); + + void Create_NamespaceFile(); + + void Setup_OperationsFile_for( + const ary::loc::File & + i_rFile ); + void Setup_OperationsFile_for( + const ary::cpp::Class & + i_rClass ); + void Setup_DataFile_for( + const ary::loc::File & + i_rFile ); + void Setup_DataFile_for( + const ary::cpp::Class & + i_rClass ); + /// Used with Setup_OperatonsFile_for(). + void Create_File(); + + + // Interface for Children of SpecializedPageMaker: + void Write_NameChainWithLinks( + const ary::cpp::CodeEntity & + i_rCe ); + + // Necessary, to call Process() on this class. + using csv::ConstProcessor<ary::cpp::Class>::Process; + using csv::ConstProcessor<ary::cpp::Enum>::Process; + using csv::ConstProcessor<ary::cpp::Typedef>::Process; + + private: + // Interface csv::ConstProcessor<>: + virtual void do_Process( + const ary::cpp::Class & + i_rData ); + virtual void do_Process( + const ary::cpp::Enum & + i_rData ); + virtual void do_Process( + const ary::cpp::Typedef & + i_rData ); + // Interface ary::cpp::Display: + virtual const ary::cpp::Gate * + inq_Get_ReFinder() const; + // Locals + HtmlDocuFile & File() { return *pMyFile; } + void RecursiveWrite_NamespaceLink( + const ary::cpp::Namespace * + i_pNamespace ); + void RecursiveWrite_ClassLink( + const ary::cpp::Class * + i_pClass, + uintt i_nLevelDistance ); + void SetupFileOnCurEnv( + const char * i_sTitle ); + void Write_NavBar_Enum( + const ary::cpp::Enum & + i_rData ); + void Write_TopArea_Enum( + const ary::cpp::Enum & + i_rData ); + void Write_DocuArea_Enum( + const ary::cpp::Enum & + i_rData ); + void Write_ChildList_Enum( + const ary::cpp::Enum & + i_rData ); + void Write_NavBar_Typedef( + const ary::cpp::Typedef & + i_rData ); + void Write_TopArea_Typedef( + const ary::cpp::Typedef & + i_rData ); + void Write_DocuArea_Typedef( + const ary::cpp::Typedef & + i_rData ); + void Create_IndexFile( + int i_nLetter ); + + // DATA + Dyn<HtmlDocuFile> pMyFile; +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/pm_aldef.cxx b/autodoc/source/display/html/pm_aldef.cxx new file mode 100644 index 000000000000..7669ba4ef3a7 --- /dev/null +++ b/autodoc/source/display/html/pm_aldef.cxx @@ -0,0 +1,248 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "pm_aldef.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_define.hxx> +#include <ary/cpp/c_macro.hxx> +#include <ary/cpp/cp_def.hxx> +#include <ary/loc/loc_file.hxx> +#include <ary/loc/locp_le.hxx> +#include <ary/getncast.hxx> +#include "hd_docu.hxx" +#include "html_kit.hxx" +#include "navibar.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" +#include "strconst.hxx" + + +using namespace csi; +using csi::html::HorizontalLine; +using csi::html::Link; +using csi::html::Label; +using csi::html::AlignAttr; + + + +PageMaker_AllDefs::PageMaker_AllDefs( PageDisplay & io_rPage ) + : SpecializedPageMaker(io_rPage), + pDocuDisplay( new Docu_Display(io_rPage.Env()) ), + pNavi(0) +{ +} + +PageMaker_AllDefs::~PageMaker_AllDefs() +{ +} + +void +PageMaker_AllDefs::MakePage() +{ + pNavi = new NavigationBar( Env(), NavigationBar::LOC_AllDefs ); + Write_NavBar(); + + Write_TopArea(); + + Write_DefinesList(); + Write_MacrosList(); + + pNavi->Write_SubRows(); +} + +void +PageMaker_AllDefs::Write_NavBar() +{ + pNavi->MakeSubRow( "" ); + pNavi->AddItem( "Defines", "defines", true ); + pNavi->AddItem( "Macros", "macros", true ); + pNavi->Write( CurOut() ); + CurOut() << new HorizontalLine; +} + +void +PageMaker_AllDefs::Write_TopArea() +{ + adcdisp::PageTitle_Std fTitle; + fTitle( CurOut(), "Defines and ", "Macros" ); + + CurOut() << new HorizontalLine; +} + +void +PageMaker_AllDefs::Write_DocuArea() +{ + // Not needed. +} + +void +PageMaker_AllDefs::Write_DefinesList() +{ + CurOut() + << new html::LineBreak + << new html::LineBreak + >> *new xml::AnElement("div") + << new html::ClassAttr("define") + >> *new html::Label("defines") + >> *new html::Headline(3) + << "Defines"; + + ary::cpp::DefsResultList + aAllDefines = Env().Gate().Defs().AllDefines(); + ary::cpp::DefsConstIterator + itEnd = aAllDefines.end(); + + if (aAllDefines.begin() != itEnd) + { + for ( ary::cpp::DefsConstIterator it = aAllDefines.begin(); + it != itEnd; + ++it ) + { + Write_Define(*it); + } + } + else + { + CurOut() << "None."; + } + + CurOut() << new HorizontalLine; +} + +void +PageMaker_AllDefs::Write_MacrosList() + +{ + CurOut() + << new html::LineBreak + << new html::LineBreak + >> *new xml::AnElement("div") + << new html::ClassAttr("define") + >> *new html::Label("macros") + >> *new html::Headline(3) + << "Macros"; + + ary::cpp::DefsResultList + aAllMacros = Env().Gate().Defs().AllMacros(); + ary::cpp::DefsConstIterator + itEnd = aAllMacros.end(); + + if (aAllMacros.begin() != itEnd) + { + for ( ary::cpp::DefsConstIterator it = aAllMacros.begin(); + it != itEnd; + ++it ) + { + Write_Macro(*it); + } + } + else + { + CurOut() << "None."; + } + + CurOut() << new HorizontalLine; +} + +void +PageMaker_AllDefs::Write_Define(De_id i_nId) +{ + csv_assert( ary::is_type<ary::cpp::Define>( Env().Gate().Defs().Find_Def(i_nId)) ); + const ary::cpp::Define & + rDef = static_cast< const ary::cpp::Define& >( Env().Gate().Defs().Find_Def(i_nId) ); + + CurOut() << new html::HorizontalLine; + + adcdisp::ExplanationList aDocu( CurOut(), true ); + aDocu.AddEntry(); + + aDocu.Term() + >> *new html::Label( rDef.LocalName() ) + << " "; + aDocu.Term() + << rDef.LocalName(); + + Write_DefsDocu( aDocu.Def(), rDef ); +} + +void +PageMaker_AllDefs::Write_Macro(De_id i_nId) +{ + csv_assert( Env().Gate().Defs().Find_Def(i_nId).AryClass() == ary::cpp::Macro::class_id ); + const ary::cpp::Macro & + rDef = static_cast< const ary::cpp::Macro& >( Env().Gate().Defs().Find_Def(i_nId) ); + + CurOut() << new html::HorizontalLine; + + adcdisp::ExplanationList aDocu( CurOut(), true ); + aDocu.AddEntry(); + + aDocu.Term() + >> *new html::Label( rDef.LocalName() ) + << " "; + aDocu.Term() + << rDef.LocalName() + << "("; + WriteOut_TokenList( aDocu.Term(), rDef.Params(), ", " ); + aDocu.Term() + << ")"; + + Write_DefsDocu( aDocu.Def(), rDef ); +} + + +void +PageMaker_AllDefs::Write_DefsDocu( csi::xml::Element & o_rOut, + const ary::cpp::DefineEntity & i_rTextReplacement ) +{ + if ( i_rTextReplacement.DefinitionText().size() > 0 ) + { + EraseLeadingSpace( *const_cast< String * >( + &(*i_rTextReplacement.DefinitionText().begin()) + ) ); + } + + adcdisp::ExplanationTable rList( o_rOut ); + + rList.AddEntry( "Defined As" ); + WriteOut_TokenList( rList.Def(), i_rTextReplacement.DefinitionText(), " " ); + + const ary::loc::File & + rFile = Env().Gate().Locations().Find_File( i_rTextReplacement.Location() ); + rList.AddEntry( "In File" ); + rList.Def() << rFile.LocalName(); + + ShowDocu_On( o_rOut, *pDocuDisplay, i_rTextReplacement ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/pm_aldef.hxx b/autodoc/source/display/html/pm_aldef.hxx new file mode 100644 index 000000000000..8f01cbb7a28a --- /dev/null +++ b/autodoc/source/display/html/pm_aldef.hxx @@ -0,0 +1,91 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_PM_ALDEF_HXX +#define ADC_DISPLAY_HTML_PM_ALDEF_HXX + +// BASE CLASSES +#include "pm_base.hxx" +// USED SERVICES +#include <ary/cpp/c_types4cpp.hxx> +using ary::cpp::De_id; + +namespace ary +{ + namespace cpp + { + class DefineEntity; + } +} + +class Docu_Display; +class NavigationBar; + + + + + +class PageMaker_AllDefs : public SpecializedPageMaker +{ + public: + PageMaker_AllDefs( + PageDisplay & io_rPage ); + + virtual ~PageMaker_AllDefs(); + + virtual void MakePage(); + + private: + typedef std::vector<De_id> List_Ids; + typedef List_Ids::const_iterator ids_iterator; + + virtual void Write_NavBar(); + virtual void Write_TopArea(); + virtual void Write_DocuArea(); + virtual void Write_DefinesList(); + virtual void Write_MacrosList(); + void Write_Define( + De_id i_nId ); + void Write_Macro( + De_id i_nId ); + void Write_DefsDocu( + csi::xml::Element & o_rOut, + const ary::cpp::DefineEntity & + i_rTextReplacement ); + + // DATA + Dyn<Docu_Display> pDocuDisplay; + Dyn<NavigationBar> pNavi; +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/pm_base.cxx b/autodoc/source/display/html/pm_base.cxx new file mode 100644 index 000000000000..ae045bd3b1de --- /dev/null +++ b/autodoc/source/display/html/pm_base.cxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "pm_base.hxx" + + +// NOT FULLY DEFINED SERVICES +#include "opageenv.hxx" +#include "pagemake.hxx" + + +//******************** SpecializedPageMaker *********************// + +SpecializedPageMaker::SpecializedPageMaker( PageDisplay & io_rPage ) + : pEnv( &io_rPage.Env() ), + pCurOut( &io_rPage.CurOut() ), + pPage( &io_rPage ) +{ +} + +void +SpecializedPageMaker::Write_NavBar() +{ + // Dummy +} + +void +SpecializedPageMaker::Write_TopArea() +{ + // Dummy +} + +void +SpecializedPageMaker::Write_DocuArea() +{ + // Dummy +} + +//void +//SpecializedPageMaker::Write_ChildList( ary::SlotAccessId , +// const char * , +// const char * ) +//{ +// // Dummy +//} + +csi::xml::Element & +SpecializedPageMaker::CurOut() +{ + return Page().CurOut(); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/pm_base.hxx b/autodoc/source/display/html/pm_base.hxx new file mode 100644 index 000000000000..2afa8a77cdfc --- /dev/null +++ b/autodoc/source/display/html/pm_base.hxx @@ -0,0 +1,90 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_PM_BASE_HXX +#define ADC_DISPLAY_PM_BASE_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +#include "hdimpl.hxx" + + + +class OuputPage_Environment; +namespace csi +{ + namespace xml + { + class Element; + } +} +class PageDisplay; + + +/** Interface for making a special kind of HTML-Page +*/ +class SpecializedPageMaker +{ + public: + virtual ~SpecializedPageMaker() {} + + virtual void MakePage() = 0; + + virtual void Write_NavBar(); + virtual void Write_TopArea(); + virtual void Write_DocuArea(); +// virtual void Write_ChildList( +// ary::SlotAccessId i_nSlot, +// const char * i_nListTitle, +// const char * i_nLabel ); + + protected: + SpecializedPageMaker( + PageDisplay & io_rPage ); + + OuputPage_Environment & + Env() const { return *pEnv; } + csi::xml::Element & CurOut(); + PageDisplay & Page() { return *pPage; } + + private: + OuputPage_Environment * + pEnv; + csi::xml::Element * pCurOut; + PageDisplay * pPage; +}; + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/pm_class.cxx b/autodoc/source/display/html/pm_class.cxx new file mode 100644 index 000000000000..16c4fe9a9aea --- /dev/null +++ b/autodoc/source/display/html/pm_class.cxx @@ -0,0 +1,813 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "pm_class.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/cp_ce.hxx> +#include <ary/loc/loc_file.hxx> +#include <ary/loc/locp_le.hxx> +#include <ary/getncast.hxx> +#include "hd_chlst.hxx" +#include "hd_docu.hxx" +#include "hdimpl.hxx" +#include "html_kit.hxx" +#include "navibar.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" +#include "strconst.hxx" + +using namespace adcdisp; + +using namespace csi; +using csi::html::HorizontalLine; +using csi::html::LineBreak; +using csi::html::Link; +using csi::html::Table; +using csi::html::TableRow; +using csi::html::TableCell; + +using ary::cpp::CesConstIterator; +using ary::doc::OldCppDocu; + +const char * const C_sTitle_InnerClasses = "Classes"; +const char * const C_sTitle_InnerStructs = "Structs"; +const char * const C_sTitle_InnerUnions = "Unions"; +const char * const C_sTitle_Methods = "Methods"; +const char * const C_sTitle_StaticMethods = "Static Methods"; +const char * const C_sTitle_Data = "Data"; +const char * const C_sTitle_StaticData = "Static Data"; + +const char * const C_sLabel_StaticOperations = "static_ops"; +const char * const C_sLabel_StaticVariables = "static_vars"; + +const char * const C_sTitlePublic = "Public Members"; +const char * const C_sTitleProtected = "Protected Members"; +const char * const C_sTitlePrivate = "Private Members"; +const char * const C_sMprTitles[3] = { C_sTitlePublic, + C_sTitleProtected, + C_sTitlePrivate + }; +const char * const C_sSummaryTitlePublic = "Public Members"; +const char * const C_sSummaryTitleProtected = "Protected Members"; +const char * const C_sSummaryTitlePrivate = "Private Members"; +const char * + C_sMprSummaryTitles[3] = + { C_sSummaryTitlePublic, C_sSummaryTitleProtected, C_sSummaryTitlePrivate }; +const char * + C_sMprPrefixes[3] = + { "publ_", "prot_", "priv_" }; +const char * + C_sSummaryItems_Titles[PageMaker_Class::cl_MAX] = + { C_sTitle_InnerClasses, C_sTitle_InnerStructs, C_sTitle_InnerUnions, + C_sTitle_Enums, C_sTitle_Typedefs, + C_sTitle_Methods, C_sTitle_StaticMethods, C_sTitle_Data, C_sTitle_StaticData }; +const char * + C_sSummaryItems_Labels[PageMaker_Class::cl_MAX] = + { C_sLabel_Classes, C_sLabel_Structs, C_sLabel_Unions, + C_sLabel_Enums, C_sLabel_Typedefs, + C_sLabel_Operations, C_sLabel_StaticOperations, + C_sLabel_Variables, C_sLabel_StaticVariables }; + + +const ary::cpp::E_Protection + aProt[3] = { ary::cpp::PROTECT_public, + ary::cpp::PROTECT_protected, + ary::cpp::PROTECT_private }; + + +PageMaker_Class::PageMaker_Class( PageDisplay & io_rPage, + const ary::cpp::Class & i_rClass ) + : SpecializedPageMaker(io_rPage), + pMe( &i_rClass ), + pChildDisplay( new ChildList_Display(io_rPage.Env(), i_rClass) ), + pNavi(0) + // pProtectionArea, + // bChildLists_Exist +{ + int i_max = 3 * cl_MAX; + for (int i = 0; i < i_max; i++) + { + bChildLists_Exist[i] = false; + } // end for +} + +PageMaker_Class::~PageMaker_Class() +{ +} + +void +PageMaker_Class::MakePage() +{ + pNavi = new NavigationBar( Env(), Me() ); + + Write_NavBar(); + Write_TopArea(); + Write_DocuArea(); + Write_ChildLists(); + + pNavi->Write_SubRows(); + pNavi = 0; +} + +void +PageMaker_Class::Write_NavBar() +{ + NavigationBar aNavi( Env(), Me() ); + pNavi->Write( CurOut() ); + CurOut() << new HorizontalLine; +} + +inline bool +IsInterface(const ary::doc::Documentation & i_doc) +{ + const OldCppDocu * + doc = Get_CppDocu(i_doc); + return doc != 0 + ? doc->IsInterface() + : false; +} + +void +PageMaker_Class::Write_TopArea() +{ + TemplateClause fTemplateClause; + PageTitle_Std fTitle; + + Page().Write_NameChainWithLinks( Me() ); + + fTemplateClause( CurOut(), Me().TemplateParameters() ); + fTitle( CurOut(), Get_ClassTypeKey(Me()), Me().LocalName() ); + + CurOut() << new HorizontalLine; + + Write_BaseHierarchy(); + Write_DerivedList(); + + CurOut() << new LineBreak; + + adcdisp::FlagTable + aFlags( CurOut(), 4 ); + aFlags.SetColumn( 0, "virtual", + Me().Virtuality() != ary::cpp::VIRTUAL_none ); + aFlags.SetColumn( 1, "abstract", + Me().Virtuality() == ary::cpp::VIRTUAL_abstract ); + aFlags.SetColumn( 2, "interface", + IsInterface(Me().Docu()) + OR Me().Virtuality() == ary::cpp::VIRTUAL_abstract ); + aFlags.SetColumn( 3, "template", + Me().TemplateParameters().size() > 0 ); +} + +void +PageMaker_Class::Write_DocuArea() +{ + Docu_Display aDocuShow( Env() ); + + aDocuShow.Assign_Out(CurOut()); + Me().Accept( aDocuShow ); + aDocuShow.Unassign_Out(); + + ary::loc::File & + rFile = Env().Gate().Locations().Find_File( Me().Location() ); + + adcdisp::ExplanationList + aFileText( CurOut() ); + aFileText.AddEntry("File"); + aFileText.Def() + << rFile.LocalName(); + + CurOut() << new HorizontalLine; +} + +void +PageMaker_Class::Write_ChildLists() +{ + int i_max = 3 * cl_MAX; + for (int i = 0; i < i_max; i++) + { + bChildLists_Exist[i] = false; + } // end for + + csi::html::DefListDefinition & + rPublic = Setup_MemberSegment_Out( mp_public ); + csi::html::DefListDefinition & + rProtected = Setup_MemberSegment_Out( mp_protected ); + csi::html::DefListDefinition & + rPrivate = Setup_MemberSegment_Out( mp_private ); + + Write_ChildList_forClasses( rPublic, + rProtected, + rPrivate, + C_sLabel_Classes, + C_sTitle_InnerClasses, + ary::cpp::CK_class ); + Write_ChildList_forClasses( rPublic, + rProtected, + rPrivate, + C_sLabel_Structs, + C_sTitle_InnerStructs, + ary::cpp::CK_struct ); + Write_ChildList_forClasses( rPublic, + rProtected, + rPrivate, + C_sLabel_Unions, + C_sTitle_InnerUnions, + ary::cpp::CK_union ); + + Write_ChildList( ary::cpp::Class::SLOT_Enums, + cl_Enums, + C_sLabel_Enums, + C_sTitle_Enums, + rPublic, + rProtected, + rPrivate ); + Write_ChildList( ary::cpp::Class::SLOT_Typedefs, + cl_Typedefs, + C_sLabel_Typedefs, + C_sTitle_Typedefs, + rPublic, + rProtected, + rPrivate ); + + Write_ChildList( ary::cpp::Class::SLOT_Operations, + cl_Operations, + C_sLabel_Operations, + C_sTitle_Methods, + rPublic, + rProtected, + rPrivate ); + Write_ChildList( ary::cpp::Class::SLOT_StaticOperations, + cl_StaticOperations, + C_sLabel_StaticOperations, + C_sTitle_StaticMethods, + rPublic, + rProtected, + rPrivate ); + Write_ChildList( ary::cpp::Class::SLOT_Data, + cl_Data, + C_sLabel_Variables, + C_sTitle_Data, + rPublic, + rProtected, + rPrivate ); + Write_ChildList( ary::cpp::Class::SLOT_StaticData, + cl_StaticData, + C_sLabel_StaticVariables, + C_sTitle_StaticData, + rPublic, + rProtected, + rPrivate ); + + Create_NaviSubRow(mp_public); // Also puts out or deletes pPublic. + Create_NaviSubRow(mp_protected); // Also puts out or deletes pProtected. + Create_NaviSubRow(mp_private); // Also puts out or deletes pPrivate. +} + +void +PageMaker_Class::Write_ChildList( ary::SlotAccessId i_nSlot, + E_ChidList i_eChildListIndex, + const char * i_sLabel, + const char * i_sListTitle, + csi::xml::Element & o_rPublic, + csi::xml::Element & o_rProtected, + csi::xml::Element & o_rPrivate ) + +{ + bool bPublic_ChildrenExist = false; + bool bProtected_ChildrenExist = false; + bool bPrivate_ChildrenExist = false; + + ChildList_Display::Area_Result + aPublic_Result( bPublic_ChildrenExist, o_rPublic ); + ChildList_Display::Area_Result + aProtected_Result( bProtected_ChildrenExist, o_rProtected ); + ChildList_Display::Area_Result + aPrivate_Result( bPrivate_ChildrenExist, o_rPrivate ); + + String sLabelPublic = ChildListLabel(i_sLabel, mp_public); + String sLabelProtected = ChildListLabel(i_sLabel, mp_protected); + String sLabelPrivate = ChildListLabel(i_sLabel, mp_private); + + pChildDisplay->Run_Members( aPublic_Result, + aProtected_Result, + aPrivate_Result, + i_nSlot, + sLabelPublic, + sLabelProtected, + sLabelPrivate, + i_sListTitle ); + + bChildLists_Exist[i_eChildListIndex] + = bPublic_ChildrenExist; + bChildLists_Exist[i_eChildListIndex + cl_MAX] + = bProtected_ChildrenExist; + bChildLists_Exist[i_eChildListIndex + 2*cl_MAX] + = bPrivate_ChildrenExist; + + if (bPublic_ChildrenExist) + o_rPublic << new HorizontalLine; + if (bProtected_ChildrenExist) + o_rProtected << new HorizontalLine; + if (bPrivate_ChildrenExist) + o_rPrivate << new HorizontalLine; +} + +void +PageMaker_Class::Write_ChildList_forClasses( csi::xml::Element & o_rPublic, + csi::xml::Element & o_rProtected, + csi::xml::Element & o_rPrivate, + const char * i_sLabel, + const char * i_sListTitle, + ary::cpp::E_ClassKey i_eFilter ) +{ + bool bPublic_ChildrenExist = false; + bool bProtected_ChildrenExist = false; + bool bPrivate_ChildrenExist = false; + + ChildList_Display::Area_Result + aPublic_Result( bPublic_ChildrenExist, o_rPublic ); + ChildList_Display::Area_Result + aProtected_Result( bProtected_ChildrenExist, o_rProtected ); + ChildList_Display::Area_Result + aPrivate_Result( bPrivate_ChildrenExist, o_rPrivate ); + + String sLabelPublic = ChildListLabel(i_sLabel, mp_public); + String sLabelProtected = ChildListLabel(i_sLabel, mp_protected); + String sLabelPrivate = ChildListLabel(i_sLabel, mp_private); + + pChildDisplay->Run_MemberClasses( aPublic_Result, + aProtected_Result, + aPrivate_Result, + ary::cpp::Class::SLOT_NestedClasses, + sLabelPublic, + sLabelProtected, + sLabelPrivate, + i_sListTitle, + i_eFilter ); + + bChildLists_Exist[int(cl_NestedClasses)+int(i_eFilter)] + = bPublic_ChildrenExist; + bChildLists_Exist[int(cl_NestedClasses)+int(i_eFilter) + cl_MAX] + = bProtected_ChildrenExist; + bChildLists_Exist[int(cl_NestedClasses)+int(i_eFilter) + 2*cl_MAX] + = bPrivate_ChildrenExist; + + if (bPublic_ChildrenExist) + o_rPublic << new HorizontalLine; + if (bProtected_ChildrenExist) + o_rProtected << new HorizontalLine; + if (bPrivate_ChildrenExist) + o_rPrivate << new HorizontalLine; +} + +const char * +PageMaker_Class::ChildListLabel( const char * i_sLabel, E_MemberProtection i_eMpr ) +{ + static char sResult[100]; + strcpy( sResult, C_sMprPrefixes[i_eMpr] ); // SAFE STRCPY (#100211# - checked) + strcat( sResult, i_sLabel ); // SAFE STRCAT (#100211# - checked) + return sResult; +} + +csi::html::DefListDefinition & +PageMaker_Class::Setup_MemberSegment_Out( E_MemberProtection i_eMpr ) +{ + html::DefList * pDefList = new html::DefList; + pProtectionArea[i_eMpr] = pDefList; + + pDefList->AddTerm() + << new html::ClassAttr("subtitle") + >> *new html::Label( C_sMprPrefixes[i_eMpr] ) + >> *new html::Headline(3) + << C_sMprTitles[i_eMpr]; + return pDefList->AddDefinition(); +} + +void +PageMaker_Class::Create_NaviSubRow( E_MemberProtection i_eMpr ) +{ + int nIndexAdd = int(cl_MAX) * int(i_eMpr); + + bool bEmpty = true; + for (int e = 0; e < cl_MAX; e++) + { + if ( bChildLists_Exist[e + nIndexAdd] ) + { + bEmpty = false; + break; + } + } // end for + if (bEmpty) + { + pProtectionArea[i_eMpr] = 0; + return; + } + else // + { + CurOut() << pProtectionArea[i_eMpr].Release(); + } // endif + + pNavi->MakeSubRow( C_sMprSummaryTitles[i_eMpr] ); + for (int i = 0; i < cl_MAX; i++) + { + pNavi->AddItem( C_sSummaryItems_Titles[i], + ChildListLabel( C_sSummaryItems_Labels[i], i_eMpr ), + bChildLists_Exist[i+nIndexAdd] ); + } // end for +} + +void +PageMaker_Class::Write_DerivedList() +{ + adcdisp::ExplanationList + aDeriveds( CurOut() ); + aDeriveds.AddEntry( "Known Derived Classes" ); + + if ( Me().KnownDerivatives().Size() == 0 ) + { + aDeriveds.Def() << "None."; + return; + } + + typedef ary::List_Rid RidList; + + CesConstIterator + itEnd = Me().KnownDerivatives().End(); + for ( CesConstIterator it = Me().KnownDerivatives().Begin(); + it != itEnd; + ++it ) + { + const ary::cpp::CodeEntity & + rCe = Env().Gate().Ces().Find_Ce(*it); + + aDeriveds.Def() + >> *new html::Link( Link2Ce(Env(),rCe) ) + << rCe.LocalName(); + aDeriveds.Def() + << new html::LineBreak; + } // end for +} + + +// ============== Creating a classes base hierarchy ====================== // + + +namespace +{ + +class Node +{ + public: + Node( + const ary::cpp::Class & + i_rClass, + ary::cpp::Type_id i_nClassType, + const ary::cpp::Gate & + i_rGate, + intt i_nPositionOffset, + Node * io_pDerived = 0, + ary::cpp::E_Protection + i_eProtection = ary::cpp::PROTECT_global, + bool i_bVirtual = false ); + ~Node(); + + void FillPositionList( + std::vector< const Node* > & + o_rPositionList ) const; + void Write2( + csi::xml::Element & o_rOut, + const OuputPage_Environment & + i_rEnv ) const; + + intt BaseCount() const { return nCountBases; } + intt Position() const { return nPosition; } + int Xpos() const { return 3*Position(); } + int Ypos() const { return 2*Position(); } + const Node * Derived() const { return pDerived; } + + private: + typedef std::vector< DYN Node* > BaseList; + + void IncrBaseCount(); + + // DATA + BaseList aBases; + intt nCountBases; + Node * pDerived; + + String sName; + const ary::cpp::Class * + pClass; + ary::cpp::Type_id nClassType; + ary::cpp::E_Protection + eProtection; + bool bVirtual; + + intt nPosition; +}; + +void WriteNodeHierarchy( + csi::xml::Element & o_rOut, + const OuputPage_Environment & + i_rEnv, + const Node & i_rClass ); + +const ary::cpp::Class * + HereFind_Class( + const ary::cpp::Gate & + i_rGate, + ary::cpp::Type_id i_nReferingTypeId ); + +} // anonymous namespace + +void +PageMaker_Class::Write_BaseHierarchy() +{ + adcdisp::ExplanationList aBases( CurOut() ); + aBases.AddEntry( "Base Classes" ); + + if ( Me().BaseClasses().size() == 0 ) + { + aBases.Def() << "None."; + } + else + { + Dyn< Node > + pBaseGraph( new Node(Me(), ary::cpp::Type_id(0), Env().Gate(), 0) ); + WriteNodeHierarchy( aBases.Def(), Env(), *pBaseGraph ); + } +} + + + +namespace +{ + +void +WriteNodeHierarchy( csi::xml::Element & o_rOut, + const OuputPage_Environment & i_rEnv, + const Node & i_rClass ) +{ + typedef const Node * NodePtr; + typedef std::vector<NodePtr> NodeList; + + NodeList aPositionList; + intt nSize = i_rClass.Position()+1; + aPositionList.reserve(nSize); + i_rClass.FillPositionList( aPositionList ); + + xml::Element & + rPre = o_rOut + >> *new xml::AnElement("pre") + << new html::StyleAttr("font-family:monospace;"); + + for ( int line = 0; line < nSize; ++line ) + { + char * sLine1 = new char[2 + line*5]; + char * sLine2 = new char[1 + line*5]; + *sLine1 = '\0'; + *sLine2 = '\0'; + + bool bBaseForThisLineReached = false; + for ( int col = 0; col < line; ++col ) + { + intt nDerivPos = aPositionList[col]->Derived()->Position(); + + if ( nDerivPos >= line ) + strcat(sLine1, " | "); + else + strcat(sLine1, " "); + + if ( nDerivPos > line ) + { + strcat(sLine2, " | "); + } + else if ( nDerivPos == line ) + { + if (bBaseForThisLineReached) + strcat(sLine2, "--+--"); + else + { + bBaseForThisLineReached = true; + strcat(sLine2, " +--"); + } + } + else // nDerivPos < line + { + if (bBaseForThisLineReached) + strcat(sLine2, "-----"); + else + strcat(sLine2, " "); + } + } // end for (col) + strcat(sLine1,"\n"); + rPre + << sLine1 + << sLine2; + delete [] sLine1; + delete [] sLine2; + + aPositionList[line]->Write2( rPre, i_rEnv ); + rPre << "\n"; + } // end for (line) +} + +const ary::cpp::Class * +HereFind_Class( const ary::cpp::Gate & i_rGate, + ary::cpp::Type_id i_nReferingTypeId ) +{ + const ary::cpp::CodeEntity * + pCe = i_rGate.Search_RelatedCe( i_nReferingTypeId ); + + if ( pCe != 0 ) + { + if ( ary::is_type<ary::cpp::Class>(*pCe) ) + { + return ary::ary_cast<ary::cpp::Class>(pCe); + } + else if ( ary::is_type<ary::cpp::Typedef>(*pCe) ) + { + const ary::cpp::Typedef * + pTydef = ary::ary_cast<ary::cpp::Typedef>(pCe); + return HereFind_Class( i_rGate, pTydef->DescribingType() ); + } + } + + static const ary::cpp::Class aClassNull_( "Base class not found", + ary::cpp::Ce_id(0), + ary::cpp::PROTECT_global, + ary::loc::Le_id(0), + ary::cpp::CK_class ); + return &aClassNull_; +} + + + +//********************* Node ***********************// + +Node::Node( const ary::cpp::Class & i_rClass, + ary::cpp::Type_id i_nClassType, + const ary::cpp::Gate & i_rGate, + intt i_nPositionOffset, + Node * io_pDerived, + ary::cpp::E_Protection i_eProtection, + bool i_bVirtual ) + : aBases(), + nCountBases(0), + pDerived(io_pDerived), + pClass(&i_rClass), + nClassType(i_nClassType), + eProtection(i_eProtection), + bVirtual(i_bVirtual), + nPosition(i_nPositionOffset) +{ + typedef ary::cpp::List_Bases BList; + + for ( BList::const_iterator it = i_rClass.BaseClasses().begin(); + it != i_rClass.BaseClasses().end(); + ++it ) + { + const ary::cpp::Class * + pBaseClass = HereFind_Class( i_rGate, (*it).nId ); + + Dyn<Node> + pBase( new Node(*pBaseClass, + (*it).nId, + i_rGate, + nPosition, + this, + (*it).eProtection, + (*it).eVirtuality == ary::cpp::VIRTUAL_virtual) + ); + IncrBaseCount(); + nPosition += pBase->BaseCount() + 1; + aBases.push_back( pBase.Release() ); + } // end for +} + +Node::~Node() +{ +} + +void +Node::FillPositionList( std::vector< const Node* > & o_rPositionList ) const +{ + for ( BaseList::const_iterator it = aBases.begin(); + it != aBases.end(); + ++it ) + { + (*it)->FillPositionList(o_rPositionList); + } // end for + + if( o_rPositionList.size() != uintt(Position()) ) + { + csv_assert(false); + } + o_rPositionList.push_back(this); +} + +void +Node::Write2( csi::xml::Element & o_rOut, + const OuputPage_Environment & i_rEnv ) const +{ + if ( Derived() == 0 ) + { + o_rOut + >> *new xml::AnElement("span") + << new html::ClassAttr("btself") + << pClass->LocalName(); + return; + } + + csi::xml::Element * + pOut = & ( o_rOut >> *new xml::AnElement("span") ); + switch ( eProtection ) + { + case ary::cpp::PROTECT_public: + if (bVirtual) + *pOut << new html::ClassAttr("btvpubl"); + else + *pOut << new html::ClassAttr("btpubl"); + break; + case ary::cpp::PROTECT_protected: + if (bVirtual) + *pOut << new html::ClassAttr("btvprot"); + else + *pOut << new html::ClassAttr("btprot"); + break; + case ary::cpp::PROTECT_private: + if (bVirtual) + *pOut << new html::ClassAttr("btvpriv"); + else + *pOut << new html::ClassAttr("btpriv"); + break; + default: // do nothing. + ; + } // end switch + + csi::xml::Element & rOut = *pOut; + + Get_LinkedTypeText( rOut, i_rEnv, nClassType, false ); + rOut << " ("; + if ( bVirtual ) + rOut << "virtual "; + switch ( eProtection ) + { + case ary::cpp::PROTECT_public: + rOut << "public)"; + break; + case ary::cpp::PROTECT_protected: + rOut << "protected)"; + break; + case ary::cpp::PROTECT_private: + rOut << "private)"; + break; + default: // do nothing. + ; + } // end switch +} + +void +Node::IncrBaseCount() +{ + ++nCountBases; + if (pDerived != 0) + pDerived->IncrBaseCount(); +} + + +} // anonymous namespace + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/pm_class.hxx b/autodoc/source/display/html/pm_class.hxx new file mode 100644 index 000000000000..71d9f604c602 --- /dev/null +++ b/autodoc/source/display/html/pm_class.hxx @@ -0,0 +1,133 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_PM_CLASS_HXX +#define ADC_DISPLAY_HTML_PM_CLASS_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "pm_base.hxx" + // COMPONENTS + // PARAMETERS + + +namespace ary +{ + namespace cpp + { + class Class; + } +} + +class ChildList_Display; +class NavigationBar; + + +class PageMaker_Class : public SpecializedPageMaker +{ + public: + enum E_ChidList + { + cl_NestedClasses = 0, + cl_NestedStructs, + cl_NestedUnions, + cl_Enums, + cl_Typedefs, + cl_Operations, + cl_StaticOperations, + cl_Data, + cl_StaticData, + cl_MAX + }; + PageMaker_Class( + PageDisplay & io_rPage, + const ary::cpp::Class & + i_rClass ); + + virtual ~PageMaker_Class(); + + virtual void MakePage(); + + private: + enum E_MemberProtection { mp_public = 0, mp_protected, mp_private, mp_MAX }; + + virtual void Write_NavBar(); + virtual void Write_TopArea(); + virtual void Write_DocuArea(); + virtual void Write_ChildList( + ary::SlotAccessId i_nSlot, + E_ChidList i_eChildListIndex, + const char * i_sLabel, + const char * i_sListTitle, + csi::xml::Element & o_rPublic, + csi::xml::Element & o_rProtected, + csi::xml::Element & o_rPrivate ); + void Write_ChildList_forClasses( + csi::xml::Element & o_rPublic, + csi::xml::Element & o_rProtected, + csi::xml::Element & o_rPrivate, + const char * i_sLabel, + const char * i_sListTitle, + ary::cpp::E_ClassKey + i_eFilter ); + void Write_ChildLists(); + static const char * ChildListLabel( + const char * i_sLabel, + E_MemberProtection i_eMpr ); + csi::html::DefListDefinition & + Setup_MemberSegment_Out( + E_MemberProtection i_eMpr ); + void Create_NaviSubRow( + E_MemberProtection i_eMpr ); + void Write_BaseHierarchy(); + void Write_DerivedList(); + + const ary::cpp::Class & + Me() const { return *pMe; } + // DATA + const ary::cpp::Class * + pMe; + Dyn<ChildList_Display> + pChildDisplay; + Dyn<NavigationBar> pNavi; + + Dyn<csi::xml::Element> + pProtectionArea[mp_MAX]; + + bool bChildLists_Exist[3*cl_MAX]; +}; + + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/pm_help.cxx b/autodoc/source/display/html/pm_help.cxx new file mode 100644 index 000000000000..80a832e05510 --- /dev/null +++ b/autodoc/source/display/html/pm_help.cxx @@ -0,0 +1,234 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "pm_help.hxx" + + +// NOT FULLY DEFINED SERVICES +#include "navibar.hxx" +#include "html_kit.hxx" + +using namespace csi; +using csi::html::Paragraph; +using csi::html::HorizontalLine; +using csi::html::Headline; +using csi::html::AlignAttr; +using csi::html::Bold; +using csi::html::Link; +using csi::html::Sbr; +using csi::html::LineBreak; +using csi::xml::Element; + + + +const String C_sHelpText( +"<div style=\"font-size:10pt;\">\n" +"<h3 class=\"help\">The Main Navigationbar</h3>\n" +"<p> On top of every page, there is a main navigationbar on a lightly coloured\n" +"background with the following items:<br>\n" +"</p>\n" +"<ul>\n" +" <li>Overview - the start page for this document,</li>\n" +" <li>Namespace - the lowest/deepest namespace of the language objects, described\n" +"on the current page,</li>\n" +" <li>Class - the class, struct or union, which owns the methods or data,\n" +"described on the current page,</li>\n" +" <li>Index - the global alphabetical index,</li>\n" +" <li>Help - this page.</li>\n" +"</ul>\n" +" Each item in this bar can be in three different states:<br>\n" +"<ul>\n" +" <li>Link - the item is valid and you can get there,</li>\n" +" <li>Simple - the item does not apply (if this page described a namespace,\n" +"there would be no owning class),</li>\n" +" <li>Reversed (white text on dark background) - this is the current page.</li>\n" +"</ul>\n" +"<h3 class=\"help\">Lower Navigationbars</h3>\n" +" Just below the main navigation bar, there may be zero to three lower navigationbars\n" +"on white background.<br>\n" +"<br>\n" +"Their items are dependent of the context, but they always link to paragraphs\n" +"on the same, current page.<br>\n" +"Available items appear as links. Unavailable items appear as simple text.<br>\n" +"\n" +"\n" +"<h3 class=\"help\">Namespace Descriptions</h3>\n" +"\n" +"<dl>\n" +"<dt class=\"simple\">Parent namespaces</dt>\n" +" </dl>\n" +" <dl>\n" +" <dd>In front of the namespace title, there is a linked list of the parent\n" +"namespaces. The global namespace is linked with the first \"::\",</dd>\n" +" <dd>the namespaces between the global and the current one are linked\n" +"by their names.<br>\n" +" </dd>\n" +" <dd> </dd>\n" +" </dl>\n" +"After the title, the documentation of the namespace follows (which is often\n" +"missing, because the namespace name may be self-explaining).<br>\n" +" <br>\n" +"Below are the lists of nested namspaces and of the classes, functions and\n" +"other program objects, that belong within this namespace.<br>\n" +"Each of this lists is accessible by the lower navigationbar on top of the\n" +"page.<br>\n" +"\n" +"<h3 class=\"help\">Class Descriptions</h3>\n" +"\n" +" <dl>\n" +" <dt class=\"simple\">Parent namespaces and classes</dt>\n" +" </dl>\n" +" <dl>\n" +" <dd>In front of the class title, there is a linked list of the\n" +"parent namespaces or classes. The global namespace is linked with the first\n" +"\"::\",</dd>\n" +" <dd>the namespaces between the global and the current one are\n" +"linked by their names. Enclosing classes are linked as well, but appear in\n" +"<span class=\"nqclass\">green</font> color. </dd>\n" +" <dd>So you see on the first glance, that this is a parent class,\n" +"no namespace.<br>\n" +" </dd>\n" +" <dd><br>\n" +" </dd>\n" +" </dl>\n" +"After the title, the bases and derivations of the class follow. <br>\n" +"Base classes are displayed as a graph. The text around base classes can appear\n" +"in different styles and colours:<br>\n" +"<ul>\n" +" <li><span class=\"btpubl\">Green</span> - public inherited,</li>\n" +" <li><span class=\"btprot\">Orange</span> - protected inherited,</li>\n" +" <li><span class=\"btpriv\">Red</span> - private inherited,</li>\n" +" <li><span class=\"btvpubl\">italic</span> - a (public inherited) virtual base class.</li>\n" +" <li><span class=\"btself\">Bold and black</span> without a link - the placeholder\n" +"for the currently described class.<br>\n" +" </li>\n" +"</ul>\n" +"There may be many derivations of a class, but only the known ones, which\n" +"are described within this document also, are listed.<br>\n" +"<br>\n" +"Below the derivations is a little table with some properties of the class:<br>\n" +"<ul>\n" +" <li>virtual - the class owns at least one virtual method,</li>\n" +" <li>abstract - the class owns at least one abstract method,</li>\n" +" <li>interface - the class may or may be not abstract,\n" +"but it is intended by its author to be used only as an interface and never\n" +"to be instantiated,</li>\n" +" <li>template - the class is a template class.<br>\n" +" </li>\n" +"</ul>\n" +"Next comes further documentation of the class itself.<br>\n" +"<br>\n" +"Lastly, there are listed all members of the class. Public members come first,\n" +"then protected, at last the private ones.<br>\n" +"All member lists are accessible by the lower navigationbars on top of the\n" +"page.<br>\n" +"\n" +"<h3 class=\"help\">Macros and Defines</h3>\n" +"In C++ and C, there are also program constructs, which do not fit into the\n" +"name tree, because they are #define'd: macros and definitions.<br>\n" +"These may be documented, too. Those comments you find <a href=\"def-all.html\">\n" +"here</a>\n" +" or from the \"Overview\" start page.\n" +"<h3 class=\"help\">Links to IDL-Documentation</h3>\n" +"Some types, which appear as links, may refer to classes, enums or other\n" +"entities, which are direct mappings of UNO-IDL entities.<br>\n" +"In those cases the link doesn't lead to the C++ class, enum or whatever,\n" +"but to the description of the IDL entity.\n" +"<h3 class=\"help\">How to Link From Extern Documents</h3>\n" +"If you wish to write an extern html document, which links to types within\n" +"this C++ reference, you can do so, if your links have the following format:<br>\n" +"<br>\n" +"<RootDirectory-of-this-Document>/names/<Namespace-A>/<Namespace-XY>/EnclosingClass-nn>/<TypePreFix>-<MyTypeName>.html<br>\n" +"<br>\n" +"<TypePreFix> can have the following values:<br>\n" +"<ul>\n" +"<li>c - class, struct or union</li>\n" +"<li>e - enum</li>\n" +"<li>t - typedef</li>\n" +"</ul>\n" +"If this document would be located in directory \"/doc/cpp/ref\", examples\n" +"would look like this:<br>\n" +"<br>\n" +"<a href=\"/doc/cpp/ref/names/osl/c-File.html\">class File</a><br>\n" +"<a href=\"/doc/cpp/ref/names/osl/FileBase/e-RC.html\">enum FileBase::RC</a><br>\n" +"<a href=\"/doc/cpp/ref/names/t-oslMutex.html\">typedef oslMutex</a><br>\n" +"<br>\n" +"Namespaces are described in the index.html file within their directory:<br>\n" +"<br>\n" +"<a href=\"/doc/cpp/ref/names/cppu/index.html\">namespace cppu</a><br>\n" +"</div>" ); + + + + +PageMaker_Help::PageMaker_Help( PageDisplay & io_rPage ) + : SpecializedPageMaker(io_rPage), + pNavi(0) +{ +} + +PageMaker_Help::~PageMaker_Help() +{ +} + +void +PageMaker_Help::MakePage() +{ + pNavi = new NavigationBar( Env(), NavigationBar::LOC_Help ); + Write_NavBar(); + + Write_TopArea(); + Write_DocuArea(); +} + +void +PageMaker_Help::Write_NavBar() +{ + pNavi->Write( CurOut() ); + CurOut() << new HorizontalLine; +} + +void +PageMaker_Help::Write_TopArea() +{ + adcdisp::PageTitle_Std fTitle; + fTitle( CurOut(), "How to Use", "this Reference Document" ); + + CurOut() << new xml::XmlCode(C_sHelpText); +} + +void +PageMaker_Help::Write_DocuArea() +{ + CurOut() << new HorizontalLine; +} + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/pm_help.hxx b/autodoc/source/display/html/pm_help.hxx new file mode 100644 index 000000000000..e40f2f3f503b --- /dev/null +++ b/autodoc/source/display/html/pm_help.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_PM_HELP_HXX +#define ADC_DISPLAY_HTML_PM_HELP_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "pm_base.hxx" + // COMPONENTS + // PARAMETERS + +class NavigationBar; + +class PageMaker_Help : public SpecializedPageMaker +{ + public: + PageMaker_Help( + PageDisplay & io_rPage ); + + virtual ~PageMaker_Help(); + + virtual void MakePage(); + + private: + virtual void Write_NavBar(); + virtual void Write_TopArea(); + virtual void Write_DocuArea(); + + // DATA + Dyn<NavigationBar> pNavi; +}; + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/pm_index.cxx b/autodoc/source/display/html/pm_index.cxx new file mode 100644 index 000000000000..122329e9dcdb --- /dev/null +++ b/autodoc/source/display/html/pm_index.cxx @@ -0,0 +1,320 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "pm_index.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/cpp/c_gate.hxx> +#include <ary/cpp/c_class.hxx> +#include <ary/cpp/c_define.hxx> +#include <ary/cpp/c_enum.hxx> +#include <ary/cpp/c_enuval.hxx> +#include <ary/cpp/c_funct.hxx> +#include <ary/cpp/c_macro.hxx> +#include <ary/cpp/c_namesp.hxx> +#include <ary/cpp/c_tydef.hxx> +#include <ary/cpp/c_vari.hxx> +#include <ary/cpp/cp_ce.hxx> +#include "aryattrs.hxx" +#include "hd_chlst.hxx" +#include "hd_docu.hxx" +#include "html_kit.hxx" +#include "navibar.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" +#include "strconst.hxx" + +using namespace csi; +using ary::GlobalId; + + + + +namespace +{ + +inline const char * +F_CK_Text( ary::cpp::E_ClassKey i_eCK ) +{ + switch (i_eCK) + { + case ary::cpp::CK_class: return "class"; + case ary::cpp::CK_struct: return "struct"; + case ary::cpp::CK_union: return "union"; + } // end switch + return ""; +} + +template <class CE> +inline const char * +F_OwnerType( const CE & i_rData, const ary::cpp::Gate & i_rGate ) +{ + if ( i_rData.Protection() == ary::cpp::PROTECT_global ) + return "namespace "; + + const ary::cpp::Class * + pClass = dynamic_cast< const ary::cpp::Class* >( + i_rGate.Ces().Search_Ce(i_rData.Owner()) ); + if (pClass != 0) + return F_CK_Text(pClass->ClassKey()); + return ""; +} + +} // anonymous namespace + +PageMaker_Index::PageMaker_Index( PageDisplay & io_rPage, + char i_c ) + : SpecializedPageMaker(io_rPage), + pNavi(0), + c(i_c), + pCurIndex(0) +{ +} + +PageMaker_Index::~PageMaker_Index() +{ +} + +void +PageMaker_Index::MakePage() +{ + pNavi = new NavigationBar( Env(), NavigationBar::LOC_Index ); + + Write_NavBar(); + Write_TopArea(); + Write_CompleteAlphabeticalList(); +} + +void +PageMaker_Index::do_Process( const ary::cpp::Namespace & i_rData ) +{ + Write_CeIndexEntry( i_rData, "namespace", "namespace" ); +} + +void +PageMaker_Index::do_Process( const ary::cpp::Class & i_rData ) +{ + // KORR_FUTURE + // Really throw out all anonymous classes from index? + + if ( strncmp(i_rData.LocalName().c_str()+1,"_Anonymous",10) == 0 ) + return; + + Write_CeIndexEntry( i_rData, + F_CK_Text(i_rData.ClassKey()), + F_OwnerType(i_rData, Env().Gate()) ); +} + +void +PageMaker_Index::do_Process( const ary::cpp::Enum & i_rData ) +{ + Write_CeIndexEntry( i_rData, "enum", F_OwnerType(i_rData, Env().Gate()) ); +} + +void +PageMaker_Index::do_Process( const ary::cpp::Typedef & i_rData ) +{ + Write_CeIndexEntry( i_rData, "typedef", F_OwnerType(i_rData, Env().Gate()) ); +} + +void +PageMaker_Index::do_Process( const ary::cpp::Function & i_rData ) +{ + Write_CeIndexEntry( i_rData, "function", F_OwnerType(i_rData, Env().Gate()) ); +} + +void +PageMaker_Index::do_Process( const ary::cpp::Variable & i_rData ) +{ + Write_CeIndexEntry( i_rData, "variable", F_OwnerType(i_rData, Env().Gate()) ); +} + +void +PageMaker_Index::do_Process( const ary::cpp::EnumValue & i_rData ) +{ + Write_CeIndexEntry( i_rData, "enum value", "" ); +} + +void +PageMaker_Index::do_Process( const ary::cpp::Define & i_rData ) +{ + String sFileName; + + pCurIndex->AddEntry(); + pCurIndex->Term() + >> *new html::Link( Link2CppDefinition(Env(), i_rData) ) + >> *new html::Bold + << i_rData.LocalName(); + pCurIndex->Term() + << " - define"; + pCurIndex->Def() << " "; +} + +void +PageMaker_Index::do_Process( const ary::cpp::Macro & i_rData ) +{ + String sFileName; + + pCurIndex->AddEntry(); + pCurIndex->Term() + >> *new html::Link( Link2CppDefinition(Env(), i_rData) ) + >> *new html::Bold + << i_rData.LocalName(); + pCurIndex->Term() + << " - macro"; + + pCurIndex->Def() << " "; +} + +const ary::cpp::Gate * +PageMaker_Index::inq_Get_ReFinder() const +{ + return &Env().Gate(); +} + +void +PageMaker_Index::Write_NavBar() +{ + pNavi->Write( CurOut() ); + CurOut() << new html::HorizontalLine; +} + + +const String C_sAlphabet( +"<a href=\"index-1.html\"><B>A</B></a> <a href=\"index-2.html\"><B>B</B></a> <a href=\"index-3.html\"><B>C</B></a> <a href=\"index-4.html\"><B>D</B></a> <a href=\"index-5.html\"><B>E</B></a> " +"<a href=\"index-6.html\"><B>F</B></a> <a href=\"index-7.html\"><B>G</B></a> <a href=\"index-8.html\"><B>H</B></a> <a href=\"index-9.html\"><B>I</B></a> <a href=\"index-10.html\"><B>J</B></a> " +"<a href=\"index-11.html\"><B>K</B></a> <a href=\"index-12.html\"><B>L</B></a> <a href=\"index-13.html\"><B>M</B></a> <a href=\"index-14.html\"><B>N</B></a> <a href=\"index-15.html\"><B>O</B></a> " +"<a href=\"index-16.html\"><B>P</B></a> <a href=\"index-17.html\"><B>Q</B></a> <a href=\"index-18.html\"><B>R</B></a> <a href=\"index-19.html\"><B>S</B></a> <a href=\"index-20.html\"><B>T</B></a> " +"<a href=\"index-21.html\"><B>U</B></a> <a href=\"index-22.html\"><B>V</B></a> <a href=\"index-23.html\"><B>W</B></a> <a href=\"index-24.html\"><B>X</B></a> <a href=\"index-25.html\"><B>Y</B></a> " +"<a href=\"index-26.html\"><B>Z</B></a> <a href=\"index-27.html\"><B>_</B></a>" ); + +void +PageMaker_Index::Write_TopArea() +{ + String sLetter(&c, 1); + + adcdisp::PageTitle_Std fTitle; + fTitle( CurOut(), "Global Index", sLetter ); + + CurOut() >>* new html::Paragraph + << new html::AlignAttr("center") + << new xml::XmlCode(C_sAlphabet); + + CurOut() << new html::HorizontalLine; +} + +void +PageMaker_Index::Write_CompleteAlphabeticalList() +{ + std::vector<GlobalId> + aThisPagesItems; + const ary::cpp::Gate & + rGate = Env().Gate(); + + static char sBegin[] = "X"; + static char sEnd[] = "Y"; + + switch ( c ) + { + case 'Z': sBegin[0] = 'Z'; + sEnd[0] = '_'; + break; + case '_': sBegin[0] = '_'; + sEnd[0] = '0'; + break; + default: sBegin[0] = c; + sEnd[0] = char(c + 1); + break; + } + + uintt + nCount = rGate.Get_AlphabeticalList( aThisPagesItems, sBegin, sEnd ); + if (nCount > 0 ) + { + adcdisp::IndexList + aIndex(CurOut()); + pCurIndex = &aIndex; + + std::vector<GlobalId>::const_iterator itEnd = aThisPagesItems.end(); + for ( std::vector<GlobalId>::const_iterator it = aThisPagesItems.begin(); + it != itEnd; + ++it ) + { + const ary::Entity * + pRe = rGate.Search_Entity( *it ); + if ( pRe != 0 ) + pRe->Accept(*this); + } // end for + + pCurIndex = 0; + } // endif (nCount > 0) +} + +void +PageMaker_Index::Write_CeIndexEntry( const ary::cpp::CodeEntity & + i_rCe, + const char * i_sType, + const char * i_sOwnerType ) +{ + if ( Ce_IsInternal(i_rCe) ) + return; + + static csv::StreamStr aQualification(500); + + const ary::cpp::CodeEntity & + rOwner = Env().Gate().Ces().Find_Ce(i_rCe.Owner()); + + pCurIndex->AddEntry(); + pCurIndex->Term() + >> *new html::Link( Link2Ce(Env(), i_rCe) ) + >> *new html::Bold + << i_rCe.LocalName(); + pCurIndex->Term() + << " - " + << i_sType; + + if ( rOwner.Owner().IsValid() ) + { + aQualification.seekp(0); + Env().Gate().Ces().Get_QualifiedName( aQualification, + rOwner.LocalName(), + rOwner.Owner() ); + + pCurIndex->Term() + << " in " + << i_sOwnerType + << " " + << aQualification.c_str(); + } + + pCurIndex->Def() << " "; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/pm_index.hxx b/autodoc/source/display/html/pm_index.hxx new file mode 100644 index 000000000000..e558292e3eae --- /dev/null +++ b/autodoc/source/display/html/pm_index.hxx @@ -0,0 +1,138 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_PM_INDEX_HXX +#define ADC_DISPLAY_HTML_PM_INDEX_HXX + +// BASE CLASSES +#include "pm_base.hxx" +#include <ary/ary_disp.hxx> +#include <cosv/tpl/processor.hxx> +// USED SERVICES +namespace adcdisp +{ + class IndexList; +} +namespace ary +{ + namespace cpp + { + class Namespace; + class Class; + class Enum; + class Typedef; + class Function; + class Variable; + class EnumValue; + class Define; + class Macro; + } +} + +class NavigationBar; + + + + +class PageMaker_Index : public SpecializedPageMaker, + public ary::Display, + public csv::ConstProcessor<ary::cpp::Namespace>, + public csv::ConstProcessor<ary::cpp::Class>, + public csv::ConstProcessor<ary::cpp::Enum>, + public csv::ConstProcessor<ary::cpp::Typedef>, + public csv::ConstProcessor<ary::cpp::Function>, + public csv::ConstProcessor<ary::cpp::Variable>, + public csv::ConstProcessor<ary::cpp::EnumValue>, + public csv::ConstProcessor<ary::cpp::Define>, + public csv::ConstProcessor<ary::cpp::Macro> +{ + public: + PageMaker_Index( + PageDisplay & io_rPage, + char i_c ); + + virtual ~PageMaker_Index(); + + virtual void MakePage(); + + private: + // Interface csv::ConstProcessor<> + virtual void do_Process( + const ary::cpp::Namespace & + i_rData ); + virtual void do_Process( + const ary::cpp::Class & + i_rData ); + virtual void do_Process( + const ary::cpp::Enum & + i_rData ); + virtual void do_Process( + const ary::cpp::Typedef & + i_rData ); + virtual void do_Process( + const ary::cpp::Function & + i_rData ); + virtual void do_Process( + const ary::cpp::Variable & + i_rData ); + virtual void do_Process( + const ary::cpp::EnumValue & + i_rData ); + virtual void do_Process( + const ary::cpp::Define & + i_rData ); + virtual void do_Process( + const ary::cpp::Macro & + i_rData ); + // Interface ary::cpp::Display: + virtual const ary::cpp::Gate * + inq_Get_ReFinder() const; + // Locals + virtual void Write_NavBar(); + virtual void Write_TopArea(); + virtual void Write_CompleteAlphabeticalList(); + + void Write_CeIndexEntry( + const ary::cpp::CodeEntity & + i_rCe, + const char * i_sType, + const char * i_sOwnerType ); + + // DATA + Dyn<NavigationBar> pNavi; + char c; + adcdisp::IndexList * + pCurIndex; +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/pm_namsp.cxx b/autodoc/source/display/html/pm_namsp.cxx new file mode 100644 index 000000000000..ea07fc77a45c --- /dev/null +++ b/autodoc/source/display/html/pm_namsp.cxx @@ -0,0 +1,176 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "pm_namsp.hxx" + + +// NOT FULLY DEFINED SERVICES +#include "hd_chlst.hxx" +#include "hd_docu.hxx" +#include "html_kit.hxx" +#include "navibar.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" +#include "strconst.hxx" + + +using namespace csi; +using csi::html::HorizontalLine; +using csi::html::Link; +using csi::html::Table; +using csi::html::TableRow; +using csi::html::TableCell; + + + +PageMaker_Namespace::PageMaker_Namespace( PageDisplay & io_rPage ) + : SpecializedPageMaker(io_rPage), + pMe( io_rPage.Env().CurNamespace() ), + pChildDisplay( new ChildList_Display(io_rPage.Env()) ), + pNavi(0) +{ + csv_assert( pMe != 0 ); +} + +PageMaker_Namespace::~PageMaker_Namespace() +{ +} + +void +PageMaker_Namespace::MakePage() +{ + pNavi = new NavigationBar( Env(), Me() ); + + Write_NavBar(); + Write_TopArea(); + Write_DocuArea(); + + pNavi->MakeSubRow(""); + Write_ChildList( ary::cpp::Namespace::SLOT_SubNamespaces, C_sTitle_SubNamespaces, C_sLabel_SubNamespaces ); + + Write_ChildLists_forClasses( C_sTitle_Classes, + C_sLabel_Classes, + ary::cpp::CK_class ); + Write_ChildLists_forClasses( C_sTitle_Structs, + C_sLabel_Structs, + ary::cpp::CK_struct ); + Write_ChildLists_forClasses( C_sTitle_Unions, + C_sLabel_Unions, + ary::cpp::CK_union ); + + Write_ChildList( ary::cpp::Namespace::SLOT_Enums, C_sTitle_Enums, C_sLabel_Enums ); + Write_ChildList( ary::cpp::Namespace::SLOT_Typedefs, C_sTitle_Typedefs, C_sLabel_Typedefs ); + Write_ChildList( ary::cpp::Namespace::SLOT_Operations, C_sTitle_Operations, C_sLabel_Operations ); + Write_ChildList( ary::cpp::Namespace::SLOT_Constants, C_sTitle_Constants, C_sLabel_Constants ); + Write_ChildList( ary::cpp::Namespace::SLOT_Variables, C_sTitle_Variables, C_sLabel_Variables ); + + pNavi->Write_SubRows(); +} + +void +PageMaker_Namespace::Write_NavBar() +{ + pNavi->Write( CurOut() ); + CurOut() << new HorizontalLine; +} + +void +PageMaker_Namespace::Write_TopArea() +{ + Page().Write_NameChainWithLinks( Me() ); + + adcdisp::PageTitle_Std fTitle; + xml::Element & rH3 = fTitle( CurOut() ); + if ( Env().CurNamespace()->Owner().IsValid() ) + { + rH3 << C_sHFTypeTitle_Namespace + << " " + << Env().CurNamespace()->LocalName(); + } + else + { + rH3 << C_sHFTitle_GlobalNamespaceCpp; + } + CurOut() << new HorizontalLine; +} + +void +PageMaker_Namespace::Write_DocuArea() +{ + Docu_Display aDocuShow( Env() ); + + aDocuShow.Assign_Out(CurOut()); + aDocuShow.Process(Me().Docu()); + aDocuShow.Unassign_Out(); + + CurOut() << new HorizontalLine; +} + +void +PageMaker_Namespace::Write_ChildList( ary::SlotAccessId i_nSlot, + const char * i_sListTitle, + const char * i_sLabel ) + +{ + bool bChildrenExist = false; + ChildList_Display::Area_Result + aResult( bChildrenExist, CurOut() ); + + pChildDisplay->Run_Simple( aResult, + i_nSlot, + i_sLabel, + i_sListTitle ); + + pNavi->AddItem(i_sListTitle, i_sLabel, bChildrenExist); + if (bChildrenExist) + CurOut() << new HorizontalLine; +} + +void +PageMaker_Namespace::Write_ChildLists_forClasses( const char * i_sListTitle, + const char * i_sLabel, + ary::cpp::E_ClassKey i_eFilter ) + +{ + bool bChildrenExist = false; + ChildList_Display::Area_Result + aResult( bChildrenExist, CurOut() ); + + pChildDisplay->Run_GlobalClasses( aResult, + ary::cpp::Namespace::SLOT_Classes, + i_sLabel, + i_sListTitle, + i_eFilter ); + + pNavi->AddItem(i_sListTitle, i_sLabel, bChildrenExist); + if ( bChildrenExist ) + CurOut() << new HorizontalLine; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/pm_namsp.hxx b/autodoc/source/display/html/pm_namsp.hxx new file mode 100644 index 000000000000..c2f0535ad7d7 --- /dev/null +++ b/autodoc/source/display/html/pm_namsp.hxx @@ -0,0 +1,80 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_PM_NAMSP_HXX +#define ADC_DISPLAY_HTML_PM_NAMSP_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "pm_base.hxx" + // COMPONENTS + // PARAMETERS + +class ChildList_Display; +class NavigationBar; + +class PageMaker_Namespace : public SpecializedPageMaker +{ + public: + PageMaker_Namespace( + PageDisplay & io_rPage ); + + virtual ~PageMaker_Namespace(); + + virtual void MakePage(); + + private: + virtual void Write_NavBar(); + virtual void Write_TopArea(); + virtual void Write_DocuArea(); + virtual void Write_ChildList( + ary::SlotAccessId i_nSlot, + const char * i_nListTitle, + const char * i_nLabel ); + void Write_ChildLists_forClasses( + const char * i_sListTitle, + const char * i_sLabel, + ary::cpp::E_ClassKey i_eFilter ); + + const ary::cpp::Namespace & + Me() const { return *pMe; } + // DATA + const ary::cpp::Namespace * + pMe; + Dyn<ChildList_Display> + pChildDisplay; + Dyn<NavigationBar> pNavi; +}; + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/pm_start.cxx b/autodoc/source/display/html/pm_start.cxx new file mode 100644 index 000000000000..335783b1b809 --- /dev/null +++ b/autodoc/source/display/html/pm_start.cxx @@ -0,0 +1,139 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "pm_start.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/ary.hxx> +#include "hd_chlst.hxx" +#include "hd_docu.hxx" +#include "navibar.hxx" +#include "html_kit.hxx" +#include "opageenv.hxx" +#include "pagemake.hxx" +#include "strconst.hxx" + + +using namespace csi; +using csi::html::Paragraph; +using csi::html::HorizontalLine; +using csi::html::AlignAttr; +using csi::html::Bold; +using csi::html::Link; +using csi::html::Sbr; +using csi::html::LineBreak; + + + +PageMaker_Overview::PageMaker_Overview( PageDisplay & io_rPage ) + : SpecializedPageMaker(io_rPage), + pNavi(0) +{ +} + +PageMaker_Overview::~PageMaker_Overview() +{ +} + +void +PageMaker_Overview::MakePage() +{ + pNavi = new NavigationBar( Env(), NavigationBar::LOC_Overview ); + Write_NavBar(); + + Write_TopArea(); + Write_DocuArea(); +} + +void +PageMaker_Overview::Write_NavBar() +{ + pNavi->Write( CurOut() ); + CurOut() << new HorizontalLine; +} + +void +PageMaker_Overview::Write_TopArea() +{ + adcdisp::PageTitle_Std fTitle; + fTitle( CurOut(), Env().RepositoryTitle(), "" ); + + CurOut() + >> *new Paragraph + << new html::StyleAttr("font-size:14pt;") + << "This is a reference documentation for the C++ source code." + << new LineBreak + << new LineBreak + << "Points to start:"; + + html::SimpleList & + rList = *new html::SimpleList; + CurOut() >> rList; + + html::ListItem & rNamedObjsItem = + rList.AddItem(); + + StreamLock sNspDir(50); + rNamedObjsItem + << new html::StyleAttr("font-size:14pt;") + >> *new Link( sNspDir() << C_sDIR_NamespacesCpp + << "/" + << C_sHFN_Namespace + << c_str ) + >> *new Bold + << "Named Objects"; + rNamedObjsItem << " (classes, functions, namespaces, etc.)" + << new html::LineBreak; + rList.AddItem() + << new html::StyleAttr("font-size:14pt;") + >> *new Link( "def-all.html" ) + >> *new Bold + << "Defines and Macros" + << new html::LineBreak; + StreamLock sIndexDir(50); + rList.AddItem() + << new html::StyleAttr("font-size:14pt;") + >> *new Link( sIndexDir() << C_sDIR_Index + << "/index-1.html" + << c_str ) + >> *new Bold + << "Global Index" + << new html::LineBreak; +} + +void +PageMaker_Overview::Write_DocuArea() +{ + CurOut() << new HorizontalLine; +} + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/pm_start.hxx b/autodoc/source/display/html/pm_start.hxx new file mode 100644 index 000000000000..26614b33bc7d --- /dev/null +++ b/autodoc/source/display/html/pm_start.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_PM_START_HXX +#define ADC_DISPLAY_HTML_PM_START_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "pm_base.hxx" + // COMPONENTS + // PARAMETERS + +class NavigationBar; + +class PageMaker_Overview : public SpecializedPageMaker +{ + public: + PageMaker_Overview( + PageDisplay & io_rPage ); + + virtual ~PageMaker_Overview(); + + virtual void MakePage(); + + private: + virtual void Write_NavBar(); + virtual void Write_TopArea(); + virtual void Write_DocuArea(); + + // DATA + Dyn<NavigationBar> pNavi; +}; + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/protarea.cxx b/autodoc/source/display/html/protarea.cxx new file mode 100644 index 000000000000..d581014eccac --- /dev/null +++ b/autodoc/source/display/html/protarea.cxx @@ -0,0 +1,140 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <precomp.h> +#include "protarea.hxx" + + +// NOT FULLY DEFINED SERVICES +#include "hdimpl.hxx" + + +inline UINT8 +ProtectionArea::Index( ary::cpp::E_ClassKey i_eClassKey ) const +{ + return i_eClassKey == ary::cpp::CK_class + ? 0 + : i_eClassKey == ary::cpp::CK_struct + ? 1 + : 2; +} + + + +ProtectionArea::ProtectionArea( const char * i_sLabel, + const char * i_sTitle ) + : pSglTable( new S_Slot_Table(i_sTitle) ), + aClassesTables(), + sLabel(i_sLabel) +{ +} + +ProtectionArea::~ProtectionArea() +{ + +} + +csi::html::Table & +ProtectionArea::GetTable() +{ + csv_assert(pSglTable); + + return pSglTable->GetTable(); +} + +csi::html::Table & +ProtectionArea::GetTable( ary::cpp::E_ClassKey i_eClassKey ) +{ + csv_assert(aClassesTables[Index(i_eClassKey)]); + return aClassesTables[Index(i_eClassKey)]->GetTable(); +} + +DYN csi::html::Table * +ProtectionArea::ReleaseTable() +{ + csv_assert(pSglTable); + return pSglTable->ReleaseTable(); +} + +DYN csi::html::Table * +ProtectionArea::ReleaseTable( ary::cpp::E_ClassKey i_eClassKey ) +{ + csv_assert(aClassesTables[Index(i_eClassKey)]); + return aClassesTables[Index(i_eClassKey)]->ReleaseTable(); +} + +const char * +ProtectionArea::Label() const +{ + return sLabel; +} + + +bool +ProtectionArea::WasUsed_Area() const +{ + if ( pSglTable ) + { + return pSglTable->WasUsed(); + } + + typedef const Dyn<ProtectionArea::S_Slot_Table> cdyntab; + + // Workaround a maybe compiler bug in Solaris5-CC ? + // should normally work without the cast, + // because that is exactly the genuine type, given: + return static_cast< cdyntab& >(aClassesTables[0])->WasUsed() + OR static_cast< cdyntab& >(aClassesTables[1])->WasUsed() + OR static_cast< cdyntab& >(aClassesTables[2])->WasUsed(); +} + +//******************* S_Slot_Table **********************// + +ProtectionArea:: +S_Slot_Table::S_Slot_Table(const char * i_sTitle) + : sTableTitle(i_sTitle) +{ +} + +ProtectionArea:: +S_Slot_Table::~S_Slot_Table() +{ +} + +csi::html::Table & +ProtectionArea:: +S_Slot_Table::GetTable() +{ + return pTable + ? *pTable + : *( pTable = &Create_ChildListTable(sTableTitle) ); +} + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/protarea.hxx b/autodoc/source/display/html/protarea.hxx new file mode 100644 index 000000000000..348afbe5ef78 --- /dev/null +++ b/autodoc/source/display/html/protarea.hxx @@ -0,0 +1,96 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_PROTAREA_HXX +#define ADC_DISPLAY_HTML_PROTAREA_HXX + +// USED SERVICES +#include <ary/cpp/c_types4cpp.hxx> + +namespace csi +{ +namespace html +{ + class Table; +} +} + + + + +class ProtectionArea +{ + public: + ProtectionArea( + const char * i_sLabel, + const char * i_sTitle ); + ~ProtectionArea(); + + csi::html::Table & GetTable(); + csi::html::Table & GetTable( + ary::cpp::E_ClassKey + i_eClassKey ); + DYN csi::html::Table * ReleaseTable(); + DYN csi::html::Table * ReleaseTable( + ary::cpp::E_ClassKey + i_eClassKey ); + const char * Label() const; + + int Size() const { return pSglTable ? 1 : 3; } + + bool WasUsed_Area() const; + private: + struct S_Slot_Table + { + const char * sTableTitle; + Dyn< csi::html::Table > + pTable; + + S_Slot_Table( + const char * i_sTitle ); + ~S_Slot_Table(); + csi::html::Table & GetTable(); + DYN csi::html::Table * + ReleaseTable() { return pTable.Release(); } + bool WasUsed() const { return pTable; } + }; + + UINT8 Index( + ary::cpp::E_ClassKey + i_eClassKey ) const; + // DATA + Dyn<S_Slot_Table> pSglTable; + Dyn<S_Slot_Table> aClassesTables[3]; + const char * sLabel; +}; + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/display/html/strconst.hxx b/autodoc/source/display/html/strconst.hxx new file mode 100644 index 000000000000..0bddc803249d --- /dev/null +++ b/autodoc/source/display/html/strconst.hxx @@ -0,0 +1,80 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org 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 version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HTML_STRCONST_HXX +#define ADC_DISPLAY_HTML_STRCONST_HXX + + +const char * const C_sDIR_NamespacesCpp = "names"; +const char * const C_sDIR_Index = "index-files"; // Convention recognised by Javadoc + +const char * const C_sPath_Index = "index-files/index-1.html"; // Convention recognised by Javadoc + +const char * const C_sHFN_Css = "cpp.css"; +const char * const C_sHFN_Overview = "index.html"; +const char * const C_sHFN_Help = "help.html"; + +const char * const C_sHFN_Namespace = "index.html"; + +const char * const C_sTitle_SubNamespaces = "Nested Namespaces"; +const char * const C_sTitle_Classes = "Classes"; +const char * const C_sTitle_Structs = "Structs"; +const char * const C_sTitle_Unions = "Unions"; +const char * const C_sTitle_Enums = "Enums"; +const char * const C_sTitle_Typedefs = "Typedefs"; +const char * const C_sTitle_Operations = "Functions"; +const char * const C_sTitle_Constants = "Constants"; +const char * const C_sTitle_Variables = "Variables"; +const char * const C_sTitle_EnumValues = "Values"; + +const char * const C_sLabel_SubNamespaces = "subnsps"; +const char * const C_sLabel_Classes = "classes"; +const char * const C_sLabel_Structs = "structs"; +const char * const C_sLabel_Unions = "unions"; +const char * const C_sLabel_Enums = "enums"; +const char * const C_sLabel_Typedefs = "tydefs"; +const char * const C_sLabel_Operations = "ops"; +const char * const C_sLabel_Constants = "consts"; +const char * const C_sLabel_Variables = "vars"; +const char * const C_sLabel_EnumValues = "envals"; + +const char * const C_sHFTitle_Overview = "C++ Reference Documentation Overview"; +const char * const C_sHFTitle_Help = "How This Reference Document Is Organized"; + +const char * const C_sHFTitle_GlobalNamespaceCpp = "Global Namespace in C++"; +const char * const C_sHFTypeTitle_Namespace = "namespace"; +const char * const C_sHFTypeTitle_Class = "class"; +const char * const C_sHFTypeTitle_Struct = "struct"; +const char * const C_sHFTypeTitle_Union = "union"; +const char * const C_sHFTypeTitle_Enum = "enum"; +const char * const C_sHFTypeTitle_Typedef = "typedef"; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |