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

Side by Side Diff: xfa/fxfa/app/xfa_fftext.cpp

Issue 2467203003: Remove FX_BOOL from xfa. (Closed)
Patch Set: Created 4 years, 1 month 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 | « xfa/fxfa/app/xfa_fftext.h ('k') | xfa/fxfa/app/xfa_fftextedit.h » ('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/fxfa/app/xfa_fftext.h" 7 #include "xfa/fxfa/app/xfa_fftext.h"
8 8
9 #include "xfa/fwl/core/fwl_widgetdef.h" 9 #include "xfa/fwl/core/fwl_widgetdef.h"
10 #include "xfa/fwl/core/fwl_widgethit.h" 10 #include "xfa/fwl/core/fwl_widgethit.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 55 }
56 CFX_Matrix mt; 56 CFX_Matrix mt;
57 mt.Set(1, 0, 0, 1, rtText.left, rtText.top); 57 mt.Set(1, 0, 0, 1, rtText.left, rtText.top);
58 CFX_RectF rtClip = rtText; 58 CFX_RectF rtClip = rtText;
59 mtRotate.TransformRect(rtClip); 59 mtRotate.TransformRect(rtClip);
60 mt.Concat(mtRotate); 60 mt.Concat(mtRotate);
61 pTextLayout->DrawString(pRenderDevice, mt, rtClip, GetIndex()); 61 pTextLayout->DrawString(pRenderDevice, mt, rtClip, GetIndex());
62 } 62 }
63 } 63 }
64 } 64 }
65 FX_BOOL CXFA_FFText::IsLoaded() { 65 bool CXFA_FFText::IsLoaded() {
66 CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout(); 66 CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
67 return pTextLayout && !pTextLayout->m_bHasBlock; 67 return pTextLayout && !pTextLayout->m_bHasBlock;
68 } 68 }
69 FX_BOOL CXFA_FFText::PerformLayout() { 69 bool CXFA_FFText::PerformLayout() {
70 CXFA_FFDraw::PerformLayout(); 70 CXFA_FFDraw::PerformLayout();
71 CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout(); 71 CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout();
72 if (!pTextLayout) { 72 if (!pTextLayout) {
73 return FALSE; 73 return false;
74 } 74 }
75 if (!pTextLayout->m_bHasBlock) { 75 if (!pTextLayout->m_bHasBlock) {
76 return TRUE; 76 return true;
77 } 77 }
78 pTextLayout->m_Blocks.RemoveAll(); 78 pTextLayout->m_Blocks.RemoveAll();
79 CXFA_LayoutItem* pItem = this; 79 CXFA_LayoutItem* pItem = this;
80 if (!pItem->GetPrev() && !pItem->GetNext()) { 80 if (!pItem->GetPrev() && !pItem->GetNext()) {
81 return TRUE; 81 return true;
82 } 82 }
83 pItem = pItem->GetFirst(); 83 pItem = pItem->GetFirst();
84 while (pItem) { 84 while (pItem) {
85 CFX_RectF rtText; 85 CFX_RectF rtText;
86 pItem->GetRect(rtText); 86 pItem->GetRect(rtText);
87 if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) { 87 if (CXFA_Margin mgWidget = m_pDataAcc->GetMargin()) {
88 if (!pItem->GetPrev()) { 88 if (!pItem->GetPrev()) {
89 FX_FLOAT fTopInset; 89 FX_FLOAT fTopInset;
90 mgWidget.GetTopInset(fTopInset); 90 mgWidget.GetTopInset(fTopInset);
91 rtText.height -= fTopInset; 91 rtText.height -= fTopInset;
92 } else if (!pItem->GetNext()) { 92 } else if (!pItem->GetNext()) {
93 FX_FLOAT fBottomInset; 93 FX_FLOAT fBottomInset;
94 mgWidget.GetBottomInset(fBottomInset); 94 mgWidget.GetBottomInset(fBottomInset);
95 rtText.height -= fBottomInset; 95 rtText.height -= fBottomInset;
96 } 96 }
97 } 97 }
98 pTextLayout->ItemBlocks(rtText, pItem->GetIndex()); 98 pTextLayout->ItemBlocks(rtText, pItem->GetIndex());
99 pItem = pItem->GetNext(); 99 pItem = pItem->GetNext();
100 } 100 }
101 pTextLayout->m_bHasBlock = FALSE; 101 pTextLayout->m_bHasBlock = false;
102 return TRUE; 102 return true;
103 } 103 }
104 FX_BOOL CXFA_FFText::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { 104 bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
105 CFX_RectF rtBox; 105 CFX_RectF rtBox;
106 GetRectWithoutRotate(rtBox); 106 GetRectWithoutRotate(rtBox);
107 if (!rtBox.Contains(fx, fy)) { 107 if (!rtBox.Contains(fx, fy)) {
108 return FALSE; 108 return false;
109 } 109 }
110 const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy); 110 const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy);
111 if (!wsURLContent) { 111 if (!wsURLContent) {
112 return FALSE; 112 return false;
113 } 113 }
114 SetButtonDown(TRUE); 114 SetButtonDown(true);
115 return TRUE; 115 return true;
116 } 116 }
117 FX_BOOL CXFA_FFText::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { 117 bool CXFA_FFText::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
118 CFX_RectF rtBox; 118 CFX_RectF rtBox;
119 GetRectWithoutRotate(rtBox); 119 GetRectWithoutRotate(rtBox);
120 if (!rtBox.Contains(fx, fy)) { 120 if (!rtBox.Contains(fx, fy)) {
121 return FALSE; 121 return false;
122 } 122 }
123 const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy); 123 const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy);
124 if (!wsURLContent) { 124 if (!wsURLContent) {
125 return FALSE; 125 return false;
126 } 126 }
127 return TRUE; 127 return true;
128 } 128 }
129 FX_BOOL CXFA_FFText::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { 129 bool CXFA_FFText::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
130 if (!IsButtonDown()) { 130 if (!IsButtonDown()) {
131 return FALSE; 131 return false;
132 } 132 }
133 SetButtonDown(FALSE); 133 SetButtonDown(false);
134 const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy); 134 const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy);
135 if (!wsURLContent) { 135 if (!wsURLContent) {
136 return FALSE; 136 return false;
137 } 137 }
138 CXFA_FFDoc* pDoc = GetDoc(); 138 CXFA_FFDoc* pDoc = GetDoc();
139 pDoc->GetDocEnvironment()->GotoURL(pDoc, wsURLContent); 139 pDoc->GetDocEnvironment()->GotoURL(pDoc, wsURLContent);
140 return TRUE; 140 return true;
141 } 141 }
142 FWL_WidgetHit CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { 142 FWL_WidgetHit CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) {
143 CFX_RectF rtBox; 143 CFX_RectF rtBox;
144 GetRectWithoutRotate(rtBox); 144 GetRectWithoutRotate(rtBox);
145 if (!rtBox.Contains(fx, fy)) 145 if (!rtBox.Contains(fx, fy))
146 return FWL_WidgetHit::Unknown; 146 return FWL_WidgetHit::Unknown;
147 if (!GetLinkURLAtPoint(fx, fy)) 147 if (!GetLinkURLAtPoint(fx, fy))
148 return FWL_WidgetHit::Unknown; 148 return FWL_WidgetHit::Unknown;
149 return FWL_WidgetHit::HyperLink; 149 return FWL_WidgetHit::HyperLink;
150 } 150 }
(...skipping 17 matching lines...) Expand all
168 } 168 }
169 } 169 }
170 return nullptr; 170 return nullptr;
171 } 171 }
172 void CXFA_FFText::FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy) { 172 void CXFA_FFText::FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy) {
173 CFX_RectF rtWidget; 173 CFX_RectF rtWidget;
174 GetRectWithoutRotate(rtWidget); 174 GetRectWithoutRotate(rtWidget);
175 fx -= rtWidget.left; 175 fx -= rtWidget.left;
176 fy -= rtWidget.top; 176 fy -= rtWidget.top;
177 } 177 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_fftext.h ('k') | xfa/fxfa/app/xfa_fftextedit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698