Home | History | Annotate | Download | only in fxfa
      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/cxfa_texttabstopscontext.h"
      8 
      9 #include <algorithm>
     10 
     11 CXFA_TextTabstopsContext::CXFA_TextTabstopsContext()
     12     : m_iTabIndex(-1), m_bTabstops(false), m_fTabWidth(0), m_fLeft(0) {}
     13 
     14 CXFA_TextTabstopsContext::~CXFA_TextTabstopsContext() {}
     15 
     16 void CXFA_TextTabstopsContext::Append(uint32_t dwAlign, float fTabstops) {
     17   XFA_TABSTOPS tabstop;
     18   tabstop.dwAlign = dwAlign;
     19   tabstop.fTabstops = fTabstops;
     20 
     21   auto it = std::lower_bound(m_tabstops.begin(), m_tabstops.end(), tabstop);
     22   m_tabstops.insert(it, tabstop);
     23 }
     24 
     25 void CXFA_TextTabstopsContext::RemoveAll() {
     26   m_tabstops.clear();
     27 }
     28 
     29 void CXFA_TextTabstopsContext::Reset() {
     30   m_iTabIndex = -1;
     31   m_bTabstops = false;
     32   m_fTabWidth = 0;
     33   m_fLeft = 0;
     34 }
     35