1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cx_docu2.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #include <s2_dsapi/cx_docu2.hxx>
35 // NOT FULLY DEFINED SERVICES
36 #include <../../parser/inc/tokens/parseinc.hxx>
37 #include <s2_dsapi/tokrecv.hxx>
38 #include <s2_dsapi/tk_html.hxx>
39 #include <s2_dsapi/tk_xml.hxx>
40 #include <s2_dsapi/tk_docw2.hxx>
41 #include <x_parse2.hxx>
53 Cx_Base::PassNewToken()
57 rReceiver
.Receive(*pNewToken
.Release());
65 Cx_Base::FollowUpContext()
67 csv_assert(pFollowUpContext
!= 0);
68 return *pFollowUpContext
;
72 Cx_Base::Handle_DocuSyntaxError( CharacterSource
& io_rText
)
75 // Put this into Error Log File
77 Cerr() << "Error: Syntax error in documentation within "
79 << io_rText
.CutToken()
82 SetToken( new Tok_Word(io_rText
.CurToken()) );
86 Cx_EoHtml::ReadCharChain( CharacterSource
& io_rText
)
88 if ( NULCH
== jumpTo(io_rText
,'>') )
89 throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF
);
91 SetToken(new Tok_HtmlTag(io_rText
.CutToken(),bToken_IsStartOfParagraph
));
95 Cx_EoXmlConst::ReadCharChain( CharacterSource
& io_rText
)
97 char c
= jumpTo(io_rText
,'>','*');
98 if ( NULCH
== c OR
'*' == c
)
100 Handle_DocuSyntaxError(io_rText
);
106 SetToken(new Tok_XmlConst(eTokenId
));
110 Cx_EoXmlLink_BeginTag::ReadCharChain( CharacterSource
& io_rText
)
116 char cReached
= jumpTo(io_rText
,'"','>','*');
123 char c
= jumpTo(io_rText
,'"','*', '>');
124 if ( NULCH
== c OR
'*' == c OR
'>' == c
)
128 Handle_DocuSyntaxError(io_rText
);
132 const char * pAttribute
= io_rText
.CutToken();
133 if ( *pAttribute
!= '[' )
144 Handle_DocuSyntaxError(io_rText
);
147 throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF
);
149 } while ( io_rText
.CurChar() != '>' );
153 SetToken( new Tok_XmlLink_BeginTag(eTokenId
, sScope
.c_str(), sDim
.c_str()) );
157 Cx_EoXmlLink_EndTag::ReadCharChain( CharacterSource
& io_rText
)
159 char c
= jumpTo(io_rText
,'>','*');
160 if ( NULCH
== c OR
'*' == c
)
162 Handle_DocuSyntaxError(io_rText
);
168 SetToken(new Tok_XmlLink_EndTag(eTokenId
));
172 Cx_EoXmlFormat_BeginTag::ReadCharChain( CharacterSource
& io_rText
)
176 char cReached
= jumpTo(io_rText
,'"','>','*');
184 char c
= jumpTo(io_rText
,'"','*','>');
185 if ( NULCH
== c OR
'*' == c OR
'>' == c
)
189 Handle_DocuSyntaxError(io_rText
);
193 sDim
= io_rText
.CutToken();
195 c
= jumpTo(io_rText
,'>','*');
196 if ( NULCH
== c OR
'*' == c
)
198 Handle_DocuSyntaxError(io_rText
);
206 Handle_DocuSyntaxError(io_rText
);
209 throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF
);
214 SetToken(new Tok_XmlFormat_BeginTag(eTokenId
, sDim
));
218 Cx_EoXmlFormat_EndTag::ReadCharChain( CharacterSource
& io_rText
)
220 char c
= jumpTo(io_rText
,'>','*');
221 if ( NULCH
== c OR
'*' == c
)
223 Handle_DocuSyntaxError(io_rText
);
229 SetToken(new Tok_XmlFormat_EndTag(eTokenId
));
233 Cx_CheckStar::ReadCharChain( CharacterSource
& io_rText
)
235 bEndTokenFound
= false;
238 char cNext
= jumpOver(io_rText
,'*');
239 if ( NULCH
== cNext
)
240 throw X_AutodocParser(X_AutodocParser::x_UnexpectedEOF
);
244 SetToken(new Tok_DocuEnd
);
245 bEndTokenFound
= true;
249 SetToken( new Tok_Word(io_rText
.CutToken()) );
254 jumpToWhite(io_rText
);
255 SetToken( new Tok_Word(io_rText
.CutToken()) );
260 Cx_CheckStar::FollowUpContext()
263 return *pEnd_FollowUpContext
;
265 return Cx_Base::FollowUpContext();