Bump for 3.6-28
[LibreOffice.git] / autodoc / source / display / toolkit / hf_title.cxx
blobe68f7a1afb217190bc2f4c7c9a54ba70919fcbe1
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 <toolkit/hf_title.hxx>
33 // NOT FULLY DEFINED SERVICES
34 #include <stdlib.h>
37 const String C_sTitleBorder("0");
38 const String C_sTitleWidth("100%");
39 const String C_sTitlePadding("5");
40 const String C_sTitleSpacing("3");
42 const String C_sSubTitleBorder("1");
43 const String C_sSubTitleWidth("100%");
44 const String C_sSubTitlePadding("5");
45 const String C_sSubTitleSpacing("0");
46 const String C_sColSpan("colspan");
49 HF_TitleTable::HF_TitleTable( Xml::Element & o_rOut )
50 : HtmlMaker(o_rOut >> *new Html::Table( C_sTitleBorder,
51 C_sTitleWidth,
52 C_sTitlePadding,
53 C_sTitleSpacing )
54 << new Html::ClassAttr("title-table")
55 << new Html::StyleAttr("margin-bottom:6pt;") )
59 HF_TitleTable::~HF_TitleTable()
63 void
64 HF_TitleTable::Produce_Title( const char * i_title )
66 Add_Row()
67 << new Html::ClassAttr("title")
68 << i_title;
71 void
72 HF_TitleTable::Produce_Title( const char * i_annotations,
73 const char * i_title )
75 if (csv::no_str(i_annotations))
77 Produce_Title(i_title);
78 return;
81 Xml::Element &
82 rRow = Add_Row();
83 rRow
84 << new Html::ClassAttr("title");
86 Xml::Element &
87 rTable = rRow
88 >> *new Html::Table()
89 << new Html::ClassAttr("title-table")
90 << new Html::WidthAttr("99%");
91 Xml::Element &
92 rInnerRow = rTable
93 >> *new Html::TableRow;
94 rInnerRow
95 >> *new Html::TableCell
96 << new Html::WidthAttr("25%")
97 << new Html::ClassAttr("title2")
98 << i_annotations;
99 rInnerRow
100 >> *new Html::TableCell
101 << new Html::WidthAttr("50%")
102 << new Html::ClassAttr("title")
103 << i_title;
104 rInnerRow
105 >> *new Html::TableCell
106 << new Html::WidthAttr("*");
109 Xml::Element &
110 HF_TitleTable::Add_Row()
112 return CurOut()
113 >> *new Html::TableRow
114 >> *new Html::TableCell;
118 inline const char *
119 get_SubTitleCssClass(HF_SubTitleTable::E_SubLevel i_eSubTitleLevel)
121 return i_eSubTitleLevel == HF_SubTitleTable::sublevel_1
122 ? "subtitle"
123 : "crosstitle";
127 HF_SubTitleTable::HF_SubTitleTable( Xml::Element & o_rOut,
128 const String & i_label,
129 const String & i_title,
130 int i_nColumns,
131 E_SubLevel i_eSubTitleLevel )
132 : HtmlMaker( o_rOut
133 << new Html::Label(i_label)
134 >> *new Html::Table( C_sSubTitleBorder,
135 C_sSubTitleWidth,
136 C_sSubTitlePadding,
137 C_sSubTitleSpacing )
138 << new Html::ClassAttr(get_SubTitleCssClass(i_eSubTitleLevel)) )
140 csv_assert(i_nColumns > 0);
142 if (i_eSubTitleLevel == sublevel_3)
143 return;
145 Xml::Element &
146 rCell = CurOut()
147 >> *new Html::TableRow
148 >> *new Html::TableCell
149 << new Html::ClassAttr(get_SubTitleCssClass(i_eSubTitleLevel)) ;
151 if (i_nColumns > 1)
153 StreamLock sl(20);
154 String sColumns = sl() << i_nColumns << c_str;
155 rCell
156 << new Xml::AnAttribute(C_sColSpan, sColumns);
158 rCell
159 << i_title;
162 HF_SubTitleTable::~HF_SubTitleTable()
166 Xml::Element &
167 HF_SubTitleTable::Add_Row()
169 return CurOut() >> *new Html::TableRow;
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */