1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: html_kit.cxx,v $
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 ************************************************************************/
32 #include "html_kit.hxx"
35 // NOT FULLY DEFINED SERVICES
37 #include <ary/cpp/c_slntry.hxx>
45 using namespace csi::xml
;
46 using namespace csi::html
;
50 PageTitle_Left::operator()( XmlElement
& o_rOwner
,
51 const char * i_sTypeTitle
,
52 const String
& i_sLocalName
)
62 PageTitle_Std::operator()( XmlElement
& o_rOwner
,
63 const char * i_sTypeTitle
,
64 const String
& i_sLocalName
)
67 >> *new AnElement("div")
68 << new ClassAttr("title")
76 PageTitle_Std::operator()( XmlElement
& o_rOwner
)
80 >> *new AnElement("div")
81 << new ClassAttr("title")
87 OperationTitle::operator()( XmlElement
& o_owner
,
88 const char * i_itemName
,
90 const ::ary::cpp::Gate
& i_gate
)
93 >> *new Label( OperationLabel(i_itemName
, i_id
, i_gate
) )
101 TemplateClause::operator()( XmlElement
& o_rOwner
,
102 const List_TplParams
& i_rTplParams
)
104 if ( i_rTplParams
.size() == 0 )
114 List_TplParams::const_iterator
115 it
= i_rTplParams
.begin();
116 List_TplParams::const_iterator
117 itEnd
= i_rTplParams
.end();
121 for ( ++it
; it
!= itEnd
; ++it
)
130 ExplanationList::ExplanationList( XmlElement
& o_rOwner
,
131 bool i_bMemberStyle
)
132 : pList( new DefList
),
135 bMemberStyle(i_bMemberStyle
)
138 *pList
<< new ClassAttr("member");
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");
160 pDefinition
= &pList
->AddDefinition();
162 *pDefinition
<< new ClassAttr("member");
166 ExplanationList::AddEntry_NoTerm()
169 pDefinition
= &pList
->AddDefinition();
171 *pDefinition
<< new ClassAttr("member");
174 ExplanationTable::ExplanationTable( XmlElement
& o_rOwner
)
179 pTable
= new Table("0", "100%", "3", "0");
180 *pTable
<< new AnAttribute("class", "expl-table");
185 ExplanationTable::AddEntry( const char * i_sTerm
,
186 const char * i_sDifferentStyle
)
189 rNewRow
= pTable
->AddRow();
191 rNewTerm
= rNewRow
.AddCell();
193 rNewDefinition
= rNewRow
.AddCell();
195 if ( i_sDifferentStyle
== 0 )
197 rNewTerm
<< new WidthAttr("15%")
198 << new StyleAttr("vertical-align:top; font-weight:bold");
202 rNewTerm
<< new StyleAttr(i_sDifferentStyle
);
208 pDefinition
= & (rNewDefinition
>> *new APureElement("pre"));
211 ParameterTable::ParameterTable( XmlElement
& o_rOwner
)
217 *pTable
<< new AnAttribute("class", "param-table");
222 ParameterTable::AddEntry()
225 rNewRow
= pTable
->AddRow();
227 rNewTerm
= rNewRow
.AddCell();
229 rNewDefinition
= rNewRow
.AddCell();
232 pDefinition
= &rNewDefinition
;
235 FlagTable::FlagTable( XmlElement
& o_rOwner
,
236 uintt i_nNrOfColumns
)
239 *pTable
<< new AnAttribute("class", "flag-table");
240 *pTable
<< new AnAttribute("border", "1");
241 *pTable
<< new AnAttribute("cellspacing", "0");
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)
255 << new WidthAttr( sWidth
)
256 << new ClassAttr( "flagname" );
257 TableCell
& rCell2
= rRow2
.AddCell();
258 aCells
.push_back( CellPair(&rCell1
, &rCell2
) );
263 FlagTable::SetColumn( uintt i_nColumnPosition
,
264 const char * i_sColumnName
,
267 csv_assert( i_nColumnPosition
< aCells
.size() );
270 rCell1
= *aCells
[i_nColumnPosition
].first
;
272 rCell2
= *aCells
[i_nColumnPosition
].second
;
278 << new ClassAttr("flagyes")
284 << new ClassAttr("flagno")
289 IndexList::IndexList( XmlElement
& o_rOwner
)
290 : pList( new DefList
),
298 IndexList::AddEntry()
300 pTerm
= &pList
->AddTerm();
301 pDefinition
= &pList
->AddDefinition();
305 } // namespace adcdisp