summaryrefslogtreecommitdiff
path: root/xfa/fgas/layout/cfx_break.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/cfx_break.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/cfx_break.h')
-rw-r--r--xfa/fgas/layout/cfx_break.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/xfa/fgas/layout/cfx_break.h b/xfa/fgas/layout/cfx_break.h
new file mode 100644
index 0000000000..d1bbde0682
--- /dev/null
+++ b/xfa/fgas/layout/cfx_break.h
@@ -0,0 +1,81 @@
+// Copyright 2017 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_BREAK_H_
+#define XFA_FGAS_LAYOUT_CFX_BREAK_H_
+
+#include <stdint.h>
+
+#include "core/fxcrt/cfx_retain_ptr.h"
+#include "xfa/fgas/font/cfgas_gefont.h"
+#include "xfa/fgas/layout/cfx_breakline.h"
+
+struct FX_TPO {
+ bool operator<(const FX_TPO& that) const { return pos < that.pos; }
+
+ int32_t index;
+ int32_t pos;
+};
+
+enum FX_LAYOUTSTYLE {
+ FX_LAYOUTSTYLE_None = 0,
+ FX_LAYOUTSTYLE_Pagination = 0x01,
+ FX_LAYOUTSTYLE_ExpandTab = 0x10,
+ FX_LAYOUTSTYLE_SingleLine = 0x200,
+ FX_LAYOUTSTYLE_CombText = 0x400
+};
+
+class CFX_Break {
+ public:
+ virtual ~CFX_Break();
+
+ void SetLayoutStyles(uint32_t dwLayoutStyles);
+ uint32_t GetLayoutStyles() const { return m_dwLayoutStyles; }
+
+ void SetFont(const CFX_RetainPtr<CFGAS_GEFont>& pFont);
+ void SetFontSize(float fFontSize);
+ void SetTabWidth(float fTabWidth);
+
+ void SetHorizontalScale(int32_t iScale);
+ void SetVerticalScale(int32_t iScale);
+ void SetLineBreakTolerance(float fTolerance);
+ void SetLineBoundary(float fLineStart, float fLineEnd);
+
+ void SetCharSpace(float fCharSpace);
+ void SetParagraphBreakChar(wchar_t wch);
+ void SetDefaultChar(wchar_t wch);
+
+ virtual void SetBreakStatus() = 0;
+ virtual void ResetArabicContext() {}
+
+ protected:
+ explicit CFX_Break(uint32_t dwLayoutStyles);
+
+ FX_CHARTYPE m_eCharType;
+ bool m_bSingleLine;
+ bool m_bCombText;
+ uint32_t m_dwLayoutStyles;
+ int32_t m_iLineStart;
+ int32_t m_iLineWidth;
+ wchar_t m_wParagraphBreakChar;
+ int32_t m_iFontSize;
+ int32_t m_iTabWidth;
+ int32_t m_iHorizontalScale;
+ int32_t m_iVerticalScale;
+ int32_t m_iTolerance;
+ int32_t m_iCharSpace;
+ int32_t m_iDefChar;
+ wchar_t m_wDefChar;
+ CFX_RetainPtr<CFGAS_GEFont> m_pFont;
+ CFX_BreakLine m_Line[2];
+ CFX_BreakLine* m_pCurLine;
+ int8_t m_iReadyLineIndex;
+
+ private:
+ void FontChanged();
+};
+
+#endif // XFA_FGAS_LAYOUT_CFX_BREAK_H_