xref: /aoo4110/main/sc/source/filter/inc/rtfparse.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_RTFPARSE_HXX
25 #define SC_RTFPARSE_HXX
26 
27 #include "eeparser.hxx"
28 
29 #ifdef SC_RTFPARSE_CXX
30 
31 struct ScRTFCellDefault
32 {
33 	SfxItemSet			aItemSet;
34 	SCCOL				nCol;
35 	sal_uInt16				nTwips;         // rechter Rand der Zelle
36 	SCCOL				nColOverlap;	// MergeCell wenn >1, merged cells wenn 0
37 
ScRTFCellDefaultScRTFCellDefault38 						ScRTFCellDefault( SfxItemPool* pPool ) :
39 							aItemSet( *pPool ), nColOverlap(1) {}
40 };
41 
42 DECLARE_LIST( ScRTFDefaultList, ScRTFCellDefault* )
43 // Remove: (const unsigned short &) not sufficiently different from (unsigned short)
44 // deswegen sal_uLong, typedef bringt's auch nicht :-(
45 SV_DECL_VARARR_SORT( ScRTFColTwips, sal_uLong, 16, 4)
46 
47 #else		// SC_RTFPARSE_CXX
48 
49 struct ScRTFCellDefault;
50 class ScRTFDefaultList;
51 class ScRTFColTwips;
52 
53 #endif		// SC_RTFPARSE_CXX
54 
55 
56 class EditEngine;
57 
58 class ScRTFParser : public ScEEParser
59 {
60 private:
61 	ScRTFDefaultList*	pDefaultList;
62 	ScRTFColTwips*		pColTwips;
63 	ScRTFCellDefault*	pInsDefault;
64 	ScRTFCellDefault*	pActDefault;
65 	ScRTFCellDefault*	pDefMerge;
66 	sal_uLong				nStartAdjust;
67 	sal_uInt16				nLastWidth;
68 	sal_Bool				bNewDef;
69 
70 	DECL_LINK( RTFImportHdl, ImportInfo* );
71 	inline void			NextRow();
72 	void				EntryEnd( ScEEParseEntry*, const ESelection& );
73 	void 				ProcToken( ImportInfo* );
74 	void				ColAdjust();
75 	sal_Bool				SeekTwips( sal_uInt16 nTwips, SCCOL* pCol );
76 	void				NewCellRow( ImportInfo* );
77 
78 public:
79 						ScRTFParser( EditEngine* );
80 	virtual				~ScRTFParser();
81     virtual sal_uLong       Read( SvStream&, const String& rBaseURL );
82 };
83 
84 
85 #endif
86