Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(985)

Side by Side Diff: core/src/fpdfdoc/pdf_vt.h

Issue 1292613003: Use override in more classes in core/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nit Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fpdfdoc/doc_vt.cpp ('k') | core/src/fpdfdoc/tagged_int.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_SRC_FPDFDOC_PDF_VT_H_ 7 #ifndef CORE_SRC_FPDFDOC_PDF_VT_H_
8 #define CORE_SRC_FPDFDOC_PDF_VT_H_ 8 #define CORE_SRC_FPDFDOC_PDF_VT_H_
9 9
10 class CPVT_Size; 10 class CPVT_Size;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 CPDF_Point ptLeftTop = OutToIn(CPDF_Point(rect.left, rect.top)); 336 CPDF_Point ptLeftTop = OutToIn(CPDF_Point(rect.left, rect.top));
337 CPDF_Point ptRightBottom = OutToIn(CPDF_Point(rect.right, rect.bottom)); 337 CPDF_Point ptRightBottom = OutToIn(CPDF_Point(rect.right, rect.bottom));
338 return CPVT_FloatRect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x, 338 return CPVT_FloatRect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x,
339 ptRightBottom.y); 339 ptRightBottom.y);
340 }; 340 };
341 341
342 private: 342 private:
343 CPDF_Rect m_rcPlate; 343 CPDF_Rect m_rcPlate;
344 CPVT_FloatRect m_rcContent; 344 CPVT_FloatRect m_rcContent;
345 }; 345 };
346
346 class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer { 347 class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer {
347 friend class CTypeset; 348 friend class CTypeset;
348 friend class CSection; 349 friend class CSection;
349 friend class CPDF_VariableText_Iterator; 350 friend class CPDF_VariableText_Iterator;
350 351
351 public: 352 public:
352 CPDF_VariableText(); 353 CPDF_VariableText();
353 virtual ~CPDF_VariableText(); 354 ~CPDF_VariableText() override;
355
356 // IPDF_VariableText
354 IPDF_VariableText_Provider* SetProvider( 357 IPDF_VariableText_Provider* SetProvider(
355 IPDF_VariableText_Provider* pProvider); 358 IPDF_VariableText_Provider* pProvider) override;
356 IPDF_VariableText_Iterator* GetIterator(); 359 IPDF_VariableText_Iterator* GetIterator() override;
357 void SetPlateRect(const CPDF_Rect& rect) { 360 void SetPlateRect(const CPDF_Rect& rect) override {
358 CPDF_EditContainer::SetPlateRect(rect); 361 CPDF_EditContainer::SetPlateRect(rect);
359 } 362 }
360 void SetAlignment(int32_t nFormat = 0) { m_nAlignment = nFormat; } 363 void SetAlignment(int32_t nFormat = 0) override { m_nAlignment = nFormat; }
361 void SetPasswordChar(FX_WORD wSubWord = '*') { m_wSubWord = wSubWord; } 364 void SetPasswordChar(FX_WORD wSubWord = '*') override {
362 void SetLimitChar(int32_t nLimitChar = 0) { m_nLimitChar = nLimitChar; } 365 m_wSubWord = wSubWord;
363 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) { m_fCharSpace = fCharSpace; } 366 }
364 void SetHorzScale(int32_t nHorzScale = 100) { m_nHorzScale = nHorzScale; } 367 void SetLimitChar(int32_t nLimitChar = 0) override {
365 void SetMultiLine(FX_BOOL bMultiLine = TRUE) { m_bMultiLine = bMultiLine; } 368 m_nLimitChar = nLimitChar;
366 void SetAutoReturn(FX_BOOL bAuto = TRUE) { m_bLimitWidth = bAuto; } 369 }
367 void SetFontSize(FX_FLOAT fFontSize) { m_fFontSize = fFontSize; } 370 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) override {
368 void SetCharArray(int32_t nCharArray = 0) { m_nCharArray = nCharArray; } 371 m_fCharSpace = fCharSpace;
369 void SetAutoFontSize(FX_BOOL bAuto = TRUE) { m_bAutoFontSize = bAuto; } 372 }
370 void SetRichText(FX_BOOL bRichText) { m_bRichText = bRichText; } 373 void SetHorzScale(int32_t nHorzScale = 100) override {
371 void SetLineLeading(FX_FLOAT fLineLeading) { m_fLineLeading = fLineLeading; } 374 m_nHorzScale = nHorzScale;
372 void Initialize(); 375 }
373 FX_BOOL IsValid() const { return m_bInitial; } 376 void SetMultiLine(FX_BOOL bMultiLine = TRUE) override {
374 FX_BOOL IsRichText() const { return m_bRichText; } 377 m_bMultiLine = bMultiLine;
375 void RearrangeAll(); 378 }
376 void RearrangePart(const CPVT_WordRange& PlaceRange); 379 void SetAutoReturn(FX_BOOL bAuto = TRUE) override { m_bLimitWidth = bAuto; }
377 void ResetAll(); 380 void SetFontSize(FX_FLOAT fFontSize) override { m_fFontSize = fFontSize; }
381 void SetCharArray(int32_t nCharArray = 0) override {
382 m_nCharArray = nCharArray;
383 }
384 void SetAutoFontSize(FX_BOOL bAuto = TRUE) override {
385 m_bAutoFontSize = bAuto;
386 }
387 void SetRichText(FX_BOOL bRichText) override { m_bRichText = bRichText; }
388 void SetLineLeading(FX_FLOAT fLineLeading) override {
389 m_fLineLeading = fLineLeading;
390 }
391 void Initialize() override;
392 FX_BOOL IsValid() const override { return m_bInitial; }
393 FX_BOOL IsRichText() const override { return m_bRichText; }
394 void RearrangeAll() override;
395 void RearrangePart(const CPVT_WordRange& PlaceRange) override;
396 void ResetAll() override;
378 void SetText(const FX_WCHAR* text, 397 void SetText(const FX_WCHAR* text,
379 int32_t charset = 1, 398 int32_t charset = 1,
380 const CPVT_SecProps* pSecProps = NULL, 399 const CPVT_SecProps* pSecProps = NULL,
381 const CPVT_WordProps* pWordProps = NULL); 400 const CPVT_WordProps* pWordProps = NULL) override;
382 CPVT_WordPlace InsertWord(const CPVT_WordPlace& place, 401 CPVT_WordPlace InsertWord(const CPVT_WordPlace& place,
383 FX_WORD word, 402 FX_WORD word,
384 int32_t charset = 1, 403 int32_t charset = 1,
385 const CPVT_WordProps* pWordProps = NULL); 404 const CPVT_WordProps* pWordProps = NULL) override;
386 CPVT_WordPlace InsertSection(const CPVT_WordPlace& place, 405 CPVT_WordPlace InsertSection(
387 const CPVT_SecProps* pSecProps = NULL, 406 const CPVT_WordPlace& place,
388 const CPVT_WordProps* pWordProps = NULL); 407 const CPVT_SecProps* pSecProps = NULL,
408 const CPVT_WordProps* pWordProps = NULL) override;
389 CPVT_WordPlace InsertText(const CPVT_WordPlace& place, 409 CPVT_WordPlace InsertText(const CPVT_WordPlace& place,
390 const FX_WCHAR* text, 410 const FX_WCHAR* text,
391 int32_t charset = 1, 411 int32_t charset = 1,
392 const CPVT_SecProps* pSecProps = NULL, 412 const CPVT_SecProps* pSecProps = NULL,
393 const CPVT_WordProps* pWordProps = NULL); 413 const CPVT_WordProps* pWordProps = NULL) override;
394 CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange); 414 CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange) override;
395 CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place); 415 CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place) override;
396 CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place); 416 CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place) override;
397 const CPDF_Rect& GetPlateRect() const { 417 const CPDF_Rect& GetPlateRect() const override {
398 return CPDF_EditContainer::GetPlateRect(); 418 return CPDF_EditContainer::GetPlateRect();
399 } 419 }
400 CPDF_Rect GetContentRect() const; 420 CPDF_Rect GetContentRect() const override;
401 int32_t GetTotalWords() const; 421 int32_t GetTotalWords() const override;
402 FX_FLOAT GetFontSize() const { return m_fFontSize; } 422 FX_FLOAT GetFontSize() const override { return m_fFontSize; }
403 int32_t GetAlignment() const { return m_nAlignment; } 423 int32_t GetAlignment() const override { return m_nAlignment; }
404 int32_t GetCharArray() const { return m_nCharArray; } 424 FX_WORD GetPasswordChar() const override { return GetSubWord(); }
405 int32_t GetLimitChar() const { return m_nLimitChar; } 425 int32_t GetCharArray() const override { return m_nCharArray; }
406 FX_BOOL IsMultiLine() const { return m_bMultiLine; } 426 int32_t GetLimitChar() const override { return m_nLimitChar; }
407 int32_t GetHorzScale() const { return m_nHorzScale; } 427 FX_BOOL IsMultiLine() const override { return m_bMultiLine; }
408 FX_FLOAT GetCharSpace() const { return m_fCharSpace; } 428 int32_t GetHorzScale() const override { return m_nHorzScale; }
429 FX_FLOAT GetCharSpace() const override { return m_fCharSpace; }
430 CPVT_WordPlace GetBeginWordPlace() const override;
431 CPVT_WordPlace GetEndWordPlace() const override;
432 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const override;
433 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const override;
434 CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const override;
435 CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace& place,
436 const CPDF_Point& point) const override;
437 CPVT_WordPlace GetDownWordPlace(const CPVT_WordPlace& place,
438 const CPDF_Point& point) const override;
439 CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const override;
440 CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const override;
441 CPVT_WordPlace GetSectionBeginPlace(
442 const CPVT_WordPlace& place) const override;
443 CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const override;
444 void UpdateWordPlace(CPVT_WordPlace& place) const override;
445 CPVT_WordPlace AdjustLineHeader(const CPVT_WordPlace& place,
446 FX_BOOL bPrevOrNext) const override;
447 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const override;
448 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const override;
409 449
410 CPVT_WordPlace GetBeginWordPlace() const;
411 CPVT_WordPlace GetEndWordPlace() const;
412 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const;
413 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const;
414 CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const;
415 CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace& place,
416 const CPDF_Point& point) const;
417 CPVT_WordPlace GetDownWordPlace(const CPVT_WordPlace& place,
418 const CPDF_Point& point) const;
419 CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const;
420 CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const;
421 CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace& place) const;
422 CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const;
423 void UpdateWordPlace(CPVT_WordPlace& place) const;
424 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const;
425 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const;
426 FX_WORD GetPasswordChar() const { return GetSubWord(); }
427 FX_WORD GetSubWord() const { return m_wSubWord; } 450 FX_WORD GetSubWord() const { return m_wSubWord; }
428 451
429 private: 452 private:
430 int32_t GetCharWidth(int32_t nFontIndex, 453 int32_t GetCharWidth(int32_t nFontIndex,
431 FX_WORD Word, 454 FX_WORD Word,
432 FX_WORD SubWord, 455 FX_WORD SubWord,
433 int32_t nWordStyle); 456 int32_t nWordStyle);
434 int32_t GetTypeAscent(int32_t nFontIndex); 457 int32_t GetTypeAscent(int32_t nFontIndex);
435 int32_t GetTypeDescent(int32_t nFontIndex); 458 int32_t GetTypeDescent(int32_t nFontIndex);
436 int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex); 459 int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex);
437 int32_t GetDefaultFontIndex(); 460 int32_t GetDefaultFontIndex();
438 FX_BOOL IsLatinWord(FX_WORD word); 461 FX_BOOL IsLatinWord(FX_WORD word);
439 462
440 private:
441 CPVT_WordPlace AddSection(const CPVT_WordPlace& place, 463 CPVT_WordPlace AddSection(const CPVT_WordPlace& place,
442 const CPVT_SectionInfo& secinfo); 464 const CPVT_SectionInfo& secinfo);
443 CPVT_WordPlace AddLine(const CPVT_WordPlace& place, 465 CPVT_WordPlace AddLine(const CPVT_WordPlace& place,
444 const CPVT_LineInfo& lineinfo); 466 const CPVT_LineInfo& lineinfo);
445 CPVT_WordPlace AddWord(const CPVT_WordPlace& place, 467 CPVT_WordPlace AddWord(const CPVT_WordPlace& place,
446 const CPVT_WordInfo& wordinfo); 468 const CPVT_WordInfo& wordinfo);
447 FX_BOOL GetWordInfo(const CPVT_WordPlace& place, CPVT_WordInfo& wordinfo); 469 FX_BOOL GetWordInfo(const CPVT_WordPlace& place, CPVT_WordInfo& wordinfo);
448 FX_BOOL SetWordInfo(const CPVT_WordPlace& place, 470 FX_BOOL SetWordInfo(const CPVT_WordPlace& place,
449 const CPVT_WordInfo& wordinfo); 471 const CPVT_WordInfo& wordinfo);
450 FX_BOOL GetLineInfo(const CPVT_WordPlace& place, CPVT_LineInfo& lineinfo); 472 FX_BOOL GetLineInfo(const CPVT_WordPlace& place, CPVT_LineInfo& lineinfo);
(...skipping 21 matching lines...) Expand all
472 FX_FLOAT GetFontAscent(int32_t nFontIndex, FX_FLOAT fFontSize); 494 FX_FLOAT GetFontAscent(int32_t nFontIndex, FX_FLOAT fFontSize);
473 FX_FLOAT GetFontDescent(int32_t nFontIndex, FX_FLOAT fFontSize); 495 FX_FLOAT GetFontDescent(int32_t nFontIndex, FX_FLOAT fFontSize);
474 int32_t GetWordFontIndex(const CPVT_WordInfo& WordInfo); 496 int32_t GetWordFontIndex(const CPVT_WordInfo& WordInfo);
475 FX_FLOAT GetCharSpace(const CPVT_WordInfo& WordInfo); 497 FX_FLOAT GetCharSpace(const CPVT_WordInfo& WordInfo);
476 int32_t GetHorzScale(const CPVT_WordInfo& WordInfo); 498 int32_t GetHorzScale(const CPVT_WordInfo& WordInfo);
477 FX_FLOAT GetLineLeading(const CPVT_SectionInfo& SecInfo); 499 FX_FLOAT GetLineLeading(const CPVT_SectionInfo& SecInfo);
478 FX_FLOAT GetLineIndent(const CPVT_SectionInfo& SecInfo); 500 FX_FLOAT GetLineIndent(const CPVT_SectionInfo& SecInfo);
479 int32_t GetAlignment(const CPVT_SectionInfo& SecInfo); 501 int32_t GetAlignment(const CPVT_SectionInfo& SecInfo);
480 502
481 void ClearSectionRightWords(const CPVT_WordPlace& place); 503 void ClearSectionRightWords(const CPVT_WordPlace& place);
482 CPVT_WordPlace AjustLineHeader(const CPVT_WordPlace& place, 504
483 FX_BOOL bPrevOrNext) const;
484 FX_BOOL ClearEmptySection(const CPVT_WordPlace& place); 505 FX_BOOL ClearEmptySection(const CPVT_WordPlace& place);
485 void ClearEmptySections(const CPVT_WordRange& PlaceRange); 506 void ClearEmptySections(const CPVT_WordRange& PlaceRange);
486 void LinkLatterSection(const CPVT_WordPlace& place); 507 void LinkLatterSection(const CPVT_WordPlace& place);
487 void ClearWords(const CPVT_WordRange& PlaceRange); 508 void ClearWords(const CPVT_WordRange& PlaceRange);
488 CPVT_WordPlace ClearLeftWord(const CPVT_WordPlace& place); 509 CPVT_WordPlace ClearLeftWord(const CPVT_WordPlace& place);
489 CPVT_WordPlace ClearRightWord(const CPVT_WordPlace& place); 510 CPVT_WordPlace ClearRightWord(const CPVT_WordPlace& place);
490 511
491 private: 512 private:
492 CPVT_FloatRect Rearrange(const CPVT_WordRange& PlaceRange); 513 CPVT_FloatRect Rearrange(const CPVT_WordRange& PlaceRange);
493 FX_FLOAT GetAutoFontSize(); 514 FX_FLOAT GetAutoFontSize();
494 FX_BOOL IsBigger(FX_FLOAT fFontSize); 515 FX_BOOL IsBigger(FX_FLOAT fFontSize);
495 CPVT_FloatRect RearrangeSections(const CPVT_WordRange& PlaceRange); 516 CPVT_FloatRect RearrangeSections(const CPVT_WordRange& PlaceRange);
496 517
497 private:
498 void ResetSectionArray(); 518 void ResetSectionArray();
499 519
500 private:
501 CPVT_ArrayTemplate<CSection*> m_SectionArray; 520 CPVT_ArrayTemplate<CSection*> m_SectionArray;
502 int32_t m_nLimitChar; 521 int32_t m_nLimitChar;
503 int32_t m_nCharArray; 522 int32_t m_nCharArray;
504 FX_BOOL m_bMultiLine; 523 FX_BOOL m_bMultiLine;
505 FX_BOOL m_bLimitWidth; 524 FX_BOOL m_bLimitWidth;
506 FX_BOOL m_bAutoFontSize; 525 FX_BOOL m_bAutoFontSize;
507 int32_t m_nAlignment; 526 int32_t m_nAlignment;
508 FX_FLOAT m_fLineLeading; 527 FX_FLOAT m_fLineLeading;
509 FX_FLOAT m_fCharSpace; 528 FX_FLOAT m_fCharSpace;
510 int32_t m_nHorzScale; 529 int32_t m_nHorzScale;
511 FX_WORD m_wSubWord; 530 FX_WORD m_wSubWord;
512 FX_FLOAT m_fFontSize; 531 FX_FLOAT m_fFontSize;
513 532
514 private: 533 private:
515 FX_BOOL m_bInitial; 534 FX_BOOL m_bInitial;
516 FX_BOOL m_bRichText; 535 FX_BOOL m_bRichText;
517 IPDF_VariableText_Provider* m_pVTProvider; 536 IPDF_VariableText_Provider* m_pVTProvider;
518 CPDF_VariableText_Iterator* m_pVTIterator; 537 CPDF_VariableText_Iterator* m_pVTIterator;
519 }; 538 };
539
520 class CPDF_VariableText_Iterator : public IPDF_VariableText_Iterator { 540 class CPDF_VariableText_Iterator : public IPDF_VariableText_Iterator {
521 public: 541 public:
522 CPDF_VariableText_Iterator(CPDF_VariableText* pVT); 542 CPDF_VariableText_Iterator(CPDF_VariableText* pVT);
523 virtual ~CPDF_VariableText_Iterator(); 543 ~CPDF_VariableText_Iterator() override;
524 FX_BOOL NextWord(); 544
525 FX_BOOL PrevWord(); 545 // IPDF_VariableText_Iterator
526 FX_BOOL NextLine(); 546 FX_BOOL NextWord() override;
527 FX_BOOL PrevLine(); 547 FX_BOOL PrevWord() override;
528 FX_BOOL NextSection(); 548 FX_BOOL NextLine() override;
529 FX_BOOL PrevSection(); 549 FX_BOOL PrevLine() override;
530 FX_BOOL SetWord(const CPVT_Word& word); 550 FX_BOOL NextSection() override;
531 FX_BOOL GetWord(CPVT_Word& word) const; 551 FX_BOOL PrevSection() override;
532 FX_BOOL GetLine(CPVT_Line& line) const; 552 FX_BOOL SetWord(const CPVT_Word& word) override;
533 FX_BOOL GetSection(CPVT_Section& section) const; 553 FX_BOOL GetWord(CPVT_Word& word) const override;
534 FX_BOOL SetSection(const CPVT_Section& section); 554 FX_BOOL GetLine(CPVT_Line& line) const override;
535 void SetAt(int32_t nWordIndex); 555 FX_BOOL GetSection(CPVT_Section& section) const override;
536 void SetAt(const CPVT_WordPlace& place); 556 FX_BOOL SetSection(const CPVT_Section& section) override;
537 const CPVT_WordPlace& GetAt() const { return m_CurPos; }; 557 void SetAt(int32_t nWordIndex) override;
558 void SetAt(const CPVT_WordPlace& place) override;
559 const CPVT_WordPlace& GetAt() const override { return m_CurPos; };
538 560
539 private: 561 private:
540 CPVT_WordPlace m_CurPos; 562 CPVT_WordPlace m_CurPos;
541 CPDF_VariableText* m_pVT; 563 CPDF_VariableText* m_pVT;
542 }; 564 };
543 565
544 #endif // CORE_SRC_FPDFDOC_PDF_VT_H_ 566 #endif // CORE_SRC_FPDFDOC_PDF_VT_H_
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_vt.cpp ('k') | core/src/fpdfdoc/tagged_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698