Update ooo320-m1
[ooovba.git] / autodoc / source / display / html / html_kit.cxx
blobc765d26186e04d59eb88a70d8b895634c0ea61bf
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: html_kit.cxx,v $
10 * $Revision: 1.10 $
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 ************************************************************************/
31 #include <precomp.h>
32 #include "html_kit.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <stdio.h>
37 #include <ary/cpp/c_slntry.hxx>
38 #include "hdimpl.hxx"
41 namespace adcdisp
45 using namespace csi::xml;
46 using namespace csi::html;
49 void
50 PageTitle_Left::operator()( XmlElement & o_rOwner,
51 const char * i_sTypeTitle,
52 const String & i_sLocalName )
54 o_rOwner
55 >> *new Headline(2)
56 << i_sTypeTitle
57 << " "
58 << i_sLocalName;
61 void
62 PageTitle_Std::operator()( XmlElement & o_rOwner,
63 const char * i_sTypeTitle,
64 const String & i_sLocalName )
66 o_rOwner
67 >> *new AnElement("div")
68 << new ClassAttr("title")
69 >> *new Headline(2)
70 << i_sTypeTitle
71 << " "
72 << i_sLocalName;
75 XmlElement &
76 PageTitle_Std::operator()( XmlElement & o_rOwner )
78 XmlElement & ret =
79 o_rOwner
80 >> *new AnElement("div")
81 << new ClassAttr("title")
82 >> *new Headline(2);
83 return ret;
86 void
87 OperationTitle::operator()( XmlElement & o_owner,
88 const char * i_itemName,
89 ary::cpp::Ce_id i_id,
90 const ::ary::cpp::Gate & i_gate )
92 o_owner
93 >> *new Label( OperationLabel(i_itemName, i_id, i_gate) )
94 << " ";
95 o_owner
96 << i_itemName;
100 void
101 TemplateClause::operator()( XmlElement & o_rOwner,
102 const List_TplParams & i_rTplParams )
104 if ( i_rTplParams.size() == 0 )
105 return;
107 Element & rOut =
108 o_rOwner
109 << new LineBreak
110 >> *new Paragraph
111 >> *new Strong
112 << "template< ";
114 List_TplParams::const_iterator
115 it = i_rTplParams.begin();
116 List_TplParams::const_iterator
117 itEnd = i_rTplParams.end();
119 rOut
120 << (*it).Name();
121 for ( ++it; it != itEnd; ++it )
123 rOut
124 << ", "
125 << (*it).Name();
126 } // end for
127 rOut << " >";
130 ExplanationList::ExplanationList( XmlElement & o_rOwner,
131 bool i_bMemberStyle )
132 : pList( new DefList),
133 pTerm(0),
134 pDefinition(0),
135 bMemberStyle(i_bMemberStyle)
137 if (bMemberStyle)
138 *pList << new ClassAttr("member");
140 o_rOwner << pList;
143 void
144 ExplanationList::AddEntry( const char * i_sTerm,
145 const char * i_sDifferentClass )
147 DefListTerm & rNewTerm = pList->AddTerm();
148 if ( i_sDifferentClass != 0 )
150 rNewTerm << new ClassAttr(i_sDifferentClass);
152 else if (bMemberStyle)
154 rNewTerm << new ClassAttr("member");
156 if ( i_sTerm != 0 )
157 rNewTerm << i_sTerm;
159 pTerm = &rNewTerm;
160 pDefinition = &pList->AddDefinition();
161 if (bMemberStyle)
162 *pDefinition << new ClassAttr("member");
165 void
166 ExplanationList::AddEntry_NoTerm()
168 pTerm = 0;
169 pDefinition = &pList->AddDefinition();
170 if (bMemberStyle)
171 *pDefinition << new ClassAttr("member");
174 ExplanationTable::ExplanationTable( XmlElement & o_rOwner )
175 : pTable(0),
176 pTerm(0),
177 pDefinition(0)
179 pTable = new Table("0", "100%", "3", "0");
180 *pTable << new AnAttribute("class", "expl-table");
181 o_rOwner << pTable;
184 void
185 ExplanationTable::AddEntry( const char * i_sTerm,
186 const char * i_sDifferentStyle )
188 TableRow &
189 rNewRow = pTable->AddRow();
190 TableCell &
191 rNewTerm = rNewRow.AddCell();
192 TableCell &
193 rNewDefinition = rNewRow.AddCell();
195 if ( i_sDifferentStyle == 0 )
197 rNewTerm << new WidthAttr("15%")
198 << new StyleAttr("vertical-align:top; font-weight:bold");
200 else
202 rNewTerm << new StyleAttr(i_sDifferentStyle);
204 if ( i_sTerm != 0 )
205 rNewTerm << i_sTerm;
207 pTerm = &rNewTerm;
208 pDefinition = & (rNewDefinition >> *new APureElement("pre"));
211 ParameterTable::ParameterTable( XmlElement & o_rOwner )
212 : pTable(0),
213 pTerm(0),
214 pDefinition(0)
216 pTable = new Table;
217 *pTable << new AnAttribute("class", "param-table");
218 o_rOwner << pTable;
221 void
222 ParameterTable::AddEntry()
224 TableRow &
225 rNewRow = pTable->AddRow();
226 TableCell &
227 rNewTerm = rNewRow.AddCell();
228 TableCell &
229 rNewDefinition = rNewRow.AddCell();
231 pTerm = &rNewTerm;
232 pDefinition = &rNewDefinition;
235 FlagTable::FlagTable( XmlElement & o_rOwner,
236 uintt i_nNrOfColumns )
238 pTable = new Table;
239 *pTable << new AnAttribute("class", "flag-table");
240 *pTable << new AnAttribute("border", "1");
241 *pTable << new AnAttribute("cellspacing", "0");
242 o_rOwner << pTable;
244 TableRow & rRow1 = pTable->AddRow();
245 TableRow & rRow2 = pTable->AddRow();
247 for ( uintt c = 0; c < i_nNrOfColumns; ++c )
249 TableCell & rCell1 = rRow1.AddCell();
250 int nWidth = 100 / i_nNrOfColumns;
251 static char sWidth[20];
252 sprintf( sWidth, "%d%%", nWidth ); // SAFE SPRINTF (#100211# - checked)
254 rCell1
255 << new WidthAttr( sWidth )
256 << new ClassAttr( "flagname" );
257 TableCell & rCell2 = rRow2.AddCell();
258 aCells.push_back( CellPair(&rCell1, &rCell2) );
259 } // end for
262 void
263 FlagTable::SetColumn( uintt i_nColumnPosition,
264 const char * i_sColumnName,
265 bool i_bValue )
267 csv_assert( i_nColumnPosition < aCells.size() );
269 TableCell &
270 rCell1 = *aCells[i_nColumnPosition].first;
271 TableCell &
272 rCell2 = *aCells[i_nColumnPosition].second;
273 rCell1
274 << i_sColumnName;
275 if (i_bValue)
277 rCell2
278 << new ClassAttr("flagyes")
279 << "YES";
281 else //
283 rCell2
284 << new ClassAttr("flagno")
285 << "NO";
286 } // endif
289 IndexList::IndexList( XmlElement & o_rOwner )
290 : pList( new DefList ),
291 pTerm(0),
292 pDefinition(0)
294 o_rOwner << pList;
297 void
298 IndexList::AddEntry()
300 pTerm = &pList->AddTerm();
301 pDefinition = &pList->AddDefinition();
305 } // namespace adcdisp