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