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_navibar.hxx"
24
25
26 // NOT FULLY DEFINED SERVICES
27 #include <ary/idl/i_ce.hxx>
28 #include <toolkit/hf_navi_main.hxx>
29 #include <toolkit/hf_navi_sub.hxx>
30 #include "hfi_interface.hxx"
31 #include "hfi_module.hxx"
32 #include "hfi_service.hxx"
33 #include "hi_linkhelper.hxx"
34
35
36 extern const String
37 C_sLocalManualLinks("#devmanual");
38
39
40 const String C_sTop = "Overview";
41 const String C_sModule = "Module";
42 const String C_sUse = "Use";
43 const String C_sManual = "Devguide";
44 const String C_sIndex = "Index";
45
46
47
48
HF_IdlNavigationBar(Environment & io_rEnv,Xml::Element & o_rOut)49 HF_IdlNavigationBar::HF_IdlNavigationBar( Environment & io_rEnv,
50 Xml::Element & o_rOut )
51 : HtmlFactory_Idl(io_rEnv, &o_rOut)
52 {
53 }
54
~HF_IdlNavigationBar()55 HF_IdlNavigationBar::~HF_IdlNavigationBar()
56 {
57 }
58
59 void
Produce_CeMainRow(const client & i_ce,bool i_bNoUsePage)60 HF_IdlNavigationBar::Produce_CeMainRow( const client & i_ce,
61 bool i_bNoUsePage )
62 {
63 HF_NaviMainRow
64 aNaviMain( CurOut() );
65
66 StreamLock aLink(500);
67 StreamStr & rLink = aLink();
68
69 Env().Get_LinkTo( rLink.reset(),
70 Env().OutputTree().Overview() );
71 aNaviMain.Add_StdItem( C_sTop, rLink.c_str() );
72
73 Env().Get_LinkTo( rLink.reset(),
74 Env().Linker().PositionOf_CurModule() );
75 aNaviMain.Add_StdItem( C_sModule, rLink.c_str() );
76
77 if (i_bNoUsePage)
78 {
79 aNaviMain.Add_NoneItem( C_sUse );
80 }
81 else
82 {
83 Env().Get_LinkTo( rLink.reset(),
84 Env().Linker().PositionOf_CurXRefs(i_ce.LocalName()) );
85 aNaviMain.Add_StdItem( C_sUse, rLink.c_str() );
86 }
87
88 const StringVector &
89 rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual();
90 if (rManualDescrs.size() == 2)
91 {
92 aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() ));
93 }
94 else if (rManualDescrs.size() > 2)
95 {
96 aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks);
97 }
98 else
99 {
100 aNaviMain.Add_NoneItem( C_sManual );
101 }
102
103 Env().Get_LinkTo( rLink.reset(),
104 Env().Linker().PositionOf_Index() );
105 aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() );
106
107 aNaviMain.Produce_Row();
108 }
109
110 void
Produce_CeXrefsMainRow(const client & i_ce)111 HF_IdlNavigationBar::Produce_CeXrefsMainRow( const client & i_ce )
112 {
113 HF_NaviMainRow
114 aNaviMain( CurOut() );
115
116 StreamLock aLink(500);
117 StreamStr & rLink = aLink();
118
119 Env().Get_LinkTo( rLink.reset(),
120 Env().OutputTree().Overview() );
121 aNaviMain.Add_StdItem( C_sTop, rLink.c_str() );
122
123 Env().Get_LinkTo( rLink.reset(),
124 Env().Linker().PositionOf_CurModule() );
125 aNaviMain.Add_StdItem( C_sModule, rLink.c_str() );
126
127 aNaviMain.Add_SelfItem( C_sUse );
128
129 const StringVector &
130 rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual();
131 if (rManualDescrs.size() == 2)
132 {
133 aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() ));
134 }
135 else if (rManualDescrs.size() > 2)
136 {
137 aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks);
138 }
139 else
140 {
141 aNaviMain.Add_NoneItem( C_sManual );
142 }
143
144 Env().Get_LinkTo( rLink.reset(),
145 Env().Linker().PositionOf_Index() );
146 aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() );
147
148 aNaviMain.Produce_Row();
149 }
150
151 void
Produce_ModuleMainRow(const client & i_ce)152 HF_IdlNavigationBar::Produce_ModuleMainRow( const client & i_ce )
153 {
154 HF_NaviMainRow
155 aNaviMain( CurOut() );
156
157 StreamLock aLink(500);
158 StreamStr & rLink = aLink();
159
160 Env().Get_LinkTo( rLink.reset(),
161 Env().OutputTree().Overview() );
162 aNaviMain.Add_StdItem( C_sTop, rLink.c_str() );
163
164 aNaviMain.Add_SelfItem( C_sModule );
165
166 aNaviMain.Add_NoneItem( C_sUse );
167
168 const StringVector &
169 rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual();
170 if (rManualDescrs.size() == 1)
171 {
172 aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() ));
173 }
174 else if (rManualDescrs.size() > 1)
175 {
176 aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks);
177 }
178 else
179 {
180 aNaviMain.Add_NoneItem( C_sManual );
181 }
182
183 Env().Get_LinkTo( rLink.reset(),
184 Env().Linker().PositionOf_Index() );
185 aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() );
186
187 aNaviMain.Produce_Row();
188 }
189
190 void
Produce_IndexMainRow()191 HF_IdlNavigationBar::Produce_IndexMainRow()
192 {
193 HF_NaviMainRow
194 aNaviMain( CurOut() );
195
196 StreamLock aLink(500);
197 StreamStr & rLink = aLink();
198
199 Env().Get_LinkTo( rLink.reset(),
200 Env().OutputTree().Overview() );
201 aNaviMain.Add_StdItem( C_sTop, rLink.c_str() );
202
203 aNaviMain.Add_NoneItem( C_sModule );
204 aNaviMain.Add_NoneItem( C_sUse );
205 aNaviMain.Add_NoneItem( C_sManual );
206
207 aNaviMain.Add_SelfItem( C_sIndex );
208
209 aNaviMain.Produce_Row();
210
211 CurOut() << new Html::HorizontalLine();
212 }
213
214 DYN HF_NaviSubRow &
Add_SubRow()215 HF_IdlNavigationBar::Add_SubRow()
216 {
217 return *new HF_NaviSubRow( CurOut() );
218 }
219
220