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