1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #include <precomp.h> 29 #include <toolkit/hf_funcdecl.hxx> 30 31 32 // NOT FULLY DEFINED SERVICES 33 34 const String C_sValignTop("top"); 35 const String C_sValignBottom("bottom"); 36 37 38 39 HF_FunctionDeclaration::HF_FunctionDeclaration( Xml::Element & o_rParent, 40 const String & i_sRaisesText ) 41 : HtmlMaker(o_rParent), 42 sRaisesText(i_sRaisesText), 43 pTable(0), 44 pReturnCell(0), 45 pNameCell(0), 46 pParameterLine(0), 47 pLastParameterCell(0), 48 pExceptionCell(0) 49 { 50 pTable = new Html::Table; 51 CurOut() 52 >> *pTable 53 << new Html::ClassAttr("table-in-method") 54 << new Xml::AnAttribute("border","0"); 55 } 56 57 HF_FunctionDeclaration::~HF_FunctionDeclaration() 58 { 59 } 60 61 Xml::Element & 62 HF_FunctionDeclaration::ReturnCell() 63 { 64 if (pReturnCell != 0) 65 return *pReturnCell; 66 67 pReturnCell = &( *pTable 68 >> *new Html::TableRow 69 >> *new Html::TableCell 70 << new Html::VAlignAttr(C_sValignTop) 71 << new Xml::AnAttribute("colspan", "3") 72 ); 73 return *pReturnCell; 74 } 75 76 Xml::Element & 77 HF_FunctionDeclaration::NameCell() 78 { 79 if (pNameCell != 0) 80 return *pNameCell; 81 82 pNameCell = &( ParameterLine() 83 >> *new Html::TableCell 84 << new Html::VAlignAttr(C_sValignTop) 85 ); 86 pLastParameterCell = pNameCell; 87 88 return *pNameCell; 89 } 90 91 Xml::Element & 92 HF_FunctionDeclaration::NewParamTypeCell() 93 { 94 if (pLastParameterCell != pNameCell) 95 { 96 pParameterLine = 0; 97 ParameterLine() 98 >> *new Html::TableCell; 99 } 100 101 Xml::Element & 102 rParamType = ParameterLine() 103 >> *new Html::TableCell 104 << new Html::VAlignAttr(C_sValignTop); 105 pLastParameterCell 106 = &( ParameterLine() 107 >> *new Html::TableCell 108 << new Html::VAlignAttr(C_sValignBottom) 109 << new Xml::XmlCode(" ") 110 ); 111 return rParamType; 112 } 113 114 Xml::Element & 115 HF_FunctionDeclaration::ParamNameCell() 116 { 117 csv_assert(pLastParameterCell != pNameCell); 118 return *pLastParameterCell; 119 } 120 121 Xml::Element & 122 HF_FunctionDeclaration::ExceptionCell() 123 { 124 if (pExceptionCell != 0) 125 return *pExceptionCell; 126 127 Xml::Element & 128 rExceptionRow = *pTable 129 >> *new Html::TableRow; 130 rExceptionRow 131 >> *new Html::TableCell 132 << new Html::VAlignAttr(C_sValignTop) 133 << new Xml::AnAttribute("align", "right") 134 << sRaisesText 135 << "( "; 136 137 pExceptionCell = &( rExceptionRow 138 >> *new Html::TableCell 139 << new Html::VAlignAttr(C_sValignTop) 140 << new Xml::AnAttribute("colspan", "2") 141 ); 142 return *pExceptionCell; 143 } 144 145 Html::TableRow & 146 HF_FunctionDeclaration::ParameterLine() 147 { 148 if (pParameterLine != 0) 149 return *pParameterLine; 150 151 pParameterLine = new Html::TableRow; 152 *pTable 153 >> *pParameterLine; 154 155 return *pParameterLine; 156 } 157 158 159 #if 0 // old 160 HF_FunctionDeclaration::HF_FunctionDeclaration( Xml::Element & o_rParent ) 161 : HtmlMaker(o_rParent), 162 pFront(0), 163 pTypes(0), 164 pNames(0) 165 { 166 Xml::Element & 167 rRow = CurOut() 168 >> *new Html::Table 169 << new Xml::AnAttribute("border","0") 170 >> *new Html::TableRow; 171 pFront = &(rRow >> *new Html::TableCell << new Html::VAlignAttr(C_sValignTop)); 172 pTypes = &(rRow >> *new Html::TableCell << new Html::VAlignAttr(C_sValignTop)); 173 pNames = &(rRow >> *new Html::TableCell << new Html::VAlignAttr(C_sValignTop)); 174 } 175 176 HF_FunctionDeclaration::~HF_FunctionDeclaration() 177 { 178 } 179 180 Xml::Element & 181 HF_FunctionDeclaration::Add_ReturnLine() 182 { 183 (*pTypes) << new Xml::XmlCode(" <br>\n"); 184 (*pNames) << new Xml::XmlCode(" <br>\n"); 185 return *pFront; 186 } 187 188 Xml::Element & 189 HF_FunctionDeclaration::Add_RaisesLine( const char * i_sRaisesText, 190 bool i_bSuppressExtraLine ) 191 { 192 if (NOT i_bSuppressExtraLine) 193 { 194 (*pTypes) << new Xml::XmlCode(" <br>"); 195 (*pNames) << new Xml::XmlCode(" <br>\n"); 196 } 197 (*pTypes) 198 << new Xml::XmlCode("<p class=\"raise\">") 199 << i_sRaisesText 200 << new Xml::XmlCode("( </p>\n"); 201 return *pNames; 202 } 203 #endif // 0 old 204