xref: /AOO41X/main/autodoc/source/display/idl/hfi_hierarchy.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef ADC_DISPLAY_HFI_HIERARCHY_HXX
29 #define ADC_DISPLAY_HFI_HIERARCHY_HXX
30 
31 // USED SERVICES
32 	// BASE CLASSES
33 	// COMPONENTS
34 	// PARAMETERS
35 #include <ary/idl/i_comrela.hxx>
36 #include <ary/idl/i_types4idl.hxx>
37 
38 
39 namespace csi
40 {
41 namespace xml
42 {
43     class Element;
44 }
45 }
46 
47 
48 class HF_IdlInterface;
49 class HtmlEnvironment_Idl;
50 
51 
52 
53 /** Represents a node in an pyramidic inheritance hierarchy which shall be
54     displayed in text mode.
55 */
56 class HF_IdlBaseNode
57 {
58   public:
59     typedef ary::idl::CodeEntity            CE;
60     typedef ary::idl::Type                  TYPE;
61     typedef ary::idl::Gate                  GATE;
62     typedef ary::idl::Ce_id                 Ce_id;
63     typedef ary::idl::Type_id               Type_id;
64 
65     /** @descr
66         The constructor recursively calls further constructors of
67         HF_IdlBaseNode for the bases of ->i_rType, if ->i_rType matches to a
68         ->CE.
69         So it builds up a complete hierarchy tree of all base classes
70         of ->i_pEntity.
71     */
72                         HF_IdlBaseNode(
73                             const TYPE &        i_rType,
74                             const GATE &        i_rGate,
75                             intt                i_nPositionOffset,
76                             HF_IdlBaseNode &    io_rDerived );
77                         ~HF_IdlBaseNode();
78 
79     /** Recursively fills ->o_rPositionList with the instances of base
80         classes in the order in which they will be displayed.
81     */
82     void                FillPositionList(
83                             std::vector< const HF_IdlBaseNode* > &
84                                                 o_rPositionList ) const;
85 
86     Type_id             Type() const            { return nType; }
87     intt                BaseCount() const       { return nCountBases; }
88     intt                Position() const        { return nPosition; }
89     int                 Xpos() const            { return 3*Position(); }
90     int                 Ypos() const            { return 2*Position(); }
91     const HF_IdlBaseNode *        Derived() const         { return pDerived; }
92 
93   private:
94     typedef std::vector< DYN HF_IdlBaseNode* > BaseList;
95 
96     void                GatherBases(
97                             const CE &          i_rCe,
98                             const GATE &        i_rGate );
99 
100     // DATA
101     Type_id             nType;
102     BaseList            aBases;
103     intt                nCountBases;
104     intt                nPosition;
105     HF_IdlBaseNode *    pDerived;
106 };
107 
108 void                Write_BaseHierarchy(
109                         csi::xml::Element & o_rOut,
110                         HtmlEnvironment_Idl &
111                                             i_env,
112                         const ary::idl::CodeEntity &
113                                             i_rCe );
114 
115 void                Write_Bases(
116                         csi::xml::Element & o_rOut,
117                         HtmlEnvironment_Idl &
118                                             i_env,
119                         const ary::idl::CodeEntity &
120                                             i_rCe,
121                         std::vector<uintt> &
122                                             io_setColumns );
123 
124 #endif
125