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_namsp.hxx"
24 
25 
26 // NOT FULLY DEFINED SERVICES
27 #include "hd_chlst.hxx"
28 #include "hd_docu.hxx"
29 #include "html_kit.hxx"
30 #include "navibar.hxx"
31 #include "opageenv.hxx"
32 #include "pagemake.hxx"
33 #include "strconst.hxx"
34 
35 
36 using namespace csi;
37 using csi::html::HorizontalLine;
38 using csi::html::Link;
39 using csi::html::Table;
40 using csi::html::TableRow;
41 using csi::html::TableCell;
42 
43 
44 
PageMaker_Namespace(PageDisplay & io_rPage)45 PageMaker_Namespace::PageMaker_Namespace( PageDisplay & io_rPage )
46     :   SpecializedPageMaker(io_rPage),
47         pMe( io_rPage.Env().CurNamespace() ),
48         pChildDisplay( new ChildList_Display(io_rPage.Env()) ),
49         pNavi(0)
50 {
51     csv_assert( pMe != 0 );
52 }
53 
~PageMaker_Namespace()54 PageMaker_Namespace::~PageMaker_Namespace()
55 {
56 }
57 
58 void
MakePage()59 PageMaker_Namespace::MakePage()
60 {
61     pNavi = new NavigationBar( Env(), Me() );
62 
63     Write_NavBar();
64     Write_TopArea();
65     Write_DocuArea();
66 
67     pNavi->MakeSubRow("");
68     Write_ChildList( ary::cpp::Namespace::SLOT_SubNamespaces, C_sTitle_SubNamespaces, C_sLabel_SubNamespaces );
69 
70     Write_ChildLists_forClasses( C_sTitle_Classes,
71                                  C_sLabel_Classes,
72                                  ary::cpp::CK_class );
73     Write_ChildLists_forClasses( C_sTitle_Structs,
74                                  C_sLabel_Structs,
75                                  ary::cpp::CK_struct );
76     Write_ChildLists_forClasses( C_sTitle_Unions,
77                                  C_sLabel_Unions,
78                                  ary::cpp::CK_union );
79 
80     Write_ChildList( ary::cpp::Namespace::SLOT_Enums, C_sTitle_Enums, C_sLabel_Enums  );
81     Write_ChildList( ary::cpp::Namespace::SLOT_Typedefs, C_sTitle_Typedefs, C_sLabel_Typedefs  );
82     Write_ChildList( ary::cpp::Namespace::SLOT_Operations, C_sTitle_Operations, C_sLabel_Operations  );
83     Write_ChildList( ary::cpp::Namespace::SLOT_Constants, C_sTitle_Constants, C_sLabel_Constants  );
84     Write_ChildList( ary::cpp::Namespace::SLOT_Variables, C_sTitle_Variables, C_sLabel_Variables  );
85 
86     pNavi->Write_SubRows();
87 }
88 
89 void
Write_NavBar()90 PageMaker_Namespace::Write_NavBar()
91 {
92     pNavi->Write( CurOut() );
93     CurOut() << new HorizontalLine;
94 }
95 
96 void
Write_TopArea()97 PageMaker_Namespace::Write_TopArea()
98 {
99     Page().Write_NameChainWithLinks( Me() );
100 
101     adcdisp::PageTitle_Std fTitle;
102     xml::Element & rH3 = fTitle( CurOut() );
103     if ( Env().CurNamespace()->Owner().IsValid() )
104     {
105         rH3 << C_sHFTypeTitle_Namespace
106             << " "
107             << Env().CurNamespace()->LocalName();
108     }
109     else
110     {
111         rH3 << C_sHFTitle_GlobalNamespaceCpp;
112     }
113     CurOut() << new HorizontalLine;
114 }
115 
116 void
Write_DocuArea()117 PageMaker_Namespace::Write_DocuArea()
118 {
119     Docu_Display aDocuShow( Env() );
120 
121     aDocuShow.Assign_Out(CurOut());
122     aDocuShow.Process(Me().Docu());
123     aDocuShow.Unassign_Out();
124 
125     CurOut() << new HorizontalLine;
126 }
127 
128 void
Write_ChildList(ary::SlotAccessId i_nSlot,const char * i_sListTitle,const char * i_sLabel)129 PageMaker_Namespace::Write_ChildList( ary::SlotAccessId   i_nSlot,
130                                       const char *        i_sListTitle,
131                                       const char *        i_sLabel )
132 
133 {
134     bool    bChildrenExist = false;
135     ChildList_Display::Area_Result
136             aResult( bChildrenExist, CurOut() );
137 
138     pChildDisplay->Run_Simple( aResult,
139                                i_nSlot,
140                                i_sLabel,
141                                i_sListTitle );
142 
143     pNavi->AddItem(i_sListTitle, i_sLabel, bChildrenExist);
144     if (bChildrenExist)
145         CurOut() << new HorizontalLine;
146 }
147 
148 void
Write_ChildLists_forClasses(const char * i_sListTitle,const char * i_sLabel,ary::cpp::E_ClassKey i_eFilter)149 PageMaker_Namespace::Write_ChildLists_forClasses( const char *         i_sListTitle,
150                                                   const char *         i_sLabel,
151                                                   ary::cpp::E_ClassKey i_eFilter )
152 
153 {
154     bool    bChildrenExist = false;
155     ChildList_Display::Area_Result
156             aResult( bChildrenExist, CurOut() );
157 
158     pChildDisplay->Run_GlobalClasses( aResult,
159                                       ary::cpp::Namespace::SLOT_Classes,
160                                       i_sLabel,
161                                       i_sListTitle,
162                                       i_eFilter );
163 
164     pNavi->AddItem(i_sListTitle, i_sLabel, bChildrenExist);
165     if ( bChildrenExist )
166         CurOut() << new HorizontalLine;
167 }
168