fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / autodoc / source / display / idl / hfi_method.cxx
blobb351161f6e45365fdcb276fd32b4cda17e83e3c3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <precomp.h>
21 #include "hfi_method.hxx"
24 // NOT FULLY DEFINED SERVICES
25 #include <ary/idl/i_exception.hxx>
26 #include <ary/idl/i_param.hxx>
27 #include <toolkit/hf_docentry.hxx>
28 #include <toolkit/hf_funcdecl.hxx>
29 #include "hfi_doc.hxx"
30 #include "hfi_globalindex.hxx"
31 #include "hfi_typetext.hxx"
37 HF_IdlMethod::HF_IdlMethod( Environment & io_rEnv,
38 Xml::Element & o_cell)
39 : HtmlFactory_Idl(io_rEnv,&o_cell)
44 HF_IdlMethod::~HF_IdlMethod()
49 void
50 HF_IdlMethod::Produce_byData( const String & i_sName,
51 type_id i_nReturnType,
52 param_list & i_rParams,
53 type_list & i_rExceptions,
54 bool i_bOneway,
55 bool i_bEllipse,
56 const client & i_ce ) const
58 CurOut()
59 >> *new Html::Label(i_sName)
60 << new Html::ClassAttr(C_sMemberTitle)
61 << i_sName;
62 enter_ContentCell();
63 write_Declaration( i_sName,
64 i_nReturnType,
65 i_rParams,
66 i_rExceptions,
67 i_bOneway,
68 i_bEllipse );
69 CurOut() << new Html::HorizontalLine;
70 write_Docu(CurOut(), i_ce);
71 leave_ContentCell();
74 void
75 HF_IdlMethod::write_Declaration( const String & i_sName,
76 type_id i_nReturnType,
77 param_list & i_rParams,
78 type_list & i_rExceptions,
79 bool i_bOneway,
80 bool i_bEllipse ) const
82 HF_FunctionDeclaration
83 aDecl(CurOut(), "raises") ;
84 Xml::Element &
85 rReturnLine = aDecl.ReturnCell();
87 // Return line:
88 if (i_bOneway)
89 rReturnLine << "[oneway] ";
90 if (i_nReturnType.IsValid())
91 { // Normal function, but not constructors:
92 HF_IdlTypeText
93 aReturn(Env(), rReturnLine);
94 aReturn.Produce_byData(i_nReturnType);
97 // Main line:
98 Xml::Element &
99 rNameCell = aDecl.NameCell();
100 rNameCell
101 >> *new Html::Bold
102 << i_sName;
104 Xml::Element *
105 pParamEnd = 0;
107 bool bParams = i_rParams.operator bool();
108 if (bParams)
110 rNameCell
111 << "(";
113 pParamEnd = write_Param( aDecl, *i_rParams );
114 for (++i_rParams; i_rParams; ++i_rParams)
116 *pParamEnd << ",";
117 pParamEnd = write_Param( aDecl, *i_rParams );
118 } // end for
120 if (i_bEllipse)
122 Xml::Element &
123 rParamType = aDecl.NewParamTypeCell();
124 rParamType
125 << " ...";
126 pParamEnd = &rParamType;
128 *pParamEnd
129 << " )";
131 else
133 rNameCell
134 << "()";
137 if ( i_rExceptions.operator bool() )
139 Xml::Element &
140 rExcOut = aDecl.ExceptionCell();
141 HF_IdlTypeText
142 aExc(Env(), rExcOut);
143 aExc.Produce_byData(*i_rExceptions);
145 for (++i_rExceptions; i_rExceptions; ++i_rExceptions)
147 rExcOut
148 << ","
149 << new Html::LineBreak;
150 aExc.Produce_byData(*i_rExceptions);
151 } // end for
153 rExcOut << " );";
155 else if (bParams)
157 *pParamEnd << ";";
159 else
161 rNameCell << ";";
165 Xml::Element *
166 HF_IdlMethod::write_Param( HF_FunctionDeclaration & o_decl,
167 const ary::idl::Parameter & i_param ) const
169 Xml::Element &
170 rTypeCell = o_decl.NewParamTypeCell();
171 Xml::Element &
172 rNameCell = o_decl.ParamNameCell();
174 switch ( i_param.Direction() )
176 case ary::idl::param_in:
177 rTypeCell << "[in] ";
178 break;
179 case ary::idl::param_out:
180 rTypeCell << "[out] ";
181 break;
182 case ary::idl::param_inout:
183 rTypeCell << "[inout] ";
184 break;
185 } // end switch
187 HF_IdlTypeText
188 aTypeWriter(Env(), rTypeCell);
189 aTypeWriter.Produce_byData( i_param.Type() );
191 rNameCell
192 << i_param.Name();
193 return &rNameCell;
196 const String sContentBorder("0");
197 const String sContentWidth("96%");
198 const String sContentPadding("5");
199 const String sContentSpacing("0");
201 const String sBgWhite("#ffffff");
202 const String sCenter("center");
204 void
205 HF_IdlMethod::enter_ContentCell() const
208 Xml::Element &
209 rContentCell = CurOut()
210 >> *new Html::Table( sContentBorder,
211 sContentWidth,
212 sContentPadding,
213 sContentSpacing )
214 << new Html::ClassAttr("table-in-method")
215 << new Html::BgColorAttr(sBgWhite)
216 << new Html::AlignAttr(sCenter)
217 >> *new Html::TableRow
218 >> *new Html::TableCell;
219 Out().Enter(rContentCell);
223 void
224 HF_IdlMethod::leave_ContentCell() const
226 Out().Leave();
229 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */