| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef _FPDF_VT_H_ | 7 #ifndef _FPDF_VT_H_ |
| 8 #define _FPDF_VT_H_ | 8 #define _FPDF_VT_H_ |
| 9 #include "../fxcrt/fx_basic.h" | 9 #include "../fxcrt/fx_basic.h" |
| 10 #include "../fpdfapi/fpdf_parser.h" | 10 #include "../fpdfapi/fpdf_parser.h" |
| 11 struct CPVT_WordPlace; | 11 struct CPVT_WordPlace; |
| 12 struct CPVT_WordRange; | 12 struct CPVT_WordRange; |
| 13 struct CPVT_Word; | 13 struct CPVT_Word; |
| 14 struct CPVT_Line; | 14 struct CPVT_Line; |
| 15 struct CPVT_Section; | 15 struct CPVT_Section; |
| 16 class IPDF_VariableText_Provider; | 16 class IPDF_VariableText_Provider; |
| 17 class IPDF_VariableText_Iterator; | 17 class IPDF_VariableText_Iterator; |
| 18 class IPDF_VariableText; | 18 class IPDF_VariableText; |
| 19 struct CPVT_WordPlace { | 19 struct CPVT_WordPlace { |
| 20 | 20 CPVT_WordPlace() : nSecIndex(-1), nLineIndex(-1), nWordIndex(-1) {} |
| 21 CPVT_WordPlace() : nSecIndex(-1), nLineIndex(-1), nWordIndex(-1) | 21 |
| 22 { | 22 CPVT_WordPlace(FX_INT32 nSecIndex, FX_INT32 nLineIndex, FX_INT32 nWordIndex) { |
| 23 } | 23 this->nSecIndex = nSecIndex; |
| 24 | 24 this->nLineIndex = nLineIndex; |
| 25 CPVT_WordPlace(FX_INT32 nSecIndex, FX_INT32 nLineIndex, FX_INT32 nWordIndex) | 25 this->nWordIndex = nWordIndex; |
| 26 { | 26 } |
| 27 this->nSecIndex = nSecIndex; | 27 |
| 28 this->nLineIndex = nLineIndex; | 28 void Default() { nSecIndex = nLineIndex = nWordIndex = -1; } |
| 29 this->nWordIndex = nWordIndex; | 29 |
| 30 } | 30 FX_BOOL operator==(const CPVT_WordPlace& wp) const { |
| 31 | 31 return wp.nSecIndex == this->nSecIndex && |
| 32 void Default() | 32 wp.nLineIndex == this->nLineIndex && |
| 33 { | 33 wp.nWordIndex == this->nWordIndex; |
| 34 nSecIndex = nLineIndex = nWordIndex = -1; | 34 } |
| 35 } | 35 |
| 36 | 36 FX_BOOL operator!=(const CPVT_WordPlace& wp) const { |
| 37 FX_BOOL operator == (const CPVT_WordPlace & wp) const | 37 return wp.nSecIndex != this->nSecIndex || |
| 38 { | 38 wp.nLineIndex != this->nLineIndex || |
| 39 return wp.nSecIndex == this->nSecIndex && wp.nLineIndex == this->nLineIn
dex && wp.nWordIndex == this->nWordIndex; | 39 wp.nWordIndex != this->nWordIndex; |
| 40 } | 40 } |
| 41 | 41 |
| 42 FX_BOOL operator != (const CPVT_WordPlace & wp) const | 42 inline FX_INT32 WordCmp(const CPVT_WordPlace& wp) const { |
| 43 { | 43 if (this->nSecIndex > wp.nSecIndex) { |
| 44 return wp.nSecIndex != this->nSecIndex || wp.nLineIndex != this->nLineIn
dex || wp.nWordIndex != this->nWordIndex; | 44 return 1; |
| 45 } | 45 } |
| 46 | 46 if (this->nSecIndex < wp.nSecIndex) { |
| 47 inline FX_INT32 WordCmp(const CPVT_WordPlace & wp) const | 47 return -1; |
| 48 { | 48 } |
| 49 if (this->nSecIndex > wp.nSecIndex) { | 49 if (this->nLineIndex > wp.nLineIndex) { |
| 50 return 1; | 50 return 1; |
| 51 } | 51 } |
| 52 if (this->nSecIndex < wp.nSecIndex) { | 52 if (this->nLineIndex < wp.nLineIndex) { |
| 53 return -1; | 53 return -1; |
| 54 } | 54 } |
| 55 if (this->nLineIndex > wp.nLineIndex) { | 55 if (this->nWordIndex > wp.nWordIndex) { |
| 56 return 1; | 56 return 1; |
| 57 } | 57 } |
| 58 if (this->nLineIndex < wp.nLineIndex) { | 58 if (this->nWordIndex < wp.nWordIndex) { |
| 59 return -1; | 59 return -1; |
| 60 } | 60 } |
| 61 if (this->nWordIndex > wp.nWordIndex) { | 61 return 0; |
| 62 return 1; | 62 } |
| 63 } | 63 |
| 64 if (this->nWordIndex < wp.nWordIndex) { | 64 inline FX_INT32 LineCmp(const CPVT_WordPlace& wp) const { |
| 65 return -1; | 65 if (this->nSecIndex > wp.nSecIndex) { |
| 66 } | 66 return 1; |
| 67 return 0; | 67 } |
| 68 } | 68 if (this->nSecIndex < wp.nSecIndex) { |
| 69 | 69 return -1; |
| 70 inline FX_INT32 LineCmp(const CPVT_WordPlace & wp) const | 70 } |
| 71 { | 71 if (this->nLineIndex > wp.nLineIndex) { |
| 72 if (this->nSecIndex > wp.nSecIndex) { | 72 return 1; |
| 73 return 1; | 73 } |
| 74 } | 74 if (this->nLineIndex < wp.nLineIndex) { |
| 75 if (this->nSecIndex < wp.nSecIndex) { | 75 return -1; |
| 76 return -1; | 76 } |
| 77 } | 77 return 0; |
| 78 if (this->nLineIndex > wp.nLineIndex) { | 78 } |
| 79 return 1; | 79 |
| 80 } | 80 inline FX_INT32 SecCmp(const CPVT_WordPlace& wp) const { |
| 81 if (this->nLineIndex < wp.nLineIndex) { | 81 if (this->nSecIndex > wp.nSecIndex) { |
| 82 return -1; | 82 return 1; |
| 83 } | 83 } |
| 84 return 0; | 84 if (this->nSecIndex < wp.nSecIndex) { |
| 85 } | 85 return -1; |
| 86 | 86 } |
| 87 inline FX_INT32 SecCmp(const CPVT_WordPlace & wp) const | 87 return 0; |
| 88 { | 88 } |
| 89 if (this->nSecIndex > wp.nSecIndex) { | 89 |
| 90 return 1; | 90 FX_INT32 nSecIndex; |
| 91 } | 91 |
| 92 if (this->nSecIndex < wp.nSecIndex) { | 92 FX_INT32 nLineIndex; |
| 93 return -1; | 93 |
| 94 } | 94 FX_INT32 nWordIndex; |
| 95 return 0; | |
| 96 } | |
| 97 | |
| 98 FX_INT32» » » » » » » nSecIndex; | |
| 99 | |
| 100 FX_INT32» » » » » » » nLineIndex; | |
| 101 | |
| 102 FX_INT32» » » » » » » nWordIndex; | |
| 103 }; | 95 }; |
| 104 struct CPVT_WordRange { | 96 struct CPVT_WordRange { |
| 105 | 97 CPVT_WordRange() {} |
| 106 CPVT_WordRange() | 98 |
| 107 { | 99 CPVT_WordRange(const CPVT_WordPlace& begin, const CPVT_WordPlace& end) { |
| 108 } | 100 Set(begin, end); |
| 109 | 101 } |
| 110 CPVT_WordRange(const CPVT_WordPlace & begin, const CPVT_WordPlace & end) | 102 |
| 111 { | 103 void Default() { |
| 112 Set(begin, end); | 104 BeginPos.Default(); |
| 113 } | 105 EndPos.Default(); |
| 114 | 106 } |
| 115 void Default() | 107 |
| 116 { | 108 void Set(const CPVT_WordPlace& begin, const CPVT_WordPlace& end) { |
| 117 BeginPos.Default(); | 109 this->BeginPos = begin; |
| 118 EndPos.Default(); | 110 this->EndPos = end; |
| 119 } | 111 SwapWordPlace(); |
| 120 | 112 } |
| 121 void Set(const CPVT_WordPlace & begin, const CPVT_WordPlace & end) | 113 |
| 122 { | 114 void SetBeginPos(const CPVT_WordPlace& begin) { |
| 123 this->BeginPos = begin; | 115 this->BeginPos = begin; |
| 124 this->EndPos = end; | 116 SwapWordPlace(); |
| 125 SwapWordPlace(); | 117 } |
| 126 } | 118 |
| 127 | 119 void SetEndPos(const CPVT_WordPlace& end) { |
| 128 void SetBeginPos(const CPVT_WordPlace & begin) | 120 this->EndPos = end; |
| 129 { | 121 SwapWordPlace(); |
| 130 this->BeginPos = begin; | 122 } |
| 131 SwapWordPlace(); | 123 |
| 132 } | 124 FX_BOOL IsExist() const { return this->BeginPos != this->EndPos; } |
| 133 | 125 |
| 134 void SetEndPos(const CPVT_WordPlace & end) | 126 FX_BOOL operator!=(const CPVT_WordRange& wr) const { |
| 135 { | 127 return wr.BeginPos != this->BeginPos || wr.EndPos != this->EndPos; |
| 136 this->EndPos = end; | 128 } |
| 137 SwapWordPlace(); | 129 |
| 138 } | 130 void SwapWordPlace() { |
| 139 | 131 if (BeginPos.WordCmp(EndPos) > 0) { |
| 140 FX_BOOL IsExist() const | 132 CPVT_WordPlace place = EndPos; |
| 141 { | 133 EndPos = BeginPos; |
| 142 return this->BeginPos != this->EndPos; | 134 BeginPos = place; |
| 143 } | 135 } |
| 144 | 136 } |
| 145 FX_BOOL operator != (const CPVT_WordRange & wr) const | 137 |
| 146 { | 138 CPVT_WordPlace BeginPos; |
| 147 return wr.BeginPos != this->BeginPos || wr.EndPos != this->EndPos; | 139 |
| 148 } | 140 CPVT_WordPlace EndPos; |
| 149 | |
| 150 void SwapWordPlace() | |
| 151 { | |
| 152 if (BeginPos.WordCmp(EndPos) > 0) { | |
| 153 CPVT_WordPlace place = EndPos; | |
| 154 EndPos = BeginPos; | |
| 155 BeginPos = place; | |
| 156 } | |
| 157 } | |
| 158 | |
| 159 CPVT_WordPlace BeginPos; | |
| 160 | |
| 161 CPVT_WordPlace EndPos; | |
| 162 }; | 141 }; |
| 163 struct CPVT_SecProps : public CFX_Object { | 142 struct CPVT_SecProps : public CFX_Object { |
| 164 | 143 CPVT_SecProps() : fLineLeading(0.0f), fLineIndent(0.0f), nAlignment(0) {} |
| 165 CPVT_SecProps() : fLineLeading(0.0f), fLineIndent(0.0f), nAlignment(0) | 144 |
| 166 { | 145 CPVT_SecProps(FX_FLOAT lineLeading, FX_FLOAT lineIndent, FX_INT32 alignment) |
| 167 } | 146 : fLineLeading(lineLeading), |
| 168 | 147 fLineIndent(lineIndent), |
| 169 CPVT_SecProps(FX_FLOAT lineLeading, FX_FLOAT lineIndent, FX_INT32 alignment)
: | 148 nAlignment(alignment) {} |
| 170 fLineLeading(lineLeading), fLineIndent(lineIndent), nAlignment(alignment
) | 149 |
| 171 { | 150 CPVT_SecProps(const CPVT_SecProps& other) |
| 172 } | 151 : fLineLeading(other.fLineLeading), |
| 173 | 152 fLineIndent(other.fLineIndent), |
| 174 CPVT_SecProps(const CPVT_SecProps & other) : | 153 nAlignment(other.nAlignment) {} |
| 175 fLineLeading(other.fLineLeading), fLineIndent(other.fLineIndent), nAlign
ment(other.nAlignment) | 154 |
| 176 { | 155 FX_FLOAT fLineLeading; |
| 177 } | 156 |
| 178 | 157 FX_FLOAT fLineIndent; |
| 179 FX_FLOAT» » » fLineLeading; | 158 |
| 180 | 159 FX_INT32 nAlignment; |
| 181 FX_FLOAT» » » fLineIndent; | |
| 182 | |
| 183 FX_INT32» » » nAlignment; | |
| 184 }; | 160 }; |
| 185 struct CPVT_WordProps : public CFX_Object { | 161 struct CPVT_WordProps : public CFX_Object { |
| 186 | 162 CPVT_WordProps() |
| 187 CPVT_WordProps() : nFontIndex(-1), fFontSize(0.0f), dwWordColor(0), nScriptT
ype(0), nWordStyle(0), | 163 : nFontIndex(-1), |
| 188 fCharSpace(0.0f), nHorzScale(0) | 164 fFontSize(0.0f), |
| 189 { | 165 dwWordColor(0), |
| 190 } | 166 nScriptType(0), |
| 191 | 167 nWordStyle(0), |
| 192 CPVT_WordProps(FX_INT32» fontIndex, FX_FLOAT fontSize, FX_COLORREF wordCo
lor = 0, FX_INT32 scriptType = 0, FX_INT32 wordStyle = 0, | 168 fCharSpace(0.0f), |
| 193 FX_FLOAT charSpace = 0, FX_INT32 horzScale = 100) : | 169 nHorzScale(0) {} |
| 194 nFontIndex(fontIndex), fFontSize(fontSize), dwWordColor(wordColor), nScr
iptType(scriptType), | 170 |
| 195 nWordStyle(wordStyle), fCharSpace(charSpace), nHorzScale(horzScale) | 171 CPVT_WordProps(FX_INT32 fontIndex, |
| 196 { | 172 FX_FLOAT fontSize, |
| 197 } | 173 FX_COLORREF wordColor = 0, |
| 198 | 174 FX_INT32 scriptType = 0, |
| 199 CPVT_WordProps(const CPVT_WordProps & other) : | 175 FX_INT32 wordStyle = 0, |
| 200 nFontIndex(other.nFontIndex), fFontSize(other.fFontSize), dwWordColor(ot
her.dwWordColor), | 176 FX_FLOAT charSpace = 0, |
| 201 nScriptType(other.nScriptType), nWordStyle(other.nWordStyle), fCharSpace
(other.fCharSpace), | 177 FX_INT32 horzScale = 100) |
| 202 nHorzScale(other.nHorzScale) | 178 : nFontIndex(fontIndex), |
| 203 { | 179 fFontSize(fontSize), |
| 204 } | 180 dwWordColor(wordColor), |
| 205 | 181 nScriptType(scriptType), |
| 206 FX_INT32» » » » » nFontIndex; | 182 nWordStyle(wordStyle), |
| 207 | 183 fCharSpace(charSpace), |
| 208 FX_FLOAT» » » » » fFontSize; | 184 nHorzScale(horzScale) {} |
| 209 | 185 |
| 210 FX_COLORREF»» » » » dwWordColor; | 186 CPVT_WordProps(const CPVT_WordProps& other) |
| 211 | 187 : nFontIndex(other.nFontIndex), |
| 212 FX_INT32» » » » » nScriptType; | 188 fFontSize(other.fFontSize), |
| 213 | 189 dwWordColor(other.dwWordColor), |
| 214 FX_INT32» » » » » nWordStyle; | 190 nScriptType(other.nScriptType), |
| 215 | 191 nWordStyle(other.nWordStyle), |
| 216 FX_FLOAT» » » » » fCharSpace; | 192 fCharSpace(other.fCharSpace), |
| 217 | 193 nHorzScale(other.nHorzScale) {} |
| 218 FX_INT32» » » » » nHorzScale; | 194 |
| 195 FX_INT32 nFontIndex; |
| 196 |
| 197 FX_FLOAT fFontSize; |
| 198 |
| 199 FX_COLORREF dwWordColor; |
| 200 |
| 201 FX_INT32 nScriptType; |
| 202 |
| 203 FX_INT32 nWordStyle; |
| 204 |
| 205 FX_FLOAT fCharSpace; |
| 206 |
| 207 FX_INT32 nHorzScale; |
| 219 }; | 208 }; |
| 220 struct CPVT_Word { | 209 struct CPVT_Word { |
| 221 | 210 CPVT_Word() |
| 222 CPVT_Word() : Word(0), nCharset(0), ptWord(0, 0), fAscent(0.0f), fDescent(0.
0f), fWidth(0.0f), | 211 : Word(0), |
| 223 fFontSize(0), WordProps() | 212 nCharset(0), |
| 224 { | 213 ptWord(0, 0), |
| 225 } | 214 fAscent(0.0f), |
| 226 | 215 fDescent(0.0f), |
| 227 FX_WORD» » » » » » Word; | 216 fWidth(0.0f), |
| 228 | 217 fFontSize(0), |
| 229 FX_INT32» » » » » nCharset; | 218 WordProps() {} |
| 230 | 219 |
| 231 CPVT_WordPlace» » » » WordPlace; | 220 FX_WORD Word; |
| 232 | 221 |
| 233 CPDF_Point» » » » » ptWord; | 222 FX_INT32 nCharset; |
| 234 | 223 |
| 235 FX_FLOAT» » » » » fAscent; | 224 CPVT_WordPlace WordPlace; |
| 236 | 225 |
| 237 FX_FLOAT» » » » » fDescent; | 226 CPDF_Point ptWord; |
| 238 | 227 |
| 239 FX_FLOAT» » » » » fWidth; | 228 FX_FLOAT fAscent; |
| 240 | 229 |
| 241 FX_INT32» » » » » nFontIndex; | 230 FX_FLOAT fDescent; |
| 242 | 231 |
| 243 FX_FLOAT» » » » » fFontSize; | 232 FX_FLOAT fWidth; |
| 244 | 233 |
| 245 CPVT_WordProps» » » » WordProps; | 234 FX_INT32 nFontIndex; |
| 235 |
| 236 FX_FLOAT fFontSize; |
| 237 |
| 238 CPVT_WordProps WordProps; |
| 246 }; | 239 }; |
| 247 struct CPVT_Line { | 240 struct CPVT_Line { |
| 248 | 241 CPVT_Line() |
| 249 CPVT_Line() : ptLine(0, 0), fLineWidth(0.0f), fLineAscent(0.0f), fLineDescen
t(0.0f) | 242 : ptLine(0, 0), fLineWidth(0.0f), fLineAscent(0.0f), fLineDescent(0.0f) {} |
| 250 { | 243 |
| 251 } | 244 CPVT_WordPlace lineplace; |
| 252 | 245 |
| 253 CPVT_WordPlace» » » » lineplace; | 246 CPVT_WordPlace lineEnd; |
| 254 | 247 |
| 255 CPVT_WordPlace» » » » lineEnd; | 248 CPDF_Point ptLine; |
| 256 | 249 |
| 257 CPDF_Point» » » » » ptLine; | 250 FX_FLOAT fLineWidth; |
| 258 | 251 |
| 259 FX_FLOAT» » » » » fLineWidth; | 252 FX_FLOAT fLineAscent; |
| 260 | 253 |
| 261 FX_FLOAT» » » » » fLineAscent; | 254 FX_FLOAT fLineDescent; |
| 262 | |
| 263 FX_FLOAT» » » » » fLineDescent; | |
| 264 }; | 255 }; |
| 265 struct CPVT_Section { | 256 struct CPVT_Section { |
| 266 | 257 CPVT_WordPlace secplace; |
| 267 CPVT_WordPlace secplace; | 258 |
| 268 | 259 CPDF_Rect rcSection; |
| 269 CPDF_Rect rcSection; | 260 |
| 270 | 261 CPVT_SecProps SecProps; |
| 271 CPVT_SecProps SecProps; | 262 |
| 272 | 263 CPVT_WordProps WordProps; |
| 273 CPVT_WordProps WordProps; | 264 }; |
| 274 }; | 265 class IPDF_VariableText_Provider { |
| 275 class IPDF_VariableText_Provider | 266 public: |
| 276 { | 267 virtual FX_INT32 GetCharWidth(FX_INT32 nFontIndex, |
| 277 public: | 268 FX_WORD word, |
| 278 | 269 FX_INT32 nWordStyle) = 0; |
| 279 virtual FX_INT32 GetCharWidth(FX_
INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle) = 0; | 270 |
| 280 | 271 virtual FX_INT32 GetTypeAscent(FX_INT32 nFontIndex) = 0; |
| 281 virtual FX_INT32 GetTypeAscent(FX
_INT32 nFontIndex) = 0; | 272 |
| 282 | 273 virtual FX_INT32 GetTypeDescent(FX_INT32 nFontIndex) = 0; |
| 283 virtual FX_INT32 GetTypeDescent(F
X_INT32 nFontIndex) = 0; | 274 |
| 284 | 275 virtual FX_INT32 GetWordFontIndex(FX_WORD word, |
| 285 virtual FX_INT32 GetWordFontIndex
(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) = 0; | 276 FX_INT32 charset, |
| 286 | 277 FX_INT32 nFontIndex) = 0; |
| 287 virtual FX_BOOL IsLatinW
ord(FX_WORD word) = 0; | 278 |
| 288 | 279 virtual FX_BOOL IsLatinWord(FX_WORD word) = 0; |
| 289 virtual FX_INT32 GetDefaultFontIn
dex() = 0; | 280 |
| 290 }; | 281 virtual FX_INT32 GetDefaultFontIndex() = 0; |
| 291 class IPDF_VariableText_Iterator | 282 }; |
| 292 { | 283 class IPDF_VariableText_Iterator { |
| 293 public: | 284 public: |
| 294 | 285 virtual FX_BOOL NextWord() = 0; |
| 295 virtual FX_BOOL NextWord
() = 0; | 286 |
| 296 | 287 virtual FX_BOOL PrevWord() = 0; |
| 297 virtual FX_BOOL PrevWord
() = 0; | 288 |
| 298 | 289 virtual FX_BOOL NextLine() = 0; |
| 299 virtual FX_BOOL NextLine
() = 0; | 290 |
| 300 | 291 virtual FX_BOOL PrevLine() = 0; |
| 301 virtual FX_BOOL PrevLine
() = 0; | 292 |
| 302 | 293 virtual FX_BOOL NextSection() = 0; |
| 303 virtual FX_BOOL NextSect
ion() = 0; | 294 |
| 304 | 295 virtual FX_BOOL PrevSection() = 0; |
| 305 virtual FX_BOOL PrevSect
ion() = 0; | 296 |
| 306 | 297 virtual FX_BOOL GetWord(CPVT_Word& word) const = 0; |
| 307 virtual FX_BOOL GetWord(
CPVT_Word & word) const = 0; | 298 |
| 308 | 299 virtual FX_BOOL SetWord(const CPVT_Word& word) = 0; |
| 309 virtual FX_BOOL SetWord(
const CPVT_Word & word) = 0; | 300 |
| 310 | 301 virtual FX_BOOL GetLine(CPVT_Line& line) const = 0; |
| 311 virtual FX_BOOL GetLine(
CPVT_Line & line) const = 0; | 302 |
| 312 | 303 virtual FX_BOOL GetSection(CPVT_Section& section) const = 0; |
| 313 virtual FX_BOOL GetSecti
on(CPVT_Section & section) const = 0; | 304 |
| 314 | 305 virtual FX_BOOL SetSection(const CPVT_Section& section) = 0; |
| 315 virtual FX_BOOL SetSecti
on(const CPVT_Section & section) = 0; | 306 |
| 316 | 307 virtual void SetAt(FX_INT32 nWordIndex) = 0; |
| 317 virtual void SetAt(FX
_INT32 nWordIndex) = 0; | 308 |
| 318 | 309 virtual void SetAt(const CPVT_WordPlace& place) = 0; |
| 319 virtual void SetAt(co
nst CPVT_WordPlace & place) = 0; | 310 |
| 320 | 311 virtual const CPVT_WordPlace& GetAt() const = 0; |
| 321 virtual const CPVT_WordPlace & GetAt() const = 0; | 312 }; |
| 322 }; | 313 class IPDF_VariableText { |
| 323 class IPDF_VariableText | 314 public: |
| 324 { | 315 static IPDF_VariableText* NewVariableText(); |
| 325 public: | 316 |
| 326 | 317 static void DelVariableText(IPDF_VariableText* pVT); |
| 327 static IPDF_VariableText* NewVariableText(); | 318 |
| 328 | 319 public: |
| 329 static void DelVariableText(
IPDF_VariableText* pVT); | 320 virtual IPDF_VariableText_Provider* SetProvider( |
| 330 public: | 321 IPDF_VariableText_Provider* pProvider) = 0; |
| 331 | 322 |
| 332 virtual IPDF_VariableText_Provider* SetProvider(IPDF_VariableText_Pr
ovider * pProvider) = 0; | 323 virtual IPDF_VariableText_Iterator* GetIterator() = 0; |
| 333 | 324 |
| 334 virtual IPDF_VariableText_Iterator* GetIterator() = 0; | 325 virtual void SetPlateRect(const CPDF_Rect& rect) = 0; |
| 335 | 326 |
| 336 virtual void SetPlate
Rect(const CPDF_Rect & rect) = 0; | 327 virtual void SetAlignment(FX_INT32 nFormat = 0) = 0; |
| 337 | 328 |
| 338 virtual void SetAlign
ment(FX_INT32 nFormat = 0) = 0; | 329 virtual void SetPasswordChar(FX_WORD wSubWord = '*') = 0; |
| 339 | 330 |
| 340 virtual void SetPassw
ordChar(FX_WORD wSubWord = '*') = 0; | 331 virtual void SetLimitChar(FX_INT32 nLimitChar = 0) = 0; |
| 341 | 332 |
| 342 virtual void SetLimit
Char(FX_INT32 nLimitChar = 0) = 0; | 333 virtual void SetCharArray(FX_INT32 nCharArray = 0) = 0; |
| 343 | 334 |
| 344 virtual void SetCharA
rray(FX_INT32 nCharArray = 0) = 0; | 335 virtual void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) = 0; |
| 345 | 336 |
| 346 virtual void SetCharS
pace(FX_FLOAT fCharSpace = 0.0f) = 0; | 337 virtual void SetHorzScale(FX_INT32 nHorzScale = 100) = 0; |
| 347 | 338 |
| 348 virtual void SetHorzS
cale(FX_INT32 nHorzScale = 100) = 0; | 339 virtual void SetMultiLine(FX_BOOL bMultiLine = TRUE) = 0; |
| 349 | 340 |
| 350 virtual void SetMulti
Line(FX_BOOL bMultiLine = TRUE) = 0; | 341 virtual void SetAutoReturn(FX_BOOL bAuto = TRUE) = 0; |
| 351 | 342 |
| 352 virtual void SetAutoR
eturn(FX_BOOL bAuto = TRUE) = 0; | 343 virtual void SetAutoFontSize(FX_BOOL bAuto = TRUE) = 0; |
| 353 | 344 |
| 354 virtual void SetAutoF
ontSize(FX_BOOL bAuto = TRUE) = 0; | 345 virtual void SetFontSize(FX_FLOAT fFontSize) = 0; |
| 355 | 346 |
| 356 virtual void SetFontS
ize(FX_FLOAT fFontSize) = 0; | 347 virtual void SetLineLeading(FX_FLOAT fLineLeading) = 0; |
| 357 | 348 |
| 358 virtual void SetLineL
eading(FX_FLOAT fLineLeading) = 0; | 349 virtual void SetRichText(FX_BOOL bRichText) = 0; |
| 359 | 350 |
| 360 virtual void SetRichT
ext(FX_BOOL bRichText) = 0; | 351 virtual void Initialize() = 0; |
| 361 | 352 |
| 362 virtual void Initiali
ze() = 0; | 353 virtual FX_BOOL IsValid() const = 0; |
| 363 | 354 |
| 364 virtual FX_BOOL IsValid(
) const = 0; | 355 virtual FX_BOOL IsRichText() const = 0; |
| 365 | 356 |
| 366 virtual FX_BOOL IsRichTe
xt() const = 0; | 357 virtual void RearrangeAll() = 0; |
| 367 | 358 |
| 368 virtual void Rearrang
eAll() = 0; | 359 virtual void RearrangePart(const CPVT_WordRange& PlaceRange) = 0; |
| 369 | 360 |
| 370 virtual void Rearrang
ePart(const CPVT_WordRange & PlaceRange) = 0; | 361 virtual void ResetAll() = 0; |
| 371 | 362 |
| 372 virtual void ResetAll
() = 0; | 363 virtual void SetText(FX_LPCWSTR text, |
| 373 | 364 FX_INT32 charset = 1, |
| 374 virtual void SetText(
FX_LPCWSTR text, FX_INT32 charset = 1, const CPVT_SecProps * pSecProps = NULL, | 365 const CPVT_SecProps* pSecProps = NULL, |
| 375 const CPVT_WordProps * pWordProps = NULL) = 0; | 366 const CPVT_WordProps* pWordProps = NULL) = 0; |
| 376 | 367 |
| 377 virtual CPVT_WordPlace InsertWord(const
CPVT_WordPlace & place, FX_WORD word, FX_INT32 charset = 1, | 368 virtual CPVT_WordPlace InsertWord( |
| 378 const CPVT_WordProps * pWordProps = NULL) = 0; | 369 const CPVT_WordPlace& place, |
| 379 | 370 FX_WORD word, |
| 380 virtual CPVT_WordPlace InsertSection(co
nst CPVT_WordPlace & place, const CPVT_SecProps * pSecProps = NULL, | 371 FX_INT32 charset = 1, |
| 381 const CPVT_WordProps * pWordProps = NULL) = 0; | 372 const CPVT_WordProps* pWordProps = NULL) = 0; |
| 382 | 373 |
| 383 virtual CPVT_WordPlace InsertText(const
CPVT_WordPlace & place, FX_LPCWSTR text, FX_INT32 charset = 1, | 374 virtual CPVT_WordPlace InsertSection( |
| 384 const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * p
WordProps = NULL) = 0; | 375 const CPVT_WordPlace& place, |
| 385 | 376 const CPVT_SecProps* pSecProps = NULL, |
| 386 virtual CPVT_WordPlace DeleteWords(cons
t CPVT_WordRange & PlaceRange) = 0; | 377 const CPVT_WordProps* pWordProps = NULL) = 0; |
| 387 | 378 |
| 388 virtual CPVT_WordPlace DeleteWord(const
CPVT_WordPlace & place) = 0; | 379 virtual CPVT_WordPlace InsertText( |
| 389 | 380 const CPVT_WordPlace& place, |
| 390 virtual CPVT_WordPlace BackSpaceWord(co
nst CPVT_WordPlace & place) = 0; | 381 FX_LPCWSTR text, |
| 391 | 382 FX_INT32 charset = 1, |
| 392 virtual const CPDF_Rect & GetPlateRect() const = 0
; | 383 const CPVT_SecProps* pSecProps = NULL, |
| 393 | 384 const CPVT_WordProps* pWordProps = NULL) = 0; |
| 394 virtual CPDF_Rect GetContentRect()
const = 0; | 385 |
| 395 | 386 virtual CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange) = 0; |
| 396 virtual FX_INT32 GetTotalWords()
const = 0; | 387 |
| 397 | 388 virtual CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place) = 0; |
| 398 virtual FX_FLOAT GetFontSize() co
nst = 0; | 389 |
| 399 | 390 virtual CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place) = 0; |
| 400 virtual FX_INT32 GetAlignment() c
onst = 0; | 391 |
| 401 | 392 virtual const CPDF_Rect& GetPlateRect() const = 0; |
| 402 virtual FX_WORD GetPassw
ordChar() const = 0; | 393 |
| 403 | 394 virtual CPDF_Rect GetContentRect() const = 0; |
| 404 virtual FX_INT32 GetCharArray() c
onst = 0; | 395 |
| 405 | 396 virtual FX_INT32 GetTotalWords() const = 0; |
| 406 virtual FX_INT32 GetLimitChar() c
onst = 0; | 397 |
| 407 | 398 virtual FX_FLOAT GetFontSize() const = 0; |
| 408 virtual FX_BOOL IsMultiL
ine() const = 0; | 399 |
| 409 | 400 virtual FX_INT32 GetAlignment() const = 0; |
| 410 virtual FX_INT32 GetHorzScale() c
onst = 0; | 401 |
| 411 | 402 virtual FX_WORD GetPasswordChar() const = 0; |
| 412 virtual FX_FLOAT GetCharSpace() c
onst = 0; | 403 |
| 413 | 404 virtual FX_INT32 GetCharArray() const = 0; |
| 414 virtual CPVT_WordPlace GetBeginWordPlac
e() const = 0; | 405 |
| 415 | 406 virtual FX_INT32 GetLimitChar() const = 0; |
| 416 virtual CPVT_WordPlace GetEndWordPlace(
) const = 0; | 407 |
| 417 | 408 virtual FX_BOOL IsMultiLine() const = 0; |
| 418 virtual CPVT_WordPlace GetPrevWordPlace
(const CPVT_WordPlace & place) const = 0; | 409 |
| 419 | 410 virtual FX_INT32 GetHorzScale() const = 0; |
| 420 virtual CPVT_WordPlace GetNextWordPlace
(const CPVT_WordPlace & place) const = 0; | 411 |
| 421 | 412 virtual FX_FLOAT GetCharSpace() const = 0; |
| 422 virtual CPVT_WordPlace SearchWordPlace(
const CPDF_Point & point) const = 0; | 413 |
| 423 | 414 virtual CPVT_WordPlace GetBeginWordPlace() const = 0; |
| 424 virtual CPVT_WordPlace GetUpWordPlace(c
onst CPVT_WordPlace & place, const CPDF_Point & point) const = 0; | 415 |
| 425 | 416 virtual CPVT_WordPlace GetEndWordPlace() const = 0; |
| 426 virtual CPVT_WordPlace GetDownWordPlace
(const CPVT_WordPlace & place, const CPDF_Point & point) const = 0; | 417 |
| 427 | 418 virtual CPVT_WordPlace GetPrevWordPlace( |
| 428 virtual CPVT_WordPlace GetLineBeginPlac
e(const CPVT_WordPlace & place) const = 0; | 419 const CPVT_WordPlace& place) const = 0; |
| 429 | 420 |
| 430 virtual CPVT_WordPlace GetLineEndPlace(
const CPVT_WordPlace & place) const = 0; | 421 virtual CPVT_WordPlace GetNextWordPlace( |
| 431 | 422 const CPVT_WordPlace& place) const = 0; |
| 432 virtual CPVT_WordPlace GetSectionBeginP
lace(const CPVT_WordPlace & place) const = 0; | 423 |
| 433 | 424 virtual CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const = 0; |
| 434 virtual CPVT_WordPlace GetSectionEndPla
ce(const CPVT_WordPlace & place) const = 0; | 425 |
| 435 | 426 virtual CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace& place, |
| 436 virtual void UpdateWo
rdPlace(CPVT_WordPlace & place) const = 0; | 427 const CPDF_Point& point) const = 0; |
| 437 | 428 |
| 438 virtual CPVT_WordPlace AjustLineHeader(
const CPVT_WordPlace & place, FX_BOOL bPrevOrNext) const = 0; | 429 virtual CPVT_WordPlace GetDownWordPlace(const CPVT_WordPlace& place, |
| 439 | 430 const CPDF_Point& point) const = 0; |
| 440 virtual FX_INT32 WordPlaceToWordI
ndex(const CPVT_WordPlace & place) const = 0; | 431 |
| 441 | 432 virtual CPVT_WordPlace GetLineBeginPlace( |
| 442 virtual CPVT_WordPlace WordIndexToWordP
lace(FX_INT32 index) const = 0; | 433 const CPVT_WordPlace& place) const = 0; |
| 434 |
| 435 virtual CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const = 0; |
| 436 |
| 437 virtual CPVT_WordPlace GetSectionBeginPlace( |
| 438 const CPVT_WordPlace& place) const = 0; |
| 439 |
| 440 virtual CPVT_WordPlace GetSectionEndPlace( |
| 441 const CPVT_WordPlace& place) const = 0; |
| 442 |
| 443 virtual void UpdateWordPlace(CPVT_WordPlace& place) const = 0; |
| 444 |
| 445 virtual CPVT_WordPlace AjustLineHeader(const CPVT_WordPlace& place, |
| 446 FX_BOOL bPrevOrNext) const = 0; |
| 447 |
| 448 virtual FX_INT32 WordPlaceToWordIndex(const CPVT_WordPlace& place) const = 0; |
| 449 |
| 450 virtual CPVT_WordPlace WordIndexToWordPlace(FX_INT32 index) const = 0; |
| 443 }; | 451 }; |
| 444 #endif | 452 #endif |
| OLD | NEW |