xref: /aoo42x/main/sc/source/filter/inc/rtfparse.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 SC_RTFPARSE_HXX
29 #define SC_RTFPARSE_HXX
30 
31 #include "eeparser.hxx"
32 
33 #ifdef SC_RTFPARSE_CXX
34 
35 struct ScRTFCellDefault
36 {
37 	SfxItemSet			aItemSet;
38 	SCCOL				nCol;
39 	sal_uInt16				nTwips;         // rechter Rand der Zelle
40 	SCCOL				nColOverlap;	// MergeCell wenn >1, merged cells wenn 0
41 
42 						ScRTFCellDefault( SfxItemPool* pPool ) :
43 							aItemSet( *pPool ), nColOverlap(1) {}
44 };
45 
46 DECLARE_LIST( ScRTFDefaultList, ScRTFCellDefault* )
47 // Remove: (const unsigned short &) not sufficiently different from (unsigned short)
48 // deswegen sal_uLong, typedef bringt's auch nicht :-(
49 SV_DECL_VARARR_SORT( ScRTFColTwips, sal_uLong, 16, 4)
50 
51 #else		// SC_RTFPARSE_CXX
52 
53 struct ScRTFCellDefault;
54 class ScRTFDefaultList;
55 class ScRTFColTwips;
56 
57 #endif		// SC_RTFPARSE_CXX
58 
59 
60 class EditEngine;
61 
62 class ScRTFParser : public ScEEParser
63 {
64 private:
65 	ScRTFDefaultList*	pDefaultList;
66 	ScRTFColTwips*		pColTwips;
67 	ScRTFCellDefault*	pInsDefault;
68 	ScRTFCellDefault*	pActDefault;
69 	ScRTFCellDefault*	pDefMerge;
70 	sal_uLong				nStartAdjust;
71 	sal_uInt16				nLastWidth;
72 	sal_Bool				bNewDef;
73 
74 	DECL_LINK( RTFImportHdl, ImportInfo* );
75 	inline void			NextRow();
76 	void				EntryEnd( ScEEParseEntry*, const ESelection& );
77 	void 				ProcToken( ImportInfo* );
78 	void				ColAdjust();
79 	sal_Bool				SeekTwips( sal_uInt16 nTwips, SCCOL* pCol );
80 	void				NewCellRow( ImportInfo* );
81 
82 public:
83 						ScRTFParser( EditEngine* );
84 	virtual				~ScRTFParser();
85     virtual sal_uLong       Read( SvStream&, const String& rBaseURL );
86 };
87 
88 
89 #endif
90