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 #include <precomp.h>
29 #include <ary_i/ci_text2.hxx>
30 
31 
32 // NOT FULLY DEFINED SERVICES
33 #include <ary_i/disdocum.hxx>
34 #include <ary_i/d_token.hxx>
35 
36 
37 namespace ary
38 {
39 namespace inf
40 {
41 
42 DocuTex2::DocuTex2()
43 {
44 }
45 
46 DocuTex2::~DocuTex2()
47 {
48 	for ( TokenList::iterator iter = aTokens.begin();
49 		  iter != aTokens.end();
50 		  ++iter )
51 	{
52 		delete (*iter);
53 	}
54 }
55 
56 void
57 DocuTex2::DisplayAt( DocumentationDisplay & o_rDisplay ) const
58 {
59 	for ( ary::inf::DocuTex2::TokenList::const_iterator
60 				iter = aTokens.begin();
61 		  iter != aTokens.end();
62 		  ++iter )
63 	{
64 		(*iter)->DisplayAt(o_rDisplay);
65 	}
66 }
67 
68 void
69 DocuTex2::AddToken( DYN DocuToken &	let_drToken )
70 {
71     if (aTokens.empty())
72     {
73         if (let_drToken.IsWhiteOnly())
74             return;
75     }
76     aTokens.push_back(&let_drToken);
77 }
78 
79 bool
80 DocuTex2::IsEmpty() const
81 {
82 	for ( ary::inf::DocuTex2::TokenList::const_iterator
83 				iter = aTokens.begin();
84 		  iter != aTokens.end();
85 		  ++iter )
86 	{
87     	return false;
88 	}
89     return true;
90 }
91 
92 using csi::dsapi::DT_TextToken;
93 
94 const String &
95 DocuTex2::TextOfFirstToken() const
96 {
97     if (NOT aTokens.empty())
98     {
99         const DT_TextToken *
100             pTok = dynamic_cast< const DT_TextToken* >(*aTokens.begin());
101 
102         if (pTok != 0)
103             return pTok->GetTextStr();
104     }
105     return String::Null_();
106 }
107 
108 String &
109 DocuTex2::Access_TextOfFirstToken()
110 {
111     if (NOT aTokens.empty())
112     {
113         DT_TextToken *
114             pTok = dynamic_cast< DT_TextToken* >(*aTokens.begin());
115 
116         if (pTok != 0)
117             return pTok->Access_Text();
118     }
119 
120     static String sDummy_;
121     return sDummy_;
122 }
123 
124 
125 
126 void    DocuText_Display::Display_StdAtTag(
127 							const csi::dsapi::DT_StdAtTag & ) {}
128 void    DocuText_Display::Display_SeeAlsoAtTag(
129 							const csi::dsapi::DT_SeeAlsoAtTag & ) {}
130 void    DocuText_Display::Display_ParameterAtTag(
131 							const csi::dsapi::DT_ParameterAtTag & ) {}
132 void    DocuText_Display::Display_SinceAtTag(
133 							const csi::dsapi::DT_SinceAtTag & ) {}
134 
135 
136 
137 }   // namespace inf
138 }   // namespace ary
139 
140