1*d291ea28SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*d291ea28SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*d291ea28SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*d291ea28SAndrew Rist * distributed with this work for additional information
6*d291ea28SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*d291ea28SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*d291ea28SAndrew Rist * "License"); you may not use this file except in compliance
9*d291ea28SAndrew Rist * with the License. You may obtain a copy of the License at
10*d291ea28SAndrew Rist *
11*d291ea28SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*d291ea28SAndrew Rist *
13*d291ea28SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*d291ea28SAndrew Rist * software distributed under the License is distributed on an
15*d291ea28SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d291ea28SAndrew Rist * KIND, either express or implied. See the License for the
17*d291ea28SAndrew Rist * specific language governing permissions and limitations
18*d291ea28SAndrew Rist * under the License.
19*d291ea28SAndrew Rist *
20*d291ea28SAndrew Rist *************************************************************/
21cdf0e10cSrcweir
22cdf0e10cSrcweir #include <precomp.h>
23cdf0e10cSrcweir #include "hfi_hierarchy.hxx"
24cdf0e10cSrcweir
25cdf0e10cSrcweir
26cdf0e10cSrcweir // NOT FULLY DECLARED SERVICES
27cdf0e10cSrcweir #include <udm/html/htmlitem.hxx>
28cdf0e10cSrcweir #include <ary/stdconstiter.hxx>
29cdf0e10cSrcweir #include <ary/idl/i_ce.hxx>
30cdf0e10cSrcweir #include <ary/idl/i_gate.hxx>
31cdf0e10cSrcweir #include <ary/idl/i_type.hxx>
32cdf0e10cSrcweir #include <ary/idl/ik_interface.hxx>
33cdf0e10cSrcweir #include <ary/idl/ip_ce.hxx>
34cdf0e10cSrcweir #include <ary/idl/ip_type.hxx>
35cdf0e10cSrcweir #include "hfi_interface.hxx"
36cdf0e10cSrcweir #include "hfi_typetext.hxx"
37cdf0e10cSrcweir #include "hi_env.hxx"
38cdf0e10cSrcweir
39cdf0e10cSrcweir
40cdf0e10cSrcweir
HF_IdlBaseNode(const TYPE & i_rType,const GATE & i_rGate,intt i_nPositionOffset,HF_IdlBaseNode & io_rDerived)41cdf0e10cSrcweir HF_IdlBaseNode::HF_IdlBaseNode( const TYPE & i_rType,
42cdf0e10cSrcweir const GATE & i_rGate,
43cdf0e10cSrcweir intt i_nPositionOffset,
44cdf0e10cSrcweir HF_IdlBaseNode & io_rDerived )
45cdf0e10cSrcweir : nType(i_rType.TypeId()),
46cdf0e10cSrcweir aBases(),
47cdf0e10cSrcweir nCountBases(0),
48cdf0e10cSrcweir nPosition(i_nPositionOffset),
49cdf0e10cSrcweir pDerived(&io_rDerived)
50cdf0e10cSrcweir {
51cdf0e10cSrcweir Ce_id nCe = i_rGate.Types().Search_CeRelatedTo(nType);
52cdf0e10cSrcweir if (nCe.IsValid())
53cdf0e10cSrcweir {
54cdf0e10cSrcweir GatherBases(i_rGate.Ces().Find_Ce(nCe), i_rGate);
55cdf0e10cSrcweir }
56cdf0e10cSrcweir }
57cdf0e10cSrcweir
~HF_IdlBaseNode()58cdf0e10cSrcweir HF_IdlBaseNode::~HF_IdlBaseNode()
59cdf0e10cSrcweir {
60cdf0e10cSrcweir }
61cdf0e10cSrcweir
62cdf0e10cSrcweir void
FillPositionList(std::vector<const HF_IdlBaseNode * > & o_rPositionList) const63cdf0e10cSrcweir HF_IdlBaseNode::FillPositionList( std::vector< const HF_IdlBaseNode* > & o_rPositionList ) const
64cdf0e10cSrcweir {
65cdf0e10cSrcweir for ( BaseList::const_iterator it = aBases.begin();
66cdf0e10cSrcweir it != aBases.end();
67cdf0e10cSrcweir ++it )
68cdf0e10cSrcweir {
69cdf0e10cSrcweir (*it)->FillPositionList(o_rPositionList);
70cdf0e10cSrcweir } // end for
71cdf0e10cSrcweir
72cdf0e10cSrcweir o_rPositionList.push_back(this);
73cdf0e10cSrcweir }
74cdf0e10cSrcweir
75cdf0e10cSrcweir void
GatherBases(const CE & i_rCe,const GATE & i_rGate)76cdf0e10cSrcweir HF_IdlBaseNode::GatherBases( const CE & i_rCe,
77cdf0e10cSrcweir const GATE & i_rGate )
78cdf0e10cSrcweir {
79cdf0e10cSrcweir ary::Dyn_StdConstIterator<ary::idl::CommentedRelation>
80cdf0e10cSrcweir aHelp;
81cdf0e10cSrcweir ary::idl::ifc_interface::attr::Get_Bases(aHelp,i_rCe);
82cdf0e10cSrcweir
83cdf0e10cSrcweir for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *aHelp;
84cdf0e10cSrcweir it.operator bool();
85cdf0e10cSrcweir ++it )
86cdf0e10cSrcweir {
87cdf0e10cSrcweir const TYPE &
88cdf0e10cSrcweir rBaseType = i_rGate.Types().Find_Type((*it).Type());
89cdf0e10cSrcweir
90cdf0e10cSrcweir Dyn<HF_IdlBaseNode>
91cdf0e10cSrcweir pBaseNode( new HF_IdlBaseNode( rBaseType,
92cdf0e10cSrcweir i_rGate,
93cdf0e10cSrcweir nPosition,
94cdf0e10cSrcweir *this )
95cdf0e10cSrcweir );
96cdf0e10cSrcweir
97cdf0e10cSrcweir intt nAddedBases = pBaseNode->BaseCount() + 1;
98cdf0e10cSrcweir nCountBases += nAddedBases;
99cdf0e10cSrcweir nPosition += nAddedBases;
100cdf0e10cSrcweir aBases.push_back( pBaseNode.Release() );
101cdf0e10cSrcweir } // end for
102cdf0e10cSrcweir }
103cdf0e10cSrcweir
104cdf0e10cSrcweir
105cdf0e10cSrcweir void
Write_BaseHierarchy(csi::xml::Element & o_rOut,HtmlEnvironment_Idl & i_env,const ary::idl::CodeEntity & i_ce)106cdf0e10cSrcweir Write_BaseHierarchy( csi::xml::Element & o_rOut,
107cdf0e10cSrcweir HtmlEnvironment_Idl & i_env,
108cdf0e10cSrcweir const ary::idl::CodeEntity & i_ce )
109cdf0e10cSrcweir {
110cdf0e10cSrcweir csi::xml::Element &
111cdf0e10cSrcweir rPre = o_rOut
112cdf0e10cSrcweir >> *new csi::xml::AnElement("pre")
113cdf0e10cSrcweir << new csi::html::StyleAttr("font-family:monospace;");
114cdf0e10cSrcweir
115cdf0e10cSrcweir std::vector<uintt>
116cdf0e10cSrcweir aSetColumns;
117cdf0e10cSrcweir rPre
118cdf0e10cSrcweir >> *new csi::html::Strong
119cdf0e10cSrcweir << i_ce.LocalName();
120cdf0e10cSrcweir rPre
121cdf0e10cSrcweir << "\n";
122cdf0e10cSrcweir Write_Bases( rPre,
123cdf0e10cSrcweir i_env,
124cdf0e10cSrcweir i_ce,
125cdf0e10cSrcweir aSetColumns );
126cdf0e10cSrcweir rPre
127cdf0e10cSrcweir << "\n";
128cdf0e10cSrcweir
129cdf0e10cSrcweir }
130cdf0e10cSrcweir
131cdf0e10cSrcweir
132cdf0e10cSrcweir void
Write_Bases(csi::xml::Element & o_out,HtmlEnvironment_Idl & i_env,const ary::idl::CodeEntity & i_rCe,std::vector<uintt> & io_setColumns)133cdf0e10cSrcweir Write_Bases( csi::xml::Element & o_out,
134cdf0e10cSrcweir HtmlEnvironment_Idl & i_env,
135cdf0e10cSrcweir const ary::idl::CodeEntity & i_rCe,
136cdf0e10cSrcweir std::vector<uintt> & io_setColumns )
137cdf0e10cSrcweir {
138cdf0e10cSrcweir ary::Dyn_StdConstIterator<ary::idl::CommentedRelation>
139cdf0e10cSrcweir aHelp;
140cdf0e10cSrcweir ary::idl::ifc_interface::attr::Get_Bases(aHelp,i_rCe);
141cdf0e10cSrcweir
142cdf0e10cSrcweir for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *aHelp;
143cdf0e10cSrcweir it.operator bool();
144cdf0e10cSrcweir // NO INCREMENT HERE, see below
145cdf0e10cSrcweir )
146cdf0e10cSrcweir {
147cdf0e10cSrcweir ary::idl::Type_id
148cdf0e10cSrcweir nType = (*it).Type();
149cdf0e10cSrcweir ++it;
150cdf0e10cSrcweir bool
151cdf0e10cSrcweir bThereComesMore = it.operator bool();
152cdf0e10cSrcweir
153cdf0e10cSrcweir ary::idl::Ce_id
154cdf0e10cSrcweir nCe = i_env.Gate().Types().Search_CeRelatedTo(nType);
155cdf0e10cSrcweir if (nCe.IsValid())
156cdf0e10cSrcweir {
157cdf0e10cSrcweir // KORR_FUTURE
158cdf0e10cSrcweir // Rather check for id(!) of com::sun::star::uno::XInterface.
159cdf0e10cSrcweir if (i_env.Gate().Ces().Find_Ce(nCe).LocalName() == "XInterface")
160cdf0e10cSrcweir continue;
161cdf0e10cSrcweir }
162cdf0e10cSrcweir
163cdf0e10cSrcweir for (uintt i = 0; i < io_setColumns.size(); ++i)
164cdf0e10cSrcweir {
165cdf0e10cSrcweir if (io_setColumns[i] == 1)
166cdf0e10cSrcweir o_out << new csi::xml::XmlCode("┃");
167cdf0e10cSrcweir else
168cdf0e10cSrcweir o_out << " ";
169cdf0e10cSrcweir o_out << " ";
170cdf0e10cSrcweir }
171cdf0e10cSrcweir
172cdf0e10cSrcweir if (bThereComesMore)
173cdf0e10cSrcweir o_out << new csi::xml::XmlCode("┣");
174cdf0e10cSrcweir else
175cdf0e10cSrcweir o_out << new csi::xml::XmlCode("┗");
176cdf0e10cSrcweir o_out << " ";
177cdf0e10cSrcweir
178cdf0e10cSrcweir HF_IdlTypeText
179cdf0e10cSrcweir aDisplay( i_env, o_out, true, i_env.CurPageCe());
180cdf0e10cSrcweir aDisplay.Produce_byData(nType);
181cdf0e10cSrcweir o_out << "\n";
182cdf0e10cSrcweir
183cdf0e10cSrcweir if (nCe.IsValid())
184cdf0e10cSrcweir {
185cdf0e10cSrcweir io_setColumns.push_back(bThereComesMore ? 1 : 0);
186cdf0e10cSrcweir
187cdf0e10cSrcweir const ary::idl::CodeEntity &
188cdf0e10cSrcweir rCe = i_env.Gate().Ces().Find_Ce(nCe);
189cdf0e10cSrcweir Write_Bases( o_out,
190cdf0e10cSrcweir i_env,
191cdf0e10cSrcweir rCe,
192cdf0e10cSrcweir io_setColumns );
193cdf0e10cSrcweir io_setColumns.pop_back();
194cdf0e10cSrcweir }
195cdf0e10cSrcweir } // end for
196cdf0e10cSrcweir }
197