1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include <precomp.h>
29 #include "hfi_siservice.hxx"
30 
31 
32 // NOT FULLY DEFINED SERVICES
33 #include <ary/idl/i_ce.hxx>
34 #include <ary/idl/ik_function.hxx>
35 #include <ary/idl/ik_siservice.hxx>
36 #include <ary/doc/d_oldidldocu.hxx>
37 #include <toolkit/hf_docentry.hxx>
38 #include <toolkit/hf_linachain.hxx>
39 #include <toolkit/hf_navi_sub.hxx>
40 #include <toolkit/hf_title.hxx>
41 #include "hfi_doc.hxx"
42 #include "hfi_method.hxx"
43 #include "hfi_navibar.hxx"
44 #include "hfi_typetext.hxx"
45 #include "hi_env.hxx"
46 #include "hi_linkhelper.hxx"
47 
48 
49 
50 namespace
51 {
52 
53 const String
54     C_sImplementedInterface("Supported Interface");
55 
56 const String
57     C_sList_Constructors("Constructors' Summary");
58 const String
59     C_sList_Constructors_Label("ConstructorsSummary");
60 const String
61     C_sDetails_Constructors("Constructors' Details");
62 const String
63     C_sDetails_Constructors_Label("ConstructorsDetails");
64 
65 
66 enum E_SubListIndices
67 {
68     sli_ConstructorsSummary = 0,
69     sli_ConstructorsDetails = 1
70 };
71 
72 } //anonymous namespace
73 
74 
75 HF_IdlSglIfcService::HF_IdlSglIfcService( Environment &         io_rEnv,
76 										  Xml::Element &        o_rOut )
77     :   HtmlFactory_Idl(io_rEnv, &o_rOut)
78 {
79 }
80 
81 HF_IdlSglIfcService::~HF_IdlSglIfcService()
82 {
83 }
84 
85 typedef ::ary::idl::ifc_sglifcservice::attr SglIfcServiceAttr;
86 
87 void
88 HF_IdlSglIfcService::Produce_byData( const client & i_ce ) const
89 {
90     Dyn<HF_NaviSubRow>
91         pNaviSubRow( &make_Navibar(i_ce) );
92 
93     HF_TitleTable
94         aTitle(CurOut());
95     HF_LinkedNameChain
96         aNameChain(aTitle.Add_Row());
97 
98     aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker);
99     produce_Title(aTitle, C_sCePrefix_Service, i_ce);
100 
101     HF_DocEntryList
102         aTopList( aTitle.Add_Row() );
103     aTopList.Produce_Term(C_sImplementedInterface);
104 
105     HF_IdlTypeText
106         aImplementedInterface( Env(), aTopList.Produce_Definition(), true, &i_ce);
107     aImplementedInterface.Produce_byData( SglIfcServiceAttr::BaseInterface(i_ce) );
108 
109     CurOut() << new Html::HorizontalLine;
110 
111     write_Docu(aTitle.Add_Row(), i_ce);
112     CurOut() << new Html::HorizontalLine();
113 
114     dyn_ce_list
115         dpConstructors;
116     SglIfcServiceAttr::Get_Constructors(dpConstructors, i_ce);
117     if ( (*dpConstructors).operator bool() )
118     {
119         produce_Members( *dpConstructors,
120 						 C_sList_Constructors,
121 						 C_sList_Constructors_Label,
122 						 C_sDetails_Constructors,
123 						 C_sDetails_Constructors_Label );
124         pNaviSubRow->SwitchOn(sli_ConstructorsSummary);
125         pNaviSubRow->SwitchOn(sli_ConstructorsDetails);
126     }
127 
128     pNaviSubRow->Produce_Row();
129     CurOut() << new Xml::XmlCode("<br>&nbsp;");
130 }
131 
132 DYN HF_NaviSubRow &
133 HF_IdlSglIfcService::make_Navibar( const client & i_ce ) const
134 {
135     HF_IdlNavigationBar
136         aNaviBar(Env(), CurOut());
137     aNaviBar.Produce_CeMainRow(i_ce, true);
138 
139     DYN HF_NaviSubRow &
140         ret = aNaviBar.Add_SubRow();
141     ret.AddItem(C_sList_Constructors, C_sList_Constructors_Label, false);
142     ret.AddItem(C_sDetails_Constructors, C_sDetails_Constructors_Label, false);
143 
144     CurOut() << new Html::HorizontalLine();
145     return ret;
146 }
147 
148 typedef ary::idl::ifc_function::attr    funcAttr;
149 
150 void
151 HF_IdlSglIfcService::produce_MemberDetails( HF_SubTitleTable &  o_table,
152 											const client &      i_ce ) const
153 {
154     HF_IdlMethod
155         aConstructor( Env(),
156 					  o_table.Add_Row()
157                             >> *new Html::TableCell
158                                 << new Html::ClassAttr(C_sCellStyle_MDetail) );
159 
160     ary::Dyn_StdConstIterator<ary::idl::Parameter>
161         pParameters;
162     funcAttr::Get_Parameters(pParameters, i_ce);
163 
164     ary::Dyn_StdConstIterator<ary::idl::Type_id>
165         pExceptions;
166     funcAttr::Get_Exceptions(pExceptions, i_ce);
167 
168     aConstructor.Produce_byData( i_ce.LocalName(),
169 								 funcAttr::ReturnType(i_ce),
170 								 *pParameters,
171 								 *pExceptions,
172 								 funcAttr::IsOneway(i_ce),
173 								 funcAttr::HasEllipse(i_ce),
174 								 i_ce );
175 }
176