Bump for 3.6-28
[LibreOffice.git] / autodoc / source / display / idl / hi_factory.cxx
blob832420f6fb9671a50cac417983fb7db8b11710a4
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 ************************************************************************/
29 #include <precomp.h>
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"
43 extern const String
44 C_sCellStyle_SummaryLeft("imsum_left");
45 extern const String
46 C_sCellStyle_SummaryRight("imsum_right");
47 extern const String
48 C_sCellStyle_MDetail("imdetail");
49 extern const String
50 C_sMemberTitle("membertitle");
53 namespace
56 const char C_sSpace[92] = " "
57 " "
58 " ";
62 void
63 HtmlFactory_Idl::produce_SummaryDeclaration( Xml::Element & o_row,
64 const client & i_ce ) const
66 produce_InternalLink(o_row, i_ce);
69 void
70 HtmlFactory_Idl::produce_InternalLink( Xml::Element & o_screen,
71 const client & i_ce ) const
73 StreamLock aLocalLink(100);
74 aLocalLink() << "#" << i_ce.LocalName();
76 o_screen
77 >> *new Html::TableCell
78 << new Html::ClassAttr( C_sCellStyle_SummaryLeft )
79 >> *new Html::Link( aLocalLink().c_str() )
80 << i_ce.LocalName();
83 void
84 HtmlFactory_Idl::produce_ShortDoc( Xml::Element & o_screen,
85 const client & i_ce ) const
87 Xml::Element &
88 rDetailsRowCell = o_screen
89 >> *new Html::TableCell
90 << new Html::ClassAttr( C_sCellStyle_SummaryRight );
91 HF_IdlShortDocu
92 aLinkDoc(Env(), rDetailsRowCell);
93 aLinkDoc.Produce_byData( i_ce );
95 rDetailsRowCell << new Xml::XmlCode("&nbsp;");
98 // KORR_FUTURE: Does not belong here (implementation inheritance)!
99 void
100 HtmlFactory_Idl::produce_Bases( Xml::Element & o_screen,
101 const client & i_ce,
102 const String & i_sLabel ) const
104 ary::idl::Type_id nBaseT = baseOf(i_ce);
105 if ( nBaseT.IsValid() )
107 HF_DocEntryList
108 aDocList( o_screen );
109 aDocList.Produce_Term(i_sLabel);
111 int nDepth = 0;
112 Xml::Element &
113 rBaseList = aDocList.Produce_Definition()
114 >> *new Xml::AnElement("pre")
115 << new Xml::AnAttribute("style","font-family:monospace;");
116 rBaseList
117 >> *new Html::Strong
118 << i_ce.LocalName();
119 rBaseList
120 << "\n";
121 recursive_ShowBases( rBaseList,
122 nBaseT,
123 nDepth );
127 void
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(
143 CurOut(),
144 i_summaryLabel,
145 i_summaryTitle,
146 2 );
149 Dyn< HF_SubTitleTable > pDetails;
150 if ( ( i_viewType == viewtype_details )
151 || ( i_viewType == viewtype_complete )
154 pDetails = new HF_SubTitleTable(
155 CurOut(),
156 i_detailsLabel,
157 i_detailsTitle,
158 1 );
161 for ( ; it_list.operator bool(); ++it_list )
163 const ary::idl::CodeEntity &
164 rCe = Env().Data().Find_Ce(*it_list);
166 if ( pSummary )
168 Xml::Element &
169 rSummaryRow = pSummary->Add_Row();
170 produce_SummaryDeclaration(rSummaryRow, rCe);
171 // produce_InternalLink(rSummaryRow, rCe);
172 produce_ShortDoc(rSummaryRow, rCe);
175 if ( pDetails )
176 produce_MemberDetails(*pDetails, rCe);
180 void
181 HtmlFactory_Idl::produce_Title( HF_TitleTable & o_title,
182 const String & i_label,
183 const client & i_ce ) const
185 StreamLock
186 slAnnotations(200);
187 get_Annotations(slAnnotations(), i_ce);
188 StreamLock
189 slTitle(200);
190 slTitle() << i_label << " " << i_ce.LocalName();
191 o_title.Produce_Title( slAnnotations().c_str(),
192 slTitle().c_str() );
195 void
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());
201 if (doc != 0)
203 if (doc->IsDeprecated())
204 o_out << "deprecated ";
205 if (NOT doc->IsPublished())
206 o_out << "unpublished ";
209 // KORR
210 // Need to display "unpublished", if there is no docu.
213 void
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());
219 if (doc != 0)
221 HF_DocEntryList
222 aDocuList( o_screen );
223 HF_IdlDocu
224 aDocu( Env(), aDocuList );
225 aDocu.Produce_fromCodeEntity(i_ce);
228 write_ManualLinks(o_screen, i_ce);
231 void
232 HtmlFactory_Idl::write_ManualLinks( Xml::Element & o_screen,
233 const client & i_ce ) const
235 const StringVector &
236 rLinks2Descrs = i_ce.Secondaries().Links2DescriptionInManual();
237 if ( rLinks2Descrs.empty() )
238 return;
240 o_screen
241 >> *new Html::Label(C_sLocalManualLinks.c_str()+1) // Leave out the leading '#'.
242 << " ";
243 HF_DocEntryList
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();
249 ++it )
251 Xml::Element &
252 rLink = aDocuList.Produce_Definition() >> *new Html::Link( Env().Link2Manual(*it));
253 if ( (*(it+1)).empty() )
254 // HACK KORR_FUTURE
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);
258 else
259 rLink << new Xml::XmlCode( *(it+1) );
260 ++it;
261 } // end for
264 void
265 HtmlFactory_Idl::produce_MemberDetails( HF_SubTitleTable & ,
266 const client & ) const
268 // Dummy, which does not need to do anything.
271 void
272 HtmlFactory_Idl::recursive_ShowBases( Xml::Element & o_screen,
273 type_id i_baseType,
274 int & io_nDepth ) const
276 // Show this base
277 ++io_nDepth;
278 const ary::idl::CodeEntity *
279 pCe = Env().Linker().Search_CeFromType(i_baseType);
281 csv_assert(io_nDepth > 0);
282 if (io_nDepth > 30)
283 io_nDepth = 30;
284 o_screen
285 << (C_sSpace + 93 - 3*io_nDepth)
286 << new csi::xml::XmlCode("&#x2517")
287 << " ";
289 if (pCe == 0)
291 HF_IdlTypeText
292 aText( Env(), o_screen, false );
293 aText.Produce_byData( i_baseType );
294 o_screen
295 << "\n";
296 --io_nDepth;
297 return;
300 HF_IdlTypeText
301 aBaseLink( Env(), o_screen, true );
302 aBaseLink.Produce_byData(pCe->CeId());
303 o_screen
304 << "\n";
306 // Bases
307 ary::idl::Type_id
308 nBaseT = baseOf(*pCe);
309 if (nBaseT.IsValid())
310 recursive_ShowBases(o_screen,nBaseT,io_nDepth);
312 --io_nDepth;
313 return;
316 HtmlFactory_Idl::type_id
317 HtmlFactory_Idl::inq_BaseOf( const client & ) const
319 // Unused dummy.
320 return type_id(0);
323 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */