From 575898e6251c1dbb8de0d40a5b6ce90762aa2af2 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 13 Mar 2017 10:16:05 -0400 Subject: Remove some single use interfaces Remove interfaces which are only implemented once. Change-Id: I73ceaa7bfd7ef2a630479c7eebed5e32ecb99940 Reviewed-on: https://pdfium-review.googlesource.com/2944 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- xfa/fde/cfde_txtedtengine.cpp | 18 +++++++------- xfa/fde/cfde_txtedtengine.h | 5 ++-- xfa/fde/cfde_txtedtpage.cpp | 7 +----- xfa/fde/cfde_txtedtpage.h | 50 +++++++++++++++++--------------------- xfa/fde/cfde_txtedttextset.cpp | 1 + xfa/fde/cfde_txtedttextset.h | 15 ++++++------ xfa/fde/fde_iterator.cpp | 7 +++--- xfa/fde/fde_iterator.h | 8 +++--- xfa/fde/fde_render.cpp | 7 +++--- xfa/fde/fde_render.h | 5 ++-- xfa/fde/fde_visualset.h | 22 ----------------- xfa/fde/ifde_txtedtengine.h | 1 - xfa/fde/ifde_txtedtpage.h | 43 -------------------------------- xfa/fgas/layout/fgas_textbreak.cpp | 4 +-- xfa/fgas/layout/fgas_textbreak.h | 13 ++-------- xfa/fwl/cfwl_edit.cpp | 26 ++++++++++---------- 16 files changed, 76 insertions(+), 156 deletions(-) delete mode 100644 xfa/fde/ifde_txtedtpage.h (limited to 'xfa') diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp index a22ed7064f..0a955ff60f 100644 --- a/xfa/fde/cfde_txtedtengine.cpp +++ b/xfa/fde/cfde_txtedtengine.cpp @@ -99,7 +99,7 @@ int32_t CFDE_TxtEdtEngine::CountPages() const { return ((m_nLineCount - 1) / m_nPageLineCount) + 1; } -IFDE_TxtEdtPage* CFDE_TxtEdtEngine::GetPage(int32_t nIndex) { +CFDE_TxtEdtPage* CFDE_TxtEdtEngine::GetPage(int32_t nIndex) { if (m_PagePtrArray.GetSize() <= nIndex) { return nullptr; } @@ -993,7 +993,7 @@ void CFDE_TxtEdtEngine::UpdatePages() { } if (nSize < nPageCount) { for (int32_t i = nSize; i < nPageCount; i++) - m_PagePtrArray.Add(IFDE_TxtEdtPage::Create(this, i)); + m_PagePtrArray.Add(new CFDE_TxtEdtPage(this, i)); return; } } @@ -1138,7 +1138,7 @@ int32_t CFDE_TxtEdtEngine::MovePage2Char(int32_t nIndex) { ASSERT(nIndex >= 0); ASSERT(nIndex <= m_pTxtBuf->GetTextLength()); if (m_nCaretPage >= 0) { - IFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage]; + CFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage]; m_Param.pEventSink->OnPageLoad(m_nCaretPage); int32_t nPageCharStart = pPage->GetCharStart(); int32_t nPageCharCount = pPage->GetCharCount(); @@ -1232,7 +1232,7 @@ int32_t CFDE_TxtEdtEngine::MoveBackward(bool& bBefore) { } bool CFDE_TxtEdtEngine::MoveUp(CFX_PointF& ptCaret) { - IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage); + CFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage); const CFX_RectF& rtContent = pPage->GetContentsBox(); ptCaret.x = m_fCaretPosReserve; ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 - m_Param.fLineSpace; @@ -1242,7 +1242,7 @@ bool CFDE_TxtEdtEngine::MoveUp(CFX_PointF& ptCaret) { } ptCaret.y -= rtContent.top; m_nCaretPage--; - IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); + CFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); ptCaret.y += pCurPage->GetContentsBox().bottom(); } @@ -1250,7 +1250,7 @@ bool CFDE_TxtEdtEngine::MoveUp(CFX_PointF& ptCaret) { } bool CFDE_TxtEdtEngine::MoveDown(CFX_PointF& ptCaret) { - IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage); + CFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage); const CFX_RectF& rtContent = pPage->GetContentsBox(); ptCaret.x = m_fCaretPosReserve; ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 + m_Param.fLineSpace; @@ -1260,7 +1260,7 @@ bool CFDE_TxtEdtEngine::MoveDown(CFX_PointF& ptCaret) { } ptCaret.y -= rtContent.bottom(); m_nCaretPage++; - IFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); + CFDE_TxtEdtPage* pCurPage = GetPage(m_nCaretPage); ptCaret.y += pCurPage->GetContentsBox().top; } return true; @@ -1409,7 +1409,7 @@ void CFDE_TxtEdtEngine::GetCaretRect(CFX_RectF& rtCaret, int32_t nPageIndex, int32_t nCaret, bool bBefore) { - IFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage]; + CFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage]; m_Param.pEventSink->OnPageLoad(m_nCaretPage); bool bCombText = !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText); int32_t nIndexInpage = nCaret - pPage->GetCharStart(); @@ -1431,7 +1431,7 @@ void CFDE_TxtEdtEngine::GetCaretRect(CFX_RectF& rtCaret, } void CFDE_TxtEdtEngine::UpdateCaretIndex(const CFX_PointF& ptCaret) { - IFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage]; + CFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage]; m_Param.pEventSink->OnPageLoad(m_nCaretPage); m_nCaret = pPage->GetCharIndex(ptCaret, m_bBefore); GetCaretRect(m_rtCaret, m_nCaretPage, m_nCaret, m_bBefore); diff --git a/xfa/fde/cfde_txtedtengine.h b/xfa/fde/cfde_txtedtengine.h index 6918d6305f..ee1cc1015d 100644 --- a/xfa/fde/cfde_txtedtengine.h +++ b/xfa/fde/cfde_txtedtengine.h @@ -13,6 +13,7 @@ #include "xfa/fde/ifde_txtedtengine.h" class CFDE_TxtEdtBuf; +class CFDE_TxtEdtPage; class CFDE_TxtEdtParag; class CFX_TxtBreak; class IFDE_TxtEdtDoRecord; @@ -27,7 +28,7 @@ class CFDE_TxtEdtEngine { FDE_TXTEDTPARAMS* GetEditParams(); int32_t CountPages() const; - IFDE_TxtEdtPage* GetPage(int32_t nIndex); + CFDE_TxtEdtPage* GetPage(int32_t nIndex); void SetTextByStream(const CFX_RetainPtr& pStream); void SetText(const CFX_WideString& wsText); @@ -149,7 +150,7 @@ class CFDE_TxtEdtEngine { std::unique_ptr m_pTxtBuf; std::unique_ptr m_pTextBreak; FDE_TXTEDTPARAMS m_Param; - CFX_ArrayTemplate m_PagePtrArray; + CFX_ArrayTemplate m_PagePtrArray; CFX_ArrayTemplate m_ParagPtrArray; CFX_ArrayTemplate m_SelRangePtrArr; int32_t m_nPageLineCount; diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp index 12333c608d..7a2cb1b18d 100644 --- a/xfa/fde/cfde_txtedtpage.cpp +++ b/xfa/fde/cfde_txtedtpage.cpp @@ -16,7 +16,7 @@ #include "xfa/fde/cfde_txtedttextset.h" #include "xfa/fde/cfx_wordbreak.h" #include "xfa/fde/ifde_txtedtengine.h" -#include "xfa/fde/ifde_txtedtpage.h" +#include "xfa/fgas/layout/fgas_textbreak.h" namespace { @@ -24,11 +24,6 @@ const double kTolerance = 0.1f; } // namespace -IFDE_TxtEdtPage* IFDE_TxtEdtPage::Create(CFDE_TxtEdtEngine* pEngine, - int32_t nIndex) { - return new CFDE_TxtEdtPage(pEngine, nIndex); -} - CFDE_TxtEdtPage::CFDE_TxtEdtPage(CFDE_TxtEdtEngine* pEngine, int32_t nPageIndex) : m_pEditEngine(pEngine), m_pBgnParag(nullptr), diff --git a/xfa/fde/cfde_txtedtpage.h b/xfa/fde/cfde_txtedtpage.h index 63ec7e7cf3..6d700d202c 100644 --- a/xfa/fde/cfde_txtedtpage.h +++ b/xfa/fde/cfde_txtedtpage.h @@ -11,52 +11,46 @@ #include #include -#include "xfa/fde/ifde_txtedtpage.h" +#include "xfa/fde/fde_visualset.h" #include "xfa/fde/ifx_chariter.h" class CFDE_TxtEdtEngine; class CFDE_TxtEdtParag; class CFDE_TxtEdtTextSet; -class CFDE_TxtEdtPage : public IFDE_TxtEdtPage { +class CFDE_TxtEdtPage : public IFDE_VisualSet { public: CFDE_TxtEdtPage(CFDE_TxtEdtEngine* pEngine, int32_t nLineIndex); ~CFDE_TxtEdtPage() override; - // IFDE_TxtEditPage: - CFDE_TxtEdtEngine* GetEngine() const override; + // IFDE_VisualSet: + FDE_VISUALOBJTYPE GetType() override; + CFX_RectF GetRect(const FDE_TEXTEDITPIECE& pPiece) override; + + CFDE_TxtEdtEngine* GetEngine() const; int32_t GetCharRect(int32_t nIndex, CFX_RectF& rect, - bool bBBox = false) const override; - int32_t GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) override; + bool bBBox = false) const; + int32_t GetCharIndex(const CFX_PointF& fPoint, bool& bBefore); void CalcRangeRectArray(int32_t nStart, int32_t nCount, - std::vector* RectFArr) const override; - int32_t SelectWord(const CFX_PointF& fPoint, int32_t& nCount) override; - int32_t GetCharStart() const override; - int32_t GetCharCount() const override; + std::vector* RectFArr) const; + int32_t SelectWord(const CFX_PointF& fPoint, int32_t& nCount); + int32_t GetCharStart() const; + int32_t GetCharCount() const; int32_t GetDisplayPos(const CFX_RectF& rtClip, FXTEXT_CHARPOS*& pCharPos, - CFX_RectF* pBBox) const override; - bool IsLoaded(const CFX_RectF* pClipBox) override; - int32_t LoadPage(const CFX_RectF* pClipBox, IFX_Pause* pPause) override; - void UnloadPage(const CFX_RectF* pClipBox) override; - const CFX_RectF& GetContentsBox() override; - - // IFDE_VisualSet: - FDE_VISUALOBJTYPE GetType() override; - CFX_RectF GetRect(const FDE_TEXTEDITPIECE& pPiece) override; + CFX_RectF* pBBox) const; + bool IsLoaded(const CFX_RectF* pClipBox); + int32_t LoadPage(const CFX_RectF* pClipBox, IFX_Pause* pPause); + void UnloadPage(const CFX_RectF* pClipBox); + const CFX_RectF& GetContentsBox(); - // IFDE_CanvasSet: - FX_POSITION GetFirstPosition() override; - FDE_TEXTEDITPIECE* GetNext(FX_POSITION& pos, - IFDE_VisualSet*& pVisualSet) override; + FX_POSITION GetFirstPosition(); + FDE_TEXTEDITPIECE* GetNext(FX_POSITION& pos, IFDE_VisualSet*& pVisualSet); - // IFX_TxtAccess: - FX_WCHAR GetChar(const FDE_TEXTEDITPIECE* pIdentity, - int32_t index) const override; - int32_t GetWidth(const FDE_TEXTEDITPIECE* pIdentity, - int32_t index) const override; + FX_WCHAR GetChar(const FDE_TEXTEDITPIECE* pIdentity, int32_t index) const; + int32_t GetWidth(const FDE_TEXTEDITPIECE* pIdentity, int32_t index) const; private: void NormalizePt2Rect(CFX_PointF& ptF, diff --git a/xfa/fde/cfde_txtedttextset.cpp b/xfa/fde/cfde_txtedttextset.cpp index e13663457d..1f86dabcdd 100644 --- a/xfa/fde/cfde_txtedttextset.cpp +++ b/xfa/fde/cfde_txtedttextset.cpp @@ -9,6 +9,7 @@ #include "xfa/fde/cfde_txtedtengine.h" #include "xfa/fde/cfde_txtedtpage.h" #include "xfa/fgas/font/cfgas_gefont.h" +#include "xfa/fgas/layout/fgas_textbreak.h" CFDE_TxtEdtTextSet::CFDE_TxtEdtTextSet(CFDE_TxtEdtPage* pPage) : m_pPage(pPage) {} diff --git a/xfa/fde/cfde_txtedttextset.h b/xfa/fde/cfde_txtedttextset.h index 8ab6578793..8046d38d79 100644 --- a/xfa/fde/cfde_txtedttextset.h +++ b/xfa/fde/cfde_txtedttextset.h @@ -13,7 +13,7 @@ class CFDE_TxtEdtPage; -class CFDE_TxtEdtTextSet : public IFDE_TextSet { +class CFDE_TxtEdtTextSet : public IFDE_VisualSet { public: explicit CFDE_TxtEdtTextSet(CFDE_TxtEdtPage* pPage); ~CFDE_TxtEdtTextSet() override; @@ -22,17 +22,16 @@ class CFDE_TxtEdtTextSet : public IFDE_TextSet { FDE_VISUALOBJTYPE GetType() override; CFX_RectF GetRect(const FDE_TEXTEDITPIECE& hVisualObj) override; - // IFDE_TextSet - int32_t GetString(FDE_TEXTEDITPIECE* pPiece, CFX_WideString& wsText) override; - CFX_RetainPtr GetFont() override; - FX_FLOAT GetFontSize() override; - FX_ARGB GetFontColor() override; + int32_t GetString(FDE_TEXTEDITPIECE* pPiece, CFX_WideString& wsText); + CFX_RetainPtr GetFont(); + FX_FLOAT GetFontSize(); + FX_ARGB GetFontColor(); int32_t GetDisplayPos(const FDE_TEXTEDITPIECE& pPiece, FXTEXT_CHARPOS* pCharPos, bool bCharCode = false, - CFX_WideString* pWSForms = nullptr) override; + CFX_WideString* pWSForms = nullptr); std::vector GetCharRects(const FDE_TEXTEDITPIECE* pPiece, - bool bBBox) override; + bool bBBox); private: CFDE_TxtEdtPage* const m_pPage; diff --git a/xfa/fde/fde_iterator.cpp b/xfa/fde/fde_iterator.cpp index 9c1adf6e80..8cbaa33383 100644 --- a/xfa/fde/fde_iterator.cpp +++ b/xfa/fde/fde_iterator.cpp @@ -6,13 +6,14 @@ #include "xfa/fde/fde_iterator.h" +#include "xfa/fde/cfde_txtedtpage.h" #include "xfa/fgas/crt/fgas_utils.h" CFDE_VisualSetIterator::CFDE_VisualSetIterator() : m_dwFilter(0) {} CFDE_VisualSetIterator::~CFDE_VisualSetIterator() {} -bool CFDE_VisualSetIterator::AttachCanvas(IFDE_CanvasSet* pCanvas) { +bool CFDE_VisualSetIterator::AttachCanvas(CFDE_TxtEdtPage* pCanvas) { ASSERT(pCanvas); m_CanvasStack = std::stack(); @@ -50,7 +51,7 @@ void CFDE_VisualSetIterator::Reset() { FDE_TEXTEDITPIECE* CFDE_VisualSetIterator::GetNext( IFDE_VisualSet*& pVisualSet, FDE_TEXTEDITPIECE** phCanvasObj, - IFDE_CanvasSet** ppCanvasSet) { + CFDE_TxtEdtPage** ppCanvasSet) { while (!m_CanvasStack.empty()) { FDE_CANVASITEM* pCanvas = &m_CanvasStack.top(); if (!pCanvas->hPos) { @@ -69,7 +70,7 @@ FDE_TEXTEDITPIECE* CFDE_VisualSetIterator::GetNext( if (eType == FDE_VISUALOBJ_Canvas) { FDE_CANVASITEM canvas; canvas.hCanvas = pObj; - canvas.pCanvas = static_cast(pVisualSet); + canvas.pCanvas = static_cast(pVisualSet); canvas.hPos = canvas.pCanvas->GetFirstPosition(); m_CanvasStack.push(canvas); break; diff --git a/xfa/fde/fde_iterator.h b/xfa/fde/fde_iterator.h index a2cd931e39..3cd3a6fa19 100644 --- a/xfa/fde/fde_iterator.h +++ b/xfa/fde/fde_iterator.h @@ -12,8 +12,10 @@ #include "xfa/fde/fde_visualset.h" #include "xfa/fgas/crt/fgas_utils.h" +class CFDE_TxtEdtPage; + struct FDE_CANVASITEM { - IFDE_CanvasSet* pCanvas; + CFDE_TxtEdtPage* pCanvas; FDE_TEXTEDITPIECE* hCanvas; FX_POSITION hPos; }; @@ -23,13 +25,13 @@ class CFDE_VisualSetIterator { CFDE_VisualSetIterator(); ~CFDE_VisualSetIterator(); - bool AttachCanvas(IFDE_CanvasSet* pCanvas); + bool AttachCanvas(CFDE_TxtEdtPage* pCanvas); bool FilterObjects(uint32_t dwObjects = 0xFFFFFFFF); void Reset(); FDE_TEXTEDITPIECE* GetNext(IFDE_VisualSet*& pVisualSet, FDE_TEXTEDITPIECE** phCanvasObj = nullptr, - IFDE_CanvasSet** ppCanvasSet = nullptr); + CFDE_TxtEdtPage** ppCanvasSet = nullptr); protected: uint32_t m_dwFilter; diff --git a/xfa/fde/fde_render.cpp b/xfa/fde/fde_render.cpp index b6a8f7edd0..371f9ca9e2 100644 --- a/xfa/fde/fde_render.cpp +++ b/xfa/fde/fde_render.cpp @@ -7,6 +7,7 @@ #include "xfa/fde/fde_render.h" #include "third_party/base/ptr_util.h" +#include "xfa/fde/cfde_txtedttextset.h" #include "xfa/fde/fde_gedevice.h" #include "xfa/fde/fde_object.h" @@ -25,7 +26,7 @@ CFDE_RenderContext::~CFDE_RenderContext() { } bool CFDE_RenderContext::StartRender(CFDE_RenderDevice* pRenderDevice, - IFDE_CanvasSet* pCanvasSet, + CFDE_TxtEdtPage* pCanvasSet, const CFX_Matrix& tmDoc2Device) { if (m_pRenderDevice) return false; @@ -73,7 +74,7 @@ FDE_RENDERSTATUS CFDE_RenderContext::DoRender(IFX_Pause* pPause) { switch (pVisualSet->GetType()) { case FDE_VISUALOBJ_Text: - RenderText(static_cast(pVisualSet), pPiece); + RenderText(static_cast(pVisualSet), pPiece); iCount += 5; break; case FDE_VISUALOBJ_Canvas: @@ -99,7 +100,7 @@ void CFDE_RenderContext::StopRender() { m_CharPos.clear(); } -void CFDE_RenderContext::RenderText(IFDE_TextSet* pTextSet, +void CFDE_RenderContext::RenderText(CFDE_TxtEdtTextSet* pTextSet, FDE_TEXTEDITPIECE* pText) { ASSERT(m_pRenderDevice); ASSERT(pTextSet && pText); diff --git a/xfa/fde/fde_render.h b/xfa/fde/fde_render.h index a24d6b5496..ba56754a3e 100644 --- a/xfa/fde/fde_render.h +++ b/xfa/fde/fde_render.h @@ -16,6 +16,7 @@ #include "xfa/fde/fde_visualset.h" class CFDE_RenderDevice; +class CFDE_TxtEdtTextSet; enum FDE_RENDERSTATUS { FDE_RENDERSTATUS_Reset = 0, @@ -30,12 +31,12 @@ class CFDE_RenderContext { ~CFDE_RenderContext(); bool StartRender(CFDE_RenderDevice* pRenderDevice, - IFDE_CanvasSet* pCanvasSet, + CFDE_TxtEdtPage* pCanvasSet, const CFX_Matrix& tmDoc2Device); FDE_RENDERSTATUS GetStatus() const { return m_eStatus; } FDE_RENDERSTATUS DoRender(IFX_Pause* pPause = nullptr); void StopRender(); - void RenderText(IFDE_TextSet* pTextSet, FDE_TEXTEDITPIECE* pText); + void RenderText(CFDE_TxtEdtTextSet* pTextSet, FDE_TEXTEDITPIECE* pText); protected: FDE_RENDERSTATUS m_eStatus; diff --git a/xfa/fde/fde_visualset.h b/xfa/fde/fde_visualset.h index 5cf02cde9c..e9ee9ab815 100644 --- a/xfa/fde/fde_visualset.h +++ b/xfa/fde/fde_visualset.h @@ -47,26 +47,4 @@ class IFDE_VisualSet { virtual CFX_RectF GetRect(const FDE_TEXTEDITPIECE& hVisualObj) = 0; }; -class IFDE_CanvasSet : public IFDE_VisualSet { - public: - virtual FX_POSITION GetFirstPosition() = 0; - virtual FDE_TEXTEDITPIECE* GetNext(FX_POSITION& pos, - IFDE_VisualSet*& pVisualSet) = 0; -}; - -class IFDE_TextSet : public IFDE_VisualSet { - public: - virtual int32_t GetString(FDE_TEXTEDITPIECE* hText, - CFX_WideString& wsText) = 0; - virtual CFX_RetainPtr GetFont() = 0; - virtual FX_FLOAT GetFontSize() = 0; - virtual FX_ARGB GetFontColor() = 0; - virtual int32_t GetDisplayPos(const FDE_TEXTEDITPIECE& hText, - FXTEXT_CHARPOS* pCharPos, - bool bCharCode = false, - CFX_WideString* pWSForms = nullptr) = 0; - virtual std::vector GetCharRects(const FDE_TEXTEDITPIECE* hText, - bool bbox) = 0; -}; - #endif // XFA_FDE_FDE_VISUALSET_H_ diff --git a/xfa/fde/ifde_txtedtengine.h b/xfa/fde/ifde_txtedtengine.h index d511949c4b..67944e01f9 100644 --- a/xfa/fde/ifde_txtedtengine.h +++ b/xfa/fde/ifde_txtedtengine.h @@ -11,7 +11,6 @@ #include "xfa/fgas/font/cfgas_fontmgr.h" class CFDE_TxtEdtEngine; -class IFDE_TxtEdtPage; class CFWL_Edit; #define FDE_TEXTEDITMODE_MultiLines (1L << 0) diff --git a/xfa/fde/ifde_txtedtpage.h b/xfa/fde/ifde_txtedtpage.h deleted file mode 100644 index 0ab3897b3c..0000000000 --- a/xfa/fde/ifde_txtedtpage.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FDE_IFDE_TXTEDTPAGE_H_ -#define XFA_FDE_IFDE_TXTEDTPAGE_H_ - -#include - -#include "xfa/fde/fde_visualset.h" -#include "xfa/fgas/layout/fgas_textbreak.h" - -class CFDE_TxtEdtEngine; - -class IFDE_TxtEdtPage : public IFDE_CanvasSet, public IFX_TxtAccess { - public: - static IFDE_TxtEdtPage* Create(CFDE_TxtEdtEngine* pEngine, int32_t nIndex); - ~IFDE_TxtEdtPage() override {} - - virtual CFDE_TxtEdtEngine* GetEngine() const = 0; - virtual int32_t GetCharRect(int32_t nIndex, - CFX_RectF& rect, - bool bBBox = false) const = 0; - virtual int32_t GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) = 0; - virtual void CalcRangeRectArray(int32_t nStart, - int32_t nCount, - std::vector* 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; - - virtual int32_t GetDisplayPos(const CFX_RectF& rtClip, - FXTEXT_CHARPOS*& pCharPos, - CFX_RectF* pBBox) const = 0; - virtual bool IsLoaded(const CFX_RectF* pClipBox) = 0; - virtual int32_t LoadPage(const CFX_RectF* pClipBox, IFX_Pause* pPause) = 0; - virtual void UnloadPage(const CFX_RectF* pClipBox) = 0; - virtual const CFX_RectF& GetContentsBox() = 0; -}; - -#endif // XFA_FDE_IFDE_TXTEDTPAGE_H_ diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp index 6442f1fb55..68930db919 100644 --- a/xfa/fgas/layout/fgas_textbreak.cpp +++ b/xfa/fgas/layout/fgas_textbreak.cpp @@ -874,7 +874,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, if (!pTxtRun || pTxtRun->iLength < 1) return 0; - IFX_TxtAccess* pAccess = pTxtRun->pAccess; + CFDE_TxtEdtPage* pAccess = pTxtRun->pAccess; const FDE_TEXTEDITPIECE* pIdentity = pTxtRun->pIdentity; const FX_WCHAR* pStr = pTxtRun->wsStr.c_str(); int32_t* pWidths = pTxtRun->pWidths; @@ -1138,7 +1138,7 @@ std::vector CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, if (!pTxtRun || pTxtRun->iLength < 1) return std::vector(); - IFX_TxtAccess* pAccess = pTxtRun->pAccess; + CFDE_TxtEdtPage* pAccess = pTxtRun->pAccess; const FDE_TEXTEDITPIECE* pIdentity = pTxtRun->pIdentity; const FX_WCHAR* pStr = pTxtRun->wsStr.c_str(); int32_t* pWidths = pTxtRun->pWidths; diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h index 0bc5768d78..1070a7bce4 100644 --- a/xfa/fgas/layout/fgas_textbreak.h +++ b/xfa/fgas/layout/fgas_textbreak.h @@ -14,13 +14,13 @@ #include "core/fxcrt/fx_ucd.h" #include "core/fxge/cfx_renderdevice.h" #include "third_party/base/stl_util.h" +#include "xfa/fde/cfde_txtedtpage.h" #include "xfa/fgas/crt/fgas_utils.h" class CFX_Char; class CFGAS_GEFont; class CFX_TxtChar; class CFX_TxtPiece; -class IFX_TxtAccess; struct FDE_TEXTEDITPIECE; #define FX_TXTLAYOUTSTYLE_SingleLine 0x0200 @@ -47,21 +47,12 @@ inline bool CFX_BreakTypeNoneOrPiece(CFX_BreakType type) { return type == CFX_BreakType::None || type == CFX_BreakType::Piece; } -class IFX_TxtAccess { - public: - virtual ~IFX_TxtAccess() {} - virtual FX_WCHAR GetChar(const FDE_TEXTEDITPIECE* pIdentity, - int32_t index) const = 0; - virtual int32_t GetWidth(const FDE_TEXTEDITPIECE* pIdentity, - int32_t index) const = 0; -}; - struct FX_TXTRUN { FX_TXTRUN(); FX_TXTRUN(const FX_TXTRUN& other); ~FX_TXTRUN(); - IFX_TxtAccess* pAccess; + CFDE_TxtEdtPage* pAccess; const FDE_TEXTEDITPIECE* pIdentity; CFX_WideString wsStr; int32_t* pWidths; diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index 62dc7e7e5b..a7c85d57b7 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -14,9 +14,9 @@ #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" #include "xfa/fde/cfde_txtedtengine.h" +#include "xfa/fde/cfde_txtedtpage.h" #include "xfa/fde/fde_gedevice.h" #include "xfa/fde/fde_render.h" -#include "xfa/fde/ifde_txtedtpage.h" #include "xfa/fgas/font/cfgas_gefont.h" #include "xfa/fwl/cfwl_app.h" #include "xfa/fwl/cfwl_caret.h" @@ -167,7 +167,7 @@ void CFWL_Edit::AddSpellCheckObj(CFX_Path& PathData, FX_FLOAT fEndX = 0.0f; FX_FLOAT fY = 0.0f; FX_FLOAT fStep = 0.0f; - IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); + CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); const FDE_TXTEDTPARAMS* txtEdtParams = m_EdtEngine.GetEditParams(); FX_FLOAT fAsent = static_cast(txtEdtParams->pFont->GetAscent()) * txtEdtParams->fFontSize / 1000; @@ -435,7 +435,7 @@ void CFWL_Edit::OnSelChanged() { } bool CFWL_Edit::OnPageLoad(int32_t nPageIndex) { - IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(nPageIndex); + CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(nPageIndex); if (!pPage) return false; @@ -444,7 +444,7 @@ bool CFWL_Edit::OnPageLoad(int32_t nPageIndex) { } bool CFWL_Edit::OnPageUnload(int32_t nPageIndex) { - IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(nPageIndex); + CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(nPageIndex); if (!pPage) return false; @@ -507,7 +507,7 @@ void CFWL_Edit::DrawTextBk(CFX_Graphics* pGraphics, void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix) { - IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); + CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); if (!pPage) return; @@ -695,7 +695,7 @@ void CFWL_Edit::UpdateEditLayout() { if (m_EdtEngine.GetTextLength() <= 0) m_EdtEngine.SetTextByStream(nullptr); - IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); + CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); if (pPage) pPage->UnloadPage(nullptr); @@ -715,7 +715,7 @@ bool CFWL_Edit::UpdateOffset() { rtCaret.Offset(fOffSetX, fOffSetY); const CFX_RectF& rtEidt = m_rtEngine; if (rtEidt.Contains(rtCaret)) { - IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); + CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); if (!pPage) return false; @@ -758,7 +758,7 @@ bool CFWL_Edit::UpdateOffset(CFWL_ScrollBar* pScrollBar, FX_FLOAT fPosChanged) { } void CFWL_Edit::UpdateVAlignment() { - IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); + CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); if (!pPage) return; @@ -828,7 +828,7 @@ CFWL_ScrollBar* CFWL_Edit::UpdateScroll() { if (!bShowHorz && !bShowVert) return nullptr; - IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); + CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); if (!pPage) return nullptr; @@ -904,7 +904,7 @@ bool CFWL_Edit::IsShowScrollBar(bool bVert) { } bool CFWL_Edit::IsContentHeightOverflow() { - IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); + CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); if (!pPage) return false; return pPage->GetContentsBox().height > m_rtEngine.height + 1.0f; @@ -1258,7 +1258,7 @@ void CFWL_Edit::DoButtonDown(CFWL_MessageMouse* pMsg) { if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) SetFocus(true); - IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); + CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); if (!pPage) return; @@ -1334,7 +1334,7 @@ void CFWL_Edit::OnLButtonUp(CFWL_MessageMouse* pMsg) { } void CFWL_Edit::OnButtonDblClk(CFWL_MessageMouse* pMsg) { - IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); + CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); if (!pPage) return; @@ -1352,7 +1352,7 @@ void CFWL_Edit::OnMouseMove(CFWL_MessageMouse* pMsg) { if (m_nSelStart == -1 || !m_bLButtonDown) return; - IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); + CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); if (!pPage) return; -- cgit v1.2.3