Bump for 3.6-28
[LibreOffice.git] / autodoc / source / display / idl / hfi_hierarchy.cxx
blobc968b9d2c8d46817c7ba0bf9199af8f92419bed5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include <precomp.h>
30 #include "hfi_hierarchy.hxx"
33 // NOT FULLY DECLARED SERVICES
34 #include <udm/html/htmlitem.hxx>
35 #include <ary/stdconstiter.hxx>
36 #include <ary/idl/i_ce.hxx>
37 #include <ary/idl/i_gate.hxx>
38 #include <ary/idl/i_type.hxx>
39 #include <ary/idl/ik_interface.hxx>
40 #include <ary/idl/ip_ce.hxx>
41 #include <ary/idl/ip_type.hxx>
42 #include "hfi_interface.hxx"
43 #include "hfi_typetext.hxx"
44 #include "hi_env.hxx"
48 HF_IdlBaseNode::HF_IdlBaseNode( const TYPE & i_rType,
49 const GATE & i_rGate,
50 intt i_nPositionOffset,
51 HF_IdlBaseNode & io_rDerived )
52 : nType(i_rType.TypeId()),
53 aBases(),
54 nCountBases(0),
55 nPosition(i_nPositionOffset),
56 pDerived(&io_rDerived)
58 Ce_id nCe = i_rGate.Types().Search_CeRelatedTo(nType);
59 if (nCe.IsValid())
61 GatherBases(i_rGate.Ces().Find_Ce(nCe), i_rGate);
65 HF_IdlBaseNode::~HF_IdlBaseNode()
69 void
70 HF_IdlBaseNode::FillPositionList( std::vector< const HF_IdlBaseNode* > & o_rPositionList ) const
72 for ( BaseList::const_iterator it = aBases.begin();
73 it != aBases.end();
74 ++it )
76 (*it)->FillPositionList(o_rPositionList);
77 } // end for
79 o_rPositionList.push_back(this);
82 void
83 HF_IdlBaseNode::GatherBases( const CE & i_rCe,
84 const GATE & i_rGate )
86 ary::Dyn_StdConstIterator<ary::idl::CommentedRelation>
87 aHelp;
88 ary::idl::ifc_interface::attr::Get_Bases(aHelp,i_rCe);
90 for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *aHelp;
91 it.operator bool();
92 ++it )
94 const TYPE &
95 rBaseType = i_rGate.Types().Find_Type((*it).Type());
97 Dyn<HF_IdlBaseNode>
98 pBaseNode( new HF_IdlBaseNode( rBaseType,
99 i_rGate,
100 nPosition,
101 *this )
104 intt nAddedBases = pBaseNode->BaseCount() + 1;
105 nCountBases += nAddedBases;
106 nPosition += nAddedBases;
107 aBases.push_back( pBaseNode.Release() );
108 } // end for
112 void
113 Write_BaseHierarchy( csi::xml::Element & o_rOut,
114 HtmlEnvironment_Idl & i_env,
115 const ary::idl::CodeEntity & i_ce )
117 csi::xml::Element &
118 rPre = o_rOut
119 >> *new csi::xml::AnElement("pre")
120 << new csi::html::StyleAttr("font-family:monospace;");
122 std::vector<uintt>
123 aSetColumns;
124 rPre
125 >> *new csi::html::Strong
126 << i_ce.LocalName();
127 rPre
128 << "\n";
129 Write_Bases( rPre,
130 i_env,
131 i_ce,
132 aSetColumns );
133 rPre
134 << "\n";
139 void
140 Write_Bases( csi::xml::Element & o_out,
141 HtmlEnvironment_Idl & i_env,
142 const ary::idl::CodeEntity & i_rCe,
143 std::vector<uintt> & io_setColumns )
145 ary::Dyn_StdConstIterator<ary::idl::CommentedRelation>
146 aHelp;
147 ary::idl::ifc_interface::attr::Get_Bases(aHelp,i_rCe);
149 for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *aHelp;
150 it.operator bool();
151 // NO INCREMENT HERE, see below
154 ary::idl::Type_id
155 nType = (*it).Type();
156 ++it;
157 bool
158 bThereComesMore = it.operator bool();
160 ary::idl::Ce_id
161 nCe = i_env.Gate().Types().Search_CeRelatedTo(nType);
162 if (nCe.IsValid())
164 // KORR_FUTURE
165 // Rather check for id(!) of com::sun::star::uno::XInterface.
166 if (i_env.Gate().Ces().Find_Ce(nCe).LocalName() == "XInterface")
167 continue;
170 for (uintt i = 0; i < io_setColumns.size(); ++i)
172 if (io_setColumns[i] == 1)
173 o_out << new csi::xml::XmlCode("&#x2503");
174 else
175 o_out << " ";
176 o_out << " ";
179 if (bThereComesMore)
180 o_out << new csi::xml::XmlCode("&#x2523");
181 else
182 o_out << new csi::xml::XmlCode("&#x2517");
183 o_out << " ";
185 HF_IdlTypeText
186 aDisplay( i_env, o_out, true, i_env.CurPageCe());
187 aDisplay.Produce_byData(nType);
188 o_out << "\n";
190 if (nCe.IsValid())
192 io_setColumns.push_back(bThereComesMore ? 1 : 0);
194 const ary::idl::CodeEntity &
195 rCe = i_env.Gate().Ces().Find_Ce(nCe);
196 Write_Bases( o_out,
197 i_env,
198 rCe,
199 io_setColumns );
200 io_setColumns.pop_back();
202 } // end for
205 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */