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_CPP_SDOCDIST_HXX
29 #define ADC_CPP_SDOCDIST_HXX
30 
31 
32 
33 // USED SERVICES
34 	// BASE CLASSES
35 #include "cxt2ary.hxx"
36 #include <ary/info/docstore.hxx>
37 	// COMPONENTS
38 	// PARAMETERS
39 
40 namespace cpp
41 {
42 
43 using ary::Documentation;
44 
45 /** Implementation struct for cpp::ContextForAry.
46 */
47 
48 struct ContextForAry::S_DocuDistributor : public ary::info::DocuStore
49 {
50   public:
51                         S_DocuDistributor()     :   pCurRe(0) {}
52                         ~S_DocuDistributor()    {}
53 
54     void                Reset()                 { pCurRe = 0; pLastStoredDocu = 0; }
55 
56     void                SetCurrentlyStoredRe(
57                             ary::cpp::CppEntity &
58                                                 io_rRe );
59     void                Event_LineBreak();
60 
61   private:
62     // Interface ary::info::DocuStore
63 	virtual void	 	do_Store2CurFile(
64 							DYN ary::doc::Node& let_drDocu );
65 	virtual void	 	do_Store2CurNamespace(
66 							DYN ary::doc::Node& let_drDocu );
67 
68 	virtual void	 	do_Store2ConnectedDeclaration(
69 							DYN ary::doc::Node& let_drDocu );
70 
71 	virtual void	 	do_Store2Glossary(
72 							DYN ary::doc::Node& let_drDocu,
73 							const String  &	    i_sExplainedTerm );
74 	virtual void	 	do_Store2GlobalTexts(
75 							DYN ary::doc::Node& let_drDocu,
76 							ary::info::GlobalTextId
77 												i_nId );
78     // DATA
79     ary::cpp::CppEntity *
80                         pCurRe;
81     Dyn<ary::doc::Node> pLastStoredDocu;
82 };
83 
84 
85 // IMPLEMENTATION
86 
87 /*  The implementation is in header, though not all inline, because this file
88     is included in cxt2ary.cxx only!
89 */
90 
91 
92 void
93 ContextForAry::
94 S_DocuDistributor::SetCurrentlyStoredRe( ary::cpp::CppEntity & io_rRe )
95 {
96     pCurRe = &io_rRe;
97     if ( pLastStoredDocu )
98         pCurRe->Set_Docu( *pLastStoredDocu.Release() );
99 }
100 
101 inline void
102 ContextForAry::
103 S_DocuDistributor::Event_LineBreak()
104 {
105     pCurRe = 0;
106 }
107 
108 void
109 ContextForAry::
110 S_DocuDistributor::do_Store2CurFile( DYN ary::doc::Node & let_drDocu )
111 {
112     // KORR_FUTURE
113     delete &let_drDocu;
114 }
115 
116 void
117 ContextForAry::
118 S_DocuDistributor::do_Store2CurNamespace( DYN ary::doc::Node & let_drDocu )
119 {
120     // KORR_FUTURE
121     delete &let_drDocu;
122 }
123 
124 void
125 ContextForAry::
126 S_DocuDistributor::do_Store2ConnectedDeclaration( DYN ary::doc::Node & let_drDocu )
127 {
128     if ( pCurRe != 0 )
129         pCurRe->Set_Docu(let_drDocu);
130     else
131         pLastStoredDocu = &let_drDocu;
132 }
133 
134 void
135 ContextForAry::
136 S_DocuDistributor::do_Store2Glossary( DYN ary::doc::Node & let_drDocu,
137 							          const String &	       // i_sExplainedTerm
138                                       )
139 {
140     // KORR_FUTURE
141     delete &let_drDocu;
142 }
143 
144 void
145 ContextForAry::
146 S_DocuDistributor::do_Store2GlobalTexts( DYN ary::doc::Node &       let_drDocu,
147 							             ary::info::GlobalTextId    // i_nId
148 							           )
149 {
150     // KORR_FUTURE
151     delete &let_drDocu;
152 }
153 
154 
155 
156 
157 }   // namespace cpp
158 #endif
159