Update ooo320-m1
[ooovba.git] / autodoc / source / display / idl / hfi_navibar.cxx
blob43b5fea0548d6f80c71b6ef1d6954be3da729193
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hfi_navibar.cxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <precomp.h>
32 #include "hfi_navibar.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <ary/idl/i_ce.hxx>
37 #include <toolkit/hf_navi_main.hxx>
38 #include <toolkit/hf_navi_sub.hxx>
39 #include "hfi_interface.hxx"
40 #include "hfi_module.hxx"
41 #include "hfi_service.hxx"
42 #include "hi_linkhelper.hxx"
45 extern const String
46 C_sLocalManualLinks("#devmanual");
49 const String C_sTop = "Overview";
50 const String C_sModule = "Module";
51 const String C_sUse = "Use";
52 const String C_sManual = "Devguide";
53 const String C_sIndex = "Index";
58 HF_IdlNavigationBar::HF_IdlNavigationBar( Environment & io_rEnv,
59 Xml::Element & o_rOut )
60 : HtmlFactory_Idl(io_rEnv, &o_rOut)
64 HF_IdlNavigationBar::~HF_IdlNavigationBar()
68 void
69 HF_IdlNavigationBar::Produce_CeMainRow( const client & i_ce,
70 bool i_bNoUsePage )
72 HF_NaviMainRow
73 aNaviMain( CurOut() );
75 StreamLock aLink(500);
76 StreamStr & rLink = aLink();
78 Env().Get_LinkTo( rLink.reset(),
79 Env().OutputTree().Overview() );
80 aNaviMain.Add_StdItem( C_sTop, rLink.c_str() );
82 Env().Get_LinkTo( rLink.reset(),
83 Env().Linker().PositionOf_CurModule() );
84 aNaviMain.Add_StdItem( C_sModule, rLink.c_str() );
86 if (i_bNoUsePage)
88 aNaviMain.Add_NoneItem( C_sUse );
90 else
92 Env().Get_LinkTo( rLink.reset(),
93 Env().Linker().PositionOf_CurXRefs(i_ce.LocalName()) );
94 aNaviMain.Add_StdItem( C_sUse, rLink.c_str() );
97 const StringVector &
98 rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual();
99 if (rManualDescrs.size() == 2)
101 aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() ));
103 else if (rManualDescrs.size() > 2)
105 aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks);
107 else
109 aNaviMain.Add_NoneItem( C_sManual );
112 Env().Get_LinkTo( rLink.reset(),
113 Env().Linker().PositionOf_Index() );
114 aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() );
116 aNaviMain.Produce_Row();
119 void
120 HF_IdlNavigationBar::Produce_CeXrefsMainRow( const client & i_ce )
122 HF_NaviMainRow
123 aNaviMain( CurOut() );
125 StreamLock aLink(500);
126 StreamStr & rLink = aLink();
128 Env().Get_LinkTo( rLink.reset(),
129 Env().OutputTree().Overview() );
130 aNaviMain.Add_StdItem( C_sTop, rLink.c_str() );
132 Env().Get_LinkTo( rLink.reset(),
133 Env().Linker().PositionOf_CurModule() );
134 aNaviMain.Add_StdItem( C_sModule, rLink.c_str() );
136 aNaviMain.Add_SelfItem( C_sUse );
138 const StringVector &
139 rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual();
140 if (rManualDescrs.size() == 2)
142 aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() ));
144 else if (rManualDescrs.size() > 2)
146 aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks);
148 else
150 aNaviMain.Add_NoneItem( C_sManual );
153 Env().Get_LinkTo( rLink.reset(),
154 Env().Linker().PositionOf_Index() );
155 aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() );
157 aNaviMain.Produce_Row();
160 void
161 HF_IdlNavigationBar::Produce_ModuleMainRow( const client & i_ce )
163 HF_NaviMainRow
164 aNaviMain( CurOut() );
166 StreamLock aLink(500);
167 StreamStr & rLink = aLink();
169 Env().Get_LinkTo( rLink.reset(),
170 Env().OutputTree().Overview() );
171 aNaviMain.Add_StdItem( C_sTop, rLink.c_str() );
173 aNaviMain.Add_SelfItem( C_sModule );
175 aNaviMain.Add_NoneItem( C_sUse );
177 const StringVector &
178 rManualDescrs = i_ce.Secondaries().Links2DescriptionInManual();
179 if (rManualDescrs.size() == 1)
181 aNaviMain.Add_StdItem(C_sManual, Env().Link2Manual( rManualDescrs.front() ));
183 else if (rManualDescrs.size() > 1)
185 aNaviMain.Add_StdItem(C_sManual, C_sLocalManualLinks);
187 else
189 aNaviMain.Add_NoneItem( C_sManual );
192 Env().Get_LinkTo( rLink.reset(),
193 Env().Linker().PositionOf_Index() );
194 aNaviMain.Add_StdItem( C_sIndex, rLink.c_str() );
196 aNaviMain.Produce_Row();
199 void
200 HF_IdlNavigationBar::Produce_IndexMainRow()
202 HF_NaviMainRow
203 aNaviMain( CurOut() );
205 StreamLock aLink(500);
206 StreamStr & rLink = aLink();
208 Env().Get_LinkTo( rLink.reset(),
209 Env().OutputTree().Overview() );
210 aNaviMain.Add_StdItem( C_sTop, rLink.c_str() );
212 aNaviMain.Add_NoneItem( C_sModule );
213 aNaviMain.Add_NoneItem( C_sUse );
214 aNaviMain.Add_NoneItem( C_sManual );
216 aNaviMain.Add_SelfItem( C_sIndex );
218 aNaviMain.Produce_Row();
220 CurOut() << new Html::HorizontalLine();
223 DYN HF_NaviSubRow &
224 HF_IdlNavigationBar::Add_SubRow()
226 return *new HF_NaviSubRow( CurOut() );