diff options
-rw-r--r-- | BUILD.gn | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffimage.cpp | 3 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffimageedit.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidget.cpp | 11 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidget.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.cpp | 32 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_imagedata.cpp (renamed from xfa/fxfa/parser/cxfa_image.cpp) | 20 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_imagedata.h (renamed from xfa/fxfa/parser/cxfa_image.h) | 10 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_value.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_value.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 18 |
12 files changed, 58 insertions, 56 deletions
@@ -1827,8 +1827,8 @@ if (pdf_enable_xfa) { "xfa/fxfa/parser/cxfa_filldata.h", "xfa/fxfa/parser/cxfa_fontdata.cpp", "xfa/fxfa/parser/cxfa_fontdata.h", - "xfa/fxfa/parser/cxfa_image.cpp", - "xfa/fxfa/parser/cxfa_image.h", + "xfa/fxfa/parser/cxfa_imagedata.cpp", + "xfa/fxfa/parser/cxfa_imagedata.h", "xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp", "xfa/fxfa/parser/cxfa_itemlayoutprocessor.h", "xfa/fxfa/parser/cxfa_layoutcontext.h", diff --git a/xfa/fxfa/cxfa_ffimage.cpp b/xfa/fxfa/cxfa_ffimage.cpp index 9903e6b25d..6dda044194 100644 --- a/xfa/fxfa/cxfa_ffimage.cpp +++ b/xfa/fxfa/cxfa_ffimage.cpp @@ -60,8 +60,7 @@ void CXFA_FFImage::RenderWidget(CXFA_Graphics* pGS, } CXFA_Value value = m_pDataAcc->GetFormValue(); - CXFA_Image imageObj = value.GetImage(); - int32_t iAspect = imageObj.GetAspect(); + int32_t iAspect = value.GetImageData().GetAspect(); int32_t iImageXDpi = 0; int32_t iImageYDpi = 0; m_pDataAcc->GetImageDpi(iImageXDpi, iImageYDpi); diff --git a/xfa/fxfa/cxfa_ffimageedit.cpp b/xfa/fxfa/cxfa_ffimageedit.cpp index 14d66e6198..0a6338aff6 100644 --- a/xfa/fxfa/cxfa_ffimageedit.cpp +++ b/xfa/fxfa/cxfa_ffimageedit.cpp @@ -77,8 +77,8 @@ void CXFA_FFImageEdit::RenderWidget(CXFA_Graphics* pGS, int32_t iAspect = XFA_ATTRIBUTEENUM_Fit; if (CXFA_Value value = m_pDataAcc->GetFormValue()) { - if (CXFA_Image imageObj = value.GetImage()) - iAspect = imageObj.GetAspect(); + if (CXFA_ImageData imageData = value.GetImageData()) + iAspect = imageData.GetAspect(); } int32_t iImageXDpi = 0; diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index 97dc26846e..48e7ae49ac 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -1890,26 +1890,26 @@ FXCODEC_IMAGE_TYPE XFA_GetImageType(const WideString& wsType) { } RetainPtr<CFX_DIBitmap> XFA_LoadImageData(CXFA_FFDoc* pDoc, - CXFA_Image* pImage, + CXFA_ImageData* pImageData, bool& bNameImage, int32_t& iImageXDpi, int32_t& iImageYDpi) { WideString wsHref; WideString wsImage; - pImage->GetHref(wsHref); - pImage->GetContent(wsImage); + pImageData->GetHref(wsHref); + pImageData->GetContent(wsImage); if (wsHref.IsEmpty() && wsImage.IsEmpty()) return nullptr; WideString wsContentType; - pImage->GetContentType(wsContentType); + pImageData->GetContentType(wsContentType); FXCODEC_IMAGE_TYPE type = XFA_GetImageType(wsContentType); ByteString bsContent; uint8_t* pImageBuffer = nullptr; RetainPtr<IFX_SeekableReadStream> pImageFileRead; if (wsImage.GetLength() > 0) { XFA_ATTRIBUTEENUM iEncoding = - (XFA_ATTRIBUTEENUM)pImage->GetTransferEncoding(); + (XFA_ATTRIBUTEENUM)pImageData->GetTransferEncoding(); if (iEncoding == XFA_ATTRIBUTEENUM_Base64) { ByteString bsData = wsImage.UTF8Encode(); int32_t iLength = bsData.GetLength(); @@ -1947,6 +1947,7 @@ RetainPtr<CFX_DIBitmap> XFA_LoadImageData(CXFA_FFDoc* pDoc, FX_Free(pImageBuffer); return pBitmap; } + static FXDIB_Format XFA_GetDIBFormat(FXCODEC_IMAGE_TYPE type, int32_t iComponents, int32_t iBitsPerComponent) { diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h index 26cca1ee5b..3f5181792d 100644 --- a/xfa/fxfa/cxfa_ffwidget.h +++ b/xfa/fxfa/cxfa_ffwidget.h @@ -50,7 +50,7 @@ void XFA_DrawImage(CXFA_Graphics* pGS, int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top); RetainPtr<CFX_DIBitmap> XFA_LoadImageData(CXFA_FFDoc* pDoc, - CXFA_Image* pImage, + CXFA_ImageData* pImageData, bool& bNameImage, int32_t& iImageXDpi, int32_t& iImageYDpi); diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index 32d925fead..c28f6d4185 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -81,12 +81,12 @@ class CXFA_ImageLayoutData : public CXFA_WidgetLayoutData { if (!value) return false; - CXFA_Image imageObj = value.GetImage(); - if (!imageObj) + CXFA_ImageData imageData = value.GetImageData(); + if (!imageData) return false; CXFA_FFDoc* pFFDoc = pAcc->GetDoc(); - pAcc->SetImageImage(XFA_LoadImageData(pFFDoc, &imageObj, m_bNamedImage, + pAcc->SetImageImage(XFA_LoadImageData(pFFDoc, &imageData, m_bNamedImage, m_iImageXDpi, m_iImageYDpi)); return !!m_pDIBitmap; } @@ -141,9 +141,9 @@ class CXFA_ImageEditData : public CXFA_FieldLayoutData { if (!value) return false; - CXFA_Image imageObj = value.GetImage(); + CXFA_ImageData imageData = value.GetImageData(); CXFA_FFDoc* pFFDoc = pAcc->GetDoc(); - pAcc->SetImageEditImage(XFA_LoadImageData(pFFDoc, &imageObj, m_bNamedImage, + pAcc->SetImageEditImage(XFA_LoadImageData(pFFDoc, &imageData, m_bNamedImage, m_iImageXDpi, m_iImageYDpi)); return !!m_pDIBitmap; } @@ -179,12 +179,12 @@ void CXFA_WidgetAcc::ResetData() { switch (eUIType) { case XFA_Element::ImageEdit: { CXFA_Value imageValue = GetDefaultValue(); - CXFA_Image image = imageValue.GetImage(); + CXFA_ImageData imageData = imageValue.GetImageData(); WideString wsContentType, wsHref; - if (image) { - image.GetContent(wsValue); - image.GetContentType(wsContentType); - image.GetHref(wsHref); + if (imageData) { + imageData.GetContent(wsValue); + imageData.GetContentType(wsContentType); + imageData.GetHref(wsHref); } SetImageEdit(wsContentType, wsHref, wsValue); break; @@ -237,17 +237,19 @@ void CXFA_WidgetAcc::ResetData() { void CXFA_WidgetAcc::SetImageEdit(const WideString& wsContentType, const WideString& wsHref, const WideString& wsData) { - CXFA_Image image = GetFormValue().GetImage(); - if (image) { - image.SetContentType(WideString(wsContentType)); - image.SetHref(wsHref); + CXFA_ImageData imageData = GetFormValue().GetImageData(); + if (imageData) { + imageData.SetContentType(WideString(wsContentType)); + imageData.SetHref(wsHref); } + WideString wsFormatValue(wsData); GetFormatDataValue(wsData, wsFormatValue); m_pNode->JSNode()->SetContent(wsData, wsFormatValue, true, false, true); + CXFA_Node* pBind = GetDatasets(); if (!pBind) { - image.SetTransferEncoding(XFA_ATTRIBUTEENUM_Base64); + imageData.SetTransferEncoding(XFA_ATTRIBUTEENUM_Base64); return; } pBind->JSNode()->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType, false, diff --git a/xfa/fxfa/cxfa_widgetacc.h b/xfa/fxfa/cxfa_widgetacc.h index 4d66ff3b5a..980a38175e 100644 --- a/xfa/fxfa/cxfa_widgetacc.h +++ b/xfa/fxfa/cxfa_widgetacc.h @@ -16,7 +16,7 @@ #include "core/fxge/fx_dib.h" #include "xfa/fxfa/parser/cxfa_boxdata.h" #include "xfa/fxfa/parser/cxfa_eventdata.h" -#include "xfa/fxfa/parser/cxfa_image.h" +#include "xfa/fxfa/parser/cxfa_imagedata.h" #include "xfa/fxfa/parser/cxfa_margin.h" #include "xfa/fxfa/parser/cxfa_script.h" #include "xfa/fxfa/parser/cxfa_value.h" diff --git a/xfa/fxfa/parser/cxfa_image.cpp b/xfa/fxfa/parser/cxfa_imagedata.cpp index cd25b5a39e..4beb78c35b 100644 --- a/xfa/fxfa/parser/cxfa_image.cpp +++ b/xfa/fxfa/parser/cxfa_imagedata.cpp @@ -4,44 +4,44 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/parser/cxfa_image.h" +#include "xfa/fxfa/parser/cxfa_imagedata.h" #include "xfa/fxfa/parser/cxfa_node.h" -CXFA_Image::CXFA_Image(CXFA_Node* pNode, bool bDefValue) +CXFA_ImageData::CXFA_ImageData(CXFA_Node* pNode, bool bDefValue) : CXFA_Data(pNode), m_bDefValue(bDefValue) {} -int32_t CXFA_Image::GetAspect() { +int32_t CXFA_ImageData::GetAspect() { return m_pNode->JSNode()->GetEnum(XFA_ATTRIBUTE_Aspect); } -bool CXFA_Image::GetContentType(WideString& wsContentType) { +bool CXFA_ImageData::GetContentType(WideString& wsContentType) { return m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_ContentType, wsContentType, true); } -bool CXFA_Image::GetHref(WideString& wsHref) { +bool CXFA_ImageData::GetHref(WideString& wsHref) { if (m_bDefValue) return m_pNode->JSNode()->TryCData(XFA_ATTRIBUTE_Href, wsHref, true); return m_pNode->JSNode()->GetAttribute(L"href", wsHref, true); } -int32_t CXFA_Image::GetTransferEncoding() { +int32_t CXFA_ImageData::GetTransferEncoding() { if (m_bDefValue) return m_pNode->JSNode()->GetEnum(XFA_ATTRIBUTE_TransferEncoding); return XFA_ATTRIBUTEENUM_Base64; } -bool CXFA_Image::GetContent(WideString& wsText) { +bool CXFA_ImageData::GetContent(WideString& wsText) { return m_pNode->JSNode()->TryContent(wsText, false, true); } -bool CXFA_Image::SetContentType(const WideString& wsContentType) { +bool CXFA_ImageData::SetContentType(const WideString& wsContentType) { return m_pNode->JSNode()->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType, false, false); } -bool CXFA_Image::SetHref(const WideString& wsHref) { +bool CXFA_ImageData::SetHref(const WideString& wsHref) { if (m_bDefValue) return m_pNode->JSNode()->SetCData(XFA_ATTRIBUTE_Href, wsHref, false, false); @@ -49,7 +49,7 @@ bool CXFA_Image::SetHref(const WideString& wsHref) { wsHref.AsStringView(), false); } -bool CXFA_Image::SetTransferEncoding(int32_t iTransferEncoding) { +bool CXFA_ImageData::SetTransferEncoding(int32_t iTransferEncoding) { if (m_bDefValue) { return m_pNode->JSNode()->SetEnum(XFA_ATTRIBUTE_TransferEncoding, (XFA_ATTRIBUTEENUM)iTransferEncoding, diff --git a/xfa/fxfa/parser/cxfa_image.h b/xfa/fxfa/parser/cxfa_imagedata.h index cc08bc3380..e94615ae1d 100644 --- a/xfa/fxfa/parser/cxfa_image.h +++ b/xfa/fxfa/parser/cxfa_imagedata.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FXFA_PARSER_CXFA_IMAGE_H_ -#define XFA_FXFA_PARSER_CXFA_IMAGE_H_ +#ifndef XFA_FXFA_PARSER_CXFA_IMAGEDATA_H_ +#define XFA_FXFA_PARSER_CXFA_IMAGEDATA_H_ #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" @@ -13,9 +13,9 @@ class CXFA_Node; -class CXFA_Image : public CXFA_Data { +class CXFA_ImageData : public CXFA_Data { public: - CXFA_Image(CXFA_Node* pNode, bool bDefValue); + CXFA_ImageData(CXFA_Node* pNode, bool bDefValue); int32_t GetAspect(); bool GetContentType(WideString& wsContentType); @@ -30,4 +30,4 @@ class CXFA_Image : public CXFA_Data { bool m_bDefValue; }; -#endif // XFA_FXFA_PARSER_CXFA_IMAGE_H_ +#endif // XFA_FXFA_PARSER_CXFA_IMAGEDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_value.cpp b/xfa/fxfa/parser/cxfa_value.cpp index 9b7040c33b..5b812a9f7f 100644 --- a/xfa/fxfa/parser/cxfa_value.cpp +++ b/xfa/fxfa/parser/cxfa_value.cpp @@ -49,8 +49,8 @@ CXFA_ExData CXFA_Value::GetExData() { : nullptr); } -CXFA_Image CXFA_Value::GetImage() { - return CXFA_Image( +CXFA_ImageData CXFA_Value::GetImageData() { + return CXFA_ImageData( m_pNode ? (m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)) : nullptr, true); } diff --git a/xfa/fxfa/parser/cxfa_value.h b/xfa/fxfa/parser/cxfa_value.h index 513f37509b..65a9c36b00 100644 --- a/xfa/fxfa/parser/cxfa_value.h +++ b/xfa/fxfa/parser/cxfa_value.h @@ -11,7 +11,7 @@ #include "xfa/fxfa/parser/cxfa_arcdata.h" #include "xfa/fxfa/parser/cxfa_data.h" #include "xfa/fxfa/parser/cxfa_exdata.h" -#include "xfa/fxfa/parser/cxfa_image.h" +#include "xfa/fxfa/parser/cxfa_imagedata.h" #include "xfa/fxfa/parser/cxfa_line.h" #include "xfa/fxfa/parser/cxfa_rectangle.h" #include "xfa/fxfa/parser/cxfa_text.h" @@ -29,7 +29,7 @@ class CXFA_Value : public CXFA_Data { CXFA_Rectangle GetRectangle(); CXFA_Text GetText(); CXFA_ExData GetExData(); - CXFA_Image GetImage(); + CXFA_ImageData GetImageData(); }; #endif // XFA_FXFA_PARSER_CXFA_VALUE_H_ diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index 37d8084399..a6441a68db 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -138,13 +138,13 @@ void CreateDataBinding(CXFA_Node* pFormNode, WideString wsFormattedValue; switch (eUIType) { case XFA_Element::ImageEdit: { - CXFA_Image image = defValue.GetImage(); + CXFA_ImageData imageData = defValue.GetImageData(); WideString wsContentType; WideString wsHref; - if (image) { - image.GetContent(wsValue); - image.GetContentType(wsContentType); - image.GetHref(wsHref); + if (imageData) { + imageData.GetContent(wsValue); + imageData.GetContentType(wsContentType); + imageData.GetHref(wsHref); } CFX_XMLElement* pXMLDataElement = static_cast<CFX_XMLElement*>(pDataNode->GetXMLMappingNode()); @@ -297,8 +297,8 @@ void CreateDataBinding(CXFA_Node* pFormNode, case XFA_Element::ImageEdit: { FormValueNode_SetChildContent(defValue.GetNode(), wsNormalizeValue, XFA_Element::Image); - CXFA_Image image = defValue.GetImage(); - if (image) { + CXFA_ImageData imageData = defValue.GetImageData(); + if (imageData) { CFX_XMLElement* pXMLDataElement = static_cast<CFX_XMLElement*>(pDataNode->GetXMLMappingNode()); ASSERT(pXMLDataElement); @@ -308,12 +308,12 @@ void CreateDataBinding(CXFA_Node* pFormNode, if (!wsContentType.IsEmpty()) { pDataNode->JSNode()->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType, false, false); - image.SetContentType(wsContentType); + imageData.SetContentType(wsContentType); } WideString wsHref = pXMLDataElement->GetString(L"href"); if (!wsHref.IsEmpty()) - image.SetHref(wsHref); + imageData.SetHref(wsHref); } break; } |