Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpvt_section.h
Go to the documentation of this file.
1// Copyright 2016 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef CORE_FPDFDOC_CPVT_SECTION_H_
8#define CORE_FPDFDOC_CPVT_SECTION_H_
9
10#include <stdint.h>
11
12#include <memory>
13#include <vector>
14
15#include "core/fpdfdoc/cpvt_floatrect.h"
16#include "core/fpdfdoc/cpvt_lineinfo.h"
17#include "core/fpdfdoc/cpvt_wordinfo.h"
18#include "core/fpdfdoc/cpvt_wordrange.h"
19#include "core/fxcrt/fx_coordinates.h"
20#include "core/fxcrt/unowned_ptr.h"
21
23struct CPVT_LineInfo;
24struct CPVT_WordPlace;
25
26class CPVT_Section final {
27 public:
40
41 explicit CPVT_Section(CPVT_VariableText* pVT);
43
44 void ResetLinePlace();
46 const CPVT_WordInfo& wordinfo);
47 CPVT_WordPlace AddLine(const CPVT_LineInfo& lineinfo);
48 void ClearWords(const CPVT_WordRange& PlaceRange);
49 void ClearWord(const CPVT_WordPlace& place);
50 CPVT_FloatRect Rearrange();
51 CFX_SizeF GetSectionSize(float fFontSize);
56 void UpdateWordPlace(CPVT_WordPlace& place) const;
57 CPVT_WordPlace SearchWordPlace(const CFX_PointF& point) const;
59 const CPVT_WordPlace& lineplace) const;
60 CPVT_WordPlace SearchWordPlace(float fx, const CPVT_WordRange& range) const;
61
62 void SetPlace(const CPVT_WordPlace& place) { m_SecPlace = place; }
63 void SetPlaceIndex(int32_t index) { m_SecPlace.nSecIndex = index; }
64 const CPVT_FloatRect& GetRect() const { return m_Rect; }
65 void SetRect(const CPVT_FloatRect& rect) { m_Rect = rect; }
66
67 int32_t GetLineArraySize() const;
68 const Line* GetLineFromArray(int32_t index) const;
69 int32_t GetWordArraySize() const;
70 const CPVT_WordInfo* GetWordFromArray(int32_t index) const;
71 void EraseWordsFrom(int32_t index);
72
73 private:
74 CPVT_FloatRect RearrangeCharArray() const;
75 CPVT_FloatRect RearrangeTypeset();
76 CPVT_FloatRect SplitLines(bool bTypeset, float fFontSize);
77 CPVT_FloatRect OutputLines(const CPVT_FloatRect& rect) const;
78
79 void ClearLeftWords(int32_t nWordIndex);
80 void ClearRightWords(int32_t nWordIndex);
81 void ClearMidWords(int32_t nBeginIndex, int32_t nEndIndex);
82
83 CPVT_WordPlace m_SecPlace;
84 CPVT_FloatRect m_Rect;
85 std::vector<std::unique_ptr<Line>> m_LineArray;
86 std::vector<std::unique_ptr<CPVT_WordInfo>> m_WordArray;
87 UnownedPtr<CPVT_VariableText> const m_pVT;
88};
89
90#endif // CORE_FPDFDOC_CPVT_SECTION_H_
float Width() const
CPVT_FloatRect(float other_left, float other_top, float other_right, float other_bottom)
float Height() const
CPVT_FloatRect()=default
CPVT_WordPlace GetEndWordPlace() const
Line(const CPVT_LineInfo &lineinfo)
CPVT_WordPlace GetBeginWordPlace() const
CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace &place) const
CPVT_LineInfo m_LineInfo
CPVT_WordPlace m_LinePlace
CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace &place) const
int32_t GetWordArraySize() const
void ClearWord(const CPVT_WordPlace &place)
void EraseWordsFrom(int32_t index)
CPVT_Section(CPVT_VariableText *pVT)
CPVT_FloatRect Rearrange()
CPVT_WordPlace GetEndWordPlace() const
CPVT_WordPlace SearchWordPlace(float fx, const CPVT_WordRange &range) const
const Line * GetLineFromArray(int32_t index) const
void SetRect(const CPVT_FloatRect &rect)
CFX_SizeF GetSectionSize(float fFontSize)
void UpdateWordPlace(CPVT_WordPlace &place) const
CPVT_WordPlace SearchWordPlace(float fx, const CPVT_WordPlace &lineplace) const
void ClearWords(const CPVT_WordRange &PlaceRange)
const CPVT_FloatRect & GetRect() const
CPVT_WordPlace GetBeginWordPlace() const
void SetPlace(const CPVT_WordPlace &place)
void SetPlaceIndex(int32_t index)
void ResetLinePlace()
CPVT_WordPlace SearchWordPlace(const CFX_PointF &point) const
CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace &place) const
const CPVT_WordInfo * GetWordFromArray(int32_t index) const
CPVT_WordPlace AddWord(const CPVT_WordPlace &place, const CPVT_WordInfo &wordinfo)
CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace &place) const
int32_t GetLineArraySize() const
CPVT_WordPlace AddLine(const CPVT_LineInfo &lineinfo)
#define FXSYS_IsFloatBigger(fa, fb)
Definition fx_system.h:36
#define FXSYS_IsFloatSmaller(fa, fb)
Definition fx_system.h:38
int32_t nBeginWordIndex
int32_t nEndWordIndex
int32_t nTotalWord
bool operator<=(const CPVT_WordPlace &wp) const
CPVT_WordPlace(int32_t other_nSecIndex, int32_t other_nLineIndex, int32_t other_nWordIndex)
bool operator>=(const CPVT_WordPlace &wp) const
CPVT_WordRange(const CPVT_WordPlace &begin, const CPVT_WordPlace &end)
CPVT_WordPlace BeginPos
CPVT_WordPlace EndPos