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