1*0841af79SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*0841af79SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*0841af79SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*0841af79SAndrew Rist * distributed with this work for additional information
6*0841af79SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*0841af79SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*0841af79SAndrew Rist * "License"); you may not use this file except in compliance
9*0841af79SAndrew Rist * with the License. You may obtain a copy of the License at
10*0841af79SAndrew Rist *
11*0841af79SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*0841af79SAndrew Rist *
13*0841af79SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*0841af79SAndrew Rist * software distributed under the License is distributed on an
15*0841af79SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*0841af79SAndrew Rist * KIND, either express or implied. See the License for the
17*0841af79SAndrew Rist * specific language governing permissions and limitations
18*0841af79SAndrew Rist * under the License.
19*0841af79SAndrew Rist *
20*0841af79SAndrew Rist *************************************************************/
21cdf0e10cSrcweir
22cdf0e10cSrcweir #include <precomp.h>
23cdf0e10cSrcweir #include "hi_factory.hxx"
24cdf0e10cSrcweir
25cdf0e10cSrcweir
26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
27cdf0e10cSrcweir #include <ary/idl/i_ce.hxx>
28cdf0e10cSrcweir #include <toolkit/hf_title.hxx>
29cdf0e10cSrcweir #include "hfi_doc.hxx"
30cdf0e10cSrcweir #include "hfi_navibar.hxx"
31cdf0e10cSrcweir #include "hfi_tag.hxx"
32cdf0e10cSrcweir #include "hfi_typetext.hxx"
33cdf0e10cSrcweir #include "hi_linkhelper.hxx"
34cdf0e10cSrcweir
35cdf0e10cSrcweir
36cdf0e10cSrcweir extern const String
37cdf0e10cSrcweir C_sCellStyle_SummaryLeft("imsum_left");
38cdf0e10cSrcweir extern const String
39cdf0e10cSrcweir C_sCellStyle_SummaryRight("imsum_right");
40cdf0e10cSrcweir extern const String
41cdf0e10cSrcweir C_sCellStyle_MDetail("imdetail");
42cdf0e10cSrcweir extern const String
43cdf0e10cSrcweir C_sMemberTitle("membertitle");
44cdf0e10cSrcweir
45cdf0e10cSrcweir
46cdf0e10cSrcweir namespace
47cdf0e10cSrcweir {
48cdf0e10cSrcweir
49cdf0e10cSrcweir const char C_sSpace[92] = " "
50cdf0e10cSrcweir " "
51cdf0e10cSrcweir " ";
52cdf0e10cSrcweir }
53cdf0e10cSrcweir
54cdf0e10cSrcweir
55cdf0e10cSrcweir void
produce_SummaryDeclaration(Xml::Element & o_row,const client & i_ce) const56cdf0e10cSrcweir HtmlFactory_Idl::produce_SummaryDeclaration( Xml::Element & o_row,
57cdf0e10cSrcweir const client & i_ce ) const
58cdf0e10cSrcweir {
59cdf0e10cSrcweir produce_InternalLink(o_row, i_ce);
60cdf0e10cSrcweir }
61cdf0e10cSrcweir
62cdf0e10cSrcweir void
produce_InternalLink(Xml::Element & o_screen,const client & i_ce) const63cdf0e10cSrcweir HtmlFactory_Idl::produce_InternalLink( Xml::Element & o_screen,
64cdf0e10cSrcweir const client & i_ce ) const
65cdf0e10cSrcweir {
66cdf0e10cSrcweir StreamLock aLocalLink(100);
67cdf0e10cSrcweir aLocalLink() << "#" << i_ce.LocalName();
68cdf0e10cSrcweir
69cdf0e10cSrcweir o_screen
70cdf0e10cSrcweir >> *new Html::TableCell
71cdf0e10cSrcweir << new Html::ClassAttr( C_sCellStyle_SummaryLeft )
72cdf0e10cSrcweir >> *new Html::Link( aLocalLink().c_str() )
73cdf0e10cSrcweir << i_ce.LocalName();
74cdf0e10cSrcweir }
75cdf0e10cSrcweir
76cdf0e10cSrcweir void
produce_ShortDoc(Xml::Element & o_screen,const client & i_ce) const77cdf0e10cSrcweir HtmlFactory_Idl::produce_ShortDoc( Xml::Element & o_screen,
78cdf0e10cSrcweir const client & i_ce ) const
79cdf0e10cSrcweir {
80cdf0e10cSrcweir Xml::Element &
81cdf0e10cSrcweir rDetailsRowCell = o_screen
82cdf0e10cSrcweir >> *new Html::TableCell
83cdf0e10cSrcweir << new Html::ClassAttr( C_sCellStyle_SummaryRight );
84cdf0e10cSrcweir HF_IdlShortDocu
85cdf0e10cSrcweir aLinkDoc(Env(), rDetailsRowCell);
86cdf0e10cSrcweir aLinkDoc.Produce_byData( i_ce );
87cdf0e10cSrcweir
88cdf0e10cSrcweir rDetailsRowCell << new Xml::XmlCode(" ");
89cdf0e10cSrcweir }
90cdf0e10cSrcweir
91cdf0e10cSrcweir // KORR_FUTURE: Does not belong here (implementation inheritance)!
92cdf0e10cSrcweir void
produce_Bases(Xml::Element & o_screen,const client & i_ce,const String & i_sLabel) const93cdf0e10cSrcweir HtmlFactory_Idl::produce_Bases( Xml::Element & o_screen,
94cdf0e10cSrcweir const client & i_ce,
95cdf0e10cSrcweir const String & i_sLabel ) const
96cdf0e10cSrcweir {
97cdf0e10cSrcweir ary::idl::Type_id nBaseT = baseOf(i_ce);
98cdf0e10cSrcweir if ( nBaseT.IsValid() )
99cdf0e10cSrcweir {
100cdf0e10cSrcweir HF_DocEntryList
101cdf0e10cSrcweir aDocList( o_screen );
102cdf0e10cSrcweir aDocList.Produce_Term(i_sLabel);
103cdf0e10cSrcweir
104cdf0e10cSrcweir int nDepth = 0;
105cdf0e10cSrcweir Xml::Element &
106cdf0e10cSrcweir rBaseList = aDocList.Produce_Definition()
107cdf0e10cSrcweir >> *new Xml::AnElement("pre")
108cdf0e10cSrcweir << new Xml::AnAttribute("style","font-family:monospace;");
109cdf0e10cSrcweir rBaseList
110cdf0e10cSrcweir >> *new Html::Strong
111cdf0e10cSrcweir << i_ce.LocalName();
112cdf0e10cSrcweir rBaseList
113cdf0e10cSrcweir << "\n";
114cdf0e10cSrcweir recursive_ShowBases( rBaseList,
115cdf0e10cSrcweir nBaseT,
116cdf0e10cSrcweir nDepth );
117cdf0e10cSrcweir }
118cdf0e10cSrcweir }
119cdf0e10cSrcweir
120cdf0e10cSrcweir void
produce_Members(ce_list & it_list,const String & i_summaryTitle,const String & i_summaryLabel,const String & i_detailsTitle,const String & i_detailsLabel,const E_MemberViewType i_viewType) const121cdf0e10cSrcweir HtmlFactory_Idl::produce_Members( ce_list & it_list,
122cdf0e10cSrcweir const String & i_summaryTitle,
123cdf0e10cSrcweir const String & i_summaryLabel,
124cdf0e10cSrcweir const String & i_detailsTitle,
125cdf0e10cSrcweir const String & i_detailsLabel,
126cdf0e10cSrcweir const E_MemberViewType i_viewType ) const
127cdf0e10cSrcweir {
128cdf0e10cSrcweir csv_assert( it_list );
129cdf0e10cSrcweir
130cdf0e10cSrcweir Dyn< HF_SubTitleTable > pSummary;
131cdf0e10cSrcweir if ( ( i_viewType == viewtype_summary )
132cdf0e10cSrcweir || ( i_viewType == viewtype_complete )
133cdf0e10cSrcweir )
134cdf0e10cSrcweir {
135cdf0e10cSrcweir pSummary = new HF_SubTitleTable(
136cdf0e10cSrcweir CurOut(),
137cdf0e10cSrcweir i_summaryLabel,
138cdf0e10cSrcweir i_summaryTitle,
139cdf0e10cSrcweir 2 );
140cdf0e10cSrcweir }
141cdf0e10cSrcweir
142cdf0e10cSrcweir Dyn< HF_SubTitleTable > pDetails;
143cdf0e10cSrcweir if ( ( i_viewType == viewtype_details )
144cdf0e10cSrcweir || ( i_viewType == viewtype_complete )
145cdf0e10cSrcweir )
146cdf0e10cSrcweir {
147cdf0e10cSrcweir pDetails = new HF_SubTitleTable(
148cdf0e10cSrcweir CurOut(),
149cdf0e10cSrcweir i_detailsLabel,
150cdf0e10cSrcweir i_detailsTitle,
151cdf0e10cSrcweir 1 );
152cdf0e10cSrcweir }
153cdf0e10cSrcweir
154cdf0e10cSrcweir for ( ; it_list.operator bool(); ++it_list )
155cdf0e10cSrcweir {
156cdf0e10cSrcweir const ary::idl::CodeEntity &
157cdf0e10cSrcweir rCe = Env().Data().Find_Ce(*it_list);
158cdf0e10cSrcweir
159cdf0e10cSrcweir if ( pSummary )
160cdf0e10cSrcweir {
161cdf0e10cSrcweir Xml::Element &
162cdf0e10cSrcweir rSummaryRow = pSummary->Add_Row();
163cdf0e10cSrcweir produce_SummaryDeclaration(rSummaryRow, rCe);
164cdf0e10cSrcweir // produce_InternalLink(rSummaryRow, rCe);
165cdf0e10cSrcweir produce_ShortDoc(rSummaryRow, rCe);
166cdf0e10cSrcweir }
167cdf0e10cSrcweir
168cdf0e10cSrcweir if ( pDetails )
169cdf0e10cSrcweir produce_MemberDetails(*pDetails, rCe);
170cdf0e10cSrcweir }
171cdf0e10cSrcweir }
172cdf0e10cSrcweir
173cdf0e10cSrcweir void
produce_Title(HF_TitleTable & o_title,const String & i_label,const client & i_ce) const174cdf0e10cSrcweir HtmlFactory_Idl::produce_Title( HF_TitleTable & o_title,
175cdf0e10cSrcweir const String & i_label,
176cdf0e10cSrcweir const client & i_ce ) const
177cdf0e10cSrcweir {
178cdf0e10cSrcweir StreamLock
179cdf0e10cSrcweir slAnnotations(200);
180cdf0e10cSrcweir get_Annotations(slAnnotations(), i_ce);
181cdf0e10cSrcweir StreamLock
182cdf0e10cSrcweir slTitle(200);
183cdf0e10cSrcweir slTitle() << i_label << " " << i_ce.LocalName();
184cdf0e10cSrcweir o_title.Produce_Title( slAnnotations().c_str(),
185cdf0e10cSrcweir slTitle().c_str() );
186cdf0e10cSrcweir }
187cdf0e10cSrcweir
188cdf0e10cSrcweir void
get_Annotations(StreamStr & o_out,const client & i_ce) const189cdf0e10cSrcweir HtmlFactory_Idl::get_Annotations( StreamStr & o_out,
190cdf0e10cSrcweir const client & i_ce ) const
191cdf0e10cSrcweir {
192cdf0e10cSrcweir const ary::doc::OldIdlDocu *
193cdf0e10cSrcweir doc = Get_IdlDocu(i_ce.Docu());
194cdf0e10cSrcweir if (doc != 0)
195cdf0e10cSrcweir {
196cdf0e10cSrcweir if (doc->IsDeprecated())
197cdf0e10cSrcweir o_out << "deprecated ";
198cdf0e10cSrcweir if (NOT doc->IsPublished())
199cdf0e10cSrcweir o_out << "unpublished ";
200cdf0e10cSrcweir }
201cdf0e10cSrcweir
202cdf0e10cSrcweir // KORR
203cdf0e10cSrcweir // Need to display "unpublished", if there is no docu.
204cdf0e10cSrcweir }
205cdf0e10cSrcweir
206cdf0e10cSrcweir void
write_Docu(Xml::Element & o_screen,const client & i_ce) const207cdf0e10cSrcweir HtmlFactory_Idl::write_Docu( Xml::Element & o_screen,
208cdf0e10cSrcweir const client & i_ce ) const
209cdf0e10cSrcweir {
210cdf0e10cSrcweir const ary::doc::OldIdlDocu *
211cdf0e10cSrcweir doc = Get_IdlDocu(i_ce.Docu());
212cdf0e10cSrcweir if (doc != 0)
213cdf0e10cSrcweir {
214cdf0e10cSrcweir HF_DocEntryList
215cdf0e10cSrcweir aDocuList( o_screen );
216cdf0e10cSrcweir HF_IdlDocu
217cdf0e10cSrcweir aDocu( Env(), aDocuList );
218cdf0e10cSrcweir aDocu.Produce_fromCodeEntity(i_ce);
219cdf0e10cSrcweir }
220cdf0e10cSrcweir
221cdf0e10cSrcweir write_ManualLinks(o_screen, i_ce);
222cdf0e10cSrcweir }
223cdf0e10cSrcweir
224cdf0e10cSrcweir void
write_ManualLinks(Xml::Element & o_screen,const client & i_ce) const225cdf0e10cSrcweir HtmlFactory_Idl::write_ManualLinks( Xml::Element & o_screen,
226cdf0e10cSrcweir const client & i_ce ) const
227cdf0e10cSrcweir {
228cdf0e10cSrcweir const StringVector &
229cdf0e10cSrcweir rLinks2Descrs = i_ce.Secondaries().Links2DescriptionInManual();
230cdf0e10cSrcweir if ( rLinks2Descrs.size() == 0 )
231cdf0e10cSrcweir return;
232cdf0e10cSrcweir
233cdf0e10cSrcweir o_screen
234cdf0e10cSrcweir >> *new Html::Label(C_sLocalManualLinks.c_str()+1) // Leave out the leading '#'.
235cdf0e10cSrcweir << " ";
236cdf0e10cSrcweir HF_DocEntryList
237cdf0e10cSrcweir aDocuList( o_screen );
238cdf0e10cSrcweir aDocuList.Produce_Term("Developers Guide");
239cdf0e10cSrcweir csv_assert(rLinks2Descrs.size() % 2 == 0);
240cdf0e10cSrcweir for ( StringVector::const_iterator it = rLinks2Descrs.begin();
241cdf0e10cSrcweir it != rLinks2Descrs.end();
242cdf0e10cSrcweir ++it )
243cdf0e10cSrcweir {
244cdf0e10cSrcweir Xml::Element &
245cdf0e10cSrcweir rLink = aDocuList.Produce_Definition() >> *new Html::Link( Env().Link2Manual(*it));
246cdf0e10cSrcweir if ( (*(it+1)).empty() )
247cdf0e10cSrcweir // HACK KORR_FUTURE
248cdf0e10cSrcweir // Research what happens with manual links which contain normal characters
249cdf0e10cSrcweir // in non-utf-8 texts. And research, why utfF-8 does not work here.
250cdf0e10cSrcweir rLink << new Xml::XmlCode(*it);
251cdf0e10cSrcweir else
252cdf0e10cSrcweir rLink << new Xml::XmlCode( *(it+1) );
253cdf0e10cSrcweir ++it;
254cdf0e10cSrcweir } // end for
255cdf0e10cSrcweir }
256cdf0e10cSrcweir
257cdf0e10cSrcweir void
produce_MemberDetails(HF_SubTitleTable &,const client &) const258cdf0e10cSrcweir HtmlFactory_Idl::produce_MemberDetails( HF_SubTitleTable & ,
259cdf0e10cSrcweir const client & ) const
260cdf0e10cSrcweir {
261cdf0e10cSrcweir // Dummy, which does not need to do anything.
262cdf0e10cSrcweir }
263cdf0e10cSrcweir
264cdf0e10cSrcweir void
recursive_ShowBases(Xml::Element & o_screen,type_id i_baseType,int & io_nDepth) const265cdf0e10cSrcweir HtmlFactory_Idl::recursive_ShowBases( Xml::Element & o_screen,
266cdf0e10cSrcweir type_id i_baseType,
267cdf0e10cSrcweir int & io_nDepth ) const
268cdf0e10cSrcweir {
269cdf0e10cSrcweir // Show this base
270cdf0e10cSrcweir ++io_nDepth;
271cdf0e10cSrcweir const ary::idl::CodeEntity *
272cdf0e10cSrcweir pCe = Env().Linker().Search_CeFromType(i_baseType);
273cdf0e10cSrcweir
274cdf0e10cSrcweir csv_assert(io_nDepth > 0);
275cdf0e10cSrcweir if (io_nDepth > 30)
276cdf0e10cSrcweir io_nDepth = 30;
277cdf0e10cSrcweir o_screen
278cdf0e10cSrcweir << (C_sSpace + 93 - 3*io_nDepth)
279cdf0e10cSrcweir << new csi::xml::XmlCode("┗")
280cdf0e10cSrcweir << " ";
281cdf0e10cSrcweir
282cdf0e10cSrcweir if (pCe == 0)
283cdf0e10cSrcweir {
284cdf0e10cSrcweir HF_IdlTypeText
285cdf0e10cSrcweir aText( Env(), o_screen, false );
286cdf0e10cSrcweir aText.Produce_byData( i_baseType );
287cdf0e10cSrcweir o_screen
288cdf0e10cSrcweir << "\n";
289cdf0e10cSrcweir --io_nDepth;
290cdf0e10cSrcweir return;
291cdf0e10cSrcweir }
292cdf0e10cSrcweir
293cdf0e10cSrcweir HF_IdlTypeText
294cdf0e10cSrcweir aBaseLink( Env(), o_screen, true );
295cdf0e10cSrcweir aBaseLink.Produce_byData(pCe->CeId());
296cdf0e10cSrcweir o_screen
297cdf0e10cSrcweir << "\n";
298cdf0e10cSrcweir
299cdf0e10cSrcweir // Bases
300cdf0e10cSrcweir ary::idl::Type_id
301cdf0e10cSrcweir nBaseT = baseOf(*pCe);
302cdf0e10cSrcweir if (nBaseT.IsValid())
303cdf0e10cSrcweir recursive_ShowBases(o_screen,nBaseT,io_nDepth);
304cdf0e10cSrcweir
305cdf0e10cSrcweir --io_nDepth;
306cdf0e10cSrcweir return;
307cdf0e10cSrcweir }
308cdf0e10cSrcweir
309cdf0e10cSrcweir HtmlFactory_Idl::type_id
inq_BaseOf(const client &) const310cdf0e10cSrcweir HtmlFactory_Idl::inq_BaseOf( const client & ) const
311cdf0e10cSrcweir {
312cdf0e10cSrcweir // Unused dummy.
313cdf0e10cSrcweir return type_id(0);
314cdf0e10cSrcweir }
315cdf0e10cSrcweir
316