fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / autodoc / source / display / idl / hfi_hierarchy.cxx
blob19b18144abed7bda9b49b24e15d216312e8d9eca
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <precomp.h>
21 #include "hfi_hierarchy.hxx"
24 // NOT FULLY DECLARED SERVICES
25 #include <udm/html/htmlitem.hxx>
26 #include <ary/stdconstiter.hxx>
27 #include <ary/idl/i_ce.hxx>
28 #include <ary/idl/i_gate.hxx>
29 #include <ary/idl/i_type.hxx>
30 #include <ary/idl/ik_interface.hxx>
31 #include <ary/idl/ip_ce.hxx>
32 #include <ary/idl/ip_type.hxx>
33 #include "hfi_interface.hxx"
34 #include "hfi_typetext.hxx"
35 #include "hi_env.hxx"
39 HF_IdlBaseNode::HF_IdlBaseNode( const TYPE & i_rType,
40 const GATE & i_rGate,
41 intt i_nPositionOffset,
42 HF_IdlBaseNode & io_rDerived )
43 : nType(i_rType.TypeId()),
44 aBases(),
45 nCountBases(0),
46 nPosition(i_nPositionOffset),
47 pDerived(&io_rDerived)
49 Ce_id nCe = i_rGate.Types().Search_CeRelatedTo(nType);
50 if (nCe.IsValid())
52 GatherBases(i_rGate.Ces().Find_Ce(nCe), i_rGate);
56 HF_IdlBaseNode::~HF_IdlBaseNode()
60 void
61 HF_IdlBaseNode::FillPositionList( std::vector< const HF_IdlBaseNode* > & o_rPositionList ) const
63 for ( BaseList::const_iterator it = aBases.begin();
64 it != aBases.end();
65 ++it )
67 (*it)->FillPositionList(o_rPositionList);
68 } // end for
70 o_rPositionList.push_back(this);
73 void
74 HF_IdlBaseNode::GatherBases( const CE & i_rCe,
75 const GATE & i_rGate )
77 ary::Dyn_StdConstIterator<ary::idl::CommentedRelation>
78 aHelp;
79 ary::idl::ifc_interface::attr::Get_Bases(aHelp,i_rCe);
81 for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *aHelp;
82 it.operator bool();
83 ++it )
85 const TYPE &
86 rBaseType = i_rGate.Types().Find_Type((*it).Type());
88 Dyn<HF_IdlBaseNode>
89 pBaseNode( new HF_IdlBaseNode( rBaseType,
90 i_rGate,
91 nPosition,
92 *this )
95 intt nAddedBases = pBaseNode->BaseCount() + 1;
96 nCountBases += nAddedBases;
97 nPosition += nAddedBases;
98 aBases.push_back( pBaseNode.Release() );
99 } // end for
103 void
104 Write_BaseHierarchy( csi::xml::Element & o_rOut,
105 HtmlEnvironment_Idl & i_env,
106 const ary::idl::CodeEntity & i_ce )
108 csi::xml::Element &
109 rPre = o_rOut
110 >> *new csi::xml::AnElement("pre")
111 << new csi::html::StyleAttr("font-family:monospace;");
113 std::vector<uintt>
114 aSetColumns;
115 rPre
116 >> *new csi::html::Strong
117 << i_ce.LocalName();
118 rPre
119 << "\n";
120 Write_Bases( rPre,
121 i_env,
122 i_ce,
123 aSetColumns );
124 rPre
125 << "\n";
130 void
131 Write_Bases( csi::xml::Element & o_out,
132 HtmlEnvironment_Idl & i_env,
133 const ary::idl::CodeEntity & i_rCe,
134 std::vector<uintt> & io_setColumns )
136 ary::Dyn_StdConstIterator<ary::idl::CommentedRelation>
137 aHelp;
138 ary::idl::ifc_interface::attr::Get_Bases(aHelp,i_rCe);
140 for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *aHelp;
141 it.operator bool();
142 // NO INCREMENT HERE, see below
145 ary::idl::Type_id
146 nType = (*it).Type();
147 ++it;
148 bool
149 bThereComesMore = it.operator bool();
151 ary::idl::Ce_id
152 nCe = i_env.Gate().Types().Search_CeRelatedTo(nType);
153 if (nCe.IsValid())
155 // KORR_FUTURE
156 // Rather check for id(!) of com::sun::star::uno::XInterface.
157 if (i_env.Gate().Ces().Find_Ce(nCe).LocalName() == "XInterface")
158 continue;
161 for (uintt i = 0; i < io_setColumns.size(); ++i)
163 if (io_setColumns[i] == 1)
164 o_out << new csi::xml::XmlCode("&#x2503");
165 else
166 o_out << " ";
167 o_out << " ";
170 if (bThereComesMore)
171 o_out << new csi::xml::XmlCode("&#x2523");
172 else
173 o_out << new csi::xml::XmlCode("&#x2517");
174 o_out << " ";
176 HF_IdlTypeText
177 aDisplay( i_env, o_out, i_env.CurPageCe());
178 aDisplay.Produce_byData(nType);
179 o_out << "\n";
181 if (nCe.IsValid())
183 io_setColumns.push_back(bThereComesMore ? 1 : 0);
185 const ary::idl::CodeEntity &
186 rCe = i_env.Gate().Ces().Find_Ce(nCe);
187 Write_Bases( o_out,
188 i_env,
189 rCe,
190 io_setColumns );
191 io_setColumns.pop_back();
193 } // end for
196 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */