1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hfi_method.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #include "hfi_method.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <ary/idl/i_exception.hxx>
37 #include <ary/idl/i_param.hxx>
38 #include <toolkit/hf_docentry.hxx>
39 #include <toolkit/hf_funcdecl.hxx>
40 #include "hfi_doc.hxx"
41 #include "hfi_globalindex.hxx"
42 #include "hfi_typetext.hxx"
48 HF_IdlMethod::HF_IdlMethod( Environment
& io_rEnv
,
49 Xml::Element
& o_cell
)
50 : HtmlFactory_Idl(io_rEnv
,&o_cell
)
55 HF_IdlMethod::~HF_IdlMethod()
61 HF_IdlMethod::Produce_byData( const String
& i_sName
,
62 type_id i_nReturnType
,
63 param_list
& i_rParams
,
64 type_list
& i_rExceptions
,
67 const client
& i_ce
) const
70 >> *new Html::Label(i_sName
)
71 << new Html::ClassAttr(C_sMemberTitle
)
74 write_Declaration( i_sName
,
80 CurOut() << new Html::HorizontalLine
;
81 write_Docu(CurOut(), i_ce
);
87 HF_IdlMethod::write_Declaration( const String
& i_sName
,
88 type_id i_nReturnType
,
89 param_list
& i_rParams
,
90 type_list
& i_rExceptions
,
92 bool i_bEllipse
) const
94 HF_FunctionDeclaration
97 front
= aDecl
.Add_ReturnLine();
101 front
<< "[oneway] ";
102 if (i_nReturnType
.IsValid())
103 { // Normal function, but not constructors:
105 aReturn(Env(), front
, true);
106 aReturn
.Produce_byData(i_nReturnType
);
108 << new Html::LineBreak
;
117 types
= aDecl
.Types();
119 names
= aDecl
.Names();
120 bool bParams
= i_rParams
.operator bool();
126 aType( Env(), types
, true );
128 write_Param( aType
, names
, (*i_rParams
) );
130 for (++i_rParams
; i_rParams
; ++i_rParams
)
133 << new Html::LineBreak
;
136 << new Html::LineBreak
;
137 write_Param( aType
, names
, (*i_rParams
) );
153 if ( i_rExceptions
.operator bool() )
156 rExcOut
= aDecl
.Add_RaisesLine("raises", NOT bParams
);
158 aExc(Env(), rExcOut
, true);
159 aExc
.Produce_byData(*i_rExceptions
);
161 for (++i_rExceptions
; i_rExceptions
; ++i_rExceptions
)
165 << new Html::LineBreak
;
166 aExc
.Produce_byData(*i_rExceptions
);
174 aDecl
.Names() << ";";
176 aDecl
.Front() << ";";
182 HF_IdlMethod::write_Declaration( const String
& i_sName
,
183 type_id i_nReturnType
,
184 param_list
& i_rParams
,
185 type_list
& i_rExceptions
,
187 bool i_bEllipse
) const
189 HF_FunctionDeclaration
190 aDecl(CurOut(), "raises") ;
192 rReturnLine
= aDecl
.ReturnCell();
196 rReturnLine
<< "[oneway] ";
197 if (i_nReturnType
.IsValid())
198 { // Normal function, but not constructors:
200 aReturn(Env(), rReturnLine
, true);
201 aReturn
.Produce_byData(i_nReturnType
);
206 rNameCell
= aDecl
.NameCell();
214 bool bParams
= i_rParams
.operator bool();
220 pParamEnd
= write_Param( aDecl
, *i_rParams
);
221 for (++i_rParams
; i_rParams
; ++i_rParams
)
224 pParamEnd
= write_Param( aDecl
, *i_rParams
);
230 rParamType
= aDecl
.NewParamTypeCell();
233 pParamEnd
= &rParamType
;
244 if ( i_rExceptions
.operator bool() )
247 rExcOut
= aDecl
.ExceptionCell();
249 aExc(Env(), rExcOut
, true);
250 aExc
.Produce_byData(*i_rExceptions
);
252 for (++i_rExceptions
; i_rExceptions
; ++i_rExceptions
)
256 << new Html::LineBreak
;
257 aExc
.Produce_byData(*i_rExceptions
);
274 HF_IdlMethod::write_Param( HF_IdlTypeText
& o_type
,
275 Xml::Element
& o_names
,
276 const ary::idl::Parameter
& i_param
) const
278 switch ( i_param
.Direction() )
280 case ary::idl::param_in
:
281 o_type
.CurOut() << "[in] ";
283 case ary::idl::param_out
:
284 o_type
.CurOut() << "[out] ";
286 case ary::idl::param_inout
:
287 o_type
.CurOut() << "[inout] ";
291 o_type
.Produce_byData( i_param
.Type() );
298 HF_IdlMethod::write_Param( HF_FunctionDeclaration
& o_decl
,
299 const ary::idl::Parameter
& i_param
) const
302 rTypeCell
= o_decl
.NewParamTypeCell();
304 rNameCell
= o_decl
.ParamNameCell();
306 switch ( i_param
.Direction() )
308 case ary::idl::param_in
:
309 rTypeCell
<< "[in] ";
311 case ary::idl::param_out
:
312 rTypeCell
<< "[out] ";
314 case ary::idl::param_inout
:
315 rTypeCell
<< "[inout] ";
320 aTypeWriter(Env(), rTypeCell
, true);
321 aTypeWriter
.Produce_byData( i_param
.Type() );
328 const String
sContentBorder("0");
329 const String
sContentWidth("96%");
330 const String
sContentPadding("5");
331 const String
sContentSpacing("0");
333 const String
sBgWhite("#ffffff");
334 const String
sCenter("center");
337 HF_IdlMethod::enter_ContentCell() const
341 rContentCell
= CurOut()
342 >> *new Html::Table( sContentBorder
,
346 << new Html::ClassAttr("table-in-method")
347 << new Html::BgColorAttr(sBgWhite
)
348 << new Html::AlignAttr(sCenter
)
349 >> *new Html::TableRow
350 >> *new Html::TableCell
;
351 Out().Enter(rContentCell
);
356 HF_IdlMethod::leave_ContentCell() const