Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef SC_RTFPARSE_HXX
21 : #define SC_RTFPARSE_HXX
22 :
23 : #include "eeparser.hxx"
24 :
25 : #ifdef SC_RTFPARSE_CXX
26 : #include <boost/ptr_container/ptr_vector.hpp>
27 : #include <o3tl/sorted_vector.hxx>
28 :
29 0 : struct ScRTFCellDefault
30 : {
31 : SfxItemSet aItemSet;
32 : SCCOL nCol;
33 : sal_uInt16 nTwips; // rechter Rand der Zelle
34 : SCCOL nColOverlap; // MergeCell wenn >1, merged cells wenn 0
35 :
36 0 : ScRTFCellDefault( SfxItemPool* pPool ) :
37 0 : aItemSet( *pPool ), nColOverlap(1) {}
38 : };
39 :
40 0 : class ScRTFColTwips : public o3tl::sorted_vector<sal_uLong> {};
41 :
42 : #else // SC_RTFPARSE_CXX
43 :
44 : struct ScRTFCellDefault;
45 : class ScRTFColTwips;
46 :
47 : #endif // SC_RTFPARSE_CXX
48 :
49 :
50 : class EditEngine;
51 :
52 : class ScRTFParser : public ScEEParser
53 : {
54 : private:
55 : typedef boost::ptr_vector<ScRTFCellDefault> DefaultList;
56 :
57 : DefaultList maDefaultList;
58 : size_t mnCurPos;
59 :
60 : ScRTFColTwips* pColTwips;
61 : ScRTFCellDefault* pInsDefault;
62 : ScRTFCellDefault* pActDefault;
63 : ScRTFCellDefault* pDefMerge;
64 : sal_uLong nStartAdjust;
65 : sal_uInt16 nLastWidth;
66 : sal_Bool bNewDef;
67 :
68 : DECL_LINK( RTFImportHdl, ImportInfo* );
69 : inline void NextRow();
70 : void EntryEnd( ScEEParseEntry*, const ESelection& );
71 : void ProcToken( ImportInfo* );
72 : void ColAdjust();
73 : sal_Bool SeekTwips( sal_uInt16 nTwips, SCCOL* pCol );
74 : void NewCellRow( ImportInfo* );
75 :
76 : public:
77 : ScRTFParser( EditEngine* );
78 : virtual ~ScRTFParser();
79 : virtual sal_uLong Read( SvStream&, const String& rBaseURL );
80 : };
81 :
82 :
83 : #endif
84 :
85 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|