• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #include "xfa/fxfa/app/cxfa_texttabstopscontext.h"
8 
CXFA_TextTabstopsContext()9 CXFA_TextTabstopsContext::CXFA_TextTabstopsContext()
10     : m_iTabCount(0),
11       m_iTabIndex(-1),
12       m_bTabstops(false),
13       m_fTabWidth(0),
14       m_fLeft(0) {}
15 
~CXFA_TextTabstopsContext()16 CXFA_TextTabstopsContext::~CXFA_TextTabstopsContext() {}
17 
Append(uint32_t dwAlign,FX_FLOAT fTabstops)18 void CXFA_TextTabstopsContext::Append(uint32_t dwAlign, FX_FLOAT fTabstops) {
19   int32_t i = 0;
20   for (i = 0; i < m_iTabCount; i++) {
21     XFA_TABSTOPS* pTabstop = m_tabstops.GetDataPtr(i);
22     if (fTabstops < pTabstop->fTabstops) {
23       break;
24     }
25   }
26   m_tabstops.InsertSpaceAt(i, 1);
27   XFA_TABSTOPS tabstop;
28   tabstop.dwAlign = dwAlign;
29   tabstop.fTabstops = fTabstops;
30   m_tabstops.SetAt(i, tabstop);
31   m_iTabCount++;
32 }
33 
RemoveAll()34 void CXFA_TextTabstopsContext::RemoveAll() {
35   m_tabstops.RemoveAll();
36   m_iTabCount = 0;
37 }
38 
Reset()39 void CXFA_TextTabstopsContext::Reset() {
40   m_iTabIndex = -1;
41   m_bTabstops = false;
42   m_fTabWidth = 0;
43   m_fLeft = 0;
44 }
45