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