diff options
Diffstat (limited to 'autodoc/source/display')
130 files changed, 24234 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..7b0fcea14cd7 --- /dev/null +++ b/autodoc/source/display/html/aryattrs.cxx @@ -0,0 +1,248 @@ +/************************************************************************* + * + * 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(); +} diff --git a/autodoc/source/display/html/aryattrs.hxx b/autodoc/source/display/html/aryattrs.hxx new file mode 100644 index 000000000000..053b445ac7eb --- /dev/null +++ b/autodoc/source/display/html/aryattrs.hxx @@ -0,0 +1,154 @@ +/************************************************************************* + * + * 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 diff --git a/autodoc/source/display/html/cfrstd.cxx b/autodoc/source/display/html/cfrstd.cxx new file mode 100644 index 000000000000..1093932699ce --- /dev/null +++ b/autodoc/source/display/html/cfrstd.cxx @@ -0,0 +1,344 @@ +/************************************************************************* + * + * 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 © " + << year + << " Oracle"; + return String(cr.c_str()); + +} diff --git a/autodoc/source/display/html/chd_udk2.cxx b/autodoc/source/display/html/chd_udk2.cxx new file mode 100644 index 000000000000..f03a9a297c40 --- /dev/null +++ b/autodoc/source/display/html/chd_udk2.cxx @@ -0,0 +1,201 @@ +/************************************************************************* + * + * 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(); +} diff --git a/autodoc/source/display/html/cre_link.cxx b/autodoc/source/display/html/cre_link.cxx new file mode 100644 index 000000000000..688464d53969 --- /dev/null +++ b/autodoc/source/display/html/cre_link.cxx @@ -0,0 +1,269 @@ +/************************************************************************* + * + * 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 ); +} diff --git a/autodoc/source/display/html/cre_link.hxx b/autodoc/source/display/html/cre_link.hxx new file mode 100644 index 000000000000..bd37e83384f4 --- /dev/null +++ b/autodoc/source/display/html/cre_link.hxx @@ -0,0 +1,133 @@ +/************************************************************************* + * + * 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 diff --git a/autodoc/source/display/html/dsply_cl.cxx b/autodoc/source/display/html/dsply_cl.cxx new file mode 100644 index 000000000000..656bca79c2cf --- /dev/null +++ b/autodoc/source/display/html/dsply_cl.cxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * 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(); +} diff --git a/autodoc/source/display/html/dsply_cl.hxx b/autodoc/source/display/html/dsply_cl.hxx new file mode 100644 index 000000000000..8f81e4f8c1b0 --- /dev/null +++ b/autodoc/source/display/html/dsply_cl.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * 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 diff --git a/autodoc/source/display/html/dsply_da.cxx b/autodoc/source/display/html/dsply_da.cxx new file mode 100644 index 000000000000..4a8055f74d55 --- /dev/null +++ b/autodoc/source/display/html/dsply_da.cxx @@ -0,0 +1,199 @@ +/************************************************************************* + * + * 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; +} diff --git a/autodoc/source/display/html/dsply_da.hxx b/autodoc/source/display/html/dsply_da.hxx new file mode 100644 index 000000000000..f3cf563c0f72 --- /dev/null +++ b/autodoc/source/display/html/dsply_da.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * 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 diff --git a/autodoc/source/display/html/dsply_op.cxx b/autodoc/source/display/html/dsply_op.cxx new file mode 100644 index 000000000000..1bae518aae18 --- /dev/null +++ b/autodoc/source/display/html/dsply_op.cxx @@ -0,0 +1,207 @@ +/************************************************************************* + * + * 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; +} diff --git a/autodoc/source/display/html/dsply_op.hxx b/autodoc/source/display/html/dsply_op.hxx new file mode 100644 index 000000000000..e17989f62c47 --- /dev/null +++ b/autodoc/source/display/html/dsply_op.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * 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 diff --git a/autodoc/source/display/html/easywri.cxx b/autodoc/source/display/html/easywri.cxx new file mode 100644 index 000000000000..47c6196e5322 --- /dev/null +++ b/autodoc/source/display/html/easywri.cxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * 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(); +} + diff --git a/autodoc/source/display/html/easywri.hxx b/autodoc/source/display/html/easywri.hxx new file mode 100644 index 000000000000..d5490b0f6133 --- /dev/null +++ b/autodoc/source/display/html/easywri.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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 + + diff --git a/autodoc/source/display/html/hd_chlst.cxx b/autodoc/source/display/html/hd_chlst.cxx new file mode 100644 index 000000000000..4647289a7bc4 --- /dev/null +++ b/autodoc/source/display/html/hd_chlst.cxx @@ -0,0 +1,589 @@ +/************************************************************************* + * + * 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; + } + } +} diff --git a/autodoc/source/display/html/hd_chlst.hxx b/autodoc/source/display/html/hd_chlst.hxx new file mode 100644 index 000000000000..d7d530ce934a --- /dev/null +++ b/autodoc/source/display/html/hd_chlst.hxx @@ -0,0 +1,206 @@ +/************************************************************************* + * + * 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 diff --git a/autodoc/source/display/html/hd_docu.cxx b/autodoc/source/display/html/hd_docu.cxx new file mode 100644 index 000000000000..5fa62b3ecb14 --- /dev/null +++ b/autodoc/source/display/html/hd_docu.cxx @@ -0,0 +1,486 @@ +/************************************************************************* + * + * 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() << "()"; +} + diff --git a/autodoc/source/display/html/hd_docu.hxx b/autodoc/source/display/html/hd_docu.hxx new file mode 100644 index 000000000000..812cc7054718 --- /dev/null +++ b/autodoc/source/display/html/hd_docu.hxx @@ -0,0 +1,196 @@ +/************************************************************************* + * + * 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 diff --git a/autodoc/source/display/html/hdimpl.cxx b/autodoc/source/display/html/hdimpl.cxx new file mode 100644 index 000000000000..fdd23be5b2e6 --- /dev/null +++ b/autodoc/source/display/html/hdimpl.cxx @@ -0,0 +1,546 @@ +/************************************************************************* + * + * 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 diff --git a/autodoc/source/display/html/hdimpl.hxx b/autodoc/source/display/html/hdimpl.hxx new file mode 100644 index 000000000000..ca882ec4152f --- /dev/null +++ b/autodoc/source/display/html/hdimpl.hxx @@ -0,0 +1,247 @@ +/************************************************************************* + * + * 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 diff --git a/autodoc/source/display/html/html_kit.cxx b/autodoc/source/display/html/html_kit.cxx new file mode 100644 index 000000000000..8b43373505fb --- /dev/null +++ b/autodoc/source/display/html/html_kit.cxx @@ -0,0 +1,305 @@ +/************************************************************************* + * + * 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 + + + diff --git a/autodoc/source/display/html/html_kit.hxx b/autodoc/source/display/html/html_kit.hxx new file mode 100644 index 000000000000..ad321d05aac7 --- /dev/null +++ b/autodoc/source/display/html/html_kit.hxx @@ -0,0 +1,198 @@ +/************************************************************************* + * + * 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 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..e61099fc502f --- /dev/null +++ b/autodoc/source/display/html/nav_main.cxx @@ -0,0 +1,377 @@ +/************************************************************************* + * + * 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); + } +} + + + diff --git a/autodoc/source/display/html/nav_main.hxx b/autodoc/source/display/html/nav_main.hxx new file mode 100644 index 000000000000..f05bebe47969 --- /dev/null +++ b/autodoc/source/display/html/nav_main.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * 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 diff --git a/autodoc/source/display/html/navibar.cxx b/autodoc/source/display/html/navibar.cxx new file mode 100644 index 000000000000..06f3e9397b8e --- /dev/null +++ b/autodoc/source/display/html/navibar.cxx @@ -0,0 +1,315 @@ +/************************************************************************* + * + * 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 ); + } +} diff --git a/autodoc/source/display/html/navibar.hxx b/autodoc/source/display/html/navibar.hxx new file mode 100644 index 000000000000..4b90985d29a4 --- /dev/null +++ b/autodoc/source/display/html/navibar.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * 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 diff --git a/autodoc/source/display/html/opageenv.cxx b/autodoc/source/display/html/opageenv.cxx new file mode 100644 index 000000000000..49661f06d15f --- /dev/null +++ b/autodoc/source/display/html/opageenv.cxx @@ -0,0 +1,489 @@ +/************************************************************************* + * + * 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(); +} diff --git a/autodoc/source/display/html/opageenv.hxx b/autodoc/source/display/html/opageenv.hxx new file mode 100644 index 000000000000..953a615d0023 --- /dev/null +++ b/autodoc/source/display/html/opageenv.hxx @@ -0,0 +1,128 @@ +/************************************************************************* + * + * 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 diff --git a/autodoc/source/display/html/outfile.cxx b/autodoc/source/display/html/outfile.cxx new file mode 100644 index 000000000000..dcf999bf0a1f --- /dev/null +++ b/autodoc/source/display/html/outfile.cxx @@ -0,0 +1,392 @@ +/************************************************************************* + * + * 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()); +} diff --git a/autodoc/source/display/html/outfile.hxx b/autodoc/source/display/html/outfile.hxx new file mode 100644 index 000000000000..7302baec7432 --- /dev/null +++ b/autodoc/source/display/html/outfile.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * 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 diff --git a/autodoc/source/display/html/pagemake.cxx b/autodoc/source/display/html/pagemake.cxx new file mode 100644 index 000000000000..4608fd5b4e0a --- /dev/null +++ b/autodoc/source/display/html/pagemake.cxx @@ -0,0 +1,576 @@ +/************************************************************************* + * + * 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(); +} + diff --git a/autodoc/source/display/html/pagemake.hxx b/autodoc/source/display/html/pagemake.hxx new file mode 100644 index 000000000000..b8cc1c50a6ff --- /dev/null +++ b/autodoc/source/display/html/pagemake.hxx @@ -0,0 +1,164 @@ +/************************************************************************* + * + * 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 diff --git a/autodoc/source/display/html/pm_aldef.cxx b/autodoc/source/display/html/pm_aldef.cxx new file mode 100644 index 000000000000..debe4681b0b8 --- /dev/null +++ b/autodoc/source/display/html/pm_aldef.cxx @@ -0,0 +1,245 @@ +/************************************************************************* + * + * 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 ); +} diff --git a/autodoc/source/display/html/pm_aldef.hxx b/autodoc/source/display/html/pm_aldef.hxx new file mode 100644 index 000000000000..3971bd0c4a13 --- /dev/null +++ b/autodoc/source/display/html/pm_aldef.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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 diff --git a/autodoc/source/display/html/pm_base.cxx b/autodoc/source/display/html/pm_base.cxx new file mode 100644 index 000000000000..16ab7bb97ef8 --- /dev/null +++ b/autodoc/source/display/html/pm_base.cxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * 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(); +} + diff --git a/autodoc/source/display/html/pm_base.hxx b/autodoc/source/display/html/pm_base.hxx new file mode 100644 index 000000000000..9acc2186d5ad --- /dev/null +++ b/autodoc/source/display/html/pm_base.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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 + diff --git a/autodoc/source/display/html/pm_class.cxx b/autodoc/source/display/html/pm_class.cxx new file mode 100644 index 000000000000..3e22eb5a91a9 --- /dev/null +++ b/autodoc/source/display/html/pm_class.cxx @@ -0,0 +1,811 @@ +/************************************************************************* + * + * 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 + + diff --git a/autodoc/source/display/html/pm_class.hxx b/autodoc/source/display/html/pm_class.hxx new file mode 100644 index 000000000000..a2a5b89e7205 --- /dev/null +++ b/autodoc/source/display/html/pm_class.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * 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 + diff --git a/autodoc/source/display/html/pm_help.cxx b/autodoc/source/display/html/pm_help.cxx new file mode 100644 index 000000000000..2ad3b6fc32e2 --- /dev/null +++ b/autodoc/source/display/html/pm_help.cxx @@ -0,0 +1,232 @@ +/************************************************************************* + * + * 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; +} + + + diff --git a/autodoc/source/display/html/pm_help.hxx b/autodoc/source/display/html/pm_help.hxx new file mode 100644 index 000000000000..7266c402c991 --- /dev/null +++ b/autodoc/source/display/html/pm_help.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * 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 + diff --git a/autodoc/source/display/html/pm_index.cxx b/autodoc/source/display/html/pm_index.cxx new file mode 100644 index 000000000000..bb41a8fe8f58 --- /dev/null +++ b/autodoc/source/display/html/pm_index.cxx @@ -0,0 +1,317 @@ +/************************************************************************* + * + * 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() << " "; +} diff --git a/autodoc/source/display/html/pm_index.hxx b/autodoc/source/display/html/pm_index.hxx new file mode 100644 index 000000000000..d2dcf8ed422c --- /dev/null +++ b/autodoc/source/display/html/pm_index.hxx @@ -0,0 +1,135 @@ +/************************************************************************* + * + * 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 diff --git a/autodoc/source/display/html/pm_namsp.cxx b/autodoc/source/display/html/pm_namsp.cxx new file mode 100644 index 000000000000..ea13c237919f --- /dev/null +++ b/autodoc/source/display/html/pm_namsp.cxx @@ -0,0 +1,173 @@ +/************************************************************************* + * + * 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; +} diff --git a/autodoc/source/display/html/pm_namsp.hxx b/autodoc/source/display/html/pm_namsp.hxx new file mode 100644 index 000000000000..11501e4dc359 --- /dev/null +++ b/autodoc/source/display/html/pm_namsp.hxx @@ -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. + * + ************************************************************************/ + +#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 + diff --git a/autodoc/source/display/html/pm_start.cxx b/autodoc/source/display/html/pm_start.cxx new file mode 100644 index 000000000000..c5ff38f32eba --- /dev/null +++ b/autodoc/source/display/html/pm_start.cxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * 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; +} + + + diff --git a/autodoc/source/display/html/pm_start.hxx b/autodoc/source/display/html/pm_start.hxx new file mode 100644 index 000000000000..96fe9d815efe --- /dev/null +++ b/autodoc/source/display/html/pm_start.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * 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 + diff --git a/autodoc/source/display/html/protarea.cxx b/autodoc/source/display/html/protarea.cxx new file mode 100644 index 000000000000..8c54212c29f4 --- /dev/null +++ b/autodoc/source/display/html/protarea.cxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * 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) ); +} + + + diff --git a/autodoc/source/display/html/protarea.hxx b/autodoc/source/display/html/protarea.hxx new file mode 100644 index 000000000000..e09904fbc85e --- /dev/null +++ b/autodoc/source/display/html/protarea.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * 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 + diff --git a/autodoc/source/display/html/strconst.hxx b/autodoc/source/display/html/strconst.hxx new file mode 100644 index 000000000000..a9e5eaad2101 --- /dev/null +++ b/autodoc/source/display/html/strconst.hxx @@ -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. + * + ************************************************************************/ + +#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 + diff --git a/autodoc/source/display/idl/hfi_constgroup.cxx b/autodoc/source/display/idl/hfi_constgroup.cxx new file mode 100644 index 000000000000..accf58cf290e --- /dev/null +++ b/autodoc/source/display/idl/hfi_constgroup.cxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * 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 "hfi_constgroup.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/ik_constgroup.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_navi_sub.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_navibar.hxx" +#include "hfi_property.hxx" +#include "hi_linkhelper.hxx" + + +extern const String + C_sCePrefix_Constants("constants group"); + + +namespace +{ + +const String + C_sList_Constants("Constants"); +const String + C_sList_Constants_Label("Constants"); +const String + C_sList_ConstantDetails("Constants' Details"); +const String + C_sList_ConstantDetails_Label("ConstantDetails"); + +enum E_SubListIndices +{ + sli_ConstantsSummary = 0, + sli_ConstantDetails = 1 +}; + + +} // anonymous namespace + + + +HF_IdlConstGroup::HF_IdlConstGroup( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlConstGroup::~HF_IdlConstGroup() +{ +} + +void +HF_IdlConstGroup::Produce_byData( const client & i_ce ) const +{ + Dyn<HF_NaviSubRow> + pNaviSubRow( &make_Navibar(i_ce) ); + + HF_TitleTable + aTitle(CurOut()); + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + produce_Title(aTitle, C_sCePrefix_Constants, i_ce); + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); + + dyn_ce_list + dpConstants; + ary::idl::ifc_constgroup::attr::Get_Constants(dpConstants, i_ce); + + if ( (*dpConstants).operator bool() ) + { + produce_Members( *dpConstants, + C_sList_Constants, + C_sList_Constants_Label, + C_sList_ConstantDetails, + C_sList_ConstantDetails_Label ); + pNaviSubRow->SwitchOn(sli_ConstantsSummary); + pNaviSubRow->SwitchOn(sli_ConstantDetails); + } + pNaviSubRow->Produce_Row(); +} + +HF_NaviSubRow & +HF_IdlConstGroup::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeMainRow(i_ce,true); // true := avoid link to Use-page. + + DYN HF_NaviSubRow & + ret = aNaviBar.Add_SubRow(); + ret.AddItem(C_sList_Constants, C_sList_Constants_Label, false); + ret.AddItem(C_sList_ConstantDetails, C_sList_ConstantDetails_Label, false); + + CurOut() << new Html::HorizontalLine(); + return ret; +} + +void +HF_IdlConstGroup::produce_MemberDetails( HF_SubTitleTable & o_table, + const client & i_ce ) const +{ + HF_IdlConstant + aElement( Env(), o_table ); + aElement.Produce_byData(i_ce); +} + diff --git a/autodoc/source/display/idl/hfi_constgroup.hxx b/autodoc/source/display/idl/hfi_constgroup.hxx new file mode 100644 index 000000000000..9719d6c131cf --- /dev/null +++ b/autodoc/source/display/idl/hfi_constgroup.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * 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_HFI_CONSTGROUP_HXX +#define ADC_DISPLAY_HFI_CONSTGROUP_HXX + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + +class HF_IdlConstGroup : public HtmlFactory_Idl +{ + public: + HF_IdlConstGroup( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlConstGroup(); + + void Produce_byData( + const client & ce ) const; + private: + HF_NaviSubRow & make_Navibar( + const client & ce ) const; + virtual void produce_MemberDetails( + HF_SubTitleTable & o_table, + const client & ce ) const; +}; + + + +// IMPLEMENTATION + + +extern const String + C_sCePrefix_Constants; + +#endif + + diff --git a/autodoc/source/display/idl/hfi_doc.cxx b/autodoc/source/display/idl/hfi_doc.cxx new file mode 100644 index 000000000000..5647ecd753f0 --- /dev/null +++ b/autodoc/source/display/idl/hfi_doc.cxx @@ -0,0 +1,191 @@ +/************************************************************************* + * + * 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 "hfi_doc.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <ary_i/d_token.hxx> +#include <toolkit/hf_docentry.hxx> +#include "hfi_tag.hxx" +#include "hi_ary.hxx" + + + + +HF_IdlDocu::HF_IdlDocu( Environment & io_rEnv, + HF_DocEntryList & o_rOut ) + : HtmlFactory_Idl( io_rEnv, &o_rOut.CurOut() ), + rOut(o_rOut) +{ +} + +HF_IdlDocu::~HF_IdlDocu() +{ +} + +void +HF_IdlDocu::Produce_fromCodeEntity( const client & i_ce ) const +{ + const ce_info * + i_pDocu = Get_IdlDocu(i_ce.Docu()); + if (i_pDocu != 0) + Produce_byDocuAndScope(*i_pDocu, &i_ce, i_ce); +} + +void +HF_IdlDocu::Produce_fromReference( const ce_info & i_rDocuForReference, + const client & i_rScopeGivingCe ) const +{ + Produce_byDocuAndScope(i_rDocuForReference, 0, i_rScopeGivingCe ); +} + +void +HF_IdlDocu::Produce_byDocuAndScope( const ce_info & i_rDocu, + const client * i_pClient, + const client & i_rScopeGivingCe ) const +{ + bool bShort = NOT i_rDocu.Short().IsEmpty(); + bool bDescr = NOT i_rDocu.Description().IsEmpty(); + + if ( i_rDocu.IsDeprecated() + OR ( + (i_pClient != 0 ? i_pClient->SightLevel() == ary::idl::sl_File : false) + AND NOT i_rDocu.IsPublished() + ) + OR i_rDocu.IsOptional() ) + { // any usage restriction + rOut.Produce_Term("Usage Restrictions"); + + if ( i_rDocu.IsDeprecated() ) + rOut.Produce_Definition() >> *new Html::Italic << "deprecated"; + if ( (i_pClient != 0 ? i_pClient->SightLevel() == ary::idl::sl_File : false) + AND NOT i_rDocu.IsPublished() ) + rOut.Produce_Definition() >> *new Html::Italic << "not published"; + if ( i_rDocu.IsOptional() ) + rOut.Produce_Definition() >> *new Html::Italic << "optional"; + + if ( i_rDocu.IsDeprecated() AND + // KORR_FUTURE + // Workaround, because DocuTex2::IsEmpty() does not + // calculate whitespace tokens only as empty. + i_rDocu.DeprecatedText().Tokens().size() > 1 ) + { + rOut.Produce_Term("Deprecation Info"); + + HF_IdlDocuTextDisplay + aDescription( Env(), 0, i_rScopeGivingCe); + aDescription.Out().Enter( rOut.Produce_Definition() ); + i_rDocu.DeprecatedText().DisplayAt( aDescription ); + aDescription.Out().Leave(); + } + } // end if (<any usage restriction>) + + if ( bShort OR bDescr ) + { + rOut.Produce_Term("Description"); + HF_IdlDocuTextDisplay + aDescription( Env(), 0, i_rScopeGivingCe); + if (bShort) + { + aDescription.Out().Enter( rOut.Produce_Definition() ); + i_rDocu.Short().DisplayAt( aDescription ); + aDescription.Out().Leave(); + } + if (bDescr) + { + aDescription.Out().Enter( rOut.Produce_Definition() ); + i_rDocu.Description().DisplayAt( aDescription ); + aDescription.Out().Leave(); + } + } + + std::vector< csi::dsapi::DT_SeeAlsoAtTag* > + aSeeAlsosWithoutText; + std::vector< csi::dsapi::DT_SeeAlsoAtTag* > + aSeeAlsosWithText; + + for ( std::vector< ary::inf::AtTag2* >::const_iterator + iter = i_rDocu.Tags().begin(); + iter != i_rDocu.Tags().end(); + ++iter ) + { + csi::dsapi::DT_SeeAlsoAtTag* + pSeeAlso = dynamic_cast< csi::dsapi::DT_SeeAlsoAtTag * >(*iter); + if (pSeeAlso != 0 ) + { + if ( pSeeAlso->Text().IsEmpty() ) + { + aSeeAlsosWithoutText.push_back(pSeeAlso); + } + else + { + aSeeAlsosWithText.push_back(pSeeAlso); + } + continue; + } + + if ( strlen( (*iter)->Title() ) > 0 ) + { + HF_IdlTag + aTag(Env(), i_rScopeGivingCe); + Xml::Element & + rTerm = rOut.Produce_Term(); + aTag.Produce_byData( rTerm, + rOut.Produce_Definition(), + *(*iter) ); + } + } // end for + + if (aSeeAlsosWithoutText.size() > 0) + { + HF_IdlTag + aSeeAlsoTag(Env(), i_rScopeGivingCe); + Xml::Element & + rTerm = rOut.Produce_Term(); + aSeeAlsoTag.Produce_byData( rTerm, + rOut.Produce_Definition(), + aSeeAlsosWithoutText ); + } + + for ( std::vector< csi::dsapi::DT_SeeAlsoAtTag* >::const_iterator + itSee2 = aSeeAlsosWithText.begin(); + itSee2 != aSeeAlsosWithText.end(); + ++itSee2 ) + { + HF_IdlTag + aTag(Env(), i_rScopeGivingCe); + Xml::Element & + rTerm = rOut.Produce_Term(); + aTag.Produce_byData( rTerm, + rOut.Produce_Definition(), + *(*itSee2) ); + } // end for +} diff --git a/autodoc/source/display/idl/hfi_doc.hxx b/autodoc/source/display/idl/hfi_doc.hxx new file mode 100644 index 000000000000..424d01cbc5e2 --- /dev/null +++ b/autodoc/source/display/idl/hfi_doc.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * 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_HFI_DOC_HXX +#define ADC_DISPLAY_HFI_DOC_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + + +class HF_DocEntryList; + + +class HF_IdlDocu : public HtmlFactory_Idl +{ + public: + HF_IdlDocu( + Environment & io_rEnv, + HF_DocEntryList & o_rOut ); + virtual ~HF_IdlDocu(); + + + /** Produces documentation by the CodeInfo accompanying + ->i_ce. + */ + void Produce_fromCodeEntity( + const client & i_ce ) const; + + /** Produces documentation by the CodeInfo accompanying + a link or reference to a CodeEntity. + + @param i_rScopeGivingCe + Gives the scope from which links are to be calculated. + */ + void Produce_fromReference( + const ce_info & i_rDocuForReference, + const client & i_rScopeGivingCe ) const; + + private: + // Locals + /** Produces documentation. + + @param i_rScopeGivingCe + Gives the scope from which links are to be calculated. + */ + void Produce_byDocuAndScope( + const ce_info & i_rDocu, + const client * i_pClient, /// May be 0. + const client & i_rScopeGivingCe ) const; + + // DATA + HF_DocEntryList & rOut; +}; + + +#endif diff --git a/autodoc/source/display/idl/hfi_enum.cxx b/autodoc/source/display/idl/hfi_enum.cxx new file mode 100644 index 000000000000..6532242ebc3c --- /dev/null +++ b/autodoc/source/display/idl/hfi_enum.cxx @@ -0,0 +1,133 @@ +/************************************************************************* + * + * 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 "hfi_enum.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/ik_enum.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_navi_sub.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_navibar.hxx" +#include "hfi_property.hxx" +#include "hi_linkhelper.hxx" + + +extern const String + C_sCePrefix_Enum("enum"); + +namespace +{ + +const String + C_sList_Values("Values"); +const String + C_sList_Values_Label("Values"); +const String + C_sList_ValueDetails("Values' Details"); +const String + C_sList_ValueDetails_Label("ValueDetails"); + +enum E_SubListIndices +{ + sli_ValuesSummary = 0, + sli_ValueDetails = 1 +}; + +} // anonymous namespace + +HF_IdlEnum::HF_IdlEnum( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlEnum::~HF_IdlEnum() +{ +} + +void +HF_IdlEnum::Produce_byData( const client & i_ce ) const +{ + Dyn<HF_NaviSubRow> + pNaviSubRow( &make_Navibar(i_ce) ); + + HF_TitleTable + aTitle(CurOut()); + + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + produce_Title(aTitle, C_sCePrefix_Enum, i_ce); + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); + + dyn_ce_list + dpValues; + ary::idl::ifc_enum::attr::Get_Values(dpValues, i_ce); + if ( (*dpValues).operator bool() ) + { + produce_Members( *dpValues, + C_sList_Values, + C_sList_Values_Label, + C_sList_ValueDetails, + C_sList_ValueDetails_Label ); + pNaviSubRow->SwitchOn(sli_ValuesSummary); + pNaviSubRow->SwitchOn(sli_ValueDetails); + } + pNaviSubRow->Produce_Row(); +} + +HF_NaviSubRow & +HF_IdlEnum::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeMainRow(i_ce); + + DYN HF_NaviSubRow & + ret = aNaviBar.Add_SubRow(); + ret.AddItem(C_sList_Values, C_sList_Values_Label, false); + ret.AddItem(C_sList_ValueDetails, C_sList_ValueDetails_Label, false); + + CurOut() << new Html::HorizontalLine(); + return ret; +} + +void +HF_IdlEnum::produce_MemberDetails( HF_SubTitleTable & o_table, + const client & i_ce) const +{ + HF_IdlEnumValue + aElement( Env(), o_table ); + aElement.Produce_byData(i_ce); +} diff --git a/autodoc/source/display/idl/hfi_enum.hxx b/autodoc/source/display/idl/hfi_enum.hxx new file mode 100644 index 000000000000..e04827374a9e --- /dev/null +++ b/autodoc/source/display/idl/hfi_enum.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * 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_HFI_ENUM_HXX +#define ADC_DISPLAY_HFI_ENUM_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + + +class HF_IdlEnum : public HtmlFactory_Idl +{ + public: + HF_IdlEnum( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlEnum(); + + void Produce_byData( + const client & ce ) const; + private: + HF_NaviSubRow & make_Navibar( + const client & ce ) const; + virtual void produce_MemberDetails( + HF_SubTitleTable & o_table, + const client & ce ) const; +}; + + + +// IMPLEMENTATION + + +extern const String + C_sCePrefix_Enum; + +#endif + + diff --git a/autodoc/source/display/idl/hfi_globalindex.cxx b/autodoc/source/display/idl/hfi_globalindex.cxx new file mode 100644 index 000000000000..0e974d61fa42 --- /dev/null +++ b/autodoc/source/display/idl/hfi_globalindex.cxx @@ -0,0 +1,275 @@ +/************************************************************************* + * + * 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 "hfi_globalindex.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_types4idl.hxx> +#include <ary/idl/i_module.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_navibar.hxx" +#include "hfi_typetext.hxx" +#include "hi_linkhelper.hxx" + + + + +namespace +{ + +/** +*/ +enum E_Types +{ + t_service = 0, + t_interface = 1, + t_struct = 2, + t_exception = 3, + t_enum = 4, + t_typedef = 5, + t_constantsgroup = 6, + t_property = 7, + t_function = 8, + t_structelement = 9, + t_enumvalue = 10, + t_constant = 11, + t_module = 12, + t_singleton = 13, + t_attribute = 14, + t_siservice = 15, + t_sisingleton = 16, + t_MAX +}; + +String G_sDummy; + + +/* RC-Ids for IDL types (see reposy.cxx): + + Module 2000 + Interface 2001 + Function 2002 + Service 2003 + Property 2004 + + Enum 2005 + EnumValue 2006 + Typedef 2007 + Struct 2008 + StructElement 2009 + + Exception 2010 + ConstantGroup 2011 + Constant 2012 + Singleton 2013 + Attribute 2014 + SglIfcService 2015 + SglIfcSingleton 2016 +*/ +const int C_nNumberOfIdlTypes = 17; +const char * C_sTypeNames[C_nNumberOfIdlTypes] = + { "module ", "interface ", "function ", "service ", "property ", + "enum ", "value ", "typedef ", "struct ", "field ", + "exception ", "constants group ", "constant ","singleton ", "attribute ", + "service", "singleton" + }; +const char * C_sOwnerNames[C_nNumberOfIdlTypes] = + { "module ", "module ", "interface ", "module ", "service ", + "module ", "enum ", "module ", "module ", "", // could be struct or exception + "module ", "module ", "constants group ", "module ", "interface ", + "module", "module" + }; +const intt C_nNamesArrayOffset = intt(ary::idl::Module::class_id); +const int C_nIxField = 9; + + + + +const char C_cAlphabet[] = +"<a class=\"inverse\" href=\"index-1.html\"><B>A</B></a> <a class=\"inverse\" href=\"index-2.html\"><B>B</B></a> <a class=\"inverse\" href=\"index-3.html\"><B>C</B></a> <a class=\"inverse\" href=\"index-4.html\"><B>D</B></a> <a class=\"inverse\" href=\"index-5.html\"><B>E</B></a> " +"<a class=\"inverse\" href=\"index-6.html\"><B>F</B></a> <a class=\"inverse\" href=\"index-7.html\"><B>G</B></a> <a class=\"inverse\" href=\"index-8.html\"><B>H</B></a> <a class=\"inverse\" href=\"index-9.html\"><B>I</B></a> <a class=\"inverse\" href=\"index-10.html\"><B>J</B></a> " +"<a class=\"inverse\" href=\"index-11.html\"><B>K</B></a> <a class=\"inverse\" href=\"index-12.html\"><B>L</B></a> <a class=\"inverse\" href=\"index-13.html\"><B>M</B></a> <a class=\"inverse\" href=\"index-14.html\"><B>N</B></a> <a class=\"inverse\" href=\"index-15.html\"><B>O</B></a> " +"<a class=\"inverse\" href=\"index-16.html\"><B>P</B></a> <a class=\"inverse\" href=\"index-17.html\"><B>Q</B></a> <a class=\"inverse\" href=\"index-18.html\"><B>R</B></a> <a class=\"inverse\" href=\"index-19.html\"><B>S</B></a> <a class=\"inverse\" href=\"index-20.html\"><B>T</B></a> " +"<a class=\"inverse\" href=\"index-21.html\"><B>U</B></a> <a class=\"inverse\" href=\"index-22.html\"><B>V</B></a> <a class=\"inverse\" href=\"index-23.html\"><B>W</B></a> <a class=\"inverse\" href=\"index-24.html\"><B>X</B></a> <a class=\"inverse\" href=\"index-25.html\"><B>Y</B></a> " +"<a class=\"inverse\" href=\"index-26.html\"><B>Z</B></a>"; + + + +HF_IdlGlobalIndex::PageData G_PageData; + +} // end anonymous namespace + + +inline void +HF_IdlGlobalIndex::write_EntryItself( Xml::Element & o_destination, + const ary::idl::CodeEntity & i_ce, + const HF_IdlTypeText & i_typeLinkWriter ) const +{ + i_typeLinkWriter.Produce_IndexLink(o_destination, i_ce); + o_destination << " - "; +} + + +HF_IdlGlobalIndex::HF_IdlGlobalIndex( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlGlobalIndex::~HF_IdlGlobalIndex() +{ +} + +void +HF_IdlGlobalIndex::Produce_Page(ary::idl::alphabetical_index::E_Letter i_letter) const +{ + make_Navibar(); + + HF_TitleTable + aTitle(CurOut()); + StreamLock sl(100); + aTitle.Produce_Title( sl() + << "Global Index " + << ( i_letter != ary::idl::alphabetical_index::non_alpha + ? char(int(i_letter)-'a'+'A') + : '_' ) + << c_str ); + + // Letters Index + aTitle.Add_Row() + << new Xml::XmlCode( + "<p align=\"center\"><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></p>" ); + + Out().Enter(CurOut() >> *new Html::DefList); + + csv::erase_container(G_PageData); + Env().Data().Get_IndexData(G_PageData, i_letter); + + // Helper object to produce links to the index Entries. + HF_IdlTypeText aTypeLinkWriter(Env(),HF_IdlTypeText::use_for_javacompatible_index); + + PageData::const_iterator itEnd = G_PageData.end(); + for ( PageData::const_iterator iter = G_PageData.begin(); + iter != itEnd; + ++iter ) + { + produce_Line(iter, aTypeLinkWriter); + } // end for + + Out().Leave(); + CurOut() << new Html::HorizontalLine; +} + +void +HF_IdlGlobalIndex::make_Navibar() const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_IndexMainRow(); + + CurOut() << new Html::HorizontalLine(); +} + +void +HF_IdlGlobalIndex::produce_Line( PageData::const_iterator i_entry, + const HF_IdlTypeText & i_typeLinkWriter) const +{ + const client & + rCe = Env().Data().Find_Ce(*i_entry); + if (NOT rCe.Owner().IsValid()) + return; // Omit global namespace. + + // The destination for the created output: + Xml::Element & rDT = CurOut() >> *new Html::DefListTerm; + + /** The following code is intended to produce an output that + will be recognized by the context help system of Forte. + That is reached by making it similar to the indices, that + Javadoc produces. + If the link to the Entry contains a hashmark, the Forte-Help + requires following a link to the owner. + But if there is no hashmark, the following link must go to + the same Entry again. Doesn't make really sense :-(, but that's + like it is. + */ + write_EntryItself(rDT,rCe,i_typeLinkWriter); + if (rCe.SightLevel() == ary::idl::sl_Member) + write_OwnerOfEntry(rDT,rCe,i_typeLinkWriter); + else + write_EntrySecondTime(rDT,rCe,i_typeLinkWriter); + + // This produces an empty "<dd></dd>", which is also needed to reach + // similarity to the Javadoc index: + CurOut() << new Html::DefListDefinition; +} + +void +HF_IdlGlobalIndex::write_OwnerOfEntry( Xml::Element & o_destination, + const ary::idl::CodeEntity & i_ce, + const HF_IdlTypeText & i_typeLinkWriter ) const +{ + const client & + rOwner = Env().Data().Find_Ce(i_ce.Owner()); + + int nIx = int(i_ce.AryClass() - C_nNamesArrayOffset); + csv_assert(csv::in_range(0,nIx,C_nNumberOfIdlTypes)); + + o_destination << C_sTypeNames[nIx] + << "in "; + if (nIx != C_nIxField) + { + o_destination << C_sOwnerNames[nIx]; + } + else + { + uintt + nOwnerIx = rOwner.AryClass() - C_nNamesArrayOffset; + csv_assert( + nOwnerIx < static_cast< unsigned int >(C_nNumberOfIdlTypes)); + o_destination << C_sTypeNames[nOwnerIx]; + } + i_typeLinkWriter.Produce_IndexOwnerLink(o_destination, rOwner); +} + +void +HF_IdlGlobalIndex::write_EntrySecondTime( Xml::Element & o_destination, + const ary::idl::CodeEntity & i_ce, + const HF_IdlTypeText & i_typeLinkWriter ) const +{ + int nIx = int(i_ce.AryClass() - C_nNamesArrayOffset); + csv_assert(csv::in_range(0,nIx,C_nNumberOfIdlTypes)); + + o_destination << C_sTypeNames[nIx] + << " "; + i_typeLinkWriter.Produce_IndexSecondEntryLink(o_destination, i_ce); +} diff --git a/autodoc/source/display/idl/hfi_globalindex.hxx b/autodoc/source/display/idl/hfi_globalindex.hxx new file mode 100644 index 000000000000..45e953baaed5 --- /dev/null +++ b/autodoc/source/display/idl/hfi_globalindex.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * 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_HFI_GLOBALINDEX_HXX +#define ADC_DISPLAY_HFI_GLOBALINDEX_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_gate.hxx> + + +class HF_IdlTypeText; + +class HF_IdlGlobalIndex : public HtmlFactory_Idl +{ + public: + typedef std::vector<ary::idl::Ce_id> PageData; + + HF_IdlGlobalIndex( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlGlobalIndex(); + + void Produce_Page( + ary::idl::alphabetical_index::E_Letter + i_letter ) const; + private: + void make_Navibar() const; /// Called by @->Produce_Page() + void produce_Line( /// Called by @->Produce_Page() + PageData::const_iterator + i_entry, + const HF_IdlTypeText & + i_typeLinkWriter ) const; + + void write_EntryItself( /// Called by @->produceLine() + Xml::Element & o_destination, + const ary::idl::CodeEntity & + i_entry, + const HF_IdlTypeText & + i_typeLinkWriter ) const; + + void write_OwnerOfEntry( /// Called by @->produceLine() + Xml::Element & o_destination, + const ary::idl::CodeEntity & + i_entry, + const HF_IdlTypeText & + i_typeLinkWriter ) const; + + void write_EntrySecondTime( /// Called by @->produceLine() + Xml::Element & o_destination, + const ary::idl::CodeEntity & + i_entry, + const HF_IdlTypeText & + i_typeLinkWriter ) const; +}; + + + +#endif + diff --git a/autodoc/source/display/idl/hfi_hierarchy.cxx b/autodoc/source/display/idl/hfi_hierarchy.cxx new file mode 100644 index 000000000000..d4db7f9028f1 --- /dev/null +++ b/autodoc/source/display/idl/hfi_hierarchy.cxx @@ -0,0 +1,202 @@ +/************************************************************************* + * + * 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 "hfi_hierarchy.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <udm/html/htmlitem.hxx> +#include <ary/stdconstiter.hxx> +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_type.hxx> +#include <ary/idl/ik_interface.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/idl/ip_type.hxx> +#include "hfi_interface.hxx" +#include "hfi_typetext.hxx" +#include "hi_env.hxx" + + + +HF_IdlBaseNode::HF_IdlBaseNode( const TYPE & i_rType, + const GATE & i_rGate, + intt i_nPositionOffset, + HF_IdlBaseNode & io_rDerived ) + : nType(i_rType.TypeId()), + aBases(), + nCountBases(0), + nPosition(i_nPositionOffset), + pDerived(&io_rDerived) +{ + Ce_id nCe = i_rGate.Types().Search_CeRelatedTo(nType); + if (nCe.IsValid()) + { + GatherBases(i_rGate.Ces().Find_Ce(nCe), i_rGate); + } +} + +HF_IdlBaseNode::~HF_IdlBaseNode() +{ +} + +void +HF_IdlBaseNode::FillPositionList( std::vector< const HF_IdlBaseNode* > & o_rPositionList ) const +{ + for ( BaseList::const_iterator it = aBases.begin(); + it != aBases.end(); + ++it ) + { + (*it)->FillPositionList(o_rPositionList); + } // end for + + o_rPositionList.push_back(this); +} + +void +HF_IdlBaseNode::GatherBases( const CE & i_rCe, + const GATE & i_rGate ) +{ + ary::Dyn_StdConstIterator<ary::idl::CommentedRelation> + aHelp; + ary::idl::ifc_interface::attr::Get_Bases(aHelp,i_rCe); + + for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *aHelp; + it.operator bool(); + ++it ) + { + const TYPE & + rBaseType = i_rGate.Types().Find_Type((*it).Type()); + + Dyn<HF_IdlBaseNode> + pBaseNode( new HF_IdlBaseNode( rBaseType, + i_rGate, + nPosition, + *this ) + ); + + intt nAddedBases = pBaseNode->BaseCount() + 1; + nCountBases += nAddedBases; + nPosition += nAddedBases; + aBases.push_back( pBaseNode.Release() ); + } // end for +} + + +void +Write_BaseHierarchy( csi::xml::Element & o_rOut, + HtmlEnvironment_Idl & i_env, + const ary::idl::CodeEntity & i_ce ) +{ + csi::xml::Element & + rPre = o_rOut + >> *new csi::xml::AnElement("pre") + << new csi::html::StyleAttr("font-family:monospace;"); + + std::vector<uintt> + aSetColumns; + rPre + >> *new csi::html::Strong + << i_ce.LocalName(); + rPre + << "\n"; + Write_Bases( rPre, + i_env, + i_ce, + aSetColumns ); + rPre + << "\n"; + +} + + +void +Write_Bases( csi::xml::Element & o_out, + HtmlEnvironment_Idl & i_env, + const ary::idl::CodeEntity & i_rCe, + std::vector<uintt> & io_setColumns ) +{ + ary::Dyn_StdConstIterator<ary::idl::CommentedRelation> + aHelp; + ary::idl::ifc_interface::attr::Get_Bases(aHelp,i_rCe); + + for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *aHelp; + it.operator bool(); + // NO INCREMENT HERE, see below + ) + { + ary::idl::Type_id + nType = (*it).Type(); + ++it; + bool + bThereComesMore = it.operator bool(); + + ary::idl::Ce_id + nCe = i_env.Gate().Types().Search_CeRelatedTo(nType); + if (nCe.IsValid()) + { + // KORR_FUTURE + // Rather check for id(!) of com::sun::star::uno::XInterface. + if (i_env.Gate().Ces().Find_Ce(nCe).LocalName() == "XInterface") + continue; + } + + for (uintt i = 0; i < io_setColumns.size(); ++i) + { + if (io_setColumns[i] == 1) + o_out << new csi::xml::XmlCode("┃"); + else + o_out << " "; + o_out << " "; + } + + if (bThereComesMore) + o_out << new csi::xml::XmlCode("┣"); + else + o_out << new csi::xml::XmlCode("┗"); + o_out << " "; + + HF_IdlTypeText + aDisplay( i_env, o_out, true, i_env.CurPageCe()); + aDisplay.Produce_byData(nType); + o_out << "\n"; + + if (nCe.IsValid()) + { + io_setColumns.push_back(bThereComesMore ? 1 : 0); + + const ary::idl::CodeEntity & + rCe = i_env.Gate().Ces().Find_Ce(nCe); + Write_Bases( o_out, + i_env, + rCe, + io_setColumns ); + io_setColumns.pop_back(); + } + } // end for +} diff --git a/autodoc/source/display/idl/hfi_hierarchy.hxx b/autodoc/source/display/idl/hfi_hierarchy.hxx new file mode 100644 index 000000000000..e918a3345821 --- /dev/null +++ b/autodoc/source/display/idl/hfi_hierarchy.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * 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_HFI_HIERARCHY_HXX +#define ADC_DISPLAY_HFI_HIERARCHY_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_comrela.hxx> +#include <ary/idl/i_types4idl.hxx> + + +namespace csi +{ +namespace xml +{ + class Element; +} +} + + +class HF_IdlInterface; +class HtmlEnvironment_Idl; + + + +/** Represents a node in an pyramidic inheritance hierarchy which shall be + displayed in text mode. +*/ +class HF_IdlBaseNode +{ + public: + typedef ary::idl::CodeEntity CE; + typedef ary::idl::Type TYPE; + typedef ary::idl::Gate GATE; + typedef ary::idl::Ce_id Ce_id; + typedef ary::idl::Type_id Type_id; + + /** @descr + The constructor recursively calls further constructors of + HF_IdlBaseNode for the bases of ->i_rType, if ->i_rType matches to a + ->CE. + So it builds up a complete hierarchy tree of all base classes + of ->i_pEntity. + */ + HF_IdlBaseNode( + const TYPE & i_rType, + const GATE & i_rGate, + intt i_nPositionOffset, + HF_IdlBaseNode & io_rDerived ); + ~HF_IdlBaseNode(); + + /** Recursively fills ->o_rPositionList with the instances of base + classes in the order in which they will be displayed. + */ + void FillPositionList( + std::vector< const HF_IdlBaseNode* > & + o_rPositionList ) const; + + Type_id Type() const { return nType; } + intt BaseCount() const { return nCountBases; } + intt Position() const { return nPosition; } + int Xpos() const { return 3*Position(); } + int Ypos() const { return 2*Position(); } + const HF_IdlBaseNode * Derived() const { return pDerived; } + + private: + typedef std::vector< DYN HF_IdlBaseNode* > BaseList; + + void GatherBases( + const CE & i_rCe, + const GATE & i_rGate ); + + // DATA + Type_id nType; + BaseList aBases; + intt nCountBases; + intt nPosition; + HF_IdlBaseNode * pDerived; +}; + +void Write_BaseHierarchy( + csi::xml::Element & o_rOut, + HtmlEnvironment_Idl & + i_env, + const ary::idl::CodeEntity & + i_rCe ); + +void Write_Bases( + csi::xml::Element & o_rOut, + HtmlEnvironment_Idl & + i_env, + const ary::idl::CodeEntity & + i_rCe, + std::vector<uintt> & + io_setColumns ); + +#endif diff --git a/autodoc/source/display/idl/hfi_interface.cxx b/autodoc/source/display/idl/hfi_interface.cxx new file mode 100644 index 000000000000..8e7a637f12c8 --- /dev/null +++ b/autodoc/source/display/idl/hfi_interface.cxx @@ -0,0 +1,357 @@ +/************************************************************************* + * + * 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 "hfi_interface.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ik_function.hxx> +#include <ary/idl/ik_interface.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/idl/ip_type.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_navi_sub.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_doc.hxx" +#include "hfi_hierarchy.hxx" +#include "hfi_method.hxx" +#include "hfi_navibar.hxx" +#include "hfi_property.hxx" +#include "hfi_tag.hxx" +#include "hfi_typetext.hxx" +#include "hi_linkhelper.hxx" + + +extern const String + C_sCePrefix_Interface("interface"); + +namespace +{ + +const String + C_sBaseInterface("Base Interfaces"); +const String + C_sList_BaseComments("Comments on Base Interfaces"); +const String + C_sList_Methods("Methods' Summary"); +const String + C_sList_Methods_Label("MethodsSummary"); +const String + C_sDetails_Methods("Methods' Details"); +const String + C_sDetails_Methods_Label("MethodsDetails"); + +const String + C_sList_Attributes("Attributes' Summary"); +const String + C_sList_Attributes_Label("AttributesSummary"); +const String + C_sList_AttributesDetails("Attributes' Details"); +const String + C_sList_AttributesDetails_Label("AttributesDetails"); + + + +enum E_SubListIndices +{ + sli_MethodsSummay = 0, + sli_AttributesSummary = 1, + sli_MethodDetails = 2, + sli_AttributesDetails = 3 +}; + +} //anonymous namespace + + + + +HF_IdlInterface::HF_IdlInterface( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut), + eCurProducedMembers(mem_none) +{ +} + +HF_IdlInterface::~HF_IdlInterface() +{ +} + +void +HF_IdlInterface::Produce_byData( const client & i_ce ) const +{ + Dyn<HF_NaviSubRow> + pNaviSubRow( &make_Navibar(i_ce) ); + + HF_TitleTable + aTitle(CurOut()); + + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + + produce_Title(aTitle, C_sCePrefix_Interface, i_ce); + + produce_BaseHierarchy( aTitle.Add_Row(), + i_ce, + C_sBaseInterface ); + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); + + dyn_ce_list dpFunctions; + ary::idl::ifc_interface::attr::Get_Functions(dpFunctions, i_ce); + if ( (*dpFunctions).operator bool() ) + { + eCurProducedMembers = mem_Functions; + + produce_Members( *dpFunctions, + C_sList_Methods, + C_sList_Methods_Label, + C_sDetails_Methods, + C_sDetails_Methods_Label, + HtmlFactory_Idl::viewtype_summary ); + pNaviSubRow->SwitchOn(sli_MethodsSummay); + } + + dyn_ce_list + dpAttributes; + ary::idl::ifc_interface::attr::Get_Attributes(dpAttributes, i_ce); + if ( (*dpAttributes).operator bool() ) + { + eCurProducedMembers = mem_Attributes; + + produce_Members( *dpAttributes, + C_sList_Attributes, + C_sList_Attributes_Label, + C_sList_AttributesDetails, + C_sList_AttributesDetails_Label, + HtmlFactory_Idl::viewtype_summary ); + pNaviSubRow->SwitchOn(sli_AttributesSummary); + } + + ary::idl::ifc_interface::attr::Get_Functions(dpFunctions, i_ce); + if ( (*dpFunctions).operator bool() ) + { + eCurProducedMembers = mem_Functions; + + produce_Members( *dpFunctions, + C_sList_Methods, + C_sList_Methods_Label, + C_sDetails_Methods, + C_sDetails_Methods_Label, + HtmlFactory_Idl::viewtype_details ); + pNaviSubRow->SwitchOn(sli_MethodDetails); + } + + ary::idl::ifc_interface::attr::Get_Attributes(dpAttributes, i_ce); + if ( (*dpAttributes).operator bool() ) + { + eCurProducedMembers = mem_Attributes; + + produce_Members( *dpAttributes, + C_sList_Attributes, + C_sList_Attributes_Label, + C_sList_AttributesDetails, + C_sList_AttributesDetails_Label, + HtmlFactory_Idl::viewtype_details ); + pNaviSubRow->SwitchOn(sli_AttributesDetails); + } + + eCurProducedMembers = mem_none; + + pNaviSubRow->Produce_Row(); +} + +DYN HF_NaviSubRow & +HF_IdlInterface::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeMainRow(i_ce); + + DYN HF_NaviSubRow & + ret = aNaviBar.Add_SubRow(); + ret.AddItem(C_sList_Methods, C_sList_Methods_Label, false); + ret.AddItem(C_sList_Attributes, C_sList_Attributes_Label, false); + ret.AddItem(C_sDetails_Methods, C_sDetails_Methods_Label, false); + ret.AddItem(C_sList_AttributesDetails, C_sList_AttributesDetails_Label, false); + + CurOut() << new Html::HorizontalLine(); + return ret; +} + +void +HF_IdlInterface::produce_MemberDetails( HF_SubTitleTable & o_table, + const client & i_ce ) const +{ + switch (eCurProducedMembers) + { + case mem_Functions: + break; + case mem_Attributes: + { + HF_IdlAttribute + aAttribute( Env(), o_table); + aAttribute.Produce_byData( i_ce ); + return; + }; + default: //Won't happen. + return; + } // end switch + + typedef ary::idl::ifc_function::attr funcAttr; + + HF_IdlMethod + aFunction( Env(), + o_table.Add_Row() + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_MDetail) ); + + ary::Dyn_StdConstIterator<ary::idl::Parameter> + pParameters; + funcAttr::Get_Parameters(pParameters, i_ce); + + ary::Dyn_StdConstIterator<ary::idl::Type_id> + pExceptions; + funcAttr::Get_Exceptions(pExceptions, i_ce); + + aFunction.Produce_byData( i_ce.LocalName(), + funcAttr::ReturnType(i_ce), + *pParameters, + *pExceptions, + funcAttr::IsOneway(i_ce), + funcAttr::HasEllipse(i_ce), + i_ce ); +} + +void +HF_IdlInterface::produce_BaseHierarchy( Xml::Element & o_screen, + const client & i_ce, + const String & i_sLabel ) const +{ + ary::Dyn_StdConstIterator<ary::idl::CommentedRelation> + pHelp; + ary::idl::ifc_interface::attr::Get_Bases(pHelp, i_ce); + if (NOT (*pHelp).operator bool()) + return; + + // Check for XInterface as only base: + ary::StdConstIterator<ary::idl::CommentedRelation> & + itTest = *pHelp; + ary::idl::Ce_id + nCe = Env().Gate().Types().Search_CeRelatedTo((*itTest).Type()); + if (nCe.IsValid()) + { + // KORR_FUTURE + // Rather check for id(!) of com::sun::star::uno::XInterface. + if (Env().Gate().Ces().Find_Ce(nCe).LocalName() == "XInterface") + { + ++itTest; + if (NOT itTest.operator bool()) + return; + } + } + + // Write hierarchy: + + HF_DocEntryList + aDocList( o_screen ); + aDocList.Produce_Term(i_sLabel); + Xml::Element & + rBaseList = aDocList.Produce_Definition(); + +// NEW + Write_BaseHierarchy(rBaseList, Env(), i_ce); + + // Write comments: + // KORR_FUTURE: Make sure, no empty table is constructed when comments list is empty. + HF_SubTitleTable + aBaseTable( aDocList.Produce_Definition(), + "", + C_sList_BaseComments, + 2, + HF_SubTitleTable::sublevel_3 ); + + ary::Dyn_StdConstIterator<ary::idl::CommentedRelation> + pBases; + ary::idl::ifc_interface::attr::Get_Bases(pBases, i_ce); + for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *pBases; + it.operator bool(); + ++it ) + { + Xml::Element & + rRow = aBaseTable.Add_Row(); + + Xml::Element & + rTerm = rRow + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_SummaryLeft); + HF_IdlTypeText + aTypeDisplay( Env(), rTerm, false, 0); + aTypeDisplay.Produce_byData((*it).Type()); + + Xml::Element & + rDocu = rRow + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_SummaryRight); + + HF_DocEntryList + aDocuList(rDocu); + + if ((*it).Info() != 0) + { +// aDocuList.Produce_Term("Comment on Base Reference"); + + HF_IdlDocu + aDocuDisplay(Env(), aDocuList); + aDocuDisplay.Produce_fromReference(*(*it).Info(), i_ce); + } + else + { + const client * + pCe = Env().Linker().Search_CeFromType((*it).Type()); + const ce_info * + pShort = pCe != 0 + ? Get_IdlDocu(pCe->Docu()) + : (const ce_info *)(0); + if ( pShort != 0 ) + { + aDocuList.Produce_NormalTerm("(referenced interface's summary:)"); + + Xml::Element & + rDef = aDocuList.Produce_Definition(); + HF_IdlDocuTextDisplay + aShortDisplay( Env(), &rDef, *pCe); + pShort->Short().DisplayAt(aShortDisplay); + } // end if (pShort != 0) + } // endif ( (*i_commentedRef).Info() != 0 ) else + } // end for +} diff --git a/autodoc/source/display/idl/hfi_interface.hxx b/autodoc/source/display/idl/hfi_interface.hxx new file mode 100644 index 000000000000..9f2c77c64a97 --- /dev/null +++ b/autodoc/source/display/idl/hfi_interface.hxx @@ -0,0 +1,90 @@ +/************************************************************************* + * + * 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_HFI_INTERFACE_HXX +#define ADC_DISPLAY_HFI_INTERFACE_HXX + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_types4idl.hxx> +#include <ary/doc/d_oldidldocu.hxx> + + +class HF_NaviSubRow; +class HF_SubTitleTable; +class HF_IdlBaseNode; + +class HF_IdlInterface : public HtmlFactory_Idl +{ + public: + HF_IdlInterface( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlInterface(); + + void Produce_byData( + const client & i_ce ) const; + private: + // Locals + DYN HF_NaviSubRow & make_Navibar( + const client & i_ce ) const; + + virtual void produce_MemberDetails( + HF_SubTitleTable & o_table, + const client & ce ) const; + void produce_BaseHierarchy( + Xml::Element & o_screen, + const client & i_ce, + const String & i_sLabel ) const; + + // Locals + enum E_CurProducedMembers + { + mem_none, + mem_Functions, + mem_Attributes + }; + + // DATA + mutable E_CurProducedMembers + eCurProducedMembers; +}; + + + +// IMPLEMENTATION + +extern const String + C_sCePrefix_Interface; + + + +#endif diff --git a/autodoc/source/display/idl/hfi_linklist.cxx b/autodoc/source/display/idl/hfi_linklist.cxx new file mode 100644 index 000000000000..3ab52ab4d722 --- /dev/null +++ b/autodoc/source/display/idl/hfi_linklist.cxx @@ -0,0 +1,378 @@ +/************************************************************************* + * + * 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 "hfi_linklist.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/idl/ip_type.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_doc.hxx" +#include "hfi_tag.hxx" +#include "hfi_typetext.hxx" +#include "hi_ary.hxx" +#include "hi_env.hxx" + + + + +//******************* HF_CommentedLink_Table **********************************// + +HF_CommentedLink_Table::HF_CommentedLink_Table( Environment & io_rEnv, + Xml::Element & o_rOut, + const String & i_sTitle, + const String & i_sLabel, + bool i_bBorder ) + : HtmlFactory_Idl(io_rEnv,&o_rOut), + pTable( new Html::Table( (i_bBorder ? "1" : "0"), "100%", "5", "0") ), + pCurLinkColumn(0), + pCurCommentColumn(0) +{ + *pTable + << new Html::ClassAttr("commentedlinks"); + + CurOut() + >> *new Html::Label(i_sLabel) + << new Html::LineBreak; + CurOut() + << pTable; +// HF_SubTitle aTitle(*pTable); +// aTitle.Produce_it(i_sTitle); +} + +HF_CommentedLink_Table::~HF_CommentedLink_Table() +{ +} + +void +HF_CommentedLink_Table::Add_Line() +{ + Html::TableRow & + rRow = pTable->AddRow(); + + pCurLinkColumn = & (rRow.AddCell() + << new Html::WidthAttr("30%") + << new Xml::AnAttribute("valign","top") ); + pCurCommentColumn = & rRow.AddCell(); +} + +Xml::Element & +HF_CommentedLink_Table::Cur_LinkColumn() +{ + csv_assert(pCurLinkColumn != 0); + return *pCurLinkColumn; +} + +Xml::Element & +HF_CommentedLink_Table::Cur_CommentColumn() +{ + csv_assert(pCurCommentColumn != 0); + return *pCurCommentColumn; +} + + +//******************* HF_MemberTable **********************************// + +HF_MemberTable::HF_MemberTable( Environment & io_rEnv, + Xml::Element & o_rOut, + const String & i_sTitle, + const String & i_sLabel, + bool i_bInline ) + : HtmlFactory_Idl(io_rEnv,&o_rOut), + pTable( new Html::Table("1", "100%", "5", "0") ), + pCurDeclaration(0), + pCurDescription(0), + bInline(i_bInline) +{ + *pTable + << new Html::ClassAttr("memberlist"); + + CurOut() + >> *new Html::Label(i_sLabel) + << new Html::LineBreak; + CurOut() + << pTable; +// HF_SubTitle aTitle(*pTable); +// aTitle.Produce_it(i_sTitle); +} + +HF_MemberTable::~HF_MemberTable() +{ +} + +void +HF_MemberTable::Add_Line() +{ + if (bInline) + { + Html::TableRow & rRow = pTable->AddRow(); + + pCurDeclaration = &( rRow.AddCell() + << new Xml::AnAttribute("valign","top") + << new Html::WidthAttr("30%") ); + pCurDescription = & rRow.AddCell(); + } + else + { + Html::DefList * + pMemberSpace = new Html::DefList; + *pMemberSpace + << new Html::ClassAttr("member"); + + pTable->AddRow().AddCell() << pMemberSpace; + + pCurDeclaration = + & ( *pMemberSpace + >> *new Html::DefListTerm + << new Html::ClassAttr("member") ); + pCurDescription = + & ( *pMemberSpace + >> *new Html::DefListDefinition() + << new Html::ClassAttr("member") ); + } +} + +Xml::Element & +HF_MemberTable::Cur_Declaration() +{ + csv_assert(pCurDeclaration != 0); + return *pCurDeclaration; +} + +Xml::Element & +HF_MemberTable::Cur_Description() +{ + csv_assert(pCurDescription != 0); + return *pCurDescription; +} + + + +//******************* HF_IdlLinkList **********************************// + +HF_IdlLinkList::HF_IdlLinkList( Environment & io_rEnv, + Xml::Element * o_pOut ) + : HtmlFactory_Idl(io_rEnv,o_pOut) +{ +} + +HF_IdlLinkList::~HF_IdlLinkList() +{ +} + +void +HF_IdlLinkList::Produce_NamespaceMembers( const String & i_sTitle, + const String & i_sLabel, + const std::vector<ary::idl::Ce_id> & i_rList, + bool i_bNestedNamespaces ) const +{ + HF_CommentedLink_Table + aTableMaker( Env(), CurOut(), + i_sTitle, i_sLabel, + true ); + + std::vector<ary::idl::Ce_id>::const_iterator itEnd = i_rList.end(); + for ( std::vector<ary::idl::Ce_id>::const_iterator it = i_rList.begin(); + it != itEnd; + ++it ) + { + static String sEntryName; + static String sEntryLink; + const ce_info * + pDocu = 0; + Get_EntryData_NamespaceMembers( sEntryName, sEntryLink, pDocu, *it, i_bNestedNamespaces ); + aTableMaker.Add_Line(); + + aTableMaker.Cur_LinkColumn() + >> *new Html::Link(sEntryLink) + << sEntryName; + + if ( pDocu != 0 ) + { + HF_IdlShortDocu + aTextDisplay(Env(), aTableMaker.Cur_CommentColumn() ); + aTextDisplay.Produce_byData( pDocu ); + } + } // end for +} + +void +HF_IdlLinkList::Produce_GlobalLinks( const String & i_sTitle, + const String & i_sLabel, + ce_list & i_rList ) const +{ + HF_CommentedLink_Table + aTableMaker( Env(), CurOut(), + i_sTitle, i_sLabel, + true ); + + for ( ; i_rList; ++i_rList ) + { + aTableMaker.Add_Line(); + HF_IdlTypeText + aLinkText( Env(), aTableMaker.Cur_LinkColumn(), true ); + aLinkText.Produce_byData(*i_rList); + + const ce_info * + pDocu = Get_EntryDocu(*i_rList); + if ( pDocu != 0 ) + { + HF_IdlShortDocu + aTextDisplay(Env(), aTableMaker.Cur_CommentColumn() ); + aTextDisplay.Produce_byData( pDocu, *i_rList ); + } + } +} + +void +HF_IdlLinkList::Produce_GlobalCommentedLinks( const String & i_sTitle, + const String & i_sLabel, + comref_list & i_rList ) const +{ + HF_CommentedLink_Table + aTableMaker( Env(), CurOut(), + i_sTitle, i_sLabel, + true ); +/* + for ( ; i_rList; ++i_rList ) + { + aTableMaker.Add_Line(); + HF_IdlTypeText + aLinkText( Env(), aTableMaker.Cur_LinkColumn(), true ); + aLinkText.Produce_byData( (*i_rList).first ); + + HF_DocEntryList + aDocList( aTableMaker.Cur_CommentColumn() ); + if ( (*i_rList).second != 0 ) + { + HF_IdlDocu + aDocuDisplay( Env(), aDocList ); + aDocuDisplay.Produce_byData( (*i_rList).second ); + } + else + { + const ce_info * + pShort = Get_EntryDocu( + Env().Gate().Types().Search_CeRelatedTo( + (*i_rList).first) ); + if ( pShort != 0 ) + { + if (pShort->IsDeprecated()) + { + aDocList.Produce_Term() + << "[ DEPRECATED ]"; + } + if (pShort->IsOptional()) + { + aDocList.Produce_Term() + << "[ OPTIONAL ]"; + } + + aDocList.Produce_Term() + << "Description"; + + HF_IdlDocuTextDisplay + aShortDisplay( Env(), &aDocList.Produce_Definition() ); + aShortDisplay.Set_CurScopeTo( + Env().Gate().Types().Search_CeRelatedTo((*i_rList).first) ); + pShort->Short().DisplayAt(aShortDisplay); + } + } + } +*/ +} + +void +HF_IdlLinkList::Produce_MemberLinks( const String & i_sTitle, + const String & i_sLabel, + ce_list & i_rList ) const +{ + HF_CommentedLink_Table + aTableMaker( Env(), CurOut(), + i_sTitle, i_sLabel, + true ); + +/* + for ( ; i_rList; ++i_rList ) + { + const ary::idl::CodeEntity & + rCe = Env().Gate().Ces().Find_Ce(*i_rList); + + aTableMaker.Add_Line(); + aTableMaker.Cur_LinkColumn() + >> *new Html::Link( + StreamLock(200)() << "#" << rCe.LocalName() << c_str) + << rCe.LocalName(); + + const ce_info * + pDocu = rCe.Docu(); + if ( pDocu != 0 ) + { + HF_IdlShortDocu + aTextDisplay(Env(), aTableMaker.Cur_CommentColumn() ); + aTextDisplay.Produce_byData( *pDocu ); + } + } // end for +*/ +} + +void +HF_IdlLinkList::Get_EntryData_NamespaceMembers( + String & o_sEntryName, + String & o_sEntryLink, + const ce_info * & o_pDocu, + ce_id i_nMemberId, + bool i_bIsNestedNamespace ) const +{ + const ary::idl::CodeEntity & + rCe = Env().Data().Find_Ce(i_nMemberId); + + o_sEntryName = rCe.LocalName(); + o_sEntryLink = StreamLock(200)() << rCe.LocalName() + << ( i_bIsNestedNamespace + ? "/module-ix" + : "" ) + << ".html" + << c_str; + o_pDocu = rCe.Docu(); +} + +const ary::doc::OldIdlDocu * +HF_IdlLinkList::Get_EntryDocu(ce_id i_nMemberId) const +{ + if (i_nMemberId.IsValid()) + return Env().Data().Find_Ce(i_nMemberId).Docu(); + else + return 0; +} + + diff --git a/autodoc/source/display/idl/hfi_linklist.hxx b/autodoc/source/display/idl/hfi_linklist.hxx new file mode 100644 index 000000000000..7a7e12679bca --- /dev/null +++ b/autodoc/source/display/idl/hfi_linklist.hxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * 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_HFI_LINKLIST_HXX +#define ADC_DISPLAY_HFI_LINKLIST_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_comrela.hxx> +#include <ary_i/ci_text2.hxx> +#include <ary/doc/d_oldidldocu.hxx> + + + + +class HF_CommentedLink_Table : public HtmlFactory_Idl +{ + public: + HF_CommentedLink_Table( + Environment & io_rEnv, + Xml::Element & o_rOut, + const String & i_sTitle, + const String & i_sLabel, + bool i_bBorder = false ); + virtual ~HF_CommentedLink_Table(); + + void Add_Line(); + Xml::Element & Cur_LinkColumn(); + Xml::Element & Cur_CommentColumn(); + + private: + // DATA + Html::Table * pTable; + Xml::Element * pCurLinkColumn; + Xml::Element * pCurCommentColumn; +}; + +class HF_MemberTable : public HtmlFactory_Idl +{ + public: + HF_MemberTable( + Environment & io_rEnv, + Xml::Element & o_rOut, + const String & i_sTitle, + const String & i_sLabel, + bool i_bInline = false ); + virtual ~HF_MemberTable(); + + void Add_Line(); + Xml::Element & Cur_Declaration(); + Xml::Element & Cur_Description(); + + private: + // DATA + Html::Table * pTable; + Xml::Element * pCurDeclaration; + Xml::Element * pCurDescription; + bool bInline; +}; + + + + +class HF_IdlLinkList : public HtmlFactory_Idl +{ + public: + typedef ary::StdConstIterator<ary::idl::CommentedRelation> + comref_list; + + HF_IdlLinkList( + Environment & io_rEnv, + Xml::Element * o_pOut ); + virtual ~HF_IdlLinkList(); + + void Produce_NamespaceMembers( + const String & i_sTitle, + const String & i_sLabel, + const std::vector<ary::idl::Ce_id> & + i_rList, + bool i_bNestedNamespaces = false ) const; + void Produce_GlobalLinks( + const String & i_sTitle, + const String & i_sLabel, + ce_list & i_rList ) const; + void Produce_GlobalCommentedLinks( + const String & i_sTitle, + const String & i_sLabel, + comref_list & i_rList ) const; + void Produce_MemberLinks( + const String & i_sTitle, + const String & i_sLabel, + ce_list & i_rList ) const; + private: + void Get_EntryData_NamespaceMembers( + String & o_sEntryName, + String & o_sEntryLink, + const ce_info * & o_pDocuText, + ce_id i_nMemberId, + bool i_bIsNestedNamespace ) const; + const ce_info * Get_EntryDocu( + ce_id i_nMemberId ) const; +}; + + + + + + + + +// IMPLEMENTATION + + +#endif + + diff --git a/autodoc/source/display/idl/hfi_method.cxx b/autodoc/source/display/idl/hfi_method.cxx new file mode 100644 index 000000000000..a8c6e3e097ca --- /dev/null +++ b/autodoc/source/display/idl/hfi_method.cxx @@ -0,0 +1,357 @@ +/************************************************************************* + * + * 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 "hfi_method.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_exception.hxx> +#include <ary/idl/i_param.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_funcdecl.hxx> +#include "hfi_doc.hxx" +#include "hfi_globalindex.hxx" +#include "hfi_typetext.hxx" + + + + + +HF_IdlMethod::HF_IdlMethod( Environment & io_rEnv, + Xml::Element & o_cell) + : HtmlFactory_Idl(io_rEnv,&o_cell) +{ +} + + +HF_IdlMethod::~HF_IdlMethod() +{ +} + + +void +HF_IdlMethod::Produce_byData( const String & i_sName, + type_id i_nReturnType, + param_list & i_rParams, + type_list & i_rExceptions, + bool i_bOneway, + bool i_bEllipse, + const client & i_ce ) const +{ + CurOut() + >> *new Html::Label(i_sName) + << new Html::ClassAttr(C_sMemberTitle) + << i_sName; + enter_ContentCell(); + write_Declaration( i_sName, + i_nReturnType, + i_rParams, + i_rExceptions, + i_bOneway, + i_bEllipse ); + CurOut() << new Html::HorizontalLine; + write_Docu(CurOut(), i_ce); + leave_ContentCell(); +} + +#if 0 // old +void +HF_IdlMethod::write_Declaration( const String & i_sName, + type_id i_nReturnType, + param_list & i_rParams, + type_list & i_rExceptions, + bool i_bOneway, + bool i_bEllipse ) const +{ + HF_FunctionDeclaration + aDecl(CurOut()) ; + Xml::Element & + front = aDecl.Add_ReturnLine(); + + // Front: + if (i_bOneway) + front << "[oneway] "; + if (i_nReturnType.IsValid()) + { // Normal function, but not constructors: + HF_IdlTypeText + aReturn(Env(), front, true); + aReturn.Produce_byData(i_nReturnType); + front + << new Html::LineBreak; + + } + front + >> *new Html::Bold + << i_sName; + + // Main line: + Xml::Element & + types = aDecl.Types(); + Xml::Element & + names = aDecl.Names(); + bool bParams = i_rParams.operator bool(); + if (bParams) + { + front + << "("; + HF_IdlTypeText + aType( Env(), types, true ); + + write_Param( aType, names, (*i_rParams) ); + + for (++i_rParams; i_rParams; ++i_rParams) + { + types + << new Html::LineBreak; + names + << "," + << new Html::LineBreak; + write_Param( aType, names, (*i_rParams) ); + } // end for + + if (i_bEllipse) + { + names + << " ..."; + } + names + << " )"; + } + else + front + << "()"; + + + if ( i_rExceptions.operator bool() ) + { + Xml::Element & + rExcOut = aDecl.Add_RaisesLine("raises", NOT bParams); + HF_IdlTypeText + aExc(Env(), rExcOut, true); + aExc.Produce_byData(*i_rExceptions); + + for (++i_rExceptions; i_rExceptions; ++i_rExceptions) + { + rExcOut + << "," + << new Html::LineBreak; + aExc.Produce_byData(*i_rExceptions); + } // end for + + rExcOut << " );"; + } + else + { + if (bParams) + aDecl.Names() << ";"; + else + aDecl.Front() << ";"; + } +} +#endif // 0 old + +void +HF_IdlMethod::write_Declaration( const String & i_sName, + type_id i_nReturnType, + param_list & i_rParams, + type_list & i_rExceptions, + bool i_bOneway, + bool i_bEllipse ) const +{ + HF_FunctionDeclaration + aDecl(CurOut(), "raises") ; + Xml::Element & + rReturnLine = aDecl.ReturnCell(); + + // Return line: + if (i_bOneway) + rReturnLine << "[oneway] "; + if (i_nReturnType.IsValid()) + { // Normal function, but not constructors: + HF_IdlTypeText + aReturn(Env(), rReturnLine, true); + aReturn.Produce_byData(i_nReturnType); + } + + // Main line: + Xml::Element & + rNameCell = aDecl.NameCell(); + rNameCell + >> *new Html::Bold + << i_sName; + + Xml::Element * + pParamEnd = 0; + + bool bParams = i_rParams.operator bool(); + if (bParams) + { + rNameCell + << "("; + + pParamEnd = write_Param( aDecl, *i_rParams ); + for (++i_rParams; i_rParams; ++i_rParams) + { + *pParamEnd << ","; + pParamEnd = write_Param( aDecl, *i_rParams ); + } // end for + + if (i_bEllipse) + { + Xml::Element & + rParamType = aDecl.NewParamTypeCell(); + rParamType + << " ..."; + pParamEnd = &rParamType; + } + *pParamEnd + << " )"; + } + else + { + rNameCell + << "()"; + } + + if ( i_rExceptions.operator bool() ) + { + Xml::Element & + rExcOut = aDecl.ExceptionCell(); + HF_IdlTypeText + aExc(Env(), rExcOut, true); + aExc.Produce_byData(*i_rExceptions); + + for (++i_rExceptions; i_rExceptions; ++i_rExceptions) + { + rExcOut + << "," + << new Html::LineBreak; + aExc.Produce_byData(*i_rExceptions); + } // end for + + rExcOut << " );"; + } + else if (bParams) + { + *pParamEnd << ";"; + } + else + { + rNameCell << ";"; + } +} + +#if 0 // old +void +HF_IdlMethod::write_Param( HF_IdlTypeText & o_type, + Xml::Element & o_names, + const ary::idl::Parameter & i_param ) const +{ + switch ( i_param.Direction() ) + { + case ary::idl::param_in: + o_type.CurOut() << "[in] "; + break; + case ary::idl::param_out: + o_type.CurOut() << "[out] "; + break; + case ary::idl::param_inout: + o_type.CurOut() << "[inout] "; + break; + } // end switch + + o_type.Produce_byData( i_param.Type() ); + o_names + << i_param.Name(); +} +#endif // 0 old + +Xml::Element * +HF_IdlMethod::write_Param( HF_FunctionDeclaration & o_decl, + const ary::idl::Parameter & i_param ) const +{ + Xml::Element & + rTypeCell = o_decl.NewParamTypeCell(); + Xml::Element & + rNameCell = o_decl.ParamNameCell(); + + switch ( i_param.Direction() ) + { + case ary::idl::param_in: + rTypeCell << "[in] "; + break; + case ary::idl::param_out: + rTypeCell << "[out] "; + break; + case ary::idl::param_inout: + rTypeCell << "[inout] "; + break; + } // end switch + + HF_IdlTypeText + aTypeWriter(Env(), rTypeCell, true); + aTypeWriter.Produce_byData( i_param.Type() ); + + rNameCell + << i_param.Name(); + return &rNameCell; +} + +const String sContentBorder("0"); +const String sContentWidth("96%"); +const String sContentPadding("5"); +const String sContentSpacing("0"); + +const String sBgWhite("#ffffff"); +const String sCenter("center"); + +void +HF_IdlMethod::enter_ContentCell() const +{ + + Xml::Element & + rContentCell = CurOut() + >> *new Html::Table( sContentBorder, + sContentWidth, + sContentPadding, + sContentSpacing ) + << new Html::ClassAttr("table-in-method") + << new Html::BgColorAttr(sBgWhite) + << new Html::AlignAttr(sCenter) + >> *new Html::TableRow + >> *new Html::TableCell; + Out().Enter(rContentCell); +} + + +void +HF_IdlMethod::leave_ContentCell() const +{ + Out().Leave(); +} + diff --git a/autodoc/source/display/idl/hfi_method.hxx b/autodoc/source/display/idl/hfi_method.hxx new file mode 100644 index 000000000000..9f81e16c6d42 --- /dev/null +++ b/autodoc/source/display/idl/hfi_method.hxx @@ -0,0 +1,104 @@ + /************************************************************************* + * + * 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_HFI_METHOD_HXX +#define ADC_DISPLAY_HFI_METHOD_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_param.hxx> +#include <ary/doc/d_oldidldocu.hxx> +typedef ary::doc::OldIdlDocu CodeInfo; +#include "hfi_linklist.hxx" + + + +namespace csi +{ + namespace idl + { + class Parameter; + } +} + +class HF_FunctionDeclaration; + +class HF_IdlMethod : public HtmlFactory_Idl +{ + public: + typedef ary::StdConstIterator<ary::idl::Parameter> param_list; + + HF_IdlMethod( + Environment & io_rEnv, + Xml::Element & o_cell ); + virtual ~HF_IdlMethod(); + + void Produce_byData( + const String & i_sName, + type_id i_nReturnType, + param_list & i_rParams, + type_list & i_rExceptions, + bool i_bOneway, + bool i_bEllipse, + const client & i_ce ) const; + private: + void write_Declaration( + const String & i_sName, + type_id i_nReturnType, + param_list & i_rParams, + type_list & i_rExceptions, + bool i_bOneway, + bool i_bEllipse ) const; +// void write_Param( +// HF_IdlTypeText & o_type, +// Xml::Element & o_names, +// const ary::idl::Parameter & +// i_param ) const; + + Xml::Element * write_Param( + HF_FunctionDeclaration & + o_decl, + const ary::idl::Parameter & + i_param ) const; + void enter_ContentCell() const; + void leave_ContentCell() const; +}; + + + +// IMPLEMENTATION + + + +#endif + + diff --git a/autodoc/source/display/idl/hfi_module.cxx b/autodoc/source/display/idl/hfi_module.cxx new file mode 100644 index 000000000000..4ab40cfebf89 --- /dev/null +++ b/autodoc/source/display/idl/hfi_module.cxx @@ -0,0 +1,299 @@ +/************************************************************************* + * + * 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 "hfi_module.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/ik_module.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <ary/getncast.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_navi_sub.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_doc.hxx" +#include "hfi_navibar.hxx" +#include "hfi_tag.hxx" +#include "hfi_typetext.hxx" +#include "hi_linkhelper.hxx" + + +extern const String + C_sCePrefix_Module("module"); + +namespace +{ + +const String + C_sList_NestedModules("Nested Modules"); +const String + C_sList_NestedModules_Label("NestedModules"); +const String + C_sList_Services("Services"); +const String + C_sList_Singletons("Singletons"); +const String + C_sList_Interfaces("Interfaces"); +const String + C_sList_Structs("Structs"); +const String + C_sList_Exceptions("Exceptions"); +const String + C_sList_Enums("Enums"); +const String + C_sList_Typedefs("Typedefs"); +const String + C_sList_ConstGroups("Constant Groups"); +const String + C_sList_ConstGroups_Label("ConstantGroups"); + + +enum E_SubListIndices +{ // In case of changes, also adapt make_Navibar() !! + sli_NestedModules = 0, + sli_Services = 1, + sli_Singletons = 2, + sli_Interfaces = 3, + sli_Structs = 4, + sli_Exceptions = 5, + sli_Enums = 6, + sli_Typedefs = 7, + sli_ConstGroups = 8 +}; + +} //anonymous namespace + + +HF_IdlModule::HF_IdlModule( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlModule::~HF_IdlModule() +{ +} + +typedef ary::idl::ifc_module::attr ModuleAttr; + + +void +HF_IdlModule::Produce_byData( const client & i_ce ) const +{ + Dyn<HF_NaviSubRow> + pNaviSubRow( &make_Navibar(i_ce) ); + + HF_TitleTable + aTitle(CurOut()); + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + if ( Env().CurPosition().Depth() > 0 ) + { + aNameChain.Produce_CompleteChain_forModule(Env().CurPosition(), nameChainLinker); + + StreamLock + sl(200); + aTitle.Produce_Title( sl() + << C_sCePrefix_Module + << " " + << i_ce.LocalName() + << c_str ); + } + else + { + aTitle.Produce_Title( "Global Module" ); + } + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); + + + // Write children lists: + ce_ptr_list aNestedModules; + ce_ptr_list aServices; + ce_ptr_list aInterfaces; + ce_ptr_list aStructs; + ce_ptr_list aExceptions; + ce_ptr_list aEnums; + ce_ptr_list aTypedefs; + ce_ptr_list aConstantGroups; + ce_ptr_list aSingletons; + + ModuleAttr::Get_AllChildrenSeparated( + aNestedModules, + aServices, + aInterfaces, + aStructs, + aExceptions, + aEnums, + aTypedefs, + aConstantGroups, + aSingletons, + Env().Data().Ces(), + i_ce ); + + // Has this to be in the order of enum E_SubListIndices ??? + if (produce_ChildList(C_sList_NestedModules, C_sList_NestedModules_Label, aNestedModules )) + pNaviSubRow->SwitchOn(sli_NestedModules); + if (produce_ChildList(C_sList_Services, C_sList_Services, aServices)) + pNaviSubRow->SwitchOn(sli_Services); + if (produce_ChildList(C_sList_Singletons, C_sList_Singletons, aSingletons)) + pNaviSubRow->SwitchOn(sli_Singletons); + if (produce_ChildList(C_sList_Interfaces, C_sList_Interfaces, aInterfaces)) + pNaviSubRow->SwitchOn(sli_Interfaces); + if (produce_ChildList(C_sList_Structs, C_sList_Structs, aStructs)) + pNaviSubRow->SwitchOn(sli_Structs); + if (produce_ChildList(C_sList_Exceptions, C_sList_Exceptions, aExceptions)) + pNaviSubRow->SwitchOn(sli_Exceptions); + if (produce_ChildList(C_sList_Enums, C_sList_Enums, aEnums)) + pNaviSubRow->SwitchOn(sli_Enums); + if (produce_ChildList(C_sList_Typedefs, C_sList_Typedefs, aTypedefs)) + pNaviSubRow->SwitchOn(sli_Typedefs); + if (produce_ChildList(C_sList_ConstGroups, C_sList_ConstGroups_Label, aConstantGroups)) + pNaviSubRow->SwitchOn(sli_ConstGroups); + pNaviSubRow->Produce_Row(); +} + +DYN HF_NaviSubRow & +HF_IdlModule::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_ModuleMainRow(i_ce); + + DYN HF_NaviSubRow & + ret = aNaviBar.Add_SubRow(); + + // Has to be in the order of E_SubListIndices: + ret.AddItem(C_sList_NestedModules, C_sList_NestedModules_Label, false); + ret.AddItem(C_sList_Services, C_sList_Services, false); + ret.AddItem(C_sList_Singletons, C_sList_Singletons, false); + ret.AddItem(C_sList_Interfaces, C_sList_Interfaces, false); + ret.AddItem(C_sList_Structs, C_sList_Structs, false); + ret.AddItem(C_sList_Exceptions, C_sList_Exceptions, false); + ret.AddItem(C_sList_Enums, C_sList_Enums, false); + ret.AddItem(C_sList_Typedefs, C_sList_Typedefs, false); + ret.AddItem(C_sList_ConstGroups, C_sList_ConstGroups_Label, false); + + CurOut() << new Html::HorizontalLine(); + return ret; +} + +bool +HF_IdlModule::produce_ChildList( const String & i_sName, + const String & i_sLabel, + const ce_ptr_list & i_list ) const +{ + if ( i_list.size() == 0 ) + return false; + + HF_SubTitleTable + aTable( CurOut(), + i_sLabel, + i_sName, + 2 ); + + ce_ptr_list::const_iterator + itEnd = i_list.end(); + for ( ce_ptr_list::const_iterator it = i_list.begin(); + it != itEnd; + ++it ) + { + Xml::Element & + rRow = aTable.Add_Row(); + produce_Link(rRow, *it); + produce_LinkDoc(rRow, *it); + } // end for + + return true; +} + +void +HF_IdlModule::produce_Link( Xml::Element & o_row, + const client * i_ce ) const +{ + csv_assert(i_ce != 0); + Xml::Element & + rCell = o_row + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_SummaryLeft); + + if ( NOT ary::is_type<ary::idl::Module>(*i_ce) ) + { + HF_IdlTypeText + aText(Env(), rCell, true); + aText.Produce_byData(i_ce->CeId()); + } + else + { + StreamLock slBuf(100); + rCell + >> *new Html::Link( slBuf() << i_ce->LocalName() + << "/module-ix.html" + << c_str ) + << i_ce->LocalName(); + } +} + +void +HF_IdlModule::produce_LinkDoc( Xml::Element & o_row, + const client * i_ce ) const +{ + csv_assert(i_ce != 0); + + // We need the cell in any case, because, the rendering may be hurt else. + Xml::Element & + rCell = o_row + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_SummaryRight); + + const client & + rCe = *i_ce; + const ce_info * + pShort = Get_IdlDocu(rCe.Docu()); + if ( pShort == 0 ) + return; + + + if (pShort->IsDeprecated()) + { + rCell << "[ DEPRECATED ]" << new Html::LineBreak; + } + if (pShort->IsOptional()) + { + rCell << "[ OPTIONAL ]" << new Html::LineBreak; + } + + HF_IdlDocuTextDisplay + aShortDisplay(Env(), &rCell, *i_ce); + pShort->Short().DisplayAt(aShortDisplay); +} diff --git a/autodoc/source/display/idl/hfi_module.hxx b/autodoc/source/display/idl/hfi_module.hxx new file mode 100644 index 000000000000..f1eab57050bf --- /dev/null +++ b/autodoc/source/display/idl/hfi_module.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * 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_HFI_MODULE_HXX +#define ADC_DISPLAY_HFI_MODULE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + + +class HF_NaviSubRow; + +class HF_IdlModule : public HtmlFactory_Idl +{ + public: + HF_IdlModule( + Environment & io_rEnv, // The CurDirectory() is the one of the here displayed Module. + Xml::Element & o_rOut ); + virtual ~HF_IdlModule(); + + void Produce_byData( + const client & i_ce ) const; + private: + typedef std::vector< const ary::idl::CodeEntity* > ce_ptr_list; + + DYN HF_NaviSubRow & make_Navibar( + const client & i_ce ) const; + bool produce_ChildList( + const String & i_sName, + const String & i_sLabel, + const ce_ptr_list & i_list ) const; + void produce_Link( + Xml::Element & o_row, + const client * i_ce ) const; + void produce_LinkDoc( + Xml::Element & o_row, + const client * i_ce ) const; +}; + + + +// IMPLEMENTATION + + +extern const String + C_sCePrefix_Module; + + + + + +#endif + + diff --git a/autodoc/source/display/idl/hfi_navibar.cxx b/autodoc/source/display/idl/hfi_navibar.cxx new file mode 100644 index 000000000000..5a9f32dacb1b --- /dev/null +++ b/autodoc/source/display/idl/hfi_navibar.cxx @@ -0,0 +1,225 @@ +/************************************************************************* + * + * 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 "hfi_navibar.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <toolkit/hf_navi_main.hxx> +#include <toolkit/hf_navi_sub.hxx> +#include "hfi_interface.hxx" +#include "hfi_module.hxx" +#include "hfi_service.hxx" +#include "hi_linkhelper.hxx" + + +extern const String + C_sLocalManualLinks("#devmanual"); + + +const String C_sTop = "Overview"; +const String C_sModule = "Module"; +const String C_sUse = "Use"; +const String C_sManual = "Devguide"; +const String C_sIndex = "Index"; + + + + +HF_IdlNavigationBar::HF_IdlNavigationBar( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlNavigationBar::~HF_IdlNavigationBar() +{ +} + +void +HF_IdlNavigationBar::Produce_CeMainRow( const client & i_ce, + bool i_bNoUsePage ) +{ + HF_NaviMainRow + aNaviMain( CurOut() ); + + StreamLock aLink(500); + StreamStr & rLink = aLink(); + + Env().Get_LinkTo( rLink.reset(), + Env().OutputTree().Overview() ); + aNaviMain.Add_StdItem( C_sTop, rLink.c_str() ); + + Env().Get_LinkTo( rLink.reset(), + Env().Linker().PositionOf_CurModule() ); + aNaviMain.Add_StdItem( C_sModule, rLink.c_str() ); + + if (i_bNoUsePage) + { + aNaviMain.Add_NoneItem( C_sUse ); + } + else + { + Env().Get_LinkTo( rLink.reset(), + Env().Linker().PositionOf_CurXRefs(i_ce.LocalName()) ); + aNaviMain.Add_StdItem( C_sUse, rLink.c_str() ); + } + + const StringVector & + rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual(); + if (rManualDescrs.size() == 2) + { + aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() )); + } + else if (rManualDescrs.size() > 2) + { + aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks); + } + else + { + aNaviMain.Add_NoneItem( C_sManual ); + } + + Env().Get_LinkTo( rLink.reset(), + Env().Linker().PositionOf_Index() ); + aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() ); + + aNaviMain.Produce_Row(); +} + +void +HF_IdlNavigationBar::Produce_CeXrefsMainRow( const client & i_ce ) +{ + HF_NaviMainRow + aNaviMain( CurOut() ); + + StreamLock aLink(500); + StreamStr & rLink = aLink(); + + Env().Get_LinkTo( rLink.reset(), + Env().OutputTree().Overview() ); + aNaviMain.Add_StdItem( C_sTop, rLink.c_str() ); + + Env().Get_LinkTo( rLink.reset(), + Env().Linker().PositionOf_CurModule() ); + aNaviMain.Add_StdItem( C_sModule, rLink.c_str() ); + + aNaviMain.Add_SelfItem( C_sUse ); + + const StringVector & + rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual(); + if (rManualDescrs.size() == 2) + { + aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() )); + } + else if (rManualDescrs.size() > 2) + { + aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks); + } + else + { + aNaviMain.Add_NoneItem( C_sManual ); + } + + Env().Get_LinkTo( rLink.reset(), + Env().Linker().PositionOf_Index() ); + aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() ); + + aNaviMain.Produce_Row(); +} + +void +HF_IdlNavigationBar::Produce_ModuleMainRow( const client & i_ce ) +{ + HF_NaviMainRow + aNaviMain( CurOut() ); + + StreamLock aLink(500); + StreamStr & rLink = aLink(); + + Env().Get_LinkTo( rLink.reset(), + Env().OutputTree().Overview() ); + aNaviMain.Add_StdItem( C_sTop, rLink.c_str() ); + + aNaviMain.Add_SelfItem( C_sModule ); + + aNaviMain.Add_NoneItem( C_sUse ); + + const StringVector & + rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual(); + if (rManualDescrs.size() == 1) + { + aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() )); + } + else if (rManualDescrs.size() > 1) + { + aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks); + } + else + { + aNaviMain.Add_NoneItem( C_sManual ); + } + + Env().Get_LinkTo( rLink.reset(), + Env().Linker().PositionOf_Index() ); + aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() ); + + aNaviMain.Produce_Row(); +} + +void +HF_IdlNavigationBar::Produce_IndexMainRow() +{ + HF_NaviMainRow + aNaviMain( CurOut() ); + + StreamLock aLink(500); + StreamStr & rLink = aLink(); + + Env().Get_LinkTo( rLink.reset(), + Env().OutputTree().Overview() ); + aNaviMain.Add_StdItem( C_sTop, rLink.c_str() ); + + aNaviMain.Add_NoneItem( C_sModule ); + aNaviMain.Add_NoneItem( C_sUse ); + aNaviMain.Add_NoneItem( C_sManual ); + + aNaviMain.Add_SelfItem( C_sIndex ); + + aNaviMain.Produce_Row(); + + CurOut() << new Html::HorizontalLine(); +} + +DYN HF_NaviSubRow & +HF_IdlNavigationBar::Add_SubRow() +{ + return *new HF_NaviSubRow( CurOut() ); +} + diff --git a/autodoc/source/display/idl/hfi_navibar.hxx b/autodoc/source/display/idl/hfi_navibar.hxx new file mode 100644 index 000000000000..b84264d3ac25 --- /dev/null +++ b/autodoc/source/display/idl/hfi_navibar.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * 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_HFI_NAVIBAR_HXX +#define ADC_DISPLAY_HFI_NAVIBAR_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include "hi_factory.hxx" + // PARAMETERS + +namespace ary +{ +namespace idl +{ +class CodeEntity; +} +} + + +class HF_NaviSubRow; + +/** @resp + Creates a navigation bar for an IDL HTML documentation page. +*/ +class HF_IdlNavigationBar : public HtmlFactory_Idl +{ + public: + HF_IdlNavigationBar( + HtmlEnvironment_Idl & + io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlNavigationBar(); + + void Produce_CeMainRow( + const client & i_ce, + bool i_bNoUsePage = false ); + void Produce_CeXrefsMainRow( + const client & i_ce ); + void Produce_ModuleMainRow( + const client & i_ce ); + void Produce_IndexMainRow(); + + /** Adds the subrow to the o_rOut argument of the constructor. + */ + DYN HF_NaviSubRow & Add_SubRow(); + + private: + const ary::idl::CodeEntity * + pCe; +}; + +extern const String + C_sLocalManualLinks; + +#endif diff --git a/autodoc/source/display/idl/hfi_property.cxx b/autodoc/source/display/idl/hfi_property.cxx new file mode 100644 index 000000000000..e92ddc201b25 --- /dev/null +++ b/autodoc/source/display/idl/hfi_property.cxx @@ -0,0 +1,451 @@ +/************************************************************************* + * + * 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 "hfi_property.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/ik_attribute.hxx> +#include <ary/idl/ik_constant.hxx> +#include <ary/idl/ik_enumvalue.hxx> +#include <ary/idl/ik_property.hxx> +#include <ary/idl/ik_structelem.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_typetext.hxx" +#include "hfi_doc.hxx" +#include "hfi_tag.hxx" +#include "hi_env.hxx" +#include "hi_ary.hxx" +#include "hi_linkhelper.hxx" + +void +HF_IdlDataMember::Produce_byData( const client & ce ) const +{ + write_Title(ce); + enter_ContentCell(); + write_Declaration(ce); + write_Description(ce); + leave_ContentCell(); +} + +HF_IdlDataMember::HF_IdlDataMember( Environment & io_rEnv, + HF_SubTitleTable & o_table ) + : HtmlFactory_Idl( io_rEnv, + &(o_table.Add_Row() + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_MDetail)) + ) +{ +} + +const String sContentBorder("0"); +const String sContentWidth("96%"); +const String sContentPadding("5"); +const String sContentSpacing("0"); + +const String sBgWhite("#ffffff"); +const String sCenter("center"); + +void +HF_IdlDataMember::write_Title( const client & i_ce ) const +{ + CurOut() + >> *new Html::Label(i_ce.LocalName()) + << new Html::ClassAttr(C_sMemberTitle) + << i_ce.LocalName(); +} + +void +HF_IdlDataMember::write_Description( const client & i_ce ) const +{ + CurOut() << new Html::HorizontalLine; + write_Docu(CurOut(), i_ce); +} + +void +HF_IdlDataMember::enter_ContentCell() const +{ + + Xml::Element & + rContentCell = CurOut() + >> *new Html::Table( sContentBorder, + sContentWidth, + sContentPadding, + sContentSpacing ) + << new Html::ClassAttr("table-in-data") + << new Html::BgColorAttr(sBgWhite) + << new Html::AlignAttr(sCenter) + >> *new Html::TableRow + >> *new Html::TableCell; + Out().Enter(rContentCell); +} + + +void +HF_IdlDataMember::leave_ContentCell() const +{ + Out().Leave(); +} + + +HF_IdlProperty::~HF_IdlProperty() +{ +} + +typedef ary::idl::ifc_property::attr PropertyAttr; + +void +HF_IdlProperty::write_Declaration( const client & i_ce ) const +{ + if (PropertyAttr::HasAnyStereotype(i_ce)) + { + CurOut() << "[ "; + if (PropertyAttr::IsReadOnly(i_ce)) + CurOut() << "readonly "; + if (PropertyAttr::IsBound(i_ce)) + CurOut() << "bound "; + if (PropertyAttr::IsConstrained(i_ce)) + CurOut() << "constrained "; + if (PropertyAttr::IsMayBeAmbiguous(i_ce)) + CurOut() << "maybeambiguous "; + if (PropertyAttr::IsMayBeDefault(i_ce)) + CurOut() << "maybedefault "; + if (PropertyAttr::IsMayBeVoid(i_ce)) + CurOut() << "maybevoid "; + if (PropertyAttr::IsRemovable(i_ce)) + CurOut() << "removable "; + if (PropertyAttr::IsTransient(i_ce)) + CurOut() << "transient "; + CurOut() << "] "; + } // end if + + HF_IdlTypeText + aType( Env(), CurOut(), true ); + aType.Produce_byData( PropertyAttr::Type(i_ce) ); + + CurOut() << " " >> *new Html::Bold << i_ce.LocalName(); + CurOut() << ";"; +} + + + + +HF_IdlAttribute::~HF_IdlAttribute() +{ +} + +typedef ary::idl::ifc_attribute::attr AttributeAttr; + +void +HF_IdlAttribute::write_Declaration( const client & i_ce ) const +{ + if (AttributeAttr::HasAnyStereotype(i_ce)) + { + CurOut() << "[ "; + if (AttributeAttr::IsReadOnly(i_ce)) + CurOut() << "readonly "; + if (AttributeAttr::IsBound(i_ce)) + CurOut() << "bound "; + CurOut() << "] "; + } + + HF_IdlTypeText + aType( Env(), CurOut(), true ); + aType.Produce_byData( AttributeAttr::Type(i_ce) ); + + CurOut() + << " " + >> *new Html::Bold + << i_ce.LocalName(); + + dyn_type_list pGetExceptions; + dyn_type_list pSetExceptions; + AttributeAttr::Get_GetExceptions(pGetExceptions, i_ce); + AttributeAttr::Get_SetExceptions(pSetExceptions, i_ce); + + bool bGetRaises = (*pGetExceptions).IsValid(); + bool bSetRaises = (*pSetExceptions).IsValid(); + bool bRaises = bGetRaises OR bSetRaises; + if (bRaises) + { + HF_DocEntryList aSub(CurOut()); + + if (bGetRaises) + { + Xml::Element & + rGet = aSub.Produce_Definition(); + HF_IdlTypeText + aExc(Env(), rGet, true); + type_list & itExc = *pGetExceptions; + + rGet << "get raises ("; + aExc.Produce_byData(*itExc); + for (++itExc; itExc.operator bool(); ++itExc) + { + rGet + << ","; + aExc.Produce_byData(*itExc); + } // end for + rGet << ")"; + if (NOT bSetRaises) + rGet << ";"; + } // end if (bGetRaises) + + if (bSetRaises) + { + Xml::Element & + rSet = aSub.Produce_Definition(); + HF_IdlTypeText + aExc(Env(), rSet, true); + type_list & itExc = *pSetExceptions; + + rSet << "set raises ("; + aExc.Produce_byData(*itExc); + for (++itExc; itExc.operator bool(); ++itExc) + { + rSet + << ","; + aExc.Produce_byData(*itExc); + } // end for + rSet << ");"; + } // end if (bSetRaises) + } + else + { + CurOut() << ";"; + } +} + + + + +HF_IdlEnumValue::~HF_IdlEnumValue() +{ +} + +typedef ary::idl::ifc_enumvalue::attr EnumValueAttr; + +void +HF_IdlEnumValue::write_Declaration( const client & i_ce ) const +{ + CurOut() + >> *new Html::Bold + << i_ce.LocalName(); + + const String & + rValue = EnumValueAttr::Value(i_ce); + if ( NOT rValue.empty() ) + { CurOut() << " " // << " = " // In the moment this is somehow in the value + << rValue; + // CurOut() << ","; // In the moment this is somehow in the value + } + else + CurOut() << ","; +} + + +HF_IdlConstant::~HF_IdlConstant() +{ +} + +typedef ary::idl::ifc_constant::attr ConstantAttr; + +void +HF_IdlConstant::write_Declaration( const client & i_ce ) const +{ + CurOut() << "const "; + HF_IdlTypeText + aType( Env(), CurOut(), true ); + aType.Produce_byData(ConstantAttr::Type(i_ce)); + CurOut() + << " " + >> *new Html::Bold + << i_ce.LocalName(); + const String & + rValue = ConstantAttr::Value(i_ce); + CurOut() << " " // << " = " // In the moment this is somehow in the value + << rValue; + // << ";"; // In the moment this is somehow in the value +} + + +HF_IdlStructElement::~HF_IdlStructElement() +{ +} + +typedef ary::idl::ifc_structelement::attr StructElementAttr; + +void +HF_IdlStructElement::write_Declaration( const client & i_ce ) const +{ + HF_IdlTypeText + aType( Env(), CurOut(), true ); + aType.Produce_byData(StructElementAttr::Type(i_ce)); + CurOut() + << " " + >> *new Html::Bold + << i_ce.LocalName(); + CurOut() + << ";"; +} + +HF_IdlCommentedRelationElement::~HF_IdlCommentedRelationElement() +{ +} + +void +HF_IdlCommentedRelationElement::produce_Summary( Environment & io_env, + Xml::Element & io_context, + const comref & i_commentedRef, + const client & i_rScopeGivingCe ) +{ + csv_assert( i_commentedRef.Info() ); + + const ary::idl::Type_id aType = i_commentedRef.Type(); + const ce_info & rDocu = *i_commentedRef.Info(); + + bool bShort = NOT rDocu.Short().IsEmpty(); + bool bDescr = NOT rDocu.Description().IsEmpty(); + + if ( bShort ) + { + HF_IdlDocuTextDisplay + aDescription(io_env, 0, i_rScopeGivingCe); + + Xml::Element& rPara = io_context >> *new Html::Paragraph; + aDescription.Out().Enter( rPara ); + rDocu.Short().DisplayAt( aDescription ); + + // if there's more than just the summary - i.e. a description, or usage restrictions, or tags -, + // then add a link to the details section + if ( bDescr OR rDocu.IsDeprecated() OR rDocu.IsOptional() OR NOT rDocu.Tags().empty() ) + { + StreamLock aLocalLink(100); + aLocalLink() << "#" << get_LocalLinkName(io_env, i_commentedRef); + + aDescription.Out().Out() << "("; + aDescription.Out().Out() + >> *new Html::Link( aLocalLink().c_str() ) + << "details"; + aDescription.Out().Out() << ")"; + } + + aDescription.Out().Leave(); + } +} + +void +HF_IdlCommentedRelationElement::produce_LinkDoc( Environment & io_env, + const client & i_ce, + Xml::Element & io_context, + const comref & i_commentedRef, + const E_DocType i_docType ) +{ + if ( i_commentedRef.Info() != 0 ) + { + if ( i_docType == doctype_complete ) + { + HF_DocEntryList aDocList(io_context); + HF_IdlDocu aDocuDisplay(io_env, aDocList); + + aDocuDisplay.Produce_fromReference(*i_commentedRef.Info(), i_ce); + } + else + { + produce_Summary(io_env, io_context, i_commentedRef, i_ce); + } + } + else + { + HF_DocEntryList aDocList(io_context); + + const client * + pCe = io_env.Linker().Search_CeFromType(i_commentedRef.Type()); + const ce_info * + pShort = pCe != 0 + ? Get_IdlDocu(pCe->Docu()) + : (const ce_info *)(0); + if ( pShort != 0 ) + { + aDocList.Produce_NormalTerm("(referenced entity's summary:)"); + Xml::Element & + rDef = aDocList.Produce_Definition(); + HF_IdlDocuTextDisplay + aShortDisplay( io_env, &rDef, *pCe); + pShort->Short().DisplayAt(aShortDisplay); + } // end if (pShort != 0) + } // endif ( (*i_commentedRef).Info() != 0 ) else +} + + +String +HF_IdlCommentedRelationElement::get_LocalLinkName( Environment & io_env, + const comref & i_commentedRef ) +{ + StringVector aModules; + String sLocalName; + ce_id nCe; + int nSequenceCount = 0; + + const ary::idl::Type & + rType = io_env.Data().Find_Type(i_commentedRef.Type()); + io_env.Data().Get_TypeText(aModules, sLocalName, nCe, nSequenceCount, rType); + + // speaking strictly, this is not correct: If we have two interfaces with the same local + // name, but in different modules, then the link name will be ambiguous. However, this should + // be too seldom a case to really make the link names that ugly by adding the module information. + return sLocalName; +} + +void +HF_IdlCommentedRelationElement::write_Title( const client & /*i_ce*/ ) const +{ + + Xml::Element & + rAnchor = CurOut() + >> *new Html::Label(get_LocalLinkName(Env(), m_relation)) + << new Html::ClassAttr(C_sMemberTitle); + + HF_IdlTypeText + aText(Env(), rAnchor, true); + aText.Produce_byData(m_relation.Type()); +} + +void +HF_IdlCommentedRelationElement::write_Declaration( const client & /*i_ce*/ ) const +{ + // nothing to do here - an entity which is a commented relation does not have a declaration +} + +void +HF_IdlCommentedRelationElement::write_Description( const client & i_ce ) const +{ + produce_LinkDoc( Env(), i_ce, CurOut(), m_relation, doctype_complete ); +} diff --git a/autodoc/source/display/idl/hfi_property.hxx b/autodoc/source/display/idl/hfi_property.hxx new file mode 100644 index 000000000000..2d82e8badb4d --- /dev/null +++ b/autodoc/source/display/idl/hfi_property.hxx @@ -0,0 +1,182 @@ + /************************************************************************* + * + * 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_HFI_PROPERTY_HXX +#define ADC_DISPLAY_HFI_PROPERTY_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_comrela.hxx> + +class HF_SubTitleTable; + +class HF_IdlDataMember : public HtmlFactory_Idl +{ + public: + void Produce_byData( + const client & ce ) const; + protected: + HF_IdlDataMember( + Environment & io_rEnv, + HF_SubTitleTable & o_table ); + virtual ~HF_IdlDataMember() {} + + private: + virtual void write_Title( + const client & i_ce ) const; + + virtual void write_Declaration( + const client & i_ce ) const = 0; + + virtual void write_Description( + const client & i_ce ) const; + + void enter_ContentCell() const; + void leave_ContentCell() const; +}; + + + +class HF_IdlProperty : public HF_IdlDataMember +{ + public: + HF_IdlProperty( + Environment & io_rEnv, + HF_SubTitleTable & o_table ) + : HF_IdlDataMember(io_rEnv, o_table) {} + virtual ~HF_IdlProperty(); + private: + virtual void write_Declaration( + const client & i_ce ) const; +}; + +class HF_IdlAttribute : public HF_IdlDataMember +{ + public: + HF_IdlAttribute( + Environment & io_rEnv, + HF_SubTitleTable & o_table ) + : HF_IdlDataMember(io_rEnv, o_table) {} + virtual ~HF_IdlAttribute(); + + private: + virtual void write_Declaration( + const client & i_ce ) const; +}; + + +class HF_IdlEnumValue : public HF_IdlDataMember +{ + public: + HF_IdlEnumValue( + Environment & io_rEnv, + HF_SubTitleTable & o_table ) + : HF_IdlDataMember(io_rEnv, o_table) {} + virtual ~HF_IdlEnumValue(); + + private: + virtual void write_Declaration( + const client & i_ce ) const; +}; + +class HF_IdlConstant : public HF_IdlDataMember +{ + public: + HF_IdlConstant( + Environment & io_rEnv, + HF_SubTitleTable & o_table ) + : HF_IdlDataMember(io_rEnv, o_table) {} + virtual ~HF_IdlConstant(); + + private: + virtual void write_Declaration( + const client & i_ce ) const; +}; + + +class HF_IdlStructElement : public HF_IdlDataMember +{ + public: + HF_IdlStructElement( + Environment & io_rEnv, + HF_SubTitleTable & o_table ) + : HF_IdlDataMember(io_rEnv, o_table) {} + virtual ~HF_IdlStructElement(); + + private: + virtual void write_Declaration( + const client & i_ce ) const; +}; + +class HF_IdlCommentedRelationElement : public HF_IdlDataMember +{ + public: + HF_IdlCommentedRelationElement( + Environment & io_rEnv, + HF_SubTitleTable & o_table, + const ary::idl::CommentedRelation& i_relation ) + : HF_IdlDataMember(io_rEnv, o_table) + , m_relation( i_relation ) + { + } + virtual ~HF_IdlCommentedRelationElement(); + + typedef ::ary::idl::CommentedRelation comref; + + static void produce_LinkDoc( + Environment & io_env, + const client & i_ce, + Xml::Element & io_context, + const comref & i_commentedRef, + const E_DocType i_docType ); + + private: + virtual void write_Title( + const client & i_ce ) const; + virtual void write_Declaration( + const client & i_ce ) const; + virtual void write_Description( + const client & i_ce ) const; + private: + static void produce_Summary( Environment & io_env, + Xml::Element & io_context, + const comref & i_commentedRef, + const client & i_rScopeGivingCe ); + + static String get_LocalLinkName( Environment & io_env, + const comref & i_commentedRef ); + + private: + const ary::idl::CommentedRelation& m_relation; +}; + +#endif diff --git a/autodoc/source/display/idl/hfi_service.cxx b/autodoc/source/display/idl/hfi_service.cxx new file mode 100644 index 000000000000..a4d105fc0f86 --- /dev/null +++ b/autodoc/source/display/idl/hfi_service.cxx @@ -0,0 +1,363 @@ +/************************************************************************* + * + * 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 "hfi_service.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/ik_property.hxx> +#include <ary/idl/ik_service.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_navi_sub.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_doc.hxx" +#include "hfi_navibar.hxx" +#include "hfi_property.hxx" +#include "hfi_tag.hxx" +#include "hfi_typetext.hxx" +#include "hi_linkhelper.hxx" + + + + +extern const String + C_sCePrefix_Service("service"); + +namespace +{ + +const String + C_sList_IncludedServices("Services' Summary"); +const String + C_sList_IncludedServices_Heading("Included Services - Summary"); +const String + C_sList_IncludedServices_Label("ServicesSummary"); +const String + C_sList_IncludedServicesDetails("Services' Details"); +const String + C_sList_IncludedServicesDetails_Heading("Included Services - Details"); +const String + C_sList_IncludedServicesDetails_Label("ServicesDetails"); +const String + C_sList_ExportedInterfaces("Interfaces' Summary"); +const String + C_sList_ExportedInterfaces_Heading("Exported Interfaces - Summary"); +const String + C_sList_ExportedInterfaces_Label("InterfacesSummary"); +const String + C_sList_ExportedInterfacesDetails("Interfaces' Details"); +const String + C_sList_ExportedInterfacesDetails_Heading("Exported Interfaces - Details"); +const String + C_sList_ExportedInterfacesDetails_Label("InterfacesDetails"); +const String + C_sList_Properties("Properties' Summary"); +const String + C_sList_Properties_Label("PropertiesSummary"); +const String + C_sList_PropertiesDetails("Properties' Details"); +const String + C_sList_PropertiesDetails_Label("PropertiesDetails"); + + +enum E_SubListIndices +{ + sli_IncludedServicesSummary = 0, + sli_InterfacesSummary = 1, + sli_PropertiesSummary = 2, + sli_IncludedServicesDetails = 3, + sli_InterfacesDetails = 4, + sli_PropertiesDetails = 5 +}; + +} //anonymous namespace + + +HF_IdlService::HF_IdlService( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlService::~HF_IdlService() +{ + +} + +typedef ::ary::idl::ifc_service::attr + ServiceAttr; +typedef ::ary::Dyn_StdConstIterator< ::ary::idl::CommentedRelation > + dyn_comref_list; + +void +HF_IdlService::produce_CommentedRelations( const client & i_ce, + comref_list & it_list, + const String & i_summaryTitle, + const String & i_summaryLabel, + const String & i_detailsTitle, + const String & i_detailsLabel, + const E_DocType i_docType ) const +{ + csv_assert( it_list ); + + bool bSummaryOnly = ( i_docType == doctype_summaryOnly ); + HF_SubTitleTable aTable( + CurOut(), + bSummaryOnly ? i_summaryLabel : i_detailsLabel, + bSummaryOnly ? i_summaryTitle : i_detailsTitle, + 2 ); + + for ( ; it_list; ++it_list ) + { + Xml::Element & + rRow = aTable.Add_Row(); + + if ( bSummaryOnly ) + { + produce_Link(rRow, (*it_list).Type()); + produce_LinkSummary(i_ce, rRow, *it_list); + } + else + { + HF_IdlCommentedRelationElement + aRelation( Env(), aTable, *it_list ); + aRelation.Produce_byData( i_ce ); + } + } // end for +} + +void +HF_IdlService::Produce_byData( const client & i_ce ) const +{ + Dyn<HF_NaviSubRow> + pNaviSubRow( &make_Navibar(i_ce) ); + + HF_TitleTable + aTitle(CurOut()); + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + produce_Title(aTitle, C_sCePrefix_Service, i_ce); + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); + + // produce ... + // - included services: summary + dyn_comref_list dpIncludedServices; + ServiceAttr::Get_IncludedServices(dpIncludedServices, i_ce); + if ( (*dpIncludedServices).operator bool() ) + { + produce_CommentedRelations( i_ce, *dpIncludedServices, + C_sList_IncludedServices_Heading, + C_sList_IncludedServices_Label, + C_sList_IncludedServicesDetails_Heading, + C_sList_IncludedServicesDetails_Label, + doctype_summaryOnly ); + pNaviSubRow->SwitchOn(sli_IncludedServicesSummary); + } + + // - exported interfaces: summary + dyn_comref_list dpExportedInterfaces; + ServiceAttr::Get_ExportedInterfaces(dpExportedInterfaces, i_ce); + if ( (*dpExportedInterfaces).operator bool() ) + { + produce_CommentedRelations( i_ce, *dpExportedInterfaces, + C_sList_ExportedInterfaces_Heading, + C_sList_ExportedInterfaces_Label, + C_sList_ExportedInterfacesDetails_Heading, + C_sList_ExportedInterfacesDetails_Label, + doctype_summaryOnly ); + pNaviSubRow->SwitchOn(sli_InterfacesSummary); + } + + // - supported properties: summary + dyn_ce_list dpProperties; + ServiceAttr::Get_Properties(dpProperties, i_ce); + if ( (*dpProperties).operator bool() ) + { + produce_Members( *dpProperties, + C_sList_Properties, + C_sList_Properties_Label, + C_sList_PropertiesDetails, + C_sList_PropertiesDetails_Label, + viewtype_summary ); + pNaviSubRow->SwitchOn(sli_PropertiesSummary); + } + + // - included services: details + ServiceAttr::Get_IncludedServices(dpIncludedServices, i_ce); + if ( (*dpIncludedServices).operator bool() ) + { + produce_CommentedRelations( i_ce, *dpIncludedServices, + C_sList_IncludedServices_Heading, + C_sList_IncludedServices_Label, + C_sList_IncludedServicesDetails_Heading, + C_sList_IncludedServicesDetails_Label, + doctype_complete ); + pNaviSubRow->SwitchOn(sli_IncludedServicesDetails); + } + + // - exported interfaces: details + ServiceAttr::Get_ExportedInterfaces(dpExportedInterfaces, i_ce); + if ( (*dpExportedInterfaces).operator bool() ) + { + produce_CommentedRelations( i_ce, *dpExportedInterfaces, + C_sList_ExportedInterfaces_Heading, + C_sList_ExportedInterfaces_Label, + C_sList_ExportedInterfacesDetails_Heading, + C_sList_ExportedInterfacesDetails_Label, + doctype_complete ); + pNaviSubRow->SwitchOn(sli_InterfacesDetails); + } + + // supported properties: details + ServiceAttr::Get_Properties(dpProperties, i_ce); + if ( (*dpProperties).operator bool() ) + { + produce_Members( *dpProperties, + C_sList_Properties, + C_sList_Properties_Label, + C_sList_PropertiesDetails, + C_sList_PropertiesDetails_Label, + viewtype_details ); + pNaviSubRow->SwitchOn(sli_PropertiesDetails); + } + + pNaviSubRow->Produce_Row(); + CurOut() << new Xml::XmlCode("<br> "); +} + +typedef ary::idl::ifc_property::attr PropertyAttr; + +void +HF_IdlService::produce_SummaryDeclaration( Xml::Element & o_row, + const client & i_property ) const +{ + // KORR_FUTURE + // Put this in to HF_IdlProperty! + + Xml::Element & + rCell = o_row + >> *new Html::TableCell + << new Html::ClassAttr( C_sCellStyle_SummaryLeft ); + + if (PropertyAttr::HasAnyStereotype(i_property)) + { + rCell << "[ "; + if (PropertyAttr::IsReadOnly(i_property)) + rCell << "readonly "; + if (PropertyAttr::IsBound(i_property)) + rCell << "bound "; + if (PropertyAttr::IsConstrained(i_property)) + rCell << "constrained "; + if (PropertyAttr::IsMayBeAmbiguous(i_property)) + rCell << "maybeambiguous "; + if (PropertyAttr::IsMayBeDefault(i_property)) + rCell << "maybedefault "; + if (PropertyAttr::IsMayBeVoid(i_property)) + rCell << "maybevoid "; + if (PropertyAttr::IsRemovable(i_property)) + rCell << "removable "; + if (PropertyAttr::IsTransient(i_property)) + rCell << "transient "; + rCell << "] "; + } // end if + + HF_IdlTypeText + aType( Env(), rCell, true ); + aType.Produce_byData( PropertyAttr::Type(i_property) ); + + StreamLock aLocalLink(100); + aLocalLink() << "#" << i_property.LocalName(); + rCell + << new Html::LineBreak + >> *new Html::Link( aLocalLink().c_str() ) + << i_property.LocalName(); +} + +DYN HF_NaviSubRow & +HF_IdlService::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeMainRow(i_ce); + + DYN HF_NaviSubRow & + ret = aNaviBar.Add_SubRow(); + ret.AddItem(C_sList_IncludedServices, C_sList_IncludedServices_Label, false); + ret.AddItem(C_sList_ExportedInterfaces, C_sList_ExportedInterfaces_Label, false); + ret.AddItem(C_sList_Properties, C_sList_Properties_Label, false); + ret.AddItem(C_sList_IncludedServicesDetails, C_sList_IncludedServicesDetails_Label, false); + ret.AddItem(C_sList_ExportedInterfacesDetails, C_sList_ExportedInterfacesDetails_Label, false); + ret.AddItem(C_sList_PropertiesDetails, C_sList_PropertiesDetails_Label, false); + + CurOut() << new Html::HorizontalLine(); + return ret; +} + +void +HF_IdlService::produce_Link( Xml::Element & o_row, + type_id i_type ) const +{ + Xml::Element & + rCell = o_row + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_SummaryLeft); + HF_IdlTypeText + aText(Env(), rCell, true); + aText.Produce_byData(i_type); +} + +void +HF_IdlService::produce_LinkSummary( const client & i_ce, + Xml::Element & o_row, + const comref & i_commentedRef ) const +{ + Xml::Element & + rCell = o_row + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_SummaryRight); + + HF_IdlCommentedRelationElement::produce_LinkDoc( Env(), i_ce, rCell, i_commentedRef, doctype_summaryOnly ); +} + +void +HF_IdlService::produce_MemberDetails( HF_SubTitleTable & o_table, + const client & i_ce ) const +{ + HF_IdlProperty + aProperty( Env(), o_table); + aProperty.Produce_byData( i_ce ); +} + + + diff --git a/autodoc/source/display/idl/hfi_service.hxx b/autodoc/source/display/idl/hfi_service.hxx new file mode 100644 index 000000000000..35e290c67157 --- /dev/null +++ b/autodoc/source/display/idl/hfi_service.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * 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_HFI_SERVICE_HXX +#define ADC_DISPLAY_HFI_SERVICE_HXX + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_comrela.hxx> + +class HF_NaviSubRow; +class HF_SubTitleTable; + +class HF_IdlService : public HtmlFactory_Idl +{ + public: + typedef ::ary::idl::CommentedRelation comref; + typedef ::ary::StdConstIterator< comref > comref_list; + + HF_IdlService( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlService(); + + void Produce_byData( + const client & i_ce ) const; + private: + // Overwritten from HtmlFactory_Idl: + virtual void produce_SummaryDeclaration( + Xml::Element & o_row, + const client & i_ce ) const; + + // Locals + DYN HF_NaviSubRow & make_Navibar( + const client & i_ce ) const; + + void produce_Link( + Xml::Element & o_row, + type_id i_type ) const; + void produce_LinkSummary( + const client & i_ce, + Xml::Element & o_row, + const comref & i_commentedRef ) const; + + void produce_MemberDetails( /// of property + HF_SubTitleTable & o_table, + const client & i_ce ) const; + + void produce_CommentedRelations( + const client & i_ce, + comref_list & it_list, + const String & i_summaryTitle, + const String & i_summaryLabel, + const String & i_detailsTitle, + const String & i_detailsLabel, + const E_DocType i_docType ) const; + +}; + + + +// IMPLEMENTATION + +extern const String + C_sCePrefix_Service; + + + +#endif + + diff --git a/autodoc/source/display/idl/hfi_singleton.cxx b/autodoc/source/display/idl/hfi_singleton.cxx new file mode 100644 index 000000000000..147fda4e2a19 --- /dev/null +++ b/autodoc/source/display/idl/hfi_singleton.cxx @@ -0,0 +1,133 @@ +/************************************************************************* + * + * 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 "hfi_singleton.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/ik_singleton.hxx> +#include <ary/idl/ik_sisingleton.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_navibar.hxx" +#include "hfi_typetext.hxx" +#include "hi_linkhelper.hxx" + + + +extern const String + C_sCePrefix_Singleton("singleton"); + +const String + C_sAssociatedService("Associated Service"); +const String + C_sImplementedInterface("Supported Interface"); + + + +HF_IdlSingleton::HF_IdlSingleton( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlSingleton::~HF_IdlSingleton() +{ + +} + +typedef ::ary::idl::ifc_singleton::attr SingletonAttr; +typedef ::ary::idl::ifc_sglifcsingleton::attr SglIfcSingletonAttr; + +void +HF_IdlSingleton::Produce_byData_ServiceBased( const client & i_ce ) const +{ + make_Navibar(i_ce); + + HF_TitleTable + aTitle(CurOut()); + + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + produce_Title(aTitle, C_sCePrefix_Singleton, i_ce); + + HF_DocEntryList + aTopList( aTitle.Add_Row() ); + aTopList.Produce_Term(C_sAssociatedService); + + HF_IdlTypeText + aAssociatedService( Env(), aTopList.Produce_Definition(), true ); + aAssociatedService.Produce_byData( SingletonAttr::AssociatedService(i_ce) ); + + CurOut() << new Html::HorizontalLine; + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); +} + +void +HF_IdlSingleton::Produce_byData_InterfaceBased( const client & i_ce ) const +{ + make_Navibar(i_ce); + + HF_TitleTable + aTitle(CurOut()); + + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + produce_Title(aTitle, C_sCePrefix_Singleton, i_ce); + + HF_DocEntryList + aTopList( aTitle.Add_Row() ); + aTopList.Produce_Term(C_sImplementedInterface); + + HF_IdlTypeText + aImplementedInterface( Env(), aTopList.Produce_Definition(), true ); + aImplementedInterface.Produce_byData( SglIfcSingletonAttr::BaseInterface(i_ce) ); + + CurOut() << new Html::HorizontalLine; + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); +} + +void +HF_IdlSingleton::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeMainRow(i_ce,true); // true := avoid link to Use-page. + + CurOut() << new Html::HorizontalLine(); +} diff --git a/autodoc/source/display/idl/hfi_singleton.hxx b/autodoc/source/display/idl/hfi_singleton.hxx new file mode 100644 index 000000000000..4cbb1dc00cff --- /dev/null +++ b/autodoc/source/display/idl/hfi_singleton.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * 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_HFI_SINGLETON_HXX +#define ADC_DISPLAY_HFI_SINGLETON_HXX + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + +class HF_NaviSubRow; + + +class HF_IdlSingleton : public HtmlFactory_Idl +{ + public: + HF_IdlSingleton( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlSingleton(); + + void Produce_byData_ServiceBased( + const client & i_ce ) const; + void Produce_byData_InterfaceBased( + const client & i_ce ) const; + private: + void make_Navibar( + const client & i_ce ) const; +}; + + + +// IMPLEMENTATION + +extern const String + C_sCePrefix_Singleton; + + + +#endif + + diff --git a/autodoc/source/display/idl/hfi_siservice.cxx b/autodoc/source/display/idl/hfi_siservice.cxx new file mode 100644 index 000000000000..127f609ded9b --- /dev/null +++ b/autodoc/source/display/idl/hfi_siservice.cxx @@ -0,0 +1,175 @@ +/************************************************************************* + * + * 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 "hfi_siservice.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/ik_function.hxx> +#include <ary/idl/ik_siservice.hxx> +#include <ary/doc/d_oldidldocu.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_navi_sub.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_doc.hxx" +#include "hfi_method.hxx" +#include "hfi_navibar.hxx" +#include "hfi_typetext.hxx" +#include "hi_env.hxx" +#include "hi_linkhelper.hxx" + + + +namespace +{ + +const String + C_sImplementedInterface("Supported Interface"); + +const String + C_sList_Constructors("Constructors' Summary"); +const String + C_sList_Constructors_Label("ConstructorsSummary"); +const String + C_sDetails_Constructors("Constructors' Details"); +const String + C_sDetails_Constructors_Label("ConstructorsDetails"); + + +enum E_SubListIndices +{ + sli_ConstructorsSummary = 0, + sli_ConstructorsDetails = 1 +}; + +} //anonymous namespace + + +HF_IdlSglIfcService::HF_IdlSglIfcService( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlSglIfcService::~HF_IdlSglIfcService() +{ +} + +typedef ::ary::idl::ifc_sglifcservice::attr SglIfcServiceAttr; + +void +HF_IdlSglIfcService::Produce_byData( const client & i_ce ) const +{ + Dyn<HF_NaviSubRow> + pNaviSubRow( &make_Navibar(i_ce) ); + + HF_TitleTable + aTitle(CurOut()); + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + produce_Title(aTitle, C_sCePrefix_Service, i_ce); + + HF_DocEntryList + aTopList( aTitle.Add_Row() ); + aTopList.Produce_Term(C_sImplementedInterface); + + HF_IdlTypeText + aImplementedInterface( Env(), aTopList.Produce_Definition(), true, &i_ce); + aImplementedInterface.Produce_byData( SglIfcServiceAttr::BaseInterface(i_ce) ); + + CurOut() << new Html::HorizontalLine; + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); + + dyn_ce_list + dpConstructors; + SglIfcServiceAttr::Get_Constructors(dpConstructors, i_ce); + if ( (*dpConstructors).operator bool() ) + { + produce_Members( *dpConstructors, + C_sList_Constructors, + C_sList_Constructors_Label, + C_sDetails_Constructors, + C_sDetails_Constructors_Label ); + pNaviSubRow->SwitchOn(sli_ConstructorsSummary); + pNaviSubRow->SwitchOn(sli_ConstructorsDetails); + } + + pNaviSubRow->Produce_Row(); + CurOut() << new Xml::XmlCode("<br> "); +} + +DYN HF_NaviSubRow & +HF_IdlSglIfcService::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeMainRow(i_ce, true); + + DYN HF_NaviSubRow & + ret = aNaviBar.Add_SubRow(); + ret.AddItem(C_sList_Constructors, C_sList_Constructors_Label, false); + ret.AddItem(C_sDetails_Constructors, C_sDetails_Constructors_Label, false); + + CurOut() << new Html::HorizontalLine(); + return ret; +} + +typedef ary::idl::ifc_function::attr funcAttr; + +void +HF_IdlSglIfcService::produce_MemberDetails( HF_SubTitleTable & o_table, + const client & i_ce ) const +{ + HF_IdlMethod + aConstructor( Env(), + o_table.Add_Row() + >> *new Html::TableCell + << new Html::ClassAttr(C_sCellStyle_MDetail) ); + + ary::Dyn_StdConstIterator<ary::idl::Parameter> + pParameters; + funcAttr::Get_Parameters(pParameters, i_ce); + + ary::Dyn_StdConstIterator<ary::idl::Type_id> + pExceptions; + funcAttr::Get_Exceptions(pExceptions, i_ce); + + aConstructor.Produce_byData( i_ce.LocalName(), + funcAttr::ReturnType(i_ce), + *pParameters, + *pExceptions, + funcAttr::IsOneway(i_ce), + funcAttr::HasEllipse(i_ce), + i_ce ); +} diff --git a/autodoc/source/display/idl/hfi_siservice.hxx b/autodoc/source/display/idl/hfi_siservice.hxx new file mode 100644 index 000000000000..c7a0b62e1b38 --- /dev/null +++ b/autodoc/source/display/idl/hfi_siservice.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * 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_HFI_SISERVICE_HXX +#define ADC_DISPLAY_HFI_SISERVICE_HXX + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS +#include <ary/idl/i_comrela.hxx> + +class HF_NaviSubRow; +class HF_SubTitleTable; + +class HF_IdlSglIfcService : public HtmlFactory_Idl +{ + public: + HF_IdlSglIfcService( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlSglIfcService(); + + void Produce_byData( + const client & i_ce ) const; + private: + DYN HF_NaviSubRow & make_Navibar( + const client & i_ce ) const; + + void produce_MemberDetails( + HF_SubTitleTable & o_table, + const client & i_ce ) const; +}; + + + +// IMPLEMENTATION + +extern const String + C_sCePrefix_Service; + + + +#endif + + diff --git a/autodoc/source/display/idl/hfi_struct.cxx b/autodoc/source/display/idl/hfi_struct.cxx new file mode 100644 index 000000000000..6c98f3a5cef0 --- /dev/null +++ b/autodoc/source/display/idl/hfi_struct.cxx @@ -0,0 +1,203 @@ +/************************************************************************* + * + * 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 "hfi_struct.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_struct.hxx> +#include <ary/idl/ik_exception.hxx> +#include <ary/idl/ik_struct.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_navi_sub.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_navibar.hxx" +#include "hfi_property.hxx" +#include "hfi_typetext.hxx" +#include "hi_linkhelper.hxx" + + +extern const String + C_sCePrefix_Struct("struct"); +extern const String + C_sCePrefix_Exception("exception"); + + +namespace +{ + +const String + C_sBaseStruct("Base Hierarchy"); +const String + C_sBaseException("Base Hierarchy"); + +const String + C_sList_Elements("Elements' Summary"); +const String + C_sList_Elements_Label("Elements"); + +const String + C_sList_ElementDetails("Elements' Details"); +const String + C_sList_ElementDetails_Label("ElementDetails"); + +enum E_SubListIndices +{ + sli_ElementsSummary = 0, + sli_ElementsDetails = 1 +}; + +} // anonymous namespace + + + +HF_IdlStruct::HF_IdlStruct( Environment & io_rEnv, + Xml::Element & o_rOut, + bool i_bIsException ) + : HtmlFactory_Idl(io_rEnv, &o_rOut), + bIsException(i_bIsException) +{ +} + +HF_IdlStruct::~HF_IdlStruct() +{ +} + +void +HF_IdlStruct::Produce_byData( const client & i_ce ) const +{ + const ary::idl::Struct * + pStruct = + bIsException + ? 0 + : static_cast< const ary::idl::Struct* >(&i_ce); + bool bIsTemplate = + pStruct != 0 + ? pStruct->TemplateParameterType().IsValid() + : false; + + Dyn<HF_NaviSubRow> + pNaviSubRow( &make_Navibar(i_ce) ); + + HF_TitleTable + aTitle(CurOut()); + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + + // Title: + StreamLock + slAnnotations(200); + get_Annotations(slAnnotations(), i_ce); + + StreamLock rTitle(200); + if (bIsTemplate) + rTitle() << "template "; + rTitle() + << (bIsException + ? C_sCePrefix_Exception + : C_sCePrefix_Struct) + << " " + << i_ce.LocalName(); + if (bIsTemplate) + { + csv_assert(pStruct != 0); + rTitle() + << "<" + << pStruct->TemplateParameter() + << ">"; + } + aTitle.Produce_Title(slAnnotations().c_str(), rTitle().c_str()); + + // Bases: + produce_Bases( aTitle.Add_Row(), + i_ce, + bIsException + ? C_sBaseException + : C_sBaseStruct ); + + // Docu: + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); + + // Elements: + dyn_ce_list + dpElements; + if (bIsException) + ary::idl::ifc_exception::attr::Get_Elements(dpElements, i_ce); + else + ary::idl::ifc_struct::attr::Get_Elements(dpElements, i_ce); + + if ( (*dpElements).operator bool() ) + { + produce_Members( *dpElements, + C_sList_Elements, + C_sList_Elements_Label, + C_sList_ElementDetails, + C_sList_ElementDetails_Label ); + pNaviSubRow->SwitchOn(sli_ElementsSummary); + pNaviSubRow->SwitchOn(sli_ElementsDetails); + } + pNaviSubRow->Produce_Row(); +} + +HtmlFactory_Idl::type_id +HF_IdlStruct::inq_BaseOf( const client & i_ce ) const +{ + return bIsException + ? ary::idl::ifc_exception::attr::Base(i_ce) + : ary::idl::ifc_struct::attr::Base(i_ce); +} + +HF_NaviSubRow & +HF_IdlStruct::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeMainRow(i_ce); + + DYN HF_NaviSubRow & + ret = aNaviBar.Add_SubRow(); + ret.AddItem(C_sList_Elements, C_sList_Elements_Label, false); + ret.AddItem(C_sList_ElementDetails, C_sList_ElementDetails_Label, false); + + CurOut() << new Html::HorizontalLine(); + return ret; +} + +void +HF_IdlStruct::produce_MemberDetails( HF_SubTitleTable & o_table, + const client & i_ce) const +{ + HF_IdlStructElement + aElement( Env(), o_table ); + aElement.Produce_byData(i_ce); +} diff --git a/autodoc/source/display/idl/hfi_struct.hxx b/autodoc/source/display/idl/hfi_struct.hxx new file mode 100644 index 000000000000..e3a98dddac1e --- /dev/null +++ b/autodoc/source/display/idl/hfi_struct.hxx @@ -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. + * + ************************************************************************/ + +#ifndef ADC_DISPLAY_HFI_STRUCT_HXX +#define ADC_DISPLAY_HFI_STRUCT_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + +/** Is used to display ->ary::idl::Exception s as well as ->ary::idl::Struct s. +*/ +class HF_IdlStruct : public HtmlFactory_Idl +{ + public: + + HF_IdlStruct( + Environment & io_rEnv, + Xml::Element & o_rOut, + bool i_bIsException ); + virtual ~HF_IdlStruct(); + + void Produce_byData( + const client & ce ) const; + private: + // Interface HtmlFactory_Idl: + virtual type_id inq_BaseOf( + const client & i_ce ) const; + // Locals + HF_NaviSubRow & make_Navibar( + const client & ce ) const; + virtual void produce_MemberDetails( + HF_SubTitleTable & o_table, + const client & ce ) const; + // DATA + bool bIsException; +}; + + + +// IMPLEMENTATION + + +extern const String + C_sCePrefix_Struct; +extern const String + C_sCePrefix_Exception; + + +#endif diff --git a/autodoc/source/display/idl/hfi_tag.cxx b/autodoc/source/display/idl/hfi_tag.cxx new file mode 100644 index 000000000000..78c913db3b99 --- /dev/null +++ b/autodoc/source/display/idl/hfi_tag.cxx @@ -0,0 +1,354 @@ +/************************************************************************* + * + * 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 "hfi_tag.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_module.hxx> +#include <ary_i/ci_text2.hxx> +#include <ary_i/d_token.hxx> +#include <toolkit/out_tree.hxx> +#include <adc_cl.hxx> +#include <adc_msg.hxx> +#include "hfi_typetext.hxx" +#include "hi_ary.hxx" +#include "hi_env.hxx" +#include "hi_linkhelper.hxx" + + +using ary::inf::DocuTex2; + + +inline void +HF_IdlTag::Enter_TextOut( Xml::Element & o_rText ) const +{ + aTextOut.Out().Enter(o_rText); +} + +inline void +HF_IdlTag::Leave_TextOut() const +{ + aTextOut.Out().Leave(); +} + +inline void +HF_IdlTag::PutText_Out( const ary::inf::DocuTex2 & i_rText ) const +{ + i_rText.DisplayAt( const_cast< HF_IdlDocuTextDisplay& >(aTextOut) ); +} + + + +HF_IdlTag::HF_IdlTag( Environment & io_rEnv, + const ary::idl::CodeEntity & i_rScopeGivingCe ) + : HtmlFactory_Idl( io_rEnv, 0 ), + pTitleOut(0), + aTextOut(io_rEnv, 0, i_rScopeGivingCe) +{ +} + +HF_IdlTag::~HF_IdlTag() +{ +} + +void +HF_IdlTag::Produce_byData( Xml::Element & o_rTitle, + Xml::Element & o_rText, + const ary::inf::AtTag2 & i_rTag ) const +{ + pTitleOut = &o_rTitle; + Enter_TextOut(o_rText); + i_rTag.DisplayAt( const_cast< HF_IdlTag& >(*this) ); + Leave_TextOut(); +} + +void +HF_IdlTag::Produce_byData( Xml::Element & o_rTitle, + Xml::Element & o_rText, + const std::vector< csi::dsapi::DT_SeeAlsoAtTag* > & + i_seeAlsoVector ) const +{ + o_rTitle << "See also"; + for ( std::vector< csi::dsapi::DT_SeeAlsoAtTag* >::const_iterator + it = i_seeAlsoVector.begin(); + it != i_seeAlsoVector.end(); + ++it ) + { + if (it != i_seeAlsoVector.begin()) + { + o_rText << ", "; + } + HF_IdlTypeText + aLinkText(Env(), o_rText, true, &aTextOut.ScopeGivingCe()); + aLinkText.Produce_byData( (*it)->LinkText() ); + } +} + +void +HF_IdlTag::Display_StdAtTag( const csi::dsapi::DT_StdAtTag & i_rTag ) +{ + if ( i_rTag.Text().IsEmpty() ) + return; + + csv_assert( pTitleOut != 0 ); + *pTitleOut << i_rTag.Title(); + PutText_Out( i_rTag.Text() ); +} + +void +HF_IdlTag::Display_SeeAlsoAtTag( const csi::dsapi::DT_SeeAlsoAtTag & i_rTag ) +{ + if ( i_rTag.Text().IsEmpty() ) + return; + + csv_assert( pTitleOut != 0 ); + *pTitleOut << "See also"; + + HF_IdlTypeText aLinkText(Env(),aTextOut.CurOut(),true, &aTextOut.ScopeGivingCe()); + aLinkText.Produce_byData( i_rTag.LinkText() ); + + aTextOut.CurOut() << new Html::LineBreak; + PutText_Out( i_rTag.Text() ); +} + +void +HF_IdlTag::Display_ParameterAtTag( const csi::dsapi::DT_ParameterAtTag & i_rTag ) +{ + csv_assert( pTitleOut != 0 ); + StreamLock sl(100); + *pTitleOut + << ( sl() << "Parameter " << i_rTag.Title() << c_str ); + PutText_Out( i_rTag.Text() ); +} + +void +HF_IdlTag::Display_SinceAtTag( const csi::dsapi::DT_SinceAtTag & i_rTag ) +{ + csv_assert(pTitleOut != 0); + + if ( i_rTag.Text().IsEmpty() ) + { + return; + } + + // Transform the value of the @since tag into the text to be displayed. + String sDisplay = + autodoc::CommandLine::Get_().DisplayOf_SinceTagValue( + i_rTag.Text().TextOfFirstToken() ); + if (sDisplay.empty()) + return; + + *pTitleOut << "Since "; + DocuTex2 aHelp; + aHelp.AddToken(* new csi::dsapi::DT_TextToken(sDisplay)); + PutText_Out(aHelp); +} + + +//******************** HF_IdlShortDocu *********************/ + +HF_IdlShortDocu::HF_IdlShortDocu( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl( io_rEnv, &o_rOut ) +{ +} + +HF_IdlShortDocu::~HF_IdlShortDocu() +{ +} + +void +HF_IdlShortDocu::Produce_byData( const ary::idl::CodeEntity & i_rCe ) +{ + const ce_info * + pDocu = Get_IdlDocu(i_rCe.Docu()); + if (pDocu == 0) + return; + + const ce_info & + rDocu = *pDocu; + if ( rDocu.IsDeprecated() ) + { + CurOut() + >> *new Html::Bold + << "[ DEPRECATED ]" << new Html::LineBreak; + } + if ( rDocu.IsOptional() ) + { + CurOut() + >> *new Html::Bold + << "[ OPTIONAL ]" << new Html::LineBreak; + } + + HF_IdlDocuTextDisplay + aText( Env(), &CurOut(), i_rCe); + rDocu.Short().DisplayAt(aText); +} + + +//******************** HF_IdlDocuTextDisplay *********************/ + + +HF_IdlDocuTextDisplay::HF_IdlDocuTextDisplay( Environment & io_rEnv, + Xml::Element * o_pOut, + const ary::idl::CodeEntity & i_rScopeGivingCe ) + : HtmlFactory_Idl(io_rEnv, o_pOut), + sScope(), + sLinkToken(), + bGatherLink(false), + pScopeGivingCe(&i_rScopeGivingCe) +{ +} + +HF_IdlDocuTextDisplay::~HF_IdlDocuTextDisplay() +{ +} + +void +HF_IdlDocuTextDisplay::Display_TextToken( const csi::dsapi::DT_TextToken & i_rToken ) +{ + if (bGatherLink) + { + if (sLinkToken.length() == 0) + { + sLinkToken = i_rToken.GetText(); + return; + } + else + { + if ( pScopeGivingCe == 0 ) + { // only in original file + TheMessages().Out_TypeVsMemberMisuse(sLinkToken, Env().CurPageCe_AsText(), 0); + } + + StopLinkGathering(); + } + } // endif (bGatherLink) + + CurOut() << new Xml::XmlCode( i_rToken.GetText() ); +} + +void +HF_IdlDocuTextDisplay::Display_White() +{ + CurOut() << " "; +} + +void +HF_IdlDocuTextDisplay::Display_MupType( const csi::dsapi::DT_MupType & i_rToken ) +{ + if (i_rToken.IsBegin()) + { + StartLinkGathering(i_rToken.Scope()); + } + else + { + if (bGatherLink) + { + CreateTypeLink(); + StopLinkGathering(); + } + } +} + +void +HF_IdlDocuTextDisplay::Display_MupMember( const csi::dsapi::DT_MupMember & i_rToken ) +{ + if (i_rToken.IsBegin()) + { + StartLinkGathering(i_rToken.Scope()); + } + else + { + if (bGatherLink) + { + CreateMemberLink(); + StopLinkGathering(); + } + } +} + +void +HF_IdlDocuTextDisplay::Display_MupConst( const csi::dsapi::DT_MupConst & i_rToken ) +{ + CurOut() + >> *new Html::Bold + << i_rToken.GetText(); +} + +void +HF_IdlDocuTextDisplay::Display_Style( const csi::dsapi::DT_Style & i_rToken ) +{ + CurOut() << new Xml::XmlCode( i_rToken.GetText() ); +} + +void +HF_IdlDocuTextDisplay::Display_EOL() +{ + CurOut() << "\n"; +} + +void +HF_IdlDocuTextDisplay::CreateTypeLink() +{ + if (strchr(sLinkToken,':') != 0) + { + TheMessages().Out_TypeVsMemberMisuse(sLinkToken, Env().CurPageCe_AsFile(".idl"), 0); + CurOut() << sLinkToken; + return; + } + HF_IdlTypeText aLink(Env(), CurOut(), true, &ScopeGivingCe()); + aLink.Produce_LinkInDocu(sScope, sLinkToken, String::Null_()); +} + +void +HF_IdlDocuTextDisplay::CreateMemberLink() +{ + + HF_IdlTypeText aLink(Env(), CurOut(), true, &ScopeGivingCe()); + + const char * + sSplit = strchr(sLinkToken,':'); + + if (sSplit != 0) + { + String sCe(sLinkToken.c_str(), sSplit - sLinkToken.c_str()); + String sMember(sSplit+2); + + if (NOT sScope.empty() OR ScopeGivingCe().LocalName() != sCe ) + aLink.Produce_LinkInDocu(sScope, sCe, sMember); + else + aLink.Produce_LocalLinkInDocu(sMember); + } + else + { + aLink.Produce_LocalLinkInDocu(sLinkToken); + } +} diff --git a/autodoc/source/display/idl/hfi_tag.hxx b/autodoc/source/display/idl/hfi_tag.hxx new file mode 100644 index 000000000000..1d09d21f8c12 --- /dev/null +++ b/autodoc/source/display/idl/hfi_tag.hxx @@ -0,0 +1,177 @@ +/************************************************************************* + * + * 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_HFI_TAG_HXX +#define ADC_DISPLAY_HFI_TAG_HXX + +// BASE CLASSES +#include "hi_factory.hxx" +#include <ary_i/disdocum.hxx> +// USED SERVICES +#include <ary/idl/i_types4idl.hxx> +#include <ary_i/ci_atag2.hxx> +#include <ary_i/ci_text2.hxx> +#include <ary/doc/d_oldidldocu.hxx> + +#include <toolkit/hf_docentry.hxx> + +namespace ary +{ +namespace idl +{ + class Module; +} +} + + + + +/** This class is an implementation of ary::inf::DocuText_Display + and will be used by that interface. +*/ +class HF_IdlDocuTextDisplay : public HtmlFactory_Idl, + public ary::inf::DocuText_Display +{ + public: + HF_IdlDocuTextDisplay( + Environment & io_rEnv, + Xml::Element * o_pOut, + const ary::idl::CodeEntity & + i_rScopeGivingCe ); + virtual ~HF_IdlDocuTextDisplay(); + + const ary::idl::CodeEntity & + ScopeGivingCe() const { return *pScopeGivingCe; } + private: + virtual void Display_TextToken( + const csi::dsapi::DT_TextToken & + i_rToken ); + virtual void Display_White(); + + virtual void Display_MupType( + const csi::dsapi::DT_MupType & + i_rToken ); + virtual void Display_MupMember( + const csi::dsapi::DT_MupMember & + i_rToken ); + virtual void Display_MupConst( + const csi::dsapi::DT_MupConst & + i_rToken ); + virtual void Display_Style( + const csi::dsapi::DT_Style & i_rToken ); + virtual void Display_EOL(); + + // Local + void StartLinkGathering( + const String & i_sScope ) + { sLinkToken = ""; sScope = i_sScope; bGatherLink = true; } + void StopLinkGathering() { bGatherLink = false; } + /** @precond + The scope is in sScope, the name is in sLinkToken. + */ + void CreateTypeLink(); + /** @precond + The scope is in sScope, the qualified member-name is in sLinkToken. + */ + void CreateMemberLink(); + + // DATA + String sScope; + String sLinkToken; + bool bGatherLink; + const ary::idl::CodeEntity * + pScopeGivingCe; +}; + + + +class HF_IdlShortDocu : public HtmlFactory_Idl +{ + public: + HF_IdlShortDocu( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlShortDocu(); + + void Produce_byData( + const ary::idl::CodeEntity & + i_rCe ); +}; + + + +class HF_IdlTag : public HtmlFactory_Idl, + public ary::inf::DocuTag_Display +{ + public: + HF_IdlTag( + Environment & io_rEnv, + const ary::idl::CodeEntity & + i_rScopeGivingCe ); + virtual ~HF_IdlTag(); + + void Produce_byData( + Xml::Element & o_rTitle, + Xml::Element & o_rText, + const ary::inf::AtTag2 & + i_rTag ) const; + void Produce_byData( + Xml::Element & o_rTitle, + Xml::Element & o_rText, + const std::vector< csi::dsapi::DT_SeeAlsoAtTag* > & + i_seeAlsoVector ) const; + private: + virtual void Display_StdAtTag( + const csi::dsapi::DT_StdAtTag & + i_rToken ); + virtual void Display_SeeAlsoAtTag( + const csi::dsapi::DT_SeeAlsoAtTag & + i_rToken ); + virtual void Display_ParameterAtTag( + const csi::dsapi::DT_ParameterAtTag & + i_rToken ); + virtual void Display_SinceAtTag( + const csi::dsapi::DT_SinceAtTag & + i_rToken ); + + void Enter_TextOut( + Xml::Element & o_rText ) const; + void Leave_TextOut() const; + void PutText_Out( + const ary::inf::DocuTex2 & + i_rText ) const; + // DATA + mutable Xml::Element * + pTitleOut; + mutable HF_IdlDocuTextDisplay + aTextOut; +}; + + + + +#endif diff --git a/autodoc/source/display/idl/hfi_typedef.cxx b/autodoc/source/display/idl/hfi_typedef.cxx new file mode 100644 index 000000000000..3146be05468f --- /dev/null +++ b/autodoc/source/display/idl/hfi_typedef.cxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * 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 "hfi_typedef.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/ik_typedef.hxx> +#include <toolkit/hf_docentry.hxx> +#include <toolkit/hf_linachain.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_navibar.hxx" +#include "hfi_typetext.hxx" +#include "hi_linkhelper.hxx" + + + +HF_IdlTypedef::HF_IdlTypedef( Environment & io_rEnv, + Xml::Element & o_rOut ) + : HtmlFactory_Idl(io_rEnv, &o_rOut) +{ +} + +HF_IdlTypedef::~HF_IdlTypedef() +{ +} + +typedef ary::idl::ifc_typedef::attr TypedefAttr; + +void +HF_IdlTypedef::Produce_byData( const client & i_ce ) const +{ + make_Navibar(i_ce); + + HF_TitleTable + aTitle(CurOut()); + + HF_LinkedNameChain + aNameChain(aTitle.Add_Row()); + + aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker); + produce_Title(aTitle, C_sCePrefix_Typedef, i_ce); + + HF_DocEntryList + aTopList( aTitle.Add_Row() ); + aTopList.Produce_Term("Defining Type"); + + HF_IdlTypeText + aDefinition( Env(), aTopList.Produce_Definition(), true ); + aDefinition.Produce_byData( TypedefAttr::DefiningType(i_ce) ); + + CurOut() << new Html::HorizontalLine; + + write_Docu(aTitle.Add_Row(), i_ce); + CurOut() << new Html::HorizontalLine(); +} + +void +HF_IdlTypedef::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeMainRow(i_ce); + + CurOut() << new Html::HorizontalLine(); +} diff --git a/autodoc/source/display/idl/hfi_typedef.hxx b/autodoc/source/display/idl/hfi_typedef.hxx new file mode 100644 index 000000000000..59c36baf3bb8 --- /dev/null +++ b/autodoc/source/display/idl/hfi_typedef.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * 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_HFI_TYPEDEF_HXX +#define ADC_DISPLAY_HFI_TYPEDEF_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + + +class HF_IdlTypedef : public HtmlFactory_Idl +{ + public: + HF_IdlTypedef( + Environment & io_rEnv, + Xml::Element & o_rOut ); + virtual ~HF_IdlTypedef(); + + void Produce_byData( + const client & ce ) const; + private: + void make_Navibar( + const client & ce ) const; +}; + + + +// IMPLEMENTATION + + +const String + C_sCePrefix_Typedef("typedef"); + +#endif + + diff --git a/autodoc/source/display/idl/hfi_typetext.cxx b/autodoc/source/display/idl/hfi_typetext.cxx new file mode 100644 index 000000000000..6927308e677e --- /dev/null +++ b/autodoc/source/display/idl/hfi_typetext.cxx @@ -0,0 +1,757 @@ +/************************************************************************* + * + * 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 "hfi_typetext.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <string.h> +#include <ary/idl/i_type.hxx> +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/ik_ce.hxx> +#include <adc_cl.hxx> +#include <adc_msg.hxx> +#include "hi_linkhelper.hxx" + + + + + + +inline const ary::idl::Module * +HF_IdlTypeText::referingModule() const +{ + if (pReferingCe == 0) + return Env().Linker().Search_CurModule(); + else + return &Env().Data().Find_Module(pReferingCe->NameRoom()); +} + +inline const HF_IdlTypeText::client * +HF_IdlTypeText::referingCe() const +{ + return pReferingCe; +} + + +HF_IdlTypeText::HF_IdlTypeText( Environment & io_rEnv, + Xml::Element & o_rOut, + bool i_bWithLink, + const client * i_pScopeGivingCe ) + : HtmlFactory_Idl(io_rEnv, &o_rOut), + pReferingCe( i_pScopeGivingCe ), + bWithLink(i_bWithLink) +{ +} + +HF_IdlTypeText::HF_IdlTypeText( Environment & io_rEnv, + E_Index ) + : HtmlFactory_Idl(io_rEnv, 0), + pReferingCe( 0 ), + bWithLink(true) +{ +} + +HF_IdlTypeText::~HF_IdlTypeText() +{ +} + +void +HF_IdlTypeText::Produce_byData(ary::idl::Type_id i_idType) const +{ + StringVector aModule_; + String sName; + ce_id nCe; + int nSequenceCount = 0; + csv::erase_container(aModule_); + + const ary::idl::Type & + rType = Env().Data().Find_Type(i_idType); + Env().Data().Get_TypeText(aModule_, sName, nCe, nSequenceCount, rType); + + if ( Env().Data().IsBuiltInOrRelated(rType) ) + { + produce_BuiltIn(sName,nSequenceCount); + } + else + { + produce_FromStd( aModule_, + sName, + String::Null_(), + nSequenceCount, + (nCe.IsValid() ? exists_yes : exists_no), + rType.FirstEnclosedNonSequenceType(Env().Gate()).TemplateParameters() ); + } +} + +void +HF_IdlTypeText::Produce_byData( ary::idl::Ce_id i_idCe ) const +{ + StringVector aModule_; + String sCe; + String sMember; + csv::erase_container(aModule_); + + const ary::idl::CodeEntity & + rCe = Env().Data().Find_Ce(i_idCe); + Env().Data().Get_CeText(aModule_, sCe, sMember, rCe); + produce_FromStd(aModule_, sCe, sMember, 0, exists_yes); +} + +void +HF_IdlTypeText::Produce_byData( const String & i_sFullName ) const +{ + if ( strncmp(i_sFullName,"http://", 7) == 0 ) + { + CurOut() + >> *new Html::Link(i_sFullName) + << i_sFullName; + return; + } + + StringVector aModule_; + String sCe, + sMember; + int nSequence = 0; + String sTypeText; + csv::erase_container(aModule_); + + const ary::idl::Module * + pScopeModule = referingModule(); + if (pScopeModule == 0) + { + // SYNTAX_ERR, but rather logical error: Missing module. + CurOut() << i_sFullName; + // KORR_FUTURE + // How to put a message about this? + // errorOut_UnresolvedLink(i_sFullName); + return; + } + + const char * sTypeStart = strrchr(i_sFullName,'<'); + if ( sTypeStart != 0 ) + { + const char * sTypeEnd = strchr(i_sFullName,'>'); + if (sTypeEnd == 0) + { // SYNTAX_ERR + CurOut() << i_sFullName; + // KORR_FUTURE + // How to put a message about this? + // errorOut_UnresolvedLink(i_sFullName); + return; + } + + nSequence = count_Sequences(i_sFullName); + sTypeStart++; + sTypeText.assign(sTypeStart, sTypeEnd-sTypeStart); + } + else + { + sTypeText = i_sFullName; + } + + csv::erase_container(aModule_); + bool bFound = // KORR : Check the semantics of this, see if ce really exists, if it is a member? + Env().Data().Search_Ce( aModule_, + sCe,sMember, + sTypeText, + *pScopeModule ); + if (NOT bFound) + { + if ( strchr(sTypeText,':') == 0 + AND + *sTypeText.c_str() != 'X' ) // This is a HACK, make this correct! + { + Produce_LocalLinkInDocu(sTypeText); + return; + } + CurOut() << i_sFullName; + // KORR + // How to put a message about this? + // errorOut_UnresolvedLink(i_sFullName); + return; + } + + produce_FromStd(aModule_, sCe, sMember, nSequence, exists_yes); +} + +void +HF_IdlTypeText::Produce_LinkInDocu( const String & i_scope, + const String & i_name, + const String & i_member ) const +{ + StringVector aModule_; + String sName; + csv::erase_container(aModule_); + + const ary::idl::Module * + pScopeModule = referingModule(); + if (pScopeModule == 0) + { + // SYNTAX_ERR, but rather logical error: Missing module. + CurOut() << i_scope << "::" << i_name; + if (NOT i_member.empty()) + CurOut() << "::" << i_member; + return; + } + + bool + bFound = Env().Data().Search_CesModule( aModule_, + i_scope, + i_name, + *pScopeModule ); + if (NOT bFound) + { + CurOut() << i_scope << "::" << i_name; + if (NOT i_member.empty()) + CurOut() << "::" << i_member; + return; + } + produce_FromStd(aModule_, i_name, i_member, 0, exists_yes); +} + +void +HF_IdlTypeText::Produce_LocalLinkInDocu( const String & i_member ) const +{ + StringVector aModule_; + String sName; + csv::erase_container(aModule_); + + csv_assert(referingCe() != 0); + if ( referingModule() == Env().Linker().Search_CurModule() ) + { + StreamLock slLink(200); + if (referingCe()->SightLevel() == ary::idl::sl_Member) + { + slLink() << "#" << i_member; + } + else + { + slLink() << referingCe()->LocalName() + << ".html#" + << i_member; + } + CurOut() + >> *new Html::Link(slLink().c_str()) + << i_member; + return; + } + + String sDummyMember; + Env().Data().Get_CeText(aModule_, sName, sDummyMember, *referingCe()); + produce_FromStd(aModule_, sName, i_member, 0, exists_yes); +} + +void +HF_IdlTypeText::Produce_IndexLink( Xml::Element & o_out, + const client & i_ce ) const +{ + StringVector aModule_; + String sCe; + String sMember; + csv::erase_container(aModule_); + + Out().Enter(o_out); + + Env().Data().Get_CeText(aModule_, sCe, sMember, i_ce); + produce_IndexLink(aModule_, sCe, sMember, false); + + Out().Leave(); +} + +void +HF_IdlTypeText::Produce_IndexOwnerLink( Xml::Element & o_out, + const client & i_owner ) const +{ + StringVector aModule_; + String sCe; + String sMember; + csv::erase_container(aModule_); + + Out().Enter(o_out); + + if (i_owner.Owner().IsValid()) + { + Env().Data().Get_CeText(aModule_, sCe, sMember, i_owner); + produce_IndexLink(aModule_, sCe, sMember, true); + } + else + { // global namespace: + + CurOut() + << "." + >> *new Html::Link("../module-ix.html") + << "global namespace"; + } + + + Out().Leave(); +} + +void +HF_IdlTypeText::Produce_IndexSecondEntryLink( Xml::Element & o_out, + const client & i_ce ) const +{ + StringVector aModule_; + String sCe; + String sMember; + csv::erase_container(aModule_); + + Out().Enter(o_out); + + Env().Data().Get_CeText(aModule_, sCe, sMember, i_ce); + produce_IndexLink(aModule_, sCe, sMember, true); + Out().Leave(); +} + + +void +HF_IdlTypeText::produce_FromStd( const StringVector & i_module, + const String & i_ce, + const String & i_member, + int i_sequenceCount, + E_Existence i_ceExists, + const std::vector<ary::idl::Type_id> * + i_templateParameters ) const +{ + if (i_ceExists == exists_no) + { + if ( is_ExternLink(i_module) ) + { + produce_ExternLink(i_module,i_ce,i_member,i_sequenceCount,i_templateParameters); + return; + } + errorOut_UnresolvedLink(i_module, i_ce, i_member); + } + + output::Node & + rCeNode = Env().OutputTree().Provide_Node(i_module); + output::Position + aTargetPos(rCeNode); + bool + bShowModule = rCeNode != Env().CurPosition().RelatedNode() + ? i_module.size() > 0 + : false; + bool + bUseMember = NOT i_member.empty(); + bool + bLink2Module = i_ceExists == exists_yes; + bool + bLink2Ce = i_ceExists == exists_yes; + bool + bLink2Member = NOT Env().Is_MemberExistenceCheckRequired() + AND i_ceExists == exists_yes; + bool + bHasCeOrName = NOT i_ce.empty(); + + if (i_sequenceCount > 0) + start_Sequence(i_sequenceCount); + + StreamLock aLink(300); + StreamStr & rLink = aLink(); + + // Produce output: module + if (bShowModule) + { + int nMax = i_module.size() - 1; + int nCount = 0; + StringVector::const_iterator + itm = i_module.begin(); + for ( ; + nCount < nMax; + ++itm, ++nCount ) + { + CurOut() << "::" << *itm; + } + + CurOut() << "::"; + if (bLink2Module) + { + aTargetPos.Set_File(output::ModuleFileName()); + Env().Linker().Get_Link2Position(rLink, aTargetPos); + CurOut() + >> *new Html::Link( rLink.c_str() ) + << *itm; + rLink.reset(); + } + else + { + CurOut() << *itm; + } + + if (bHasCeOrName) + CurOut() << "::"; + } // end if (bShowModule) + + // CodeEntity and member: + aTargetPos.Set_File( rLink << i_ce << ".html" << c_str ); + rLink.reset(); + + if (bHasCeOrName) + { + if (bLink2Ce) + { + Env().Linker().Get_Link2Position(rLink, aTargetPos); + CurOut() + >> *new Html::Link(rLink.c_str()) + << i_ce; + rLink.reset(); + } + else + { + CurOut() << i_ce; + } + + if (i_templateParameters != 0) + write_TemplateParameterList(*i_templateParameters); + + if (bUseMember) + { + CurOut() << "::"; + + if (bLink2Member) + { + bool bFunction = strstr(i_member,"()") != 0; + String sMember( i_member ); + if (bFunction) + sMember.assign(i_member.c_str(), sMember.length()-2); + + Env().Linker().Get_Link2Member(rLink, aTargetPos, sMember); + CurOut() + >> *new Html::Link(rLink.c_str()) + << i_member; + rLink.reset(); + } + else + { + CurOut() + << i_member; + } + } // endif (bUseMember) + } // endif (bHasCeOrName) + + if (i_sequenceCount > 0) + finish_Sequence(i_sequenceCount); +} + +void +HF_IdlTypeText::produce_BuiltIn( const String & i_type, + int i_sequenceCount ) const +{ + if (i_sequenceCount > 0) + start_Sequence(i_sequenceCount); + CurOut() << i_type; + if (i_sequenceCount > 0) + finish_Sequence(i_sequenceCount); +} + +void +HF_IdlTypeText::produce_IndexLink( const StringVector & i_module, + const String & i_ce, + const String & i_member, + bool i_bIsOwner ) const +{ + output::Node & + rCeNode = Env().OutputTree().Provide_Node(i_module); + output::Position + aTargetPos(rCeNode); + bool + bShowModule = i_bIsOwner OR (i_module.size() > 0 AND i_ce.empty()); + bool + bShowNonModule = NOT bShowModule OR (i_bIsOwner AND NOT i_ce.empty()); + bool + bUseMember = NOT i_member.empty(); + + StreamLock aLink(300); + StreamStr & rLink = aLink(); + + // Produce output: module + if (bShowModule) + { + if (i_bIsOwner) + { + int nMax = bShowNonModule ? i_module.size() : i_module.size() - 1; + int nCount = 0; + for ( StringVector::const_iterator itm = i_module.begin(); + nCount < nMax; + ++itm, ++nCount ) + { + CurOut() << "::" << *itm; + } + CurOut() << ":: ."; + } + + if (NOT bShowNonModule) + { + aTargetPos.Set_File(output::ModuleFileName()); + Env().Linker().Get_Link2Position(rLink, aTargetPos); + CurOut() + >> *new Html::Link( rLink.c_str() ) + >> *new Html::Bold + << i_module.back(); + rLink.reset(); + } + } // end if (bShowModule) + + if (bShowNonModule) + { + aTargetPos.Set_File( rLink << i_ce << ".html" << c_str ); + rLink.reset(); + + if (bUseMember) + { + bool bFunction = strstr(i_member,"()") != 0; + String sMember( i_member ); + if (bFunction) + sMember.assign(i_member.c_str(), sMember.length()-2); + Env().Linker().Get_Link2Member(rLink, aTargetPos, sMember); + CurOut() + >> *new Html::Link(rLink.c_str()) + >> *new Html::Bold + << i_member; + rLink.reset(); + } + else + { + Env().Linker().Get_Link2Position(rLink, aTargetPos); + if (i_bIsOwner) + { + CurOut() + >> *new Html::Link(rLink.c_str()) + << i_ce; + } + else + { + CurOut() + >> *new Html::Link(rLink.c_str()) + >> *new Html::Bold + << i_ce; + } + rLink.reset(); + } + } // endif (bHasCeOrName) +} + +int +HF_IdlTypeText::count_Sequences( const char * i_sFullType ) const +{ + int ret = 0; + + for ( const char * pCount = i_sFullType; + *pCount != 0; + ) + { + pCount = strstr(pCount,"sequence"); + if (pCount != 0) + { + pCount += sizeof("sequence"); // = strlen(sequence) + 1 for '<'. + if ( *(pCount-1) == '\0' ) + { + // SYNTAX_ERR + return 0; + } + ++ret; + } + } // end for + + return ret; +} + +void +HF_IdlTypeText::start_Sequence( int i_count ) const +{ + csv_assert( i_count > 0 ); + for (int i = 0; i < i_count; ++i ) + { + CurOut() << "sequence< "; + } +} + +void +HF_IdlTypeText::finish_Sequence( int i_count ) const +{ + csv_assert( i_count > 0 ); + for (int i = 0; i < i_count; ++i ) + { + CurOut() << " >"; + } +} + +void +HF_IdlTypeText::errorOut_UnresolvedLink( const char * i_name ) const +{ + StreamLock slFile(1000); + + // KORR + // Handle links in cited documentation from other entities. + slFile() << Env().CurPageCe_AsText(); + slFile().pop_back(5); + slFile() << ".idl"; + + // KORR + // Retrieve, correct line number. + TheMessages().Out_UnresolvedLink( i_name, + slFile().c_str(), + 0 ); +} + +void +HF_IdlTypeText::errorOut_UnresolvedLink( const StringVector & i_module, + const String & i_ce, + const String & i_member ) const +{ + StreamLock slName(500); + + if (i_module.size() > 0) + { + slName().operator_join(i_module.begin(), i_module.end(), "::"); + if (NOT i_ce.empty()) + slName() << "::"; + } + if (NOT i_ce.empty()) + { + slName() << i_ce; + if (NOT i_member.empty()) + slName() << "::" << i_member; + } + errorOut_UnresolvedLink(slName().c_str()); +} + +bool +HF_IdlTypeText::is_ExternLink( const StringVector & i_module ) const +{ + const autodoc::CommandLine & + rCmdLine = autodoc::CommandLine::Get_(); + uintt nExtNspLength = rCmdLine.ExternNamespace().length(); + if (nExtNspLength == 0) + return false; + + StreamStr s(1000); + s << "::"; + s.operator_join( i_module.begin(), + i_module.end(), + "::" ); + + if (s.length() < nExtNspLength) + return false; + return ( strncmp( rCmdLine.ExternNamespace().c_str(), + s.c_str(), + nExtNspLength ) == 0 ); +} + +void +HF_IdlTypeText::produce_ExternLink( const StringVector & i_module, + const String & i_ce, + const String & i_member, + int i_sequenceCount, + const std::vector<ary::idl::Type_id> * + i_templateParameters ) const +{ + // KORR + // Look again at this code and take some time. + + StreamLock aLink(1000); + StreamStr & rLink = aLink(); + + rLink << autodoc::CommandLine::Get_().ExternRoot(); + rLink.operator_join( i_module.begin(), + i_module.end(), + "/" ); + rLink << '/' + << i_ce + << ".html"; + if (i_member.length() > 0) + rLink << "/#" << i_member; + + if (i_sequenceCount > 0) + start_Sequence(i_sequenceCount); + + // module + int nMax = i_module.size(); + int nCount = 0; + StringVector::const_iterator + itm = i_module.begin(); + for ( ; + nCount < nMax; + ++itm, ++nCount ) + { + CurOut() << "::" << *itm; + } + CurOut() << "::"; + + + // CodeEntity + if (i_member.length() == 0) + { + CurOut() + >> *new Html::Link(rLink.c_str()) + << i_ce; + } + else + { + CurOut() + << i_ce; + } + + if (i_templateParameters != 0) + write_TemplateParameterList(*i_templateParameters); + + // Member + if (i_member.length() > 0) + { + CurOut() + >> *new Html::Link(rLink.c_str()) + << i_member; + } + + if (i_sequenceCount > 0) + finish_Sequence(i_sequenceCount); +} + +void +HF_IdlTypeText::write_TemplateParameterList( + const std::vector<ary::idl::Type_id> & i_templateParameters ) const +{ + if (i_templateParameters.size() == 0) + return; + + HF_IdlTypeText + aTemplateParamWriter(Env(), CurOut(), true, pReferingCe); + CurOut() << "< "; + std::vector<ary::idl::Type_id>::const_iterator + it = i_templateParameters.begin(); + aTemplateParamWriter.Produce_byData(*it); + for ( ++it; it != i_templateParameters.end(); ++it ) + { + CurOut() << ", "; + aTemplateParamWriter.Produce_byData(*it); + } + CurOut() << " >"; +} diff --git a/autodoc/source/display/idl/hfi_typetext.hxx b/autodoc/source/display/idl/hfi_typetext.hxx new file mode 100644 index 000000000000..62766ed411e0 --- /dev/null +++ b/autodoc/source/display/idl/hfi_typetext.hxx @@ -0,0 +1,158 @@ +/************************************************************************* + * + * 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_HFI_TYPETEXT_HXX +#define ADC_DISPLAY_HFI_TYPETEXT_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + + +class HF_IdlTypeText : public HtmlFactory_Idl +{ + public: + enum E_Index { use_for_javacompatible_index }; + + HF_IdlTypeText( + Environment & io_rEnv, + Xml::Element & o_rOut, + bool i_bWithLink, + const client * i_pScopeGivingCe = 0 ); + HF_IdlTypeText( + Environment & io_rEnv, + E_Index e ); + virtual ~HF_IdlTypeText(); + + void Produce_byData( + ary::idl::Type_id i_idType ) const; + void Produce_byData( + ary::idl::Ce_id i_idCe ) const; + void Produce_byData( + const String & i_sFullName ) const; + void Produce_LinkInDocu( + const String & i_scope, + const String & i_name, + const String & i_member ) const; + void Produce_LocalLinkInDocu( + const String & i_member ) const; + + /// Produce the first link for Java-help understood index entries. + void Produce_IndexLink( + Xml::Element & o_out, + const client & i_ce ) const; + /** Produce the second link for Java-help understood index entries. + For members this will be a link to their owner (this function is + used), else see @->Produce_IndexSecondEntryLink(); + */ + void Produce_IndexOwnerLink( + Xml::Element & o_out, + const client & i_owner ) const; + /** Produce the second link for Java-help understood index entries. + For non- members this will again be a link to to the entry itself + (this function is used), else see @->Produce_IndexOwnerLink(); + */ + void Produce_IndexSecondEntryLink( + Xml::Element & o_out, + const client & i_ce ) const; + private: + // Locals + enum E_Existence + { + exists_dontknow, + exists_yes, + exists_no + }; + + void produce_FromStd( + const StringVector & + i_module, + const String & i_ce, + const String & i_member, + int i_sequenceCount, + E_Existence i_ceExists, + const std::vector<ary::idl::Type_id> * + i_templateParameters = 0 ) const; + void produce_BuiltIn( + const String & i_type, + int i_sequenceCount ) const; + void produce_IndexLink( + const StringVector & + i_module, + const String & i_ce, + const String & i_member, + bool i_bIsOwner ) const; + int count_Sequences( + const char * i_sFullType ) const; + void start_Sequence( + int i_count ) const; + void finish_Sequence( + int i_count ) const; + void errorOut_UnresolvedLink( + const char * i_name ) const; + void errorOut_UnresolvedLink( + const StringVector & + i_module, + const String & i_ce, + const String & i_member ) const; + bool is_ExternLink( + const StringVector & + i_module ) const; + void produce_ExternLink( + const StringVector & + i_module, + const String & i_ce, + const String & i_member, + int i_sequenceCount, + const std::vector<ary::idl::Type_id> * + i_templateParameters ) const; + void write_TemplateParameterList( + const std::vector<ary::idl::Type_id> & + i_templateParameters ) const; + const ary::idl::Module * + referingModule() const; + const client * referingCe() const; + + // DATA + mutable const client * + pReferingCe; + bool bWithLink; +}; + + + +// IMPLEMENTATION + + + +#endif + + diff --git a/autodoc/source/display/idl/hfi_xrefpage.cxx b/autodoc/source/display/idl/hfi_xrefpage.cxx new file mode 100644 index 000000000000..ecf4cb72ff43 --- /dev/null +++ b/autodoc/source/display/idl/hfi_xrefpage.cxx @@ -0,0 +1,273 @@ +/************************************************************************* + * + * 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 "hfi_xrefpage.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/ip_ce.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_navibar.hxx" +#include "hfi_typetext.hxx" +#include "hi_env.hxx" + + +namespace +{ + +const String + C_sTitleStart("uses of "); +const String + C_sCRLF("\n"); +const String + C_sDevMan("References in Developers Guide"); + +} // anonymous namespace + + + +HF_IdlXrefs::HF_IdlXrefs( Environment & io_rEnv, + Xml::Element & o_rOut, + const String & i_prefix, + const client & i_ce ) + : HtmlFactory_Idl(io_rEnv, &o_rOut), + rContentDirectory(*new Html::Paragraph), + pClient(&i_ce) +{ + produce_Main(i_prefix, i_ce); +} + +HF_IdlXrefs::~HF_IdlXrefs() +{ +} + +void +HF_IdlXrefs::Write_ManualLinks( const client & i_ce ) const +{ + const StringVector & + rLinks2Refs = i_ce.Secondaries().Links2RefsInManual(); + if ( rLinks2Refs.size() == 0 ) + { + rContentDirectory + << C_sDevMan + << new Html::LineBreak + << C_sCRLF; + return; + } + + + rContentDirectory + >> *new Html::Link("#devmanrefs") + << C_sDevMan + << new Html::LineBreak + << C_sCRLF; + + HF_SubTitleTable + aList(CurOut(), "devmanrefs", C_sDevMan, 1); + Xml::Element & + rOutCell = aList.Add_Row() >>* new Html::TableCell; + + csv_assert(rLinks2Refs.size() % 2 == 0); + for ( StringVector::const_iterator it = rLinks2Refs.begin(); + it != rLinks2Refs.end(); + ++it ) + { + Xml::Element & + rLink = rOutCell >> *new Html::Link( Env().Link2Manual(*it)); + if ( (*(it+1)).empty() ) + + // HACK KORR_FUTURE + // Research what happens with manual links which contain normal characters + // in non-utf-8 texts. And research, why utfF-8 does not work here. + rLink << new Xml::XmlCode(*it); + else + // HACK KORR_FUTURE, see above. + rLink << new Xml::XmlCode( *(it+1) ); + rOutCell + << new Html::LineBreak + << C_sCRLF; + ++it; + } // end for +} + +void +HF_IdlXrefs::Produce_List( const char * i_title, + const char * i_label, + ce_list & i_iterator ) const +{ + if (NOT i_iterator) + { + rContentDirectory + << i_title + << new Html::LineBreak + << C_sCRLF; + return; + } + + csv_assert(*i_label == '#'); + + rContentDirectory + >> *new Html::Link(i_label) + << i_title + << new Html::LineBreak + << C_sCRLF; + + HF_SubTitleTable + aList(CurOut(), i_label+1, i_title, 1); + Xml::Element & + rOutCell = aList.Add_Row() >>* new Html::TableCell; + HF_IdlTypeText + aTypeWriter(Env(), rOutCell, true, pClient); + for ( ce_list & it = i_iterator; it; ++it ) + { + aTypeWriter.Produce_byData(*it); + rOutCell << new Html::LineBreak; + } // end for +} + +void +HF_IdlXrefs::Produce_Tree( const char * i_title, + const char * i_label, + const client & i_ce, + F_GET_SUBLIST i_sublistcreator ) const +{ + dyn_ce_list pResult; + (*i_sublistcreator)(pResult, i_ce); + + if (NOT (*pResult).operator bool()) + { + rContentDirectory + << i_title + << new Html::LineBreak + << C_sCRLF; + return; + } + + csv_assert(*i_label == '#'); + + rContentDirectory + >> *new Html::Link(i_label) + << i_title + << new Html::LineBreak + << C_sCRLF; + + HF_SubTitleTable + aList(CurOut(), i_label+1, i_title, 1); + Xml::Element & + rOut = aList.Add_Row() + >>* new Html::TableCell + >> *new csi::xml::AnElement("pre") + << new csi::html::StyleAttr("font-family:monospace;"); + + recursive_make_ListInTree( rOut, + 0, + i_ce, + *pResult, + i_sublistcreator ); +} + +void +HF_IdlXrefs::produce_Main( const String & i_prefix, + const client & i_ce ) const +{ + make_Navibar(i_ce); + + HF_TitleTable + aTitle(CurOut()); + StreamLock sl(200); + aTitle.Produce_Title( sl() + << C_sTitleStart + << i_prefix + << " " + << i_ce.LocalName() + << c_str ); + + aTitle.Add_Row() << &rContentDirectory; + sl().reset(); + rContentDirectory + >> *new Html::Link( sl() << i_ce.LocalName() + << ".html" + << c_str ) + >> *new Html::Bold + << "back to " + << i_prefix + << " " + << i_ce.LocalName(); + rContentDirectory + << new Html::LineBreak + << new Html::LineBreak + << C_sCRLF; + + CurOut() << new Html::HorizontalLine(); +} + +void +HF_IdlXrefs::make_Navibar( const client & i_ce ) const +{ + HF_IdlNavigationBar + aNaviBar(Env(), CurOut()); + aNaviBar.Produce_CeXrefsMainRow(i_ce); + CurOut() << new Html::HorizontalLine(); +} + +void +HF_IdlXrefs::recursive_make_ListInTree( Xml::Element & o_rDisplay, + uintt i_level, + const client & i_ce, + ce_list & i_iterator, + F_GET_SUBLIST i_sublistcreator ) const +{ + const char * sLevelIndentation = " "; + + HF_IdlTypeText + aTypeWriter(Env(), o_rDisplay, true, &i_ce); + for ( ; i_iterator.operator bool(); ++i_iterator ) + { + for (uintt i = 0; i < i_level; ++i) + { + o_rDisplay << sLevelIndentation; + } // end for + + aTypeWriter.Produce_byData(*i_iterator); + o_rDisplay << C_sCRLF; + + dyn_ce_list pResult; + const client & rCe = Env().Gate().Ces().Find_Ce(*i_iterator); + (*i_sublistcreator)(pResult, rCe); + if ( (*pResult).operator bool() ) + { + recursive_make_ListInTree( o_rDisplay, + i_level + 1, + rCe, + *pResult, + i_sublistcreator ); + } + } // end for +} diff --git a/autodoc/source/display/idl/hfi_xrefpage.hxx b/autodoc/source/display/idl/hfi_xrefpage.hxx new file mode 100644 index 000000000000..2eed092c568e --- /dev/null +++ b/autodoc/source/display/idl/hfi_xrefpage.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * 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_HFI_XREFPAGE_HXX +#define ADC_DISPLAY_HFI_XREFPAGE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "hi_factory.hxx" + // COMPONENTS + // PARAMETERS + + +class HF_IdlXrefs : public HtmlFactory_Idl +{ + public: + typedef void (*F_GET_SUBLIST)(dyn_ce_list&, const client&); + + HF_IdlXrefs( + Environment & io_rEnv, + Xml::Element & o_rOut, + const String & i_prefix, + const client & i_ce); + virtual ~HF_IdlXrefs(); + + /** @descr + Only lists which are tried to be produced by Produce_List() or + Produce_Tree(), will occur in the content directory of the page. + They will have links, if the list or tree has at least one element, + else the list is mentioned in the directory without link. + + @param i_label [*i_label == '#'] + */ + void Produce_List( + const char * i_title, + const char * i_label, + ce_list & i_iterator ) const; + void Write_ManualLinks( + const client & i_ce ) const; + /** @descr + Only lists which are tried to be produced by Produce_List() or + Produce_Tree(), will occur in the content directory of the page. + They will have links, if the list or tree has at least one element, + else the list is mentioned in the directory without link. + + @param i_label [*i_label == '#'] + */ + void Produce_Tree( + const char * i_title, + const char * i_label, + const client & i_ce, + F_GET_SUBLIST i_sublistcreator ) const; + + private: + // Locals + void produce_Main( + const String & i_prefix, + const client & i_ce ) const; + void make_Navibar( + const client & i_ce ) const; + /// @return true if there are any elements in sub lists. + void recursive_make_ListInTree( + Xml::Element & o_rDisplay, + uintt i_level, /// 0 is highest + const client & i_ce, + ce_list & i_iterator, + F_GET_SUBLIST i_sublistcreator ) const; + + // DATA + Xml::Element & rContentDirectory; + const client * pClient; +}; + + + +// IMPLEMENTATION + +#endif diff --git a/autodoc/source/display/idl/hi_ary.cxx b/autodoc/source/display/idl/hi_ary.cxx new file mode 100644 index 000000000000..ce8a4197911f --- /dev/null +++ b/autodoc/source/display/idl/hi_ary.cxx @@ -0,0 +1,283 @@ +/************************************************************************* + * + * 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 "hi_ary.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/ploc_dir.hxx> +#include <ary/idl/i_gate.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_type.hxx> +#include <ary/idl/ip_ce.hxx> +#include <ary/idl/ip_type.hxx> + + +inline const ary::idl::Gate & +AryAccess::gate() const + { return rGate; } + +inline const ary::idl::CePilot & +AryAccess::ces() const + { return rGate.Ces(); } + +inline const ary::idl::TypePilot & +AryAccess::types() const + { return rGate.Types(); } + +inline const ary::idl::Module * +AryAccess::find_SubModule( const ary::idl::Module & i_parent, + const String & i_name ) const +{ + ary::idl::Ce_id + nModule = i_parent.Search_Name(i_name); + return ces().Search_Module(nModule); +} + +bool +AryAccess::nextName( const char * & io_TextPtr, + String & o_name ) const +{ + if ( strncmp(io_TextPtr,"::", 2) == 0 ) + io_TextPtr += 2; + + const char * pEnd = strchr(io_TextPtr,':'); + size_t nLen = pEnd == 0 + ? strlen(io_TextPtr) + : pEnd - io_TextPtr; + o_name.assign(io_TextPtr, nLen); + io_TextPtr += nLen; + + return nLen > 0; +} + + + +AryAccess::AryAccess( const ary::idl::Gate & i_rGate ) + : rGate(i_rGate) +{ +} + +const ary::idl::Module & +AryAccess::GlobalNamespace() const +{ + return ces().GlobalNamespace(); +} + +const ary::idl::Module & +AryAccess::Find_Module( ary::idl::Ce_id i_ce ) const +{ + return ces().Find_Module(i_ce); +} + + +const ary::idl::CodeEntity & +AryAccess::Find_Ce( ary::idl::Ce_id i_ce ) const +{ + return ces().Find_Ce(i_ce); +} + +const ary::idl::Type & +AryAccess::Find_Type( ary::idl::Type_id i_type ) const +{ + return types().Find_Type(i_type); +} + +ary::idl::Ce_id +AryAccess::CeFromType( ary::idl::Type_id i_type ) const +{ + return types().Search_CeRelatedTo(i_type); +} + +bool +AryAccess::IsBuiltInOrRelated( const ary::idl::Type & i_type ) const +{ + return types().IsBuiltInOrRelated(i_type); +} + +bool +AryAccess::Search_Ce( StringVector & o_module, + String & o_mainEntity, + String & o_memberEntity, + const char * i_sText, + const ary::idl::Module & i_referingScope ) const +{ + o_module.erase(o_module.begin(),o_module.end()); + o_mainEntity = String::Null_(); + o_memberEntity = String::Null_(); + + const ary::idl::Module * pModule = 0; + + if ( strncmp(i_sText, "::", 2) == 0 + OR strncmp(i_sText, "com::sun::star", 14) == 0 ) + pModule = &GlobalNamespace(); + else + { + pModule = &i_referingScope; + ces().Get_Text(o_module, o_mainEntity, o_memberEntity, *pModule); + } + + const char * pNext = i_sText; + String sNextName; + + // Find Module: + while ( nextName(pNext, sNextName) ) + { + const ary::idl::Module * + pSub = find_SubModule(*pModule, sNextName); + if (pSub != 0) + { + pModule = pSub; + o_module.push_back(sNextName); + } + else + break; + } + + // Find main CodeEntity: + if ( sNextName.length() == 0 ) + return true; + const ary::idl::Ce_id + nCe = pModule->Search_Name(sNextName); + if (NOT nCe.IsValid()) + return false; + o_mainEntity = sNextName; + + // Find member: + if ( *pNext == 0 ) + return true; + nextName(pNext, o_memberEntity); + if (strchr(o_memberEntity,':') != 0) + return false; // This must not happen in IDL + +#if 0 +// The following code avoids false links, but is rather expensive +// in runtime time consumation. + + const ary::idl::CodeEntity * + pCe = Find_Ce(nCe); + if (pCe == 0) + return false; + + if ( NOT ary::idl::ifc_ce::attr::Search_Member(*pCe,o_memberEntity) ) + return false; +#endif + + return true; +} + +bool +AryAccess::Search_CesModule( StringVector & o_module, + const String & i_scope, + const String & i_ce, + const ary::idl::Module & i_referingScope ) const +{ + o_module.erase(o_module.begin(),o_module.end()); + + const ary::idl::Module * + pModule = 0; + + if ( strncmp(i_scope, "::", 2) == 0 + OR strncmp(i_scope, "com::sun::star", 14) == 0 ) + pModule = &GlobalNamespace(); + else + { + pModule = &i_referingScope; + static String Dummy1; + static String Dummy2; + ces().Get_Text(o_module, Dummy1, Dummy2, *pModule); + } + + const char * pNext = i_scope; + String sNextName; + + // Find Module: + while ( nextName(pNext, sNextName) ) + { + const ary::idl::Module * + pSub = find_SubModule(*pModule, sNextName); + if (pSub != 0) + { + pModule = pSub; + o_module.push_back(sNextName); + } + else + return false; + } // end while + return pModule->Search_Name(i_ce).IsValid(); +} + +const ary::idl::Module * +AryAccess::Search_Module( const StringVector & i_nameChain ) const +{ + const ary::idl::Module * ret = + &GlobalNamespace(); + for ( StringVector::const_iterator it = i_nameChain.begin(); + it != i_nameChain.end(); + ++it ) + { + ret = find_SubModule(*ret, *it); + if (ret == 0) + break; + } // end for + return ret; +} + +void +AryAccess::Get_CeText( StringVector & o_module, + String & o_ce, + String & o_member, + const ary::idl::CodeEntity & i_ce ) const +{ + ces().Get_Text(o_module, o_ce, o_member, i_ce); +} + +void +AryAccess::Get_TypeText( StringVector & o_module, + String & o_sCe, + ary::idl::Ce_id & o_nCe, + int & o_sequenceCount, + const ary::idl::Type & i_type ) const +{ + i_type.Get_Text(o_module, o_sCe, o_nCe, o_sequenceCount, gate()); +} + +void +AryAccess::Get_IndexData( std::vector<ary::idl::Ce_id> & o_data, + ary::idl::alphabetical_index::E_Letter i_letter ) const +{ + rGate.Ces().Get_AlphabeticalIndex(o_data, i_letter); +} + + +const ary::idl::CePilot & +AryAccess::Ces() const +{ + return rGate.Ces(); +} diff --git a/autodoc/source/display/idl/hi_ary.hxx b/autodoc/source/display/idl/hi_ary.hxx new file mode 100644 index 000000000000..a85dff4913dd --- /dev/null +++ b/autodoc/source/display/idl/hi_ary.hxx @@ -0,0 +1,162 @@ +/************************************************************************* + * + * 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_HI_ARY_HXX +#define ADC_DISPLAY_HI_ARY_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <ary/idl/i_types4idl.hxx> + // PARAMETERS +#include <ary/idl/i_gate.hxx> +#include <ary/doc/d_docu.hxx> +#include <ary/doc/d_oldidldocu.hxx> + + +namespace ary +{ +namespace idl +{ + class Module; + class Gate; + class CePilot; + class TypePilot; +} +} +namespace output +{ + class Position; +} + + + + +inline const ary::doc::OldIdlDocu * +Get_IdlDocu(const ary::doc::Documentation & i_doc) +{ + return dynamic_cast< const ary::doc::OldIdlDocu* >(i_doc.Data()); +} + + + + + +/** A helper class to wrap the access to data in the Autodoc Repository. +*/ +class AryAccess +{ + public: + // LIFECYCLE + AryAccess( + const ary::idl::Gate & + i_rGate ); + // INQUIRY + const ary::idl::Module & + GlobalNamespace() const; + const ary::idl::Module & + Find_Module( + ary::idl::Ce_id i_ce ) const; + const ary::idl::CodeEntity & + Find_Ce( + ary::idl::Ce_id i_ce ) const; + const ary::idl::Type & + Find_Type( + ary::idl::Type_id i_type ) const; + ary::idl::Ce_id CeFromType( + ary::idl::Type_id i_type ) const; + bool IsBuiltInOrRelated( + const ary::idl::Type & + i_type ) const; + bool Search_Ce( + StringVector & o_module, + String & o_mainEntity, + String & o_memberEntity, + const char * i_sText, + const ary::idl::Module & + i_referingScope ) const; + bool Search_CesModule( + StringVector & o_module, + const String & i_scope, + const String & i_ce, + const ary::idl::Module & + i_referingScope ) const; + const ary::idl::Module * + Search_Module( + const StringVector & + i_nameChain ) const; + + void Get_CeText( + StringVector & o_module, + String & o_ce, + String & o_member, + const ary::idl::CodeEntity & + i_ce ) const; + void Get_TypeText( + StringVector & o_module, + String & o_sCe, + ary::idl::Ce_id & o_nCe, + int & o_sequenceCount, + const ary::idl::Type & + i_type ) const; + void Get_IndexData( + std::vector<ary::idl::Ce_id> & + o_data, + ary::idl::alphabetical_index::E_Letter + i_letter ) const; + + const ary::idl::CePilot & + Ces() const; + private: + const ary::idl::Module * + find_SubModule( + const ary::idl::Module & + i_parent, + const String & i_name ) const; + + /// Gets "::"-separated names out of a string. + bool nextName( + const char * & io_TextPtr, + String & o_name ) const; + + + const ary::idl::Gate & + gate() const; + const ary::idl::CePilot & + ces() const; + const ary::idl::TypePilot & + types() const; + // DATA + const ary::idl::Gate & + rGate; +}; + + +#endif + + diff --git a/autodoc/source/display/idl/hi_display.cxx b/autodoc/source/display/idl/hi_display.cxx new file mode 100644 index 000000000000..f1c2042e9e6d --- /dev/null +++ b/autodoc/source/display/idl/hi_display.cxx @@ -0,0 +1,207 @@ +/************************************************************************* + * + * 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 <idl/hi_display.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <cosv/file.hxx> +#include <ary/idl/i_ce.hxx> +#include <ary/idl/i_module.hxx> +#include <ary/getncast.hxx> +#include <toolkit/out_tree.hxx> +#include <cfrstd.hxx> +#include "hi_ary.hxx" +#include "hi_env.hxx" +#include "hi_main.hxx" + + +extern const String C_sCssFilename_Idl; + + +inline bool +HtmlDisplay_Idl::IsModule( const ary::idl::CodeEntity & i_ce ) const +{ + return ary::is_type<ary::idl::Module>(i_ce); +} + +inline const ary::idl::Module & +HtmlDisplay_Idl::Module_Cast( const ary::idl::CodeEntity & i_ce ) const +{ + return ary::ary_cast<ary::idl::Module>(i_ce); +} + + + + +HtmlDisplay_Idl::HtmlDisplay_Idl() + : pCurPageEnv(), + pMainDisplay() +{ +} + +HtmlDisplay_Idl::~HtmlDisplay_Idl() +{ +} + +void +HtmlDisplay_Idl::do_Run( const char * i_sOutputDirectory, + const ary::idl::Gate & i_rAryGate, + const display::CorporateFrame & i_rLayout ) +{ + SetRunData( i_sOutputDirectory, i_rAryGate, i_rLayout ); + + Create_StartFile(); + Create_CssFile(); + Create_FilesInNameTree(); + Create_IndexFiles(); + Create_FilesInProjectTree(); + Create_PackageList(); + Create_HelpFile(); +} + +void +HtmlDisplay_Idl::SetRunData( const char * i_sOutputDirectory, + const ary::idl::Gate & i_rAryGate, + const display::CorporateFrame & i_rLayout ) +{ + csv::ploc::Path aOutputDir( i_sOutputDirectory, true ); + pCurPageEnv = new HtmlEnvironment_Idl( aOutputDir, i_rAryGate, i_rLayout ); + pMainDisplay = new MainDisplay_Idl(*pCurPageEnv); +} + +void +HtmlDisplay_Idl::Create_StartFile() +{ +} + +void +HtmlDisplay_Idl::Create_FilesInNameTree() +{ + Cout() << "\nCreate files in subtree namespaces ..." << Endl(); + + const ary::idl::Module & + rGlobalNamespace = pCurPageEnv->Data().GlobalNamespace(); + pCurPageEnv->Goto_Directory( pCurPageEnv->OutputTree().NamesRoot(), true ); + + RecursiveDisplay_Module(rGlobalNamespace); + + Cout() << "... done." << Endl(); +} + +void +HtmlDisplay_Idl::Create_IndexFiles() +{ + Cout() << "\nCreate files in subtree index ..." << Endl(); + pCurPageEnv->Goto_Directory( pCurPageEnv->OutputTree().IndexRoot(), true ); + pMainDisplay->WriteGlobalIndices(); + Cout() << "... done.\n" << Endl(); +} + +typedef ary::Dyn_StdConstIterator<ary::idl::Ce_id> Dyn_CeIterator; +typedef ary::StdConstIterator<ary::idl::Ce_id> CeIterator; + +void +HtmlDisplay_Idl::RecursiveDisplay_Module( const ary::idl::Module & i_module ) +{ + i_module.Accept(*pMainDisplay); + + Dyn_CeIterator + aMembers; + i_module.Get_Names(aMembers); + + for ( CeIterator & iter = *aMembers; + iter; + ++iter ) + { + const ary::idl::CodeEntity & + rCe = pCurPageEnv->Data().Find_Ce(*iter); + + if ( NOT IsModule(rCe) ) + rCe.Accept(*pMainDisplay); + else + { + pCurPageEnv->Goto_DirectoryLevelDown( rCe.LocalName(), true ); + RecursiveDisplay_Module( Module_Cast(rCe) ); + pCurPageEnv->Goto_DirectoryLevelUp(); + } + } // end for +} + +void +HtmlDisplay_Idl::Create_FilesInProjectTree() +{ +} + +void +HtmlDisplay_Idl::Create_PackageList() +{ +#if 0 + Cout() << "\nCreate package list ..." << std::flush; + + pCurPageEnv->CurPosition() = pCurPageEnv->OutputTree().Root(); + + // KORR + // ... + + Cout() << " done." << Endl(); +#endif // 0 +} + +void +HtmlDisplay_Idl::Create_HelpFile() +{ +} + +void +HtmlDisplay_Idl::Create_CssFile() +{ + Cout() << "\nCreate css file ..." << Endl(); + + pCurPageEnv->Goto_Directory( pCurPageEnv->OutputTree().Root(), true ); + pCurPageEnv->Set_CurFile( C_sCssFilename_Idl ); + + StreamLock + slCurFilePath(700); + pCurPageEnv->Get_CurFilePath(slCurFilePath()); + + csv::File + aCssFile(slCurFilePath().c_str(), csv::CFM_CREATE); + csv::OpenCloseGuard + aOpenGuard(aCssFile); + if (NOT aOpenGuard) + { + Cerr() << "Can't create file " << slCurFilePath().c_str() << "." << Endl(); + return; + } + + aCssFile.write("/* Autodoc css file for IDL documentation */\n\n\n"); + aCssFile.write(pCurPageEnv->Layout().CssStyle()); + aCssFile.write("\n\n\n"); + aCssFile.write(pCurPageEnv->Layout().CssStylesExplanation()); +} diff --git a/autodoc/source/display/idl/hi_env.cxx b/autodoc/source/display/idl/hi_env.cxx new file mode 100644 index 000000000000..7dc6b8187ab9 --- /dev/null +++ b/autodoc/source/display/idl/hi_env.cxx @@ -0,0 +1,199 @@ +/************************************************************************* + * + * 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 "hi_env.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <cosv/ploc_dir.hxx> +#include <cfrstd.hxx> +#include <toolkit/out_tree.hxx> +#include "hi_ary.hxx" +#include "hi_linkhelper.hxx" + + + +const String C_s_index_files("index-files"); + +const String C_sUseFileSuffix("-use.html"); +const String C_IndexA_FileName("index-1.html"); + + +HtmlEnvironment_Idl::HtmlEnvironment_Idl( const csv::ploc::Path & i_rOutputDir, + const ary::idl::Gate & i_rGate, + const display::CorporateFrame & i_rLayout ) + : aOutputRoot(i_rOutputDir), + pData(new AryAccess(i_rGate)), + pGate(&i_rGate), + pOutputTree(new output::Tree), + aCurPosition(pOutputTree->Root()), + pCurPageCe(0), + pLayout(&i_rLayout), + pLinker() +{ + StringVector aHelp; + pOutputTree->Set_NamesRoot(aHelp); + + aHelp.push_back(output::IndexFilesDirName()); + pOutputTree->Set_IndexRoot(aHelp); + + (*aHelp.begin()) = String("com"); + aHelp.push_back(String("sun")); + aHelp.push_back(String("star")); + pOutputTree->Set_Overview(aHelp, output::ModuleFileName() ); + + pLinker = new LinkHelper(*this); +} + +HtmlEnvironment_Idl::~HtmlEnvironment_Idl() +{ +} + +namespace +{ +StringVector G_aChain; +} + +void +HtmlEnvironment_Idl::Goto_Directory( output::Position i_pos, + bool i_bCreateDirectoryIfNecessary ) +{ + aCurPosition = i_pos; + aCurPath = aOutputRoot.MyPath(); + + aCurPosition.Get_Chain(G_aChain); + for ( StringVector::const_iterator it = G_aChain.begin(); + it != G_aChain.end(); + ++it ) + { + aCurPath.DirChain() += *it; + } + + if (i_bCreateDirectoryIfNecessary) + create_Directory(aCurPath); +} + +void +HtmlEnvironment_Idl::Goto_DirectoryLevelDown( const String & i_subDirName, + bool i_bCreateDirectoryIfNecessary ) +{ + aCurPosition +=(i_subDirName); + + aCurPath.SetFile(String::Null_()); + aCurPath.DirChain() += i_subDirName; + + if (i_bCreateDirectoryIfNecessary) + create_Directory(aCurPath); +} + +void +HtmlEnvironment_Idl::Goto_DirectoryLevelUp() +{ + aCurPosition -= 1; + + aCurPath.SetFile(String::Null_()); + aCurPath.DirChain() -= 1; +} + +void +HtmlEnvironment_Idl::Set_CurFile( const String & i_fileName ) +{ + aCurPath.SetFile(i_fileName); +} + +void +HtmlEnvironment_Idl::create_Directory( const csv::ploc::Path & i_path ) + +{ + csv::ploc::Directory aCurDir(i_path); + if (NOT aCurDir.Exists()) + aCurDir.PhysicalCreate(); +} + +inline bool +IsAbsoluteLink(const char * i_link) +{ + const char + shttp[] = "http://"; + const char + sfile[] = "file://"; + const int + csize = sizeof shttp - 1; + csv_assert(csize == sizeof sfile - 1); + + return strncmp(i_link,shttp,csize) == 0 + OR strncmp(i_link,sfile,csize) == 0; +} + + +const char * +HtmlEnvironment_Idl::Link2Manual( const String & i_link ) const +{ + if ( IsAbsoluteLink(i_link.c_str()) ) + return i_link; + + static StreamStr aLink_(200); + aLink_.reset(); + String + sDvgRoot(pLayout->DevelopersGuideHtmlRoot()); + if (sDvgRoot.empty()) + sDvgRoot = "../DevelopersGuide"; + + // KORR_FUTURE + // Enhance performance by calculating this only one time: + if ( NOT IsAbsoluteLink(sDvgRoot.c_str()) ) + aCurPosition.Get_LinkToRoot(aLink_); + aLink_ << sDvgRoot + << "/" + << i_link; + return aLink_.c_str(); +} + +String +HtmlEnvironment_Idl::CurPageCe_AsText() const +{ + return CurPageCe_AsFile(".html"); +} + +String +HtmlEnvironment_Idl::CurPageCe_AsFile(const char * i_sEnding) const +{ + if (pCurPageCe == 0) + return String::Null_(); + + static StringVector aModule_; + String sCe; + String sDummy; + Data().Get_CeText(aModule_, sCe, sDummy, *pCurPageCe); + StreamLock slCe(500); + if (aModule_.size() > 0) + slCe().operator_join(aModule_.begin(), aModule_.end(), "/"); + if (NOT sCe.empty()) + slCe() << "/" << sCe << i_sEnding; + return String(slCe().c_str()); +} diff --git a/autodoc/source/display/idl/hi_env.hxx b/autodoc/source/display/idl/hi_env.hxx new file mode 100644 index 000000000000..f671d6f46ce6 --- /dev/null +++ b/autodoc/source/display/idl/hi_env.hxx @@ -0,0 +1,161 @@ +/************************************************************************* + * + * 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_HI_ENV_HXX +#define ADC_DISPLAY_HI_ENV_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <cosv/ploc.hxx> +#include <cosv/ploc_dir.hxx> + // PARAMETERS +#include <toolkit/out_position.hxx> + +namespace ary +{ +namespace idl +{ + class Gate; + class CodeEntity; +} +} +namespace display +{ + class CorporateFrame; +} +namespace output +{ + class Tree; +} + +class AryAccess; +class LinkHelper; + +/** @resp + Provides enviroment information to the HTML factory + classes. + + @descr + All information that is not included in the data, especially + about the layout of the output tree and the access to + information from the repository are provided here. + + @see HtmlFactory +*/ +class HtmlEnvironment_Idl +{ + public: + // LIFECYCLE + HtmlEnvironment_Idl( + const csv::ploc::Path & + io_rOutputDir, + const ary::idl::Gate & + i_rGate, + const display::CorporateFrame & + i_rLayout ); + ~HtmlEnvironment_Idl(); + + // OPERATIONS + void Goto_Directory( + output::Position i_pos, + bool i_bCreateDirectoryIfNecessary ); + void Goto_DirectoryLevelDown( + const String & i_subDirName, + bool i_bCreateDirectoryIfNecessary ); + void Goto_DirectoryLevelUp(); + void Set_CurFile( + const String & i_fileName ); + void Set_CurPageCe( + const ary::idl::CodeEntity * + i_ce ) + { pCurPageCe = i_ce; } + // INQUIRY + const ary::idl::Gate & + Gate() const { return *pGate; } + const AryAccess & Data() const { return *pData; } + const char * Link2Manual( + const String & i_link ) const; + + /// This may be reimplemented for removing dead links to members. + bool Is_MemberExistenceCheckRequired() const + { return false; } + + /// @return Holds only the current directory, not the current file. + output::Position & CurPosition() const { return aCurPosition; } + void Get_CurFilePath( + StreamStr & o_buffer ) const + { o_buffer << aCurPath; } + + const display::CorporateFrame & + Layout() const { return *pLayout; } + const LinkHelper & Linker() const { return *pLinker; } + + void Get_LinkTo( + StreamStr & o_result, + output::Position i_destination ) + { CurPosition().Get_LinkTo(o_result, i_destination); } + String CurPageCe_AsText() const; + String CurPageCe_AsFile( + const char * i_sEnding) const; + const ary::idl::CodeEntity * + CurPageCe() const { return pCurPageCe; } + + // ACCESS + output::Tree & OutputTree() { return *pOutputTree; } + + private: + // Local + void create_Directory( + const csv::ploc::Path & + i_path ); + + // DATA + csv::ploc::Directory + aOutputRoot; + csv::ploc::Path aCurPath; + + Dyn<AryAccess> pData; /// @invariant *pData is valid. + const ary::idl::Gate * + pGate; /// @invariant pGate != 0. + Dyn<output::Tree> pOutputTree; /// @invariant *pOutputTree is valid. + mutable output::Position + aCurPosition; + const ary::idl::CodeEntity * + pCurPageCe; + + const display::CorporateFrame * + pLayout; + + Dyn<LinkHelper> pLinker; +}; + + +#endif + + diff --git a/autodoc/source/display/idl/hi_factory.cxx b/autodoc/source/display/idl/hi_factory.cxx new file mode 100644 index 000000000000..78d71bf83525 --- /dev/null +++ b/autodoc/source/display/idl/hi_factory.cxx @@ -0,0 +1,321 @@ +/************************************************************************* + * + * 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 "hi_factory.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_ce.hxx> +#include <toolkit/hf_title.hxx> +#include "hfi_doc.hxx" +#include "hfi_navibar.hxx" +#include "hfi_tag.hxx" +#include "hfi_typetext.hxx" +#include "hi_linkhelper.hxx" + + +extern const String + C_sCellStyle_SummaryLeft("imsum_left"); +extern const String + C_sCellStyle_SummaryRight("imsum_right"); +extern const String + C_sCellStyle_MDetail("imdetail"); +extern const String + C_sMemberTitle("membertitle"); + + +namespace +{ + +const char C_sSpace[92] = " " + " " + " "; +} + + +void +HtmlFactory_Idl::produce_SummaryDeclaration( Xml::Element & o_row, + const client & i_ce ) const +{ + produce_InternalLink(o_row, i_ce); +} + +void +HtmlFactory_Idl::produce_InternalLink( Xml::Element & o_screen, + const client & i_ce ) const +{ + StreamLock aLocalLink(100); + aLocalLink() << "#" << i_ce.LocalName(); + + o_screen + >> *new Html::TableCell + << new Html::ClassAttr( C_sCellStyle_SummaryLeft ) + >> *new Html::Link( aLocalLink().c_str() ) + << i_ce.LocalName(); +} + +void +HtmlFactory_Idl::produce_ShortDoc( Xml::Element & o_screen, + const client & i_ce ) const +{ + Xml::Element & + rDetailsRowCell = o_screen + >> *new Html::TableCell + << new Html::ClassAttr( C_sCellStyle_SummaryRight ); + HF_IdlShortDocu + aLinkDoc(Env(), rDetailsRowCell); + aLinkDoc.Produce_byData( i_ce ); + + rDetailsRowCell << new Xml::XmlCode(" "); +} + +// KORR_FUTURE: Does not belong here (implementation inheritance)! +void +HtmlFactory_Idl::produce_Bases( Xml::Element & o_screen, + const client & i_ce, + const String & i_sLabel ) const +{ + ary::idl::Type_id nBaseT = baseOf(i_ce); + if ( nBaseT.IsValid() ) + { + HF_DocEntryList + aDocList( o_screen ); + aDocList.Produce_Term(i_sLabel); + + int nDepth = 0; + Xml::Element & + rBaseList = aDocList.Produce_Definition() + >> *new Xml::AnElement("pre") + << new Xml::AnAttribute("style","font-family:monospace;"); + rBaseList + >> *new Html::Strong + << i_ce.LocalName(); + rBaseList + << "\n"; + recursive_ShowBases( rBaseList, + nBaseT, + nDepth ); + } +} + +void +HtmlFactory_Idl::produce_Members( ce_list & it_list, + const String & i_summaryTitle, + const String & i_summaryLabel, + const String & i_detailsTitle, + const String & i_detailsLabel, + const E_MemberViewType i_viewType ) const +{ + csv_assert( it_list ); + + Dyn< HF_SubTitleTable > pSummary; + if ( ( i_viewType == viewtype_summary ) + || ( i_viewType == viewtype_complete ) + ) + { + pSummary = new HF_SubTitleTable( + CurOut(), + i_summaryLabel, + i_summaryTitle, + 2 ); + } + + Dyn< HF_SubTitleTable > pDetails; + if ( ( i_viewType == viewtype_details ) + || ( i_viewType == viewtype_complete ) + ) + { + pDetails = new HF_SubTitleTable( + CurOut(), + i_detailsLabel, + i_detailsTitle, + 1 ); + } + + for ( ; it_list.operator bool(); ++it_list ) + { + const ary::idl::CodeEntity & + rCe = Env().Data().Find_Ce(*it_list); + + if ( pSummary ) + { + Xml::Element & + rSummaryRow = pSummary->Add_Row(); + produce_SummaryDeclaration(rSummaryRow, rCe); +// produce_InternalLink(rSummaryRow, rCe); + produce_ShortDoc(rSummaryRow, rCe); + } + + if ( pDetails ) + produce_MemberDetails(*pDetails, rCe); + } +} + +void +HtmlFactory_Idl::produce_Title( HF_TitleTable & o_title, + const String & i_label, + const client & i_ce ) const +{ + StreamLock + slAnnotations(200); + get_Annotations(slAnnotations(), i_ce); + StreamLock + slTitle(200); + slTitle() << i_label << " " << i_ce.LocalName(); + o_title.Produce_Title( slAnnotations().c_str(), + slTitle().c_str() ); +} + +void +HtmlFactory_Idl::get_Annotations( StreamStr & o_out, + const client & i_ce ) const +{ + const ary::doc::OldIdlDocu * + doc = Get_IdlDocu(i_ce.Docu()); + if (doc != 0) + { + if (doc->IsDeprecated()) + o_out << "deprecated "; + if (NOT doc->IsPublished()) + o_out << "unpublished "; + } + + // KORR + // Need to display "unpublished", if there is no docu. +} + +void +HtmlFactory_Idl::write_Docu( Xml::Element & o_screen, + const client & i_ce ) const +{ + const ary::doc::OldIdlDocu * + doc = Get_IdlDocu(i_ce.Docu()); + if (doc != 0) + { + HF_DocEntryList + aDocuList( o_screen ); + HF_IdlDocu + aDocu( Env(), aDocuList ); + aDocu.Produce_fromCodeEntity(i_ce); + } + + write_ManualLinks(o_screen, i_ce); +} + +void +HtmlFactory_Idl::write_ManualLinks( Xml::Element & o_screen, + const client & i_ce ) const +{ + const StringVector & + rLinks2Descrs = i_ce.Secondaries().Links2DescriptionInManual(); + if ( rLinks2Descrs.size() == 0 ) + return; + + o_screen + >> *new Html::Label(C_sLocalManualLinks.c_str()+1) // Leave out the leading '#'. + << " "; + HF_DocEntryList + aDocuList( o_screen ); + aDocuList.Produce_Term("Developers Guide"); + csv_assert(rLinks2Descrs.size() % 2 == 0); + for ( StringVector::const_iterator it = rLinks2Descrs.begin(); + it != rLinks2Descrs.end(); + ++it ) + { + Xml::Element & + rLink = aDocuList.Produce_Definition() >> *new Html::Link( Env().Link2Manual(*it)); + if ( (*(it+1)).empty() ) + // HACK KORR_FUTURE + // Research what happens with manual links which contain normal characters + // in non-utf-8 texts. And research, why utfF-8 does not work here. + rLink << new Xml::XmlCode(*it); + else + rLink << new Xml::XmlCode( *(it+1) ); + ++it; + } // end for +} + +void +HtmlFactory_Idl::produce_MemberDetails( HF_SubTitleTable & , + const client & ) const +{ + // Dummy, which does not need to do anything. +} + +void +HtmlFactory_Idl::recursive_ShowBases( Xml::Element & o_screen, + type_id i_baseType, + int & io_nDepth ) const +{ + // Show this base + ++io_nDepth; + const ary::idl::CodeEntity * + pCe = Env().Linker().Search_CeFromType(i_baseType); + + csv_assert(io_nDepth > 0); + if (io_nDepth > 30) + io_nDepth = 30; + o_screen + << (C_sSpace + 93 - 3*io_nDepth) + << new csi::xml::XmlCode("┗") + << " "; + + if (pCe == 0) + { + HF_IdlTypeText + aText( Env(), o_screen, false ); + aText.Produce_byData( i_baseType ); + o_screen + << "\n"; + --io_nDepth; + return; + } + + HF_IdlTypeText + aBaseLink( Env(), o_screen, true ); + aBaseLink.Produce_byData(pCe->CeId()); + o_screen + << "\n"; + + // Bases + ary::idl::Type_id + nBaseT = baseOf(*pCe); + if (nBaseT.IsValid()) + recursive_ShowBases(o_screen,nBaseT,io_nDepth); + + --io_nDepth; + return; +} + +HtmlFactory_Idl::type_id +HtmlFactory_Idl::inq_BaseOf( const client & ) const +{ + // Unused dummy. + return type_id(0); +} + diff --git a/autodoc/source/display/idl/hi_factory.hxx b/autodoc/source/display/idl/hi_factory.hxx new file mode 100644 index 000000000000..d7a649bbfbb2 --- /dev/null +++ b/autodoc/source/display/idl/hi_factory.hxx @@ -0,0 +1,169 @@ +/************************************************************************* + * + * 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_HI_FACTORY_HXX +#define ADC_DISPLAY_HI_FACTORY_HXX + + +// USED SERVICES + // BASE CLASSES +#include <toolkit/htmlfactory.hxx> + // COMPONENTS + // PARAMETERS +#include <ary/stdconstiter.hxx> +#include <ary/idl/i_types4idl.hxx> +#include <toolkit/out_position.hxx> + + +namespace ary +{ +namespace idl +{ + class Module; +} +namespace doc +{ + class OldIdlDocu; +} +} + + +class HtmlEnvironment_Idl; +class LinkHelper; +class HF_NaviSubRow; +class HF_TitleTable; +class HF_SubTitleTable; + + +class HtmlFactory_Idl : public HtmlFactory<HtmlEnvironment_Idl> +{ + public: + enum E_MemberViewType + { + viewtype_summary, // the summary of the members + viewtype_details, // the details of the members + viewtype_complete // everything + }; + + enum E_DocType + { + doctype_summaryOnly, // only the summary + doctype_complete // the complete documentation + }; + + public: + typedef ary::idl::CodeEntity client; + typedef ary::idl::Ce_id ce_id; + typedef ary::idl::Type_id type_id; + typedef ary::doc::OldIdlDocu ce_info; + + typedef ary::Dyn_StdConstIterator<ce_id> dyn_ce_list; + typedef ary::Dyn_StdConstIterator<type_id> dyn_type_list; + typedef ary::StdConstIterator<ce_id> ce_list; + typedef ary::StdConstIterator<type_id> type_list; + + typedef HtmlEnvironment_Idl Environment; + typedef output::Position OutPosition; + + protected: + HtmlFactory_Idl( + Environment & io_rEnv, + Xml::Element * o_pOut = 0 ) + : HtmlFactory<Environment>(io_rEnv, o_pOut) + { } + virtual ~HtmlFactory_Idl() {} + + /** The default version only calls ->produce_InternalLink(). + This may be overwritten by derived classes. + */ + virtual void produce_SummaryDeclaration( + Xml::Element & o_row, + const client & i_ce ) const; + void produce_InternalLink( + Xml::Element & o_row, + const client & i_ce ) const; + void produce_ShortDoc( + Xml::Element & o_row, + const client & i_ce ) const; + + // KORR_FUTURE: Does not belong here (implementation inheritance)! + void produce_Bases( + Xml::Element & o_screen, + const client & i_ce, + const String & i_sLabel ) const; + void produce_Members( + ce_list & it_list, + const String & i_summaryTitle, + const String & i_summaryLabel, + const String & i_detailsTitle, + const String & i_detailsLabel, + const E_MemberViewType i_viewType = viewtype_complete ) const; + + void produce_Title( + HF_TitleTable & o_title, + const String & i_label, + const client & i_ce ) const; + void get_Annotations( + StreamStr & o_out, + const client & i_ce ) const; + + /// Writes complete docu in standard format. + void write_Docu( + Xml::Element & o_screen, + const client & i_ce ) const; + + void write_ManualLinks( + Xml::Element & o_screen, + const client & i_ce ) const; + private: + // Dummy does nothing + virtual void produce_MemberDetails( + HF_SubTitleTable & o_table, + const client & i_ce ) const; + void recursive_ShowBases( + Xml::Element & o_screen, + type_id i_baseType, + int & io_nDepth ) const; + type_id baseOf( + const client & i_ce ) const + { return inq_BaseOf(i_ce); } + virtual type_id inq_BaseOf( + const client & i_ce ) const; +}; + + +extern const String + C_sCellStyle_SummaryLeft; +extern const String + C_sCellStyle_SummaryRight; +extern const String + C_sCellStyle_MDetail; +extern const String + C_sMemberTitle; + + +#endif diff --git a/autodoc/source/display/idl/hi_linkhelper.cxx b/autodoc/source/display/idl/hi_linkhelper.cxx new file mode 100644 index 000000000000..1e3bff61b50c --- /dev/null +++ b/autodoc/source/display/idl/hi_linkhelper.cxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * 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 "hi_linkhelper.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <ary/idl/i_module.hxx> + + + + +const ary::idl::Module * +LinkHelper::Search_CurModule() const +{ + return Search_Module( rEnv.CurPosition().RelatedNode() ); +} + +const ary::idl::Module * +LinkHelper::Search_Module( output::Node & i_node ) const +{ + static StringVector aNames_; + + output::Node::relative_id + nId = i_node.RelatedNameRoom(); + if (nId == 0) + { + csv::erase_container(aNames_); + i_node.Get_Chain(aNames_); + const ary::idl::Module * pModule = + rEnv.Data().Search_Module(aNames_); + if ( pModule == 0 ) + return 0; + nId = static_cast<output::Node::relative_id>(pModule->Id()); + rEnv.CurPosition().RelatedNode().Set_RelatedNameRoom(nId); + } + + return & rEnv.Data().Find_Module( ary::idl::Ce_id(nId) ); +} + +namespace +{ + const String C_sXrefsSuffix("-xref"); +} + + +LinkHelper::OutPosition +LinkHelper::PositionOf_CurXRefs( const String & i_ceName ) const +{ + StreamLock sl(100); + return OutPosition( rEnv.CurPosition(), + sl() << i_ceName + << C_sXrefsSuffix + << ".html" + << c_str ); +} + +const String & +LinkHelper::XrefsSuffix() const +{ + return C_sXrefsSuffix; +} + + +String +nameChainLinker( const char * ) +{ + static const String + sModuleFileName_( output::ModuleFileName() ); + return sModuleFileName_; +} diff --git a/autodoc/source/display/idl/hi_linkhelper.hxx b/autodoc/source/display/idl/hi_linkhelper.hxx new file mode 100644 index 000000000000..26f50cca2f87 --- /dev/null +++ b/autodoc/source/display/idl/hi_linkhelper.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * 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_HI_LINKHELPER_HXX +#define ADC_DISPLAY_HI_LINKHELPER_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS + // PARAMETERS +#include "hi_ary.hxx" +#include "hi_env.hxx" +#include <toolkit/out_position.hxx> +#include <toolkit/out_tree.hxx> + + +class LinkHelper +{ + public: + typedef ary::idl::CodeEntity CE; + typedef output::Position OutPosition; + + LinkHelper( + HtmlEnvironment_Idl & + io_rEnv ) + : rEnv(io_rEnv) {} + + OutPosition PositionOf_CurModule() const + { return OutPosition( rEnv.CurPosition(), + output::ModuleFileName()); } + + OutPosition PositionOf_CurXRefs( + const String & i_ceName) const; + OutPosition PositionOf_Index() const + { OutPosition ret1 = rEnv.OutputTree().IndexRoot(); + return OutPosition( ret1, String(output::IndexFile_A()) ); } + + + const ary::idl::Module * + Search_CurModule() const; + const ary::idl::Module * + Search_Module( + output::Node & i_node ) const; + + const CE * Search_CeFromType( + ary::idl::Type_id i_type ) const; + + void Get_Link2Position( + StreamStr & o_link, + OutPosition & i_pos ) const + { rEnv.CurPosition().Get_LinkTo(o_link, i_pos); } + + void Get_Link2Member( + StreamStr & o_link, + OutPosition & i_ownerPos, + const String & i_memberName ) const + { Get_Link2Position(o_link, i_ownerPos); + o_link << "#" << i_memberName; } + const String & XrefsSuffix() const; + + private: + // DATA + mutable HtmlEnvironment_Idl & + rEnv; +}; + +inline const ary::idl::CodeEntity * +LinkHelper::Search_CeFromType( ary::idl::Type_id i_type ) const +{ + ary::idl::Ce_id nCe = rEnv.Data().CeFromType(i_type); + if (nCe.IsValid()) + return &rEnv.Data().Find_Ce(nCe); + return 0; +} + + + +String nameChainLinker( + const char * i_levelName ); + + +#endif diff --git a/autodoc/source/display/idl/hi_main.cxx b/autodoc/source/display/idl/hi_main.cxx new file mode 100644 index 000000000000..8a18d4a8564b --- /dev/null +++ b/autodoc/source/display/idl/hi_main.cxx @@ -0,0 +1,764 @@ +/************************************************************************* + * + * 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 "hi_main.hxx" + + +// NOT FULLY DEFINED SERVICES +#include <algorithm> +#include <cosv/ploc.hxx> +#include <cosv/file.hxx> +#include <ary/idl/i_ce.hxx> +#include <ary/idl/ik_ce.hxx> +#include <ary/idl/ik_enum.hxx> +#include <ary/idl/ik_typedef.hxx> +#include <ary/idl/ik_interface.hxx> +#include <ary/idl/ik_struct.hxx> +#include <ary/idl/ik_exception.hxx> +#include <ary/idl/i_constant.hxx> +#include <ary/idl/i_constgroup.hxx> +#include <ary/idl/i_enum.hxx> +#include <ary/idl/i_singleton.hxx> +#include <ary/idl/i_sisingleton.hxx> +#include <ary/idl/i_exception.hxx> +#include <ary/idl/i_interface.hxx> +#include <ary/idl/i_service.hxx> +#include <ary/idl/i_siservice.hxx> +#include <ary/idl/i_struct.hxx> +#include <ary/idl/i_typedef.hxx> +#include <ary/idl/i_module.hxx> +#include <cfrstd.hxx> +#include <toolkit/htmlfile.hxx> +#include <toolkit/out_position.hxx> +#include <toolkit/out_tree.hxx> +#include "hfi_constgroup.hxx" +#include "hfi_enum.hxx" +#include "hfi_globalindex.hxx" +#include "hfi_interface.hxx" +#include "hfi_module.hxx" +#include "hfi_struct.hxx" +#include "hfi_service.hxx" +#include "hfi_singleton.hxx" +#include "hfi_siservice.hxx" +#include "hfi_typedef.hxx" +#include "hfi_xrefpage.hxx" +#include "hi_env.hxx" +#include "hi_linkhelper.hxx" + + +using ::ary::idl::Ce_id; +using ::ary::idl::Type_id; +using ::ary::idl::ifc_ce::Dyn_CeIterator; + + + +extern const String C_sCssFilename_Idl("idl.css"); + +/* +typedef ::ary::Dyn_StdConstIterator< ::ary::idl::CommentedRelation> + Dyn_ComRefIterator; +namespace read_module = ::ary::idl::ifc_module; +namespace read_interface = ::ary::idl::ifc_interface; +namespace read_service = ::ary::idl::ifc_service; +namespace read_struct = ::ary::idl::ifc_struct; +namespace read_exception = ::ary::idl::ifc_exception; +namespace read_enum = ::ary::idl::ifc_enum; +namespace read_typedef = ::ary::idl::ifc_typedef; +namespace read_constgroup = ::ary::idl::ifc_constantsgroup; +*/ + +namespace +{ + +/** @resp + Inits (constructor) and creates (destructor) the current + html documentation file ( MainDisplay_Idl.pMyFile ). +*/ +class Guard_CurFile +{ + public: + Guard_CurFile( /// For CodeEntities + DocuFile_Html & io_client, + HtmlEnvironment_Idl & + io_env, + const ary::idl::CodeEntity & + i_ce, + const String & i_titlePrefix ); + Guard_CurFile( /// For Use pages + DocuFile_Html & io_client, + HtmlEnvironment_Idl & + io_env, + const String & i_fileName, + const String & i_titlePrefix ); + Guard_CurFile( /// For Modules + DocuFile_Html & io_client, + HtmlEnvironment_Idl & + io_env, + const ary::idl::CodeEntity & + i_ce ); + Guard_CurFile( /// For Indices + DocuFile_Html & io_client, + HtmlEnvironment_Idl & + io_env, + char i_letter ); + ~Guard_CurFile(); + private: + DocuFile_Html & rClient; + HtmlEnvironment_Idl & + rEnv; + +}; + +/** @resp + Sets and releases the current factory pointer + ( MainDisplay_Idl.pCurFactory ). +*/ +class Guard_CurFactoryPtr +{ + public: + Guard_CurFactoryPtr( + HtmlFactory_Idl *& io_client, + HtmlFactory_Idl & i_factory ) + : rpClient(io_client) + { rpClient = &i_factory; } + + ~Guard_CurFactoryPtr() + { rpClient = 0; } + + private: + HtmlFactory_Idl *& rpClient; + +}; + + +Guard_CurFile::Guard_CurFile( DocuFile_Html & io_client, + HtmlEnvironment_Idl & io_env, + const ary::idl::CodeEntity & i_ce, + const String & i_titlePrefix ) + : rClient(io_client), + rEnv(io_env) +{ // For Ces + StreamLock sl(300); + io_env.Set_CurFile( sl() << i_ce.LocalName() + << ".html" + << c_str ); + StreamLock aCurFilePath(700); + io_env.Get_CurFilePath(aCurFilePath()); + + rClient.EmptyBody(); + csv::ploc::Path + aLocation(aCurFilePath().c_str()); + rClient.SetLocation(aLocation); + sl().reset(); + rClient.SetTitle( sl() << i_titlePrefix + << " " + << i_ce.LocalName() + << c_str ); + sl().reset(); + rClient.SetRelativeCssPath( + sl() << io_env.CurPosition().LinkToRoot() + << C_sCssFilename_Idl + << c_str ); + + io_env.Set_CurPageCe(&i_ce); +} + +Guard_CurFile::Guard_CurFile( DocuFile_Html & io_client, + HtmlEnvironment_Idl & io_env, + const String & i_fileName, + const String & i_titlePrefix ) + : rClient(io_client), + rEnv(io_env) +{ // For Use pages + StreamLock sl(300); + io_env.Set_CurFile( sl() << i_fileName + << ".html" + << c_str ); + StreamLock aCurFilePath(700); + io_env.Get_CurFilePath(aCurFilePath()); + csv::ploc::Path + aLocation(aCurFilePath().c_str()); + + rClient.EmptyBody(); + rClient.SetLocation(aLocation); + sl().reset(); + rClient.SetTitle( sl() << i_titlePrefix << " " << i_fileName << c_str ); + sl().reset(); + rClient.SetRelativeCssPath( + sl() << io_env.CurPosition().LinkToRoot() + << C_sCssFilename_Idl + << c_str ); + + io_env.Set_CurPageCe(0); +} + +Guard_CurFile::Guard_CurFile( DocuFile_Html & io_client, + HtmlEnvironment_Idl & io_env, + const ary::idl::CodeEntity & i_ce ) + : rClient(io_client), + rEnv(io_env) +{ // For Modules + io_env.Set_CurFile( output::ModuleFileName() ); + StreamLock aCurFilePath(700); + io_env.Get_CurFilePath(aCurFilePath()); + csv::ploc::Path + aLocation(aCurFilePath().c_str()); + + rClient.EmptyBody(); + rClient.SetLocation(aLocation); + StreamLock sl(300); + rClient.SetTitle( sl() << "Module " << io_env.CurPosition().Name() << c_str ); + sl().reset(); + rClient.SetRelativeCssPath( + sl() << io_env.CurPosition().LinkToRoot() + << C_sCssFilename_Idl + << c_str ); + + io_env.Set_CurPageCe(&i_ce); +} + +Guard_CurFile::Guard_CurFile( DocuFile_Html & io_client, + HtmlEnvironment_Idl & io_env, + char i_letter ) + : rClient(io_client), + rEnv(io_env) +{ // For Index pages + StreamLock sl(300); + io_env.Set_CurFile( sl() << "index-" + << ( i_letter != '_' + ? int(i_letter)-'a'+1 + : 27 ) + << ".html" + << c_str ); + StreamLock aCurFilePath(700); + io_env.Get_CurFilePath(aCurFilePath()); + csv::ploc::Path + aLocation(aCurFilePath().c_str()); + + rClient.EmptyBody(); + rClient.SetLocation(aLocation); + sl().reset(); + rClient.SetTitle( sl() << "Global Index " + << ( i_letter != '_' + ? char(i_letter-'a'+'A') + : '_' ) + << c_str ); + sl().reset(); + rClient.SetRelativeCssPath( + sl() << "../" + << C_sCssFilename_Idl + << c_str ); +} + +Guard_CurFile::~Guard_CurFile() +{ + rClient.CreateFile(); + rEnv.Set_CurPageCe(0); +} + + +} // anonymous namespace + + + + +MainDisplay_Idl::MainDisplay_Idl( HtmlEnvironment_Idl & io_rEnv ) + : pEnv(&io_rEnv), + pMyFile(new DocuFile_Html), + pCurFactory(0) +{ +// pMyFile->SetStyle( Env().Layout().CssStyle() ); + pMyFile->SetCopyright( Env().Layout().CopyrightText() ); +} + +MainDisplay_Idl::~MainDisplay_Idl() +{ +} + + +void +MainDisplay_Idl::WriteGlobalIndices() +{ + for ( const char * pLetter = "abcdefghijklmnopqrstuvwxyz_X"; *pLetter != 'X'; ++pLetter ) + { + Guard_CurFile gFile( *pMyFile, Env(), *pLetter ); + + HF_IdlGlobalIndex aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_Page( ary::idl::alphabetical_index::E_Letter(*pLetter) ); + } // end for +} + + +void +MainDisplay_Idl::do_Process( const ary::idl::Module & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce ); + HF_IdlModule aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::Interface & i_ce ) +{ + do_InterfaceDescr(i_ce); + do_Interface2s(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::Service & i_ce ) +{ + do_ServiceDescr(i_ce); + do_Service2s(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::SglIfcService & i_ce ) +{ + do_SglIfcServiceDescr(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::Struct & i_ce ) +{ + do_StructDescr(i_ce); + do_Struct2s(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::Exception & i_ce ) +{ + do_ExceptionDescr(i_ce); + do_Exception2s(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::Enum & i_ce ) +{ + do_EnumDescr(i_ce); + do_Enum2s(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::Typedef & i_ce ) +{ + do_TypedefDescr(i_ce); + do_Typedef2s(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::ConstantsGroup & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Constants' Group" ); + HF_IdlConstGroup aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::Singleton & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Singleton" ); + HF_IdlSingleton aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData_ServiceBased(i_ce); +} + +void +MainDisplay_Idl::do_Process( const ary::idl::SglIfcSingleton & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Singleton" ); + HF_IdlSingleton aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData_InterfaceBased(i_ce); +} + +void +MainDisplay_Idl::do_InterfaceDescr( const ary::idl::CodeEntity & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Interface" ); + HF_IdlInterface aInterface( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aInterface); + + aInterface.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_ServiceDescr( const ary::idl::CodeEntity & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Service" ); + HF_IdlService aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_SglIfcServiceDescr( const ary::idl::CodeEntity & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Service" ); + HF_IdlSglIfcService aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_StructDescr( const ary::idl::CodeEntity & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Struct" ); + HF_IdlStruct aFactory( *pEnv, pMyFile->Body(), false ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_ExceptionDescr( const ary::idl::CodeEntity & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Exception" ); + HF_IdlStruct aFactory( *pEnv, pMyFile->Body(), true ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_EnumDescr( const ary::idl::CodeEntity & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Enum" ); + HF_IdlEnum aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_TypedefDescr( const ary::idl::CodeEntity & i_ce ) +{ + Guard_CurFile gFile( *pMyFile, + Env(), + i_ce, + "Typedef" ); + HF_IdlTypedef aFactory( *pEnv, pMyFile->Body() ); + Guard_CurFactoryPtr gFactory(pCurFactory,aFactory); + + aFactory.Produce_byData(i_ce); +} + +void +MainDisplay_Idl::do_Interface2s( const ary::idl::CodeEntity & i_ce ) +{ + StreamLock sl(100); + String sUsesFileName( + sl() + << i_ce.LocalName() + << Env().Linker().XrefsSuffix() + << c_str ); + Guard_CurFile gFile( *pMyFile, + Env(), + sUsesFileName, + "Uses of Interface" ); + HF_IdlXrefs aUses( *pEnv, + pMyFile->Body(), + C_sCePrefix_Interface, + i_ce ); + + + aUses.Produce_Tree( + "Derived Interfaces", + "#Deriveds", + i_ce, + &ary::idl::ifc_interface::xref::Get_Derivations ); + + Dyn_CeIterator pXrefList; + + ary::idl::ifc_interface::xref::Get_SynonymTypedefs(pXrefList,i_ce); + aUses.Produce_List( + "Synonym Typedefs", + "#Synonyms", + *pXrefList ); + ary::idl::ifc_interface::xref::Get_ExportingServices(pXrefList,i_ce); + aUses.Produce_List( + "Services which Support this Interface", + "#SupportingServices", + *pXrefList ); + ary::idl::ifc_interface::xref::Get_ExportingSingletons(pXrefList,i_ce); + aUses.Produce_List( + "Singletons which Support this Interface", + "#SupportingSingletons", + *pXrefList ); + ary::idl::ifc_interface::xref::Get_AsReturns(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Return Type", + "#Returns", + *pXrefList ); + ary::idl::ifc_interface::xref::Get_AsParameters(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Parameter", + "#Parameters", + *pXrefList ); + ary::idl::ifc_interface::xref::Get_AsDataTypes(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Data Type", + "#DataTypes", + *pXrefList ); + aUses.Write_ManualLinks(i_ce); +} + +void +MainDisplay_Idl::do_Service2s( const ary::idl::CodeEntity & i_ce ) +{ + StreamLock sl(100); + String sUsesFileName( + sl() + << i_ce.LocalName() + << Env().Linker().XrefsSuffix() + << c_str ); + Guard_CurFile gFile( *pMyFile, + Env(), + sUsesFileName, + "Uses of Service" ); + HF_IdlXrefs aUses( *pEnv, + pMyFile->Body(), + C_sCePrefix_Service, + i_ce ); + Dyn_CeIterator pXrefList; + ary::idl::ifc_service::xref::Get_IncludingServices(pXrefList,i_ce); + aUses.Produce_List( + "Services which Include this Service", + "#IncludingServices", + *pXrefList ); + + ary::idl::ifc_service::xref::Get_InstantiatingSingletons(pXrefList,i_ce); + aUses.Produce_List( + "Singletons which Instantiate this Service", + "#Singletons", + *pXrefList ); + aUses.Write_ManualLinks(i_ce); +} + +void +MainDisplay_Idl::do_Struct2s( const ary::idl::CodeEntity & i_ce ) +{ + StreamLock sl(100); + String sUsesFileName( + sl() + << i_ce.LocalName() + << Env().Linker().XrefsSuffix() + << c_str ); + Guard_CurFile gFile( *pMyFile, + Env(), + sUsesFileName, + "Uses of Struct" ); + HF_IdlXrefs aUses( *pEnv, + pMyFile->Body(), + C_sCePrefix_Struct, + i_ce ); + + aUses.Produce_Tree( + "Derived Structs", + "#Deriveds", + i_ce, + &ary::idl::ifc_struct::xref::Get_Derivations ); + + Dyn_CeIterator pXrefList; + + ary::idl::ifc_struct::xref::Get_SynonymTypedefs(pXrefList,i_ce); + aUses.Produce_List( + "Synonym Typedefs", + "#Synonyms", + *pXrefList ); + ary::idl::ifc_struct::xref::Get_AsReturns(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Return Type", + "#Returns", + *pXrefList ); + ary::idl::ifc_struct::xref::Get_AsParameters(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Parameter", + "#Parameters", + *pXrefList ); + ary::idl::ifc_struct::xref::Get_AsDataTypes(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Data Type", + "#DataTypes", + *pXrefList ); + aUses.Write_ManualLinks(i_ce); +} + +void +MainDisplay_Idl::do_Exception2s( const ary::idl::CodeEntity & i_ce ) +{ + StreamLock sl(100); + String sUsesFileName( + sl() + << i_ce.LocalName() + << Env().Linker().XrefsSuffix() + << c_str ); + Guard_CurFile gFile( *pMyFile, + Env(), + sUsesFileName, + "Uses of Exception" ); + HF_IdlXrefs aUses( *pEnv, + pMyFile->Body(), + C_sCePrefix_Exception, + i_ce ); + + aUses.Produce_Tree( + "Derived Exceptions", + "#Deriveds", + i_ce, + &ary::idl::ifc_exception::xref::Get_Derivations ); + + Dyn_CeIterator pXrefList; + + ary::idl::ifc_exception::xref::Get_RaisingFunctions(pXrefList,i_ce); + aUses.Produce_List( + "Raising Functions", + "#Raisers", + *pXrefList ); + aUses.Write_ManualLinks(i_ce); +} + +void +MainDisplay_Idl::do_Enum2s( const ary::idl::CodeEntity & i_ce ) +{ + StreamLock sl(100); + String sUsesFileName( + sl() + << i_ce.LocalName() + << Env().Linker().XrefsSuffix() + << c_str ); + Guard_CurFile gFile( *pMyFile, + Env(), + sUsesFileName, + "Uses of Enum" ); + HF_IdlXrefs aUses( *pEnv, + pMyFile->Body(), + C_sCePrefix_Enum, + i_ce ); + Dyn_CeIterator pXrefList; + ary::idl::ifc_enum::xref::Get_SynonymTypedefs(pXrefList,i_ce); + aUses.Produce_List( + "Synonym Typedefs", + "#Synonyms", + *pXrefList ); + ary::idl::ifc_enum::xref::Get_AsReturns(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Return Type", + "#Returns", + *pXrefList ); + ary::idl::ifc_enum::xref::Get_AsParameters(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Parameter", + "#Parameters", + *pXrefList ); + ary::idl::ifc_enum::xref::Get_AsDataTypes(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Data Type", + "#DataTypes", + *pXrefList ); + aUses.Write_ManualLinks(i_ce); +} + +void +MainDisplay_Idl::do_Typedef2s( const ary::idl::CodeEntity & i_ce ) +{ + StreamLock sl(100); + String sUsesFileName( + sl() << i_ce.LocalName() + << Env().Linker().XrefsSuffix() + << c_str ); + Guard_CurFile gFile( *pMyFile, + Env(), + sUsesFileName, + "Uses of Typedef" ); + HF_IdlXrefs aUses( *pEnv, + pMyFile->Body(), + C_sCePrefix_Typedef, + i_ce ); + Dyn_CeIterator pXrefList; + ary::idl::ifc_typedef::xref::Get_SynonymTypedefs(pXrefList,i_ce); + aUses.Produce_List( + "Synonym Typedefs", + "#Synonyms", + *pXrefList ); + ary::idl::ifc_typedef::xref::Get_AsReturns(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Return Type", + "#Returns", + *pXrefList ); + ary::idl::ifc_typedef::xref::Get_AsParameters(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Parameter", + "#Parameters", + *pXrefList ); + ary::idl::ifc_typedef::xref::Get_AsDataTypes(pXrefList,i_ce); + aUses.Produce_List( + "Uses as Data Type", + "#DataTypes", + *pXrefList ); + aUses.Write_ManualLinks(i_ce); +} + diff --git a/autodoc/source/display/idl/hi_main.hxx b/autodoc/source/display/idl/hi_main.hxx new file mode 100644 index 000000000000..57b345a98df7 --- /dev/null +++ b/autodoc/source/display/idl/hi_main.hxx @@ -0,0 +1,178 @@ +/************************************************************************* + * + * 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_HFIDMAIN_HXX +#define ADC_DISPLAY_HFIDMAIN_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <cosv/tpl/processor.hxx> + // COMPONENTS +#include "hi_factory.hxx" + // PARAMETERS + + +class HtmlEnvironment_Idl; +class HtmlFactory_Idl; +class DocuFile_Html; + +namespace ary +{ +namespace idl +{ + + class Module; + class Service; + class SglIfcService; + class Interface; + class Struct; + class Exception; + class Enum; + class Typedef; + class ConstantsGroup; + class Singleton; + class SglIfcSingleton; + +} // namespace idl +} // namespace ary + + +class MainDisplay_Idl : public csv::ProcessorIfc, + public csv::ConstProcessor<ary::idl::Module>, + public csv::ConstProcessor<ary::idl::Service>, + public csv::ConstProcessor<ary::idl::SglIfcService>, + public csv::ConstProcessor<ary::idl::Interface>, + public csv::ConstProcessor<ary::idl::Struct>, + public csv::ConstProcessor<ary::idl::Exception>, + public csv::ConstProcessor<ary::idl::Enum>, + public csv::ConstProcessor<ary::idl::Typedef>, + public csv::ConstProcessor<ary::idl::ConstantsGroup>, + public csv::ConstProcessor<ary::idl::Singleton>, + public csv::ConstProcessor<ary::idl::SglIfcSingleton> +{ + public: + MainDisplay_Idl( + HtmlEnvironment_Idl & + io_rEnv ); + virtual ~MainDisplay_Idl(); + + void WriteGlobalIndices(); + + void Display_NamedEntityHierarchy(); + + private: + // Interface csv::ProcessorIfc: + virtual void do_Process( + const ary::idl::Module & i_client ); + virtual void do_Process( + const ary::idl::Service & i_client ); + virtual void do_Process( + const ary::idl::SglIfcService & + i_client ); + virtual void do_Process( + const ary::idl::Interface & i_client ); + virtual void do_Process( + const ary::idl::Struct & i_client ); + virtual void do_Process( + const ary::idl::Exception & i_client ); + virtual void do_Process( + const ary::idl::Enum & i_client ); + virtual void do_Process( + const ary::idl::Typedef & i_client ); + virtual void do_Process( + const ary::idl::ConstantsGroup & + i_client ); + virtual void do_Process( + const ary::idl::Singleton & i_client ); + virtual void do_Process( + const ary::idl::SglIfcSingleton & + i_client ); + // Locals + void do_ServiceDescr( + const ary::idl::CodeEntity & + i_rData ); + void do_SglIfcServiceDescr( + const ary::idl::CodeEntity & + i_rData ); + void do_InterfaceDescr( + const ary::idl::CodeEntity & + i_rData ); + void do_StructDescr( + const ary::idl::CodeEntity & + i_rData ); + void do_ExceptionDescr( + const ary::idl::CodeEntity & + i_rData ); + void do_EnumDescr( + const ary::idl::CodeEntity & + i_rData ); + void do_TypedefDescr( + const ary::idl::CodeEntity & + i_rData ); + void do_SingletonDescr( + const ary::idl::CodeEntity & + i_rData ); + void do_Service2s( + const ary::idl::CodeEntity & + i_rData ); + void do_Interface2s( + const ary::idl::CodeEntity & + i_rData ); + void do_Struct2s( + const ary::idl::CodeEntity & + i_rData ); + void do_Exception2s( + const ary::idl::CodeEntity & + i_rData ); + void do_Enum2s( + const ary::idl::CodeEntity & + i_rData ); + void do_Typedef2s( + const ary::idl::CodeEntity & + i_rData ); + void do_Singleton2s( + const ary::idl::CodeEntity & + i_rData ); + + const HtmlEnvironment_Idl & + Env() const { return *pEnv; } + HtmlEnvironment_Idl & + Env() { return *pEnv; } + Xml::Element & CurHtmlOut() { return pCurFactory->CurOut(); } + + // DATA + HtmlEnvironment_Idl * + pEnv; + Dyn<DocuFile_Html> pMyFile; + HtmlFactory_Idl * pCurFactory; +}; + + + +#endif diff --git a/autodoc/source/display/idl/makefile.mk b/autodoc/source/display/idl/makefile.mk new file mode 100644 index 000000000000..383983a1fb22 --- /dev/null +++ b/autodoc/source/display/idl/makefile.mk @@ -0,0 +1,77 @@ +#************************************************************************* +# +# 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_idl + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/hfi_constgroup.obj \ + $(OBJ)$/hfi_doc.obj \ + $(OBJ)$/hfi_enum.obj \ + $(OBJ)$/hfi_globalindex.obj \ + $(OBJ)$/hfi_hierarchy.obj \ + $(OBJ)$/hfi_interface.obj \ + $(OBJ)$/hfi_method.obj \ + $(OBJ)$/hfi_module.obj \ + $(OBJ)$/hfi_navibar.obj \ + $(OBJ)$/hfi_property.obj \ + $(OBJ)$/hfi_service.obj \ + $(OBJ)$/hfi_singleton.obj \ + $(OBJ)$/hfi_siservice.obj \ + $(OBJ)$/hfi_struct.obj \ + $(OBJ)$/hfi_tag.obj \ + $(OBJ)$/hfi_typedef.obj \ + $(OBJ)$/hfi_typetext.obj \ + $(OBJ)$/hfi_xrefpage.obj \ + $(OBJ)$/hi_ary.obj \ + $(OBJ)$/hi_display.obj \ + $(OBJ)$/hi_env.obj \ + $(OBJ)$/hi_factory.obj \ + $(OBJ)$/hi_linkhelper.obj \ + $(OBJ)$/hi_main.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/display/inc/cfrstd.hxx b/autodoc/source/display/inc/cfrstd.hxx new file mode 100644 index 000000000000..5545fe854596 --- /dev/null +++ b/autodoc/source/display/inc/cfrstd.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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_CFRSTD_HXX +#define ADC_CFRSTD_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <display/corframe.hxx> + // COMPONENTS + // PARAMETERS + + + +class StdFrame : public display::CorporateFrame +{ + public: + // LIFECYCLE + StdFrame(); + + // INQUIRY + virtual DYN Html_Image * + LogoSrc() const; + virtual const char * + LogoLink() const; + virtual const char * + CopyrightText() const; + virtual const char * + CssStyle() const; + virtual const char * + CssStylesExplanation() const; + virtual const char * + DevelopersGuideHtmlRoot() const; + virtual bool SimpleLinks() const; + + // ACCESS + virtual void Set_DevelopersGuideHtmlRoot( + const String & i_directory ); + virtual void Set_SimpleLinks(); + + private: + String sDevelopersGuideHtmlRoot; + bool bSimpleLinks; +}; + + + +// IMPLEMENTATION + + + + +#endif + diff --git a/autodoc/source/display/inc/html/chd_udk2.hxx b/autodoc/source/display/inc/html/chd_udk2.hxx new file mode 100644 index 000000000000..2177f22a90b6 --- /dev/null +++ b/autodoc/source/display/inc/html/chd_udk2.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * 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_CHD_UDK2_HXX +#define ADC_DISPLAY_HTML_CHD_UDK2_HXX + +// BASE CLASSES +#include <autodoc/dsp_html_std.hxx> +// USED SERVICES +#include <cosv/ploc.hxx> + +namespace ary +{ +namespace cpp +{ + class Namespace; + class Gate; +} +} + +class OuputPage_Environment; + + + + +class CppHtmlDisplay_Udk2 : public autodoc::HtmlDisplay_UdkStd +{ + public: + CppHtmlDisplay_Udk2(); + ~CppHtmlDisplay_Udk2(); + private: + // Interface CppHtmlDisplay_UdkStd: + virtual void do_Run( + const char * i_sOutputDirectory, + const ary::cpp::Gate & + i_rAryGate, + const display::CorporateFrame & + i_rLayout ); + + // Local + void SetRunData( + const char * i_sOutputDirectory, + const ary::cpp::Gate & + i_rAryGate, + const display::CorporateFrame & + i_rLayout ); + + void Create_Css_File(); + void Create_Overview_File(); + void Create_Help_File(); + void Create_AllDefs_File(); + void CreateFiles_InSubTree_Namespaces(); + void CreateFiles_InSubTree_Index(); + + void RecursiveDisplay_Namespace( + const ary::cpp::Namespace & + i_rNsp ); + void DisplayFiles_InNamespace( + const ary::cpp::Namespace & + i_rNsp ); + const ary::cpp::Gate & + Gate() const; + // DATA + Dyn<OuputPage_Environment> + pCurPageEnv; +}; + + + + +#endif diff --git a/autodoc/source/display/inc/idl/hi_display.hxx b/autodoc/source/display/inc/idl/hi_display.hxx new file mode 100644 index 000000000000..53650a8ce5a8 --- /dev/null +++ b/autodoc/source/display/inc/idl/hi_display.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * 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_HI_DISPLAY_HXX +#define ADC_DISPLAY_HI_DISPLAY_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <autodoc/dsp_html_std.hxx> + // COMPONENTS +#include <cosv/ploc.hxx> + // PARAMETERS + + + +namespace ary +{ + namespace idl + { + class Module; + class CodeEntity; + } // namspace idl +} // namspace csi + + +class MainDisplay_Idl; +class HtmlEnvironment_Idl; + +class HtmlDisplay_Idl : public autodoc::HtmlDisplay_Idl_Ifc +{ + public: + HtmlDisplay_Idl(); + ~HtmlDisplay_Idl(); + private: + // Interface HtmlDisplay_Idl_Ifc: + virtual void do_Run( + const char * i_sOutputDirectory, + const ary::idl::Gate & + i_rAryGate, + const display::CorporateFrame & + i_rLayout ); + void SetRunData( + const char * i_sOutputDirectory, + const ary::idl::Gate & + i_rAryGate, + const display::CorporateFrame & + i_rLayout ); + void Create_StartFile(); + void Create_FilesInNameTree(); + void Create_IndexFiles(); + void Create_FilesInProjectTree(); + void Create_PackageList(); + void Create_HelpFile(); + void Create_CssFile(); + + /** @descr + - makes sure, the module's directory exists + - creates the module's docu file + - creates docu files for all members of the module + - does the same recursive for all sub-modules. + */ + void RecursiveDisplay_Module( + const ary::idl::Module & + i_rNamespace ); + bool IsModule( + const ary::idl::CodeEntity & + i_ce ) const; + const ary::idl::Module & + Module_Cast( /// @precond Cast must be valid. + const ary::idl::CodeEntity & + i_ce ) const; + // DATA + Dyn<HtmlEnvironment_Idl> + pCurPageEnv; + Dyn<MainDisplay_Idl> + pMainDisplay; +}; + + + +// IMPLEMENTATION + + +#endif + diff --git a/autodoc/source/display/inc/toolkit/hf_docentry.hxx b/autodoc/source/display/inc/toolkit/hf_docentry.hxx new file mode 100644 index 000000000000..83e447c615fa --- /dev/null +++ b/autodoc/source/display/inc/toolkit/hf_docentry.hxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * 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_HF_DOCENTRY_HXX +#define ADC_DISPLAY_HF_DOCENTRY_HXX + + + +// USED SERVICES + // BASE CLASSES +#include "htmlfactory.hxx" + // COMPONENTS + // PARAMETERS + +/** @resp + Produces a list of <DT>..</DT> and <DD>. +*/ +class HF_DocEntryList : public HtmlMaker +{ + public: + + HF_DocEntryList( + Xml::Element & o_rOut ); + virtual ~HF_DocEntryList(); + + Xml::Element & Produce_Term( + const char * i_sTerm = 0 ); + Xml::Element & Produce_NormalTerm( /// Font will not be bold. + const char * i_sTerm = 0 ); + Xml::Element & Produce_Definition(); +}; + + + +#endif diff --git a/autodoc/source/display/inc/toolkit/hf_funcdecl.hxx b/autodoc/source/display/inc/toolkit/hf_funcdecl.hxx new file mode 100644 index 000000000000..1b943dde3e19 --- /dev/null +++ b/autodoc/source/display/inc/toolkit/hf_funcdecl.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * 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_HF_FUNCDECL_HXX +#define ADC_DISPLAY_HF_FUNCDECL_HXX + + +// USED SERVICES + // BASE CLASSES +#include <toolkit/htmlfactory.hxx> + // COMPONENTS + // PARAMETERS + + +#if 0 // old +/** @resp + Provides three cells to put in a function declaration. +*/ +class HF_FunctionDeclaration : public HtmlMaker +{ + public: + HF_FunctionDeclaration( + Xml::Element & o_rParent ); + virtual ~HF_FunctionDeclaration(); + + /// Inserts empty line in 2nd and 3rd cell and returns first. + Xml::Element & Add_ReturnLine(); + + /** Inserts empty line in 1st cell, "raises (" in 2nd + and returns 3rd. + */ + Xml::Element & Add_RaisesLine( + const char * i_sRaisesText, + bool i_bSuppressExtraLine = false ); + + Xml::Element & Front() { return *pFront; } + Xml::Element & Types() { return *pTypes; } + Xml::Element & Names() { return *pNames; } + + private: + Xml::Element * pFront; + Xml::Element * pTypes; + Xml::Element * pNames; +}; +#endif // 0 old + +class HF_FunctionDeclaration : public HtmlMaker +{ + public: + HF_FunctionDeclaration( + Xml::Element & o_rParent, + const String & i_sRaisesText ); + virtual ~HF_FunctionDeclaration(); + + // OPERATIONS + Xml::Element & ReturnCell(); + Xml::Element & NameCell(); + Xml::Element & NewParamTypeCell(); + Xml::Element & ParamNameCell(); + Xml::Element & ExceptionCell(); + + private: + Html::TableRow & ParameterLine(); + + // DATA + String sRaisesText; + Html::Table * pTable; + Xml::Element * pReturnCell; + Xml::Element * pNameCell; + Html::TableRow * pParameterLine; + Xml::Element * pLastParameterCell; + Xml::Element * pExceptionCell; +}; + + +// IMPLEMENTATION + + + +#endif diff --git a/autodoc/source/display/inc/toolkit/hf_linachain.hxx b/autodoc/source/display/inc/toolkit/hf_linachain.hxx new file mode 100644 index 000000000000..fa780dbc778c --- /dev/null +++ b/autodoc/source/display/inc/toolkit/hf_linachain.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * 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_HF_LINACHAIN_HXX +#define ADC_DISPLAY_HF_LINACHAIN_HXX + +// BASE CLASSES +#include "htmlfactory.hxx" +#include "out_position.hxx" + + + + +class HF_LinkedNameChain : public HtmlMaker +{ + public: + /** F_LinkMaker makes a link out of the name of the + parent position. + + Returns true, if there is a link, false if not. + */ + typedef String (*F_LinkMaker)(const char *); + + + HF_LinkedNameChain( + Xml::Element & o_rOut ); + virtual ~HF_LinkedNameChain(); + + void Produce_CompleteChain( + const output::Position & + i_curPosition, + F_LinkMaker i_linkMaker ) const; + void Produce_CompleteChain_forModule( + const output::Position & + i_curPosition, /// current Module's node + F_LinkMaker i_linkMaker ) const; + private: + void produce_Level( + output::Node & i_levelNode, + const output::Position & + i_startPosition, + F_LinkMaker i_linkMaker ) const; +}; + + + + +#endif diff --git a/autodoc/source/display/inc/toolkit/hf_navi_main.hxx b/autodoc/source/display/inc/toolkit/hf_navi_main.hxx new file mode 100644 index 000000000000..da4167d64dbe --- /dev/null +++ b/autodoc/source/display/inc/toolkit/hf_navi_main.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * 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_HF_NAVI_MAIN_HXX +#define ADC_DISPLAY_HF_NAVI_MAIN_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include "htmlfactory.hxx" + // PARAMETERS + + +class HF_MainItem; + + +/** @task + Create a HTML navigation bar with lightly coloured background. + + @descr + There are three kinds of items: + Item with link: Add_StdItem(), + Item without link: Add_NoneItem(), + Item that is current page: Add_SelfItem(). +*/ +class HF_NaviMainRow : public HtmlMaker +{ + public: + enum E_Style + { + eStd, + eSelf, + eNo + }; + HF_NaviMainRow( + Xml::Element & o_out ); + ~HF_NaviMainRow(); + + void Add_StdItem( + const char * i_sText, + const char * i_sLink ); + void Add_SelfItem( + const char * i_sText ); + void Add_NoneItem( + const char * i_sText ); + + void Produce_Row(); + + private: + // DATA + typedef std::vector< DYN HF_MainItem* > ItemList; + + ItemList aItems; + Xml::Element * pRow; +}; + + + +// IMPLEMENTATION + + + + +#endif + + diff --git a/autodoc/source/display/inc/toolkit/hf_navi_sub.hxx b/autodoc/source/display/inc/toolkit/hf_navi_sub.hxx new file mode 100644 index 000000000000..6d24a40eb530 --- /dev/null +++ b/autodoc/source/display/inc/toolkit/hf_navi_sub.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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_HF_NAVI_SUB_HXX +#define ADC_DISPLAY_HFI_NAVI_SUB_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include "htmlfactory.hxx" + // PARAMETERS + + +class HF_NaviSubRow : public HtmlMaker +{ + public: + HF_NaviSubRow( + Xml::Element & o_rOut ); + virtual ~HF_NaviSubRow(); + + void AddItem( + const String & i_sText, + const String & i_sLink, + bool i_bSwitchOn ); + void SwitchOn( + int i_nIndex ); + void Produce_Row(); + + private: + typedef std::pair<String,String> SubRow_Data; + typedef std::pair<SubRow_Data,bool> SubRow_Item; + typedef std::vector<SubRow_Item> SubRow; + + /** Puts the row's table into the parent XML-element, but + doesn't write the items, because the actvity-status of + the subitems isn't known yet. + */ + void Setup_Row(); + + // DATA + SubRow aRow; + Xml::Element * pMyRow; +}; + + + + +// IMPLEMENTATION + + + + +#endif + + diff --git a/autodoc/source/display/inc/toolkit/hf_title.hxx b/autodoc/source/display/inc/toolkit/hf_title.hxx new file mode 100644 index 000000000000..b4c80a54cc13 --- /dev/null +++ b/autodoc/source/display/inc/toolkit/hf_title.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * 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_HF_TITLE_HXX +#define ADC_DISPLAY_HF_TITLE_HXX + + + +// USED SERVICES + // BASE CLASSES +#include <toolkit/htmlfactory.hxx> + // COMPONENTS + // PARAMETERS + + +class HF_TitleTable : public HtmlMaker +{ + public: + HF_TitleTable( + Xml::Element & o_rOut ); + virtual ~HF_TitleTable(); + + void Produce_Title( + const char * i_title ); + void Produce_Title( + const char * i_annotations, +// const char * i_label, + const char * i_title ); + + /// @return a Html::TableCell reference. + Xml::Element & Add_Row(); +}; + + +class HF_SubTitleTable : public HtmlMaker +{ + public: + enum E_SubLevel + { + sublevel_1, /// Big title. + sublevel_2, /// Small title. + sublevel_3 /// No title. + }; + + /** @param i_nColumns [1 .. n] + @param i_nSubTitleLevel [1 .. 2] + 1 is a bit bigger than 2. + */ + + HF_SubTitleTable( + Xml::Element & o_rOut, + const String & i_label, + const String & i_title, + int i_nColumns, + E_SubLevel i_eSubTitleLevel = sublevel_1 ); + virtual ~HF_SubTitleTable(); + + /// @return an Html::TableRow reference. + Xml::Element & Add_Row(); +}; + + +// IMPLEMENTATION + + + +#endif diff --git a/autodoc/source/display/inc/toolkit/htmlfactory.hxx b/autodoc/source/display/inc/toolkit/htmlfactory.hxx new file mode 100644 index 000000000000..1e46ac7d94db --- /dev/null +++ b/autodoc/source/display/inc/toolkit/htmlfactory.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * 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_HTMLFACTORY_HXX +#define ADC_DISPLAY_HTMLFACTORY_HXX + + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include "outputstack.hxx" + // PARAMETERS +#include <udm/xml/xmlitem.hxx> +#include <udm/html/htmlitem.hxx> + +namespace Xml = ::csi::xml; +namespace Html = ::csi::html; + +/** @resp + Base class for HTML page creators (factories) for code entites or + similar items. +*/ +template <class ENV> +class HtmlFactory +{ + public: + // INQUIRY + ENV & Env() const { return *pEnv; } + Xml::Element & CurOut() const { return aDestination.Out(); } + + // ACCESS + OutputStack & Out() const { return aDestination; } + + protected: + HtmlFactory( + ENV & io_rEnv, + Xml::Element * o_pOut = 0 ) + : pEnv(&io_rEnv) { if (o_pOut != 0) aDestination.Enter(*o_pOut); } + ~HtmlFactory() {} + private: + // DATA + ENV * pEnv; + mutable OutputStack aDestination; +}; + + +/** @resp + Base class for HTML paragraph creators, which are to be put into + a parent HTML element. +*/ +class HtmlMaker +{ + public: + + // INQUIRY + Xml::Element & CurOut() const { return *pOut; } + + protected: + HtmlMaker( + Xml::Element & o_rOut ) + : pOut(&o_rOut) {} + private: + // DATA + Xml::Element * pOut; +}; + + + + +// IMPLEMENTATION + + + + +#endif + + diff --git a/autodoc/source/display/inc/toolkit/htmlfile.hxx b/autodoc/source/display/inc/toolkit/htmlfile.hxx new file mode 100644 index 000000000000..771855ea7a31 --- /dev/null +++ b/autodoc/source/display/inc/toolkit/htmlfile.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * 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_HTMLFILE_HXX +#define ADC_DISPLAY_HTMLFILE_HXX + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <udm/html/htmlitem.hxx> + // PARAMETERS +#include <cosv/ploc.hxx> + +namespace csv +{ + class File; +} + +/** Represents an HTML output file. +*/ +class DocuFile_Html +{ + public: + // LIFECYCLE + DocuFile_Html(); + + void SetLocation( + const csv::ploc::Path & + i_rFilePath ); + void SetTitle( + const char * i_sTitle ); + void SetRelativeCssPath( + const char * i_sCssFile_relativePath ); + void SetCopyright( + const char * i_sCopyright ); + void EmptyBody(); + + Html::Body & Body() { return aBodyData; } + bool CreateFile(); + + private: + void WriteHeader( + csv::File & io_aFile ); + void WriteBody( + csv::File & io_aFile ); + // DATA + String sFilePath; + String sTitle; + String sLocation; + String sStyle; + String sCssFile; + String sCopyright; + + Html::Body aBodyData; + StreamStr aBuffer; +}; + + + +#endif + + diff --git a/autodoc/source/display/inc/toolkit/out_node.hxx b/autodoc/source/display/inc/toolkit/out_node.hxx new file mode 100644 index 000000000000..4f6385cf54fb --- /dev/null +++ b/autodoc/source/display/inc/toolkit/out_node.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * 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_OUT_NODE_HXX +#define ADC_DISPLAY_OUT_NODE_HXX + + + + +namespace output +{ + + +/** @resp + Represents a tree of names where each node can have only one parent, + but a list of children. + + @see Position + @see Tree +*/ +class Node +{ + public: + typedef std::vector< Node* > List; + typedef UINT32 relative_id; + + // LIFECYCLE + enum E_NullObject { null_object }; + + Node(); + explicit Node( + E_NullObject ); + ~Node(); + + // OPERATORS + bool operator==( + const Node & i_node ) const + { return pParent == i_node.pParent AND sName == i_node.sName; } + bool operator!=( + const Node & i_node ) const + { return NOT operator==(i_node); } + + // OPERATIONS + /// Seek, and if not existent, create. + Node & Provide_Child( + const String & i_name ); + /// Seek, and if not existent, create. + Node & Provide_Child( + const StringVector & + i_path ) + { return provide_Child(i_path.begin(), i_path.end()); } + // INQUIRY + intt Depth() const { return nDepth; } + + const String & Name() const { return sName; } + /// @return Id of a namespace or class etc. this directory represents. + relative_id RelatedNameRoom() const { return nNameRoomId; } + /// @return No delimiter at start, with delimiter at end. + void Get_Path( + StreamStr & o_result, + intt i_maxDepth = -1 ) const; + void Get_Chain( + StringVector & o_result, + intt i_maxDepth = -1 ) const; + // ACCESS + void Set_RelatedNameRoom( + relative_id i_nNameRoomId ) + { nNameRoomId = i_nNameRoomId; } + Node * Parent() { return pParent; } + Node * Child( + const String & i_name ) + { return find_Child(i_name); } + List & Children() { return aChildren; } + + /// @return a reference to a Node with Depth() == -1. + static Node & Null_(); + + private: + // Local + Node( + const String & i_name, + Node & i_parent ); + + Node * find_Child( + const String & i_name ); + Node & add_Child( + const String & i_name ); + Node & provide_Child( + StringVector::const_iterator + i_next, + StringVector::const_iterator + i_end ); + // Data + String sName; + Node * pParent; + List aChildren; + intt nDepth; + relative_id nNameRoomId; +}; + + + + +} // namespace output +#endif diff --git a/autodoc/source/display/inc/toolkit/out_position.hxx b/autodoc/source/display/inc/toolkit/out_position.hxx new file mode 100644 index 000000000000..214b91c15bab --- /dev/null +++ b/autodoc/source/display/inc/toolkit/out_position.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * 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_OUT_POSITION_HXX +#define ADC_DISPLAY_OUT_POSITION_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <toolkit/out_node.hxx> + // PARAMETERS + + + +namespace output +{ + + + +class Position +{ + public: + // LIFECYCLE + Position(); + explicit Position( + Node & i_directory, + const String & i_file = String::Null_() ); + Position( + const Position & i_directory, + const String & i_rDifferentFile ); + ~Position(); + + // OPERATIONS + Position & operator=( + Node & i_node ); + Position & operator+=( + const String & i_nodeName ); + Position & operator-=( + intt i_levels ); + + // INQUIRY + bool IsValid() const { return pDirectory->Depth() >= 0; } + const String & Name() const { return pDirectory->Name(); } + const String & File() const { return sFile; } + intt Depth() const { return pDirectory->Depth(); } + + void Get_Chain( + StringVector & o_result ) const + { pDirectory->Get_Chain(o_result); } + String LinkToRoot( + const String & i_localLabel = String::Null_() ) const; + + void Get_LinkTo( + StreamStr & o_result, + const Position & i_destination, + const String & i_localLabel = String::Null_() ) const; + void Get_LinkToRoot( + StreamStr & o_result, + const String & i_localLabel = String::Null_() ) const; + + static char Delimiter() { return '/'; } + + // ACCESS + Node & RelatedNode() const { return *pDirectory; } + + void Set( + Node & i_node, + const String & i_file = String::Null_() ); + void Set_File( + const String & i_file ); + + private: + // DATA + String sFile; + Node * pDirectory; +}; + + +/// @return No delimiter at start, with delimiter at end. +const char * get_UpLink( + uintt i_depth ); + + +// IMPLEMENTATION + +inline void +Position::Set_File( const String & i_file ) + { sFile = i_file; } + +} // namespace output + +#endif diff --git a/autodoc/source/display/inc/toolkit/out_tree.hxx b/autodoc/source/display/inc/toolkit/out_tree.hxx new file mode 100644 index 000000000000..eaf1edffdf30 --- /dev/null +++ b/autodoc/source/display/inc/toolkit/out_tree.hxx @@ -0,0 +1,136 @@ +/************************************************************************* + * + * 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_OUT_TREE_HXX +#define ADC_DISPLAY_OUT_TREE_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include "out_position.hxx" + // PARAMETERS + + +namespace output +{ + +inline const char * +ModuleFileName() +{ return "module-ix.html"; } +inline const char * +IndexFilesDirName() +{ return "index-files"; } +inline const char * +IndexFile_A() +{ return "index-1.html"; } + + +class Tree +{ + public: + // LIFECYCLE + Tree(); + ~Tree(); + + // OPERATIONS + void Set_Overview( + const StringVector & + i_path, + const String & i_sFileName ); + Node & Set_NamesRoot( + const StringVector & + i_path ); + Node & Set_IndexRoot( + const StringVector & + i_path ); + Node & Set_ProjectsRoot( + const StringVector & + i_path ); + Node & Provide_Node( + const StringVector & + i_path ); + + // ACCESS + Node & RootNode() { return *pRoot; } + Node & NamesRootNode() { return *pNamesRoot; } + Node & IndexRootNode() { return *pIndexRoot; } + Node & ProjectsRootNode() { return *pProjectsRoot; } + + Position Root() { return Position(*pRoot); } + Position Overview() { return aOverview; } + Position NamesRoot() { return Position(*pNamesRoot); } + Position IndexRoot() { return Position(*pIndexRoot); } + Position ProjectsRoot() { return Position(*pProjectsRoot); } + + private: + // forbidden: + Tree(const Tree&); + Tree & operator=(const Tree&); + + // DATA + Dyn<Node> pRoot; + Node * pNamesRoot; + Node * pIndexRoot; + Node * pProjectsRoot; + Position aOverview; +}; + + +// IMPLEMENTATION + +inline Node & +Tree::Provide_Node( const StringVector & i_path ) + { return pRoot->Provide_Child(i_path); } + + +inline void +Tree::Set_Overview( const StringVector & i_path, + const String & i_sFileName ) + { aOverview.Set(Provide_Node(i_path), i_sFileName); } + +inline Node & +Tree::Set_NamesRoot( const StringVector & i_path ) + { pNamesRoot = &Provide_Node(i_path); + return *pNamesRoot; } + +inline Node & +Tree::Set_IndexRoot( const StringVector & i_path ) + { pIndexRoot = &Provide_Node(i_path); + return *pIndexRoot; } + +inline Node & +Tree::Set_ProjectsRoot( const StringVector & i_path ) + { pProjectsRoot = &Provide_Node(i_path); + return *pProjectsRoot; } + + + +} // namespace output + + +#endif diff --git a/autodoc/source/display/inc/toolkit/outputstack.hxx b/autodoc/source/display/inc/toolkit/outputstack.hxx new file mode 100644 index 000000000000..4c02065bd1e6 --- /dev/null +++ b/autodoc/source/display/inc/toolkit/outputstack.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * 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_OUTPUTSTACK_HXX +#define ADC_DISPLAY_OUTPUTSTACK_HXX + + +// USED SERVICES + // BASE CLASSES + // COMPONENTS +#include <estack.hxx> + // PARAMETERS +#include <udm/xml/xmlitem.hxx> + + +class OutputStack +{ + public: + // LIFECYCLE + OutputStack(); + ~OutputStack(); + + // OPERATIONS + void Enter( + csi::xml::Element & io_rDestination ); + void Leave(); + + // ACCESS + csi::xml::Element & Out() const; // CurOutputNode + + private: + EStack< csi::xml::Element * > + aCurDestination; // The front element is the currently used. + // The later ones are the parents. +}; + +inline csi::xml::Element & +OutputStack::Out() const +{ + csv_assert( aCurDestination.size() > 0 ); + return *aCurDestination.top(); +} + +// IMPLEMENTATION + + +#endif + + diff --git a/autodoc/source/display/kernel/displfct.cxx b/autodoc/source/display/kernel/displfct.cxx new file mode 100644 index 000000000000..149dbb375b68 --- /dev/null +++ b/autodoc/source/display/kernel/displfct.cxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * 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 "displfct.hxx" + + +// NOT FULLY DECLARED SERVICES +#include <html/chd_udk2.hxx> +#include <idl/hi_display.hxx> +#include <cfrstd.hxx> + + +DYN DisplayToolsFactory * DisplayToolsFactory::dpTheInstance_ = 0; + + +namespace autodoc +{ + +DisplayToolsFactory_Ifc & +DisplayToolsFactory_Ifc::GetIt_() +{ + if ( DisplayToolsFactory::dpTheInstance_ == 0 ) + DisplayToolsFactory::dpTheInstance_ = new DisplayToolsFactory; + return *DisplayToolsFactory::dpTheInstance_; +} + +} // namespace autodoc + + +DisplayToolsFactory::DisplayToolsFactory() +{ +} + +DisplayToolsFactory::~DisplayToolsFactory() +{ +} + +// DYN autodoc::TextDisplay_FunctionList_Ifc * +// DisplayToolsFactory::Create_TextDisplay_FunctionList() const +// { +// return new CppTextDisplay_FunctionList; +// } + + +DYN autodoc::HtmlDisplay_UdkStd * +DisplayToolsFactory::Create_HtmlDisplay_UdkStd() const +{ + return new CppHtmlDisplay_Udk2; +} + +DYN autodoc::HtmlDisplay_Idl_Ifc * +DisplayToolsFactory::Create_HtmlDisplay_Idl() const +{ + return new HtmlDisplay_Idl; +} + +const display::CorporateFrame & +DisplayToolsFactory::Create_StdFrame() const +{ + static StdFrame aFrame; + return aFrame; +} + + diff --git a/autodoc/source/display/kernel/displfct.hxx b/autodoc/source/display/kernel/displfct.hxx new file mode 100644 index 000000000000..a6de4b44e447 --- /dev/null +++ b/autodoc/source/display/kernel/displfct.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * 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_DISPLFCT_HXX +#define ADC_DISPLAY_DISPLFCT_HXX + + +#include <autodoc/displaying.hxx> + + +/** Interface for parsing code of a programming language and + delivering the information into an Autodoc Repository. +**/ +class DisplayToolsFactory : public autodoc::DisplayToolsFactory_Ifc +{ + public: + DisplayToolsFactory(); + virtual ~DisplayToolsFactory(); + +// virtual DYN autodoc::TextDisplay_FunctionList_Ifc * +// Create_TextDisplay_FunctionList() const; + + virtual DYN autodoc::HtmlDisplay_UdkStd * + Create_HtmlDisplay_UdkStd() const; + virtual DYN autodoc::HtmlDisplay_Idl_Ifc * + Create_HtmlDisplay_Idl() const; + + virtual const display::CorporateFrame & + Create_StdFrame() const; + private: + static DYN DisplayToolsFactory * + dpTheInstance_; + + friend class autodoc::DisplayToolsFactory_Ifc; +}; + + +#endif + diff --git a/autodoc/source/display/kernel/makefile.mk b/autodoc/source/display/kernel/makefile.mk new file mode 100644 index 000000000000..992456dcd667 --- /dev/null +++ b/autodoc/source/display/kernel/makefile.mk @@ -0,0 +1,55 @@ +#************************************************************************* +# +# 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_kernel +TARGETTYPE=CUI + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/displfct.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/display/toolkit/hf_docentry.cxx b/autodoc/source/display/toolkit/hf_docentry.cxx new file mode 100644 index 000000000000..5d6f415a5223 --- /dev/null +++ b/autodoc/source/display/toolkit/hf_docentry.cxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * 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 <toolkit/hf_docentry.hxx> + + +// NOT FULLY DEFINED SERVICES + + +HF_DocEntryList::HF_DocEntryList( Xml::Element & o_out ) + : HtmlMaker( o_out >>* new Html::DefList ) +{ +} + +HF_DocEntryList::~HF_DocEntryList() +{ +} + +Xml::Element & +HF_DocEntryList::Produce_Term(const char * i_sTerm ) +{ + Xml::Element & + ret = CurOut() + >> *new Html::DefListTerm + >> *new Html::Bold; + if ( NOT csv::no_str(i_sTerm)) + ret + << i_sTerm; + return ret; +} + +Xml::Element & +HF_DocEntryList::Produce_NormalTerm(const char * i_sTerm) +{ + Xml::Element & + ret = CurOut() + >> *new Html::DefListTerm; + if ( NOT csv::no_str(i_sTerm)) + ret + << i_sTerm; + return ret; +} + +Xml::Element & +HF_DocEntryList::Produce_Definition() +{ + return CurOut() + >> *new Html::DefListDefinition; +} diff --git a/autodoc/source/display/toolkit/hf_funcdecl.cxx b/autodoc/source/display/toolkit/hf_funcdecl.cxx new file mode 100644 index 000000000000..1c015b539cf2 --- /dev/null +++ b/autodoc/source/display/toolkit/hf_funcdecl.cxx @@ -0,0 +1,203 @@ +/************************************************************************* + * + * 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 <toolkit/hf_funcdecl.hxx> + + +// NOT FULLY DEFINED SERVICES + +const String C_sValignTop("top"); +const String C_sValignBottom("bottom"); + + + +HF_FunctionDeclaration::HF_FunctionDeclaration( Xml::Element & o_rParent, + const String & i_sRaisesText ) + : HtmlMaker(o_rParent), + sRaisesText(i_sRaisesText), + pTable(0), + pReturnCell(0), + pNameCell(0), + pParameterLine(0), + pLastParameterCell(0), + pExceptionCell(0) +{ + pTable = new Html::Table; + CurOut() + >> *pTable + << new Html::ClassAttr("table-in-method") + << new Xml::AnAttribute("border","0"); +} + +HF_FunctionDeclaration::~HF_FunctionDeclaration() +{ +} + +Xml::Element & +HF_FunctionDeclaration::ReturnCell() +{ + if (pReturnCell != 0) + return *pReturnCell; + + pReturnCell = &( *pTable + >> *new Html::TableRow + >> *new Html::TableCell + << new Html::VAlignAttr(C_sValignTop) + << new Xml::AnAttribute("colspan", "3") + ); + return *pReturnCell; +} + +Xml::Element & +HF_FunctionDeclaration::NameCell() +{ + if (pNameCell != 0) + return *pNameCell; + + pNameCell = &( ParameterLine() + >> *new Html::TableCell + << new Html::VAlignAttr(C_sValignTop) + ); + pLastParameterCell = pNameCell; + + return *pNameCell; +} + +Xml::Element & +HF_FunctionDeclaration::NewParamTypeCell() +{ + if (pLastParameterCell != pNameCell) + { + pParameterLine = 0; + ParameterLine() + >> *new Html::TableCell; + } + + Xml::Element & + rParamType = ParameterLine() + >> *new Html::TableCell + << new Html::VAlignAttr(C_sValignTop); + pLastParameterCell + = &( ParameterLine() + >> *new Html::TableCell + << new Html::VAlignAttr(C_sValignBottom) + << new Xml::XmlCode(" ") + ); + return rParamType; +} + +Xml::Element & +HF_FunctionDeclaration::ParamNameCell() +{ + csv_assert(pLastParameterCell != pNameCell); + return *pLastParameterCell; +} + +Xml::Element & +HF_FunctionDeclaration::ExceptionCell() +{ + if (pExceptionCell != 0) + return *pExceptionCell; + + Xml::Element & + rExceptionRow = *pTable + >> *new Html::TableRow; + rExceptionRow + >> *new Html::TableCell + << new Html::VAlignAttr(C_sValignTop) + << new Xml::AnAttribute("align", "right") + << sRaisesText + << "( "; + + pExceptionCell = &( rExceptionRow + >> *new Html::TableCell + << new Html::VAlignAttr(C_sValignTop) + << new Xml::AnAttribute("colspan", "2") + ); + return *pExceptionCell; +} + +Html::TableRow & +HF_FunctionDeclaration::ParameterLine() +{ + if (pParameterLine != 0) + return *pParameterLine; + + pParameterLine = new Html::TableRow; + *pTable + >> *pParameterLine; + + return *pParameterLine; +} + + +#if 0 // old +HF_FunctionDeclaration::HF_FunctionDeclaration( Xml::Element & o_rParent ) + : HtmlMaker(o_rParent), + pFront(0), + pTypes(0), + pNames(0) +{ + Xml::Element & + rRow = CurOut() + >> *new Html::Table + << new Xml::AnAttribute("border","0") + >> *new Html::TableRow; + pFront = &(rRow >> *new Html::TableCell << new Html::VAlignAttr(C_sValignTop)); + pTypes = &(rRow >> *new Html::TableCell << new Html::VAlignAttr(C_sValignTop)); + pNames = &(rRow >> *new Html::TableCell << new Html::VAlignAttr(C_sValignTop)); +} + +HF_FunctionDeclaration::~HF_FunctionDeclaration() +{ +} + +Xml::Element & +HF_FunctionDeclaration::Add_ReturnLine() +{ + (*pTypes) << new Xml::XmlCode(" <br>\n"); + (*pNames) << new Xml::XmlCode(" <br>\n"); + return *pFront; +} + +Xml::Element & +HF_FunctionDeclaration::Add_RaisesLine( const char * i_sRaisesText, + bool i_bSuppressExtraLine ) +{ + if (NOT i_bSuppressExtraLine) + { + (*pTypes) << new Xml::XmlCode(" <br>"); + (*pNames) << new Xml::XmlCode(" <br>\n"); + } + (*pTypes) + << new Xml::XmlCode("<p class=\"raise\">") + << i_sRaisesText + << new Xml::XmlCode("( </p>\n"); + return *pNames; +} +#endif // 0 old diff --git a/autodoc/source/display/toolkit/hf_linachain.cxx b/autodoc/source/display/toolkit/hf_linachain.cxx new file mode 100644 index 000000000000..fd83242e5247 --- /dev/null +++ b/autodoc/source/display/toolkit/hf_linachain.cxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * 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 <toolkit/hf_linachain.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <toolkit/out_position.hxx> + + + +HF_LinkedNameChain::HF_LinkedNameChain( Xml::Element & o_rOut ) + : HtmlMaker( o_rOut + >> *new Html::Paragraph + << new Html::ClassAttr("namechain") ) +{ +} + +HF_LinkedNameChain::~HF_LinkedNameChain() +{ +} + +void +HF_LinkedNameChain::Produce_CompleteChain( const output::Position & i_curPosition, + F_LinkMaker i_linkMaker ) const +{ + produce_Level(i_curPosition.RelatedNode(), i_curPosition, i_linkMaker); +} + +void +HF_LinkedNameChain::Produce_CompleteChain_forModule( const output::Position & i_curPosition, + F_LinkMaker i_linkMaker ) const +{ + if (i_curPosition.Depth() == 0) + return; + produce_Level(*i_curPosition.RelatedNode().Parent(), i_curPosition, i_linkMaker); +} + + + +namespace +{ + +StreamStr aLinkBuf(200); + +} + +void +HF_LinkedNameChain::produce_Level( output::Node & i_levelNode, + const output::Position & i_startPosition, + F_LinkMaker i_linkMaker ) const +{ + if ( i_levelNode.Depth() > 0 ) + { + produce_Level( *i_levelNode.Parent(), + i_startPosition, + i_linkMaker ); + } + + aLinkBuf.reset(); + + String + sFileName = (*i_linkMaker)(i_levelNode.Name()); + output::Position + aLevelPos(i_levelNode, sFileName); + + i_startPosition.Get_LinkTo(aLinkBuf, aLevelPos); + + if ( i_levelNode.Depth() > 0 ) + { + CurOut() + >> *new Html::Link(aLinkBuf.c_str()) + << new Html::ClassAttr("namechain") + << i_levelNode.Name(); + CurOut() << " :: "; + } + else + { + CurOut() + >> *new Html::Link(aLinkBuf.c_str()) + << new Html::ClassAttr("namechain") + << "::"; + CurOut() << " "; + } +} diff --git a/autodoc/source/display/toolkit/hf_navi_main.cxx b/autodoc/source/display/toolkit/hf_navi_main.cxx new file mode 100644 index 000000000000..69cfdf0ec746 --- /dev/null +++ b/autodoc/source/display/toolkit/hf_navi_main.cxx @@ -0,0 +1,238 @@ +/************************************************************************* + * + * 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 <toolkit/hf_navi_main.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <cosv/tpl/tpltools.hxx> + + + +//******************** MainItem and derived ones ***************// +class HF_MainItem : public HtmlMaker +{ + public: + virtual ~HF_MainItem() {} + void Produce_Item() const { do_ProduceItem(); } + protected: + HF_MainItem( + Xml::Element & o_out ) + : HtmlMaker(o_out) {} + private: + virtual void do_ProduceItem() const = 0; +}; + + +namespace +{ + +class StdItem : public HF_MainItem +{ + public: + StdItem( + Xml::Element & o_out, + const char * i_sText, + const char * i_sLink ); + + ~StdItem(); + private: + virtual void do_ProduceItem() const; + + // DATA + String sText; + String sLink; +}; + +class SelfItem : public HF_MainItem +{ + public: + SelfItem( + Xml::Element & o_out, + const char * i_sText ); + ~SelfItem(); + private: + virtual void do_ProduceItem() const; + + // DATA + String sText; +}; + +class NoneItem : public HF_MainItem +{ + public: + NoneItem( + Xml::Element & o_out, + const char * i_sText ); + ~NoneItem(); + private: + virtual void do_ProduceItem() const; + + // DATA + String sText; +}; + +} // anonymous namespace + + + +//******************** HF_NaviMainRow ***************// + + + +HF_NaviMainRow::HF_NaviMainRow( Xml::Element & o_out ) + : HtmlMaker(o_out), + aItems(), + pRow(0) +{ + aItems.reserve(5); + + pRow = + &( CurOut() + >> *new Html::Table + << new Html::ClassAttr("navimain") + << new Xml::AnAttribute( "border", "0" ) + << new Xml::AnAttribute( "cellpadding", "3" ) + >> *new Html::TableRow + ); +} + +HF_NaviMainRow::~HF_NaviMainRow() +{ + csv::erase_container_of_heap_ptrs(aItems); +} + +void +HF_NaviMainRow::Add_StdItem( const char * i_sText, + const char * i_sLink ) +{ + aItems.push_back(new StdItem( *pRow,i_sText,i_sLink )); +} + +void +HF_NaviMainRow::Add_SelfItem( const char * i_sText ) +{ + aItems.push_back(new SelfItem( *pRow,i_sText )); +} + +void +HF_NaviMainRow::Add_NoneItem( const char * i_sText ) +{ + aItems.push_back(new NoneItem( *pRow,i_sText )); +} + +void +HF_NaviMainRow::Produce_Row() +{ + ItemList::iterator itEnd = aItems.end(); + for ( ItemList::iterator iter = aItems.begin(); + iter != itEnd; + ++iter ) + { + (*iter)->Produce_Item(); + } +} + + + + +//******************** MainItem and derived ones ***************// + +namespace +{ + +StdItem::StdItem( Xml::Element & o_out, + const char * i_sText, + const char * i_sLink ) + : HF_MainItem(o_out), + sText(i_sText), + sLink(i_sLink) +{ +} + +StdItem::~StdItem() +{ +} + +void +StdItem::do_ProduceItem() const +{ + Xml::Element & + rCell = CurOut() >>* new Html::TableCell; + rCell + << new Html::ClassAttr( "navimain" ) + >> *new Html::Link(sLink.c_str()) + << new Html::ClassAttr( "navimain" ) + << sText.c_str(); +} + +SelfItem::SelfItem( Xml::Element & o_out, + const char * i_sText ) + : HF_MainItem(o_out), + sText(i_sText) +{ +} + +SelfItem::~SelfItem() +{ +} + +void +SelfItem::do_ProduceItem() const +{ + Xml::Element & + rCell = CurOut() >>* new Html::TableCell; + rCell + << new Html::ClassAttr( "navimainself" ) + << sText.c_str(); +} + +NoneItem::NoneItem( Xml::Element & o_out, + const char * i_sText ) + : HF_MainItem(o_out), + sText(i_sText) +{ +} + +NoneItem::~NoneItem() +{ +} + +void +NoneItem::do_ProduceItem() const +{ + Xml::Element & + rCell = CurOut() >>* new Html::TableCell; + rCell + << new Html::ClassAttr( "navimainnone" ) + << sText.c_str(); +} + +} // anonymous namespace + + diff --git a/autodoc/source/display/toolkit/hf_navi_sub.cxx b/autodoc/source/display/toolkit/hf_navi_sub.cxx new file mode 100644 index 000000000000..4c11e0e7e6df --- /dev/null +++ b/autodoc/source/display/toolkit/hf_navi_sub.cxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * 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 <toolkit/hf_navi_sub.hxx> + + +// NOT FULLY DEFINED SERVICES + + +HF_NaviSubRow::HF_NaviSubRow( Xml::Element & o_rOut ) + : HtmlMaker(o_rOut), + aRow(), + pMyRow(0) +{ + Setup_Row(); +} + +HF_NaviSubRow::~HF_NaviSubRow() +{ +} + +void +HF_NaviSubRow::AddItem( const String & i_sText, + const String & i_sLink, + bool i_bSwitchOn ) +{ + aRow.push_back( SubRow_Item( SubRow_Data(i_sText,i_sLink), + i_bSwitchOn )); +} + +void +HF_NaviSubRow::SwitchOn( int i_nIndex ) +{ + if ( i_nIndex < int(aRow.size()) ) + aRow[i_nIndex].second = true; +} + +void +HF_NaviSubRow::Setup_Row() +{ + Html::Table * + pTable = new Html::Table; + CurOut() + >> *pTable + << new Html::ClassAttr("navisub") + << new Xml::AnAttribute( "border", "0" ) + << new Xml::AnAttribute( "cellpadding", "0" ); + pMyRow = &pTable->AddRow(); +} + +void +HF_NaviSubRow::Produce_Row() +{ + for ( SubRow::const_iterator it = aRow.begin(); + it != aRow.end(); + ++it ) + { + Xml::Element & + rCell = *pMyRow + >> *new Html::TableCell + << new Html::ClassAttr("navisub"); + StreamLock sl(100); + Xml::Element & + rGoon = (*it).second + ? ( rCell + >> *new Html::Link( sl() + << "#" + << (*it).first.second + << c_str ) + << new Html::ClassAttr("navisub") + ) + : rCell; + rGoon + << (*it).first.first; + } +} + + diff --git a/autodoc/source/display/toolkit/hf_title.cxx b/autodoc/source/display/toolkit/hf_title.cxx new file mode 100644 index 000000000000..bd6bbd2d5f89 --- /dev/null +++ b/autodoc/source/display/toolkit/hf_title.cxx @@ -0,0 +1,169 @@ +/************************************************************************* + * + * 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 <toolkit/hf_title.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <stdlib.h> + + +const String C_sTitleBorder("0"); +const String C_sTitleWidth("100%"); +const String C_sTitlePadding("5"); +const String C_sTitleSpacing("3"); + +const String C_sSubTitleBorder("1"); +const String C_sSubTitleWidth("100%"); +const String C_sSubTitlePadding("5"); +const String C_sSubTitleSpacing("0"); +const String C_sColSpan("colspan"); + + +HF_TitleTable::HF_TitleTable( Xml::Element & o_rOut ) + : HtmlMaker(o_rOut >> *new Html::Table( C_sTitleBorder, + C_sTitleWidth, + C_sTitlePadding, + C_sTitleSpacing ) + << new Html::ClassAttr("title-table") + << new Html::StyleAttr("margin-bottom:6pt;") ) +{ +} + +HF_TitleTable::~HF_TitleTable() +{ +} + +void +HF_TitleTable::Produce_Title( const char * i_title ) +{ + Add_Row() + << new Html::ClassAttr("title") + << i_title; +} + +void +HF_TitleTable::Produce_Title( const char * i_annotations, + const char * i_title ) +{ + if (csv::no_str(i_annotations)) + { + Produce_Title(i_title); + return; + } + + Xml::Element & + rRow = Add_Row(); + rRow + << new Html::ClassAttr("title"); + + Xml::Element & + rTable = rRow + >> *new Html::Table() + << new Html::ClassAttr("title-table") + << new Html::WidthAttr("99%"); + Xml::Element & + rInnerRow = rTable + >> *new Html::TableRow; + rInnerRow + >> *new Html::TableCell + << new Html::WidthAttr("25%") + << new Html::ClassAttr("title2") + << i_annotations; + rInnerRow + >> *new Html::TableCell + << new Html::WidthAttr("50%") + << new Html::ClassAttr("title") + << i_title; + rInnerRow + >> *new Html::TableCell + << new Html::WidthAttr("*"); +} + +Xml::Element & +HF_TitleTable::Add_Row() +{ + return CurOut() + >> *new Html::TableRow + >> *new Html::TableCell; +} + + +inline const char * +get_SubTitleCssClass(HF_SubTitleTable::E_SubLevel i_eSubTitleLevel) +{ + return i_eSubTitleLevel == HF_SubTitleTable::sublevel_1 + ? "subtitle" + : "crosstitle"; +} + + +HF_SubTitleTable::HF_SubTitleTable( Xml::Element & o_rOut, + const String & i_label, + const String & i_title, + int i_nColumns, + E_SubLevel i_eSubTitleLevel ) + : HtmlMaker( o_rOut + << new Html::Label(i_label) + >> *new Html::Table( C_sSubTitleBorder, + C_sSubTitleWidth, + C_sSubTitlePadding, + C_sSubTitleSpacing ) + << new Html::ClassAttr(get_SubTitleCssClass(i_eSubTitleLevel)) ) +{ + csv_assert(i_nColumns > 0); + + if (i_eSubTitleLevel == sublevel_3) + return; + + Xml::Element & + rCell = CurOut() + >> *new Html::TableRow + >> *new Html::TableCell + << new Html::ClassAttr(get_SubTitleCssClass(i_eSubTitleLevel)) ; + + if (i_nColumns > 1) + { + StreamLock sl(20); + String sColumns = sl() << i_nColumns << c_str; + rCell + << new Xml::AnAttribute(C_sColSpan, sColumns); + } + rCell + << i_title; +} + +HF_SubTitleTable::~HF_SubTitleTable() +{ +} + +Xml::Element & +HF_SubTitleTable::Add_Row() +{ + return CurOut() >> *new Html::TableRow; +} diff --git a/autodoc/source/display/toolkit/htmlfile.cxx b/autodoc/source/display/toolkit/htmlfile.cxx new file mode 100644 index 000000000000..bb2bb35f0360 --- /dev/null +++ b/autodoc/source/display/toolkit/htmlfile.cxx @@ -0,0 +1,211 @@ +/************************************************************************* + * + * 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 <toolkit/htmlfile.hxx> + +// NOT FULLY DECLARED SERVICES +#include <cosv/file.hxx> +#include <udm/html/htmlitem.hxx> + +namespace +{ +bool bUse_OOoFrameDiv = true; +const String C_sOOoFrameDiv_IdlId("adc-idlref"); +} + +using namespace csi; +using csi::xml::AnAttribute; + +DocuFile_Html::DocuFile_Html() + : sFilePath(), + sTitle(), + sLocation(), + sStyle(), + sCssFile(), + sCopyright(), + aBodyData(), + aBuffer(60000) // Grows dynamically, when necessary. +{ +} + +void +DocuFile_Html::SetLocation( const csv::ploc::Path & i_rFilePath ) +{ + StreamLock sPath(1000); + i_rFilePath.Get( sPath() ); + + sFilePath = sPath().c_str(); +} + +void +DocuFile_Html::SetTitle( const char * i_sTitle ) +{ + sTitle = i_sTitle; +} + +void +DocuFile_Html::SetRelativeCssPath( const char * i_sCssFile_relativePath ) +{ + sCssFile = i_sCssFile_relativePath; +} + +void +DocuFile_Html::SetCopyright( const char * i_sCopyright ) +{ + sCopyright = i_sCopyright; +} + +void +DocuFile_Html::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_IdlId) + << new xml::XmlCode("\">\n\n"); + } + + aBodyData + >> *new html::Label( "_top_" ) + << " "; +} + +bool +DocuFile_Html::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 +DocuFile_Html::WriteHeader( csv::File & io_aFile ) +{ + aBuffer.reset(); + + static const char s1[] = + "<html>\n<head>\n<title>"; + static const char s2[] = + "</title>\n" + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n"; + + aBuffer.write( s1 ); + aBuffer.write( sTitle ); + aBuffer.write( s2 ); + + + if (NOT sCssFile.empty()) + { + static const char s3[] = + "<link rel=\"stylesheet\" type=\"text/css\" href=\""; + static const char s4[] = + "\">\n"; + + aBuffer.write(s3); + aBuffer.write(sCssFile); + aBuffer.write(s4); + } + + if (NOT sStyle.empty()) + { + static const char s5[] = + "<style>"; + static const char s6[] = + "</style>\n"; + + aBuffer.write(s5); + aBuffer.write(sStyle); + aBuffer.write(s6); + } + + static const char s7[] = + "</head>\n"; + aBuffer.write(s7); + + io_aFile.write(aBuffer.c_str(), aBuffer.size()); +} + +void +DocuFile_Html::WriteBody( csv::File & io_aFile ) +{ + aBuffer.reset(); + + aBodyData + >> *new html::Link( "#_top_" ) + << "Top of Page"; + + if ( sCopyright.length() > 0 ) + { + aBodyData + << new xml::XmlCode("<hr size=\"3\">"); + + 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_IdlId) + << new xml::XmlCode("\" -->\n"); + } + + aBodyData.WriteOut(aBuffer); + io_aFile.write(aBuffer.c_str(), aBuffer.size()); +} + + + + + + + diff --git a/autodoc/source/display/toolkit/makefile.mk b/autodoc/source/display/toolkit/makefile.mk new file mode 100644 index 000000000000..ab374990eb7a --- /dev/null +++ b/autodoc/source/display/toolkit/makefile.mk @@ -0,0 +1,64 @@ +#************************************************************************* +# +# 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_toolkit + + +# --- Settings ----------------------------------------------------- + +ENABLE_EXCEPTIONS=true +PRJINC=$(PRJ)$/source + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/source$/mkinc$/fullcpp.mk + + +# --- Files -------------------------------------------------------- + +OBJFILES= \ + $(OBJ)$/hf_docentry.obj \ + $(OBJ)$/hf_funcdecl.obj \ + $(OBJ)$/hf_linachain.obj \ + $(OBJ)$/hf_navi_main.obj \ + $(OBJ)$/hf_navi_sub.obj \ + $(OBJ)$/hf_title.obj \ + $(OBJ)$/htmlfile.obj \ + $(OBJ)$/out_node.obj \ + $(OBJ)$/out_position.obj \ + $(OBJ)$/out_tree.obj \ + $(OBJ)$/outputstack.obj + + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + + diff --git a/autodoc/source/display/toolkit/out_node.cxx b/autodoc/source/display/toolkit/out_node.cxx new file mode 100644 index 000000000000..ac402e2a123b --- /dev/null +++ b/autodoc/source/display/toolkit/out_node.cxx @@ -0,0 +1,189 @@ +/************************************************************************* + * + * 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 <toolkit/out_node.hxx> + + +// NOT FULLY DEFINED SERVICES +#include <algorithm> + + +namespace output +{ + + +namespace +{ + +struct Less_NodePtr +{ + bool operator()( + Node * p1, + Node * p2 ) const + { return p1->Name() < p2->Name(); } +}; + +struct Less_NodePtr C_Less_NodePtr; + + +Node C_aNullNode(Node::null_object); + + +} // namepace anonymous + + +//********************** Node ***************************// + + +Node::Node() + : sName(), + pParent(0), + aChildren(), + nDepth(0), + nNameRoomId(0) +{ +} + +Node::Node( E_NullObject ) + : sName(), + pParent(0), + aChildren(), + nDepth(-1), + nNameRoomId(0) +{ +} + +Node::Node( const String & i_name, + Node & i_parent ) + : sName(i_name), + pParent(&i_parent), + aChildren(), + nDepth(i_parent.Depth()+1), + nNameRoomId(0) +{ +} + +Node::~Node() +{ + for ( List::iterator it = aChildren.begin(); + it != aChildren.end(); + ++it ) + { + delete *it; + } +} + +Node & +Node::Provide_Child( const String & i_name ) +{ + Node * + ret = find_Child(i_name); + if (ret != 0) + return *ret; + return add_Child(i_name); +} + +void +Node::Get_Path( StreamStr & o_result, + intt i_maxDepth ) const +{ + // Intentionally 'i_maxDepth != 0', so max_Depth == -1 sets no limit: + if (i_maxDepth != 0) + { + if (pParent != 0) + pParent->Get_Path(o_result, i_maxDepth-1); + o_result << sName << '/'; + } +} + +void +Node::Get_Chain( StringVector & o_result, + intt i_maxDepth ) const +{ + if (i_maxDepth != 0) + { + // This is called also for the toplevel Node, + // but there happens nothing: + if (pParent != 0) + { + pParent->Get_Chain(o_result, i_maxDepth-1); + o_result.push_back(sName); + } + } +} + +Node * +Node::find_Child( const String & i_name ) +{ + Node aSearch; + aSearch.sName = i_name; + + List::const_iterator + ret = std::lower_bound( aChildren.begin(), + aChildren.end(), + &aSearch, + C_Less_NodePtr ); + if ( ret != aChildren.end() ? (*ret)->Name() == i_name : false ) + return *ret; + + return 0; +} + +Node & +Node::add_Child( const String & i_name ) +{ + DYN Node * + pNew = new Node(i_name,*this); + aChildren.insert( std::lower_bound( aChildren.begin(), + aChildren.end(), + pNew, + C_Less_NodePtr ), + pNew ); + return *pNew; +} + +Node & +Node::provide_Child( StringVector::const_iterator i_next, + StringVector::const_iterator i_end ) +{ + if (i_next == i_end) + return *this; + return Provide_Child(*i_next).provide_Child(i_next+1,i_end); +} + + + + +Node & +Node::Null_() +{ + return C_aNullNode; +} + + +} // namespace output diff --git a/autodoc/source/display/toolkit/out_position.cxx b/autodoc/source/display/toolkit/out_position.cxx new file mode 100644 index 000000000000..735732014b80 --- /dev/null +++ b/autodoc/source/display/toolkit/out_position.cxx @@ -0,0 +1,239 @@ +/************************************************************************* + * + * 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 <toolkit/out_position.hxx> + + +// NOT FULLY DEFINED SERVICES + + + +namespace output +{ + + + +namespace +{ + +const int C_nAssumedMaxLinkLength = 500; + +void move_ToParent( + Node * & io_node, + intt i_levels = 1 ); + +void +move_ToParent( Node * & io_node, + intt i_levels ) +{ + for ( intt n = 0; n < i_levels; ++n ) + { + csv_assert(io_node != 0); + io_node = io_node->Parent(); + } +} + + + +} // namepace anonymous + + + +Position::Position() + : sFile(), + pDirectory(&Node::Null_()) +{ +} + + +Position::Position( Node & i_directory, + const String & i_file ) + : sFile(i_file), + pDirectory(&i_directory) +{ +} + +Position::Position( const Position & i_directory, + const String & i_sDifferentFile ) + : sFile(i_sDifferentFile), + pDirectory(i_directory.pDirectory) +{ +} + + +Position::~Position() +{ +} + + +Position & +Position::operator=( Node & i_node ) +{ + pDirectory = &i_node; + sFile.clear(); + return *this; +} + +Position & +Position::operator+=( const String & i_nodeName ) +{ + csv_assert(pDirectory != 0); + + pDirectory = &pDirectory->Provide_Child(i_nodeName); + sFile.clear(); + + return *this; +} + +Position & +Position::operator-=( intt i_levels ) +{ + csv_assert(pDirectory != 0); + + for ( intt i = i_levels; i > 0; --i ) + { + pDirectory = pDirectory->Parent(); + if (pDirectory == 0) + { + pDirectory = &Node::Null_(); + i = 0; + } + } + sFile.clear(); + + return *this; +} + +String +Position::LinkToRoot( const String & ) const +{ + StreamLock sl(C_nAssumedMaxLinkLength); + return sl() << get_UpLink(Depth()) << c_str; +} + +void +Position::Get_LinkTo( StreamStr & o_result, + const Position & i_destination, + const String & i_localLabel ) const +{ + Node * p1 = pDirectory; + Node * p2 = i_destination.pDirectory; + + intt diff = Depth() - i_destination.Depth(); + intt pathLength1 = 0; + intt pathLength2 = 0; + + if ( diff > 0 ) + { + pathLength1 = diff; + move_ToParent(p1,pathLength1); + } + else if ( diff < 0 ) + { + pathLength2 = -diff; + move_ToParent(p2,pathLength2); + } + + while ( p1 != p2 ) + { + move_ToParent(p1); + move_ToParent(p2); + ++pathLength1; + ++pathLength2; + } + + o_result << get_UpLink(pathLength1); + i_destination.pDirectory->Get_Path(o_result, pathLength2); + o_result << i_destination.sFile; + if (i_localLabel.length()) + o_result << "#" << i_localLabel; +} + +void +Position::Get_LinkToRoot( StreamStr & o_result, + const String & ) const +{ + o_result << get_UpLink(Depth()); +} + +void +Position::Set( Node & i_node, + const String & i_file ) +{ + sFile = i_file; + pDirectory = &i_node; +} + + + + +const char * +get_UpLink(uintt i_depth) +{ + static const uintt + C_nMaxDepth = 30; + static const char + C_sUpLinkArray[3*C_nMaxDepth+1] = + "../../../../../../../../../../" + "../../../../../../../../../../" + "../../../../../../../../../../"; + static const char * + C_sUpLink = &C_sUpLinkArray[0]; + + if ( i_depth <= C_nMaxDepth ) + { + return C_sUpLink + 3*(C_nMaxDepth - i_depth); + } + else + { // not THREAD fast + static std::vector<char> + aRet; + uintt nNeededSize = i_depth * 3 + 1; + + if (aRet.size() < nNeededSize) + { + aRet.resize(nNeededSize); + char * pEnd = &aRet[nNeededSize-1]; + *pEnd = '\0'; + + for ( char * pFill = &(*aRet.begin()); + pFill != pEnd; + pFill += 3 ) + { + memcpy(pFill, C_sUpLink, 3); + } + } // end if + + return &aRet[aRet.size() - 1 - 3*i_depth]; + } +} + + + + +} // namespace output diff --git a/autodoc/source/display/toolkit/out_tree.cxx b/autodoc/source/display/toolkit/out_tree.cxx new file mode 100644 index 000000000000..73c7d2192e76 --- /dev/null +++ b/autodoc/source/display/toolkit/out_tree.cxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * 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 <toolkit/out_tree.hxx> + + +// NOT FULLY DEFINED SERVICES + + +namespace output +{ + +Tree::Tree() + : pRoot(new Node), + pNamesRoot(pRoot.Ptr()), + pIndexRoot(pRoot.Ptr()), + pProjectsRoot(pRoot.Ptr()), + aOverview() +{ +} + +Tree::~Tree() +{ +} + + + +} // namespace output diff --git a/autodoc/source/display/toolkit/outputstack.cxx b/autodoc/source/display/toolkit/outputstack.cxx new file mode 100644 index 000000000000..19573dc4fe75 --- /dev/null +++ b/autodoc/source/display/toolkit/outputstack.cxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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 <toolkit/outputstack.hxx> + + +// NOT FULLY DEFINED SERVICES + + + +OutputStack::OutputStack() +{ +} + +OutputStack::~OutputStack() +{ +} + +void +OutputStack::Enter( csi::xml::Element & io_rDestination ) +{ + aCurDestination.push(&io_rDestination); +} + +void +OutputStack::Leave() +{ + csv_assert( NOT aCurDestination.empty() ); + aCurDestination.pop(); +} + + + |