From 994acdc1a31015674e786d24cc37d08dfae6d863 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 18 Apr 2017 13:56:39 -0400 Subject: Rename text break files to match class names. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL renames several fgas/layout files to match the class names contained in the files. Change-Id: Ib4feaa902618e577261e51dbac743cb4cb500ea1 Reviewed-on: https://pdfium-review.googlesource.com/4290 Commit-Queue: dsinclair Reviewed-by: Tom Sepez Reviewed-by: Nicolás Peña --- xfa/fgas/layout/cfx_txtbreak.h | 102 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 xfa/fgas/layout/cfx_txtbreak.h (limited to 'xfa/fgas/layout/cfx_txtbreak.h') diff --git a/xfa/fgas/layout/cfx_txtbreak.h b/xfa/fgas/layout/cfx_txtbreak.h new file mode 100644 index 0000000000..0f11844453 --- /dev/null +++ b/xfa/fgas/layout/cfx_txtbreak.h @@ -0,0 +1,102 @@ +// 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_FGAS_LAYOUT_CFX_TXTBREAK_H_ +#define XFA_FGAS_LAYOUT_CFX_TXTBREAK_H_ + +#include +#include +#include + +#include "core/fxcrt/cfx_char.h" +#include "core/fxge/cfx_renderdevice.h" +#include "third_party/base/stl_util.h" +#include "xfa/fde/cfde_txtedtpage.h" +#include "xfa/fgas/layout/cfx_break.h" + +class CFGAS_GEFont; +struct FDE_TEXTEDITPIECE; + +#define FX_TXTCHARSTYLE_ArabicShadda 0x0020 +#define FX_TXTCHARSTYLE_OddBidiLevel 0x0040 + +enum CFX_TxtLineAlignment { + CFX_TxtLineAlignment_Left = 0, + CFX_TxtLineAlignment_Center = 1 << 0, + CFX_TxtLineAlignment_Right = 1 << 1, + CFX_TxtLineAlignment_Justified = 1 << 2 +}; + +inline bool CFX_BreakTypeNoneOrPiece(CFX_BreakType type) { + return type == CFX_BreakType::None || type == CFX_BreakType::Piece; +} + +struct FX_TXTRUN { + FX_TXTRUN(); + FX_TXTRUN(const FX_TXTRUN& other); + ~FX_TXTRUN(); + + CFDE_TxtEdtPage* pAccess; + const FDE_TEXTEDITPIECE* pIdentity; + CFX_WideString wsStr; + int32_t* pWidths; + int32_t iLength; + CFX_RetainPtr pFont; + float fFontSize; + uint32_t dwStyles; + int32_t iHorizontalScale; + int32_t iVerticalScale; + uint32_t dwCharStyles; + const CFX_RectF* pRect; + wchar_t wLineBreakChar; + bool bSkipSpace; +}; + +class CFX_TxtBreak : public CFX_Break { + public: + CFX_TxtBreak(); + ~CFX_TxtBreak() override; + + void SetLineWidth(float fLineWidth); + void SetAlignment(int32_t iAlignment); + void SetCombWidth(float fCombWidth); + CFX_BreakType EndBreak(CFX_BreakType dwStatus); + + int32_t GetDisplayPos(const FX_TXTRUN* pTxtRun, + FXTEXT_CHARPOS* pCharPos, + bool bCharCode = false, + CFX_WideString* pWSForms = nullptr) const; + std::vector GetCharRects(const FX_TXTRUN* pTxtRun, + bool bCharBBox = false) const; + CFX_BreakType AppendChar(wchar_t wch); + + private: + void AppendChar_Combination(CFX_Char* pCurChar); + void AppendChar_Tab(CFX_Char* pCurChar); + void AppendChar_PageLoad(CFX_Char* pCurChar, uint32_t dwProps); + CFX_BreakType AppendChar_Control(CFX_Char* pCurChar); + CFX_BreakType AppendChar_Arabic(CFX_Char* pCurChar); + CFX_BreakType AppendChar_Others(CFX_Char* pCurChar); + + void ResetContextCharStyles(); + bool EndBreak_SplitLine(CFX_BreakLine* pNextLine, bool bAllChars); + void EndBreak_BidiLine(std::deque* tpos, CFX_BreakType dwStatus); + void EndBreak_Alignment(const std::deque& tpos, + bool bAllChars, + CFX_BreakType dwStatus); + int32_t GetBreakPos(std::vector& ca, + int32_t& iEndPos, + bool bAllChars = false, + bool bOnlyBrk = false); + void SplitTextLine(CFX_BreakLine* pCurLine, + CFX_BreakLine* pNextLine, + bool bAllChars = false); + + int32_t m_iAlignment; + int32_t m_iCombWidth; +}; + +#endif // XFA_FGAS_LAYOUT_CFX_TXTBREAK_H_ -- cgit v1.2.3