xref: /AOO41X/main/autodoc/source/display/html/html_kit.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #include <precomp.h>
29*cdf0e10cSrcweir #include "html_kit.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
33*cdf0e10cSrcweir #include <stdio.h>
34*cdf0e10cSrcweir #include <ary/cpp/c_slntry.hxx>
35*cdf0e10cSrcweir #include "hdimpl.hxx"
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir namespace adcdisp
39*cdf0e10cSrcweir {
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir using namespace csi::xml;
43*cdf0e10cSrcweir using namespace csi::html;
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir void
47*cdf0e10cSrcweir PageTitle_Left::operator()( XmlElement &        o_rOwner,
48*cdf0e10cSrcweir                             const char *        i_sTypeTitle,
49*cdf0e10cSrcweir                             const String &      i_sLocalName )
50*cdf0e10cSrcweir {
51*cdf0e10cSrcweir     o_rOwner
52*cdf0e10cSrcweir         >> *new Headline(2)
53*cdf0e10cSrcweir             << i_sTypeTitle
54*cdf0e10cSrcweir             << " "
55*cdf0e10cSrcweir             << i_sLocalName;
56*cdf0e10cSrcweir }
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir void
59*cdf0e10cSrcweir PageTitle_Std::operator()( XmlElement &         o_rOwner,
60*cdf0e10cSrcweir                            const char *         i_sTypeTitle,
61*cdf0e10cSrcweir                            const String &       i_sLocalName )
62*cdf0e10cSrcweir {
63*cdf0e10cSrcweir     o_rOwner
64*cdf0e10cSrcweir         >> *new AnElement("div")
65*cdf0e10cSrcweir             << new ClassAttr("title")
66*cdf0e10cSrcweir             >> *new Headline(2)
67*cdf0e10cSrcweir                 << i_sTypeTitle
68*cdf0e10cSrcweir                 << " "
69*cdf0e10cSrcweir                 << i_sLocalName;
70*cdf0e10cSrcweir }
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir XmlElement &
73*cdf0e10cSrcweir PageTitle_Std::operator()( XmlElement & o_rOwner )
74*cdf0e10cSrcweir {
75*cdf0e10cSrcweir     XmlElement & ret =
76*cdf0e10cSrcweir         o_rOwner
77*cdf0e10cSrcweir             >> *new AnElement("div")
78*cdf0e10cSrcweir                 << new ClassAttr("title")
79*cdf0e10cSrcweir                 >> *new Headline(2);
80*cdf0e10cSrcweir     return ret;
81*cdf0e10cSrcweir }
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir void
84*cdf0e10cSrcweir OperationTitle::operator()( XmlElement &                o_owner,
85*cdf0e10cSrcweir                             const char *                i_itemName,
86*cdf0e10cSrcweir                             ary::cpp::Ce_id             i_id,
87*cdf0e10cSrcweir                             const ::ary::cpp::Gate &    i_gate )
88*cdf0e10cSrcweir {
89*cdf0e10cSrcweir     o_owner
90*cdf0e10cSrcweir         >> *new Label( OperationLabel(i_itemName, i_id, i_gate) )
91*cdf0e10cSrcweir             << " ";
92*cdf0e10cSrcweir     o_owner
93*cdf0e10cSrcweir         << i_itemName;
94*cdf0e10cSrcweir }
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir void
98*cdf0e10cSrcweir TemplateClause::operator()( XmlElement &           o_rOwner,
99*cdf0e10cSrcweir                             const List_TplParams & i_rTplParams )
100*cdf0e10cSrcweir {
101*cdf0e10cSrcweir     if ( i_rTplParams.size() == 0 )
102*cdf0e10cSrcweir         return;
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir     Element & rOut =
105*cdf0e10cSrcweir         o_rOwner
106*cdf0e10cSrcweir             << new LineBreak
107*cdf0e10cSrcweir             >> *new Paragraph
108*cdf0e10cSrcweir                 >> *new Strong
109*cdf0e10cSrcweir                     << "template< ";
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir     List_TplParams::const_iterator
112*cdf0e10cSrcweir         it      = i_rTplParams.begin();
113*cdf0e10cSrcweir     List_TplParams::const_iterator
114*cdf0e10cSrcweir         itEnd   = i_rTplParams.end();
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir     rOut
117*cdf0e10cSrcweir         << (*it).Name();
118*cdf0e10cSrcweir     for ( ++it; it != itEnd; ++it )
119*cdf0e10cSrcweir     {
120*cdf0e10cSrcweir         rOut
121*cdf0e10cSrcweir             << ", "
122*cdf0e10cSrcweir             << (*it).Name();
123*cdf0e10cSrcweir     }  // end for
124*cdf0e10cSrcweir   	rOut << " >";
125*cdf0e10cSrcweir }
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir ExplanationList::ExplanationList( XmlElement & o_rOwner,
128*cdf0e10cSrcweir                                   bool         i_bMemberStyle )
129*cdf0e10cSrcweir     :   pList( new DefList),
130*cdf0e10cSrcweir         pTerm(0),
131*cdf0e10cSrcweir         pDefinition(0),
132*cdf0e10cSrcweir         bMemberStyle(i_bMemberStyle)
133*cdf0e10cSrcweir {
134*cdf0e10cSrcweir     if (bMemberStyle)
135*cdf0e10cSrcweir         *pList << new ClassAttr("member");
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir     o_rOwner << pList;
138*cdf0e10cSrcweir }
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir void
141*cdf0e10cSrcweir ExplanationList::AddEntry( const char *        i_sTerm,
142*cdf0e10cSrcweir                            const char *        i_sDifferentClass )
143*cdf0e10cSrcweir {
144*cdf0e10cSrcweir     DefListTerm & rNewTerm = pList->AddTerm();
145*cdf0e10cSrcweir     if ( i_sDifferentClass != 0 )
146*cdf0e10cSrcweir     {
147*cdf0e10cSrcweir         rNewTerm << new ClassAttr(i_sDifferentClass);
148*cdf0e10cSrcweir     }
149*cdf0e10cSrcweir     else if (bMemberStyle)
150*cdf0e10cSrcweir     {
151*cdf0e10cSrcweir         rNewTerm << new ClassAttr("member");
152*cdf0e10cSrcweir     }
153*cdf0e10cSrcweir     if ( i_sTerm != 0 )
154*cdf0e10cSrcweir         rNewTerm << i_sTerm;
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir     pTerm = &rNewTerm;
157*cdf0e10cSrcweir     pDefinition = &pList->AddDefinition();
158*cdf0e10cSrcweir     if (bMemberStyle)
159*cdf0e10cSrcweir         *pDefinition << new ClassAttr("member");
160*cdf0e10cSrcweir }
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir void
163*cdf0e10cSrcweir ExplanationList::AddEntry_NoTerm()
164*cdf0e10cSrcweir {
165*cdf0e10cSrcweir     pTerm = 0;
166*cdf0e10cSrcweir     pDefinition = &pList->AddDefinition();
167*cdf0e10cSrcweir     if (bMemberStyle)
168*cdf0e10cSrcweir         *pDefinition << new ClassAttr("member");
169*cdf0e10cSrcweir }
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir ExplanationTable::ExplanationTable( XmlElement &    o_rOwner )
172*cdf0e10cSrcweir     :   pTable(0),
173*cdf0e10cSrcweir         pTerm(0),
174*cdf0e10cSrcweir         pDefinition(0)
175*cdf0e10cSrcweir {
176*cdf0e10cSrcweir     pTable = new Table("0", "100%", "3", "0");
177*cdf0e10cSrcweir     *pTable << new AnAttribute("class", "expl-table");
178*cdf0e10cSrcweir     o_rOwner << pTable;
179*cdf0e10cSrcweir }
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir void
182*cdf0e10cSrcweir ExplanationTable::AddEntry( const char *        i_sTerm,
183*cdf0e10cSrcweir                             const char *        i_sDifferentStyle )
184*cdf0e10cSrcweir {
185*cdf0e10cSrcweir     TableRow &
186*cdf0e10cSrcweir         rNewRow = pTable->AddRow();
187*cdf0e10cSrcweir     TableCell &
188*cdf0e10cSrcweir         rNewTerm = rNewRow.AddCell();
189*cdf0e10cSrcweir     TableCell &
190*cdf0e10cSrcweir         rNewDefinition = rNewRow.AddCell();
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir     if ( i_sDifferentStyle == 0 )
193*cdf0e10cSrcweir     {
194*cdf0e10cSrcweir         rNewTerm << new WidthAttr("15%")
195*cdf0e10cSrcweir                  << new StyleAttr("vertical-align:top; font-weight:bold");
196*cdf0e10cSrcweir     }
197*cdf0e10cSrcweir     else
198*cdf0e10cSrcweir     {
199*cdf0e10cSrcweir         rNewTerm << new StyleAttr(i_sDifferentStyle);
200*cdf0e10cSrcweir     }
201*cdf0e10cSrcweir     if ( i_sTerm != 0 )
202*cdf0e10cSrcweir         rNewTerm << i_sTerm;
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir     pTerm = &rNewTerm;
205*cdf0e10cSrcweir     pDefinition = & (rNewDefinition >> *new APureElement("pre"));
206*cdf0e10cSrcweir }
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir ParameterTable::ParameterTable( XmlElement &    o_rOwner )
209*cdf0e10cSrcweir     :   pTable(0),
210*cdf0e10cSrcweir         pTerm(0),
211*cdf0e10cSrcweir         pDefinition(0)
212*cdf0e10cSrcweir {
213*cdf0e10cSrcweir     pTable = new Table;
214*cdf0e10cSrcweir     *pTable << new AnAttribute("class", "param-table");
215*cdf0e10cSrcweir     o_rOwner << pTable;
216*cdf0e10cSrcweir }
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir void
219*cdf0e10cSrcweir ParameterTable::AddEntry()
220*cdf0e10cSrcweir {
221*cdf0e10cSrcweir     TableRow &
222*cdf0e10cSrcweir         rNewRow = pTable->AddRow();
223*cdf0e10cSrcweir     TableCell &
224*cdf0e10cSrcweir         rNewTerm = rNewRow.AddCell();
225*cdf0e10cSrcweir     TableCell &
226*cdf0e10cSrcweir         rNewDefinition = rNewRow.AddCell();
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir     pTerm = &rNewTerm;
229*cdf0e10cSrcweir     pDefinition = &rNewDefinition;
230*cdf0e10cSrcweir }
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir FlagTable::FlagTable( XmlElement &        o_rOwner,
233*cdf0e10cSrcweir                       uintt               i_nNrOfColumns )
234*cdf0e10cSrcweir {
235*cdf0e10cSrcweir     pTable = new Table;
236*cdf0e10cSrcweir     *pTable << new AnAttribute("class", "flag-table");
237*cdf0e10cSrcweir     *pTable << new AnAttribute("border", "1");
238*cdf0e10cSrcweir     *pTable << new AnAttribute("cellspacing", "0");
239*cdf0e10cSrcweir     o_rOwner << pTable;
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir     TableRow & rRow1 = pTable->AddRow();
242*cdf0e10cSrcweir     TableRow & rRow2 = pTable->AddRow();
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir     for ( uintt c = 0; c < i_nNrOfColumns; ++c )
245*cdf0e10cSrcweir     {
246*cdf0e10cSrcweir         TableCell & rCell1 = rRow1.AddCell();
247*cdf0e10cSrcweir         int nWidth = 100 / i_nNrOfColumns;
248*cdf0e10cSrcweir         static char sWidth[20];
249*cdf0e10cSrcweir         sprintf( sWidth, "%d%%", nWidth );      // SAFE SPRINTF (#100211# - checked)
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir         rCell1
252*cdf0e10cSrcweir             << new WidthAttr( sWidth )
253*cdf0e10cSrcweir             << new ClassAttr( "flagname" );
254*cdf0e10cSrcweir         TableCell & rCell2 = rRow2.AddCell();
255*cdf0e10cSrcweir         aCells.push_back( CellPair(&rCell1, &rCell2) );
256*cdf0e10cSrcweir     }   // end for
257*cdf0e10cSrcweir }
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir void
260*cdf0e10cSrcweir FlagTable::SetColumn( uintt               i_nColumnPosition,
261*cdf0e10cSrcweir                       const char *        i_sColumnName,
262*cdf0e10cSrcweir                       bool                i_bValue )
263*cdf0e10cSrcweir {
264*cdf0e10cSrcweir     csv_assert( i_nColumnPosition < aCells.size() );
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir     TableCell &
267*cdf0e10cSrcweir         rCell1 = *aCells[i_nColumnPosition].first;
268*cdf0e10cSrcweir     TableCell &
269*cdf0e10cSrcweir         rCell2 = *aCells[i_nColumnPosition].second;
270*cdf0e10cSrcweir     rCell1
271*cdf0e10cSrcweir         << i_sColumnName;
272*cdf0e10cSrcweir     if (i_bValue)
273*cdf0e10cSrcweir     {
274*cdf0e10cSrcweir         rCell2
275*cdf0e10cSrcweir             << new ClassAttr("flagyes")
276*cdf0e10cSrcweir             << "YES";
277*cdf0e10cSrcweir     }
278*cdf0e10cSrcweir     else //
279*cdf0e10cSrcweir     {
280*cdf0e10cSrcweir         rCell2
281*cdf0e10cSrcweir             << new ClassAttr("flagno")
282*cdf0e10cSrcweir             << "NO";
283*cdf0e10cSrcweir     }  // endif
284*cdf0e10cSrcweir }
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir IndexList::IndexList( XmlElement & o_rOwner )
287*cdf0e10cSrcweir     :   pList( new DefList ),
288*cdf0e10cSrcweir         pTerm(0),
289*cdf0e10cSrcweir         pDefinition(0)
290*cdf0e10cSrcweir {
291*cdf0e10cSrcweir     o_rOwner << pList;
292*cdf0e10cSrcweir }
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir void
295*cdf0e10cSrcweir IndexList::AddEntry()
296*cdf0e10cSrcweir {
297*cdf0e10cSrcweir     pTerm = &pList->AddTerm();
298*cdf0e10cSrcweir     pDefinition = &pList->AddDefinition();
299*cdf0e10cSrcweir }
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir }   // namespace adcdisp
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir 
306