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_enum.hxx"
30 
31 
32 // NOT FULLY DEFINED SERVICES
33 #include <ary/idl/i_ce.hxx>
34 #include <ary/idl/ik_enum.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_Enum("enum");
45 
46 namespace
47 {
48 
49 const String
50     C_sList_Values("Values");
51 const String
52     C_sList_Values_Label("Values");
53 const String
54     C_sList_ValueDetails("Values' Details");
55 const String
56     C_sList_ValueDetails_Label("ValueDetails");
57 
58 enum E_SubListIndices
59 {
60     sli_ValuesSummary = 0,
61     sli_ValueDetails = 1
62 };
63 
64 }   // anonymous namespace
65 
66 HF_IdlEnum::HF_IdlEnum( Environment &       io_rEnv,
67                         Xml::Element &      o_rOut )
68     :   HtmlFactory_Idl(io_rEnv, &o_rOut)
69 {
70 }
71 
72 HF_IdlEnum::~HF_IdlEnum()
73 {
74 }
75 
76 void
77 HF_IdlEnum::Produce_byData( const client & i_ce ) const
78 {
79     Dyn<HF_NaviSubRow>
80         pNaviSubRow( &make_Navibar(i_ce) );
81 
82     HF_TitleTable
83         aTitle(CurOut());
84 
85     HF_LinkedNameChain
86         aNameChain(aTitle.Add_Row());
87 
88     aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker);
89     produce_Title(aTitle, C_sCePrefix_Enum, i_ce);
90 
91     write_Docu(aTitle.Add_Row(), i_ce);
92     CurOut() << new Html::HorizontalLine();
93 
94     dyn_ce_list
95         dpValues;
96     ary::idl::ifc_enum::attr::Get_Values(dpValues, i_ce);
97     if ( (*dpValues).operator bool() )
98     {
99         produce_Members( *dpValues,
100                          C_sList_Values,
101                          C_sList_Values_Label,
102                          C_sList_ValueDetails,
103                          C_sList_ValueDetails_Label );
104         pNaviSubRow->SwitchOn(sli_ValuesSummary);
105         pNaviSubRow->SwitchOn(sli_ValueDetails);
106     }
107     pNaviSubRow->Produce_Row();
108 }
109 
110 HF_NaviSubRow &
111 HF_IdlEnum::make_Navibar( const client & i_ce ) const
112 {
113     HF_IdlNavigationBar
114         aNaviBar(Env(), CurOut());
115     aNaviBar.Produce_CeMainRow(i_ce);
116 
117     DYN HF_NaviSubRow &
118         ret = aNaviBar.Add_SubRow();
119     ret.AddItem(C_sList_Values, C_sList_Values_Label, false);
120     ret.AddItem(C_sList_ValueDetails, C_sList_ValueDetails_Label, false);
121 
122     CurOut() << new Html::HorizontalLine();
123     return ret;
124 }
125 
126 void
127 HF_IdlEnum::produce_MemberDetails( HF_SubTitleTable &  o_table,
128                                    const client &      i_ce) const
129 {
130     HF_IdlEnumValue
131         aElement( Env(), o_table );
132     aElement.Produce_byData(i_ce);
133 }
134