xref: /AOO41X/main/autodoc/source/display/idl/hi_linkhelper.hxx (revision a046d00f64f7897a53f3356d02ce7dd043873852)
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_HI_LINKHELPER_HXX
29 #define ADC_DISPLAY_HI_LINKHELPER_HXX
30 
31 
32 // USED SERVICES
33     // BASE CLASSES
34     // COMPONENTS
35     // PARAMETERS
36 #include "hi_ary.hxx"
37 #include "hi_env.hxx"
38 #include <toolkit/out_position.hxx>
39 #include <toolkit/out_tree.hxx>
40 
41 
42 class LinkHelper
43 {
44   public:
45     typedef ary::idl::CodeEntity                CE;
46     typedef output::Position                    OutPosition;
47 
48                         LinkHelper(
49                             HtmlEnvironment_Idl &
50                                                 io_rEnv )
51                             :   rEnv(io_rEnv) {}
52 
53     OutPosition         PositionOf_CurModule() const
54 	                    { return OutPosition( rEnv.CurPosition(),
55 											  output::ModuleFileName()); }
56 
57     OutPosition         PositionOf_CurXRefs(
58 						    const String &      i_ceName) const;
59     OutPosition         PositionOf_Index() const
60 	                    { OutPosition ret1 = rEnv.OutputTree().IndexRoot();
61 	                      return OutPosition( ret1, String(output::IndexFile_A()) ); }
62 
63 
64     const ary::idl::Module *
65                         Search_CurModule() const;
66     const ary::idl::Module *
67                         Search_Module(
68                             output::Node &      i_node ) const;
69 
70     const CE *          Search_CeFromType(
71                             ary::idl::Type_id   i_type ) const;
72 
73     void                Get_Link2Position(
74                             StreamStr &         o_link,
75                             OutPosition &       i_pos ) const
76                         { rEnv.CurPosition().Get_LinkTo(o_link, i_pos); }
77 
78     void                Get_Link2Member(
79                             StreamStr &         o_link,
80                             OutPosition &       i_ownerPos,
81                             const String &      i_memberName ) const
82                         { Get_Link2Position(o_link, i_ownerPos);
83                           o_link << "#" << i_memberName; }
84     const String &      XrefsSuffix() const;
85 
86   private:
87     // DATA
88     HtmlEnvironment_Idl & rEnv;
89 };
90 
91 inline const ary::idl::CodeEntity *
92 LinkHelper::Search_CeFromType( ary::idl::Type_id i_type ) const
93 {
94     ary::idl::Ce_id nCe = rEnv.Data().CeFromType(i_type);
95     if (nCe.IsValid())
96         return &rEnv.Data().Find_Ce(nCe);
97     return 0;
98 }
99 
100 
101 
102 String              nameChainLinker(
103                         const char *        i_levelName );
104 
105 
106 #endif
107