Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: xfa/fde/cfde_txtedtengine.cpp

Issue 1998873002: Clean up XFA code which causes warnings (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | xfa/fde/css/fde_cssstyleselector.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fde/cfde_txtedtengine.h" 7 #include "xfa/fde/cfde_txtedtengine.h"
8 8
9 #include "xfa/fde/cfde_txtedtbuf.h" 9 #include "xfa/fde/cfde_txtedtbuf.h"
10 #include "xfa/fde/cfde_txtedtbufiter.h" 10 #include "xfa/fde/cfde_txtedtbufiter.h"
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 void CFDE_TxtEdtEngine::UpdatePages() { 1016 void CFDE_TxtEdtEngine::UpdatePages() {
1017 if (m_nLineCount == 0) 1017 if (m_nLineCount == 0)
1018 return; 1018 return;
1019 1019
1020 int32_t nPageCount = (m_nLineCount - 1) / (m_nPageLineCount) + 1; 1020 int32_t nPageCount = (m_nLineCount - 1) / (m_nPageLineCount) + 1;
1021 int32_t nSize = m_PagePtrArray.GetSize(); 1021 int32_t nSize = m_PagePtrArray.GetSize();
1022 if (nSize == nPageCount) 1022 if (nSize == nPageCount)
1023 return; 1023 return;
1024 1024
1025 if (nSize > nPageCount) { 1025 if (nSize > nPageCount) {
1026 IFDE_TxtEdtPage* pPage = NULL; 1026 for (int32_t i = nSize - 1; i >= nPageCount; i--) {
1027 int32_t i = 0;
1028 for (i = nSize - 1; i >= nPageCount; i--) {
1029 delete m_PagePtrArray[i]; 1027 delete m_PagePtrArray[i];
1030 m_PagePtrArray.RemoveAt(i); 1028 m_PagePtrArray.RemoveAt(i);
1031 } 1029 }
1032 return; 1030 return;
1033 } 1031 }
1034 if (nSize < nPageCount) { 1032 if (nSize < nPageCount) {
1035 IFDE_TxtEdtPage* pPage = NULL; 1033 for (int32_t i = nSize; i < nPageCount; i++)
1036 int32_t i = 0; 1034 m_PagePtrArray.Add(IFDE_TxtEdtPage::Create(this, i));
1037 for (i = nSize; i < nPageCount; i++) {
1038 pPage = IFDE_TxtEdtPage::Create(this, i);
1039 m_PagePtrArray.Add(pPage);
1040 }
1041 return; 1035 return;
1042 } 1036 }
1043 } 1037 }
1044 1038
1045 void CFDE_TxtEdtEngine::UpdateTxtBreak() { 1039 void CFDE_TxtEdtEngine::UpdateTxtBreak() {
1046 uint32_t dwStyle = m_pTextBreak->GetLayoutStyles(); 1040 uint32_t dwStyle = m_pTextBreak->GetLayoutStyles();
1047 if (m_Param.dwMode & FDE_TEXTEDITMODE_MultiLines) { 1041 if (m_Param.dwMode & FDE_TEXTEDITMODE_MultiLines) {
1048 dwStyle &= ~FX_TXTLAYOUTSTYLE_SingleLine; 1042 dwStyle &= ~FX_TXTLAYOUTSTYLE_SingleLine;
1049 } else { 1043 } else {
1050 dwStyle |= FX_TXTLAYOUTSTYLE_SingleLine; 1044 dwStyle |= FX_TXTLAYOUTSTYLE_SingleLine;
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); 1593 m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0);
1600 } 1594 }
1601 1595
1602 FX_BOOL CFDE_TxtEdtEngine::IsSelect() { 1596 FX_BOOL CFDE_TxtEdtEngine::IsSelect() {
1603 return m_SelRangePtrArr.GetSize() > 0; 1597 return m_SelRangePtrArr.GetSize() > 0;
1604 } 1598 }
1605 1599
1606 void CFDE_TxtEdtEngine::DeleteSelect() { 1600 void CFDE_TxtEdtEngine::DeleteSelect() {
1607 int32_t nCountRange = CountSelRanges(); 1601 int32_t nCountRange = CountSelRanges();
1608 if (nCountRange > 0) { 1602 if (nCountRange > 0) {
1609 int32_t nSelStart; 1603 int32_t nSelStart = 0;
1610 int32_t nSelCount;
1611 while (nCountRange > 0) { 1604 while (nCountRange > 0) {
1612 nSelCount = GetSelRange(--nCountRange, nSelStart); 1605 int32_t nSelCount = GetSelRange(--nCountRange, nSelStart);
1613 delete m_SelRangePtrArr[nCountRange]; 1606 delete m_SelRangePtrArr[nCountRange];
1614 m_SelRangePtrArr.RemoveAt(nCountRange); 1607 m_SelRangePtrArr.RemoveAt(nCountRange);
1615 DeleteRange_DoRecord(nSelStart, nSelCount, TRUE); 1608 DeleteRange_DoRecord(nSelStart, nSelCount, TRUE);
1616 } 1609 }
1617 ClearSelection(); 1610 ClearSelection();
1618 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); 1611 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo);
1619 m_Param.pEventSink->On_SelChanged(this); 1612 m_Param.pEventSink->On_SelChanged(this);
1620 SetCaretPos(nSelStart, TRUE); 1613 SetCaretPos(nSelStart, TRUE);
1621 return; 1614 return;
1622 } 1615 }
1623 } 1616 }
OLDNEW
« no previous file with comments | « no previous file | xfa/fde/css/fde_cssstyleselector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698