1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #include <precomp.h>
29*cdf0e10cSrcweir #include "hfi_struct.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir 
32*cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES
33*cdf0e10cSrcweir #include <ary/idl/i_ce.hxx>
34*cdf0e10cSrcweir #include <ary/idl/i_struct.hxx>
35*cdf0e10cSrcweir #include <ary/idl/ik_exception.hxx>
36*cdf0e10cSrcweir #include <ary/idl/ik_struct.hxx>
37*cdf0e10cSrcweir #include <toolkit/hf_docentry.hxx>
38*cdf0e10cSrcweir #include <toolkit/hf_linachain.hxx>
39*cdf0e10cSrcweir #include <toolkit/hf_navi_sub.hxx>
40*cdf0e10cSrcweir #include <toolkit/hf_title.hxx>
41*cdf0e10cSrcweir #include "hfi_navibar.hxx"
42*cdf0e10cSrcweir #include "hfi_property.hxx"
43*cdf0e10cSrcweir #include "hfi_typetext.hxx"
44*cdf0e10cSrcweir #include "hi_linkhelper.hxx"
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir extern const String
48*cdf0e10cSrcweir     C_sCePrefix_Struct("struct");
49*cdf0e10cSrcweir extern const String
50*cdf0e10cSrcweir     C_sCePrefix_Exception("exception");
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir namespace
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir const String
57*cdf0e10cSrcweir     C_sBaseStruct("Base Hierarchy");
58*cdf0e10cSrcweir const String
59*cdf0e10cSrcweir     C_sBaseException("Base Hierarchy");
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir const String
62*cdf0e10cSrcweir     C_sList_Elements("Elements' Summary");
63*cdf0e10cSrcweir const String
64*cdf0e10cSrcweir     C_sList_Elements_Label("Elements");
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir const String
67*cdf0e10cSrcweir     C_sList_ElementDetails("Elements' Details");
68*cdf0e10cSrcweir const String
69*cdf0e10cSrcweir     C_sList_ElementDetails_Label("ElementDetails");
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir enum E_SubListIndices
72*cdf0e10cSrcweir {
73*cdf0e10cSrcweir     sli_ElementsSummary = 0,
74*cdf0e10cSrcweir     sli_ElementsDetails = 1
75*cdf0e10cSrcweir };
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir }   // anonymous namespace
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir HF_IdlStruct::HF_IdlStruct( Environment &         io_rEnv,
82*cdf0e10cSrcweir                             Xml::Element &        o_rOut,
83*cdf0e10cSrcweir                             bool                  i_bIsException )
84*cdf0e10cSrcweir     :   HtmlFactory_Idl(io_rEnv, &o_rOut),
85*cdf0e10cSrcweir         bIsException(i_bIsException)
86*cdf0e10cSrcweir {
87*cdf0e10cSrcweir }
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir HF_IdlStruct::~HF_IdlStruct()
90*cdf0e10cSrcweir {
91*cdf0e10cSrcweir }
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir void
94*cdf0e10cSrcweir HF_IdlStruct::Produce_byData( const client & i_ce ) const
95*cdf0e10cSrcweir {
96*cdf0e10cSrcweir     const ary::idl::Struct *
97*cdf0e10cSrcweir         pStruct =
98*cdf0e10cSrcweir             bIsException
99*cdf0e10cSrcweir                 ?   0
100*cdf0e10cSrcweir                 :   static_cast< const ary::idl::Struct* >(&i_ce);
101*cdf0e10cSrcweir     bool bIsTemplate =
102*cdf0e10cSrcweir             pStruct != 0
103*cdf0e10cSrcweir                 ?   pStruct->TemplateParameterType().IsValid()
104*cdf0e10cSrcweir                 :   false;
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir     Dyn<HF_NaviSubRow>
107*cdf0e10cSrcweir         pNaviSubRow( &make_Navibar(i_ce) );
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir     HF_TitleTable
110*cdf0e10cSrcweir         aTitle(CurOut());
111*cdf0e10cSrcweir     HF_LinkedNameChain
112*cdf0e10cSrcweir         aNameChain(aTitle.Add_Row());
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir     aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker);
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir     // Title:
117*cdf0e10cSrcweir     StreamLock
118*cdf0e10cSrcweir         slAnnotations(200);
119*cdf0e10cSrcweir     get_Annotations(slAnnotations(), i_ce);
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir     StreamLock rTitle(200);
122*cdf0e10cSrcweir     if (bIsTemplate)
123*cdf0e10cSrcweir         rTitle() << "template ";
124*cdf0e10cSrcweir     rTitle()
125*cdf0e10cSrcweir         << (bIsException
126*cdf0e10cSrcweir 		    ?   C_sCePrefix_Exception
127*cdf0e10cSrcweir 			:   C_sCePrefix_Struct)
128*cdf0e10cSrcweir 	    << " "
129*cdf0e10cSrcweir 		<< i_ce.LocalName();
130*cdf0e10cSrcweir     if (bIsTemplate)
131*cdf0e10cSrcweir     {
132*cdf0e10cSrcweir         csv_assert(pStruct != 0);
133*cdf0e10cSrcweir         rTitle()
134*cdf0e10cSrcweir             << "<"
135*cdf0e10cSrcweir             << pStruct->TemplateParameter()
136*cdf0e10cSrcweir             << ">";
137*cdf0e10cSrcweir     }
138*cdf0e10cSrcweir     aTitle.Produce_Title(slAnnotations().c_str(), rTitle().c_str());
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir     // Bases:
141*cdf0e10cSrcweir     produce_Bases( aTitle.Add_Row(),
142*cdf0e10cSrcweir                    i_ce,
143*cdf0e10cSrcweir                    bIsException
144*cdf0e10cSrcweir                     ?   C_sBaseException
145*cdf0e10cSrcweir                     :   C_sBaseStruct );
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir     // Docu:
148*cdf0e10cSrcweir     write_Docu(aTitle.Add_Row(), i_ce);
149*cdf0e10cSrcweir     CurOut() << new Html::HorizontalLine();
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir     // Elements:
152*cdf0e10cSrcweir     dyn_ce_list
153*cdf0e10cSrcweir         dpElements;
154*cdf0e10cSrcweir     if (bIsException)
155*cdf0e10cSrcweir         ary::idl::ifc_exception::attr::Get_Elements(dpElements, i_ce);
156*cdf0e10cSrcweir     else
157*cdf0e10cSrcweir         ary::idl::ifc_struct::attr::Get_Elements(dpElements, i_ce);
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir     if ( (*dpElements).operator bool() )
160*cdf0e10cSrcweir     {
161*cdf0e10cSrcweir         produce_Members( *dpElements,
162*cdf0e10cSrcweir                          C_sList_Elements,
163*cdf0e10cSrcweir                          C_sList_Elements_Label,
164*cdf0e10cSrcweir                          C_sList_ElementDetails,
165*cdf0e10cSrcweir                          C_sList_ElementDetails_Label );
166*cdf0e10cSrcweir         pNaviSubRow->SwitchOn(sli_ElementsSummary);
167*cdf0e10cSrcweir         pNaviSubRow->SwitchOn(sli_ElementsDetails);
168*cdf0e10cSrcweir     }
169*cdf0e10cSrcweir     pNaviSubRow->Produce_Row();
170*cdf0e10cSrcweir }
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir HtmlFactory_Idl::type_id
173*cdf0e10cSrcweir HF_IdlStruct::inq_BaseOf( const client & i_ce ) const
174*cdf0e10cSrcweir {
175*cdf0e10cSrcweir     return bIsException
176*cdf0e10cSrcweir                 ?   ary::idl::ifc_exception::attr::Base(i_ce)
177*cdf0e10cSrcweir                 :   ary::idl::ifc_struct::attr::Base(i_ce);
178*cdf0e10cSrcweir }
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir HF_NaviSubRow &
181*cdf0e10cSrcweir HF_IdlStruct::make_Navibar( const client & i_ce ) const
182*cdf0e10cSrcweir {
183*cdf0e10cSrcweir     HF_IdlNavigationBar
184*cdf0e10cSrcweir         aNaviBar(Env(), CurOut());
185*cdf0e10cSrcweir     aNaviBar.Produce_CeMainRow(i_ce);
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir     DYN HF_NaviSubRow &
188*cdf0e10cSrcweir         ret = aNaviBar.Add_SubRow();
189*cdf0e10cSrcweir     ret.AddItem(C_sList_Elements, C_sList_Elements_Label, false);
190*cdf0e10cSrcweir     ret.AddItem(C_sList_ElementDetails, C_sList_ElementDetails_Label, false);
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir     CurOut() << new Html::HorizontalLine();
193*cdf0e10cSrcweir     return ret;
194*cdf0e10cSrcweir }
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir void
197*cdf0e10cSrcweir HF_IdlStruct::produce_MemberDetails( HF_SubTitleTable &  o_table,
198*cdf0e10cSrcweir                                      const client &      i_ce) const
199*cdf0e10cSrcweir {
200*cdf0e10cSrcweir     HF_IdlStructElement
201*cdf0e10cSrcweir         aElement( Env(), o_table );
202*cdf0e10cSrcweir     aElement.Produce_byData(i_ce);
203*cdf0e10cSrcweir }
204