From cf2e4c3ecc2a66f0a01e6a1d8c20dcb73e4b8024 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 11 Jun 2015 14:00:52 -0700 Subject: Remove trailing whitespaces in fpdfsdk. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1173343004. --- fpdfsdk/src/fxedit/fxet_edit.cpp | 328 +++++++++++++++++++-------------------- 1 file changed, 164 insertions(+), 164 deletions(-) (limited to 'fpdfsdk/src/fxedit/fxet_edit.cpp') diff --git a/fpdfsdk/src/fxedit/fxet_edit.cpp b/fpdfsdk/src/fxedit/fxet_edit.cpp index 19c05d20ae..70d7b77553 100644 --- a/fpdfsdk/src/fxedit/fxet_edit.cpp +++ b/fpdfsdk/src/fxedit/fxet_edit.cpp @@ -1,7 +1,7 @@ // Copyright 2014 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 #include "../../include/fxedit/fxet_stub.h" @@ -11,7 +11,7 @@ /* ---------------------------- CFX_Edit_Iterator ---------------------------- */ -CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator * pVTIterator) : +CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator * pVTIterator) : m_pEdit(pEdit), m_pVTIterator(pVTIterator) { @@ -24,7 +24,7 @@ CFX_Edit_Iterator::~CFX_Edit_Iterator() FX_BOOL CFX_Edit_Iterator::NextWord() { ASSERT(m_pVTIterator != NULL); - + return m_pVTIterator->NextWord(); } @@ -45,7 +45,7 @@ FX_BOOL CFX_Edit_Iterator::NextSection() FX_BOOL CFX_Edit_Iterator::PrevWord() { ASSERT(m_pVTIterator != NULL); - + return m_pVTIterator->PrevWord(); } @@ -83,7 +83,7 @@ FX_BOOL CFX_Edit_Iterator::GetLine(CPVT_Line & line) const ASSERT(m_pVTIterator != NULL); if (m_pVTIterator->GetLine(line)) - { + { line.ptLine = m_pEdit->VTToEdit(line.ptLine); return TRUE; } @@ -153,12 +153,12 @@ int32_t CFX_Edit_Provider::GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_ { FX_DWORD charcode = word; - if (pPDFFont->IsUnicodeCompatible()) - charcode = pPDFFont->CharCodeFromUnicode(word); + if (pPDFFont->IsUnicodeCompatible()) + charcode = pPDFFont->CharCodeFromUnicode(word); else charcode = m_pFontMap->CharCodeFromUnicode(nFontIndex, word); - if (charcode != -1) + if (charcode != -1) return pPDFFont->GetCharWidthF(charcode); } @@ -272,14 +272,14 @@ void CFX_Edit_Refresh::Analyse(int32_t nAlignment) { rcResult = pOldRect->m_rcLine; rcResult.Union(pNewRect->m_rcLine); - m_RefreshRects.Add(rcResult); + m_RefreshRects.Add(rcResult); } else { - if (!pNewRect->IsSameLeft(*pOldRect)) + if (!pNewRect->IsSameLeft(*pOldRect)) { rcResult = pOldRect->m_rcLine; - rcResult.Union(pNewRect->m_rcLine); + rcResult.Union(pNewRect->m_rcLine); } else { @@ -374,9 +374,9 @@ void CFX_Edit_Undo::Undo() ASSERT(pItem != NULL); pItem->Undo(); - + m_nCurUndoPos--; - m_bModified = (m_nCurUndoPos != 0); + m_bModified = (m_nCurUndoPos != 0); } m_bWorking = FALSE; @@ -401,7 +401,7 @@ void CFX_Edit_Undo::Redo() pItem->Redo(); m_nCurUndoPos++; - m_bModified = (m_nCurUndoPos != 0); + m_bModified = (m_nCurUndoPos != 0); } m_bWorking = FALSE; @@ -417,17 +417,17 @@ void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) ASSERT(!m_bWorking); ASSERT(pItem != NULL); ASSERT(m_nBufSize > 1); - + if (m_nCurUndoPos < m_UndoItemStack.GetSize()) RemoveTails(); if (m_UndoItemStack.GetSize() >= m_nBufSize) { - RemoveHeads(); + RemoveHeads(); m_bVirgin = FALSE; } - m_UndoItemStack.Add(pItem); + m_UndoItemStack.Add(pItem); m_nCurUndoPos = m_UndoItemStack.GetSize(); m_bModified = (m_nCurUndoPos != 0); @@ -549,7 +549,7 @@ CFX_WideString CFX_Edit_GroupUndoItem::GetUndoTitle() /* ------------------------------------- CFX_Edit_UndoItem derived classes ------------------------------------- */ CFXEU_InsertWord::CFXEU_InsertWord(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, - FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps) + FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps) : m_pEdit(pEdit), m_wpOld(wpOldPlace), m_wpNew(wpNewPlace), m_Word(word), m_nCharset(charset), m_WordProps() { if (pWordProps) @@ -565,7 +565,7 @@ void CFXEU_InsertWord::Redo() if (m_pEdit) { m_pEdit->SelectNone(); - m_pEdit->SetCaret(m_wpOld); + m_pEdit->SetCaret(m_wpOld); m_pEdit->InsertWord(m_Word,m_nCharset,&m_WordProps,FALSE,TRUE); } } @@ -588,7 +588,7 @@ CFXEU_InsertReturn::CFXEU_InsertReturn(CFX_Edit * pEdit, const CPVT_WordPlace & m_wpOld(wpOldPlace), m_wpNew(wpNewPlace), m_SecProps(), - m_WordProps() + m_WordProps() { if (pSecProps) m_SecProps = *pSecProps; @@ -632,7 +632,7 @@ CFXEU_Backspace::CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP m_Word(word), m_nCharset(charset), m_SecProps(SecProps), - m_WordProps(WordProps) + m_WordProps(WordProps) { } @@ -763,7 +763,7 @@ CFXEU_ClearRich::CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldP m_Word(word), m_nCharset(charset), m_SecProps(SecProps), - m_WordProps(WordProps) + m_WordProps(WordProps) { } @@ -815,7 +815,7 @@ CFXEU_InsertText::CFXEU_InsertText(CFX_Edit * pEdit, const CPVT_WordPlace & wpOl m_swText(swText), m_nCharset(charset), m_SecProps(), - m_WordProps() + m_WordProps() { if (pSecProps) m_SecProps = *pSecProps; @@ -849,8 +849,8 @@ void CFXEU_InsertText::Undo() /* -------------------------------------------------------------------------- */ -CFXEU_SetSecProps::CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep, - const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwordprops, +CFXEU_SetSecProps::CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep, + const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwordprops, const CPVT_SecProps & newsecprops, const CPVT_WordProps & newwordprops, const CPVT_WordRange & range) : m_pEdit(pEdit), m_wpPlace(place), @@ -897,7 +897,7 @@ void CFXEU_SetSecProps::Undo() /* -------------------------------------------------------------------------- */ -CFXEU_SetWordProps::CFXEU_SetWordProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep, +CFXEU_SetWordProps::CFXEU_SetWordProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep, const CPVT_WordProps & oldprops, const CPVT_WordProps & newprops, const CPVT_WordRange & range) : m_pEdit(pEdit), m_wpPlace(place), @@ -965,7 +965,7 @@ CFX_Edit::CFX_Edit(IPDF_VariableText * pVT) : m_bNotify(TRUE), m_bOprNotify(FALSE), m_pGroupUndoItem(NULL) -{ +{ ASSERT(pVT != NULL); } @@ -997,7 +997,7 @@ void CFX_Edit::Initialize() void CFX_Edit::SetFontMap(IFX_Edit_FontMap * pFontMap) { - if (m_pVTProvide) + if (m_pVTProvide) delete m_pVTProvide; m_pVT->SetProvider(m_pVTProvide = new CFX_Edit_Provider(pFontMap)); @@ -1040,9 +1040,9 @@ IFX_Edit_FontMap* CFX_Edit::GetFontMap() } void CFX_Edit::SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint/* = TRUE*/) -{ +{ m_pVT->SetPlateRect(rect); - m_ptScrollPos = CPDF_Point(rect.left,rect.top); + m_ptScrollPos = CPDF_Point(rect.left,rect.top); if (bPaint) Paint(); } @@ -1139,11 +1139,11 @@ void CFX_Edit::SetSel(int32_t nStartChar,int32_t nEndChar) SelectAll(); } else if (nStartChar < 0) - { + { SelectNone(); } else - { + { if (nStartChar < nEndChar) { SetSel(m_pVT->WordIndexToWordPlace(nStartChar),m_pVT->WordIndexToWordPlace(nEndChar)); @@ -1152,7 +1152,7 @@ void CFX_Edit::SetSel(int32_t nStartChar,int32_t nEndChar) { SetSel(m_pVT->WordIndexToWordPlace(nEndChar),m_pVT->WordIndexToWordPlace(nStartChar)); } - } + } } } @@ -1174,7 +1174,7 @@ void CFX_Edit::SetSel(const CPVT_WordPlace & begin,const CPVT_WordPlace & end) SetCaretInfo(); } else - { + { ScrollToCaret(); SetCaretInfo(); } @@ -1234,7 +1234,7 @@ CFX_WideString CFX_Edit::GetText() const pIterator->SetAt(0); - CPVT_Word wordinfo; + CPVT_Word wordinfo; CPVT_WordPlace oldplace = pIterator->GetAt(); while (pIterator->NextWord()) { @@ -1249,7 +1249,7 @@ CFX_WideString CFX_Edit::GetText() const else { swRet += wordinfo.Word; - } + } } if (oldplace.SecCmp(place) != 0) @@ -1257,7 +1257,7 @@ CFX_WideString CFX_Edit::GetText() const swRet += 0x0D; swRet += 0x0A; } - + oldplace = place; } } @@ -1275,13 +1275,13 @@ CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange & range) const FX_BOOL bRich = m_pVT->IsRichText(); if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) - { + { CPVT_WordRange wrTemp = range; m_pVT->UpdateWordPlace(wrTemp.BeginPos); m_pVT->UpdateWordPlace(wrTemp.EndPos); pIterator->SetAt(wrTemp.BeginPos); - CPVT_Word wordinfo; + CPVT_Word wordinfo; CPVT_WordPlace oldplace = wrTemp.BeginPos; while (pIterator->NextWord()) { @@ -1297,7 +1297,7 @@ CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange & range) const else { swRet += wordinfo.Word; - } + } } if (oldplace.SecCmp(place) != 0) @@ -1305,7 +1305,7 @@ CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange & range) const swRet += 0x0D; swRet += 0x0A; } - + oldplace = place; } } @@ -1383,28 +1383,28 @@ FX_BOOL CFX_Edit::SetRichFontIndex(int32_t nFontIndex) { CPVT_WordProps WordProps; WordProps.nFontIndex = nFontIndex; - return SetRichTextProps(EP_FONTINDEX,NULL,&WordProps); + return SetRichTextProps(EP_FONTINDEX,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichFontSize(FX_FLOAT fFontSize) -{ +{ CPVT_WordProps WordProps; WordProps.fFontSize = fFontSize; - return SetRichTextProps(EP_FONTSIZE,NULL,&WordProps); + return SetRichTextProps(EP_FONTSIZE,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) { CPVT_WordProps WordProps; WordProps.dwWordColor = dwColor; - return SetRichTextProps(EP_WORDCOLOR,NULL,&WordProps); + return SetRichTextProps(EP_WORDCOLOR,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichTextScript(int32_t nScriptType) { CPVT_WordProps WordProps; WordProps.nScriptType = nScriptType; - return SetRichTextProps(EP_SCRIPTTYPE,NULL,&WordProps); + return SetRichTextProps(EP_SCRIPTTYPE,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichTextBold(FX_BOOL bBold) @@ -1443,21 +1443,21 @@ FX_BOOL CFX_Edit::SetRichTextCharSpace(FX_FLOAT fCharSpace) { CPVT_WordProps WordProps; WordProps.fCharSpace = fCharSpace; - return SetRichTextProps(EP_CHARSPACE,NULL,&WordProps); + return SetRichTextProps(EP_CHARSPACE,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichTextHorzScale(int32_t nHorzScale /*= 100*/) { CPVT_WordProps WordProps; WordProps.nHorzScale = nHorzScale; - return SetRichTextProps(EP_HORZSCALE,NULL,&WordProps); + return SetRichTextProps(EP_HORZSCALE,NULL,&WordProps); } FX_BOOL CFX_Edit::SetRichTextLineLeading(FX_FLOAT fLineLeading) { CPVT_SecProps SecProps; SecProps.fLineLeading = fLineLeading; - return SetRichTextProps(EP_LINELEADING,&SecProps,NULL); + return SetRichTextProps(EP_LINELEADING,&SecProps,NULL); } FX_BOOL CFX_Edit::SetRichTextLineIndent(FX_FLOAT fLineIndent) @@ -1483,7 +1483,7 @@ FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pS if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) { CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange(); - + m_pVT->UpdateWordPlace(wrTemp.BeginPos); m_pVT->UpdateWordPlace(wrTemp.EndPos); pIterator->SetAt(wrTemp.BeginPos); @@ -1498,7 +1498,7 @@ FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pS if (place.WordCmp(wrTemp.EndPos) > 0) break; bSet1 = SetSecProps(eProps,place,pSecProps,pWordProps,wrTemp,TRUE); bSet2 = SetWordProps(eProps,place,pWordProps,wrTemp,TRUE); - + if (!bSet) bSet = (bSet1 || bSet2); } @@ -1510,7 +1510,7 @@ FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps, const CPVT_SecProps * pS PaintSetProps(eProps,wrTemp); } } - } + } return bSet; } @@ -1526,8 +1526,8 @@ void CFX_Edit::PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr) ScrollToCaret(); Refresh(RP_ANALYSE); SetCaretOrigin(); - SetCaretInfo(); - break; + SetCaretInfo(); + break; case EP_WORDCOLOR: case EP_UNDERLINE: case EP_CROSSOUT: @@ -1535,7 +1535,7 @@ void CFX_Edit::PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr) break; case EP_FONTINDEX: case EP_FONTSIZE: - case EP_SCRIPTTYPE: + case EP_SCRIPTTYPE: case EP_CHARSPACE: case EP_HORZSCALE: case EP_BOLD: @@ -1548,13 +1548,13 @@ void CFX_Edit::PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr) Refresh(RP_ANALYSE,&wrRefresh); SetCaretOrigin(); - SetCaretInfo(); + SetCaretInfo(); break; - } + } } -FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, - const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps, +FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, + const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo) { if (m_pVT->IsValid() && m_pVT->IsRichText()) @@ -1578,10 +1578,10 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, switch(eProps) { - case EP_LINELEADING: + case EP_LINELEADING: if (!FX_EDIT_IsFloatEqual(secinfo.SecProps.fLineLeading,pSecProps->fLineLeading)) { - secinfo.SecProps.fLineLeading = pSecProps->fLineLeading; + secinfo.SecProps.fLineLeading = pSecProps->fLineLeading; bSet = TRUE; } break; @@ -1616,7 +1616,7 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, switch(eProps) { - case EP_FONTINDEX: + case EP_FONTINDEX: if (secinfo.WordProps.nFontIndex != pWordProps->nFontIndex) { secinfo.WordProps.nFontIndex = pWordProps->nFontIndex; @@ -1637,21 +1637,21 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, bSet = TRUE; } break; - case EP_SCRIPTTYPE: + case EP_SCRIPTTYPE: if (secinfo.WordProps.nScriptType != pWordProps->nScriptType) { secinfo.WordProps.nScriptType = pWordProps->nScriptType; bSet = TRUE; } break; - case EP_CHARSPACE: + case EP_CHARSPACE: if (!FX_EDIT_IsFloatEqual(secinfo.WordProps.fCharSpace,pWordProps->fCharSpace)) { secinfo.WordProps.fCharSpace = pWordProps->fCharSpace; bSet = TRUE; } break; - case EP_HORZSCALE: + case EP_HORZSCALE: if (secinfo.WordProps.nHorzScale != pWordProps->nHorzScale) { secinfo.WordProps.nHorzScale = pWordProps->nHorzScale; @@ -1663,7 +1663,7 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, { if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) == 0) { - secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; + secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE; bSet = TRUE; } } @@ -1681,7 +1681,7 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, { if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) == 0) { - secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; + secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; bSet = TRUE; } } @@ -1699,7 +1699,7 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, { if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_BOLD) == 0) { - secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; + secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; bSet = TRUE; } } @@ -1717,7 +1717,7 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, { if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_ITALIC) == 0) { - secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; + secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; bSet = TRUE; } } @@ -1753,11 +1753,11 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, return bSet; } } - + return FALSE; } -FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, +FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo) { if (m_pVT->IsValid() && m_pVT->IsRichText()) @@ -1779,7 +1779,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place switch(eProps) { - case EP_FONTINDEX: + case EP_FONTINDEX: if (wordinfo.WordProps.nFontIndex != pWordProps->nFontIndex) { if (IFX_Edit_FontMap* pFontMap = GetFontMap()) @@ -1847,7 +1847,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place { if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) == 0) { - wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; + wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT; bSet = TRUE; } } @@ -1865,7 +1865,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place { if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_BOLD) == 0) { - wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; + wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_BOLD; bSet = TRUE; } } @@ -1883,7 +1883,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place { if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_ITALIC) == 0) { - wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; + wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC; bSet = TRUE; } } @@ -1900,7 +1900,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place break; } } - } + } if (bSet) { @@ -1912,7 +1912,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place (this,place,eProps,OldWordinfo.WordProps,wordinfo.WordProps,wr)); } } - + pIterator->SetAt(oldplace); return bSet; } @@ -2089,9 +2089,9 @@ void CFX_Edit::SelectAll() { if (m_pVT->IsValid()) { - m_SelState = GetWholeWordRange(); - SetCaret(m_SelState.EndPos); - + m_SelState = GetWholeWordRange(); + SetCaret(m_SelState.EndPos); + ScrollToCaret(); CPVT_WordRange wrVisible = GetVisibleWordRange(); Refresh(RP_OPTIONAL,&wrVisible); @@ -2109,7 +2109,7 @@ void CFX_Edit::SelectNone() m_SelState.Default(); Refresh(RP_OPTIONAL,&wrTemp); } - } + } } FX_BOOL CFX_Edit::IsSelected() const @@ -2136,7 +2136,7 @@ CPDF_Point CFX_Edit::VTToEdit(const CPDF_Point & point) const fPadding = rcPlate.Height() - rcContent.Height(); break; } - + return CPDF_Point(point.x - (m_ptScrollPos.x - rcPlate.left), point.y - (m_ptScrollPos.y + fPadding - rcPlate.top)); } @@ -2191,10 +2191,10 @@ void CFX_Edit::SetScrollInfo() if (!m_bNotifyFlag) { m_bNotifyFlag = TRUE; - m_pNotify->IOnSetScrollInfoX(rcPlate.left, rcPlate.right, + m_pNotify->IOnSetScrollInfoX(rcPlate.left, rcPlate.right, rcContent.left, rcContent.right, rcPlate.Width() / 3, rcPlate.Width()); - - m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, + + m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, rcContent.bottom, rcContent.top, rcPlate.Height() / 3, rcPlate.Height()); m_bNotifyFlag = FALSE; } @@ -2209,7 +2209,7 @@ void CFX_Edit::SetScrollPosX(FX_FLOAT fx) { if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.x,fx)) { - m_ptScrollPos.x = fx; + m_ptScrollPos.x = fx; Refresh(RP_NOANALYSE); if (m_bNotify && m_pNotify) @@ -2232,7 +2232,7 @@ void CFX_Edit::SetScrollPosY(FX_FLOAT fy) if (m_pVT->IsValid()) { if (!FX_EDIT_IsFloatEqual(m_ptScrollPos.y,fy)) - { + { m_ptScrollPos.y = fy; Refresh(RP_NOANALYSE); @@ -2277,7 +2277,7 @@ void CFX_Edit::SetScrollLimit() { if (FX_EDIT_IsFloatSmaller(m_ptScrollPos.x, rcContent.left)) { - SetScrollPosX(rcContent.left); + SetScrollPosX(rcContent.left); } else if (FX_EDIT_IsFloatBigger(m_ptScrollPos.x, rcContent.right - rcPlate.Width())) { @@ -2289,7 +2289,7 @@ void CFX_Edit::SetScrollLimit() { SetScrollPosY(rcPlate.top); } - else + else { if (FX_EDIT_IsFloatSmaller(m_ptScrollPos.y, rcContent.bottom + rcPlate.Height())) { @@ -2326,7 +2326,7 @@ void CFX_Edit::ScrollToCaret() ptFoot.y = word.ptWord.y + word.fDescent; } else if (pIterator->GetLine(line)) - { + { ptHead.x = line.ptLine.x; ptHead.y = line.ptLine.y + line.fLineAscent; ptFoot.x = line.ptLine.x; @@ -2380,7 +2380,7 @@ void CFX_Edit::Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1,const m_Refresh.BeginRefresh(); RefreshPushLineRects(GetVisibleWordRange()); -// if (!FX_EDIT_IsFloatEqual(m_ptRefreshScrollPos.x,m_ptScrollPos.x) || +// if (!FX_EDIT_IsFloatEqual(m_ptRefreshScrollPos.x,m_ptScrollPos.x) || // !FX_EDIT_IsFloatEqual(m_ptRefreshScrollPos.y,m_ptScrollPos.y)) // { m_Refresh.NoAnalyse(); @@ -2392,7 +2392,7 @@ void CFX_Edit::Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1,const // { // case RP_ANALYSE: // m_Refresh.Analyse(m_pVT->GetAlignment()); -// +// // if (pRange1) RefreshPushRandomRects(*pRange1); // if (pRange2) RefreshPushRandomRects(*pRange2); // break; @@ -2402,9 +2402,9 @@ void CFX_Edit::Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1,const // case RP_OPTIONAL: // if (pRange1) RefreshPushRandomRects(*pRange1); // if (pRange2) RefreshPushRandomRects(*pRange2); -// break; +// break; // } -// } +// } if (m_bNotify && m_pNotify) { @@ -2436,7 +2436,7 @@ void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange & wr) m_pVT->UpdateWordPlace(wpEnd); pIterator->SetAt(wpBegin); - CPVT_Line lineinfo; + CPVT_Line lineinfo; do { if (!pIterator->GetLine(lineinfo))break; @@ -2466,15 +2466,15 @@ void CFX_Edit::RefreshPushRandomRects(const CPVT_WordRange & wr) m_pVT->UpdateWordPlace(wrTemp.EndPos); pIterator->SetAt(wrTemp.BeginPos); - CPVT_Word wordinfo; - CPVT_Line lineinfo; + CPVT_Word wordinfo; + CPVT_Line lineinfo; CPVT_WordPlace place; while (pIterator->NextWord()) { place = pIterator->GetAt(); if (place.WordCmp(wrTemp.EndPos) > 0) break; - + pIterator->GetWord(wordinfo); pIterator->GetLine(lineinfo); @@ -2488,7 +2488,7 @@ void CFX_Edit::RefreshPushRandomRects(const CPVT_WordRange & wr) m_Refresh.AddRefresh(VTToEdit(rcWord)); } else - { + { CPDF_Rect rcLine(lineinfo.ptLine.x, lineinfo.ptLine.y + lineinfo.fLineDescent, lineinfo.ptLine.x + lineinfo.fLineWidth, @@ -2513,15 +2513,15 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) m_pVT->UpdateWordPlace(wrTemp.EndPos); pIterator->SetAt(wrTemp.BeginPos); - CPVT_Word wordinfo; - CPVT_Line lineinfo; + CPVT_Word wordinfo; + CPVT_Line lineinfo; CPVT_WordPlace place; while (pIterator->NextWord()) { place = pIterator->GetAt(); if (place.WordCmp(wrTemp.EndPos) > 0) break; - + pIterator->GetWord(wordinfo); pIterator->GetLine(lineinfo); @@ -2544,7 +2544,7 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) } } else - { + { CPDF_Rect rcLine(lineinfo.ptLine.x, lineinfo.ptLine.y + lineinfo.fLineDescent, lineinfo.ptLine.x + lineinfo.fLineWidth, @@ -2569,8 +2569,8 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) void CFX_Edit::SetCaret(const CPVT_WordPlace & place) { - m_wpOldCaret = m_wpCaret; - m_wpCaret = place; + m_wpOldCaret = m_wpCaret; + m_wpCaret = place; } void CFX_Edit::SetCaretInfo() @@ -2594,13 +2594,13 @@ void CFX_Edit::SetCaretInfo() ptFoot.y = word.ptWord.y + word.fDescent; } else if (pIterator->GetLine(line)) - { + { ptHead.x = line.ptLine.x; ptHead.y = line.ptLine.y + line.fLineAscent; ptFoot.x = line.ptLine.x; ptFoot.y = line.ptLine.y + line.fLineDescent; } - } + } m_bNotifyFlag = TRUE; m_pNotify->IOnSetCaret(!m_SelState.IsExist(),VTToEdit(ptHead),VTToEdit(ptFoot), m_wpCaret); @@ -2631,27 +2631,27 @@ void CFX_Edit::SetCaretChange() SecProps = section.SecProps; WordProps = section.WordProps; } - + if (pIterator->GetWord(word)) - { - WordProps = word.WordProps; + { + WordProps = word.WordProps; } - } - + } + if (!m_bNotifyFlag) { m_bNotifyFlag = TRUE; m_pNotify->IOnCaretChange(SecProps,WordProps); m_bNotifyFlag = FALSE; } - } + } } void CFX_Edit::SetCaret(int32_t nPos) { if (m_pVT->IsValid()) { - SelectNone(); + SelectNone(); SetCaret(m_pVT->WordIndexToWordPlace(nPos)); m_SelState.Set(m_wpCaret,m_wpCaret); @@ -2665,7 +2665,7 @@ void CFX_Edit::OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl { if (m_pVT->IsValid()) { - SelectNone(); + SelectNone(); SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); m_SelState.Set(m_wpCaret,m_wpCaret); @@ -2683,7 +2683,7 @@ void CFX_Edit::OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl if (m_wpCaret != m_wpOldCaret) { - m_SelState.SetEndPos(m_wpCaret); + m_SelState.SetEndPos(m_wpCaret); ScrollToCaret(); CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); @@ -2695,7 +2695,7 @@ void CFX_Edit::OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl } void CFX_Edit::OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) -{ +{ if (m_pVT->IsValid()) { SetCaret(m_pVT->GetUpWordPlace(m_wpCaret,m_ptCaret)); @@ -2717,9 +2717,9 @@ void CFX_Edit::OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) } else { - SelectNone(); - - ScrollToCaret(); + SelectNone(); + + ScrollToCaret(); SetCaretInfo(); } } @@ -2750,7 +2750,7 @@ void CFX_Edit::OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) { SelectNone(); - ScrollToCaret(); + ScrollToCaret(); SetCaretInfo(); } } @@ -2764,12 +2764,12 @@ void CFX_Edit::OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) { if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) && m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCaret)) - SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); + SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); if (m_SelState.IsExist()) - m_SelState.SetEndPos(m_wpCaret); + m_SelState.SetEndPos(m_wpCaret); else m_SelState.Set(m_wpOldCaret, m_wpCaret); @@ -2798,7 +2798,7 @@ void CFX_Edit::OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) { if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) && m_wpCaret != m_pVT->GetSectionBeginPlace(m_wpCaret)) - SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); + SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); SetCaret(m_pVT->GetPrevWordPlace(m_wpCaret)); @@ -2823,12 +2823,12 @@ void CFX_Edit::OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); if (m_SelState.IsExist()) - m_SelState.SetEndPos(m_wpCaret); + m_SelState.SetEndPos(m_wpCaret); else - m_SelState.Set(m_wpOldCaret,m_wpCaret); + m_SelState.Set(m_wpOldCaret,m_wpCaret); if (m_wpOldCaret != m_wpCaret) - { + { ScrollToCaret(); CPVT_WordRange wr(m_wpOldCaret,m_wpCaret); Refresh(RP_OPTIONAL,&wr); @@ -2854,7 +2854,7 @@ void CFX_Edit::OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) if (m_wpCaret == m_pVT->GetLineEndPlace(m_wpCaret) && m_wpCaret != m_pVT->GetSectionEndPlace(m_wpCaret)) - SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); + SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); ScrollToCaret(); SetCaretOrigin(); @@ -2876,7 +2876,7 @@ void CFX_Edit::OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); if (m_SelState.IsExist()) - m_SelState.SetEndPos(m_wpCaret); + m_SelState.SetEndPos(m_wpCaret); else m_SelState.Set(m_wpOldCaret,m_wpCaret); @@ -2903,8 +2903,8 @@ void CFX_Edit::OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) if (bCtrl) SetCaret(m_pVT->GetBeginWordPlace()); else - SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); - + SetCaret(m_pVT->GetLineBeginPlace(m_wpCaret)); + ScrollToCaret(); SetCaretOrigin(); SetCaretInfo(); @@ -2953,8 +2953,8 @@ void CFX_Edit::OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) SetCaret(m_pVT->GetEndWordPlace()); else SetCaret(m_pVT->GetLineEndPlace(m_wpCaret)); - - ScrollToCaret(); + + ScrollToCaret(); SetCaretOrigin(); SetCaretInfo(); } @@ -3000,11 +3000,11 @@ FX_BOOL CFX_Edit::InsertWord(FX_WORD word, int32_t charset, const CPVT_WordProps return TRUE; } } - + return FALSE; } -FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps, +FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps, FX_BOOL bAddUndo, FX_BOOL bPaint) { if (IsTextOverflow()) return FALSE; @@ -3027,9 +3027,9 @@ FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordPr RearrangePart(CPVT_WordRange(m_wpOldCaret, m_wpCaret)); ScrollToCaret(); CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRange().EndPos); - Refresh(RP_ANALYSE, &wr); + Refresh(RP_ANALYSE, &wr); SetCaretOrigin(); - SetCaretInfo(); + SetCaretInfo(); } if (m_bOprNotify && m_pOprNotify) @@ -3054,7 +3054,7 @@ FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) if (bAddUndo) { if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) - { + { pIterator->SetAt(m_wpCaret); pIterator->GetSection(section); pIterator->GetWord(word); @@ -3069,7 +3069,7 @@ FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) { if (bAddUndo && m_bEnableUndo) { - if (m_wpCaret.SecCmp(m_wpOldCaret) != 0) + if (m_wpCaret.SecCmp(m_wpOldCaret) != 0) AddEditUndoItem(new CFXEU_Backspace(this,m_wpOldCaret,m_wpCaret,word.Word,word.nCharset, section.SecProps,section.WordProps)); else @@ -3084,7 +3084,7 @@ FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) CPVT_WordRange wr; if (m_wpCaret.SecCmp(m_wpOldCaret) !=0) - wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpCaret),GetVisibleWordRange().EndPos); + wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpCaret),GetVisibleWordRange().EndPos); else if (m_wpCaret.LineCmp(m_wpOldCaret) !=0) wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(m_wpCaret),m_pVT->GetSectionEndPlace(m_wpCaret)); else @@ -3118,7 +3118,7 @@ FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) if (bAddUndo) { if (IPDF_VariableText_Iterator * pIterator = m_pVT->GetIterator()) - { + { pIterator->SetAt(m_pVT->GetNextWordPlace(m_wpCaret)); pIterator->GetSection(section); pIterator->GetWord(word); @@ -3133,14 +3133,14 @@ FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) if (bAddUndo && m_bEnableUndo) { - if (bSecEnd) + if (bSecEnd) AddEditUndoItem(new CFXEU_Delete(this,m_wpOldCaret,m_wpCaret,word.Word,word.nCharset, section.SecProps,section.WordProps,bSecEnd)); else AddEditUndoItem(new CFXEU_Delete(this,m_wpOldCaret,m_wpCaret,word.Word,word.nCharset, section.SecProps,word.WordProps,bSecEnd)); } - + if (bPaint) { RearrangePart(CPVT_WordRange(m_wpOldCaret,m_wpCaret)); @@ -3152,10 +3152,10 @@ FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) else if (m_wpCaret.LineCmp(m_wpOldCaret) !=0) wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(m_wpCaret),m_pVT->GetSectionEndPlace(m_wpCaret)); else - wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpOldCaret),m_pVT->GetSectionEndPlace(m_wpCaret)); + wr = CPVT_WordRange(m_pVT->GetPrevWordPlace(m_wpOldCaret),m_pVT->GetSectionEndPlace(m_wpCaret)); Refresh(RP_ANALYSE, &wr); - + SetCaretOrigin(); SetCaretInfo(); } @@ -3200,14 +3200,14 @@ FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) { pIterator->SetAt(range.EndPos); - CPVT_Word wordinfo; - CPVT_Section secinfo; + CPVT_Word wordinfo; + CPVT_Section secinfo; do - { + { CPVT_WordPlace place = pIterator->GetAt(); if (place.WordCmp(range.BeginPos) <= 0)break; - CPVT_WordPlace oldplace = m_pVT->GetPrevWordPlace(place); + CPVT_WordPlace oldplace = m_pVT->GetPrevWordPlace(place); if (oldplace.SecCmp(place) != 0) { @@ -3220,7 +3220,7 @@ FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) else { if (pIterator->GetWord(wordinfo)) - { + { oldplace = m_pVT->AjustLineHeader(oldplace,TRUE); place = m_pVT->AjustLineHeader(place,TRUE); @@ -3233,23 +3233,23 @@ FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) EndGroupUndo(); } else - { - AddEditUndoItem(new CFXEU_Clear(this,range,GetSelText())); + { + AddEditUndoItem(new CFXEU_Clear(this,range,GetSelText())); } } - SelectNone(); - SetCaret(m_pVT->DeleteWords(range)); + SelectNone(); + SetCaret(m_pVT->DeleteWords(range)); m_SelState.Set(m_wpCaret,m_wpCaret); if (bPaint) { - RearrangePart(range); + RearrangePart(range); ScrollToCaret(); CPVT_WordRange wr(m_wpOldCaret, GetVisibleWordRange().EndPos); Refresh(RP_ANALYSE, &wr); - + SetCaretOrigin(); SetCaretInfo(); } @@ -3297,12 +3297,12 @@ void CFX_Edit::PaintInsertText(const CPVT_WordPlace & wpOld, const CPVT_WordPlac { RearrangePart(CPVT_WordRange(wpOld,wpNew)); ScrollToCaret(); - + CPVT_WordRange wr; if (m_wpCaret.LineCmp(wpOld) !=0) - wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(wpOld),m_pVT->GetSectionEndPlace(wpNew)); + wr = CPVT_WordRange(m_pVT->GetLineBeginPlace(wpOld),m_pVT->GetSectionEndPlace(wpNew)); else - wr = CPVT_WordRange(wpOld,m_pVT->GetSectionEndPlace(wpNew)); + wr = CPVT_WordRange(wpOld,m_pVT->GetSectionEndPlace(wpNew)); Refresh(RP_ANALYSE, &wr); SetCaretOrigin(); SetCaretInfo(); @@ -3352,12 +3352,12 @@ void CFX_Edit::SetCaretOrigin() m_ptCaret.y = word.ptWord.y; } else if (pIterator->GetLine(line)) - { + { m_ptCaret.x = line.ptLine.x; m_ptCaret.y = line.ptLine.y; } - } - } + } + } } int32_t CFX_Edit::WordPlaceToWordIndex(const CPVT_WordPlace & place) const @@ -3510,7 +3510,7 @@ FX_FLOAT CFX_Edit::GetLineBottom(const CPVT_WordPlace& place) const return 0.0f; } -CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, const FX_WCHAR* text, int32_t charset, +CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, const FX_WCHAR* text, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) { CPVT_WordPlace wp = place; @@ -3529,7 +3529,7 @@ CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, const FX_WCHA if (sText[i+1] == 0x0A) i++; break; - case 0x0A: + case 0x0A: wp = m_pVT->InsertSection(wp,pSecProps,pWordProps); if (sText[i+1] == 0x0D) i++; -- cgit v1.2.3