1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #include "hfi_interface.hxx"
24 // NOT FULLY DEFINED SERVICES
25 #include <ary/idl/i_ce.hxx>
26 #include <ary/idl/i_gate.hxx>
27 #include <ary/idl/ik_function.hxx>
28 #include <ary/idl/ik_interface.hxx>
29 #include <ary/idl/ip_ce.hxx>
30 #include <ary/idl/ip_type.hxx>
31 #include <toolkit/hf_docentry.hxx>
32 #include <toolkit/hf_linachain.hxx>
33 #include <toolkit/hf_navi_sub.hxx>
34 #include <toolkit/hf_title.hxx>
35 #include "hfi_doc.hxx"
36 #include "hfi_hierarchy.hxx"
37 #include "hfi_method.hxx"
38 #include "hfi_navibar.hxx"
39 #include "hfi_property.hxx"
40 #include "hfi_tag.hxx"
41 #include "hfi_typetext.hxx"
42 #include "hi_linkhelper.hxx"
46 C_sCePrefix_Interface("interface");
52 C_sBaseInterface("Base Interfaces");
54 C_sList_BaseComments("Comments on Base Interfaces");
56 C_sList_Methods("Methods' Summary");
58 C_sList_Methods_Label("MethodsSummary");
60 C_sDetails_Methods("Methods' Details");
62 C_sDetails_Methods_Label("MethodsDetails");
65 C_sList_Attributes("Attributes' Summary");
67 C_sList_Attributes_Label("AttributesSummary");
69 C_sList_AttributesDetails("Attributes' Details");
71 C_sList_AttributesDetails_Label("AttributesDetails");
77 sli_MethodsSummay
= 0,
78 sli_AttributesSummary
= 1,
79 sli_MethodDetails
= 2,
80 sli_AttributesDetails
= 3
83 } //anonymous namespace
88 HF_IdlInterface::HF_IdlInterface( Environment
& io_rEnv
,
89 Xml::Element
& o_rOut
)
90 : HtmlFactory_Idl(io_rEnv
, &o_rOut
),
91 eCurProducedMembers(mem_none
)
95 HF_IdlInterface::~HF_IdlInterface()
100 HF_IdlInterface::Produce_byData( const client
& i_ce
) const
103 pNaviSubRow( &make_Navibar(i_ce
) );
109 aNameChain(aTitle
.Add_Row());
110 aNameChain
.Produce_CompleteChain(Env().CurPosition(), nameChainLinker
);
112 produce_Title(aTitle
, C_sCePrefix_Interface
, i_ce
);
114 produce_BaseHierarchy( aTitle
.Add_Row(),
118 write_Docu(aTitle
.Add_Row(), i_ce
);
119 CurOut() << new Html::HorizontalLine();
121 dyn_ce_list dpFunctions
;
122 ary::idl::ifc_interface::attr::Get_Functions(dpFunctions
, i_ce
);
123 if ( (*dpFunctions
).operator bool() )
125 eCurProducedMembers
= mem_Functions
;
127 produce_Members( *dpFunctions
,
129 C_sList_Methods_Label
,
131 C_sDetails_Methods_Label
,
132 HtmlFactory_Idl::viewtype_summary
);
133 pNaviSubRow
->SwitchOn(sli_MethodsSummay
);
138 ary::idl::ifc_interface::attr::Get_Attributes(dpAttributes
, i_ce
);
139 if ( (*dpAttributes
).operator bool() )
141 eCurProducedMembers
= mem_Attributes
;
143 produce_Members( *dpAttributes
,
145 C_sList_Attributes_Label
,
146 C_sList_AttributesDetails
,
147 C_sList_AttributesDetails_Label
,
148 HtmlFactory_Idl::viewtype_summary
);
149 pNaviSubRow
->SwitchOn(sli_AttributesSummary
);
152 ary::idl::ifc_interface::attr::Get_Functions(dpFunctions
, i_ce
);
153 if ( (*dpFunctions
).operator bool() )
155 eCurProducedMembers
= mem_Functions
;
157 produce_Members( *dpFunctions
,
159 C_sList_Methods_Label
,
161 C_sDetails_Methods_Label
,
162 HtmlFactory_Idl::viewtype_details
);
163 pNaviSubRow
->SwitchOn(sli_MethodDetails
);
166 ary::idl::ifc_interface::attr::Get_Attributes(dpAttributes
, i_ce
);
167 if ( (*dpAttributes
).operator bool() )
169 eCurProducedMembers
= mem_Attributes
;
171 produce_Members( *dpAttributes
,
173 C_sList_Attributes_Label
,
174 C_sList_AttributesDetails
,
175 C_sList_AttributesDetails_Label
,
176 HtmlFactory_Idl::viewtype_details
);
177 pNaviSubRow
->SwitchOn(sli_AttributesDetails
);
180 eCurProducedMembers
= mem_none
;
182 pNaviSubRow
->Produce_Row();
186 HF_IdlInterface::make_Navibar( const client
& i_ce
) const
189 aNaviBar(Env(), CurOut());
190 aNaviBar
.Produce_CeMainRow(i_ce
);
193 ret
= aNaviBar
.Add_SubRow();
194 ret
.AddItem(C_sList_Methods
, C_sList_Methods_Label
, false);
195 ret
.AddItem(C_sList_Attributes
, C_sList_Attributes_Label
, false);
196 ret
.AddItem(C_sDetails_Methods
, C_sDetails_Methods_Label
, false);
197 ret
.AddItem(C_sList_AttributesDetails
, C_sList_AttributesDetails_Label
, false);
199 CurOut() << new Html::HorizontalLine();
204 HF_IdlInterface::produce_MemberDetails( HF_SubTitleTable
& o_table
,
205 const client
& i_ce
) const
207 switch (eCurProducedMembers
)
214 aAttribute( Env(), o_table
);
215 aAttribute
.Produce_byData( i_ce
);
218 default: //Won't happen.
222 typedef ary::idl::ifc_function::attr funcAttr
;
227 >> *new Html::TableCell
228 << new Html::ClassAttr(C_sCellStyle_MDetail
) );
230 ary::Dyn_StdConstIterator
<ary::idl::Parameter
>
232 funcAttr::Get_Parameters(pParameters
, i_ce
);
234 ary::Dyn_StdConstIterator
<ary::idl::Type_id
>
236 funcAttr::Get_Exceptions(pExceptions
, i_ce
);
238 aFunction
.Produce_byData( i_ce
.LocalName(),
239 funcAttr::ReturnType(i_ce
),
242 funcAttr::IsOneway(i_ce
),
243 funcAttr::HasEllipse(i_ce
),
248 HF_IdlInterface::produce_BaseHierarchy( Xml::Element
& o_screen
,
250 const String
& i_sLabel
) const
252 ary::Dyn_StdConstIterator
<ary::idl::CommentedRelation
>
254 ary::idl::ifc_interface::attr::Get_Bases(pHelp
, i_ce
);
255 if (NOT (*pHelp
).operator bool())
258 // Check for XInterface as only base:
259 ary::StdConstIterator
<ary::idl::CommentedRelation
> &
262 nCe
= Env().Gate().Types().Search_CeRelatedTo((*itTest
).Type());
266 // Rather check for id(!) of com::sun::star::uno::XInterface.
267 if (Env().Gate().Ces().Find_Ce(nCe
).LocalName() == "XInterface")
270 if (NOT itTest
.operator bool())
278 aDocList( o_screen
);
279 aDocList
.Produce_Term(i_sLabel
);
281 rBaseList
= aDocList
.Produce_Definition();
284 Write_BaseHierarchy(rBaseList
, Env(), i_ce
);
287 // KORR_FUTURE: Make sure, no empty table is constructed when comments list is empty.
289 aBaseTable( aDocList
.Produce_Definition(),
291 C_sList_BaseComments
,
293 HF_SubTitleTable::sublevel_3
);
295 ary::Dyn_StdConstIterator
<ary::idl::CommentedRelation
>
297 ary::idl::ifc_interface::attr::Get_Bases(pBases
, i_ce
);
298 for ( ary::StdConstIterator
<ary::idl::CommentedRelation
> & it
= *pBases
;
303 rRow
= aBaseTable
.Add_Row();
307 >> *new Html::TableCell
308 << new Html::ClassAttr(C_sCellStyle_SummaryLeft
);
310 aTypeDisplay( Env(), rTerm
, 0);
311 aTypeDisplay
.Produce_byData((*it
).Type());
315 >> *new Html::TableCell
316 << new Html::ClassAttr(C_sCellStyle_SummaryRight
);
321 if ((*it
).Info() != 0)
323 // aDocuList.Produce_Term("Comment on Base Reference");
326 aDocuDisplay(Env(), aDocuList
);
327 aDocuDisplay
.Produce_fromReference(*(*it
).Info(), i_ce
);
332 pCe
= Env().Linker().Search_CeFromType((*it
).Type());
335 ? Get_IdlDocu(pCe
->Docu())
336 : (const ce_info
*)(0);
339 aDocuList
.Produce_NormalTerm("(referenced interface's summary:)");
342 rDef
= aDocuList
.Produce_Definition();
343 HF_IdlDocuTextDisplay
344 aShortDisplay( Env(), &rDef
, *pCe
);
345 pShort
->Short().DisplayAt(aShortDisplay
);
346 } // end if (pShort != 0)
347 } // endif ( (*i_commentedRef).Info() != 0 ) else
351 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */