1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #include <precomp.h>
23 #include "hfi_constgroup.hxx"
24 
25 
26 // NOT FULLY DEFINED SERVICES
27 #include <ary/idl/i_ce.hxx>
28 #include <ary/idl/ik_constgroup.hxx>
29 #include <toolkit/hf_linachain.hxx>
30 #include <toolkit/hf_navi_sub.hxx>
31 #include <toolkit/hf_title.hxx>
32 #include "hfi_navibar.hxx"
33 #include "hfi_property.hxx"
34 #include "hi_linkhelper.hxx"
35 
36 
37 extern const String
38     C_sCePrefix_Constants("constants group");
39 
40 
41 namespace
42 {
43 
44 const String
45     C_sList_Constants("Constants");
46 const String
47     C_sList_Constants_Label("Constants");
48 const String
49     C_sList_ConstantDetails("Constants' Details");
50 const String
51     C_sList_ConstantDetails_Label("ConstantDetails");
52 
53 enum E_SubListIndices
54 {
55     sli_ConstantsSummary = 0,
56     sli_ConstantDetails = 1
57 };
58 
59 
60 }   // anonymous namespace
61 
62 
63 
HF_IdlConstGroup(Environment & io_rEnv,Xml::Element & o_rOut)64 HF_IdlConstGroup::HF_IdlConstGroup( Environment &   io_rEnv,
65                                     Xml::Element &  o_rOut )
66     :   HtmlFactory_Idl(io_rEnv, &o_rOut)
67 {
68 }
69 
~HF_IdlConstGroup()70 HF_IdlConstGroup::~HF_IdlConstGroup()
71 {
72 }
73 
74 void
Produce_byData(const client & i_ce) const75 HF_IdlConstGroup::Produce_byData( const client & i_ce ) const
76 {
77     Dyn<HF_NaviSubRow>
78         pNaviSubRow( &make_Navibar(i_ce) );
79 
80     HF_TitleTable
81         aTitle(CurOut());
82     HF_LinkedNameChain
83         aNameChain(aTitle.Add_Row());
84 
85     aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker);
86     produce_Title(aTitle, C_sCePrefix_Constants, i_ce);
87 
88     write_Docu(aTitle.Add_Row(), i_ce);
89     CurOut() << new Html::HorizontalLine();
90 
91     dyn_ce_list
92         dpConstants;
93     ary::idl::ifc_constgroup::attr::Get_Constants(dpConstants, i_ce);
94 
95     if ( (*dpConstants).operator bool() )
96     {
97         produce_Members( *dpConstants,
98                          C_sList_Constants,
99                          C_sList_Constants_Label,
100                          C_sList_ConstantDetails,
101                          C_sList_ConstantDetails_Label );
102         pNaviSubRow->SwitchOn(sli_ConstantsSummary);
103         pNaviSubRow->SwitchOn(sli_ConstantDetails);
104     }
105     pNaviSubRow->Produce_Row();
106 }
107 
108 HF_NaviSubRow &
make_Navibar(const client & i_ce) const109 HF_IdlConstGroup::make_Navibar( const client & i_ce ) const
110 {
111     HF_IdlNavigationBar
112         aNaviBar(Env(), CurOut());
113     aNaviBar.Produce_CeMainRow(i_ce,true);  // true := avoid link to Use-page.
114 
115     DYN HF_NaviSubRow &
116         ret = aNaviBar.Add_SubRow();
117     ret.AddItem(C_sList_Constants, C_sList_Constants_Label, false);
118     ret.AddItem(C_sList_ConstantDetails, C_sList_ConstantDetails_Label, false);
119 
120     CurOut() << new Html::HorizontalLine();
121     return ret;
122 }
123 
124 void
produce_MemberDetails(HF_SubTitleTable & o_table,const client & i_ce) const125 HF_IdlConstGroup::produce_MemberDetails( HF_SubTitleTable &  o_table,
126                                          const client &      i_ce ) const
127 {
128     HF_IdlConstant
129         aElement( Env(), o_table );
130     aElement.Produce_byData(i_ce);
131 }
132 
133