diff options
Diffstat (limited to 'autodoc/source/display/toolkit')
-rw-r--r-- | autodoc/source/display/toolkit/hf_docentry.cxx | 74 | ||||
-rw-r--r-- | autodoc/source/display/toolkit/hf_funcdecl.cxx | 203 | ||||
-rw-r--r-- | autodoc/source/display/toolkit/hf_linachain.cxx | 110 | ||||
-rw-r--r-- | autodoc/source/display/toolkit/hf_navi_main.cxx | 238 | ||||
-rw-r--r-- | autodoc/source/display/toolkit/hf_navi_sub.cxx | 103 | ||||
-rw-r--r-- | autodoc/source/display/toolkit/hf_title.cxx | 169 | ||||
-rw-r--r-- | autodoc/source/display/toolkit/htmlfile.cxx | 211 | ||||
-rw-r--r-- | autodoc/source/display/toolkit/makefile.mk | 64 | ||||
-rw-r--r-- | autodoc/source/display/toolkit/out_node.cxx | 189 | ||||
-rw-r--r-- | autodoc/source/display/toolkit/out_position.cxx | 239 | ||||
-rw-r--r-- | autodoc/source/display/toolkit/out_tree.cxx | 53 | ||||
-rw-r--r-- | autodoc/source/display/toolkit/outputstack.cxx | 58 |
12 files changed, 1711 insertions, 0 deletions
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(); +} + + + |