xref: /AOO41X/main/autodoc/source/display/html/cfrstd.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include <precomp.h>
29 #include <cfrstd.hxx>
30 
31 
32 // NOT FULLY DEFINED SERVICES
33 #include <time.h>
34 
35 
36 /*                      CSS Styles
37                         ----------
38 
39 Colors:
40 -   light background color              #eeeeff
41 -   dark background color               #ccccff
42 -   self in navibar background color    #2222ad
43 
44 
45 Fonts:
46 -   page title              20, bold, Arial
47 -   navibar main			12, bold, Arial
48 -   navibar sub              8, Arial, kapit�lchen
49 -   attrtable title line     8, bold, Arial, kapit�lchen
50 -   attrtable value line     8, Arial kapit�lchen
51 
52 -   namespace chain         13, bold
53 -   table title             13, bold
54 -   template line           13
55 
56 -   member paragraph title  12, bold
57 
58 -   docu paragraph title    11, bold
59 -   standard text           11
60 
61 -   hierarchy               11, monospace
62 
63 
64 classes:
65 
66     td.title                page title
67     h3                      table title
68     h4                      member paragraph title
69 
70     td.nmain                navigation main bar
71     td.nsub                 navigation sub bar
72     a.nmain                 links in navigation main bar
73     a.nsub                  links in navigation sub bar
74 
75     td.attr1                attribute table head line
76     td.attr2                attribute table value line
77 
78     p.namechain             namespace chain in head of pages
79     p.tpl                   template line in head of pages
80 
81     pre.doc                 preformatted docu
82     pre.hierarchy           class bases hierarchy graphic
83 
84     dl.syntax               function- or variable-declaration field
85     a.syntax                link in function- or variable-declaration field
86 
87     p.dt                    docu paragraph title
88     dl.dt                   docu paragraph title
89 
90     p                       standard text
91     dl                      standard text
92     dd                      standard text
93 */
94 
95 
96 #define CRLF "\n"
97 
98 namespace
99 {
100 
101 bool            bUse_OOoFrameDiv = true;
102 
103 
104 //***************   These are used for IDL currently only!   ********************
105 
106 const char * const C_sStdStyle =
107     "/*See bottom of file for explanations.*/"CRLF
108     CRLF
109     "body { background-color:#ffffff; }"CRLF
110     CRLF
111 	"h3             { font-size:13pt; font-weight:bold;"CRLF
112 	"                 margin-top:3pt; margin-bottom:1pt; }"CRLF
113     "p, dt, dd, pre { font-size:11pt;"CRLF
114     "                 margin-top:3pt; margin-bottom:1pt; }"CRLF
115 	"pre            { font-family:monospace; }"CRLF
116     CRLF
117     "table.navimain { background-color:#eeeeff; }"CRLF
118     "table.subtitle { margin-top:6pt; margin-bottom:6pt; }"CRLF
119     CRLF
120 	"td             {                     font-size:11pt; }"CRLF
121     "td.title       { font-family: Arial; font-size:19pt; font-weight:bold;"CRLF
122     "                 line-height:30pt;   background-color:#ccccff; text-align:center; }"CRLF
123     "td.subtitle    { font-family: Arial; font-size:13pt;"CRLF
124     "                 line-height:20pt;   background-color:#ccccff; }"CRLF
125     "td.crosstitle  {                     font-size:12pt; font-weight:bold;"CRLF
126     "                 line-height:15pt;   background-color:#eeeeff; }"CRLF
127     "td.imdetail    { width:100%;         background-color:#eeeeff; }"CRLF
128     CRLF
129     "td.imsum_left  { width:30%;  }"CRLF
130     "td.imsum_right { width:70%;  }"CRLF
131     CRLF
132     "td.navimain, a.navimain"CRLF
133     "                   { text-align:center; font-family: Arial; font-size:12pt; font-weight:bold; }"CRLF
134     "td.navimainself    { text-align:center; font-family: Arial; font-size:12pt; font-weight:bold;"CRLF
135     "                     color:#ffffff; background-color:#2222ad; }"CRLF
136     "td.navimainnone    { text-align:center; font-family: Arial; font-size:12pt; }"CRLF
137     "td.navisub, a.navisub"CRLF
138     "                   { text-align:center; font-family: Arial; font-size:9pt; font-variant:small-caps; }"CRLF
139     "td.navimain, td.navisub"CRLF
140     "                   { padding-left:7pt; padding-right:7pt; }"CRLF
141     CRLF
142     "a.membertitle  { font-size:12pt; font-weight:bold; line-height:18pt; }"CRLF
143     "a.navimain, a.navisub  { color:#000000; }"CRLF
144     ".dt            { font-weight:bold; }"CRLF
145 	".namechain     { font-size:13pt; font-weight:bold;"CRLF
146 	"                 margin-top:3pt; margin-bottom:6pt; }"CRLF
147 	".title2        { font-size:13pt; font-style:italic; font-weight:bold; text-align:left; }"CRLF
148     ;
149 
150 
151 const char * const C_sCssExplanations =
152     "/* Explanation of CSS classes:"CRLF
153     CRLF
154     ".navimain          Text in main navigation bar."CRLF
155     ".navisub           Text in lower navigation bar."CRLF
156     "td.navimainself    Cell in main navigation bar with \"selected\" shadow: You are here."CRLF
157     "td.navimainnone    Cell in main navigation bar with no link."CRLF
158     CRLF
159 	".namechain         Line with current module path."CRLF
160     CRLF
161     "td.crosstitle      Comment box for bases (base interfaces etc.)"CRLF
162     "td.imsum_left      Left part of such boxes."CRLF
163     "td.imsum_right     Right part of such boxes."CRLF
164     CRLF
165     "td.title           Main title of the page like \"interface XYz\""CRLF
166     ".subtitle          Tables, and head cells of those, which list members"CRLF
167     "                   like \"method summary\" and \"method details\"."CRLF
168     CRLF
169     "td.imdetail        Background table of method's detail description."CRLF
170     "a.membertitle      Method name (as jump label) in method's detail"CRLF
171     "                   description."CRLF
172 	".title2            smaller font prefixes to page titles"CRLF
173     "*/"CRLF
174     ;
175 
176 const char * const C_sStdStyle_withDivFrame =
177     "/*See bottom of file for explanations.*/"CRLF
178     CRLF
179     "body { background-color:#ffffff; }"CRLF
180     CRLF
181 	"#adc-idlref h3 { font-size:13pt; font-weight:bold;"CRLF
182 	"                 margin-top:3pt; margin-bottom:1pt; }"CRLF
183     "#adc-idlref p, #adc-idlref dt, #adc-idlref dd, #adc-idlref pre"CRLF
184     "               { font-size:11pt;"CRLF
185     "                 margin-top:3pt; margin-bottom:1pt; }"CRLF
186 	"#adc-idlref pre    { font-family:monospace; }"CRLF
187     CRLF
188     "#adc-idlref table.navimain { background-color:#eeeeff; }"CRLF
189     "#adc-idlref table.subtitle { margin-top:6pt; margin-bottom:6pt; }"CRLF
190     CRLF
191 	"#adc-idlref td             { font-size:11pt; }"CRLF
192     "#adc-idlref td.title       { font-family: Arial; font-size:19pt; font-weight:bold;"CRLF
193     "                             line-height:30pt;   background-color:#ccccff; text-align:center; }"CRLF
194     "#adc-idlref td.subtitle    { font-family: Arial; font-size:13pt;"CRLF
195     "                             line-height:20pt;   background-color:#ccccff; }"CRLF
196     "#adc-idlref td.crosstitle  { font-size:12pt; font-weight:bold;"CRLF
197     "                             line-height:15pt;   background-color:#eeeeff; }"CRLF
198     "#adc-idlref td.imdetail    { width:100%;         background-color:#eeeeff; }"CRLF
199     CRLF
200     "#adc-idlref td.imsum_left  { width:30%;  }"CRLF
201     "#adc-idlref td.imsum_right { width:70%;  }"CRLF
202     CRLF
203     "#adc-idlref td.navimain, #adc-idlref a.navimain"CRLF
204     "                   { text-align:center; font-family: Arial; font-size:12pt; font-weight:bold; }"CRLF
205     "#adc-idlref td.navimainself    { text-align:center; font-family: Arial; font-size:12pt; font-weight:bold;"CRLF
206     "                                 color:#ffffff; background-color:#2222ad; }"CRLF
207     "#adc-idlref td.navimainnone    { text-align:center; font-family: Arial; font-size:12pt; }"CRLF
208     "#adc-idlref td.navisub, #adc-idlref a.navisub"CRLF
209     "                   { text-align:center; font-family: Arial; font-size:9pt; font-variant:small-caps; }"CRLF
210     "#adc-idlref td.navimain, #adc-idlref td.navisub"CRLF
211     "                   { padding-left:7pt; padding-right:7pt; }"CRLF
212     CRLF
213     "#adc-idlref a.membertitle  { font-size:12pt; font-weight:bold; line-height:18pt; }"CRLF
214     "#adc-idlref a.navimain, #adc-idlref a.navisub  { color:#000000; }"CRLF
215     "#adc-idlref .dt            { font-weight:bold; }"CRLF
216 	"#adc-idlref .namechain     { font-size:13pt; font-weight:bold;"CRLF
217 	"                             margin-top:3pt; margin-bottom:6pt; }"CRLF
218 	"#adc-idlref .title2        { font-size:13pt; font-style:italic; font-weight:bold; text-align:left; }"CRLF
219     ""CRLF
220     "#adc-idlref table { empty-cells:show; }"CRLF
221     ""CRLF
222 	"#adc-idlref .childlist td, "CRLF
223 	"#adc-idlref .commentedlinks td, "CRLF
224 	"#adc-idlref .memberlist td, "CRLF
225 	"#adc-idlref .subtitle td, "CRLF
226 	"#adc-idlref .crosstitle td  { border: .1pt solid #000000; }"CRLF
227     ""CRLF
228 	"#adc-idlref .flag-table td { border: .1pt solid #cccccc; } "CRLF
229     ""CRLF
230 	"#adc-idlref .title-table td, "CRLF
231 	"#adc-idlref .table-in-method td, "CRLF
232 	"#adc-idlref .table-in-data td, "CRLF
233 	"#adc-idlref .navimain td, "CRLF
234 	"#adc-idlref .navisub td, "CRLF
235 	"#adc-idlref .expl-table td, "CRLF
236 	"#adc-idlref .param-table td  { border: none; }"CRLF
237     ;
238 
239 
240 }   // anonymous namespace
241 
242 
243 StdFrame::StdFrame()
244     :   sDevelopersGuideHtmlRoot(),
245         bSimpleLinks(false)
246 {
247 }
248 
249 DYN Html_Image *
250 StdFrame::LogoSrc() const
251 {
252     return 0;
253 
254 //    return  new Html_Image( "logodot-blu.gif",
255 //                            "109",
256 //							  "54",
257 //							  "RIGHT",
258 //							  "0",
259 //							  "OpenOffice" );
260 
261 }
262 
263 const char *
264 StdFrame::LogoLink() const
265 {
266     return "";
267 //  return "http://www.sun.com";
268 //  return "http://www.openoffice.org";
269 }
270 
271 
272 String              MakeCopyRight();
273 
274 const char *
275 StdFrame::CopyrightText() const
276 {
277     static String sCopyRight_( MakeCopyRight() );
278     return sCopyRight_.c_str();
279 }
280 
281 const char *
282 StdFrame::CssStyle() const
283 {
284     if (bUse_OOoFrameDiv)
285         return C_sStdStyle_withDivFrame;
286     else
287         return C_sStdStyle;
288 }
289 
290 const char *
291 StdFrame::CssStylesExplanation() const
292 {
293     return C_sCssExplanations;
294 }
295 
296 const char *
297 StdFrame::DevelopersGuideHtmlRoot() const
298 {
299     return sDevelopersGuideHtmlRoot;
300 }
301 
302 bool
303 StdFrame::SimpleLinks() const
304 {
305     return bSimpleLinks;
306 }
307 
308 void
309 StdFrame::Set_DevelopersGuideHtmlRoot( const String & i_directory )
310 {
311     if (NOT i_directory.empty())
312     {
313         if (i_directory.char_at(i_directory.length()-1) == '/')
314         {
315             sDevelopersGuideHtmlRoot.assign(i_directory,i_directory.length()-1);
316             return;
317         }
318     }
319     sDevelopersGuideHtmlRoot = i_directory;
320 }
321 
322 void
323 StdFrame::Set_SimpleLinks()
324 {
325     bSimpleLinks = true;
326 }
327 
328 String
329 MakeCopyRight()
330 {
331     StreamStr cr(700);
332     time_t
333         gt;
334     time(&gt);
335     tm *
336         plt = localtime(&gt);
337     int year = 1900 + plt->tm_year;
338 
339     cr  << "Copyright &copy; 1995, "
340         << year
341         << ", Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.";
342     return String(cr.c_str());
343 
344 }
345