1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "hfi_navibar.hxx"
24 // NOT FULLY DEFINED SERVICES
25 #include <ary/idl/i_ce.hxx>
26 #include <toolkit/hf_navi_main.hxx>
27 #include <toolkit/hf_navi_sub.hxx>
28 #include "hfi_interface.hxx"
29 #include "hfi_module.hxx"
30 #include "hfi_service.hxx"
31 #include "hi_linkhelper.hxx"
35 C_sLocalManualLinks("#devmanual");
38 const String C_sTop
= "Overview";
39 const String C_sModule
= "Module";
40 const String C_sUse
= "Use";
41 const String C_sManual
= "Devguide";
42 const String C_sIndex
= "Index";
47 HF_IdlNavigationBar::HF_IdlNavigationBar( Environment
& io_rEnv
,
48 Xml::Element
& o_rOut
)
49 : HtmlFactory_Idl(io_rEnv
, &o_rOut
)
53 HF_IdlNavigationBar::~HF_IdlNavigationBar()
58 HF_IdlNavigationBar::Produce_CeMainRow( const client
& i_ce
,
62 aNaviMain( CurOut() );
64 StreamLock
aLink(500);
65 StreamStr
& rLink
= aLink();
67 Env().Get_LinkTo( rLink
.reset(),
68 Env().OutputTree().Overview() );
69 aNaviMain
.Add_StdItem( C_sTop
, rLink
.c_str() );
71 Env().Get_LinkTo( rLink
.reset(),
72 Env().Linker().PositionOf_CurModule() );
73 aNaviMain
.Add_StdItem( C_sModule
, rLink
.c_str() );
77 aNaviMain
.Add_NoneItem( C_sUse
);
81 Env().Get_LinkTo( rLink
.reset(),
82 Env().Linker().PositionOf_CurXRefs(i_ce
.LocalName()) );
83 aNaviMain
.Add_StdItem( C_sUse
, rLink
.c_str() );
87 rManualDescrs
= i_ce
.Secondaries().Links2DescriptionInManual();
88 if (rManualDescrs
.size() == 2)
90 aNaviMain
.Add_StdItem(C_sManual
, Env().Link2Manual( rManualDescrs
.front() ));
92 else if (rManualDescrs
.size() > 2)
94 aNaviMain
.Add_StdItem(C_sManual
, C_sLocalManualLinks
);
98 aNaviMain
.Add_NoneItem( C_sManual
);
101 Env().Get_LinkTo( rLink
.reset(),
102 Env().Linker().PositionOf_Index() );
103 aNaviMain
.Add_StdItem( C_sIndex
, rLink
.c_str() );
105 aNaviMain
.Produce_Row();
109 HF_IdlNavigationBar::Produce_CeXrefsMainRow( const client
& i_ce
)
112 aNaviMain( CurOut() );
114 StreamLock
aLink(500);
115 StreamStr
& rLink
= aLink();
117 Env().Get_LinkTo( rLink
.reset(),
118 Env().OutputTree().Overview() );
119 aNaviMain
.Add_StdItem( C_sTop
, rLink
.c_str() );
121 Env().Get_LinkTo( rLink
.reset(),
122 Env().Linker().PositionOf_CurModule() );
123 aNaviMain
.Add_StdItem( C_sModule
, rLink
.c_str() );
125 aNaviMain
.Add_SelfItem( C_sUse
);
128 rManualDescrs
= i_ce
.Secondaries().Links2DescriptionInManual();
129 if (rManualDescrs
.size() == 2)
131 aNaviMain
.Add_StdItem(C_sManual
, Env().Link2Manual( rManualDescrs
.front() ));
133 else if (rManualDescrs
.size() > 2)
135 aNaviMain
.Add_StdItem(C_sManual
, C_sLocalManualLinks
);
139 aNaviMain
.Add_NoneItem( C_sManual
);
142 Env().Get_LinkTo( rLink
.reset(),
143 Env().Linker().PositionOf_Index() );
144 aNaviMain
.Add_StdItem( C_sIndex
, rLink
.c_str() );
146 aNaviMain
.Produce_Row();
150 HF_IdlNavigationBar::Produce_ModuleMainRow( const client
& i_ce
)
153 aNaviMain( CurOut() );
155 StreamLock
aLink(500);
156 StreamStr
& rLink
= aLink();
158 Env().Get_LinkTo( rLink
.reset(),
159 Env().OutputTree().Overview() );
160 aNaviMain
.Add_StdItem( C_sTop
, rLink
.c_str() );
162 aNaviMain
.Add_SelfItem( C_sModule
);
164 aNaviMain
.Add_NoneItem( C_sUse
);
167 rManualDescrs
= i_ce
.Secondaries().Links2DescriptionInManual();
168 if (rManualDescrs
.size() == 1)
170 aNaviMain
.Add_StdItem(C_sManual
, Env().Link2Manual( rManualDescrs
.front() ));
172 else if (rManualDescrs
.size() > 1)
174 aNaviMain
.Add_StdItem(C_sManual
, C_sLocalManualLinks
);
178 aNaviMain
.Add_NoneItem( C_sManual
);
181 Env().Get_LinkTo( rLink
.reset(),
182 Env().Linker().PositionOf_Index() );
183 aNaviMain
.Add_StdItem( C_sIndex
, rLink
.c_str() );
185 aNaviMain
.Produce_Row();
189 HF_IdlNavigationBar::Produce_IndexMainRow()
192 aNaviMain( CurOut() );
194 StreamLock
aLink(500);
195 StreamStr
& rLink
= aLink();
197 Env().Get_LinkTo( rLink
.reset(),
198 Env().OutputTree().Overview() );
199 aNaviMain
.Add_StdItem( C_sTop
, rLink
.c_str() );
201 aNaviMain
.Add_NoneItem( C_sModule
);
202 aNaviMain
.Add_NoneItem( C_sUse
);
203 aNaviMain
.Add_NoneItem( C_sManual
);
205 aNaviMain
.Add_SelfItem( C_sIndex
);
207 aNaviMain
.Produce_Row();
209 CurOut() << new Html::HorizontalLine();
213 HF_IdlNavigationBar::Add_SubRow()
215 return *new HF_NaviSubRow( CurOut() );
218 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */