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: hi_factory.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 "hi_factory.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <ary/idl/i_ce.hxx>
37 #include <toolkit/hf_title.hxx>
38 #include "hfi_doc.hxx"
39 #include "hfi_navibar.hxx"
40 #include "hfi_tag.hxx"
41 #include "hfi_typetext.hxx"
42 #include "hi_linkhelper.hxx"
46 C_sCellStyle_SummaryLeft("imsum_left");
48 C_sCellStyle_SummaryRight("imsum_right");
50 C_sCellStyle_MDetail("imdetail");
52 C_sMemberTitle("membertitle");
58 const char C_sSpace
[92] = " "
65 HtmlFactory_Idl::produce_SummaryDeclaration( Xml::Element
& o_row
,
66 const client
& i_ce
) const
68 produce_InternalLink(o_row
, i_ce
);
72 HtmlFactory_Idl::produce_InternalLink( Xml::Element
& o_screen
,
73 const client
& i_ce
) const
75 StreamLock
aLocalLink(100);
76 aLocalLink() << "#" << i_ce
.LocalName();
79 >> *new Html::TableCell
80 << new Html::ClassAttr( C_sCellStyle_SummaryLeft
)
81 >> *new Html::Link( aLocalLink().c_str() )
86 HtmlFactory_Idl::produce_ShortDoc( Xml::Element
& o_screen
,
87 const client
& i_ce
) const
90 rDetailsRowCell
= o_screen
91 >> *new Html::TableCell
92 << new Html::ClassAttr( C_sCellStyle_SummaryRight
);
94 aLinkDoc(Env(), rDetailsRowCell
);
95 aLinkDoc
.Produce_byData( i_ce
);
97 rDetailsRowCell
<< new Xml::XmlCode(" ");
100 // KORR_FUTURE: Does not belong here (implementation inheritance)!
102 HtmlFactory_Idl::produce_Bases( Xml::Element
& o_screen
,
104 const String
& i_sLabel
) const
106 ary::idl::Type_id nBaseT
= baseOf(i_ce
);
107 if ( nBaseT
.IsValid() )
110 aDocList( o_screen
);
111 aDocList
.Produce_Term(i_sLabel
);
115 rBaseList
= aDocList
.Produce_Definition()
116 >> *new Xml::AnElement("pre")
117 << new Xml::AnAttribute("style","font-family:monospace;");
123 recursive_ShowBases( rBaseList
,
130 HtmlFactory_Idl::produce_Members( ce_list
& it_list
,
131 const String
& i_summaryTitle
,
132 const String
& i_summaryLabel
,
133 const String
& i_detailsTitle
,
134 const String
& i_detailsLabel
,
135 const E_MemberViewType i_viewType
) const
137 csv_assert( it_list
);
139 Dyn
< HF_SubTitleTable
> pSummary
;
140 if ( ( i_viewType
== viewtype_summary
)
141 || ( i_viewType
== viewtype_complete
)
144 pSummary
= new HF_SubTitleTable(
151 Dyn
< HF_SubTitleTable
> pDetails
;
152 if ( ( i_viewType
== viewtype_details
)
153 || ( i_viewType
== viewtype_complete
)
156 pDetails
= new HF_SubTitleTable(
163 for ( ; it_list
.operator bool(); ++it_list
)
165 const ary::idl::CodeEntity
&
166 rCe
= Env().Data().Find_Ce(*it_list
);
171 rSummaryRow
= pSummary
->Add_Row();
172 produce_SummaryDeclaration(rSummaryRow
, rCe
);
173 // produce_InternalLink(rSummaryRow, rCe);
174 produce_ShortDoc(rSummaryRow
, rCe
);
178 produce_MemberDetails(*pDetails
, rCe
);
183 HtmlFactory_Idl::produce_Title( HF_TitleTable
& o_title
,
184 const String
& i_label
,
185 const client
& i_ce
) const
189 get_Annotations(slAnnotations(), i_ce
);
192 slTitle() << i_label
<< " " << i_ce
.LocalName();
193 o_title
.Produce_Title( slAnnotations().c_str(),
198 HtmlFactory_Idl::get_Annotations( StreamStr
& o_out
,
199 const client
& i_ce
) const
201 const ary::doc::OldIdlDocu
*
202 doc
= Get_IdlDocu(i_ce
.Docu());
205 if (doc
->IsDeprecated())
206 o_out
<< "deprecated ";
207 if (NOT doc
->IsPublished())
208 o_out
<< "unpublished ";
212 // Need to display "unpublished", if there is no docu.
216 HtmlFactory_Idl::write_Docu( Xml::Element
& o_screen
,
217 const client
& i_ce
) const
219 const ary::doc::OldIdlDocu
*
220 doc
= Get_IdlDocu(i_ce
.Docu());
224 aDocuList( o_screen
);
226 aDocu( Env(), aDocuList
);
227 aDocu
.Produce_byDocu4Reference(*doc
, i_ce
);
230 write_ManualLinks(o_screen
, i_ce
);
234 HtmlFactory_Idl::write_ManualLinks( Xml::Element
& o_screen
,
235 const client
& i_ce
) const
238 rLinks2Descrs
= i_ce
.Secondaries().Links2DescriptionInManual();
239 if ( rLinks2Descrs
.size() == 0 )
243 >> *new Html::Label(C_sLocalManualLinks
.c_str()+1) // Leave out the leading '#'.
246 aDocuList( o_screen
);
247 aDocuList
.Produce_Term("Developers Guide");
248 csv_assert(rLinks2Descrs
.size() % 2 == 0);
249 for ( StringVector::const_iterator it
= rLinks2Descrs
.begin();
250 it
!= rLinks2Descrs
.end();
254 rLink
= aDocuList
.Produce_Definition() >> *new Html::Link( Env().Link2Manual(*it
));
255 if ( (*(it
+1)).empty() )
257 // Research what happens with manual links which contain normal characters
258 // in non-utf-8 texts. And research, why utfF-8 does not work here.
259 rLink
<< new Xml::XmlCode(*it
);
261 rLink
<< new Xml::XmlCode( *(it
+1) );
267 HtmlFactory_Idl::produce_MemberDetails( HF_SubTitleTable
& ,
268 const client
& ) const
270 // Dummy, which does not need to do anything.
274 HtmlFactory_Idl::recursive_ShowBases( Xml::Element
& o_screen
,
276 int & io_nDepth
) const
280 const ary::idl::CodeEntity
*
281 pCe
= Env().Linker().Search_CeFromType(i_baseType
);
283 csv_assert(io_nDepth
> 0);
287 << (C_sSpace
+ 93 - 3*io_nDepth
)
288 << new csi::xml::XmlCode("┗")
294 aText( Env(), o_screen
, false );
295 aText
.Produce_byData( i_baseType
);
303 aBaseLink( Env(), o_screen
, true );
304 aBaseLink
.Produce_byData(pCe
->CeId());
310 nBaseT
= baseOf(*pCe
);
311 if (nBaseT
.IsValid())
312 recursive_ShowBases(o_screen
,nBaseT
,io_nDepth
);
318 HtmlFactory_Idl::type_id
319 HtmlFactory_Idl::inq_BaseOf( const client
& ) const