summaryrefslogtreecommitdiff
path: root/xfa/fgas/layout/fgas_textbreak.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-03-16 11:47:20 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-03-16 18:21:03 +0000
commite533b93601c7e9eb328619681a78c188d1a89191 (patch)
tree0e3741cec1296a39e478c67eeac3ecc9c000fc24 /xfa/fgas/layout/fgas_textbreak.h
parentc9819a972830e9d1210d9d8f5c81d9f03f7c90a9 (diff)
downloadpdfium-e533b93601c7e9eb328619681a78c188d1a89191.tar.xz
Create common base class for TxtBreak and RTFBreak.
This CL starts extracting common members between the two break classes into a common base class. This also normalizes some of the member names to be the same across classes. Change-Id: I7f4e5065f2dac79eb4ebba397458236cc0609d38 Reviewed-on: https://pdfium-review.googlesource.com/3058 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fgas/layout/fgas_textbreak.h')
-rw-r--r--xfa/fgas/layout/fgas_textbreak.h49
1 files changed, 5 insertions, 44 deletions
diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h
index d4aa1418e7..054fe39344 100644
--- a/xfa/fgas/layout/fgas_textbreak.h
+++ b/xfa/fgas/layout/fgas_textbreak.h
@@ -15,14 +15,11 @@
#include "core/fxge/cfx_renderdevice.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_txtedtpage.h"
-#include "xfa/fgas/layout/cfx_breakline.h"
+#include "xfa/fgas/layout/cfx_break.h"
class CFGAS_GEFont;
struct FDE_TEXTEDITPIECE;
-#define FX_TXTLAYOUTSTYLE_SingleLine 0x0200
-#define FX_TXTLAYOUTSTYLE_CombText 0x0400
-
#define FX_TXTCHARSTYLE_ArabicShadda 0x0020
#define FX_TXTCHARSTYLE_OddBidiLevel 0x0040
@@ -33,13 +30,6 @@ enum CFX_TxtLineAlignment {
CFX_TxtLineAlignment_Justified = 1 << 2
};
-struct FX_TPO {
- int32_t index;
- int32_t pos;
-
- bool operator<(const FX_TPO& that) const { return pos < that.pos; }
-};
-
inline bool CFX_BreakTypeNoneOrPiece(CFX_BreakType type) {
return type == CFX_BreakType::None || type == CFX_BreakType::Piece;
}
@@ -65,22 +55,12 @@ struct FX_TXTRUN {
bool bSkipSpace;
};
-class CFX_TxtBreak {
+class CFX_TxtBreak : public CFX_Break {
public:
CFX_TxtBreak();
- ~CFX_TxtBreak();
+ ~CFX_TxtBreak() override;
void SetLineWidth(float fLineWidth);
- uint32_t GetLayoutStyles() const { return m_dwLayoutStyles; }
- void SetLayoutStyles(uint32_t dwLayoutStyles);
- void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont);
- void SetFontSize(float fFontSize);
- void SetTabWidth(float fTabWidth, bool bEquidistant);
- void SetDefaultChar(wchar_t wch);
- void SetParagraphBreakChar(wchar_t wch);
- void SetLineBreakTolerance(float fTolerance);
- void SetHorizontalScale(int32_t iScale);
- void SetCharSpace(float fCharSpace);
void SetAlignment(int32_t iAlignment);
void SetCombWidth(float fCombWidth);
CFX_BreakType EndBreak(CFX_BreakType dwStatus);
@@ -103,12 +83,11 @@ class CFX_TxtBreak {
CFX_BreakType AppendChar_Others(CFX_Char* pCurChar);
private:
- void FontChanged();
- void SetBreakStatus();
+ void SetBreakStatus() override;
CFX_Char* GetLastChar(int32_t index, bool bOmitChar = true) const;
bool HasTxtLine() const { return m_iReadyLineIndex >= 0; }
FX_CHARTYPE GetUnifiedCharType(FX_CHARTYPE dwType) const;
- void ResetArabicContext();
+ void ResetArabicContext() override;
void ResetContextCharStyles();
bool EndBreak_SplitLine(CFX_BreakLine* pNextLine, bool bAllChars);
void EndBreak_BidiLine(std::deque<FX_TPO>* tpos, CFX_BreakType dwStatus);
@@ -123,30 +102,12 @@ class CFX_TxtBreak {
CFX_BreakLine* pNextLine,
bool bAllChars = false);
- int32_t m_iLineWidth;
- uint32_t m_dwLayoutStyles;
- bool m_bSingleLine;
- bool m_bCombText;
- bool m_bEquidistant;
int32_t m_iArabicContext;
int32_t m_iCurArabicContext;
- CFX_RetainPtr<CFGAS_GEFont> m_pFont;
- int32_t m_iFontSize;
- int32_t m_iTabWidth;
- wchar_t m_wDefChar;
- wchar_t m_wParagBreakChar;
- int32_t m_iDefChar;
int32_t m_iAlignment;
uint32_t m_dwContextCharStyles;
int32_t m_iCombWidth;
- FX_CHARTYPE m_eCharType;
int32_t m_iCurAlignment;
- CFX_BreakLine m_TxtLine[2];
- CFX_BreakLine* m_pCurLine;
- int32_t m_iTolerance;
- int32_t m_iHorScale;
- int32_t m_iCharSpace;
- int8_t m_iReadyLineIndex;
};
#endif // XFA_FGAS_LAYOUT_FGAS_TEXTBREAK_H_