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 "pm_help.hxx"
24 
25 
26 // NOT FULLY DEFINED SERVICES
27 #include "navibar.hxx"
28 #include "html_kit.hxx"
29 
30 using namespace csi;
31 using csi::html::Paragraph;
32 using csi::html::HorizontalLine;
33 using csi::html::Headline;
34 using csi::html::AlignAttr;
35 using csi::html::Bold;
36 using csi::html::Link;
37 using csi::html::Sbr;
38 using csi::html::LineBreak;
39 using csi::xml::Element;
40 
41 
42 
43 const String  C_sHelpText(
44 "<div style=\"font-size:10pt;\">\n"
45 "<h3 class=\"help\">The Main Navigationbar</h3>\n"
46 "<p> On top of every page, there is a main navigationbar on a lightly coloured\n"
47 "background with the following items:<br>\n"
48 "</p>\n"
49 "<ul>\n"
50 "  <li>Overview - the start page for this document,</li>\n"
51 "  <li>Namespace - the lowest/deepest namespace of the language objects, described\n"
52 "on the current page,</li>\n"
53 "  <li>Class - the class, struct or union, which owns the methods or data,\n"
54 "described on the current page,</li>\n"
55 "  <li>Index - the global alphabetical index,</li>\n"
56 "  <li>Help - this page.</li>\n"
57 "</ul>\n"
58 " Each item in this&nbsp; bar can be in three different states:<br>\n"
59 "<ul>\n"
60 "  <li>Link - the item is valid and you can get there,</li>\n"
61 "  <li>Simple - the item does not apply (if this page described a namespace,\n"
62 "there would be no owning class),</li>\n"
63 "  <li>Reversed (white text on dark background) - this is the current page.</li>\n"
64 "</ul>\n"
65 "<h3 class=\"help\">Lower Navigationbars</h3>\n"
66 " Just below the main navigation bar, there may be zero to three lower navigationbars\n"
67 "on white background.<br>\n"
68 "<br>\n"
69 "Their items are dependent of the context, but they always link to paragraphs\n"
70 "on the same, current page.<br>\n"
71 "Available items appear as links. Unavailable items appear as simple text.<br>\n"
72 "\n"
73 "\n"
74 "<h3 class=\"help\">Namespace Descriptions</h3>\n"
75 "\n"
76 "<dl>\n"
77 "<dt class=\"simple\">Parent namespaces</dt>\n"
78 "  </dl>\n"
79 "  <dl>\n"
80 "  <dd>In front of the namespace title, there is a linked list of the parent\n"
81 "namespaces. The global namespace is linked with the first \"::\",</dd>\n"
82 "    <dd>the namespaces between the global and the current one are linked\n"
83 "by their names.<br>\n"
84 "      </dd>\n"
85 "      <dd> </dd>\n"
86 "        </dl>\n"
87 "After the title, the documentation of the namespace follows (which is often\n"
88 "missing, because the namespace name may be self-explaining).<br>\n"
89 "        <br>\n"
90 "Below are the lists of nested namspaces and of the classes, functions and\n"
91 "other program objects, that belong within this namespace.<br>\n"
92 "Each of this lists is accessible by the lower navigationbar on top of the\n"
93 "page.<br>\n"
94 "\n"
95 "<h3 class=\"help\">Class Descriptions</h3>\n"
96 "\n"
97 "        <dl>\n"
98 "        <dt class=\"simple\">Parent namespaces and classes</dt>\n"
99 "          </dl>\n"
100 "          <dl>\n"
101 "          <dd>In front of the class title, there is a linked list of the\n"
102 "parent namespaces or classes. The global namespace is linked with the first\n"
103 "\"::\",</dd>\n"
104 "            <dd>the namespaces between the global and the current one are\n"
105 "linked by their names. Enclosing classes are linked as well, but appear in\n"
106 "<span class=\"nqclass\">green</font> color.&nbsp;</dd>\n"
107 "              <dd>So you see on the first glance, that this is a parent class,\n"
108 "no namespace.<br>\n"
109 "               </dd>\n"
110 "                <dd><br>\n"
111 "                  </dd>\n"
112 "                  </dl>\n"
113 "After the title, the bases and derivations of the class follow. <br>\n"
114 "Base classes are displayed as a graph. The text around base classes can appear\n"
115 "in different styles and colours:<br>\n"
116 "<ul>\n"
117 "  <li><span class=\"btpubl\">Green</span> - public inherited,</li>\n"
118 "  <li><span class=\"btprot\">Orange</span> - protected inherited,</li>\n"
119 "  <li><span class=\"btpriv\">Red</span> - private inherited,</li>\n"
120 "  <li><span class=\"btvpubl\">italic</span> - a (public inherited) virtual base class.</li>\n"
121 "  <li><span class=\"btself\">Bold and black</span> without a link - the placeholder\n"
122 "for the currently described class.<br>\n"
123 "  </li>\n"
124 "</ul>\n"
125 "There may be many derivations of a class, but only the known ones, which\n"
126 "are described within this document also, are listed.<br>\n"
127 "<br>\n"
128 "Below the derivations is a little table with some properties of the class:<br>\n"
129 "<ul>\n"
130 "  <li>virtual - the class owns at least one virtual method,</li>\n"
131 "  <li>abstract - the class owns at least one abstract method,</li>\n"
132 "  <li>interface - the class may or may be not abstract,\n"
133 "but it is intended by its author to be used only as an interface and never\n"
134 "to be instantiated,</li>\n"
135 "  <li>template - the class is a template class.<br>\n"
136 "  </li>\n"
137 "</ul>\n"
138 "Next comes further documentation of the class itself.<br>\n"
139 "<br>\n"
140 "Lastly, there are listed all members of the class. Public members come first,\n"
141 "then protected, at last the private ones.<br>\n"
142 "All member lists are accessible by the lower navigationbars on top of the\n"
143 "page.<br>\n"
144 "\n"
145 "<h3 class=\"help\">Macros and Defines</h3>\n"
146 "In C++ and C, there are also program constructs, which do not fit into the\n"
147 "name tree, because they are #define'd: macros and definitions.<br>\n"
148 "These may be documented, too. Those comments you find <a href=\"def-all.html\">\n"
149 "here</a>\n"
150 " or from the \"Overview\" start page.\n"
151 "<h3 class=\"help\">Links to IDL-Documentation</h3>\n"
152 "Some types, which appear as links, may refer to classes, enums or other\n"
153 "entities, which are direct mappings of UNO-IDL entities.<br>\n"
154 "In those cases the link doesn't lead to the C++ class, enum or whatever,\n"
155 "but to the description of the IDL entity.\n"
156 "<h3 class=\"help\">How to Link From Extern Documents</h3>\n"
157 "If you wish to write an extern html document, which links to types within\n"
158 "this C++ reference, you can do so, if your links have the following format:<br>\n"
159 "<br>\n"
160 "&lt;RootDirectory-of-this-Document&gt;/names/&lt;Namespace-A&gt;/&lt;Namespace-XY&gt;/EnclosingClass-nn&gt;/&lt;TypePreFix&gt;-&lt;MyTypeName&gt;.html<br>\n"
161 "<br>\n"
162 "&lt;TypePreFix&gt; can have the following values:<br>\n"
163 "<ul>\n"
164 "<li>c - class, struct or union</li>\n"
165 "<li>e - enum</li>\n"
166 "<li>t - typedef</li>\n"
167 "</ul>\n"
168 "If this document would be located in directory &nbsp;\"/doc/cpp/ref\", examples\n"
169 "would look like this:<br>\n"
170 "<br>\n"
171 "&lt;a href=\"/doc/cpp/ref/names/osl/c-File.html\"&gt;class File&lt;/a&gt;<br>\n"
172 "&lt;a href=\"/doc/cpp/ref/names/osl/FileBase/e-RC.html\"&gt;enum FileBase::RC&lt;/a&gt;<br>\n"
173 "&lt;a href=\"/doc/cpp/ref/names/t-oslMutex.html\"&gt;typedef oslMutex&lt;/a&gt;<br>\n"
174 "<br>\n"
175 "Namespaces are described in the index.html file within their directory:<br>\n"
176 "<br>\n"
177 "&lt;a href=\"/doc/cpp/ref/names/cppu/index.html\"&gt;namespace cppu&lt;/a&gt;<br>\n"
178 "</div>" );
179 
180 
181 
182 
PageMaker_Help(PageDisplay & io_rPage)183 PageMaker_Help::PageMaker_Help( PageDisplay & io_rPage )
184     :   SpecializedPageMaker(io_rPage),
185         pNavi(0)
186 {
187 }
188 
~PageMaker_Help()189 PageMaker_Help::~PageMaker_Help()
190 {
191 }
192 
193 void
MakePage()194 PageMaker_Help::MakePage()
195 {
196     pNavi = new NavigationBar( Env(), NavigationBar::LOC_Help );
197     Write_NavBar();
198 
199     Write_TopArea();
200     Write_DocuArea();
201 }
202 
203 void
Write_NavBar()204 PageMaker_Help::Write_NavBar()
205 {
206     pNavi->Write( CurOut() );
207     CurOut() << new HorizontalLine;
208 }
209 
210 void
Write_TopArea()211 PageMaker_Help::Write_TopArea()
212 {
213     adcdisp::PageTitle_Std fTitle;
214     fTitle( CurOut(), "How to Use", "this Reference Document" );
215 
216     CurOut() << new xml::XmlCode(C_sHelpText);
217 }
218 
219 void
Write_DocuArea()220 PageMaker_Help::Write_DocuArea()
221 {
222     CurOut() << new HorizontalLine;
223 }
224 
225 
226 
227