Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_FPDFDOC_CSECTION_H_ | 7 #ifndef CORE_FPDFDOC_CSECTION_H_ |
| 8 #define CORE_FPDFDOC_CSECTION_H_ | 8 #define CORE_FPDFDOC_CSECTION_H_ |
| 9 | 9 |
| 10 #include <memory> | |
| 11 #include <vector> | |
| 12 | |
| 10 #include "core/fpdfdoc/cpvt_sectioninfo.h" | 13 #include "core/fpdfdoc/cpvt_sectioninfo.h" |
| 11 #include "core/fpdfdoc/ctypeset.h" | |
| 12 #include "core/fxcrt/include/fx_coordinates.h" | 14 #include "core/fxcrt/include/fx_coordinates.h" |
| 13 #include "core/fxcrt/include/fx_system.h" | 15 #include "core/fxcrt/include/fx_system.h" |
| 14 | 16 |
| 15 class CPDF_VariableText; | 17 class CPDF_VariableText; |
| 16 | 18 |
| 17 struct CPVT_LineInfo; | 19 struct CPVT_LineInfo; |
| 18 struct CPVT_WordLine; | 20 struct CPVT_WordLine; |
| 19 struct CPVT_WordPlace; | 21 struct CPVT_WordPlace; |
| 20 | 22 |
| 21 class CSection { | 23 class CSection { |
| 22 public: | 24 public: |
| 23 explicit CSection(CPDF_VariableText* pVT); | 25 explicit CSection(CPDF_VariableText* pVT); |
| 24 virtual ~CSection(); | 26 ~CSection(); |
| 27 | |
| 25 void ResetAll(); | 28 void ResetAll(); |
| 26 void ResetLineArray(); | 29 void ResetLineArray(); |
| 27 void ResetWordArray(); | 30 void ResetWordArray(); |
| 28 void ResetLinePlace(); | 31 void ResetLinePlace(); |
| 29 CPVT_WordPlace AddWord(const CPVT_WordPlace& place, | 32 CPVT_WordPlace AddWord(const CPVT_WordPlace& place, |
| 30 const CPVT_WordInfo& wordinfo); | 33 const CPVT_WordInfo& wordinfo); |
| 31 CPVT_WordPlace AddLine(const CPVT_LineInfo& lineinfo); | 34 CPVT_WordPlace AddLine(const CPVT_LineInfo& lineinfo); |
| 32 void ClearWords(const CPVT_WordRange& PlaceRange); | 35 void ClearWords(const CPVT_WordRange& PlaceRange); |
| 33 void ClearWord(const CPVT_WordPlace& place); | 36 void ClearWord(const CPVT_WordPlace& place); |
| 34 CPVT_FloatRect Rearrange(); | 37 CPVT_FloatRect Rearrange(); |
| 35 CPVT_Size GetSectionSize(FX_FLOAT fFontSize); | 38 CFX_PointF GetSectionSize(FX_FLOAT fFontSize); |
| 36 CPVT_WordPlace GetBeginWordPlace() const; | 39 CPVT_WordPlace GetBeginWordPlace() const; |
| 37 CPVT_WordPlace GetEndWordPlace() const; | 40 CPVT_WordPlace GetEndWordPlace() const; |
| 38 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const; | 41 CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const; |
| 39 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const; | 42 CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const; |
| 40 void UpdateWordPlace(CPVT_WordPlace& place) const; | 43 void UpdateWordPlace(CPVT_WordPlace& place) const; |
| 41 CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; | 44 CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; |
| 42 CPVT_WordPlace SearchWordPlace(FX_FLOAT fx, | 45 CPVT_WordPlace SearchWordPlace(FX_FLOAT fx, |
| 43 const CPVT_WordPlace& lineplace) const; | 46 const CPVT_WordPlace& lineplace) const; |
| 44 CPVT_WordPlace SearchWordPlace(FX_FLOAT fx, | 47 CPVT_WordPlace SearchWordPlace(FX_FLOAT fx, |
| 45 const CPVT_WordRange& range) const; | 48 const CPVT_WordRange& range) const; |
| 49 void ClearLeftWords(int32_t nWordIndex); | |
| 50 void ClearRightWords(int32_t nWordIndex); | |
|
dsinclair
2016/05/16 14:12:27
ClearWordsBefore and ClearWordsAfter?
| |
| 51 void ClearMidWords(int32_t nBeginIndex, int32_t nEndIndex); | |
|
dsinclair
2016/05/16 14:12:27
ClearWordsBetween?
| |
| 52 | |
| 53 CPDF_VariableText* GetVT() { return m_pVT; } | |
|
dsinclair
2016/05/16 14:12:27
nit: s/GetVT/GetVariableText
| |
| 54 | |
| 55 bool IsWordArrayEmpty() const; | |
| 56 int32_t GetNumberOfWords() const; | |
| 57 const CPVT_WordInfo* GetWord(int32_t index) const; | |
| 58 CPVT_WordInfo* GetWord(int32_t index); | |
| 46 | 59 |
| 47 CPVT_WordPlace SecPlace; | 60 CPVT_WordPlace SecPlace; |
|
dsinclair
2016/05/16 14:12:27
Can these be private now?
| |
| 48 CPVT_SectionInfo m_SecInfo; | 61 CPVT_SectionInfo m_SecInfo; |
| 49 CLines m_LineArray; | 62 CLines m_LineArray; |
| 50 CPVT_ArrayTemplate<CPVT_WordInfo*> m_WordArray; | |
| 51 | 63 |
| 52 private: | 64 private: |
| 53 friend class CTypeset; | 65 std::vector<std::unique_ptr<CPVT_WordInfo>> m_WordArray; |
| 54 | 66 CPDF_VariableText* const m_pVT; |
|
dsinclair
2016/05/16 14:12:27
nit: s/m_pVT/m_pVariableText ?
| |
| 55 void ClearLeftWords(int32_t nWordIndex); | |
| 56 void ClearRightWords(int32_t nWordIndex); | |
| 57 void ClearMidWords(int32_t nBeginIndex, int32_t nEndIndex); | |
| 58 | |
| 59 CPDF_VariableText* m_pVT; | |
| 60 }; | 67 }; |
| 61 | 68 |
| 62 #endif // CORE_FPDFDOC_CSECTION_H_ | 69 #endif // CORE_FPDFDOC_CSECTION_H_ |
| OLD | NEW |