/src/libreoffice/include/editeng/svxrtf.hxx
Line | Count | Source |
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 INCLUDED_EDITENG_SVXRTF_HXX |
21 | | #define INCLUDED_EDITENG_SVXRTF_HXX |
22 | | |
23 | | #include <svl/itemset.hxx> |
24 | | #include <svtools/parrtf.hxx> |
25 | | #include <rtl/ustring.hxx> |
26 | | #include <tools/color.hxx> |
27 | | #include <vcl/font.hxx> |
28 | | |
29 | | #include <editeng/editengdllapi.h> |
30 | | |
31 | | #include <optional> |
32 | | #include <vector> |
33 | | #include <map> |
34 | | #include <memory> |
35 | | |
36 | | class SvxRTFItemStackType; |
37 | | using SvxRTFItemStackList = std::vector<std::unique_ptr<SvxRTFItemStackType>>; |
38 | | |
39 | | // Mapper-Classes for the various requirements on Document positions |
40 | | // Swg - NodePosition is a SwContentIndex, which is used internally |
41 | | // EditEngine - ULONG to list of paragraphs |
42 | | |
43 | | class EditEngine; |
44 | | class ContentNode; |
45 | | class EditNodeIdx |
46 | | { |
47 | | public: |
48 | | EditNodeIdx(EditEngine* pEE, ContentNode* pNd); |
49 | | sal_Int32 GetIdx() const; |
50 | 427k | ContentNode* GetNode() { return mpNode; } |
51 | | private: |
52 | | EditEngine* mpEditEngine; |
53 | | ContentNode* mpNode; |
54 | | }; |
55 | | |
56 | | class EditSelection; |
57 | | class EditPosition |
58 | | { |
59 | | private: |
60 | | EditEngine* mpEditEngine; |
61 | | EditSelection* mpCurSel; |
62 | | |
63 | | public: |
64 | | EditPosition(EditEngine* pIEE, EditSelection* pSel); |
65 | | |
66 | | sal_Int32 GetNodeIdx() const; |
67 | | sal_Int32 GetCntIdx() const; |
68 | | |
69 | | // clone NodeIndex |
70 | | EditNodeIdx MakeNodeIdx() const; |
71 | | }; |
72 | | |
73 | | typedef std::map<short, vcl::Font> SvxRTFFontTbl; |
74 | | |
75 | | // own helper classes for the RTF Parser |
76 | | struct SvxRTFStyleType |
77 | | { |
78 | | SfxItemSet aAttrSet; // the attributes of Style (+ derivated!) |
79 | | OUString sName; |
80 | | sal_uInt16 nBasedOn; |
81 | | sal_uInt8 nOutlineNo; |
82 | | |
83 | | SvxRTFStyleType(SfxItemPool& rPool, const WhichRangesContainer& pWhichRange); |
84 | | }; |
85 | | |
86 | | typedef std::map<sal_uInt16, SvxRTFStyleType> SvxRTFStyleTbl; |
87 | | |
88 | | class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser |
89 | | { |
90 | | std::vector<Color> maColorTable; |
91 | | SvxRTFFontTbl m_FontTable; |
92 | | SvxRTFStyleTbl m_StyleTable; |
93 | | std::deque< std::unique_ptr<SvxRTFItemStackType> > aAttrStack; |
94 | | SvxRTFItemStackList m_AttrSetList; |
95 | | |
96 | | struct PlainOrPardMap |
97 | | { |
98 | | std::map<sal_uInt16, sal_uInt16> data; |
99 | | template<class T> |
100 | 642k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); }TypedWhichId<SvxFontItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxFontItem>(TypedWhichId<SvxFontItem>) const Line | Count | Source | 100 | 256k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxFontHeightItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxFontHeightItem>(TypedWhichId<SvxFontHeightItem>) const Line | Count | Source | 100 | 64.3k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxPostureItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxPostureItem>(TypedWhichId<SvxPostureItem>) const Line | Count | Source | 100 | 40.0k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxWeightItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxWeightItem>(TypedWhichId<SvxWeightItem>) const Line | Count | Source | 100 | 42.0k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxLanguageItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxLanguageItem>(TypedWhichId<SvxLanguageItem>) const Line | Count | Source | 100 | 12.9k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxFormatSplitItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxFormatSplitItem>(TypedWhichId<SvxFormatSplitItem>) const Line | Count | Source | 100 | 363 | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxFormatKeepItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxFormatKeepItem>(TypedWhichId<SvxFormatKeepItem>) const Line | Count | Source | 100 | 426 | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SfxInt16Item> SvxRTFParser::PlainOrPardMap::operator[]<SfxInt16Item>(TypedWhichId<SfxInt16Item>) const Line | Count | Source | 100 | 538 | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxAdjustItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxAdjustItem>(TypedWhichId<SvxAdjustItem>) const Line | Count | Source | 100 | 9.47k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxLRSpaceItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxLRSpaceItem>(TypedWhichId<SvxLRSpaceItem>) const Line | Count | Source | 100 | 22.9k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxULSpaceItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxULSpaceItem>(TypedWhichId<SvxULSpaceItem>) const Line | Count | Source | 100 | 7.57k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxLineSpacingItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxLineSpacingItem>(TypedWhichId<SvxLineSpacingItem>) const Line | Count | Source | 100 | 9.47k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
Unexecuted instantiation: TypedWhichId<SvxForbiddenRuleItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxForbiddenRuleItem>(TypedWhichId<SvxForbiddenRuleItem>) const TypedWhichId<SvxHangingPunctuationItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxHangingPunctuationItem>(TypedWhichId<SvxHangingPunctuationItem>) const Line | Count | Source | 100 | 911 | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxScriptSpaceItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxScriptSpaceItem>(TypedWhichId<SvxScriptSpaceItem>) const Line | Count | Source | 100 | 16.2k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxParaVertAlignItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxParaVertAlignItem>(TypedWhichId<SvxParaVertAlignItem>) const Line | Count | Source | 100 | 917 | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxCaseMapItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxCaseMapItem>(TypedWhichId<SvxCaseMapItem>) const Line | Count | Source | 100 | 5.14k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxEscapementItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxEscapementItem>(TypedWhichId<SvxEscapementItem>) const Line | Count | Source | 100 | 10.6k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxKerningItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxKerningItem>(TypedWhichId<SvxKerningItem>) const Line | Count | Source | 100 | 8.86k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxAutoKernItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxAutoKernItem>(TypedWhichId<SvxAutoKernItem>) const Line | Count | Source | 100 | 1.03k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxContourItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxContourItem>(TypedWhichId<SvxContourItem>) const Line | Count | Source | 100 | 1.04k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxShadowedItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxShadowedItem>(TypedWhichId<SvxShadowedItem>) const Line | Count | Source | 100 | 1.10k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxCrossedOutItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxCrossedOutItem>(TypedWhichId<SvxCrossedOutItem>) const Line | Count | Source | 100 | 1.35k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxWordLineModeItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxWordLineModeItem>(TypedWhichId<SvxWordLineModeItem>) const Line | Count | Source | 100 | 3.22k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxUnderlineItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxUnderlineItem>(TypedWhichId<SvxUnderlineItem>) const Line | Count | Source | 100 | 12.0k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxOverlineItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxOverlineItem>(TypedWhichId<SvxOverlineItem>) const Line | Count | Source | 100 | 8.99k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxColorItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxColorItem>(TypedWhichId<SvxColorItem>) const Line | Count | Source | 100 | 8.86k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxFrameDirectionItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxFrameDirectionItem>(TypedWhichId<SvxFrameDirectionItem>) const Line | Count | Source | 100 | 2.77k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxEmphasisMarkItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxEmphasisMarkItem>(TypedWhichId<SvxEmphasisMarkItem>) const Line | Count | Source | 100 | 984 | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
Unexecuted instantiation: TypedWhichId<SvxTwoLinesItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxTwoLinesItem>(TypedWhichId<SvxTwoLinesItem>) const TypedWhichId<SvxCharScaleWidthItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxCharScaleWidthItem>(TypedWhichId<SvxCharScaleWidthItem>) const Line | Count | Source | 100 | 1.65k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxCharRotateItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxCharRotateItem>(TypedWhichId<SvxCharRotateItem>) const Line | Count | Source | 100 | 92 | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxCharReliefItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxCharReliefItem>(TypedWhichId<SvxCharReliefItem>) const Line | Count | Source | 100 | 2.25k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxCharHiddenItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxCharHiddenItem>(TypedWhichId<SvxCharHiddenItem>) const Line | Count | Source | 100 | 2.16k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxBrushItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxBrushItem>(TypedWhichId<SvxBrushItem>) const Line | Count | Source | 100 | 17.7k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxHyphenZoneItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxHyphenZoneItem>(TypedWhichId<SvxHyphenZoneItem>) const Line | Count | Source | 100 | 678 | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxShadowItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxShadowItem>(TypedWhichId<SvxShadowItem>) const Line | Count | Source | 100 | 2.10k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxTabStopItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxTabStopItem>(TypedWhichId<SvxTabStopItem>) const Line | Count | Source | 100 | 14.3k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
TypedWhichId<SvxBoxItem> SvxRTFParser::PlainOrPardMap::operator[]<SvxBoxItem>(TypedWhichId<SvxBoxItem>) const Line | Count | Source | 100 | 50.8k | TypedWhichId<T> operator[](TypedWhichId<T> in) const { return TypedWhichId<T>(data.at(in)); } |
|
101 | | template<class T> |
102 | 83.0k | void set(TypedWhichId<T> in, TypedWhichId<T> out) { data[in] = out; }void SvxRTFParser::PlainOrPardMap::set<SvxBrushItem>(TypedWhichId<SvxBrushItem>, TypedWhichId<SvxBrushItem>) Line | Count | Source | 102 | 27.6k | void set(TypedWhichId<T> in, TypedWhichId<T> out) { data[in] = out; } |
void SvxRTFParser::PlainOrPardMap::set<SvxBoxItem>(TypedWhichId<SvxBoxItem>, TypedWhichId<SvxBoxItem>) Line | Count | Source | 102 | 27.6k | void set(TypedWhichId<T> in, TypedWhichId<T> out) { data[in] = out; } |
void SvxRTFParser::PlainOrPardMap::set<SvxShadowItem>(TypedWhichId<SvxShadowItem>, TypedWhichId<SvxShadowItem>) Line | Count | Source | 102 | 27.6k | void set(TypedWhichId<T> in, TypedWhichId<T> out) { data[in] = out; } |
|
103 | | }; |
104 | | PlainOrPardMap aPlainMap; |
105 | | PlainOrPardMap aPardMap; |
106 | | WhichRangesContainer aWhichMap; |
107 | | |
108 | | std::optional<EditPosition> mxInsertPosition; |
109 | | SfxItemPool* pAttrPool; |
110 | | std::optional<Color> mxDefaultColor; |
111 | | std::optional<vcl::Font> pDfltFont; |
112 | | std::unique_ptr<SfxItemSet> pRTFDefaults; |
113 | | |
114 | | int nDfltFont; |
115 | | |
116 | | bool bNewDoc : 1; // sal_False - Reading in an existing |
117 | | bool bNewGroup : 1; // sal_True - there was an opening parenthesis |
118 | | bool bIsSetDfltTab : 1; // sal_True - DefTab was loaded |
119 | | bool bChkStyleAttr : 1; // sal_True - StyleSheets are evaluated |
120 | | bool bCalcValue : 1; // sal_True - Twip values adapt to App |
121 | | bool bIsLeftToRightDef : 1; // sal_True - in LeftToRight char run def. |
122 | | // sal_False - in RightToLeft char run def. |
123 | | bool bIsInReadStyleTab : 1; // sal_True - in ReadStyleTable |
124 | | |
125 | | SvxRTFParser(SvxRTFParser const&) = delete; |
126 | | void operator=(SvxRTFParser const&) = delete; |
127 | | |
128 | | void ClearColorTbl(); |
129 | | void ClearAttrStack(); |
130 | | |
131 | | SvxRTFItemStackType* GetAttrSet_(); // Create new ItemStackType:s |
132 | | void ClearStyleAttr_( SvxRTFItemStackType& rStkType ); |
133 | | |
134 | | // Sets all the attributes that are different from the current |
135 | | void SetAttrSet( SvxRTFItemStackType &rSet ); |
136 | | void SetDefault( int nToken, int nValue ); |
137 | | |
138 | | // Execute pard / plain |
139 | | void RTFPardPlain( bool bPard, SfxItemSet** ppSet ); |
140 | | |
141 | | void BuildWhichTable(); |
142 | | |
143 | | enum RTF_CharTypeDef |
144 | | { |
145 | | NOTDEF_CHARTYPE, |
146 | | LOW_CHARTYPE, |
147 | | HIGH_CHARTYPE, |
148 | | DOUBLEBYTE_CHARTYPE |
149 | | }; |
150 | | |
151 | | // set latin/asian/complex character attributes |
152 | | void SetScriptAttr( |
153 | | RTF_CharTypeDef eType, SfxItemSet& rSet, SfxPoolItem& rItem ); |
154 | | |
155 | | protected: |
156 | | virtual void InsertPara() = 0; |
157 | | |
158 | | static void DelCharAtEnd( OUStringBuffer& rStr, const sal_Unicode cDel ); |
159 | | |
160 | | // is called for each token that is recognized in CallParser |
161 | | virtual void NextToken( int nToken ) override; |
162 | | |
163 | | void ReadStyleTable(); |
164 | | void ReadColorTable(); |
165 | | void ReadFontTable(); |
166 | | void ReadAttr( int nToken, SfxItemSet* pSet ); |
167 | | void ReadTabAttr( int nToken, SfxItemSet& rSet ); |
168 | | |
169 | | inline SfxItemSet& GetAttrSet(); |
170 | | // no text yet inserted? (SttPos from the top stack entry!) |
171 | | bool IsAttrSttPos(); |
172 | | void AttrGroupEnd(); // edit the current, delete from stack |
173 | | void SetAllAttrOfStk(); // end all Attr. and set it into doc |
174 | | |
175 | | |
176 | | virtual void InsertText() = 0; |
177 | | virtual void MovePos( bool bForward = true ) = 0; |
178 | | virtual void SetEndPrevPara( std::optional<EditNodeIdx>& rpNodePos, |
179 | | sal_Int32& rCntPos )=0; |
180 | | virtual void SetAttrInDoc( SvxRTFItemStackType &rSet ); |
181 | | // for Tokens, which are not evaluated in ReadAttr |
182 | | virtual void UnknownAttrToken( int nToken ); |
183 | | |
184 | | // if no-one would like to have any twips |
185 | | virtual void CalcValue(); |
186 | | |
187 | | SvxRTFParser( SfxItemPool& rAttrPool, SvStream& rIn ); |
188 | | virtual ~SvxRTFParser() override; |
189 | | |
190 | 27.6k | void SetNewDoc( bool bFlag ) { bNewDoc = bFlag; } |
191 | 404k | bool IsChkStyleAttr() const { return bChkStyleAttr; } |
192 | 27.6k | void SetChkStyleAttr( bool bFlag ) { bChkStyleAttr = bFlag; } |
193 | 63.2k | bool IsCalcValue() const { return bCalcValue; } |
194 | 27.6k | void SetCalcValue( bool bFlag ) { bCalcValue = bFlag; } |
195 | | |
196 | | // Query/Set the current insert position |
197 | | void SetInsPos( const EditPosition& rNew ); |
198 | 0 | SvxRTFStyleTbl& GetStyleTbl() { return m_StyleTable; } |
199 | | |
200 | | public: |
201 | | |
202 | | virtual SvParserState CallParser() override; |
203 | | |
204 | | inline const Color& GetColor( size_t nId ) const; |
205 | | const vcl::Font& GetFont( sal_uInt16 nId ); // Changes the default Font |
206 | | |
207 | | virtual bool IsEndPara( EditNodeIdx* pNd, sal_Int32 nCnt ) const = 0; |
208 | | |
209 | | // to set a different attribute pool. May only be done prior to CallParser! |
210 | | // The maps are not generated anew! |
211 | 27.6k | void SetAttrPool( SfxItemPool* pNewPool ) { pAttrPool = pNewPool; } |
212 | | // to set different WhichIds for a different pool. |
213 | | template<class T> |
214 | 83.0k | void SetPardMap(TypedWhichId<T> wid, TypedWhichId<T> widTrue) { aPardMap.set(wid, widTrue); }void SvxRTFParser::SetPardMap<SvxBrushItem>(TypedWhichId<SvxBrushItem>, TypedWhichId<SvxBrushItem>) Line | Count | Source | 214 | 27.6k | void SetPardMap(TypedWhichId<T> wid, TypedWhichId<T> widTrue) { aPardMap.set(wid, widTrue); } |
void SvxRTFParser::SetPardMap<SvxBoxItem>(TypedWhichId<SvxBoxItem>, TypedWhichId<SvxBoxItem>) Line | Count | Source | 214 | 27.6k | void SetPardMap(TypedWhichId<T> wid, TypedWhichId<T> widTrue) { aPardMap.set(wid, widTrue); } |
void SvxRTFParser::SetPardMap<SvxShadowItem>(TypedWhichId<SvxShadowItem>, TypedWhichId<SvxShadowItem>) Line | Count | Source | 214 | 27.6k | void SetPardMap(TypedWhichId<T> wid, TypedWhichId<T> widTrue) { aPardMap.set(wid, widTrue); } |
|
215 | | // to be able to assign them from the outside as for example table cells |
216 | | void ReadBorderAttr( int nToken, SfxItemSet& rSet, bool bTableDef=false ); |
217 | | void ReadBackgroundAttr( int nToken, SfxItemSet& rSet, bool bTableDef=false ); |
218 | | |
219 | | // for asynchronous read from the SvStream |
220 | | virtual void Continue( int nToken ) override; |
221 | | |
222 | | // get RTF default ItemSets. Must be used by pard/plain tokens or in |
223 | | // reset of Style-Items |
224 | | const SfxItemSet& GetRTFDefaults(); |
225 | | }; |
226 | | |
227 | | // The stack for the attributes: |
228 | | // this class may only be used by SvxRTFParser! |
229 | | class SvxRTFItemStackType |
230 | | { |
231 | | friend class SvxRTFParser; |
232 | | |
233 | | SfxItemSet aAttrSet; |
234 | | std::optional<EditNodeIdx> mxStartNodeIdx; |
235 | | std::optional<EditNodeIdx> mxEndNodeIdx; |
236 | | sal_Int32 nSttCnt, nEndCnt; |
237 | | SvxRTFItemStackList maChildList; |
238 | | sal_uInt16 nStyleNo; |
239 | | |
240 | | SvxRTFItemStackType(SvxRTFItemStackType const&) = delete; |
241 | | void operator=(SvxRTFItemStackType const&) = delete; |
242 | | |
243 | | SvxRTFItemStackType( SfxItemPool&, const WhichRangesContainer& pWhichRange, |
244 | | const EditPosition& ); |
245 | | |
246 | | static std::unique_ptr<SvxRTFItemStackType> createSvxRTFItemStackType( |
247 | | SfxItemPool&, const WhichRangesContainer& pWhichRange, const EditPosition&); |
248 | | |
249 | | void Add(std::unique_ptr<SvxRTFItemStackType>); |
250 | | void Compress( const SvxRTFParser& ); |
251 | | void DropChildList(); |
252 | | |
253 | | public: |
254 | | SvxRTFItemStackType(const SvxRTFItemStackType&, const EditPosition&, |
255 | | bool bCopyAttr); |
256 | | ~SvxRTFItemStackType(); |
257 | | //cmc, I'm very suspicious about SetStartPos, it doesn't change |
258 | | //its children's starting position, and the implementation looks |
259 | | //bad, consider this deprecated. |
260 | | void SetStartPos( const EditPosition& rPos ); |
261 | | |
262 | 199k | const EditNodeIdx& GetSttNode() const { return *mxStartNodeIdx; } |
263 | 199k | const EditNodeIdx& GetEndNode() const { return *mxEndNodeIdx; } |
264 | | |
265 | 199k | sal_Int32 GetSttCnt() const { return nSttCnt; } |
266 | 199k | sal_Int32 GetEndCnt() const { return nEndCnt; } |
267 | | |
268 | 1.57M | SfxItemSet& GetAttrSet() { return aAttrSet; } |
269 | 0 | const SfxItemSet& GetAttrSet() const { return aAttrSet; } |
270 | | |
271 | 199k | sal_uInt16 StyleNo() const { return nStyleNo; } |
272 | | |
273 | | void SetRTFDefaults( const SfxItemSet& rDefaults ); |
274 | | }; |
275 | | |
276 | | |
277 | | // ----------- Inline Implementations -------------- |
278 | | |
279 | | inline const Color& SvxRTFParser::GetColor( size_t nId ) const |
280 | 20.4k | { |
281 | 20.4k | if( nId < maColorTable.size() ) |
282 | 5.78k | return maColorTable[ nId ]; |
283 | 14.6k | return *mxDefaultColor; |
284 | 20.4k | } |
285 | | |
286 | | inline SfxItemSet& SvxRTFParser::GetAttrSet() |
287 | 254k | { |
288 | 254k | SvxRTFItemStackType* pTmp; |
289 | 254k | if( bNewGroup || aAttrStack.empty() ) |
290 | 52.5k | pTmp = GetAttrSet_(); |
291 | 201k | else |
292 | 201k | { |
293 | 201k | pTmp = aAttrStack.back().get(); |
294 | 201k | if ( pTmp == nullptr ) |
295 | 0 | pTmp = GetAttrSet_(); |
296 | 201k | } |
297 | 254k | return pTmp->aAttrSet; |
298 | 254k | } |
299 | | |
300 | | |
301 | | #endif // INCLUDED_EDITENG_SVXRTF_HXX |
302 | | |
303 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |