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_xrefpage.hxx"
24 // NOT FULLY DEFINED SERVICES
25 #include <ary/idl/i_ce.hxx>
26 #include <ary/idl/i_gate.hxx>
27 #include <ary/idl/ip_ce.hxx>
28 #include <toolkit/hf_title.hxx>
29 #include "hfi_navibar.hxx"
30 #include "hfi_typetext.hxx"
38 C_sTitleStart("uses of ");
42 C_sDevMan("References in Developers Guide");
44 } // anonymous namespace
48 HF_IdlXrefs::HF_IdlXrefs( Environment
& io_rEnv
,
49 Xml::Element
& o_rOut
,
50 const String
& i_prefix
,
52 : HtmlFactory_Idl(io_rEnv
, &o_rOut
),
53 rContentDirectory(*new Html::Paragraph
),
56 produce_Main(i_prefix
, i_ce
);
59 HF_IdlXrefs::~HF_IdlXrefs()
64 HF_IdlXrefs::Write_ManualLinks( const client
& i_ce
) const
67 rLinks2Refs
= i_ce
.Secondaries().Links2RefsInManual();
68 if ( rLinks2Refs
.empty() )
72 << new Html::LineBreak
79 >> *new Html::Link("#devmanrefs")
81 << new Html::LineBreak
85 aList(CurOut(), "devmanrefs", C_sDevMan
, 1);
87 rOutCell
= aList
.Add_Row() >>* new Html::TableCell
;
89 csv_assert(rLinks2Refs
.size() % 2 == 0);
90 for ( StringVector::const_iterator it
= rLinks2Refs
.begin();
91 it
!= rLinks2Refs
.end();
95 rLink
= rOutCell
>> *new Html::Link( Env().Link2Manual(*it
));
96 if ( (*(it
+1)).empty() )
99 // Research what happens with manual links which contain normal characters
100 // in non-utf-8 texts. And research, why utfF-8 does not work here.
101 rLink
<< new Xml::XmlCode(*it
);
103 // HACK KORR_FUTURE, see above.
104 rLink
<< new Xml::XmlCode( *(it
+1) );
106 << new Html::LineBreak
113 HF_IdlXrefs::Produce_List( const char * i_title
,
114 const char * i_label
,
115 ce_list
& i_iterator
) const
121 << new Html::LineBreak
126 csv_assert(*i_label
== '#');
129 >> *new Html::Link(i_label
)
131 << new Html::LineBreak
135 aList(CurOut(), i_label
+1, i_title
, 1);
137 rOutCell
= aList
.Add_Row() >>* new Html::TableCell
;
139 aTypeWriter(Env(), rOutCell
, pClient
);
140 for ( ce_list
& it
= i_iterator
; it
; ++it
)
142 aTypeWriter
.Produce_byData(*it
);
143 rOutCell
<< new Html::LineBreak
;
148 HF_IdlXrefs::Produce_Tree( const char * i_title
,
149 const char * i_label
,
151 F_GET_SUBLIST i_sublistcreator
) const
154 (*i_sublistcreator
)(pResult
, i_ce
);
156 if (NOT (*pResult
).operator bool())
160 << new Html::LineBreak
165 csv_assert(*i_label
== '#');
168 >> *new Html::Link(i_label
)
170 << new Html::LineBreak
174 aList(CurOut(), i_label
+1, i_title
, 1);
176 rOut
= aList
.Add_Row()
177 >>* new Html::TableCell
178 >> *new csi::xml::AnElement("pre")
179 << new csi::html::StyleAttr("font-family:monospace;");
181 recursive_make_ListInTree( rOut
,
189 HF_IdlXrefs::produce_Main( const String
& i_prefix
,
190 const client
& i_ce
) const
197 aTitle
.Produce_Title( sl()
204 aTitle
.Add_Row() << &rContentDirectory
;
207 >> *new Html::Link( sl() << i_ce
.LocalName()
216 << new Html::LineBreak
217 << new Html::LineBreak
220 CurOut() << new Html::HorizontalLine();
224 HF_IdlXrefs::make_Navibar( const client
& i_ce
) const
227 aNaviBar(Env(), CurOut());
228 aNaviBar
.Produce_CeXrefsMainRow(i_ce
);
229 CurOut() << new Html::HorizontalLine();
233 HF_IdlXrefs::recursive_make_ListInTree( Xml::Element
& o_rDisplay
,
236 ce_list
& i_iterator
,
237 F_GET_SUBLIST i_sublistcreator
) const
239 const char * sLevelIndentation
= " ";
242 aTypeWriter(Env(), o_rDisplay
, &i_ce
);
243 for ( ; i_iterator
.operator bool(); ++i_iterator
)
245 for (uintt i
= 0; i
< i_level
; ++i
)
247 o_rDisplay
<< sLevelIndentation
;
250 aTypeWriter
.Produce_byData(*i_iterator
);
251 o_rDisplay
<< C_sCRLF
;
254 const client
& rCe
= Env().Gate().Ces().Find_Ce(*i_iterator
);
255 (*i_sublistcreator
)(pResult
, rCe
);
256 if ( (*pResult
).operator bool() )
258 recursive_make_ListInTree( o_rDisplay
,
267 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */