summaryrefslogtreecommitdiff
path: root/fpdfsdk/fxedit
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-06-15 11:21:33 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-15 11:21:33 -0700
commit625ad667d0c0c17d5bc11d505f04861d90b45078 (patch)
treeefd014e752072adf726a0e34383555399342dcb2 /fpdfsdk/fxedit
parent29b8ad0b130ec6ed4f72ebd0c0a4f9e6a5b03467 (diff)
downloadpdfium-625ad667d0c0c17d5bc11d505f04861d90b45078.tar.xz
Make code compile with clang_use_chrome_plugin (part IV)
This change mainly contains files in fpdfsdk/ directory. This is part of the efforts to make PDFium code compilable by Clang chromium style plugins. The changes are mainly the following: -- move inline constructor/destructor of complex class/struct out-of-line; -- add constructor/destructor of complex class/struct if not explicitly defined; -- add explicit out-of-line copy constructor when needed; -- move inline virtual functions out-of-line; -- Properly mark virtual functions with 'override'; -- some minor cleanups plus removing an unused file and splitting cxfa_eventparam out from fxfa.h BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2062313002
Diffstat (limited to 'fpdfsdk/fxedit')
-rw-r--r--fpdfsdk/fxedit/fxet_edit.cpp142
-rw-r--r--fpdfsdk/fxedit/fxet_list.cpp16
-rw-r--r--fpdfsdk/fxedit/include/fxet_edit.h131
-rw-r--r--fpdfsdk/fxedit/include/fxet_list.h13
4 files changed, 198 insertions, 104 deletions
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp
index 589ac1bd41..1a3289b26d 100644
--- a/fpdfsdk/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/fxedit/fxet_edit.cpp
@@ -364,6 +364,30 @@ void CFX_Edit_Undo::Reset() {
m_UndoItemStack.RemoveAll();
}
+CFX_Edit_UndoItem::CFX_Edit_UndoItem() : m_bFirst(TRUE), m_bLast(TRUE) {}
+
+CFX_Edit_UndoItem::~CFX_Edit_UndoItem() {}
+
+CFX_WideString CFX_Edit_UndoItem::GetUndoTitle() {
+ return L"";
+}
+
+void CFX_Edit_UndoItem::SetFirst(FX_BOOL bFirst) {
+ m_bFirst = bFirst;
+}
+
+FX_BOOL CFX_Edit_UndoItem::IsFirst() {
+ return m_bFirst;
+}
+
+void CFX_Edit_UndoItem::SetLast(FX_BOOL bLast) {
+ m_bLast = bLast;
+}
+
+FX_BOOL CFX_Edit_UndoItem::IsLast() {
+ return m_bLast;
+}
+
CFX_Edit_GroupUndoItem::CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle)
: m_sTitle(sTitle) {}
@@ -2979,3 +3003,121 @@ void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) {
if (m_bOprNotify && m_pOprNotify)
m_pOprNotify->OnAddUndo(pUndoItem);
}
+
+CFX_Edit_LineRectArray::CFX_Edit_LineRectArray() {}
+
+CFX_Edit_LineRectArray::~CFX_Edit_LineRectArray() {
+ Empty();
+}
+
+void CFX_Edit_LineRectArray::Empty() {
+ for (int32_t i = 0, sz = m_LineRects.GetSize(); i < sz; i++)
+ delete m_LineRects.GetAt(i);
+
+ m_LineRects.RemoveAll();
+}
+
+void CFX_Edit_LineRectArray::RemoveAll() {
+ m_LineRects.RemoveAll();
+}
+
+void CFX_Edit_LineRectArray::operator=(CFX_Edit_LineRectArray& rects) {
+ Empty();
+ for (int32_t i = 0, sz = rects.GetSize(); i < sz; i++)
+ m_LineRects.Add(rects.GetAt(i));
+
+ rects.RemoveAll();
+}
+
+void CFX_Edit_LineRectArray::Add(const CPVT_WordRange& wrLine,
+ const CFX_FloatRect& rcLine) {
+ m_LineRects.Add(new CFX_Edit_LineRect(wrLine, rcLine));
+}
+
+int32_t CFX_Edit_LineRectArray::GetSize() const {
+ return m_LineRects.GetSize();
+}
+
+CFX_Edit_LineRect* CFX_Edit_LineRectArray::GetAt(int32_t nIndex) const {
+ if (nIndex < 0 || nIndex >= m_LineRects.GetSize())
+ return nullptr;
+
+ return m_LineRects.GetAt(nIndex);
+}
+
+CFX_Edit_Select::CFX_Edit_Select() {}
+
+CFX_Edit_Select::CFX_Edit_Select(const CPVT_WordPlace& begin,
+ const CPVT_WordPlace& end) {
+ Set(begin, end);
+}
+
+CFX_Edit_Select::CFX_Edit_Select(const CPVT_WordRange& range) {
+ Set(range.BeginPos, range.EndPos);
+}
+
+CPVT_WordRange CFX_Edit_Select::ConvertToWordRange() const {
+ return CPVT_WordRange(BeginPos, EndPos);
+}
+
+void CFX_Edit_Select::Default() {
+ BeginPos.Default();
+ EndPos.Default();
+}
+
+void CFX_Edit_Select::Set(const CPVT_WordPlace& begin,
+ const CPVT_WordPlace& end) {
+ BeginPos = begin;
+ EndPos = end;
+}
+
+void CFX_Edit_Select::SetBeginPos(const CPVT_WordPlace& begin) {
+ BeginPos = begin;
+}
+
+void CFX_Edit_Select::SetEndPos(const CPVT_WordPlace& end) {
+ EndPos = end;
+}
+
+FX_BOOL CFX_Edit_Select::IsExist() const {
+ return BeginPos != EndPos;
+}
+
+FX_BOOL CFX_Edit_Select::operator!=(const CPVT_WordRange& wr) const {
+ return wr.BeginPos != BeginPos || wr.EndPos != EndPos;
+}
+
+CFX_Edit_RectArray::CFX_Edit_RectArray() {}
+
+CFX_Edit_RectArray::~CFX_Edit_RectArray() {
+ Empty();
+}
+
+void CFX_Edit_RectArray::Empty() {
+ for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++)
+ delete m_Rects.GetAt(i);
+
+ m_Rects.RemoveAll();
+}
+
+void CFX_Edit_RectArray::Add(const CFX_FloatRect& rect) {
+ // check for overlapped area
+ for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++) {
+ CFX_FloatRect* pRect = m_Rects.GetAt(i);
+ if (pRect && pRect->Contains(rect))
+ return;
+ }
+
+ m_Rects.Add(new CFX_FloatRect(rect));
+}
+
+int32_t CFX_Edit_RectArray::GetSize() const {
+ return m_Rects.GetSize();
+}
+
+CFX_FloatRect* CFX_Edit_RectArray::GetAt(int32_t nIndex) const {
+ if (nIndex < 0 || nIndex >= m_Rects.GetSize())
+ return nullptr;
+
+ return m_Rects.GetAt(nIndex);
+}
diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/fxedit/fxet_list.cpp
index 1385d57680..662a64b00a 100644
--- a/fpdfsdk/fxedit/fxet_list.cpp
+++ b/fpdfsdk/fxedit/fxet_list.cpp
@@ -73,6 +73,14 @@ CFX_WideString CFX_ListItem::GetText() const {
return m_pEdit->GetText();
}
+CFX_ListContainer::CFX_ListContainer() {}
+
+CFX_ListContainer::~CFX_ListContainer() {}
+
+void CFX_ListContainer::SetPlateRect(const CFX_FloatRect& rect) {
+ m_rcPlate = rect;
+}
+
CFX_List::CFX_List()
: m_fFontSize(0.0f), m_pFontMap(nullptr), m_bMultiple(FALSE) {}
@@ -561,6 +569,14 @@ CFX_FloatRect CFX_ListCtrl::GetItemRect(int32_t nIndex) const {
return InToOut(CFX_List::GetItemRect(nIndex));
}
+int32_t CFX_ListCtrl::GetCaret() const {
+ return m_nCaretIndex;
+}
+
+int32_t CFX_ListCtrl::GetSelect() const {
+ return m_nSelItem;
+}
+
void CFX_ListCtrl::AddString(const FX_WCHAR* str) {
AddItem(str);
ReArrange(GetCount() - 1);
diff --git a/fpdfsdk/fxedit/include/fxet_edit.h b/fpdfsdk/fxedit/include/fxet_edit.h
index 71431de90a..aab26556b8 100644
--- a/fpdfsdk/fxedit/include/fxet_edit.h
+++ b/fpdfsdk/fxedit/include/fxet_edit.h
@@ -73,76 +73,33 @@ struct CFX_Edit_LineRect {
class CFX_Edit_LineRectArray {
public:
- CFX_Edit_LineRectArray() {}
+ CFX_Edit_LineRectArray();
+ virtual ~CFX_Edit_LineRectArray();
- virtual ~CFX_Edit_LineRectArray() { Empty(); }
+ void Empty();
+ void RemoveAll();
+ void operator=(CFX_Edit_LineRectArray& rects);
+ void Add(const CPVT_WordRange& wrLine, const CFX_FloatRect& rcLine);
- void Empty() {
- for (int32_t i = 0, sz = m_LineRects.GetSize(); i < sz; i++)
- delete m_LineRects.GetAt(i);
-
- m_LineRects.RemoveAll();
- }
-
- void RemoveAll() { m_LineRects.RemoveAll(); }
-
- void operator=(CFX_Edit_LineRectArray& rects) {
- Empty();
- for (int32_t i = 0, sz = rects.GetSize(); i < sz; i++)
- m_LineRects.Add(rects.GetAt(i));
-
- rects.RemoveAll();
- }
-
- void Add(const CPVT_WordRange& wrLine, const CFX_FloatRect& rcLine) {
- m_LineRects.Add(new CFX_Edit_LineRect(wrLine, rcLine));
- }
-
- int32_t GetSize() const { return m_LineRects.GetSize(); }
-
- CFX_Edit_LineRect* GetAt(int32_t nIndex) const {
- if (nIndex < 0 || nIndex >= m_LineRects.GetSize())
- return nullptr;
-
- return m_LineRects.GetAt(nIndex);
- }
+ int32_t GetSize() const;
+ CFX_Edit_LineRect* GetAt(int32_t nIndex) const;
+ private:
CFX_ArrayTemplate<CFX_Edit_LineRect*> m_LineRects;
};
class CFX_Edit_RectArray {
public:
- CFX_Edit_RectArray() {}
-
- virtual ~CFX_Edit_RectArray() { Empty(); }
-
- void Empty() {
- for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++)
- delete m_Rects.GetAt(i);
+ CFX_Edit_RectArray();
+ virtual ~CFX_Edit_RectArray();
- m_Rects.RemoveAll();
- }
-
- void Add(const CFX_FloatRect& rect) {
- // check for overlapped area
- for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++) {
- CFX_FloatRect* pRect = m_Rects.GetAt(i);
- if (pRect && pRect->Contains(rect))
- return;
- }
-
- m_Rects.Add(new CFX_FloatRect(rect));
- }
+ void Empty();
+ void Add(const CFX_FloatRect& rect);
- int32_t GetSize() const { return m_Rects.GetSize(); }
-
- CFX_FloatRect* GetAt(int32_t nIndex) const {
- if (nIndex < 0 || nIndex >= m_Rects.GetSize())
- return nullptr;
-
- return m_Rects.GetAt(nIndex);
- }
+ int32_t GetSize() const;
+ CFX_FloatRect* GetAt(int32_t nIndex) const;
+ private:
CFX_ArrayTemplate<CFX_FloatRect*> m_Rects;
};
@@ -167,39 +124,18 @@ class CFX_Edit_Refresh {
class CFX_Edit_Select {
public:
- CFX_Edit_Select() {}
-
- CFX_Edit_Select(const CPVT_WordPlace& begin, const CPVT_WordPlace& end) {
- Set(begin, end);
- }
-
- explicit CFX_Edit_Select(const CPVT_WordRange& range) {
- Set(range.BeginPos, range.EndPos);
- }
-
- CPVT_WordRange ConvertToWordRange() const {
- return CPVT_WordRange(BeginPos, EndPos);
- }
-
- void Default() {
- BeginPos.Default();
- EndPos.Default();
- }
-
- void Set(const CPVT_WordPlace& begin, const CPVT_WordPlace& end) {
- BeginPos = begin;
- EndPos = end;
- }
+ CFX_Edit_Select();
+ CFX_Edit_Select(const CPVT_WordPlace& begin, const CPVT_WordPlace& end);
+ explicit CFX_Edit_Select(const CPVT_WordRange& range);
- void SetBeginPos(const CPVT_WordPlace& begin) { BeginPos = begin; }
+ void Default();
+ void Set(const CPVT_WordPlace& begin, const CPVT_WordPlace& end);
+ void SetBeginPos(const CPVT_WordPlace& begin);
+ void SetEndPos(const CPVT_WordPlace& end);
- void SetEndPos(const CPVT_WordPlace& end) { EndPos = end; }
-
- FX_BOOL IsExist() const { return BeginPos != EndPos; }
-
- FX_BOOL operator!=(const CPVT_WordRange& wr) const {
- return wr.BeginPos != BeginPos || wr.EndPos != EndPos;
- }
+ CPVT_WordRange ConvertToWordRange() const;
+ FX_BOOL IsExist() const;
+ FX_BOOL operator!=(const CPVT_WordRange& wr) const;
CPVT_WordPlace BeginPos, EndPos;
};
@@ -244,15 +180,15 @@ class CFX_Edit_Undo {
class CFX_Edit_UndoItem : public IFX_Edit_UndoItem {
public:
- CFX_Edit_UndoItem() : m_bFirst(TRUE), m_bLast(TRUE) {}
- ~CFX_Edit_UndoItem() override {}
+ CFX_Edit_UndoItem();
+ ~CFX_Edit_UndoItem() override;
- CFX_WideString GetUndoTitle() override { return L""; }
+ CFX_WideString GetUndoTitle() override;
- void SetFirst(FX_BOOL bFirst) { m_bFirst = bFirst; }
- FX_BOOL IsFirst() { return m_bFirst; }
- void SetLast(FX_BOOL bLast) { m_bLast = bLast; }
- FX_BOOL IsLast() { return m_bLast; }
+ void SetFirst(FX_BOOL bFirst);
+ FX_BOOL IsFirst();
+ void SetLast(FX_BOOL bLast);
+ FX_BOOL IsLast();
private:
FX_BOOL m_bFirst;
@@ -264,6 +200,7 @@ class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem {
explicit CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle);
~CFX_Edit_GroupUndoItem() override;
+ // IFX_Edit_UndoItem
void Undo() override;
void Redo() override;
CFX_WideString GetUndoTitle() override;
diff --git a/fpdfsdk/fxedit/include/fxet_list.h b/fpdfsdk/fxedit/include/fxet_list.h
index ab4605169b..a763db52da 100644
--- a/fpdfsdk/fxedit/include/fxet_list.h
+++ b/fpdfsdk/fxedit/include/fxet_list.h
@@ -142,11 +142,10 @@ class CFX_ListItem final {
class CFX_ListContainer {
public:
- CFX_ListContainer()
- : m_rcPlate(0.0f, 0.0f, 0.0f, 0.0f),
- m_rcContent(0.0f, 0.0f, 0.0f, 0.0f) {}
- virtual ~CFX_ListContainer() {}
- virtual void SetPlateRect(const CFX_FloatRect& rect) { m_rcPlate = rect; }
+ CFX_ListContainer();
+ virtual ~CFX_ListContainer();
+ virtual void SetPlateRect(const CFX_FloatRect& rect);
+
CFX_FloatRect GetPlateRect() const { return m_rcPlate; }
void SetContentRect(const CLST_Rect& rect) { m_rcContent = rect; }
CLST_Rect GetContentRect() const { return m_rcContent; }
@@ -297,8 +296,8 @@ class CFX_ListCtrl : public CFX_List {
void SetScrollPos(const CFX_FloatPoint& point) override;
void ScrollToListItem(int32_t nItemIndex) override;
CFX_FloatRect GetItemRect(int32_t nIndex) const override;
- int32_t GetCaret() const override { return m_nCaretIndex; }
- int32_t GetSelect() const override { return m_nSelItem; }
+ int32_t GetCaret() const override;
+ int32_t GetSelect() const override;
int32_t GetTopItem() const override;
CFX_FloatRect GetContentRect() const override;
int32_t GetItemIndex(const CFX_FloatPoint& point) const override;