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

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

Issue 1896893003: Cleanup FDE interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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 | « xfa/fxfa/app/xfa_ffpageview.cpp ('k') | xfa/fxfa/app/xfa_fwltheme.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_ffwidgetacc.h" 7 #include "xfa/fxfa/app/xfa_ffwidgetacc.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) { 135 if (caption && caption.GetPresence() != XFA_ATTRIBUTEENUM_Hidden) {
136 m_pCapTextProvider = 136 m_pCapTextProvider =
137 new CXFA_TextProvider(pAcc, XFA_TEXTPROVIDERTYPE_Caption); 137 new CXFA_TextProvider(pAcc, XFA_TEXTPROVIDERTYPE_Caption);
138 m_pCapTextLayout = new CXFA_TextLayout(m_pCapTextProvider); 138 m_pCapTextLayout = new CXFA_TextLayout(m_pCapTextProvider);
139 return TRUE; 139 return TRUE;
140 } 140 }
141 return FALSE; 141 return FALSE;
142 } 142 }
143 CXFA_TextLayout* m_pCapTextLayout; 143 CXFA_TextLayout* m_pCapTextLayout;
144 CXFA_TextProvider* m_pCapTextProvider; 144 CXFA_TextProvider* m_pCapTextProvider;
145 IFDE_TextOut* m_pTextOut; 145 CFDE_TextOut* m_pTextOut;
146 CFX_FloatArray* m_pFieldSplitArray; 146 CFX_FloatArray* m_pFieldSplitArray;
147 }; 147 };
148 class CXFA_TextEditData : public CXFA_FieldLayoutData { 148 class CXFA_TextEditData : public CXFA_FieldLayoutData {
149 public: 149 public:
150 }; 150 };
151 class CXFA_ImageEditData : public CXFA_FieldLayoutData { 151 class CXFA_ImageEditData : public CXFA_FieldLayoutData {
152 public: 152 public:
153 CXFA_ImageEditData() 153 CXFA_ImageEditData()
154 : m_pDIBitmap(NULL), 154 : m_pDIBitmap(NULL),
155 m_bNamedImage(FALSE), 155 m_bNamedImage(FALSE),
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 GetValue(wsText, XFA_VALUEPICTURE_Display); 875 GetValue(wsText, XFA_VALUEPICTURE_Display);
876 if (wsText.IsEmpty()) { 876 if (wsText.IsEmpty()) {
877 size.y += fFontSize; 877 size.y += fFontSize;
878 return; 878 return;
879 } 879 }
880 FX_WCHAR wcEnter = '\n'; 880 FX_WCHAR wcEnter = '\n';
881 FX_WCHAR wsLast = wsText.GetAt(wsText.GetLength() - 1); 881 FX_WCHAR wsLast = wsText.GetAt(wsText.GetLength() - 1);
882 if (wsLast == wcEnter) { 882 if (wsLast == wcEnter) {
883 wsText = wsText + wcEnter; 883 wsText = wsText + wcEnter;
884 } 884 }
885 if (!((CXFA_FieldLayoutData*)m_pLayoutData)->m_pTextOut) { 885
886 ((CXFA_FieldLayoutData*)m_pLayoutData)->m_pTextOut = IFDE_TextOut::Create(); 886 CXFA_FieldLayoutData* layoutData =
887 IFDE_TextOut* pTextOut = ((CXFA_FieldLayoutData*)m_pLayoutData)->m_pTextOut; 887 static_cast<CXFA_FieldLayoutData*>(m_pLayoutData);
888 if (!layoutData->m_pTextOut) {
889 layoutData->m_pTextOut = new CFDE_TextOut;
890 CFDE_TextOut* pTextOut = layoutData->m_pTextOut;
888 pTextOut->SetFont(GetFDEFont()); 891 pTextOut->SetFont(GetFDEFont());
889 pTextOut->SetFontSize(fFontSize); 892 pTextOut->SetFontSize(fFontSize);
890 pTextOut->SetLineBreakTolerance(fFontSize * 0.2f); 893 pTextOut->SetLineBreakTolerance(fFontSize * 0.2f);
891 pTextOut->SetLineSpace(GetLineHeight()); 894 pTextOut->SetLineSpace(GetLineHeight());
892 uint32_t dwStyles = FDE_TTOSTYLE_LastLineHeight; 895 uint32_t dwStyles = FDE_TTOSTYLE_LastLineHeight;
893 if (GetUIType() == XFA_ELEMENT_TextEdit && IsMultiLine()) { 896 if (GetUIType() == XFA_ELEMENT_TextEdit && IsMultiLine()) {
894 dwStyles |= FDE_TTOSTYLE_LineWrap; 897 dwStyles |= FDE_TTOSTYLE_LineWrap;
895 } 898 }
896 pTextOut->SetStyles(dwStyles); 899 pTextOut->SetStyles(dwStyles);
897 } 900 }
898 ((CXFA_FieldLayoutData*)m_pLayoutData) 901 layoutData->m_pTextOut->CalcLogicSize(wsText.c_str(), wsText.GetLength(),
899 ->m_pTextOut->CalcLogicSize(wsText.c_str(), wsText.GetLength(), size); 902 size);
900 } 903 }
901 FX_BOOL CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { 904 FX_BOOL CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) {
902 if (size.x > 0) { 905 if (size.x > 0) {
903 CFX_SizeF szOrz = size; 906 CFX_SizeF szOrz = size;
904 CFX_SizeF szCap; 907 CFX_SizeF szCap;
905 CalcCaptionSize(szCap); 908 CalcCaptionSize(szCap);
906 FX_BOOL bCapExit = szCap.x > 0.01 && szCap.y > 0.01; 909 FX_BOOL bCapExit = szCap.x > 0.01 && szCap.y > 0.01;
907 int32_t iCapPlacement = XFA_ATTRIBUTEENUM_Unknown; 910 int32_t iCapPlacement = XFA_ATTRIBUTEENUM_Unknown;
908 if (bCapExit) { 911 if (bCapExit) {
909 iCapPlacement = GetCaption().GetPlacementType(); 912 iCapPlacement = GetCaption().GetPlacementType();
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 if (pIDNode) { 1699 if (pIDNode) {
1697 pEmbAcc = (CXFA_WidgetAcc*)pIDNode->GetWidgetData(); 1700 pEmbAcc = (CXFA_WidgetAcc*)pIDNode->GetWidgetData();
1698 } 1701 }
1699 if (pEmbAcc) { 1702 if (pEmbAcc) {
1700 pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display); 1703 pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display);
1701 return TRUE; 1704 return TRUE;
1702 } 1705 }
1703 } 1706 }
1704 return FALSE; 1707 return FALSE;
1705 } 1708 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_ffpageview.cpp ('k') | xfa/fxfa/app/xfa_fwltheme.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698