Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _EERTFPAR_HXX
29 : : #define _EERTFPAR_HXX
30 : :
31 : : #include <editeng/svxrtf.hxx>
32 : :
33 : : #include <editdoc.hxx>
34 : : #include <impedit.hxx>
35 : :
36 : : class EditEngine;
37 : :
38 [ # # ]: 0 : class EditNodeIdx : public SvxNodeIdx
39 : : {
40 : : private:
41 : : EditEngine* mpEditEngine;
42 : : ContentNode* mpNode;
43 : :
44 : : public:
45 : : EditNodeIdx(EditEngine* pEE, ContentNode* pNd = NULL);
46 : :
47 : : virtual sal_uLong GetIdx() const;
48 : : virtual SvxNodeIdx* Clone() const;
49 : 0 : ContentNode* GetNode() { return mpNode; }
50 : : };
51 : :
52 [ # # ]: 0 : class EditPosition : public SvxPosition
53 : : {
54 : : private:
55 : : EditEngine* mpEditEngine;
56 : : EditSelection* mpCurSel;
57 : :
58 : : public:
59 : : EditPosition(EditEngine* pIEE, EditSelection* pSel);
60 : :
61 : : virtual sal_uLong GetNodeIdx() const;
62 : : virtual sal_uInt16 GetCntIdx() const;
63 : :
64 : : // clone
65 : : virtual SvxPosition* Clone() const;
66 : :
67 : : // clone NodeIndex
68 : : virtual SvxNodeIdx* MakeNodeIdx() const;
69 : : };
70 : :
71 : : #define ACTION_INSERTTEXT 1
72 : : #define ACTION_INSERTPARABRK 2
73 : :
74 : : class EditRTFParser : public SvxRTFParser
75 : : {
76 : : private:
77 : : EditSelection aCurSel;
78 : : EditEngine* mpEditEngine;
79 : : CharSet eDestCharSet;
80 : : MapMode aRTFMapMode;
81 : : MapMode aEditMapMode;
82 : :
83 : : sal_uInt16 nDefFont;
84 : : sal_uInt16 nDefTab;
85 : : sal_uInt16 nDefFontHeight;
86 : : sal_uInt8 nLastAction;
87 : :
88 : : protected:
89 : : virtual void InsertPara();
90 : : virtual void InsertText();
91 : : virtual void MovePos( int bForward = sal_True );
92 : : virtual void SetEndPrevPara( SvxNodeIdx*& rpNodePos,
93 : : sal_uInt16& rCntPos );
94 : :
95 : : virtual void UnknownAttrToken( int nToken, SfxItemSet* pSet );
96 : : virtual void NextToken( int nToken );
97 : : virtual void SetAttrInDoc( SvxRTFItemStackType &rSet );
98 : : virtual int IsEndPara( SvxNodeIdx* pNd, sal_uInt16 nCnt ) const;
99 : : virtual void CalcValue();
100 : : void CreateStyleSheets();
101 : : SfxStyleSheet* CreateStyleSheet( SvxRTFStyleType* pRTFStyle );
102 : : SvxRTFStyleType* FindStyleSheet( const String& rName );
103 : : void AddRTFDefaultValues( const EditPaM& rStart, const EditPaM& rEnd );
104 : : void ReadField();
105 : : void SkipGroup();
106 : :
107 : : public:
108 : : EditRTFParser(SvStream& rIn, EditSelection aCurSel, SfxItemPool& rAttrPool, EditEngine* pEditEngine);
109 : : ~EditRTFParser();
110 : :
111 : : virtual SvParserState CallParser();
112 : :
113 : :
114 : : void SetDestCharSet( CharSet eCharSet ) { eDestCharSet = eCharSet; }
115 : : CharSet GetDestCharSet() const { return eDestCharSet; }
116 : :
117 : : sal_uInt16 GetDefTab() const { return nDefTab; }
118 : 0 : Font GetDefFont() { return GetFont( nDefFont ); }
119 : :
120 : 0 : EditPaM GetCurPaM() const { return aCurSel.Max(); }
121 : : };
122 : :
123 : 0 : SV_DECL_REF( EditRTFParser )
124 [ # # ][ # # ]: 0 : SV_IMPL_REF( EditRTFParser );
125 : :
126 : :
127 : : #endif //_EERTFPAR_HXX
128 : :
129 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|