OLD | NEW |
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_ffimageedit.h" | 7 #include "xfa/fxfa/app/xfa_ffimageedit.h" |
8 | 8 |
9 #include "xfa/fwl/core/cfwl_message.h" | 9 #include "xfa/fwl/core/cfwl_message.h" |
10 #include "xfa/fwl/core/ifwl_app.h" | 10 #include "xfa/fwl/core/ifwl_app.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 FWLToClient(ms.m_fx, ms.m_fy); | 101 FWLToClient(ms.m_fx, ms.m_fy); |
102 TranslateFWLMessage(&ms); | 102 TranslateFWLMessage(&ms); |
103 IXFA_AppProvider* pAppProvider = GetAppProvider(); | 103 IXFA_AppProvider* pAppProvider = GetAppProvider(); |
104 if (!pAppProvider) { | 104 if (!pAppProvider) { |
105 return TRUE; | 105 return TRUE; |
106 } | 106 } |
107 CFX_WideString wsTitle; | 107 CFX_WideString wsTitle; |
108 CFX_WideString wsFilter; | 108 CFX_WideString wsFilter; |
109 pAppProvider->LoadString(XFA_IDS_ImageFilter, wsFilter); | 109 pAppProvider->LoadString(XFA_IDS_ImageFilter, wsFilter); |
110 CFX_WideStringArray wsPathArray; | 110 CFX_WideStringArray wsPathArray; |
111 pAppProvider->ShowFileDialog(wsTitle.AsWideStringC(), | 111 pAppProvider->ShowFileDialog(wsTitle.AsStringC(), wsFilter.AsStringC(), |
112 wsFilter.AsWideStringC(), wsPathArray); | 112 wsPathArray); |
113 int32_t iSize = wsPathArray.GetSize(); | 113 int32_t iSize = wsPathArray.GetSize(); |
114 if (iSize < 1) { | 114 if (iSize < 1) { |
115 return TRUE; | 115 return TRUE; |
116 } | 116 } |
117 CFX_WideString wsFilePath = wsPathArray[0]; | 117 CFX_WideString wsFilePath = wsPathArray[0]; |
118 FX_STRSIZE nLen = wsFilePath.GetLength(); | 118 FX_STRSIZE nLen = wsFilePath.GetLength(); |
119 FX_STRSIZE nIndex = nLen - 1; | 119 FX_STRSIZE nIndex = nLen - 1; |
120 while (nIndex > 0 && wsFilePath[nIndex] != '.') { | 120 while (nIndex > 0 && wsFilePath[nIndex] != '.') { |
121 nIndex--; | 121 nIndex--; |
122 } | 122 } |
(...skipping 18 matching lines...) Expand all Loading... |
141 bsBuf.ReleaseBuffer(); | 141 bsBuf.ReleaseBuffer(); |
142 if (!bsBuf.IsEmpty()) { | 142 if (!bsBuf.IsEmpty()) { |
143 FX_CHAR* pData = XFA_Base64Encode(bsBuf, nDataSize); | 143 FX_CHAR* pData = XFA_Base64Encode(bsBuf, nDataSize); |
144 wsImage = CFX_WideString::FromLocal(pData); | 144 wsImage = CFX_WideString::FromLocal(pData); |
145 FX_Free(pData); | 145 FX_Free(pData); |
146 } | 146 } |
147 } | 147 } |
148 m_pDataAcc->SetImageEditImage(NULL); | 148 m_pDataAcc->SetImageEditImage(NULL); |
149 pFileRead->Release(); | 149 pFileRead->Release(); |
150 } | 150 } |
151 m_pDataAcc->SetImageEdit(wsContentType.AsWideStringC(), CFX_WideStringC(), | 151 m_pDataAcc->SetImageEdit(wsContentType.AsStringC(), CFX_WideStringC(), |
152 wsImage.AsWideStringC()); | 152 wsImage.AsStringC()); |
153 m_pDataAcc->LoadImageEditImage(); | 153 m_pDataAcc->LoadImageEditImage(); |
154 AddInvalidateRect(); | 154 AddInvalidateRect(); |
155 m_pDocView->SetChangeMark(); | 155 m_pDocView->SetChangeMark(); |
156 return TRUE; | 156 return TRUE; |
157 } | 157 } |
158 void CXFA_FFImageEdit::SetFWLRect() { | 158 void CXFA_FFImageEdit::SetFWLRect() { |
159 if (!m_pNormalWidget) { | 159 if (!m_pNormalWidget) { |
160 return; | 160 return; |
161 } | 161 } |
162 CFX_RectF rtUIMargin; | 162 CFX_RectF rtUIMargin; |
(...skipping 15 matching lines...) Expand all Loading... |
178 return m_pOldDelegate->OnProcessMessage(pMessage); | 178 return m_pOldDelegate->OnProcessMessage(pMessage); |
179 } | 179 } |
180 FWL_ERR CXFA_FFImageEdit::OnProcessEvent(CFWL_Event* pEvent) { | 180 FWL_ERR CXFA_FFImageEdit::OnProcessEvent(CFWL_Event* pEvent) { |
181 CXFA_FFField::OnProcessEvent(pEvent); | 181 CXFA_FFField::OnProcessEvent(pEvent); |
182 return m_pOldDelegate->OnProcessEvent(pEvent); | 182 return m_pOldDelegate->OnProcessEvent(pEvent); |
183 } | 183 } |
184 FWL_ERR CXFA_FFImageEdit::OnDrawWidget(CFX_Graphics* pGraphics, | 184 FWL_ERR CXFA_FFImageEdit::OnDrawWidget(CFX_Graphics* pGraphics, |
185 const CFX_Matrix* pMatrix) { | 185 const CFX_Matrix* pMatrix) { |
186 return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); | 186 return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); |
187 } | 187 } |
OLD | NEW |