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_xrefpage.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_xrefpage.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <ary/idl/i_ce.hxx>
37 #include <ary/idl/i_gate.hxx>
38 #include <ary/idl/ip_ce.hxx>
39 #include <toolkit/hf_title.hxx>
40 #include "hfi_navibar.hxx"
41 #include "hfi_typetext.hxx"
49 C_sTitleStart("uses of ");
53 C_sDevMan("References in Developers Guide");
55 } // anonymous namespace
59 HF_IdlXrefs::HF_IdlXrefs( Environment
& io_rEnv
,
60 Xml::Element
& o_rOut
,
61 const String
& i_prefix
,
63 : HtmlFactory_Idl(io_rEnv
, &o_rOut
),
64 rContentDirectory(*new Html::Paragraph
),
67 produce_Main(i_prefix
, i_ce
);
70 HF_IdlXrefs::~HF_IdlXrefs()
75 HF_IdlXrefs::Write_ManualLinks( const client
& i_ce
) const
78 rLinks2Refs
= i_ce
.Secondaries().Links2RefsInManual();
79 if ( rLinks2Refs
.size() == 0 )
83 << new Html::LineBreak
90 >> *new Html::Link("#devmanrefs")
92 << new Html::LineBreak
96 aList(CurOut(), "devmanrefs", C_sDevMan
, 1);
98 rOutCell
= aList
.Add_Row() >>* new Html::TableCell
;
100 csv_assert(rLinks2Refs
.size() % 2 == 0);
101 for ( StringVector::const_iterator it
= rLinks2Refs
.begin();
102 it
!= rLinks2Refs
.end();
106 rLink
= rOutCell
>> *new Html::Link( Env().Link2Manual(*it
));
107 if ( (*(it
+1)).empty() )
110 // Research what happens with manual links which contain normal characters
111 // in non-utf-8 texts. And research, why utfF-8 does not work here.
112 rLink
<< new Xml::XmlCode(*it
);
114 // HACK KORR_FUTURE, see above.
115 rLink
<< new Xml::XmlCode( *(it
+1) );
117 << new Html::LineBreak
124 HF_IdlXrefs::Produce_List( const char * i_title
,
125 const char * i_label
,
126 ce_list
& i_iterator
) const
132 << new Html::LineBreak
137 csv_assert(*i_label
== '#');
140 >> *new Html::Link(i_label
)
142 << new Html::LineBreak
146 aList(CurOut(), i_label
+1, i_title
, 1);
148 rOutCell
= aList
.Add_Row() >>* new Html::TableCell
;
150 aTypeWriter(Env(), rOutCell
, true, pClient
);
151 for ( ce_list
& it
= i_iterator
; it
; ++it
)
153 aTypeWriter
.Produce_byData(*it
);
154 rOutCell
<< new Html::LineBreak
;
159 HF_IdlXrefs::Produce_Tree( const char * i_title
,
160 const char * i_label
,
162 F_GET_SUBLIST i_sublistcreator
) const
165 (*i_sublistcreator
)(pResult
, i_ce
);
167 if (NOT (*pResult
).operator bool())
171 << new Html::LineBreak
176 csv_assert(*i_label
== '#');
179 >> *new Html::Link(i_label
)
181 << new Html::LineBreak
185 aList(CurOut(), i_label
+1, i_title
, 1);
187 rOut
= aList
.Add_Row()
188 >>* new Html::TableCell
189 >> *new csi::xml::AnElement("pre")
190 << new csi::html::StyleAttr("font-family:monospace;");
192 recursive_make_ListInTree( rOut
,
200 HF_IdlXrefs::produce_Main( const String
& i_prefix
,
201 const client
& i_ce
) const
208 aTitle
.Produce_Title( sl()
215 aTitle
.Add_Row() << &rContentDirectory
;
218 >> *new Html::Link( sl() << i_ce
.LocalName()
227 << new Html::LineBreak
228 << new Html::LineBreak
231 CurOut() << new Html::HorizontalLine();
235 HF_IdlXrefs::make_Navibar( const client
& i_ce
) const
238 aNaviBar(Env(), CurOut());
239 aNaviBar
.Produce_CeXrefsMainRow(i_ce
);
240 CurOut() << new Html::HorizontalLine();
244 HF_IdlXrefs::recursive_make_ListInTree( Xml::Element
& o_rDisplay
,
247 ce_list
& i_iterator
,
248 F_GET_SUBLIST i_sublistcreator
) const
250 const char * sLevelIndentation
= " ";
253 aTypeWriter(Env(), o_rDisplay
, true, &i_ce
);
254 for ( ; i_iterator
.operator bool(); ++i_iterator
)
256 for (uintt i
= 0; i
< i_level
; ++i
)
258 o_rDisplay
<< sLevelIndentation
;
261 aTypeWriter
.Produce_byData(*i_iterator
);
262 o_rDisplay
<< C_sCRLF
;
265 const client
& rCe
= Env().Gate().Ces().Find_Ce(*i_iterator
);
266 (*i_sublistcreator
)(pResult
, rCe
);
267 if ( (*pResult
).operator bool() )
269 recursive_make_ListInTree( o_rDisplay
,