1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include "hi_factory.hxx"
33 // NOT FULLY DEFINED SERVICES
34 #include <ary/idl/i_ce.hxx>
35 #include <toolkit/hf_title.hxx>
36 #include "hfi_doc.hxx"
37 #include "hfi_navibar.hxx"
38 #include "hfi_tag.hxx"
39 #include "hfi_typetext.hxx"
40 #include "hi_linkhelper.hxx"
44 C_sCellStyle_SummaryLeft("imsum_left");
46 C_sCellStyle_SummaryRight("imsum_right");
48 C_sCellStyle_MDetail("imdetail");
50 C_sMemberTitle("membertitle");
56 const char C_sSpace
[92] = " "
63 HtmlFactory_Idl::produce_SummaryDeclaration( Xml::Element
& o_row
,
64 const client
& i_ce
) const
66 produce_InternalLink(o_row
, i_ce
);
70 HtmlFactory_Idl::produce_InternalLink( Xml::Element
& o_screen
,
71 const client
& i_ce
) const
73 StreamLock
aLocalLink(100);
74 aLocalLink() << "#" << i_ce
.LocalName();
77 >> *new Html::TableCell
78 << new Html::ClassAttr( C_sCellStyle_SummaryLeft
)
79 >> *new Html::Link( aLocalLink().c_str() )
84 HtmlFactory_Idl::produce_ShortDoc( Xml::Element
& o_screen
,
85 const client
& i_ce
) const
88 rDetailsRowCell
= o_screen
89 >> *new Html::TableCell
90 << new Html::ClassAttr( C_sCellStyle_SummaryRight
);
92 aLinkDoc(Env(), rDetailsRowCell
);
93 aLinkDoc
.Produce_byData( i_ce
);
95 rDetailsRowCell
<< new Xml::XmlCode(" ");
98 // KORR_FUTURE: Does not belong here (implementation inheritance)!
100 HtmlFactory_Idl::produce_Bases( Xml::Element
& o_screen
,
102 const String
& i_sLabel
) const
104 ary::idl::Type_id nBaseT
= baseOf(i_ce
);
105 if ( nBaseT
.IsValid() )
108 aDocList( o_screen
);
109 aDocList
.Produce_Term(i_sLabel
);
113 rBaseList
= aDocList
.Produce_Definition()
114 >> *new Xml::AnElement("pre")
115 << new Xml::AnAttribute("style","font-family:monospace;");
121 recursive_ShowBases( rBaseList
,
128 HtmlFactory_Idl::produce_Members( ce_list
& it_list
,
129 const String
& i_summaryTitle
,
130 const String
& i_summaryLabel
,
131 const String
& i_detailsTitle
,
132 const String
& i_detailsLabel
,
133 const E_MemberViewType i_viewType
) const
135 csv_assert( it_list
);
137 Dyn
< HF_SubTitleTable
> pSummary
;
138 if ( ( i_viewType
== viewtype_summary
)
139 || ( i_viewType
== viewtype_complete
)
142 pSummary
= new HF_SubTitleTable(
149 Dyn
< HF_SubTitleTable
> pDetails
;
150 if ( ( i_viewType
== viewtype_details
)
151 || ( i_viewType
== viewtype_complete
)
154 pDetails
= new HF_SubTitleTable(
161 for ( ; it_list
.operator bool(); ++it_list
)
163 const ary::idl::CodeEntity
&
164 rCe
= Env().Data().Find_Ce(*it_list
);
169 rSummaryRow
= pSummary
->Add_Row();
170 produce_SummaryDeclaration(rSummaryRow
, rCe
);
171 // produce_InternalLink(rSummaryRow, rCe);
172 produce_ShortDoc(rSummaryRow
, rCe
);
176 produce_MemberDetails(*pDetails
, rCe
);
181 HtmlFactory_Idl::produce_Title( HF_TitleTable
& o_title
,
182 const String
& i_label
,
183 const client
& i_ce
) const
187 get_Annotations(slAnnotations(), i_ce
);
190 slTitle() << i_label
<< " " << i_ce
.LocalName();
191 o_title
.Produce_Title( slAnnotations().c_str(),
196 HtmlFactory_Idl::get_Annotations( StreamStr
& o_out
,
197 const client
& i_ce
) const
199 const ary::doc::OldIdlDocu
*
200 doc
= Get_IdlDocu(i_ce
.Docu());
203 if (doc
->IsDeprecated())
204 o_out
<< "deprecated ";
205 if (NOT doc
->IsPublished())
206 o_out
<< "unpublished ";
210 // Need to display "unpublished", if there is no docu.
214 HtmlFactory_Idl::write_Docu( Xml::Element
& o_screen
,
215 const client
& i_ce
) const
217 const ary::doc::OldIdlDocu
*
218 doc
= Get_IdlDocu(i_ce
.Docu());
222 aDocuList( o_screen
);
224 aDocu( Env(), aDocuList
);
225 aDocu
.Produce_fromCodeEntity(i_ce
);
228 write_ManualLinks(o_screen
, i_ce
);
232 HtmlFactory_Idl::write_ManualLinks( Xml::Element
& o_screen
,
233 const client
& i_ce
) const
236 rLinks2Descrs
= i_ce
.Secondaries().Links2DescriptionInManual();
237 if ( rLinks2Descrs
.empty() )
241 >> *new Html::Label(C_sLocalManualLinks
.c_str()+1) // Leave out the leading '#'.
244 aDocuList( o_screen
);
245 aDocuList
.Produce_Term("Developers Guide");
246 csv_assert(rLinks2Descrs
.size() % 2 == 0);
247 for ( StringVector::const_iterator it
= rLinks2Descrs
.begin();
248 it
!= rLinks2Descrs
.end();
252 rLink
= aDocuList
.Produce_Definition() >> *new Html::Link( Env().Link2Manual(*it
));
253 if ( (*(it
+1)).empty() )
255 // Research what happens with manual links which contain normal characters
256 // in non-utf-8 texts. And research, why utfF-8 does not work here.
257 rLink
<< new Xml::XmlCode(*it
);
259 rLink
<< new Xml::XmlCode( *(it
+1) );
265 HtmlFactory_Idl::produce_MemberDetails( HF_SubTitleTable
& ,
266 const client
& ) const
268 // Dummy, which does not need to do anything.
272 HtmlFactory_Idl::recursive_ShowBases( Xml::Element
& o_screen
,
274 int & io_nDepth
) const
278 const ary::idl::CodeEntity
*
279 pCe
= Env().Linker().Search_CeFromType(i_baseType
);
281 csv_assert(io_nDepth
> 0);
285 << (C_sSpace
+ 93 - 3*io_nDepth
)
286 << new csi::xml::XmlCode("┗")
292 aText( Env(), o_screen
, false );
293 aText
.Produce_byData( i_baseType
);
301 aBaseLink( Env(), o_screen
, true );
302 aBaseLink
.Produce_byData(pCe
->CeId());
308 nBaseT
= baseOf(*pCe
);
309 if (nBaseT
.IsValid())
310 recursive_ShowBases(o_screen
,nBaseT
,io_nDepth
);
316 HtmlFactory_Idl::type_id
317 HtmlFactory_Idl::inq_BaseOf( const client
& ) const
323 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */