summaryrefslogtreecommitdiff
path: root/xfa/fde
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fde')
-rw-r--r--xfa/fde/cfde_txtedtpage.cpp36
-rw-r--r--xfa/fde/cfde_txtedtpage.h2
-rw-r--r--xfa/fde/cfde_txtedttextset.cpp2
-rw-r--r--xfa/fde/cfde_txtedttextset.h4
-rw-r--r--xfa/fde/fde_visualset.h4
-rw-r--r--xfa/fde/ifde_txtedtpage.h4
-rw-r--r--xfa/fde/tto/fde_textout.cpp6
-rw-r--r--xfa/fde/tto/fde_textout.h2
8 files changed, 34 insertions, 26 deletions
diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp
index 238dba2bcc..a049548269 100644
--- a/xfa/fde/cfde_txtedtpage.cpp
+++ b/xfa/fde/cfde_txtedtpage.cpp
@@ -9,6 +9,7 @@
#include <algorithm>
#include "third_party/base/ptr_util.h"
+#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_txtedtbuf.h"
#include "xfa/fde/cfde_txtedtengine.h"
#include "xfa/fde/cfde_txtedtparag.h"
@@ -71,8 +72,8 @@ int32_t CFDE_TxtEdtPage::GetCharRect(int32_t nIndex,
const FDE_TEXTEDITPIECE* pPiece = m_PieceMassArr.GetPtrAt(i);
if (nIndex >= pPiece->nStart &&
nIndex < (pPiece->nStart + pPiece->nCount)) {
- CFX_RectFArray rectArr;
- m_pTextSet->GetCharRects(pPiece, rectArr, bBBox);
+ std::vector<CFX_RectF> rectArr;
+ m_pTextSet->GetCharRects(pPiece, &rectArr, bBBox);
rect = rectArr[nIndex - pPiece->nStart];
return pPiece->nBidiLevel;
}
@@ -113,9 +114,9 @@ int32_t CFDE_TxtEdtPage::GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) {
pPiece = m_PieceMassArr.GetPtrAt(i);
nCaret = m_nPageStart + pPiece->nStart;
if (pPiece->rtPiece.Contains(ptF)) {
- CFX_RectFArray rectArr;
- m_pTextSet->GetCharRects(pPiece, rectArr, false);
- int32_t nRtCount = rectArr.GetSize();
+ std::vector<CFX_RectF> rectArr;
+ m_pTextSet->GetCharRects(pPiece, &rectArr, false);
+ int32_t nRtCount = pdfium::CollectionSize<int32_t>(rectArr);
for (int32_t j = 0; j < nRtCount; j++) {
if (rectArr[j].Contains(ptF)) {
nCaret = m_nPageStart + pPiece->nStart + j;
@@ -184,9 +185,10 @@ int32_t CFDE_TxtEdtPage::GetDisplayPos(const CFX_RectF& rtClip,
return nCharPosCount;
}
-void CFDE_TxtEdtPage::CalcRangeRectArray(int32_t nStart,
- int32_t nCount,
- CFX_RectFArray& RectFArr) const {
+void CFDE_TxtEdtPage::CalcRangeRectArray(
+ int32_t nStart,
+ int32_t nCount,
+ std::vector<CFX_RectF>* pRectFArr) const {
int32_t nPieceCount = m_PieceMassArr.GetSize();
int32_t nEnd = nStart + nCount - 1;
bool bInRange = false;
@@ -200,26 +202,26 @@ void CFDE_TxtEdtPage::CalcRangeRectArray(int32_t nStart,
nRangeEnd = nEnd - piece->nStart;
bEnd = true;
}
- CFX_RectFArray rcArr;
- m_pTextSet->GetCharRects(piece, rcArr, false);
+ std::vector<CFX_RectF> rcArr;
+ m_pTextSet->GetCharRects(piece, &rcArr, false);
CFX_RectF rectPiece = rcArr[nStart - piece->nStart];
rectPiece.Union(rcArr[nRangeEnd]);
- RectFArr.Add(rectPiece);
- if (bEnd) {
+ pRectFArr->push_back(rectPiece);
+ if (bEnd)
return;
- }
+
bInRange = true;
}
} else {
if (nEnd >= piece->nStart && nEnd < (piece->nStart + piece->nCount)) {
- CFX_RectFArray rcArr;
- m_pTextSet->GetCharRects(piece, rcArr, false);
+ std::vector<CFX_RectF> rcArr;
+ m_pTextSet->GetCharRects(piece, &rcArr, false);
CFX_RectF rectPiece = rcArr[0];
rectPiece.Union(rcArr[nEnd - piece->nStart]);
- RectFArr.Add(rectPiece);
+ pRectFArr->push_back(rectPiece);
return;
}
- RectFArr.Add(piece->rtPiece);
+ pRectFArr->push_back(piece->rtPiece);
}
}
}
diff --git a/xfa/fde/cfde_txtedtpage.h b/xfa/fde/cfde_txtedtpage.h
index 5cb4501afc..57ade45bbc 100644
--- a/xfa/fde/cfde_txtedtpage.h
+++ b/xfa/fde/cfde_txtedtpage.h
@@ -30,7 +30,7 @@ class CFDE_TxtEdtPage : public IFDE_TxtEdtPage {
int32_t GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) override;
void CalcRangeRectArray(int32_t nStart,
int32_t nCount,
- CFX_RectFArray& RectFArr) const override;
+ std::vector<CFX_RectF>* RectFArr) const override;
int32_t SelectWord(const CFX_PointF& fPoint, int32_t& nCount) override;
int32_t GetCharStart() const override;
int32_t GetCharCount() const override;
diff --git a/xfa/fde/cfde_txtedttextset.cpp b/xfa/fde/cfde_txtedttextset.cpp
index 4149a6df20..a885ad4508 100644
--- a/xfa/fde/cfde_txtedttextset.cpp
+++ b/xfa/fde/cfde_txtedttextset.cpp
@@ -76,7 +76,7 @@ int32_t CFDE_TxtEdtTextSet::GetDisplayPos(FDE_TEXTEDITPIECE* pPiece,
}
int32_t CFDE_TxtEdtTextSet::GetCharRects(const FDE_TEXTEDITPIECE* pPiece,
- CFX_RectFArray& rtArray,
+ std::vector<CFX_RectF>* rtArray,
bool bBBox) {
if (!pPiece)
return 0;
diff --git a/xfa/fde/cfde_txtedttextset.h b/xfa/fde/cfde_txtedttextset.h
index 6c6266642b..561419affe 100644
--- a/xfa/fde/cfde_txtedttextset.h
+++ b/xfa/fde/cfde_txtedttextset.h
@@ -7,6 +7,8 @@
#ifndef XFA_FDE_CFDE_TXTEDTTEXTSET_H_
#define XFA_FDE_CFDE_TXTEDTTEXTSET_H_
+#include <vector>
+
#include "xfa/fde/fde_visualset.h"
class CFDE_TxtEdtPage;
@@ -30,7 +32,7 @@ class CFDE_TxtEdtTextSet : public IFDE_TextSet {
bool bCharCode = false,
CFX_WideString* pWSForms = nullptr) override;
int32_t GetCharRects(const FDE_TEXTEDITPIECE* pPiece,
- CFX_RectFArray& rtArray,
+ std::vector<CFX_RectF>* rtArray,
bool bBBox) override;
private:
diff --git a/xfa/fde/fde_visualset.h b/xfa/fde/fde_visualset.h
index 8aef237ba1..30703e795a 100644
--- a/xfa/fde/fde_visualset.h
+++ b/xfa/fde/fde_visualset.h
@@ -7,6 +7,8 @@
#ifndef XFA_FDE_FDE_VISUALSET_H_
#define XFA_FDE_FDE_VISUALSET_H_
+#include <vector>
+
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_system.h"
@@ -56,7 +58,7 @@ class IFDE_TextSet : public IFDE_VisualSet {
bool bCharCode = false,
CFX_WideString* pWSForms = nullptr) = 0;
virtual int32_t GetCharRects(const FDE_TEXTEDITPIECE* hText,
- CFX_RectFArray& rtArray,
+ std::vector<CFX_RectF>* rtArray,
bool bbox) = 0;
};
diff --git a/xfa/fde/ifde_txtedtpage.h b/xfa/fde/ifde_txtedtpage.h
index ecc7d1699e..0ab3897b3c 100644
--- a/xfa/fde/ifde_txtedtpage.h
+++ b/xfa/fde/ifde_txtedtpage.h
@@ -7,6 +7,8 @@
#ifndef XFA_FDE_IFDE_TXTEDTPAGE_H_
#define XFA_FDE_IFDE_TXTEDTPAGE_H_
+#include <vector>
+
#include "xfa/fde/fde_visualset.h"
#include "xfa/fgas/layout/fgas_textbreak.h"
@@ -24,7 +26,7 @@ class IFDE_TxtEdtPage : public IFDE_CanvasSet, public IFX_TxtAccess {
virtual int32_t GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) = 0;
virtual void CalcRangeRectArray(int32_t nStart,
int32_t nCount,
- CFX_RectFArray& RectFArr) const = 0;
+ std::vector<CFX_RectF>* RectFArr) const = 0;
virtual int32_t SelectWord(const CFX_PointF& fPoint, int32_t& nCount) = 0;
virtual int32_t GetCharStart() const = 0;
virtual int32_t GetCharCount() const = 0;
diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp
index 4d207fb734..ca5aa566e1 100644
--- a/xfa/fde/tto/fde_textout.cpp
+++ b/xfa/fde/tto/fde_textout.cpp
@@ -814,8 +814,8 @@ int32_t CFDE_TextOut::GetDisplayPos(FDE_TTOPIECE* pPiece) {
int32_t CFDE_TextOut::GetCharRects(const FDE_TTOPIECE* pPiece) {
FX_TXTRUN tr = ToTextRun(pPiece);
- m_rectArray.RemoveAll();
- return m_pTxtBreak->GetCharRects(&tr, m_rectArray);
+ m_rectArray.clear();
+ return m_pTxtBreak->GetCharRects(&tr, &m_rectArray);
}
FX_TXTRUN CFDE_TextOut::ToTextRun(const FDE_TTOPIECE* pPiece) {
@@ -886,7 +886,7 @@ void CFDE_TextOut::DrawLine(const FDE_TTOPIECE* pPiece, CFDE_Pen*& pPen) {
int32_t iCharIndex = m_hotKeys.GetAt(i);
if (iCharIndex >= pPiece->iStartChar &&
iCharIndex < pPiece->iStartChar + pPiece->iChars) {
- CFX_RectF rect = m_rectArray.GetAt(iCharIndex - pPiece->iStartChar);
+ CFX_RectF rect = m_rectArray[iCharIndex - pPiece->iStartChar];
if (bVertical) {
pt1.x = rect.left;
pt1.y = rect.top;
diff --git a/xfa/fde/tto/fde_textout.h b/xfa/fde/tto/fde_textout.h
index 084af42acf..e1eb71cf3b 100644
--- a/xfa/fde/tto/fde_textout.h
+++ b/xfa/fde/tto/fde_textout.h
@@ -180,7 +180,7 @@ class CFDE_TextOut {
std::vector<FXTEXT_CHARPOS> m_CharPos;
std::unique_ptr<CFDE_RenderDevice> m_pRenderDevice;
CFX_ArrayTemplate<int32_t> m_hotKeys;
- CFX_RectFArray m_rectArray;
+ std::vector<CFX_RectF> m_rectArray;
};
#endif // XFA_FDE_TTO_FDE_TEXTOUT_H_