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_constgroup.hxx"
30 
31 
32 // NOT FULLY DEFINED SERVICES
33 #include <ary/idl/i_ce.hxx>
34 #include <ary/idl/ik_constgroup.hxx>
35 #include <toolkit/hf_linachain.hxx>
36 #include <toolkit/hf_navi_sub.hxx>
37 #include <toolkit/hf_title.hxx>
38 #include "hfi_navibar.hxx"
39 #include "hfi_property.hxx"
40 #include "hi_linkhelper.hxx"
41 
42 
43 extern const String
44     C_sCePrefix_Constants("constants group");
45 
46 
47 namespace
48 {
49 
50 const String
51     C_sList_Constants("Constants");
52 const String
53     C_sList_Constants_Label("Constants");
54 const String
55     C_sList_ConstantDetails("Constants' Details");
56 const String
57     C_sList_ConstantDetails_Label("ConstantDetails");
58 
59 enum E_SubListIndices
60 {
61     sli_ConstantsSummary = 0,
62     sli_ConstantDetails = 1
63 };
64 
65 
66 }   // anonymous namespace
67 
68 
69 
70 HF_IdlConstGroup::HF_IdlConstGroup( Environment &   io_rEnv,
71                                     Xml::Element &  o_rOut )
72     :   HtmlFactory_Idl(io_rEnv, &o_rOut)
73 {
74 }
75 
76 HF_IdlConstGroup::~HF_IdlConstGroup()
77 {
78 }
79 
80 void
81 HF_IdlConstGroup::Produce_byData( const client & i_ce ) const
82 {
83     Dyn<HF_NaviSubRow>
84         pNaviSubRow( &make_Navibar(i_ce) );
85 
86     HF_TitleTable
87         aTitle(CurOut());
88     HF_LinkedNameChain
89         aNameChain(aTitle.Add_Row());
90 
91     aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker);
92     produce_Title(aTitle, C_sCePrefix_Constants, i_ce);
93 
94     write_Docu(aTitle.Add_Row(), i_ce);
95     CurOut() << new Html::HorizontalLine();
96 
97     dyn_ce_list
98         dpConstants;
99     ary::idl::ifc_constgroup::attr::Get_Constants(dpConstants, i_ce);
100 
101     if ( (*dpConstants).operator bool() )
102     {
103         produce_Members( *dpConstants,
104                          C_sList_Constants,
105                          C_sList_Constants_Label,
106                          C_sList_ConstantDetails,
107                          C_sList_ConstantDetails_Label );
108         pNaviSubRow->SwitchOn(sli_ConstantsSummary);
109         pNaviSubRow->SwitchOn(sli_ConstantDetails);
110     }
111     pNaviSubRow->Produce_Row();
112 }
113 
114 HF_NaviSubRow &
115 HF_IdlConstGroup::make_Navibar( const client & i_ce ) const
116 {
117     HF_IdlNavigationBar
118         aNaviBar(Env(), CurOut());
119     aNaviBar.Produce_CeMainRow(i_ce,true);  // true := avoid link to Use-page.
120 
121     DYN HF_NaviSubRow &
122         ret = aNaviBar.Add_SubRow();
123     ret.AddItem(C_sList_Constants, C_sList_Constants_Label, false);
124     ret.AddItem(C_sList_ConstantDetails, C_sList_ConstantDetails_Label, false);
125 
126     CurOut() << new Html::HorizontalLine();
127     return ret;
128 }
129 
130 void
131 HF_IdlConstGroup::produce_MemberDetails( HF_SubTitleTable &  o_table,
132                                          const client &      i_ce ) const
133 {
134     HF_IdlConstant
135         aElement( Env(), o_table );
136     aElement.Produce_byData(i_ce);
137 }
138 
139