1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: hfi_navibar.cxx,v $
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 ************************************************************************/
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"
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()
69 HF_IdlNavigationBar::Produce_CeMainRow( const client
& i_ce
,
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() );
88 aNaviMain
.Add_NoneItem( C_sUse
);
92 Env().Get_LinkTo( rLink
.reset(),
93 Env().Linker().PositionOf_CurXRefs(i_ce
.LocalName()) );
94 aNaviMain
.Add_StdItem( C_sUse
, rLink
.c_str() );
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
);
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();
120 HF_IdlNavigationBar::Produce_CeXrefsMainRow( const client
& i_ce
)
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
);
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
);
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();
161 HF_IdlNavigationBar::Produce_ModuleMainRow( const client
& i_ce
)
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
);
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
);
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();
200 HF_IdlNavigationBar::Produce_IndexMainRow()
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();
224 HF_IdlNavigationBar::Add_SubRow()
226 return *new HF_NaviSubRow( CurOut() );