summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-05 12:02:15 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-05 17:12:31 +0000
commit3862d24efe5ca45f29e4404e674f3152f492cb01 (patch)
tree8346010ff49e719b121378246b13c64201542bbb /core
parent4ce4f5f8ab0b25ac10a5c66cac1a8c281e24a69b (diff)
downloadpdfium-3862d24efe5ca45f29e4404e674f3152f492cb01.tar.xz
Remove friends from CPDF_VariableText
This CL removes the friend class items from CPDF_VariableText and adds accessor and makes methods public as needed. Change-Id: Ic54732b25e9879c39a2276a89580cf42d3b3947f Reviewed-on: https://pdfium-review.googlesource.com/15534 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fpdfdoc/cpdf_variabletext.h46
-rw-r--r--core/fpdfdoc/csection.cpp2
-rw-r--r--core/fpdfdoc/ctypeset.cpp14
3 files changed, 31 insertions, 31 deletions
diff --git a/core/fpdfdoc/cpdf_variabletext.h b/core/fpdfdoc/cpdf_variabletext.h
index 5b0c259952..2319df7cb9 100644
--- a/core/fpdfdoc/cpdf_variabletext.h
+++ b/core/fpdfdoc/cpdf_variabletext.h
@@ -128,6 +128,8 @@ class CPDF_VariableText {
bool IsMultiLine() const { return m_bMultiLine; }
int32_t GetHorzScale() const { return m_nHorzScale; }
float GetCharSpace() const { return m_fCharSpace; }
+ bool IsAutoReturn() const { return m_bLimitWidth; }
+
CPVT_WordPlace GetBeginWordPlace() const;
CPVT_WordPlace GetEndWordPlace() const;
CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const;
@@ -160,15 +162,32 @@ class CPDF_VariableText {
CFX_FloatRect InToOut(const CPVT_FloatRect& rect) const;
CPVT_FloatRect OutToIn(const CFX_FloatRect& rect) const;
- private:
- friend class CTypeset;
- friend class CSection;
+ float GetFontAscent(int32_t nFontIndex, float fFontSize);
+ float GetFontDescent(int32_t nFontIndex, float fFontSize);
+ int32_t GetDefaultFontIndex();
+ float GetLineLeading(const CPVT_SectionInfo& SecInfo);
+ int32_t GetAlignment(const CPVT_SectionInfo& SecInfo);
+ float GetWordWidth(const CPVT_WordInfo& WordInfo);
+ float GetWordWidth(int32_t nFontIndex,
+ uint16_t Word,
+ uint16_t SubWord,
+ float fCharSpace,
+ int32_t nHorzScale,
+ float fFontSize,
+ float fWordTail);
+ float GetWordAscent(const CPVT_WordInfo& WordInfo);
+ float GetWordDescent(const CPVT_WordInfo& WordInfo);
+ float GetWordAscent(const CPVT_WordInfo& WordInfo, float fFontSize);
+ float GetWordDescent(const CPVT_WordInfo& WordInfo, float fFontSize);
+ float GetLineAscent(const CPVT_SectionInfo& SecInfo);
+ float GetLineDescent(const CPVT_SectionInfo& SecInfo);
+ float GetLineIndent(const CPVT_SectionInfo& SecInfo);
+ private:
int32_t GetCharWidth(int32_t nFontIndex, uint16_t Word, uint16_t SubWord);
int32_t GetTypeAscent(int32_t nFontIndex);
int32_t GetTypeDescent(int32_t nFontIndex);
int32_t GetWordFontIndex(uint16_t word, int32_t charset, int32_t nFontIndex);
- int32_t GetDefaultFontIndex();
bool IsLatinWord(uint16_t word);
CPVT_WordPlace AddSection(const CPVT_WordPlace& place,
@@ -182,28 +201,9 @@ class CPDF_VariableText {
bool GetLineInfo(const CPVT_WordPlace& place, CPVT_LineInfo& lineinfo);
bool GetSectionInfo(const CPVT_WordPlace& place, CPVT_SectionInfo& secinfo);
float GetWordFontSize(const CPVT_WordInfo& WordInfo);
- float GetWordWidth(int32_t nFontIndex,
- uint16_t Word,
- uint16_t SubWord,
- float fCharSpace,
- int32_t nHorzScale,
- float fFontSize,
- float fWordTail);
- float GetWordWidth(const CPVT_WordInfo& WordInfo);
- float GetWordAscent(const CPVT_WordInfo& WordInfo, float fFontSize);
- float GetWordDescent(const CPVT_WordInfo& WordInfo, float fFontSize);
- float GetWordAscent(const CPVT_WordInfo& WordInfo);
- float GetWordDescent(const CPVT_WordInfo& WordInfo);
- float GetLineAscent(const CPVT_SectionInfo& SecInfo);
- float GetLineDescent(const CPVT_SectionInfo& SecInfo);
- float GetFontAscent(int32_t nFontIndex, float fFontSize);
- float GetFontDescent(int32_t nFontIndex, float fFontSize);
int32_t GetWordFontIndex(const CPVT_WordInfo& WordInfo);
float GetCharSpace(const CPVT_WordInfo& WordInfo);
int32_t GetHorzScale(const CPVT_WordInfo& WordInfo);
- float GetLineLeading(const CPVT_SectionInfo& SecInfo);
- float GetLineIndent(const CPVT_SectionInfo& SecInfo);
- int32_t GetAlignment(const CPVT_SectionInfo& SecInfo);
void ClearSectionRightWords(const CPVT_WordPlace& place);
diff --git a/core/fpdfdoc/csection.cpp b/core/fpdfdoc/csection.cpp
index b6f45a274c..0c8c02585f 100644
--- a/core/fpdfdoc/csection.cpp
+++ b/core/fpdfdoc/csection.cpp
@@ -45,7 +45,7 @@ CPVT_WordPlace CSection::AddLine(const CPVT_LineInfo& lineinfo) {
}
CPVT_FloatRect CSection::Rearrange() {
- if (m_pVT->m_nCharArray > 0)
+ if (m_pVT->GetCharArray() > 0)
return CTypeset(this).CharArray();
return CTypeset(this).Typeset();
}
diff --git a/core/fpdfdoc/ctypeset.cpp b/core/fpdfdoc/ctypeset.cpp
index 2e2f6c54a4..920ac03a18 100644
--- a/core/fpdfdoc/ctypeset.cpp
+++ b/core/fpdfdoc/ctypeset.cpp
@@ -185,7 +185,7 @@ CPVT_FloatRect CTypeset::CharArray() {
return m_rcRet;
float fNodeWidth = m_pVT->GetPlateWidth() /
- (m_pVT->m_nCharArray <= 0 ? 1 : m_pVT->m_nCharArray);
+ (m_pVT->GetCharArray() <= 0 ? 1 : m_pVT->GetCharArray());
float fLineAscent =
m_pVT->GetFontAscent(m_pVT->GetDefaultFontIndex(), m_pVT->GetFontSize());
float fLineDescent =
@@ -199,14 +199,14 @@ CPVT_FloatRect CTypeset::CharArray() {
pLine->m_LineInfo.fLineX = fNodeWidth * VARIABLETEXT_HALF;
break;
case 1:
- nStart = (m_pVT->m_nCharArray -
+ nStart = (m_pVT->GetCharArray() -
pdfium::CollectionSize<int32_t>(m_pSection->m_WordArray)) /
2;
pLine->m_LineInfo.fLineX =
fNodeWidth * nStart - fNodeWidth * VARIABLETEXT_HALF;
break;
case 2:
- nStart = m_pVT->m_nCharArray -
+ nStart = m_pVT->GetCharArray() -
pdfium::CollectionSize<int32_t>(m_pSection->m_WordArray);
pLine->m_LineInfo.fLineX =
fNodeWidth * nStart - fNodeWidth * VARIABLETEXT_HALF;
@@ -215,7 +215,7 @@ CPVT_FloatRect CTypeset::CharArray() {
for (int32_t w = 0,
sz = pdfium::CollectionSize<int32_t>(m_pSection->m_WordArray);
w < sz; w++) {
- if (w >= m_pVT->m_nCharArray)
+ if (w >= m_pVT->GetCharArray())
break;
float fNextWidth = 0;
@@ -314,8 +314,8 @@ void CTypeset::SplitLines(bool bTypeset, float fFontSize) {
fLineDescent =
std::min(fLineDescent, m_pVT->GetWordDescent(*pWord, fFontSize));
fWordWidth = m_pVT->GetWordWidth(
- pWord->nFontIndex, pWord->Word, m_pVT->m_wSubWord,
- m_pVT->m_fCharSpace, m_pVT->m_nHorzScale, fFontSize,
+ pWord->nFontIndex, pWord->Word, m_pVT->GetSubWord(),
+ m_pVT->GetCharSpace(), m_pVT->GetHorzScale(), fFontSize,
pWord->fWordTail);
}
if (!bOpened) {
@@ -344,7 +344,7 @@ void CTypeset::SplitLines(bool bTypeset, float fFontSize) {
}
nCharIndex++;
}
- if (m_pVT->m_bLimitWidth && fTypesetWidth > 0 &&
+ if (m_pVT->IsAutoReturn() && fTypesetWidth > 0 &&
fLineWidth + fWordWidth > fTypesetWidth) {
if (nLineFullWordIndex > 0) {
i = nWordStartPos;