xref: /trunk/main/editeng/source/editeng/eehtml.hxx (revision cdf0e10c)
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 _EEHTML_HXX
29 #define _EEHTML_HXX
30 
31 #include <svl/svarray.hxx>
32 
33 #include <editdoc.hxx>
34 #include <svtools/parhtml.hxx>
35 
36 class ImpEditEngine;
37 
38 #define MAX_NUMBERLEVEL			10
39 
40 struct AnchorInfo
41 {
42 	String	aHRef;
43 	String	aText;
44 };
45 
46 class EditHTMLParser : public HTMLParser
47 {
48 	using HTMLParser::CallParser;
49 private:
50 	EditSelection 			aCurSel;
51     String                  aBaseURL;
52 	ImpEditEngine* 			pImpEditEngine;
53 	AnchorInfo*				pCurAnchor;
54 
55 	sal_Bool					bInPara;
56 	sal_Bool					bWasInPara;	// bInPara vor HeadingStart merken, weil sonst hinterher weg
57 	sal_Bool					bFieldsInserted;
58 	sal_uInt8					nInTable;
59 	sal_uInt8					nInCell;
60     sal_Bool                    bInTitle;
61 
62 	sal_uInt8					nDefListLevel;
63 	sal_uInt8					nBulletLevel;
64 	sal_uInt8					nNumberingLevel;
65 
66 	sal_uInt8					nLastAction;
67 
68 	void					StartPara( sal_Bool bReal );
69 	void					EndPara( sal_Bool bReal );
70 	void					AnchorStart();
71 	void					AnchorEnd();
72 	void					HeadingStart( int nToken );
73 	void					HeadingEnd( int nToken );
74 	void					SkipGroup( int nEndToken );
75 	sal_Bool					ThrowAwayBlank();
76 	sal_Bool					HasTextInCurrentPara();
77 	void					ProcessUnknownControl( sal_Bool bOn );
78 
79 	void					ImpInsertParaBreak();
80 	void 					ImpInsertText( const String& rText );
81 	void 					ImpSetAttribs( const SfxItemSet& rItems, EditSelection* pSel = 0 );
82 	void					ImpSetStyleSheet( sal_uInt16 nHeadingLevel );
83 
84 protected:
85 	virtual void 			NextToken( int nToken );
86 
87 public:
88                             EditHTMLParser( SvStream& rIn, const String& rBaseURL, SvKeyValueIterator* pHTTPHeaderAttrs );
89 							~EditHTMLParser();
90 
91 	virtual SvParserState 	CallParser( ImpEditEngine* pImpEE, const EditPaM& rPaM );
92 
93 	const EditSelection&	GetCurSelection() const { return aCurSel; }
94 };
95 
96 SV_DECL_REF( EditHTMLParser )
97 SV_IMPL_REF( EditHTMLParser );
98 
99 #endif // _EEHTML_HXX
100