1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include "hfi_interface.hxx"
33 // NOT FULLY DEFINED SERVICES
34 #include <ary/idl/i_ce.hxx>
35 #include <ary/idl/i_gate.hxx>
36 #include <ary/idl/ik_function.hxx>
37 #include <ary/idl/ik_interface.hxx>
38 #include <ary/idl/ip_ce.hxx>
39 #include <ary/idl/ip_type.hxx>
40 #include <toolkit/hf_docentry.hxx>
41 #include <toolkit/hf_linachain.hxx>
42 #include <toolkit/hf_navi_sub.hxx>
43 #include <toolkit/hf_title.hxx>
44 #include "hfi_doc.hxx"
45 #include "hfi_hierarchy.hxx"
46 #include "hfi_method.hxx"
47 #include "hfi_navibar.hxx"
48 #include "hfi_property.hxx"
49 #include "hfi_tag.hxx"
50 #include "hfi_typetext.hxx"
51 #include "hi_linkhelper.hxx"
55 C_sCePrefix_Interface("interface");
61 C_sBaseInterface("Base Interfaces");
63 C_sList_BaseComments("Comments on Base Interfaces");
65 C_sList_Methods("Methods' Summary");
67 C_sList_Methods_Label("MethodsSummary");
69 C_sDetails_Methods("Methods' Details");
71 C_sDetails_Methods_Label("MethodsDetails");
74 C_sList_Attributes("Attributes' Summary");
76 C_sList_Attributes_Label("AttributesSummary");
78 C_sList_AttributesDetails("Attributes' Details");
80 C_sList_AttributesDetails_Label("AttributesDetails");
86 sli_MethodsSummay
= 0,
87 sli_AttributesSummary
= 1,
88 sli_MethodDetails
= 2,
89 sli_AttributesDetails
= 3
92 } //anonymous namespace
97 HF_IdlInterface::HF_IdlInterface( Environment
& io_rEnv
,
98 Xml::Element
& o_rOut
)
99 : HtmlFactory_Idl(io_rEnv
, &o_rOut
),
100 eCurProducedMembers(mem_none
)
104 HF_IdlInterface::~HF_IdlInterface()
109 HF_IdlInterface::Produce_byData( const client
& i_ce
) const
112 pNaviSubRow( &make_Navibar(i_ce
) );
118 aNameChain(aTitle
.Add_Row());
119 aNameChain
.Produce_CompleteChain(Env().CurPosition(), nameChainLinker
);
121 produce_Title(aTitle
, C_sCePrefix_Interface
, i_ce
);
123 produce_BaseHierarchy( aTitle
.Add_Row(),
127 write_Docu(aTitle
.Add_Row(), i_ce
);
128 CurOut() << new Html::HorizontalLine();
130 dyn_ce_list dpFunctions
;
131 ary::idl::ifc_interface::attr::Get_Functions(dpFunctions
, i_ce
);
132 if ( (*dpFunctions
).operator bool() )
134 eCurProducedMembers
= mem_Functions
;
136 produce_Members( *dpFunctions
,
138 C_sList_Methods_Label
,
140 C_sDetails_Methods_Label
,
141 HtmlFactory_Idl::viewtype_summary
);
142 pNaviSubRow
->SwitchOn(sli_MethodsSummay
);
147 ary::idl::ifc_interface::attr::Get_Attributes(dpAttributes
, i_ce
);
148 if ( (*dpAttributes
).operator bool() )
150 eCurProducedMembers
= mem_Attributes
;
152 produce_Members( *dpAttributes
,
154 C_sList_Attributes_Label
,
155 C_sList_AttributesDetails
,
156 C_sList_AttributesDetails_Label
,
157 HtmlFactory_Idl::viewtype_summary
);
158 pNaviSubRow
->SwitchOn(sli_AttributesSummary
);
161 ary::idl::ifc_interface::attr::Get_Functions(dpFunctions
, i_ce
);
162 if ( (*dpFunctions
).operator bool() )
164 eCurProducedMembers
= mem_Functions
;
166 produce_Members( *dpFunctions
,
168 C_sList_Methods_Label
,
170 C_sDetails_Methods_Label
,
171 HtmlFactory_Idl::viewtype_details
);
172 pNaviSubRow
->SwitchOn(sli_MethodDetails
);
175 ary::idl::ifc_interface::attr::Get_Attributes(dpAttributes
, i_ce
);
176 if ( (*dpAttributes
).operator bool() )
178 eCurProducedMembers
= mem_Attributes
;
180 produce_Members( *dpAttributes
,
182 C_sList_Attributes_Label
,
183 C_sList_AttributesDetails
,
184 C_sList_AttributesDetails_Label
,
185 HtmlFactory_Idl::viewtype_details
);
186 pNaviSubRow
->SwitchOn(sli_AttributesDetails
);
189 eCurProducedMembers
= mem_none
;
191 pNaviSubRow
->Produce_Row();
195 HF_IdlInterface::make_Navibar( const client
& i_ce
) const
198 aNaviBar(Env(), CurOut());
199 aNaviBar
.Produce_CeMainRow(i_ce
);
202 ret
= aNaviBar
.Add_SubRow();
203 ret
.AddItem(C_sList_Methods
, C_sList_Methods_Label
, false);
204 ret
.AddItem(C_sList_Attributes
, C_sList_Attributes_Label
, false);
205 ret
.AddItem(C_sDetails_Methods
, C_sDetails_Methods_Label
, false);
206 ret
.AddItem(C_sList_AttributesDetails
, C_sList_AttributesDetails_Label
, false);
208 CurOut() << new Html::HorizontalLine();
213 HF_IdlInterface::produce_MemberDetails( HF_SubTitleTable
& o_table
,
214 const client
& i_ce
) const
216 switch (eCurProducedMembers
)
223 aAttribute( Env(), o_table
);
224 aAttribute
.Produce_byData( i_ce
);
227 default: //Won't happen.
231 typedef ary::idl::ifc_function::attr funcAttr
;
236 >> *new Html::TableCell
237 << new Html::ClassAttr(C_sCellStyle_MDetail
) );
239 ary::Dyn_StdConstIterator
<ary::idl::Parameter
>
241 funcAttr::Get_Parameters(pParameters
, i_ce
);
243 ary::Dyn_StdConstIterator
<ary::idl::Type_id
>
245 funcAttr::Get_Exceptions(pExceptions
, i_ce
);
247 aFunction
.Produce_byData( i_ce
.LocalName(),
248 funcAttr::ReturnType(i_ce
),
251 funcAttr::IsOneway(i_ce
),
252 funcAttr::HasEllipse(i_ce
),
257 HF_IdlInterface::produce_BaseHierarchy( Xml::Element
& o_screen
,
259 const String
& i_sLabel
) const
261 ary::Dyn_StdConstIterator
<ary::idl::CommentedRelation
>
263 ary::idl::ifc_interface::attr::Get_Bases(pHelp
, i_ce
);
264 if (NOT (*pHelp
).operator bool())
267 // Check for XInterface as only base:
268 ary::StdConstIterator
<ary::idl::CommentedRelation
> &
271 nCe
= Env().Gate().Types().Search_CeRelatedTo((*itTest
).Type());
275 // Rather check for id(!) of com::sun::star::uno::XInterface.
276 if (Env().Gate().Ces().Find_Ce(nCe
).LocalName() == "XInterface")
279 if (NOT itTest
.operator bool())
287 aDocList( o_screen
);
288 aDocList
.Produce_Term(i_sLabel
);
290 rBaseList
= aDocList
.Produce_Definition();
293 Write_BaseHierarchy(rBaseList
, Env(), i_ce
);
296 // KORR_FUTURE: Make sure, no empty table is constructed when comments list is empty.
298 aBaseTable( aDocList
.Produce_Definition(),
300 C_sList_BaseComments
,
302 HF_SubTitleTable::sublevel_3
);
304 ary::Dyn_StdConstIterator
<ary::idl::CommentedRelation
>
306 ary::idl::ifc_interface::attr::Get_Bases(pBases
, i_ce
);
307 for ( ary::StdConstIterator
<ary::idl::CommentedRelation
> & it
= *pBases
;
312 rRow
= aBaseTable
.Add_Row();
316 >> *new Html::TableCell
317 << new Html::ClassAttr(C_sCellStyle_SummaryLeft
);
319 aTypeDisplay( Env(), rTerm
, false, 0);
320 aTypeDisplay
.Produce_byData((*it
).Type());
324 >> *new Html::TableCell
325 << new Html::ClassAttr(C_sCellStyle_SummaryRight
);
330 if ((*it
).Info() != 0)
332 // aDocuList.Produce_Term("Comment on Base Reference");
335 aDocuDisplay(Env(), aDocuList
);
336 aDocuDisplay
.Produce_fromReference(*(*it
).Info(), i_ce
);
341 pCe
= Env().Linker().Search_CeFromType((*it
).Type());
344 ? Get_IdlDocu(pCe
->Docu())
345 : (const ce_info
*)(0);
348 aDocuList
.Produce_NormalTerm("(referenced interface's summary:)");
351 rDef
= aDocuList
.Produce_Definition();
352 HF_IdlDocuTextDisplay
353 aShortDisplay( Env(), &rDef
, *pCe
);
354 pShort
->Short().DisplayAt(aShortDisplay
);
355 } // end if (pShort != 0)
356 } // endif ( (*i_commentedRef).Info() != 0 ) else
360 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */