| 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 CORE_INCLUDE_FPDFDOC_FPDF_VT_H_ | 7 #ifndef CORE_INCLUDE_FPDFDOC_FPDF_VT_H_ |
| 8 #define CORE_INCLUDE_FPDFDOC_FPDF_VT_H_ | 8 #define CORE_INCLUDE_FPDFDOC_FPDF_VT_H_ |
| 9 | 9 |
| 10 #include "../fpdfapi/fpdf_parser.h" | 10 #include "../fpdfapi/fpdf_parser.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 nSecIndex = other_nSecIndex; | 32 nSecIndex = other_nSecIndex; |
| 33 nLineIndex = other_nLineIndex; | 33 nLineIndex = other_nLineIndex; |
| 34 nWordIndex = other_nWordIndex; | 34 nWordIndex = other_nWordIndex; |
| 35 } | 35 } |
| 36 | 36 |
| 37 void Default() | 37 void Default() |
| 38 { | 38 { |
| 39 nSecIndex = nLineIndex = nWordIndex = -1; | 39 nSecIndex = nLineIndex = nWordIndex = -1; |
| 40 } | 40 } |
| 41 | 41 |
| 42 FX_BOOL operator == (const CPVT_WordPlace & wp) const | 42 bool operator == (const CPVT_WordPlace & wp) const |
| 43 { | 43 { |
| 44 return wp.nSecIndex == nSecIndex && wp.nLineIndex == nLineIndex && wp.nW
ordIndex == nWordIndex; | 44 return wp.nSecIndex == nSecIndex && wp.nLineIndex == nLineIndex && wp.nW
ordIndex == nWordIndex; |
| 45 } | 45 } |
| 46 | 46 |
| 47 FX_BOOL operator != (const CPVT_WordPlace & wp) const | 47 bool operator != (const CPVT_WordPlace & wp) const |
| 48 { | 48 { |
| 49 return wp.nSecIndex != nSecIndex || wp.nLineIndex != nLineIndex || wp.nW
ordIndex != nWordIndex; | 49 return wp.nSecIndex != nSecIndex || wp.nLineIndex != nLineIndex || wp.nW
ordIndex != nWordIndex; |
| 50 } | 50 } |
| 51 | 51 |
| 52 inline int32_t WordCmp(const CPVT_WordPlace & wp) const | 52 inline int32_t WordCmp(const CPVT_WordPlace & wp) const |
| 53 { | 53 { |
| 54 if (nSecIndex > wp.nSecIndex) { | 54 if (nSecIndex > wp.nSecIndex) { |
| 55 return 1; | 55 return 1; |
| 56 } | 56 } |
| 57 if (nSecIndex < wp.nSecIndex) { | 57 if (nSecIndex < wp.nSecIndex) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 BeginPos = begin; | 135 BeginPos = begin; |
| 136 SwapWordPlace(); | 136 SwapWordPlace(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void SetEndPos(const CPVT_WordPlace & end) | 139 void SetEndPos(const CPVT_WordPlace & end) |
| 140 { | 140 { |
| 141 EndPos = end; | 141 EndPos = end; |
| 142 SwapWordPlace(); | 142 SwapWordPlace(); |
| 143 } | 143 } |
| 144 | 144 |
| 145 FX_BOOL IsExist() const | 145 bool IsExist() const |
| 146 { | 146 { |
| 147 return BeginPos != EndPos; | 147 return BeginPos != EndPos; |
| 148 } | 148 } |
| 149 | 149 |
| 150 FX_BOOL operator != (const CPVT_WordRange & wr) const | 150 bool operator != (const CPVT_WordRange & wr) const |
| 151 { | 151 { |
| 152 return wr.BeginPos != BeginPos || wr.EndPos != EndPos; | 152 return wr.BeginPos != BeginPos || wr.EndPos != EndPos; |
| 153 } | 153 } |
| 154 | 154 |
| 155 void SwapWordPlace() | 155 void SwapWordPlace() |
| 156 { | 156 { |
| 157 if (BeginPos.WordCmp(EndPos) > 0) { | 157 if (BeginPos.WordCmp(EndPos) > 0) { |
| 158 CPVT_WordPlace place = EndPos; | 158 CPVT_WordPlace place = EndPos; |
| 159 EndPos = BeginPos; | 159 EndPos = BeginPos; |
| 160 BeginPos = place; | 160 BeginPos = place; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 virtual ~IPDF_VariableText_Provider() { } | 283 virtual ~IPDF_VariableText_Provider() { } |
| 284 | 284 |
| 285 virtual int32_t GetCharWidth(int
32_t nFontIndex, FX_WORD word, int32_t nWordStyle) = 0; | 285 virtual int32_t GetCharWidth(int
32_t nFontIndex, FX_WORD word, int32_t nWordStyle) = 0; |
| 286 | 286 |
| 287 virtual int32_t GetTypeAscent(in
t32_t nFontIndex) = 0; | 287 virtual int32_t GetTypeAscent(in
t32_t nFontIndex) = 0; |
| 288 | 288 |
| 289 virtual int32_t GetTypeDescent(i
nt32_t nFontIndex) = 0; | 289 virtual int32_t GetTypeDescent(i
nt32_t nFontIndex) = 0; |
| 290 | 290 |
| 291 virtual int32_t GetWordFontIndex
(FX_WORD word, int32_t charset, int32_t nFontIndex) = 0; | 291 virtual int32_t GetWordFontIndex
(FX_WORD word, int32_t charset, int32_t nFontIndex) = 0; |
| 292 | 292 |
| 293 virtual FX_BOOL» » » » » » » IsLatinW
ord(FX_WORD word) = 0; | 293 virtual bool» » » » » » » IsLatinW
ord(FX_WORD word) = 0; |
| 294 | 294 |
| 295 virtual int32_t GetDefaultFontIn
dex() = 0; | 295 virtual int32_t GetDefaultFontIn
dex() = 0; |
| 296 }; | 296 }; |
| 297 class IPDF_VariableText_Iterator | 297 class IPDF_VariableText_Iterator |
| 298 { | 298 { |
| 299 public: | 299 public: |
| 300 virtual ~IPDF_VariableText_Iterator() { } | 300 virtual ~IPDF_VariableText_Iterator() { } |
| 301 | 301 |
| 302 virtual FX_BOOL» » » » » » » NextWord
() = 0; | 302 virtual bool» » » » » » » NextWord
() = 0; |
| 303 | 303 |
| 304 virtual FX_BOOL» » » » » » » PrevWord
() = 0; | 304 virtual bool» » » » » » » PrevWord
() = 0; |
| 305 | 305 |
| 306 virtual FX_BOOL» » » » » » » NextLine
() = 0; | 306 virtual bool» » » » » » » NextLine
() = 0; |
| 307 | 307 |
| 308 virtual FX_BOOL» » » » » » » PrevLine
() = 0; | 308 virtual bool» » » » » » » PrevLine
() = 0; |
| 309 | 309 |
| 310 virtual FX_BOOL» » » » » » » NextSect
ion() = 0; | 310 virtual bool» » » » » » » NextSect
ion() = 0; |
| 311 | 311 |
| 312 virtual FX_BOOL» » » » » » » PrevSect
ion() = 0; | 312 virtual bool» » » » » » » PrevSect
ion() = 0; |
| 313 | 313 |
| 314 virtual FX_BOOL» » » » » » » GetWord(
CPVT_Word & word) const = 0; | 314 virtual bool» » » » » » » GetWord(
CPVT_Word & word) const = 0; |
| 315 | 315 |
| 316 virtual FX_BOOL» » » » » » » SetWord(
const CPVT_Word & word) = 0; | 316 virtual bool» » » » » » » SetWord(
const CPVT_Word & word) = 0; |
| 317 | 317 |
| 318 virtual FX_BOOL» » » » » » » GetLine(
CPVT_Line & line) const = 0; | 318 virtual bool» » » » » » » GetLine(
CPVT_Line & line) const = 0; |
| 319 | 319 |
| 320 virtual FX_BOOL» » » » » » » GetSecti
on(CPVT_Section & section) const = 0; | 320 virtual bool» » » » » » » GetSecti
on(CPVT_Section & section) const = 0; |
| 321 | 321 |
| 322 virtual» FX_BOOL»» » » » » » SetSecti
on(const CPVT_Section & section) = 0; | 322 virtual» bool» » » » » » » SetSecti
on(const CPVT_Section & section) = 0; |
| 323 | 323 |
| 324 virtual void SetAt(in
t32_t nWordIndex) = 0; | 324 virtual void SetAt(in
t32_t nWordIndex) = 0; |
| 325 | 325 |
| 326 virtual void SetAt(co
nst CPVT_WordPlace & place) = 0; | 326 virtual void SetAt(co
nst CPVT_WordPlace & place) = 0; |
| 327 | 327 |
| 328 virtual const CPVT_WordPlace & GetAt() const = 0; | 328 virtual const CPVT_WordPlace & GetAt() const = 0; |
| 329 }; | 329 }; |
| 330 class IPDF_VariableText | 330 class IPDF_VariableText |
| 331 { | 331 { |
| 332 public: | 332 public: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 345 virtual void SetPassw
ordChar(FX_WORD wSubWord = '*') = 0; | 345 virtual void SetPassw
ordChar(FX_WORD wSubWord = '*') = 0; |
| 346 | 346 |
| 347 virtual void SetLimit
Char(int32_t nLimitChar = 0) = 0; | 347 virtual void SetLimit
Char(int32_t nLimitChar = 0) = 0; |
| 348 | 348 |
| 349 virtual void SetCharA
rray(int32_t nCharArray = 0) = 0; | 349 virtual void SetCharA
rray(int32_t nCharArray = 0) = 0; |
| 350 | 350 |
| 351 virtual void SetCharS
pace(FX_FLOAT fCharSpace = 0.0f) = 0; | 351 virtual void SetCharS
pace(FX_FLOAT fCharSpace = 0.0f) = 0; |
| 352 | 352 |
| 353 virtual void SetHorzS
cale(int32_t nHorzScale = 100) = 0; | 353 virtual void SetHorzS
cale(int32_t nHorzScale = 100) = 0; |
| 354 | 354 |
| 355 virtual void» » » » » » » SetMulti
Line(FX_BOOL bMultiLine = TRUE) = 0; | 355 virtual void» » » » » » » SetMulti
Line(bool bMultiLine = true) = 0; |
| 356 | 356 |
| 357 virtual void» » » » » » » SetAutoR
eturn(FX_BOOL bAuto = TRUE) = 0; | 357 virtual void» » » » » » » SetAutoR
eturn(bool bAuto = true) = 0; |
| 358 | 358 |
| 359 virtual void» » » » » » » SetAutoF
ontSize(FX_BOOL bAuto = TRUE) = 0; | 359 virtual void» » » » » » » SetAutoF
ontSize(bool bAuto = true) = 0; |
| 360 | 360 |
| 361 virtual void SetFontS
ize(FX_FLOAT fFontSize) = 0; | 361 virtual void SetFontS
ize(FX_FLOAT fFontSize) = 0; |
| 362 | 362 |
| 363 virtual void SetLineL
eading(FX_FLOAT fLineLeading) = 0; | 363 virtual void SetLineL
eading(FX_FLOAT fLineLeading) = 0; |
| 364 | 364 |
| 365 virtual void» » » » » » » SetRichT
ext(FX_BOOL bRichText) = 0; | 365 virtual void» » » » » » » SetRichT
ext(bool bRichText) = 0; |
| 366 | 366 |
| 367 virtual void Initiali
ze() = 0; | 367 virtual void Initiali
ze() = 0; |
| 368 | 368 |
| 369 virtual FX_BOOL» » » » » » » IsValid(
) const = 0; | 369 virtual bool» » » » » » » IsValid(
) const = 0; |
| 370 | 370 |
| 371 virtual FX_BOOL» » » » » » » IsRichTe
xt() const = 0; | 371 virtual bool» » » » » » » IsRichTe
xt() const = 0; |
| 372 | 372 |
| 373 virtual void Rearrang
eAll() = 0; | 373 virtual void Rearrang
eAll() = 0; |
| 374 | 374 |
| 375 virtual void Rearrang
ePart(const CPVT_WordRange & PlaceRange) = 0; | 375 virtual void Rearrang
ePart(const CPVT_WordRange & PlaceRange) = 0; |
| 376 | 376 |
| 377 virtual void ResetAll
() = 0; | 377 virtual void ResetAll
() = 0; |
| 378 | 378 |
| 379 virtual void SetText(
const FX_WCHAR* text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NUL
L, | 379 virtual void SetText(
const FX_WCHAR* text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NUL
L, |
| 380 const CPVT_WordProps * pWordProps = NULL) = 0; | 380 const CPVT_WordProps * pWordProps = NULL) = 0; |
| 381 | 381 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 403 virtual FX_FLOAT GetFontSize() co
nst = 0; | 403 virtual FX_FLOAT GetFontSize() co
nst = 0; |
| 404 | 404 |
| 405 virtual int32_t GetAlignment() c
onst = 0; | 405 virtual int32_t GetAlignment() c
onst = 0; |
| 406 | 406 |
| 407 virtual FX_WORD GetPassw
ordChar() const = 0; | 407 virtual FX_WORD GetPassw
ordChar() const = 0; |
| 408 | 408 |
| 409 virtual int32_t GetCharArray() c
onst = 0; | 409 virtual int32_t GetCharArray() c
onst = 0; |
| 410 | 410 |
| 411 virtual int32_t GetLimitChar() c
onst = 0; | 411 virtual int32_t GetLimitChar() c
onst = 0; |
| 412 | 412 |
| 413 virtual FX_BOOL» » » » » » » IsMultiL
ine() const = 0; | 413 virtual bool» » » » » » » IsMultiL
ine() const = 0; |
| 414 | 414 |
| 415 virtual int32_t GetHorzScale() c
onst = 0; | 415 virtual int32_t GetHorzScale() c
onst = 0; |
| 416 | 416 |
| 417 virtual FX_FLOAT GetCharSpace() c
onst = 0; | 417 virtual FX_FLOAT GetCharSpace() c
onst = 0; |
| 418 | 418 |
| 419 virtual CPVT_WordPlace GetBeginWordPlac
e() const = 0; | 419 virtual CPVT_WordPlace GetBeginWordPlac
e() const = 0; |
| 420 | 420 |
| 421 virtual CPVT_WordPlace GetEndWordPlace(
) const = 0; | 421 virtual CPVT_WordPlace GetEndWordPlace(
) const = 0; |
| 422 | 422 |
| 423 virtual CPVT_WordPlace GetPrevWordPlace
(const CPVT_WordPlace & place) const = 0; | 423 virtual CPVT_WordPlace GetPrevWordPlace
(const CPVT_WordPlace & place) const = 0; |
| 424 | 424 |
| 425 virtual CPVT_WordPlace GetNextWordPlace
(const CPVT_WordPlace & place) const = 0; | 425 virtual CPVT_WordPlace GetNextWordPlace
(const CPVT_WordPlace & place) const = 0; |
| 426 | 426 |
| 427 virtual CPVT_WordPlace SearchWordPlace(
const CPDF_Point & point) const = 0; | 427 virtual CPVT_WordPlace SearchWordPlace(
const CPDF_Point & point) const = 0; |
| 428 | 428 |
| 429 virtual CPVT_WordPlace GetUpWordPlace(c
onst CPVT_WordPlace & place, const CPDF_Point & point) const = 0; | 429 virtual CPVT_WordPlace GetUpWordPlace(c
onst CPVT_WordPlace & place, const CPDF_Point & point) const = 0; |
| 430 | 430 |
| 431 virtual CPVT_WordPlace GetDownWordPlace
(const CPVT_WordPlace & place, const CPDF_Point & point) const = 0; | 431 virtual CPVT_WordPlace GetDownWordPlace
(const CPVT_WordPlace & place, const CPDF_Point & point) const = 0; |
| 432 | 432 |
| 433 virtual CPVT_WordPlace GetLineBeginPlac
e(const CPVT_WordPlace & place) const = 0; | 433 virtual CPVT_WordPlace GetLineBeginPlac
e(const CPVT_WordPlace & place) const = 0; |
| 434 | 434 |
| 435 virtual CPVT_WordPlace GetLineEndPlace(
const CPVT_WordPlace & place) const = 0; | 435 virtual CPVT_WordPlace GetLineEndPlace(
const CPVT_WordPlace & place) const = 0; |
| 436 | 436 |
| 437 virtual CPVT_WordPlace GetSectionBeginP
lace(const CPVT_WordPlace & place) const = 0; | 437 virtual CPVT_WordPlace GetSectionBeginP
lace(const CPVT_WordPlace & place) const = 0; |
| 438 | 438 |
| 439 virtual CPVT_WordPlace GetSectionEndPla
ce(const CPVT_WordPlace & place) const = 0; | 439 virtual CPVT_WordPlace GetSectionEndPla
ce(const CPVT_WordPlace & place) const = 0; |
| 440 | 440 |
| 441 virtual void UpdateWo
rdPlace(CPVT_WordPlace & place) const = 0; | 441 virtual void UpdateWo
rdPlace(CPVT_WordPlace & place) const = 0; |
| 442 | 442 |
| 443 virtual CPVT_WordPlace» » » » » AjustLineHeader(
const CPVT_WordPlace & place, FX_BOOL bPrevOrNext) const = 0; | 443 virtual CPVT_WordPlace» » » » » AjustLineHeader(
const CPVT_WordPlace & place, bool bPrevOrNext) const = 0; |
| 444 | 444 |
| 445 virtual int32_t WordPlaceToWordI
ndex(const CPVT_WordPlace & place) const = 0; | 445 virtual int32_t WordPlaceToWordI
ndex(const CPVT_WordPlace & place) const = 0; |
| 446 | 446 |
| 447 virtual CPVT_WordPlace WordIndexToWordP
lace(int32_t index) const = 0; | 447 virtual CPVT_WordPlace WordIndexToWordP
lace(int32_t index) const = 0; |
| 448 | 448 |
| 449 protected: | 449 protected: |
| 450 ~IPDF_VariableText() { } | 450 ~IPDF_VariableText() { } |
| 451 }; | 451 }; |
| 452 | 452 |
| 453 #endif // CORE_INCLUDE_FPDFDOC_FPDF_VT_H_ | 453 #endif // CORE_INCLUDE_FPDFDOC_FPDF_VT_H_ |
| OLD | NEW |