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 : : aItemSet(*pPool)
38 : , nCol(0)
39 : , nTwips(0)
40 0 : , nColOverlap(1)
41 : {
42 0 : }
43 : };
44 :
45 0 : class ScRTFColTwips : public o3tl::sorted_vector<sal_uLong> {};
46 :
47 : #else // SC_RTFPARSE_CXX
48 :
49 : struct ScRTFCellDefault;
50 : class ScRTFColTwips;
51 :
52 : #endif // SC_RTFPARSE_CXX
53 :
54 :
55 : class EditEngine;
56 :
57 : class ScRTFParser : public ScEEParser
58 : {
59 : private:
60 : typedef boost::ptr_vector<ScRTFCellDefault> DefaultList;
61 :
62 : DefaultList maDefaultList;
63 : size_t mnCurPos;
64 :
65 : ScRTFColTwips* pColTwips;
66 : ScRTFCellDefault* pInsDefault;
67 : ScRTFCellDefault* pActDefault;
68 : ScRTFCellDefault* pDefMerge;
69 : sal_uLong nStartAdjust;
70 : sal_uInt16 nLastWidth;
71 : bool bNewDef;
72 :
73 : DECL_LINK( RTFImportHdl, ImportInfo* );
74 : inline void NextRow();
75 : void EntryEnd( ScEEParseEntry*, const ESelection& );
76 : void ProcToken( ImportInfo* );
77 : void ColAdjust();
78 : bool SeekTwips( sal_uInt16 nTwips, SCCOL* pCol );
79 : void NewCellRow( ImportInfo* );
80 :
81 : public:
82 : ScRTFParser( EditEngine* );
83 : virtual ~ScRTFParser();
84 : virtual sal_uLong Read( SvStream&, const OUString& rBaseURL ) SAL_OVERRIDE;
85 : };
86 :
87 :
88 : #endif
89 :
90 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|