Update ooo320-m1
[ooovba.git] / autodoc / source / display / idl / hfi_hierarchy.cxx
blob6dbedf587ae95e423bab710066e8a72fa17f1ecf
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_hierarchy.cxx,v $
10 * $Revision: 1.8 $
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_hierarchy.hxx"
35 // NOT FULLY DECLARED SERVICES
36 #include <udm/html/htmlitem.hxx>
37 #include <ary/stdconstiter.hxx>
38 #include <ary/idl/i_ce.hxx>
39 #include <ary/idl/i_gate.hxx>
40 #include <ary/idl/i_type.hxx>
41 #include <ary/idl/ik_interface.hxx>
42 #include <ary/idl/ip_ce.hxx>
43 #include <ary/idl/ip_type.hxx>
44 #include "hfi_interface.hxx"
45 #include "hfi_typetext.hxx"
46 #include "hi_env.hxx"
50 HF_IdlBaseNode::HF_IdlBaseNode( const TYPE & i_rType,
51 const GATE & i_rGate,
52 intt i_nPositionOffset,
53 HF_IdlBaseNode & io_rDerived )
54 : nType(i_rType.TypeId()),
55 aBases(),
56 nCountBases(0),
57 nPosition(i_nPositionOffset),
58 pDerived(&io_rDerived)
60 Ce_id nCe = i_rGate.Types().Search_CeRelatedTo(nType);
61 if (nCe.IsValid())
63 GatherBases(i_rGate.Ces().Find_Ce(nCe), i_rGate);
67 HF_IdlBaseNode::~HF_IdlBaseNode()
71 void
72 HF_IdlBaseNode::FillPositionList( std::vector< const HF_IdlBaseNode* > & o_rPositionList ) const
74 for ( BaseList::const_iterator it = aBases.begin();
75 it != aBases.end();
76 ++it )
78 (*it)->FillPositionList(o_rPositionList);
79 } // end for
81 o_rPositionList.push_back(this);
84 void
85 HF_IdlBaseNode::GatherBases( const CE & i_rCe,
86 const GATE & i_rGate )
88 ary::Dyn_StdConstIterator<ary::idl::CommentedRelation>
89 aHelp;
90 ary::idl::ifc_interface::attr::Get_Bases(aHelp,i_rCe);
92 for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *aHelp;
93 it.operator bool();
94 ++it )
96 const TYPE &
97 rBaseType = i_rGate.Types().Find_Type((*it).Type());
99 Dyn<HF_IdlBaseNode>
100 pBaseNode( new HF_IdlBaseNode( rBaseType,
101 i_rGate,
102 nPosition,
103 *this )
106 intt nAddedBases = pBaseNode->BaseCount() + 1;
107 nCountBases += nAddedBases;
108 nPosition += nAddedBases;
109 aBases.push_back( pBaseNode.Release() );
110 } // end for
114 void
115 Write_BaseHierarchy( csi::xml::Element & o_rOut,
116 HtmlEnvironment_Idl & i_env,
117 const ary::idl::CodeEntity & i_ce )
119 csi::xml::Element &
120 rPre = o_rOut
121 >> *new csi::xml::AnElement("pre")
122 << new csi::html::StyleAttr("font-family:monospace;");
124 std::vector<uintt>
125 aSetColumns;
126 rPre
127 >> *new csi::html::Strong
128 << i_ce.LocalName();
129 rPre
130 << "\n";
131 Write_Bases( rPre,
132 i_env,
133 i_ce,
134 aSetColumns );
135 rPre
136 << "\n";
141 void
142 Write_Bases( csi::xml::Element & o_out,
143 HtmlEnvironment_Idl & i_env,
144 const ary::idl::CodeEntity & i_rCe,
145 std::vector<uintt> & io_setColumns )
147 ary::Dyn_StdConstIterator<ary::idl::CommentedRelation>
148 aHelp;
149 ary::idl::ifc_interface::attr::Get_Bases(aHelp,i_rCe);
151 for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *aHelp;
152 it.operator bool();
153 // NO INCREMENT HERE, see below
156 ary::idl::Type_id
157 nType = (*it).Type();
158 ++it;
159 bool
160 bThereComesMore = it.operator bool();
162 ary::idl::Ce_id
163 nCe = i_env.Gate().Types().Search_CeRelatedTo(nType);
164 if (nCe.IsValid())
166 // KORR_FUTURE
167 // Rather check for id(!) of com::sun::star::uno::XInterface.
168 if (i_env.Gate().Ces().Find_Ce(nCe).LocalName() == "XInterface")
169 continue;
172 for (uintt i = 0; i < io_setColumns.size(); ++i)
174 if (io_setColumns[i] == 1)
175 o_out << new csi::xml::XmlCode("&#x2503");
176 else
177 o_out << " ";
178 o_out << " ";
181 if (bThereComesMore)
182 o_out << new csi::xml::XmlCode("&#x2523");
183 else
184 o_out << new csi::xml::XmlCode("&#x2517");
185 o_out << " ";
187 HF_IdlTypeText
188 aDisplay( i_env, o_out, true, i_env.CurPageCe());
189 aDisplay.Produce_byData(nType);
190 o_out << "\n";
192 if (nCe.IsValid())
194 io_setColumns.push_back(bThereComesMore ? 1 : 0);
196 const ary::idl::CodeEntity &
197 rCe = i_env.Gate().Ces().Find_Ce(nCe);
198 Write_Bases( o_out,
199 i_env,
200 rCe,
201 io_setColumns );
202 io_setColumns.pop_back();
204 } // end for