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_interface.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_interface.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <ary/idl/i_ce.hxx>
37 #include <ary/idl/i_gate.hxx>
38 #include <ary/idl/ik_function.hxx>
39 #include <ary/idl/ik_interface.hxx>
40 #include <ary/idl/ip_ce.hxx>
41 #include <ary/idl/ip_type.hxx>
42 #include <toolkit/hf_docentry.hxx>
43 #include <toolkit/hf_linachain.hxx>
44 #include <toolkit/hf_navi_sub.hxx>
45 #include <toolkit/hf_title.hxx>
46 #include "hfi_doc.hxx"
47 #include "hfi_hierarchy.hxx"
48 #include "hfi_method.hxx"
49 #include "hfi_navibar.hxx"
50 #include "hfi_property.hxx"
51 #include "hfi_tag.hxx"
52 #include "hfi_typetext.hxx"
53 #include "hi_linkhelper.hxx"
57 C_sCePrefix_Interface("interface");
63 C_sBaseInterface("Base Interfaces");
65 C_sList_BaseComments("Comments on Base Interfaces");
67 C_sList_Methods("Methods' Summary");
69 C_sList_Methods_Label("MethodsSummary");
71 C_sDetails_Methods("Methods' Details");
73 C_sDetails_Methods_Label("MethodsDetails");
76 C_sList_Attributes("Attributes' Summary");
78 C_sList_Attributes_Label("AttributesSummary");
80 C_sList_AttributesDetails("Attributes' Details");
82 C_sList_AttributesDetails_Label("AttributesDetails");
88 sli_MethodsSummay
= 0,
89 sli_AttributesSummary
= 1,
90 sli_MethodDetails
= 2,
91 sli_AttributesDetails
= 3
94 } //anonymous namespace
99 HF_IdlInterface::HF_IdlInterface( Environment
& io_rEnv
,
100 Xml::Element
& o_rOut
)
101 : HtmlFactory_Idl(io_rEnv
, &o_rOut
),
102 eCurProducedMembers(mem_none
)
106 HF_IdlInterface::~HF_IdlInterface()
111 HF_IdlInterface::Produce_byData( const client
& i_ce
) const
114 pNaviSubRow( &make_Navibar(i_ce
) );
120 aNameChain(aTitle
.Add_Row());
121 aNameChain
.Produce_CompleteChain(Env().CurPosition(), nameChainLinker
);
123 produce_Title(aTitle
, C_sCePrefix_Interface
, i_ce
);
125 produce_BaseHierarchy( aTitle
.Add_Row(),
129 write_Docu(aTitle
.Add_Row(), i_ce
);
130 CurOut() << new Html::HorizontalLine();
132 dyn_ce_list dpFunctions
;
133 ary::idl::ifc_interface::attr::Get_Functions(dpFunctions
, i_ce
);
134 if ( (*dpFunctions
).operator bool() )
136 eCurProducedMembers
= mem_Functions
;
138 produce_Members( *dpFunctions
,
140 C_sList_Methods_Label
,
142 C_sDetails_Methods_Label
,
143 HtmlFactory_Idl::viewtype_summary
);
144 pNaviSubRow
->SwitchOn(sli_MethodsSummay
);
149 ary::idl::ifc_interface::attr::Get_Attributes(dpAttributes
, i_ce
);
150 if ( (*dpAttributes
).operator bool() )
152 eCurProducedMembers
= mem_Attributes
;
154 produce_Members( *dpAttributes
,
156 C_sList_Attributes_Label
,
157 C_sList_AttributesDetails
,
158 C_sList_AttributesDetails_Label
,
159 HtmlFactory_Idl::viewtype_summary
);
160 pNaviSubRow
->SwitchOn(sli_AttributesSummary
);
163 ary::idl::ifc_interface::attr::Get_Functions(dpFunctions
, i_ce
);
164 if ( (*dpFunctions
).operator bool() )
166 eCurProducedMembers
= mem_Functions
;
168 produce_Members( *dpFunctions
,
170 C_sList_Methods_Label
,
172 C_sDetails_Methods_Label
,
173 HtmlFactory_Idl::viewtype_details
);
174 pNaviSubRow
->SwitchOn(sli_MethodDetails
);
177 ary::idl::ifc_interface::attr::Get_Attributes(dpAttributes
, i_ce
);
178 if ( (*dpAttributes
).operator bool() )
180 eCurProducedMembers
= mem_Attributes
;
182 produce_Members( *dpAttributes
,
184 C_sList_Attributes_Label
,
185 C_sList_AttributesDetails
,
186 C_sList_AttributesDetails_Label
,
187 HtmlFactory_Idl::viewtype_details
);
188 pNaviSubRow
->SwitchOn(sli_AttributesDetails
);
191 eCurProducedMembers
= mem_none
;
193 pNaviSubRow
->Produce_Row();
197 HF_IdlInterface::make_Navibar( const client
& i_ce
) const
200 aNaviBar(Env(), CurOut());
201 aNaviBar
.Produce_CeMainRow(i_ce
);
204 ret
= aNaviBar
.Add_SubRow();
205 ret
.AddItem(C_sList_Methods
, C_sList_Methods_Label
, false);
206 ret
.AddItem(C_sList_Attributes
, C_sList_Attributes_Label
, false);
207 ret
.AddItem(C_sDetails_Methods
, C_sDetails_Methods_Label
, false);
208 ret
.AddItem(C_sList_AttributesDetails
, C_sList_AttributesDetails_Label
, false);
210 CurOut() << new Html::HorizontalLine();
215 HF_IdlInterface::produce_MemberDetails( HF_SubTitleTable
& o_table
,
216 const client
& i_ce
) const
218 switch (eCurProducedMembers
)
225 aAttribute( Env(), o_table
);
226 aAttribute
.Produce_byData( i_ce
);
229 default: //Won't happen.
233 typedef ary::idl::ifc_function::attr funcAttr
;
238 >> *new Html::TableCell
239 << new Html::ClassAttr(C_sCellStyle_MDetail
) );
241 ary::Dyn_StdConstIterator
<ary::idl::Parameter
>
243 funcAttr::Get_Parameters(pParameters
, i_ce
);
245 ary::Dyn_StdConstIterator
<ary::idl::Type_id
>
247 funcAttr::Get_Exceptions(pExceptions
, i_ce
);
249 aFunction
.Produce_byData( i_ce
.LocalName(),
250 funcAttr::ReturnType(i_ce
),
253 funcAttr::IsOneway(i_ce
),
254 funcAttr::HasEllipse(i_ce
),
259 HF_IdlInterface::produce_BaseHierarchy( Xml::Element
& o_screen
,
261 const String
& i_sLabel
) const
263 ary::Dyn_StdConstIterator
<ary::idl::CommentedRelation
>
265 ary::idl::ifc_interface::attr::Get_Bases(pHelp
, i_ce
);
266 if (NOT (*pHelp
).operator bool())
269 // Check for XInterface as only base:
270 ary::StdConstIterator
<ary::idl::CommentedRelation
> &
273 nCe
= Env().Gate().Types().Search_CeRelatedTo((*itTest
).Type());
277 // Rather check for id(!) of com::sun::star::uno::XInterface.
278 if (Env().Gate().Ces().Find_Ce(nCe
).LocalName() == "XInterface")
281 if (NOT itTest
.operator bool())
289 aDocList( o_screen
);
290 aDocList
.Produce_Term(i_sLabel
);
292 rBaseList
= aDocList
.Produce_Definition();
295 Write_BaseHierarchy(rBaseList
, Env(), i_ce
);
298 // KORR_FUTURE: Make sure, no empty table is constructed when comments list is empty.
300 aBaseTable( aDocList
.Produce_Definition(),
302 C_sList_BaseComments
,
304 HF_SubTitleTable::sublevel_3
);
306 ary::Dyn_StdConstIterator
<ary::idl::CommentedRelation
>
308 ary::idl::ifc_interface::attr::Get_Bases(pBases
, i_ce
);
309 for ( ary::StdConstIterator
<ary::idl::CommentedRelation
> & it
= *pBases
;
314 rRow
= aBaseTable
.Add_Row();
318 >> *new Html::TableCell
319 << new Html::ClassAttr(C_sCellStyle_SummaryLeft
);
321 aTypeDisplay( Env(), rTerm
, false, 0);
322 aTypeDisplay
.Produce_byData((*it
).Type());
326 >> *new Html::TableCell
327 << new Html::ClassAttr(C_sCellStyle_SummaryRight
);
332 if ((*it
).Info() != 0)
334 // aDocuList.Produce_Term("Comment on Base Reference");
337 aDocuDisplay(Env(), aDocuList
);
338 aDocuDisplay
.Produce_byDocu4Reference(*(*it
).Info(), i_ce
);
343 pCe
= Env().Linker().Search_CeFromType((*it
).Type());
346 ? Get_IdlDocu(pCe
->Docu())
347 : (const ce_info
*)(0);
350 aDocuList
.Produce_NormalTerm("(referenced interface's summary:)");
353 rDef
= aDocuList
.Produce_Definition();
354 HF_IdlDocuTextDisplay
355 aShortDisplay( Env(), &rDef
, *pCe
);
356 pShort
->Short().DisplayAt(aShortDisplay
);
357 } // end if (pShort != 0)
358 } // endif ( (*i_commentedRef).Info() != 0 ) else