diff options
31 files changed, 0 insertions, 3412 deletions
@@ -512,7 +512,6 @@ static_library("fxcodec") { "core/fxcodec/codec/fx_codec_jpx_opj.cpp", "core/fxcodec/include/fx_codec.h", "core/fxcodec/include/fx_codec_def.h", - "core/fxcodec/include/fx_codec_flate.h", "core/fxcodec/jbig2/JBig2_ArithDecoder.cpp", "core/fxcodec/jbig2/JBig2_ArithDecoder.h", "core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp", @@ -765,18 +764,10 @@ static_library("pdfwindow") { "fpdfsdk/pdfwindow/PWL_FontMap.h", "fpdfsdk/pdfwindow/PWL_Icon.cpp", "fpdfsdk/pdfwindow/PWL_Icon.h", - "fpdfsdk/pdfwindow/PWL_IconList.cpp", - "fpdfsdk/pdfwindow/PWL_IconList.h", - "fpdfsdk/pdfwindow/PWL_Label.cpp", - "fpdfsdk/pdfwindow/PWL_Label.h", "fpdfsdk/pdfwindow/PWL_ListBox.cpp", "fpdfsdk/pdfwindow/PWL_ListBox.h", - "fpdfsdk/pdfwindow/PWL_ListCtrl.cpp", - "fpdfsdk/pdfwindow/PWL_ListCtrl.h", "fpdfsdk/pdfwindow/PWL_ScrollBar.cpp", "fpdfsdk/pdfwindow/PWL_ScrollBar.h", - "fpdfsdk/pdfwindow/PWL_Signature.cpp", - "fpdfsdk/pdfwindow/PWL_Signature.h", "fpdfsdk/pdfwindow/PWL_SpecialButton.cpp", "fpdfsdk/pdfwindow/PWL_SpecialButton.h", "fpdfsdk/pdfwindow/PWL_Utils.cpp", @@ -1078,16 +1069,8 @@ if (pdf_enable_xfa) { "xfa/fwl/lightwidget/cfwl_picturebox.h", "xfa/fwl/lightwidget/cfwl_pushbutton.cpp", "xfa/fwl/lightwidget/cfwl_pushbutton.h", - "xfa/fwl/lightwidget/cfwl_scrollbar.cpp", - "xfa/fwl/lightwidget/cfwl_scrollbar.h", - "xfa/fwl/lightwidget/cfwl_theme.cpp", - "xfa/fwl/lightwidget/cfwl_theme.h", - "xfa/fwl/lightwidget/cfwl_tooltip.cpp", - "xfa/fwl/lightwidget/cfwl_tooltip.h", "xfa/fwl/lightwidget/cfwl_widget.cpp", "xfa/fwl/lightwidget/cfwl_widget.h", - "xfa/fwl/lightwidget/cfwl_widgetdelegate.cpp", - "xfa/fwl/lightwidget/cfwl_widgetdelegate.h", "xfa/fwl/lightwidget/cfwl_widgetproperties.cpp", "xfa/fwl/lightwidget/cfwl_widgetproperties.h", "xfa/fwl/theme/cfwl_barcodetp.cpp", @@ -1102,8 +1085,6 @@ if (pdf_enable_xfa) { "xfa/fwl/theme/cfwl_datetimepickertp.h", "xfa/fwl/theme/cfwl_edittp.cpp", "xfa/fwl/theme/cfwl_edittp.h", - "xfa/fwl/theme/cfwl_formtp.cpp", - "xfa/fwl/theme/cfwl_formtp.h", "xfa/fwl/theme/cfwl_listboxtp.cpp", "xfa/fwl/theme/cfwl_listboxtp.h", "xfa/fwl/theme/cfwl_monthcalendartp.cpp", @@ -1120,8 +1101,6 @@ if (pdf_enable_xfa) { "xfa/fxbarcode/BC_Dimension.cpp", "xfa/fxbarcode/BC_Dimension.h", "xfa/fxbarcode/BC_Library.cpp", - "xfa/fxbarcode/BC_ResultPoint.cpp", - "xfa/fxbarcode/BC_ResultPoint.h", "xfa/fxbarcode/BC_TwoDimWriter.cpp", "xfa/fxbarcode/BC_TwoDimWriter.h", "xfa/fxbarcode/BC_UtilCodingConvert.cpp", @@ -1155,14 +1134,10 @@ if (pdf_enable_xfa) { "xfa/fxbarcode/common/BC_CommonBitArray.h", "xfa/fxbarcode/common/BC_CommonBitMatrix.cpp", "xfa/fxbarcode/common/BC_CommonBitMatrix.h", - "xfa/fxbarcode/common/BC_CommonBitSource.cpp", - "xfa/fxbarcode/common/BC_CommonBitSource.h", "xfa/fxbarcode/common/BC_CommonByteArray.cpp", "xfa/fxbarcode/common/BC_CommonByteArray.h", "xfa/fxbarcode/common/BC_CommonByteMatrix.cpp", "xfa/fxbarcode/common/BC_CommonByteMatrix.h", - "xfa/fxbarcode/common/BC_CommonPerspectiveTransform.cpp", - "xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h", "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp", "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h", "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp", @@ -1220,8 +1195,6 @@ if (pdf_enable_xfa) { "xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h", "xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp", "xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h", - "xfa/fxbarcode/pdf417/BC_PDF417Codeword.cpp", - "xfa/fxbarcode/pdf417/BC_PDF417Codeword.h", "xfa/fxbarcode/pdf417/BC_PDF417Compaction.cpp", "xfa/fxbarcode/pdf417/BC_PDF417Compaction.h", "xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp", diff --git a/core/fxcodec/codec/fx_codec_flate.cpp b/core/fxcodec/codec/fx_codec_flate.cpp index d32a8a13ba..fd86cf3380 100644 --- a/core/fxcodec/codec/fx_codec_flate.cpp +++ b/core/fxcodec/codec/fx_codec_flate.cpp @@ -10,7 +10,6 @@ #include <memory> #include "core/fxcodec/include/fx_codec.h" -#include "core/fxcodec/include/fx_codec_flate.h" #include "core/fxcrt/include/fx_ext.h" #include "third_party/zlib_v128/zlib.h" diff --git a/core/fxcodec/include/fx_codec_flate.h b/core/fxcodec/include/fx_codec_flate.h deleted file mode 100644 index 83e9281b48..0000000000 --- a/core/fxcodec/include/fx_codec_flate.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 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 - -#ifndef CORE_FXCODEC_INCLUDE_FX_CODEC_FLATE_H_ -#define CORE_FXCODEC_INCLUDE_FX_CODEC_FLATE_H_ - -#include "third_party/zlib_v128/zlib.h" - -#ifdef __cplusplus -extern "C" { -#endif - -// Note: Some of these return Z_* status codes from zlib.h. -void* FPDFAPI_FlateInit(void* (*alloc_func)(void*, unsigned int, unsigned int), - void (*free_func)(void*, void*)); -void FPDFAPI_FlateInput(void* context, - const unsigned char* src_buf, - unsigned int src_size); -int FPDFAPI_FlateOutput(void* context, - unsigned char* dest_buf, - unsigned int dest_size); -int FPDFAPI_FlateGetAvailIn(void* context); -int FPDFAPI_FlateGetAvailOut(void* context); -void FPDFAPI_FlateEnd(void* context); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // CORE_FXCODEC_INCLUDE_FX_CODEC_FLATE_H_ diff --git a/fpdfsdk/pdfwindow/PWL_IconList.cpp b/fpdfsdk/pdfwindow/PWL_IconList.cpp deleted file mode 100644 index 26d6c92ea4..0000000000 --- a/fpdfsdk/pdfwindow/PWL_IconList.cpp +++ /dev/null @@ -1,478 +0,0 @@ -// 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 "fpdfsdk/pdfwindow/PWL_IconList.h" - -#include "fpdfsdk/pdfwindow/PWL_Label.h" -#include "fpdfsdk/pdfwindow/PWL_ListCtrl.h" -#include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" -#include "fpdfsdk/pdfwindow/PWL_Utils.h" -#include "fpdfsdk/pdfwindow/PWL_Wnd.h" -#include "public/fpdf_fwlevent.h" - -#define PWL_IconList_ITEM_ICON_LEFTMARGIN 10.0f -#define PWL_IconList_ITEM_WIDTH 20.0f -#define PWL_IconList_ITEM_HEIGHT 20.0f -#define PWL_IconList_ITEM_SPACE 4.0f - -CPWL_IconList_Item::CPWL_IconList_Item() - : m_nIconIndex(-1), - m_pData(nullptr), - m_bSelected(FALSE), - m_pText(nullptr) {} - -CPWL_IconList_Item::~CPWL_IconList_Item() {} - -CFX_ByteString CPWL_IconList_Item::GetClassName() const { - return "CPWL_IconList_Item"; -} - -FX_FLOAT CPWL_IconList_Item::GetItemHeight(FX_FLOAT fLimitWidth) { - return PWL_IconList_ITEM_HEIGHT; -} - -void CPWL_IconList_Item::DrawThisAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { - CFX_FloatRect rcClient = GetClientRect(); - - if (m_bSelected) { - if (IsEnabled()) { - CPWL_Utils::DrawFillRect( - pDevice, pUser2Device, rcClient, - CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_SELBACKCOLOR, - GetTransparency())); - } else { - CPWL_Utils::DrawFillRect( - pDevice, pUser2Device, rcClient, - CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_LIGHTGRAYCOLOR, - GetTransparency())); - } - } - - CFX_FloatRect rcIcon = rcClient; - rcIcon.left += PWL_IconList_ITEM_ICON_LEFTMARGIN; - rcIcon.right = rcIcon.left + PWL_IconList_ITEM_WIDTH; - - CPWL_Utils::DrawIconAppStream(pDevice, pUser2Device, m_nIconIndex, rcIcon, - m_crIcon, m_pText->GetTextColor(), - GetTransparency()); -} - -void CPWL_IconList_Item::SetSelect(FX_BOOL bSelected) { - m_bSelected = bSelected; - - if (bSelected) - m_pText->SetTextColor(PWL_DEFAULT_WHITECOLOR); - else - m_pText->SetTextColor(PWL_DEFAULT_BLACKCOLOR); -} - -FX_BOOL CPWL_IconList_Item::IsSelected() const { - return m_bSelected; -} - -void CPWL_IconList_Item::CreateChildWnd(const PWL_CREATEPARAM& cp) { - m_pText = new CPWL_Label; - - PWL_CREATEPARAM lcp = cp; - lcp.pParentWnd = this; - lcp.dwFlags = PWS_CHILD | PWS_VISIBLE | PES_LEFT | PES_CENTER; - lcp.sTextColor = PWL_DEFAULT_BLACKCOLOR; - lcp.fFontSize = 12; - m_pText->Create(lcp); -} - -void CPWL_IconList_Item::SetData(void* pData) { - m_pData = pData; -} - -void CPWL_IconList_Item::SetIcon(int32_t nIconIndex) { - m_nIconIndex = nIconIndex; -} - -void CPWL_IconList_Item::SetText(const CFX_WideString& str) { - m_pText->SetText(str.c_str()); -} - -CFX_WideString CPWL_IconList_Item::GetText() const { - return m_pText->GetText(); -} - -void CPWL_IconList_Item::RePosChildWnd() { - CFX_FloatRect rcClient = GetClientRect(); - - rcClient.left += - (PWL_IconList_ITEM_ICON_LEFTMARGIN + PWL_IconList_ITEM_WIDTH + - PWL_IconList_ITEM_ICON_LEFTMARGIN); - - m_pText->Move(rcClient, TRUE, FALSE); -} - -void CPWL_IconList_Item::SetIconFillColor(const CPWL_Color& color) { - m_crIcon = color; -} - -void CPWL_IconList_Item::OnEnabled() { - if (m_bSelected) - m_pText->SetTextColor(PWL_DEFAULT_WHITECOLOR); - else - m_pText->SetTextColor(PWL_DEFAULT_BLACKCOLOR); - - InvalidateRect(); -} - -void CPWL_IconList_Item::OnDisabled() { - m_pText->SetTextColor(PWL_DEFAULT_HEAVYGRAYCOLOR); - - InvalidateRect(); -} - -CPWL_IconList_Content::CPWL_IconList_Content(int32_t nListCount) - : m_nSelectIndex(-1), - m_bMouseDown(FALSE), - m_nListCount(nListCount) {} - -CPWL_IconList_Content::~CPWL_IconList_Content() {} - -void CPWL_IconList_Content::CreateChildWnd(const PWL_CREATEPARAM& cp) { - for (int32_t i = 0; i < m_nListCount; i++) { - CPWL_IconList_Item* pNewItem = new CPWL_IconList_Item(); - - PWL_CREATEPARAM icp = cp; - icp.pParentWnd = this; - icp.dwFlags = PWS_CHILD | PWS_VISIBLE | PWS_NOREFRESHCLIP; - pNewItem->Create(icp); - } - - SetItemSpace(PWL_IconList_ITEM_SPACE); - ResetContent(0); - - if (CPWL_Wnd* pParent = GetParentWindow()) { - CFX_FloatRect rcScroll = GetScrollArea(); - GetScrollPos(); - - PWL_SCROLL_INFO sInfo; - sInfo.fContentMin = rcScroll.bottom; - sInfo.fContentMax = rcScroll.top; - sInfo.fPlateWidth = GetClientRect().Height(); - sInfo.fSmallStep = 13.0f; - sInfo.fBigStep = sInfo.fPlateWidth; - - pParent->OnNotify(this, PNM_SETSCROLLINFO, SBT_VSCROLL, (intptr_t)&sInfo); - } -} - -FX_BOOL CPWL_IconList_Content::OnLButtonDown(const CFX_FloatPoint& point, - uint32_t nFlag) { - SetFocus(); - - SetCapture(); - m_bMouseDown = TRUE; - - int32_t nItemIndex = FindItemIndex(point); - SetSelect(nItemIndex); - ScrollToItem(nItemIndex); - - return TRUE; -} - -FX_BOOL CPWL_IconList_Content::OnLButtonUp(const CFX_FloatPoint& point, - uint32_t nFlag) { - m_bMouseDown = FALSE; - ReleaseCapture(); - - return TRUE; -} - -FX_BOOL CPWL_IconList_Content::OnMouseMove(const CFX_FloatPoint& point, - uint32_t nFlag) { - if (m_bMouseDown) { - int32_t nItemIndex = FindItemIndex(point); - SetSelect(nItemIndex); - ScrollToItem(nItemIndex); - } - - return TRUE; -} - -FX_BOOL CPWL_IconList_Content::OnKeyDown(uint16_t nChar, uint32_t nFlag) { - switch (nChar) { - case FWL_VKEY_Up: - if (m_nSelectIndex > 0) { - int32_t nItemIndex = m_nSelectIndex - 1; - SetSelect(nItemIndex); - ScrollToItem(nItemIndex); - } - return TRUE; - case FWL_VKEY_Down: - if (m_nSelectIndex < m_nListCount - 1) { - int32_t nItemIndex = m_nSelectIndex + 1; - SetSelect(nItemIndex); - ScrollToItem(nItemIndex); - } - return TRUE; - } - - return FALSE; -} - -int32_t CPWL_IconList_Content::FindItemIndex(const CFX_FloatPoint& point) { - int32_t nIndex = 0; - for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { - if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { - CFX_FloatRect rcWnd = pChild->ChildToParent(pChild->GetWindowRect()); - - if (point.y < rcWnd.top) { - nIndex = i; - } - } - } - - return nIndex; -} - -void CPWL_IconList_Content::ScrollToItem(int32_t nItemIndex) { - CFX_FloatRect rcClient = GetClientRect(); - - if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) { - CFX_FloatRect rcOrigin = pItem->GetWindowRect(); - CFX_FloatRect rcWnd = pItem->ChildToParent(rcOrigin); - - if (!(rcWnd.bottom > rcClient.bottom && rcWnd.top < rcClient.top)) { - CFX_FloatPoint ptScroll = GetScrollPos(); - - if (rcWnd.top > rcClient.top) { - ptScroll.y = rcOrigin.top; - } else if (rcWnd.bottom < rcClient.bottom) { - ptScroll.y = rcOrigin.bottom + rcClient.Height(); - } - - SetScrollPos(ptScroll); - ResetFace(); - InvalidateRect(); - if (CPWL_Wnd* pParent = GetParentWindow()) { - pParent->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, - (intptr_t)&ptScroll.y); - } - } - } -} - -void CPWL_IconList_Content::SetSelect(int32_t nIndex) { - if (m_nSelectIndex == nIndex) - return; - - SelectItem(m_nSelectIndex, FALSE); - SelectItem(nIndex, TRUE); - m_nSelectIndex = nIndex; -} - -int32_t CPWL_IconList_Content::GetSelect() const { - return m_nSelectIndex; -} - -void CPWL_IconList_Content::SelectItem(int32_t nItemIndex, FX_BOOL bSelect) { - if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) { - pItem->SetSelect(bSelect); - pItem->InvalidateRect(); - } -} - -CPWL_IconList_Item* CPWL_IconList_Content::GetListItem( - int32_t nItemIndex) const { - if (nItemIndex >= 0 && nItemIndex < m_aChildren.GetSize()) { - if (CPWL_Wnd* pChild = m_aChildren.GetAt(nItemIndex)) { - if (pChild->GetClassName() == "CPWL_IconList_Item") { - return (CPWL_IconList_Item*)pChild; - } - } - } - - return nullptr; -} - -void CPWL_IconList_Content::SetListData(int32_t nItemIndex, void* pData) { - if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) - pItem->SetData(pData); -} - -void CPWL_IconList_Content::SetListIcon(int32_t nItemIndex, - int32_t nIconIndex) { - if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) - pItem->SetIcon(nIconIndex); -} - -void CPWL_IconList_Content::SetListString(int32_t nItemIndex, - const CFX_WideString& str) { - if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) - pItem->SetText(str); -} - -CFX_WideString CPWL_IconList_Content::GetListString(int32_t nItemIndex) const { - if (CPWL_IconList_Item* pItem = GetListItem(nItemIndex)) - return pItem->GetText(); - - return L""; -} - -void CPWL_IconList_Content::SetIconFillColor(const CPWL_Color& color) { - for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { - if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { - if (pChild->GetClassName() == "CPWL_IconList_Item") { - CPWL_IconList_Item* pItem = (CPWL_IconList_Item*)pChild; - pItem->SetIconFillColor(color); - pItem->InvalidateRect(); - } - } - } -} - -CPWL_IconList::CPWL_IconList(int32_t nListCount) - : m_pListContent(nullptr), m_nListCount(nListCount) {} - -CPWL_IconList::~CPWL_IconList() {} - -void CPWL_IconList::RePosChildWnd() { - CPWL_Wnd::RePosChildWnd(); - - if (m_pListContent) - m_pListContent->Move(GetClientRect(), TRUE, FALSE); -} - -void CPWL_IconList::CreateChildWnd(const PWL_CREATEPARAM& cp) { - m_pListContent = new CPWL_IconList_Content(m_nListCount); - - PWL_CREATEPARAM ccp = cp; - ccp.pParentWnd = this; - ccp.dwFlags = PWS_CHILD | PWS_VISIBLE; - m_pListContent->Create(ccp); -} - -void CPWL_IconList::OnCreated() { - if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) { - pScrollBar->RemoveFlag(PWS_AUTOTRANSPARENT); - pScrollBar->SetTransparency(255); - pScrollBar->SetNotifyForever(TRUE); - } -} - -void CPWL_IconList::OnNotify(CPWL_Wnd* pWnd, - uint32_t msg, - intptr_t wParam, - intptr_t lParam) { - CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam); - - if (wParam == SBT_VSCROLL) { - switch (msg) { - case PNM_SETSCROLLINFO: - if (PWL_SCROLL_INFO* pInfo = (PWL_SCROLL_INFO*)lParam) { - if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) { - if (pInfo->fContentMax - pInfo->fContentMin > pInfo->fPlateWidth) { - if (!pScrollBar->IsVisible()) { - pScrollBar->SetVisible(TRUE); - RePosChildWnd(); - } else { - } - } else { - if (pScrollBar->IsVisible()) { - pScrollBar->SetVisible(FALSE); - RePosChildWnd(); - } - - if (m_pListContent) - m_pListContent->SetScrollPos(CFX_FloatPoint(0.0f, 0.0f)); - } - - pScrollBar->OnNotify(pWnd, PNM_SETSCROLLINFO, wParam, lParam); - } - } - return; - case PNM_SCROLLWINDOW: - if (m_pListContent) { - m_pListContent->SetScrollPos( - CFX_FloatPoint(0.0f, *(FX_FLOAT*)lParam)); - m_pListContent->ResetFace(); - m_pListContent->InvalidateRect(nullptr); - } - return; - case PNM_SETSCROLLPOS: - if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) - pScrollBar->OnNotify(pWnd, PNM_SETSCROLLPOS, wParam, lParam); - return; - } - } -} - -void CPWL_IconList::SetSelect(int32_t nIndex) { - m_pListContent->SetSelect(nIndex); -} - -void CPWL_IconList::SetTopItem(int32_t nIndex) { - m_pListContent->ScrollToItem(nIndex); -} - -int32_t CPWL_IconList::GetSelect() const { - return m_pListContent->GetSelect(); -} - -void CPWL_IconList::SetListData(int32_t nItemIndex, void* pData) { - m_pListContent->SetListData(nItemIndex, pData); -} - -void CPWL_IconList::SetListIcon(int32_t nItemIndex, int32_t nIconIndex) { - m_pListContent->SetListIcon(nItemIndex, nIconIndex); -} - -void CPWL_IconList::SetListString(int32_t nItemIndex, - const CFX_WideString& str) { - m_pListContent->SetListString(nItemIndex, str); -} - -CFX_WideString CPWL_IconList::GetListString(int32_t nItemIndex) const { - return m_pListContent->GetListString(nItemIndex); -} - -void CPWL_IconList::SetIconFillColor(const CPWL_Color& color) { - m_pListContent->SetIconFillColor(color); -} - -FX_BOOL CPWL_IconList::OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, - uint32_t nFlag) { - CFX_FloatPoint ptScroll = m_pListContent->GetScrollPos(); - CFX_FloatRect rcScroll = m_pListContent->GetScrollArea(); - CFX_FloatRect rcContents = m_pListContent->GetClientRect(); - - if (rcScroll.top - rcScroll.bottom > rcContents.Height()) { - CFX_FloatPoint ptNew = ptScroll; - - if (zDelta > 0) - ptNew.y += 30; - else - ptNew.y -= 30; - - if (ptNew.y > rcScroll.top) - ptNew.y = rcScroll.top; - if (ptNew.y < rcScroll.bottom + rcContents.Height()) - ptNew.y = rcScroll.bottom + rcContents.Height(); - if (ptNew.y < rcScroll.bottom) - ptNew.y = rcScroll.bottom; - - if (ptNew.y != ptScroll.y) { - m_pListContent->SetScrollPos(ptNew); - m_pListContent->ResetFace(); - m_pListContent->InvalidateRect(nullptr); - - if (CPWL_ScrollBar* pScrollBar = GetVScrollBar()) - pScrollBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL, - (intptr_t)&ptNew.y); - - return TRUE; - } - } - - return FALSE; -} diff --git a/fpdfsdk/pdfwindow/PWL_IconList.h b/fpdfsdk/pdfwindow/PWL_IconList.h deleted file mode 100644 index 901f4de976..0000000000 --- a/fpdfsdk/pdfwindow/PWL_IconList.h +++ /dev/null @@ -1,115 +0,0 @@ -// 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 - -#ifndef FPDFSDK_PDFWINDOW_PWL_ICONLIST_H_ -#define FPDFSDK_PDFWINDOW_PWL_ICONLIST_H_ - -#include "core/fxcrt/include/fx_string.h" -#include "fpdfsdk/pdfwindow/PWL_ListCtrl.h" -#include "fpdfsdk/pdfwindow/PWL_Wnd.h" - -class CPWL_IconList_Item; -class CPWL_IconList_Content; -class CPWL_IconList; -class CPWL_Label; - -class CPWL_IconList_Item : public CPWL_Wnd { - public: - CPWL_IconList_Item(); - ~CPWL_IconList_Item() override; - - void SetSelect(FX_BOOL bSelected); - FX_BOOL IsSelected() const; - void SetData(void* pData); - void SetIcon(int32_t nIconIndex); - void SetText(const CFX_WideString& str); - void SetIconFillColor(const CPWL_Color& color); - CFX_WideString GetText() const; - - protected: - // CPWL_Wnd - CFX_ByteString GetClassName() const override; - void CreateChildWnd(const PWL_CREATEPARAM& cp) override; - void RePosChildWnd() override; - FX_FLOAT GetItemHeight(FX_FLOAT fLimitWidth) override; - void DrawThisAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; - void OnEnabled() override; - void OnDisabled() override; - - private: - int32_t m_nIconIndex; - void* m_pData; - FX_BOOL m_bSelected; - CPWL_Label* m_pText; - CPWL_Color m_crIcon; -}; - -class CPWL_IconList_Content : public CPWL_ListCtrl { - public: - CPWL_IconList_Content(int32_t nListCount); - ~CPWL_IconList_Content() override; - - void SetSelect(int32_t nIndex); - int32_t GetSelect() const; - void SetListData(int32_t nItemIndex, void* pData); - void SetListIcon(int32_t nItemIndex, int32_t nIconIndex); - void SetListString(int32_t nItemIndex, const CFX_WideString& str); - void SetIconFillColor(const CPWL_Color& color); - CFX_WideString GetListString(int32_t nItemIndex) const; - void ScrollToItem(int32_t nItemIndex); - - protected: - // CPWL_ListCtrl - void CreateChildWnd(const PWL_CREATEPARAM& cp) override; - FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnMouseMove(const CFX_FloatPoint& point, uint32_t nFlag) override; - FX_BOOL OnKeyDown(uint16_t nChar, uint32_t nFlag) override; - - private: - CPWL_IconList_Item* GetListItem(int32_t nItemIndex) const; - void SelectItem(int32_t nItemIndex, FX_BOOL bSelect); - int32_t FindItemIndex(const CFX_FloatPoint& point); - - int32_t m_nSelectIndex; - FX_BOOL m_bMouseDown; - int32_t m_nListCount; -}; - -class CPWL_IconList : public CPWL_Wnd { - public: - CPWL_IconList(int32_t nListCount); - ~CPWL_IconList() override; - - void SetSelect(int32_t nIndex); - void SetTopItem(int32_t nIndex); - int32_t GetSelect() const; - void SetListData(int32_t nItemIndex, void* pData); - void SetListIcon(int32_t nItemIndex, int32_t nIconIndex); - void SetListString(int32_t nItemIndex, const CFX_WideString& str); - void SetIconFillColor(const CPWL_Color& color); - CFX_WideString GetListString(int32_t nItemIndex) const; - - protected: - // CPWL_Wnd - FX_BOOL OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, - uint32_t nFlag) override; - void OnCreated() override; - void RePosChildWnd() override; - void CreateChildWnd(const PWL_CREATEPARAM& cp) override; - void OnNotify(CPWL_Wnd* pWnd, - uint32_t msg, - intptr_t wParam = 0, - intptr_t lParam = 0) override; - - private: - CPWL_IconList_Content* m_pListContent; - int32_t m_nListCount; -}; - -#endif // FPDFSDK_PDFWINDOW_PWL_ICONLIST_H_ diff --git a/fpdfsdk/pdfwindow/PWL_Label.cpp b/fpdfsdk/pdfwindow/PWL_Label.cpp deleted file mode 100644 index 83d299cd34..0000000000 --- a/fpdfsdk/pdfwindow/PWL_Label.cpp +++ /dev/null @@ -1,143 +0,0 @@ -// 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 "fpdfsdk/fxedit/include/fx_edit.h" -#include "fpdfsdk/pdfwindow/PWL_Label.h" -#include "fpdfsdk/pdfwindow/PWL_Utils.h" -#include "fpdfsdk/pdfwindow/PWL_Wnd.h" - -CPWL_Label::CPWL_Label() : m_pEdit(IFX_Edit::NewEdit()) {} - -CPWL_Label::~CPWL_Label() { - IFX_Edit::DelEdit(m_pEdit); -} - -CFX_ByteString CPWL_Label::GetClassName() const { - return "CPWL_Label"; -} - -void CPWL_Label::OnCreated() { - SetParamByFlag(); - SetFontSize(GetCreationParam().fFontSize); - - m_pEdit->SetFontMap(GetFontMap()); - m_pEdit->Initialize(); - - if (HasFlag(PES_TEXTOVERFLOW)) { - SetClipRect(CFX_FloatRect(0.0f, 0.0f, 0.0f, 0.0f)); - m_pEdit->SetTextOverflow(TRUE); - } -} - -void CPWL_Label::SetText(const FX_WCHAR* csText) { - m_pEdit->SetText(csText); -} - -void CPWL_Label::RePosChildWnd() { - m_pEdit->SetPlateRect(GetClientRect()); -} - -void CPWL_Label::SetFontSize(FX_FLOAT fFontSize) { - m_pEdit->SetFontSize(fFontSize); -} - -FX_FLOAT CPWL_Label::GetFontSize() const { - return m_pEdit->GetFontSize(); -} - -void CPWL_Label::SetParamByFlag() { - if (HasFlag(PES_LEFT)) { - m_pEdit->SetAlignmentH(0); - } else if (HasFlag(PES_MIDDLE)) { - m_pEdit->SetAlignmentH(1); - } else if (HasFlag(PES_RIGHT)) { - m_pEdit->SetAlignmentH(2); - } else { - m_pEdit->SetAlignmentH(0); - } - - if (HasFlag(PES_TOP)) { - m_pEdit->SetAlignmentV(0); - } else if (HasFlag(PES_CENTER)) { - m_pEdit->SetAlignmentV(1); - } else if (HasFlag(PES_BOTTOM)) { - m_pEdit->SetAlignmentV(2); - } else { - m_pEdit->SetAlignmentV(0); - } - - if (HasFlag(PES_PASSWORD)) { - m_pEdit->SetPasswordChar('*'); - } - - m_pEdit->SetMultiLine(HasFlag(PES_MULTILINE)); - m_pEdit->SetAutoReturn(HasFlag(PES_AUTORETURN)); - m_pEdit->SetAutoFontSize(HasFlag(PWS_AUTOFONTSIZE)); - m_pEdit->SetAutoScroll(HasFlag(PES_AUTOSCROLL)); -} - -void CPWL_Label::DrawThisAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { - CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); - - GetClientRect(); - - CFX_FloatRect rcClip; - CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange(); - CPVT_WordRange* pRange = nullptr; - - if (!HasFlag(PES_TEXTOVERFLOW)) { - rcClip = GetClientRect(); - pRange = &wrRange; - } - CFX_SystemHandler* pSysHandler = GetSystemHandler(); - IFX_Edit::DrawEdit( - pDevice, pUser2Device, m_pEdit, - CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), - CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()), - rcClip, CFX_FloatPoint(0.0f, 0.0f), pRange, pSysHandler, nullptr); -} - -void CPWL_Label::SetHorzScale(int32_t nHorzScale) { - m_pEdit->SetHorzScale(nHorzScale); -} - -void CPWL_Label::SetCharSpace(FX_FLOAT fCharSpace) { - m_pEdit->SetCharSpace(fCharSpace); -} - -CFX_FloatRect CPWL_Label::GetContentRect() const { - return m_pEdit->GetContentRect(); -} - -void CPWL_Label::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { - CPWL_Wnd::GetThisAppearanceStream(sAppStream); - - sAppStream << GetTextAppearanceStream(CFX_FloatPoint(0.0f, 0.0f)).AsStringC(); -} - -CFX_ByteString CPWL_Label::GetTextAppearanceStream( - const CFX_FloatPoint& ptOffset) const { - CFX_ByteTextBuf sRet; - CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset); - if (sEdit.GetLength() > 0) { - sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() - << sEdit.AsStringC() << "ET\n"; - } - return sRet.MakeString(); -} - -CFX_WideString CPWL_Label::GetText() const { - return m_pEdit->GetText(); -} - -void CPWL_Label::SetLimitChar(int32_t nLimitChar) { - m_pEdit->SetLimitChar(nLimitChar); -} - -int32_t CPWL_Label::GetTotalWords() { - return m_pEdit->GetTotalWords(); -} diff --git a/fpdfsdk/pdfwindow/PWL_Label.h b/fpdfsdk/pdfwindow/PWL_Label.h deleted file mode 100644 index 7b5a3e52f7..0000000000 --- a/fpdfsdk/pdfwindow/PWL_Label.h +++ /dev/null @@ -1,45 +0,0 @@ -// 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 - -#ifndef FPDFSDK_PDFWINDOW_PWL_LABEL_H_ -#define FPDFSDK_PDFWINDOW_PWL_LABEL_H_ - -#include "fpdfsdk/pdfwindow/PWL_Wnd.h" - -class IFX_Edit; - -class CPWL_Label : public CPWL_Wnd { - public: - CPWL_Label(); - ~CPWL_Label() override; - - void SetText(const FX_WCHAR* csText); - CFX_WideString GetText() const; - void SetLimitChar(int32_t nLimitChar); - void SetHorzScale(int32_t nHorzScale); - void SetCharSpace(FX_FLOAT fCharSpace); - CFX_FloatRect GetContentRect() const; - int32_t GetTotalWords(); - CFX_ByteString GetTextAppearanceStream(const CFX_FloatPoint& ptOffset) const; - - protected: - // CPWL_Wnd - CFX_ByteString GetClassName() const override; - void SetFontSize(FX_FLOAT fFontSize) override; - FX_FLOAT GetFontSize() const override; - void OnCreated() override; - void DrawThisAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; - void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; - void RePosChildWnd() override; - - private: - void SetParamByFlag(); - - IFX_Edit* m_pEdit; -}; - -#endif // FPDFSDK_PDFWINDOW_PWL_LABEL_H_ diff --git a/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp b/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp deleted file mode 100644 index dde2160943..0000000000 --- a/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp +++ /dev/null @@ -1,205 +0,0 @@ -// 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 "core/fxge/include/fx_ge.h" -#include "fpdfsdk/pdfwindow/PWL_ListCtrl.h" -#include "fpdfsdk/pdfwindow/PWL_Wnd.h" - -CPWL_ListCtrl::CPWL_ListCtrl() - : m_rcContent(0, 0, 0, 0), - m_ptScroll(0, 0), - m_fItemSpace(0.0f), - m_fTopSpace(0.0f), - m_fBottomSpace(0.0f) {} - -CPWL_ListCtrl::~CPWL_ListCtrl() {} - -void CPWL_ListCtrl::SetScrollPos(const CFX_FloatPoint& point) { - m_ptScroll = point; - - if (m_ptScroll.x < m_rcContent.left) - m_ptScroll.x = m_rcContent.left; - - if (m_ptScroll.x > m_rcContent.right) - m_ptScroll.x = m_rcContent.right; - - if (m_ptScroll.y > m_rcContent.top) - m_ptScroll.y = m_rcContent.top; - - if (m_ptScroll.y < m_rcContent.bottom) - m_ptScroll.y = m_rcContent.bottom; -} - -CFX_FloatPoint CPWL_ListCtrl::GetScrollPos() const { - return m_ptScroll; -} - -CFX_FloatRect CPWL_ListCtrl::GetScrollArea() const { - return m_rcContent; -} - -void CPWL_ListCtrl::ResetFace() { - ResetAll(FALSE, 0); -} - -void CPWL_ListCtrl::ResetContent(int32_t nStart) { - if (nStart < 0) - nStart = 0; - if (nStart >= 0 && nStart < m_aChildren.GetSize()) - ResetAll(TRUE, nStart); -} - -FX_FLOAT CPWL_ListCtrl::GetContentsHeight(FX_FLOAT fLimitWidth) { - FX_FLOAT fRet = m_fTopSpace; - - FX_FLOAT fBorderWidth = (FX_FLOAT)GetBorderWidth(); - - if (fLimitWidth > fBorderWidth * 2) { - for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { - if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { - FX_FLOAT fLeft = pChild->GetItemLeftMargin(); - FX_FLOAT fRight = pChild->GetItemRightMargin(); - - fRet += pChild->GetItemHeight(fLimitWidth - fBorderWidth * 2 - fLeft - - fRight); - fRet += m_fItemSpace; - } - } - - fRet -= m_fItemSpace; - } - - fRet += m_fBottomSpace; - - return fRet; -} - -void CPWL_ListCtrl::ResetAll(FX_BOOL bMove, int32_t nStart) { - CFX_FloatRect rcClient = GetClientRect(); - - FX_FLOAT fWidth = rcClient.Width(); - - FX_FLOAT fy = 0.0f - m_fTopSpace; - - if (nStart - 1 >= 0 && nStart - 1 < m_aChildren.GetSize()) - if (CPWL_Wnd* pChild = m_aChildren.GetAt(nStart - 1)) - fy = pChild->GetWindowRect().bottom - m_fItemSpace; - - for (int32_t i = nStart, sz = m_aChildren.GetSize(); i < sz; i++) { - if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { - FX_FLOAT fLeft = pChild->GetItemLeftMargin(); - FX_FLOAT fRight = pChild->GetItemRightMargin(); - - pChild->SetChildMatrix(CFX_Matrix(1, 0, 0, 1, - rcClient.left - m_ptScroll.x, - rcClient.top - m_ptScroll.y)); - - if (bMove) { - FX_FLOAT fItemHeight = pChild->GetItemHeight(fWidth - fLeft - fRight); - pChild->Move( - CFX_FloatRect(fLeft, fy - fItemHeight, fWidth - fRight, fy), TRUE, - FALSE); - fy -= fItemHeight; - fy -= m_fItemSpace; - } - } - } - - fy += m_fItemSpace; - - fy -= m_fBottomSpace; - - if (bMove) { - m_rcContent.left = 0; - m_rcContent.top = 0; - m_rcContent.right = fWidth; - m_rcContent.bottom = fy; - } -} - -void CPWL_ListCtrl::SetItemSpace(FX_FLOAT fSpace) { - m_fItemSpace = fSpace; -} - -void CPWL_ListCtrl::SetTopSpace(FX_FLOAT fSpace) { - m_fTopSpace = fSpace; -} - -void CPWL_ListCtrl::SetBottomSpace(FX_FLOAT fSpace) { - m_fBottomSpace = fSpace; -} - -void CPWL_ListCtrl::RePosChildWnd() { - ResetFace(); -} - -void CPWL_ListCtrl::DrawChildAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { - pDevice->SaveState(); - CFX_FloatRect rcClient = GetClientRect(); - CFX_FloatRect rcTemp = rcClient; - pUser2Device->TransformRect(rcTemp); - pDevice->SetClip_Rect(FX_RECT((int32_t)rcTemp.left, (int32_t)rcTemp.bottom, - (int32_t)rcTemp.right, (int32_t)rcTemp.top)); - - for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { - if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { - CFX_FloatRect rcChild = pChild->ChildToParent(pChild->GetWindowRect()); - if (!(rcChild.top < rcClient.bottom || rcChild.bottom > rcClient.top)) { - CFX_Matrix mt = pChild->GetChildMatrix(); - if (mt.IsIdentity()) { - pChild->DrawAppearance(pDevice, pUser2Device); - } else { - mt.Concat(*pUser2Device); - pChild->DrawAppearance(pDevice, &mt); - } - } - } - } - - pDevice->RestoreState(false); -} - -int32_t CPWL_ListCtrl::GetItemIndex(CPWL_Wnd* pItem) { - for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { - if (pItem == m_aChildren.GetAt(i)) - return i; - } - - return -1; -} - -CFX_FloatPoint CPWL_ListCtrl::InToOut(const CFX_FloatPoint& point) const { - CFX_FloatRect rcClient = GetClientRect(); - - return CFX_FloatPoint(point.x + rcClient.left - m_ptScroll.x, - point.y + rcClient.top - m_ptScroll.y); -} - -CFX_FloatPoint CPWL_ListCtrl::OutToIn(const CFX_FloatPoint& point) const { - CFX_FloatRect rcClient = GetClientRect(); - - return CFX_FloatPoint(point.x - rcClient.left + m_ptScroll.x, - point.y - rcClient.top + m_ptScroll.y); -} - -CFX_FloatRect CPWL_ListCtrl::InToOut(const CFX_FloatRect& rect) const { - CFX_FloatRect rcClient = GetClientRect(); - - return CFX_FloatRect(rect.left + rcClient.left - m_ptScroll.x, - rect.bottom + rcClient.top - m_ptScroll.y, - rect.right + rcClient.left - m_ptScroll.x, - rect.top + rcClient.top - m_ptScroll.y); -} - -CFX_FloatRect CPWL_ListCtrl::OutToIn(const CFX_FloatRect& rect) const { - CFX_FloatRect rcClient = GetClientRect(); - - return CFX_FloatRect(rect.left - rcClient.left + m_ptScroll.x, - rect.bottom - rcClient.top + m_ptScroll.y, - rect.right - rcClient.left + m_ptScroll.x, - rect.top - rcClient.top + m_ptScroll.y); -} diff --git a/fpdfsdk/pdfwindow/PWL_ListCtrl.h b/fpdfsdk/pdfwindow/PWL_ListCtrl.h deleted file mode 100644 index 844801978c..0000000000 --- a/fpdfsdk/pdfwindow/PWL_ListCtrl.h +++ /dev/null @@ -1,48 +0,0 @@ -// 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 - -#ifndef FPDFSDK_PDFWINDOW_PWL_LISTCTRL_H_ -#define FPDFSDK_PDFWINDOW_PWL_LISTCTRL_H_ - -#include "fpdfsdk/pdfwindow/PWL_Wnd.h" - -class CPWL_ListCtrl : public CPWL_Wnd { - public: - CPWL_ListCtrl(); - ~CPWL_ListCtrl() override; - - void SetScrollPos(const CFX_FloatPoint& point); - CFX_FloatPoint GetScrollPos() const; - CFX_FloatRect GetScrollArea() const; - void SetItemSpace(FX_FLOAT fSpace); - void SetTopSpace(FX_FLOAT fSpace); - void SetBottomSpace(FX_FLOAT fSpace); - void ResetFace(); - void ResetContent(int32_t nStart); - int32_t GetItemIndex(CPWL_Wnd* pItem); - FX_FLOAT GetContentsHeight(FX_FLOAT fLimitWidth); - CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const; - CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const; - CFX_FloatRect InToOut(const CFX_FloatRect& rect) const; - CFX_FloatRect OutToIn(const CFX_FloatRect& rect) const; - - protected: - // CPWL_Wnd - void RePosChildWnd() override; - void DrawChildAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; - - private: - void ResetAll(FX_BOOL bMove, int32_t nStart); - - CFX_FloatRect m_rcContent; - CFX_FloatPoint m_ptScroll; - FX_FLOAT m_fItemSpace; - FX_FLOAT m_fTopSpace; - FX_FLOAT m_fBottomSpace; -}; - -#endif // FPDFSDK_PDFWINDOW_PWL_LISTCTRL_H_ diff --git a/fpdfsdk/pdfwindow/PWL_Signature.cpp b/fpdfsdk/pdfwindow/PWL_Signature.cpp deleted file mode 100644 index 7513950cb7..0000000000 --- a/fpdfsdk/pdfwindow/PWL_Signature.cpp +++ /dev/null @@ -1,178 +0,0 @@ -// 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 "fpdfsdk/pdfwindow/PWL_Signature.h" - -#include "core/fxge/include/fx_ge.h" -#include "fpdfsdk/pdfwindow/PWL_Icon.h" -#include "fpdfsdk/pdfwindow/PWL_Label.h" -#include "fpdfsdk/pdfwindow/PWL_Utils.h" -#include "fpdfsdk/pdfwindow/PWL_Wnd.h" - -CPWL_Signature_Image::CPWL_Signature_Image() : m_pImage(nullptr) {} - -CPWL_Signature_Image::~CPWL_Signature_Image() {} - -void CPWL_Signature_Image::SetImage(CFX_DIBSource* pImage) { - m_pImage = pImage; -} - -CFX_DIBSource* CPWL_Signature_Image::GetImage() { - return m_pImage; -} - -void CPWL_Signature_Image::DrawThisAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { - CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); - - if (m_pImage) { - CFX_FloatRect rcClient = GetClientRect(); - - FX_FLOAT x, y; - pUser2Device->Transform(rcClient.left, rcClient.top, x, y); - - pDevice->StretchDIBits(m_pImage, (int32_t)x, (int32_t)y, - (int32_t)rcClient.Width(), - (int32_t)rcClient.Height()); - } -} - -void CPWL_Signature_Image::GetThisAppearanceStream( - CFX_ByteTextBuf& sAppStream) { - sAppStream << CPWL_Image::GetImageAppStream().AsStringC(); -} - -void CPWL_Signature_Image::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) { - FX_FLOAT fImageW, fImageH; - - GetImageSize(fImageW, fImageH); - - CFX_FloatRect rcClient = GetClientRect(); - - fHScale = rcClient.Width() / fImageW; - fVScale = rcClient.Height() / fImageH; -} - -CPWL_Signature::CPWL_Signature() - : m_pText(nullptr), - m_pDescription(nullptr), - m_pImage(nullptr), - m_bTextExist(TRUE), - m_bImageExist(FALSE), - m_bFlagExist(TRUE) {} - -CPWL_Signature::~CPWL_Signature() {} - -void CPWL_Signature::SetTextFlag(FX_BOOL bTextExist) { - m_bTextExist = bTextExist; - - RePosChildWnd(); -} - -void CPWL_Signature::SetImageFlag(FX_BOOL bImageExist) { - m_bImageExist = bImageExist; - - RePosChildWnd(); -} - -void CPWL_Signature::SetFoxitFlag(FX_BOOL bFlagExist) { - m_bFlagExist = bFlagExist; -} - -void CPWL_Signature::SetText(const FX_WCHAR* sText) { - m_pText->SetText(sText); - - RePosChildWnd(); -} - -void CPWL_Signature::SetDescription(const FX_WCHAR* str) { - m_pDescription->SetText(str); - - RePosChildWnd(); -} - -void CPWL_Signature::SetImage(CFX_DIBSource* pImage) { - m_pImage->SetImage(pImage); - - RePosChildWnd(); -} - -void CPWL_Signature::SetImageStream(CPDF_Stream* pStream, - const FX_CHAR* sImageAlias) { - m_pImage->SetPDFStream(pStream); - m_pImage->SetImageAlias(sImageAlias); - - RePosChildWnd(); -} - -void CPWL_Signature::RePosChildWnd() { - CFX_FloatRect rcClient = GetClientRect(); - - CFX_FloatRect rcText = rcClient; - CFX_FloatRect rcDescription = rcClient; - - FX_BOOL bTextVisible = m_bTextExist && m_pText->GetText().GetLength() > 0; - - if ((bTextVisible || m_bImageExist) && - m_pDescription->GetText().GetLength() > 0) { - if (rcClient.Width() >= rcClient.Height()) { - rcText.right = rcText.left + rcClient.Width() / 2.0f; - rcDescription.left = rcDescription.right - rcClient.Width() / 2.0f; - } else { - rcText.bottom = rcText.top - rcClient.Height() / 2.0f; - rcDescription.top = rcDescription.bottom + rcClient.Height() / 2.0f; - } - } - - m_pText->SetVisible(bTextVisible); - m_pImage->SetVisible(m_bImageExist); - - m_pText->Move(rcText, TRUE, FALSE); - m_pImage->Move(rcText, TRUE, FALSE); - m_pDescription->Move(rcDescription, TRUE, FALSE); -} - -void CPWL_Signature::CreateChildWnd(const PWL_CREATEPARAM& cp) { - m_pImage = new CPWL_Signature_Image; - PWL_CREATEPARAM icp = cp; - icp.pParentWnd = this; - icp.dwFlags = PWS_CHILD | PWS_VISIBLE; - icp.sTextColor = CPWL_Color(COLORTYPE_GRAY, 0); - m_pImage->Create(icp); - - m_pText = new CPWL_Label; - PWL_CREATEPARAM acp = cp; - acp.pParentWnd = this; - acp.dwFlags = PWS_CHILD | PWS_VISIBLE | PWS_AUTOFONTSIZE | PES_MULTILINE | - PES_AUTORETURN | PES_MIDDLE | PES_CENTER; - acp.sTextColor = CPWL_Color(COLORTYPE_GRAY, 0); - m_pText->Create(acp); - - m_pDescription = new CPWL_Label; - PWL_CREATEPARAM dcp = cp; - dcp.pParentWnd = this; - dcp.dwFlags = PWS_CHILD | PWS_VISIBLE | PWS_AUTOFONTSIZE | PES_MULTILINE | - PES_AUTORETURN | PES_LEFT | PES_CENTER; - dcp.sTextColor = CPWL_Color(COLORTYPE_GRAY, 0); - m_pDescription->Create(dcp); -} - -void CPWL_Signature::DrawThisAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { - CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); - - if (m_bFlagExist) { - CPWL_Utils::DrawIconAppStream( - pDevice, pUser2Device, PWL_ICONTYPE_FOXIT, - CPWL_Utils::GetCenterSquare(GetClientRect()), - CPWL_Color(COLORTYPE_RGB, 0.91f, 0.855f, 0.92f), - CPWL_Color(COLORTYPE_TRANSPARENT), 255); - } -} - -void CPWL_Signature::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { - CPWL_Wnd::GetThisAppearanceStream(sAppStream); -} diff --git a/fpdfsdk/pdfwindow/PWL_Signature.h b/fpdfsdk/pdfwindow/PWL_Signature.h deleted file mode 100644 index 47d0bb0ae3..0000000000 --- a/fpdfsdk/pdfwindow/PWL_Signature.h +++ /dev/null @@ -1,67 +0,0 @@ -// 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 - -#ifndef FPDFSDK_PDFWINDOW_PWL_SIGNATURE_H_ -#define FPDFSDK_PDFWINDOW_PWL_SIGNATURE_H_ - -#include "fpdfsdk/pdfwindow/PWL_Icon.h" -#include "fpdfsdk/pdfwindow/PWL_Wnd.h" - -class CFX_DIBSource; -class CPWL_Label; - -class CPWL_Signature_Image : public CPWL_Image { - public: - CPWL_Signature_Image(); - ~CPWL_Signature_Image() override; - - void SetImage(CFX_DIBSource* pImage); - CFX_DIBSource* GetImage(); - - protected: - // CPWL_Image - void DrawThisAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; - void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; - void GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) override; - - private: - CFX_DIBSource* m_pImage; -}; - -class CPWL_Signature : public CPWL_Wnd { - public: - CPWL_Signature(); - ~CPWL_Signature() override; - - void SetText(const FX_WCHAR* sText); - void SetDescription(const FX_WCHAR* str); - void SetImage(CFX_DIBSource* pImage); - void SetImageStream(CPDF_Stream* pStream, const FX_CHAR* sImageAlias); - - void SetTextFlag(FX_BOOL bTextExist); - void SetImageFlag(FX_BOOL bImageExist); - void SetFoxitFlag(FX_BOOL bFlagExist); - - protected: - // CPWL_Wnd - void RePosChildWnd() override; - void CreateChildWnd(const PWL_CREATEPARAM& cp) override; - void DrawThisAppearance(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; - void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override; - - private: - CPWL_Label* m_pText; - CPWL_Label* m_pDescription; - CPWL_Signature_Image* m_pImage; - - FX_BOOL m_bTextExist; - FX_BOOL m_bImageExist; - FX_BOOL m_bFlagExist; -}; - -#endif // FPDFSDK_PDFWINDOW_PWL_SIGNATURE_H_ diff --git a/pdfium.gyp b/pdfium.gyp index 153864aee2..d6da141323 100644 --- a/pdfium.gyp +++ b/pdfium.gyp @@ -509,7 +509,6 @@ 'sources': [ 'core/fxcodec/include/fx_codec.h', 'core/fxcodec/include/fx_codec_def.h', - 'core/fxcodec/include/fx_codec_flate.h', 'core/fxcodec/codec/ccodec_basicmodule.h', 'core/fxcodec/codec/ccodec_faxmodule.h', 'core/fxcodec/codec/ccodec_flatemodule.h', @@ -789,18 +788,10 @@ 'fpdfsdk/pdfwindow/PWL_FontMap.h', 'fpdfsdk/pdfwindow/PWL_Icon.cpp', 'fpdfsdk/pdfwindow/PWL_Icon.h', - 'fpdfsdk/pdfwindow/PWL_IconList.cpp', - 'fpdfsdk/pdfwindow/PWL_IconList.h', - 'fpdfsdk/pdfwindow/PWL_Label.cpp', - 'fpdfsdk/pdfwindow/PWL_Label.h', 'fpdfsdk/pdfwindow/PWL_ListBox.cpp', 'fpdfsdk/pdfwindow/PWL_ListBox.h', - 'fpdfsdk/pdfwindow/PWL_ListCtrl.cpp', - 'fpdfsdk/pdfwindow/PWL_ListCtrl.h', 'fpdfsdk/pdfwindow/PWL_ScrollBar.cpp', 'fpdfsdk/pdfwindow/PWL_ScrollBar.h', - 'fpdfsdk/pdfwindow/PWL_Signature.cpp', - 'fpdfsdk/pdfwindow/PWL_Signature.h', 'fpdfsdk/pdfwindow/PWL_SpecialButton.cpp', 'fpdfsdk/pdfwindow/PWL_SpecialButton.h', 'fpdfsdk/pdfwindow/PWL_Utils.cpp', @@ -218,16 +218,8 @@ "xfa/fwl/lightwidget/cfwl_picturebox.h", "xfa/fwl/lightwidget/cfwl_pushbutton.cpp", "xfa/fwl/lightwidget/cfwl_pushbutton.h", - "xfa/fwl/lightwidget/cfwl_scrollbar.cpp", - "xfa/fwl/lightwidget/cfwl_scrollbar.h", - "xfa/fwl/lightwidget/cfwl_theme.cpp", - "xfa/fwl/lightwidget/cfwl_theme.h", - "xfa/fwl/lightwidget/cfwl_tooltip.cpp", - "xfa/fwl/lightwidget/cfwl_tooltip.h", "xfa/fwl/lightwidget/cfwl_widget.cpp", "xfa/fwl/lightwidget/cfwl_widget.h", - "xfa/fwl/lightwidget/cfwl_widgetdelegate.cpp", - "xfa/fwl/lightwidget/cfwl_widgetdelegate.h", "xfa/fwl/lightwidget/cfwl_widgetproperties.cpp", "xfa/fwl/lightwidget/cfwl_widgetproperties.h", "xfa/fwl/theme/cfwl_barcodetp.cpp", @@ -242,8 +234,6 @@ "xfa/fwl/theme/cfwl_datetimepickertp.h", "xfa/fwl/theme/cfwl_edittp.cpp", "xfa/fwl/theme/cfwl_edittp.h", - "xfa/fwl/theme/cfwl_formtp.cpp", - "xfa/fwl/theme/cfwl_formtp.h", "xfa/fwl/theme/cfwl_listboxtp.cpp", "xfa/fwl/theme/cfwl_listboxtp.h", "xfa/fwl/theme/cfwl_monthcalendartp.cpp", @@ -260,8 +250,6 @@ "xfa/fxbarcode/BC_Dimension.cpp", "xfa/fxbarcode/BC_Dimension.h", "xfa/fxbarcode/BC_Library.cpp", - "xfa/fxbarcode/BC_ResultPoint.cpp", - "xfa/fxbarcode/BC_ResultPoint.h", "xfa/fxbarcode/BC_TwoDimWriter.cpp", "xfa/fxbarcode/BC_TwoDimWriter.h", "xfa/fxbarcode/BC_UtilCodingConvert.cpp", @@ -295,14 +283,10 @@ "xfa/fxbarcode/common/BC_CommonBitArray.h", "xfa/fxbarcode/common/BC_CommonBitMatrix.cpp", "xfa/fxbarcode/common/BC_CommonBitMatrix.h", - "xfa/fxbarcode/common/BC_CommonBitSource.cpp", - "xfa/fxbarcode/common/BC_CommonBitSource.h", "xfa/fxbarcode/common/BC_CommonByteArray.cpp", "xfa/fxbarcode/common/BC_CommonByteArray.h", "xfa/fxbarcode/common/BC_CommonByteMatrix.cpp", "xfa/fxbarcode/common/BC_CommonByteMatrix.h", - "xfa/fxbarcode/common/BC_CommonPerspectiveTransform.cpp", - "xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h", "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp", "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h", "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp", @@ -360,8 +344,6 @@ "xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h", "xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp", "xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h", - "xfa/fxbarcode/pdf417/BC_PDF417Codeword.cpp", - "xfa/fxbarcode/pdf417/BC_PDF417Codeword.h", "xfa/fxbarcode/pdf417/BC_PDF417Compaction.cpp", "xfa/fxbarcode/pdf417/BC_PDF417Compaction.h", "xfa/fxbarcode/pdf417/BC_PDF417ErrorCorrection.cpp", diff --git a/xfa/fwl/lightwidget/cfwl_scrollbar.cpp b/xfa/fwl/lightwidget/cfwl_scrollbar.cpp deleted file mode 100644 index eb4276c2d1..0000000000 --- a/xfa/fwl/lightwidget/cfwl_scrollbar.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// 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 "xfa/fwl/lightwidget/cfwl_scrollbar.h" - -#include <memory> - -#include "xfa/fwl/basewidget/ifwl_scrollbar.h" - -CFWL_ScrollBar* CFWL_ScrollBar::Create() { - return new CFWL_ScrollBar; -} - -CFWL_ScrollBar::CFWL_ScrollBar() {} - -CFWL_ScrollBar::~CFWL_ScrollBar() {} - -FWL_Error CFWL_ScrollBar::Initialize(const CFWL_WidgetProperties* pProperties) { - if (m_pIface) - return FWL_Error::Indefinite; - if (pProperties) { - *m_pProperties = *pProperties; - } - std::unique_ptr<IFWL_ScrollBar> pScrollBar(IFWL_ScrollBar::Create( - m_pProperties->MakeWidgetImpProperties(nullptr), nullptr)); - FWL_Error ret = pScrollBar->Initialize(); - if (ret != FWL_Error::Succeeded) { - return ret; - } - m_pIface = pScrollBar.release(); - CFWL_Widget::Initialize(); - return FWL_Error::Succeeded; -} - -FX_BOOL CFWL_ScrollBar::IsVertical() { - if (!m_pIface) - return FALSE; - return static_cast<IFWL_ScrollBar*>(m_pIface)->IsVertical(); -} - -FWL_Error CFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { - if (!m_pIface) - return FWL_Error::Indefinite; - return static_cast<IFWL_ScrollBar*>(m_pIface)->GetRange(fMin, fMax); -} - -FWL_Error CFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { - if (!m_pIface) - return FWL_Error::Indefinite; - return static_cast<IFWL_ScrollBar*>(m_pIface)->SetRange(fMin, fMax); -} - -FX_FLOAT CFWL_ScrollBar::GetPageSize() { - if (!m_pIface) - return 0; - return static_cast<IFWL_ScrollBar*>(m_pIface)->GetPageSize(); -} - -FWL_Error CFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) { - if (!m_pIface) - return FWL_Error::Indefinite; - return static_cast<IFWL_ScrollBar*>(m_pIface)->SetPageSize(fPageSize); -} - -FX_FLOAT CFWL_ScrollBar::GetStepSize() { - if (!m_pIface) - return 0; - return static_cast<IFWL_ScrollBar*>(m_pIface)->GetStepSize(); -} - -FWL_Error CFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) { - if (!m_pIface) - return FWL_Error::Indefinite; - return static_cast<IFWL_ScrollBar*>(m_pIface)->SetStepSize(fStepSize); -} - -FX_FLOAT CFWL_ScrollBar::GetPos() { - if (!m_pIface) - return -1; - return static_cast<IFWL_ScrollBar*>(m_pIface)->GetPos(); -} - -FWL_Error CFWL_ScrollBar::SetPos(FX_FLOAT fPos) { - if (!m_pIface) - return FWL_Error::Indefinite; - return static_cast<IFWL_ScrollBar*>(m_pIface)->SetPos(fPos); -} - -FX_FLOAT CFWL_ScrollBar::GetTrackPos() { - if (!m_pIface) - return -1; - return static_cast<IFWL_ScrollBar*>(m_pIface)->GetTrackPos(); -} - -FWL_Error CFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) { - if (!m_pIface) - return FWL_Error::Indefinite; - return static_cast<IFWL_ScrollBar*>(m_pIface)->SetTrackPos(fTrackPos); -} - -FX_BOOL CFWL_ScrollBar::DoScroll(uint32_t dwCode, FX_FLOAT fPos) { - if (!m_pIface) - return FALSE; - return static_cast<IFWL_ScrollBar*>(m_pIface)->DoScroll(dwCode, fPos); -} diff --git a/xfa/fwl/lightwidget/cfwl_scrollbar.h b/xfa/fwl/lightwidget/cfwl_scrollbar.h deleted file mode 100644 index fd80e8b8ab..0000000000 --- a/xfa/fwl/lightwidget/cfwl_scrollbar.h +++ /dev/null @@ -1,32 +0,0 @@ -// 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 - -#ifndef XFA_FWL_LIGHTWIDGET_CFWL_SCROLLBAR_H_ -#define XFA_FWL_LIGHTWIDGET_CFWL_SCROLLBAR_H_ - -#include "xfa/fwl/lightwidget/cfwl_widget.h" - -class CFWL_ScrollBar : public CFWL_Widget { - public: - static CFWL_ScrollBar* Create(); - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); - FX_BOOL IsVertical(); - FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); - FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax); - FX_FLOAT GetPageSize(); - FWL_Error SetPageSize(FX_FLOAT fPageSize); - FX_FLOAT GetStepSize(); - FWL_Error SetStepSize(FX_FLOAT fStepSize); - FX_FLOAT GetPos(); - FWL_Error SetPos(FX_FLOAT fPos); - FX_FLOAT GetTrackPos(); - FWL_Error SetTrackPos(FX_FLOAT fTrackPos); - FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); - CFWL_ScrollBar(); - virtual ~CFWL_ScrollBar(); -}; - -#endif // XFA_FWL_LIGHTWIDGET_CFWL_SCROLLBAR_H_ diff --git a/xfa/fwl/lightwidget/cfwl_theme.cpp b/xfa/fwl/lightwidget/cfwl_theme.cpp deleted file mode 100644 index 4824667080..0000000000 --- a/xfa/fwl/lightwidget/cfwl_theme.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// 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 "xfa/fwl/lightwidget/cfwl_theme.h" - -#include <algorithm> - -#include "xfa/fwl/core/cfwl_themebackground.h" -#include "xfa/fwl/core/cfwl_themepart.h" -#include "xfa/fwl/core/cfwl_themetext.h" -#include "xfa/fwl/theme/cfwl_barcodetp.h" -#include "xfa/fwl/theme/cfwl_carettp.h" -#include "xfa/fwl/theme/cfwl_checkboxtp.h" -#include "xfa/fwl/theme/cfwl_comboboxtp.h" -#include "xfa/fwl/theme/cfwl_datetimepickertp.h" -#include "xfa/fwl/theme/cfwl_edittp.h" -#include "xfa/fwl/theme/cfwl_formtp.h" -#include "xfa/fwl/theme/cfwl_listboxtp.h" -#include "xfa/fwl/theme/cfwl_monthcalendartp.h" -#include "xfa/fwl/theme/cfwl_pictureboxtp.h" -#include "xfa/fwl/theme/cfwl_pushbuttontp.h" -#include "xfa/fwl/theme/cfwl_scrollbartp.h" - -CFWL_Theme::CFWL_Theme() { - m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_FormTP)); - m_ThemesArray.push_back( - std::unique_ptr<CFWL_WidgetTP>(new CFWL_PushButtonTP)); - m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_CheckBoxTP)); - m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_ListBoxTP)); - m_ThemesArray.push_back( - std::unique_ptr<CFWL_WidgetTP>(new CFWL_PictureBoxTP)); - m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_ScrollBarTP)); - m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_EditTP)); - m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_ComboBoxTP)); - m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_BarcodeTP)); - m_ThemesArray.push_back( - std::unique_ptr<CFWL_WidgetTP>(new CFWL_DateTimePickerTP)); - m_ThemesArray.push_back( - std::unique_ptr<CFWL_WidgetTP>(new CFWL_MonthCalendarTP)); - m_ThemesArray.push_back(std::unique_ptr<CFWL_WidgetTP>(new CFWL_CaretTP)); -} - -CFWL_Theme::~CFWL_Theme() {} - -bool CFWL_Theme::IsValidWidget(IFWL_Widget* pWidget) { - return !!GetTheme(pWidget); -} - -uint32_t CFWL_Theme::GetThemeID(IFWL_Widget* pWidget) { - return GetTheme(pWidget)->GetThemeID(pWidget); -} - -uint32_t CFWL_Theme::SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren) { - uint32_t dwID = 0; - for (const auto& pTheme : m_ThemesArray) { - dwID = pTheme->GetThemeID(pWidget); - pTheme->SetThemeID(pWidget, dwThemeID, FALSE); - } - return dwID; -} - -FWL_Error CFWL_Theme::GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) { - return FWL_Error::Succeeded; -} - -FWL_Error CFWL_Theme::SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix) { - return FWL_Error::Succeeded; -} - -FX_BOOL CFWL_Theme::DrawBackground(CFWL_ThemeBackground* pParams) { - return GetTheme(pParams->m_pWidget)->DrawBackground(pParams); -} - -FX_BOOL CFWL_Theme::DrawText(CFWL_ThemeText* pParams) { - return GetTheme(pParams->m_pWidget)->DrawText(pParams); -} - -void* CFWL_Theme::GetCapacity(CFWL_ThemePart* pThemePart, - CFWL_WidgetCapacity dwCapacity) { - return GetTheme(pThemePart->m_pWidget)->GetCapacity(pThemePart, dwCapacity); -} - -FX_BOOL CFWL_Theme::IsCustomizedLayout(IFWL_Widget* pWidget) { - return GetTheme(pWidget)->IsCustomizedLayout(pWidget); -} - -FWL_Error CFWL_Theme::GetPartRect(CFWL_ThemePart* pThemePart, - CFX_RectF& rtPart) { - return GetTheme(pThemePart->m_pWidget)->GetPartRect(pThemePart, rtPart); -} - -FX_BOOL CFWL_Theme::IsInPart(CFWL_ThemePart* pThemePart, - FX_FLOAT fx, - FX_FLOAT fy) { - return GetTheme(pThemePart->m_pWidget)->IsInPart(pThemePart, fx, fy); -} - -FX_BOOL CFWL_Theme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { - return GetTheme(pParams->m_pWidget)->CalcTextRect(pParams, rect); -} - -FWL_Error CFWL_Theme::Initialize() { - for (const auto& pTheme : m_ThemesArray) - pTheme->Initialize(); - - FWLTHEME_Init(); - return FWL_Error::Succeeded; -} - -FWL_Error CFWL_Theme::Finalize() { - for (const auto& pTheme : m_ThemesArray) - pTheme->Finalize(); - - FWLTHEME_Release(); - return FWL_Error::Succeeded; -} - -FWL_Error CFWL_Theme::SetFont(IFWL_Widget* pWidget, - const FX_WCHAR* strFont, - FX_FLOAT fFontSize, - FX_ARGB rgbFont) { - for (const auto& pTheme : m_ThemesArray) - pTheme->SetFont(pWidget, strFont, fFontSize, rgbFont); - - return FWL_Error::Succeeded; -} - -CFWL_WidgetTP* CFWL_Theme::GetTheme(IFWL_Widget* pWidget) { - for (const auto& pTheme : m_ThemesArray) { - if (pTheme->IsValidWidget(pWidget)) - return pTheme.get(); - } - return nullptr; -} diff --git a/xfa/fwl/lightwidget/cfwl_theme.h b/xfa/fwl/lightwidget/cfwl_theme.h deleted file mode 100644 index effb31b04e..0000000000 --- a/xfa/fwl/lightwidget/cfwl_theme.h +++ /dev/null @@ -1,60 +0,0 @@ -// 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 - -#ifndef XFA_FWL_LIGHTWIDGET_CFWL_THEME_H_ -#define XFA_FWL_LIGHTWIDGET_CFWL_THEME_H_ - -#include <memory> -#include <vector> - -#include "core/fxcrt/include/fx_coordinates.h" -#include "core/fxcrt/include/fx_system.h" -#include "core/fxge/include/fx_dib.h" -#include "xfa/fwl/core/ifwl_themeprovider.h" - -class CFWL_WidgetTP; -class IFWL_Widget; -class CFWL_ThemePart; -class CFWL_ThemeText; - -class CFWL_Theme final : public IFWL_ThemeProvider { - public: - CFWL_Theme(); - ~CFWL_Theme() override; - - // IFWL_ThemeProvider: - bool IsValidWidget(IFWL_Widget* pWidget) override; - uint32_t GetThemeID(IFWL_Widget* pWidget) override; - uint32_t SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren = TRUE) override; - FWL_Error GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) override; - FWL_Error SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix) override; - FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; - FX_BOOL DrawText(CFWL_ThemeText* pParams) override; - void* GetCapacity(CFWL_ThemePart* pThemePart, - CFWL_WidgetCapacity dwCapacity) override; - FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget) override; - FWL_Error GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) override; - FX_BOOL IsInPart(CFWL_ThemePart* pThemePart, - FX_FLOAT fx, - FX_FLOAT fy) override; - FX_BOOL CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) override; - - FWL_Error Initialize(); - FWL_Error Finalize(); - FWL_Error SetFont(IFWL_Widget* pWidget, - const FX_WCHAR* strFont, - FX_FLOAT fFontSize, - FX_ARGB rgbFont); - CFWL_WidgetTP* GetTheme(IFWL_Widget* pWidget); - - protected: - std::vector<std::unique_ptr<CFWL_WidgetTP>> m_ThemesArray; -}; - -#endif // XFA_FWL_LIGHTWIDGET_CFWL_THEME_H_ diff --git a/xfa/fwl/lightwidget/cfwl_tooltip.cpp b/xfa/fwl/lightwidget/cfwl_tooltip.cpp deleted file mode 100644 index 7a9a26cf9e..0000000000 --- a/xfa/fwl/lightwidget/cfwl_tooltip.cpp +++ /dev/null @@ -1,125 +0,0 @@ -// 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 "xfa/fwl/lightwidget/cfwl_tooltip.h" - -#include <memory> - -#include "xfa/fwl/core/fwl_formimp.h" -#include "xfa/fwl/core/fwl_noteimp.h" -#include "xfa/fwl/core/fwl_widgetimp.h" - -CFWL_ToolTip* CFWL_ToolTip::Create() { - return new CFWL_ToolTip; -} - -FWL_Error CFWL_ToolTip::Initialize(const CFWL_WidgetProperties* pProperties) { - if (m_pIface) - return FWL_Error::Indefinite; - if (pProperties) { - *m_pProperties = *pProperties; - } - std::unique_ptr<IFWL_ToolTip> pToolTip(IFWL_ToolTip::Create( - m_pProperties->MakeWidgetImpProperties(&m_tooltipData), nullptr)); - FWL_Error ret = pToolTip->Initialize(); - if (ret != FWL_Error::Succeeded) { - return ret; - } - m_pIface = pToolTip.release(); - CFWL_Widget::Initialize(); - return FWL_Error::Succeeded; -} - -void CFWL_ToolTip::GetCaption(CFX_WideString& wsCaption) { - wsCaption = m_tooltipData.m_wsCaption; -} - -void CFWL_ToolTip::SetCaption(const CFX_WideStringC& wsCaption) { - m_tooltipData.m_wsCaption = wsCaption; -} - -int32_t CFWL_ToolTip::GetInitialDelay() { - return m_tooltipData.m_nInitDelayTime; -} - -void CFWL_ToolTip::SetInitialDelay(int32_t nDelayTime) { - m_tooltipData.m_nInitDelayTime = nDelayTime; -} - -int32_t CFWL_ToolTip::GetAutoPopDelay() { - return m_tooltipData.m_nAutoPopDelayTime; -} - -void CFWL_ToolTip::SetAutoPopDelay(int32_t nDelayTime) { - m_tooltipData.m_nAutoPopDelayTime = nDelayTime; -} - -CFX_DIBitmap* CFWL_ToolTip::GetToolTipIcon() { - return m_tooltipData.m_pBitmap; -} - -void CFWL_ToolTip::SetToolTipIcon(CFX_DIBitmap* pBitmap) { - m_tooltipData.m_pBitmap = pBitmap; -} - -CFX_SizeF CFWL_ToolTip::GetToolTipIconSize() { - return m_tooltipData.m_fIconSize; -} - -void CFWL_ToolTip::SetToolTipIconSize(CFX_SizeF fSize) { - m_tooltipData.m_fIconSize = fSize; -} - -void CFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) { - static_cast<IFWL_ToolTip*>(m_pIface)->SetAnchor(rtAnchor); -} - -void CFWL_ToolTip::Show() { - static_cast<IFWL_ToolTip*>(m_pIface)->Show(); -} - -void CFWL_ToolTip::Hide() { - static_cast<IFWL_ToolTip*>(m_pIface)->Hide(); -} - -CFWL_ToolTip::CFWL_ToolTip() {} - -CFWL_ToolTip::~CFWL_ToolTip() {} - -CFWL_ToolTip::CFWL_ToolTipDP::CFWL_ToolTipDP() : m_pBitmap(NULL) { - m_wsCaption = L""; - m_nInitDelayTime = 500; - m_nAutoPopDelayTime = 50000; - m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); -} - -FWL_Error CFWL_ToolTip::CFWL_ToolTipDP::GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { - wsCaption = m_wsCaption; - return FWL_Error::Succeeded; -} - -int32_t CFWL_ToolTip::CFWL_ToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) { - return m_nInitDelayTime; -} - -int32_t CFWL_ToolTip::CFWL_ToolTipDP::GetAutoPopDelay(IFWL_Widget* pWidget) { - return m_nAutoPopDelayTime; -} - -CFX_DIBitmap* CFWL_ToolTip::CFWL_ToolTipDP::GetToolTipIcon( - IFWL_Widget* pWidget) { - return m_pBitmap; -} - -CFX_SizeF CFWL_ToolTip::CFWL_ToolTipDP::GetToolTipIconSize( - IFWL_Widget* pWidget) { - return m_fIconSize; -} - -CFX_RectF CFWL_ToolTip::CFWL_ToolTipDP::GetAnchor() { - return m_fAnchor; -} diff --git a/xfa/fwl/lightwidget/cfwl_tooltip.h b/xfa/fwl/lightwidget/cfwl_tooltip.h deleted file mode 100644 index 74f702849c..0000000000 --- a/xfa/fwl/lightwidget/cfwl_tooltip.h +++ /dev/null @@ -1,60 +0,0 @@ -// 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 - -#ifndef XFA_FWL_LIGHTWIDGET_CFWL_TOOLTIP_H_ -#define XFA_FWL_LIGHTWIDGET_CFWL_TOOLTIP_H_ - -#include "xfa/fwl/basewidget/ifwl_tooltip.h" -#include "xfa/fwl/lightwidget/cfwl_widget.h" - -class CFWL_ToolTip : public CFWL_Widget { - public: - static CFWL_ToolTip* Create(); - - CFWL_ToolTip(); - virtual ~CFWL_ToolTip(); - - FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); - - void GetCaption(CFX_WideString& wsCaption); - void SetCaption(const CFX_WideStringC& wsCaption); - - int32_t GetInitialDelay(); - void SetInitialDelay(int32_t nDelayTime); - - int32_t GetAutoPopDelay(); - void SetAutoPopDelay(int32_t nDelayTime); - - CFX_DIBitmap* GetToolTipIcon(); - void SetToolTipIcon(CFX_DIBitmap* pBitmap); - CFX_SizeF GetToolTipIconSize(); - void SetToolTipIconSize(CFX_SizeF fSize); - - void SetAnchor(const CFX_RectF& rtAnchor); - void Show(); - void Hide(); - - protected: - class CFWL_ToolTipDP : public IFWL_ToolTipDP { - public: - CFWL_ToolTipDP(); - FWL_Error GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption); - int32_t GetInitialDelay(IFWL_Widget* pWidget); - int32_t GetAutoPopDelay(IFWL_Widget* pWidget); - CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget); - CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget); - CFX_RectF GetAnchor(); - CFX_WideString m_wsCaption; - int32_t m_nInitDelayTime; - int32_t m_nAutoPopDelayTime; - CFX_DIBitmap* m_pBitmap; - CFX_SizeF m_fIconSize; - CFX_RectF m_fAnchor; - }; - CFWL_ToolTipDP m_tooltipData; -}; - -#endif // XFA_FWL_LIGHTWIDGET_CFWL_TOOLTIP_H_ diff --git a/xfa/fwl/lightwidget/cfwl_widgetdelegate.cpp b/xfa/fwl/lightwidget/cfwl_widgetdelegate.cpp deleted file mode 100644 index fcb7232622..0000000000 --- a/xfa/fwl/lightwidget/cfwl_widgetdelegate.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 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 "xfa/fwl/lightwidget/cfwl_widgetdelegate.h" - -#include "xfa/fwl/core/cfwl_event.h" -#include "xfa/fwl/core/cfwl_message.h" - -CFWL_WidgetDelegate::CFWL_WidgetDelegate() {} - -CFWL_WidgetDelegate::~CFWL_WidgetDelegate() {} - -void CFWL_WidgetDelegate::OnProcessMessage(CFWL_Message* pMessage) {} - -void CFWL_WidgetDelegate::OnProcessEvent(CFWL_Event* pEvent) {} - -void CFWL_WidgetDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) {} diff --git a/xfa/fwl/lightwidget/cfwl_widgetdelegate.h b/xfa/fwl/lightwidget/cfwl_widgetdelegate.h deleted file mode 100644 index 1f5cdab8f4..0000000000 --- a/xfa/fwl/lightwidget/cfwl_widgetdelegate.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2016 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 - -#ifndef XFA_FWL_LIGHTWIDGET_CFWL_WIDGETDELEGATE_H_ -#define XFA_FWL_LIGHTWIDGET_CFWL_WIDGETDELEGATE_H_ - -#include <stdint.h> - -#include "xfa/fwl/core/fwl_error.h" -#include "xfa/fwl/core/ifwl_widgetdelegate.h" - -class CFWL_Event; -class CFWL_Message; -class CFX_Graphics; -class CFX_Matrix; - -class CFWL_WidgetDelegate : public IFWL_WidgetDelegate { - public: - CFWL_WidgetDelegate(); - virtual ~CFWL_WidgetDelegate(); - - void OnProcessMessage(CFWL_Message* pMessage) override; - void OnProcessEvent(CFWL_Event* pEvent) override; - void OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; -}; - -#endif // XFA_FWL_LIGHTWIDGET_CFWL_WIDGETDELEGATE_H_ diff --git a/xfa/fwl/theme/cfwl_formtp.cpp b/xfa/fwl/theme/cfwl_formtp.cpp deleted file mode 100644 index 033375911b..0000000000 --- a/xfa/fwl/theme/cfwl_formtp.cpp +++ /dev/null @@ -1,874 +0,0 @@ -// 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 "xfa/fwl/theme/cfwl_formtp.h" - -#include "xfa/fde/tto/fde_textout.h" -#include "xfa/fwl/core/cfwl_themebackground.h" -#include "xfa/fwl/core/cfwl_themepart.h" -#include "xfa/fwl/core/cfwl_themetext.h" -#include "xfa/fwl/core/ifwl_form.h" -#include "xfa/fwl/core/ifwl_themeprovider.h" -#include "xfa/fwl/core/ifwl_widget.h" -#include "xfa/fxgraphics/cfx_color.h" -#include "xfa/fxgraphics/cfx_path.h" - -namespace { - -const int kCXFormBorder = 3; -const int kCYFormBorder = 3; -const int kCYCaption = 29; -const int kFormBigIconSize = 32; -const int kFormSmallIconSize = 16; -const uint32_t kFormTextColor = 0xFFFFFFFF; - -const int kButtonSize = 21; -const int kButtonMargin = 5; -const int kButtonSpan = 2; - -} // namespace - -CFWL_FormTP::CFWL_FormTP() : m_pActiveBitmap(NULL), m_pDeactivebitmap(NULL) { - m_pThemeData = new SBThemeData; - SetThemeData(0); - m_rtDisLBorder.Reset(); - m_rtDisRBorder.Reset(); - m_rtDisBBorder.Reset(); - m_rtDisCaption.Reset(); -} - -CFWL_FormTP::~CFWL_FormTP() { - delete m_pThemeData; -} - -FWL_Error CFWL_FormTP::Initialize() { - InitTTO(); - InitCaption(TRUE); - InitCaption(FALSE); - return CFWL_WidgetTP::Initialize(); -} - -FWL_Error CFWL_FormTP::Finalize() { - FinalizeTTO(); - delete m_pActiveBitmap; - m_pActiveBitmap = nullptr; - delete m_pDeactivebitmap; - m_pDeactivebitmap = nullptr; - return CFWL_WidgetTP::Finalize(); -} - -bool CFWL_FormTP::IsValidWidget(IFWL_Widget* pWidget) { - return pWidget && pWidget->GetClassID() == FWL_Type::Form; -} - -uint32_t CFWL_FormTP::SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren) { - if (m_pThemeData) { - SetThemeData(FWL_GetThemeColor(dwThemeID)); - } - InitCaption(TRUE); - InitCaption(FALSE); - return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren); -} -FX_BOOL CFWL_FormTP::DrawBackground(CFWL_ThemeBackground* pParams) { - if (!pParams) - return FALSE; - int32_t iActive = 0; - if (pParams->m_dwStates & CFWL_PartState_Inactive) - iActive = 1; - - FWLTHEME_STATE eState = FWLTHEME_STATE_Normal; - if (pParams->m_dwStates & CFWL_PartState_Hovered) - eState = FWLTHEME_STATE_Hover; - else if (pParams->m_dwStates & CFWL_PartState_Pressed) - eState = FWLTHEME_STATE_Pressed; - else if (pParams->m_dwStates & CFWL_PartState_Disabled) - eState = FWLTHEME_STATE_Disabale; - - switch (pParams->m_iPart) { - case CFWL_Part::Border: { - DrawFormBorder(pParams->m_pGraphics, &pParams->m_rtPart, eState, - &pParams->m_matrix, iActive); - break; - } - case CFWL_Part::Edge: { - DrawEdge(pParams->m_pGraphics, pParams->m_pWidget->GetStyles(), - &pParams->m_rtPart, &pParams->m_matrix); - break; - } - case CFWL_Part::Background: { - FillBackground(pParams->m_pGraphics, &pParams->m_rtPart, - &pParams->m_matrix); - break; - } - case CFWL_Part::Caption: { - DrawCaption(pParams->m_pGraphics, &pParams->m_rtPart, eState, - &pParams->m_matrix, iActive); - break; - } - case CFWL_Part::NarrowCaption: { - DrawNarrowCaption(pParams->m_pGraphics, &pParams->m_rtPart, eState, - &pParams->m_matrix, iActive); - break; - } - case CFWL_Part::CloseBox: { - DrawCloseBox(pParams->m_pGraphics, &pParams->m_rtPart, eState, - &pParams->m_matrix, iActive); - break; - } - case CFWL_Part::MinimizeBox: { - DrawMinimizeBox(pParams->m_pGraphics, &pParams->m_rtPart, eState, - &pParams->m_matrix, iActive); - break; - } - case CFWL_Part::MaximizeBox: { - DrawMaximizeBox(pParams->m_pGraphics, &pParams->m_rtPart, eState, - pParams->m_bMaximize, &pParams->m_matrix, iActive); - break; - } - case CFWL_Part::Icon: { - DrawIconImage(pParams->m_pGraphics, pParams->m_pImage, &pParams->m_rtPart, - eState, &pParams->m_matrix, iActive); - break; - } - default: {} - } - return TRUE; -} -FX_BOOL CFWL_FormTP::DrawText(CFWL_ThemeText* pParams) { - if (!m_pTextOut) - return FALSE; - if (pParams->m_iPart == CFWL_Part::Caption) { - m_pTextOut->SetTextColor(0xFFFFFFFF); - } else { - m_pTextOut->SetTextColor(0xFF000000); - } - return CFWL_WidgetTP::DrawText(pParams); -} -void* CFWL_FormTP::GetCapacity(CFWL_ThemePart* pThemePart, - CFWL_WidgetCapacity dwCapacity) { - FX_BOOL bDefPro = FALSE; - FX_BOOL bDwordVal = FALSE; - switch (dwCapacity) { - case CFWL_WidgetCapacity::CXBorder: { - m_fValue = kCXFormBorder; - break; - } - case CFWL_WidgetCapacity::CYBorder: { - m_fValue = kCYFormBorder; - break; - } - case CFWL_WidgetCapacity::CYCaption: { - m_fValue = kCYCaption; - break; - } - case CFWL_WidgetCapacity::CYNarrowCaption: { - m_fValue = kCYCaption; - break; - } - case CFWL_WidgetCapacity::TextColor: { - bDwordVal = TRUE; - m_dwValue = kFormTextColor; - break; - } - case CFWL_WidgetCapacity::BigIcon: { - m_fValue = kFormBigIconSize; - break; - } - case CFWL_WidgetCapacity::SmallIcon: { - m_fValue = kFormSmallIconSize; - break; - } - default: { bDefPro = TRUE; } - } - if (!bDefPro) { - if (bDwordVal) { - return &m_dwValue; - } - return &m_fValue; - } - return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); -} -FWL_Error CFWL_FormTP::GetPartRect(CFWL_ThemePart* pThemePart, - CFX_RectF& rtPart) { - switch (pThemePart->m_iPart) { - case CFWL_Part::CloseBox: { - CalCloseBox(pThemePart->m_pWidget, rtPart); - break; - } - case CFWL_Part::MaximizeBox: { - CalMaxBox(pThemePart->m_pWidget, rtPart); - break; - } - case CFWL_Part::MinimizeBox: { - CalMinBox(pThemePart->m_pWidget, rtPart); - break; - } - case CFWL_Part::HeadText: { - CalCaption(pThemePart->m_pWidget, rtPart); - break; - } - case CFWL_Part::Icon: { - CalIcon(pThemePart->m_pWidget, rtPart); - break; - } - default: {} - } - return FWL_Error::Succeeded; -} -void CFWL_FormTP::CalCloseBox(IFWL_Widget* pWidget, CFX_RectF& rect) { - uint32_t dwStyles = pWidget->GetStyles(); - CFX_RectF rtWidget; - pWidget->GetWidgetRect(rtWidget); - rtWidget.Offset(-rtWidget.left, -rtWidget.top); - if (dwStyles & FWL_WGTSTYLE_CloseBox) { - rect.Set(rtWidget.left + kButtonMargin + kButtonSpan, - rtWidget.top + kButtonMargin, kButtonSize, kButtonSize); - } else { - rect.Set(rtWidget.left + kButtonMargin + kButtonSpan, - rtWidget.top + kButtonMargin, 0, 0); - } -} -void CFWL_FormTP::CalMaxBox(IFWL_Widget* pWidget, CFX_RectF& rect) { - uint32_t dwStyles = pWidget->GetStyles(); - CFX_RectF rtWidget; - pWidget->GetWidgetRect(rtWidget); - rtWidget.Offset(-rtWidget.left, -rtWidget.top); - if (dwStyles & FWL_WGTSTYLE_MaximizeBox) { - rect.Set(rtWidget.left + kButtonMargin + kButtonSize + kButtonSpan * 2, - rtWidget.top + kButtonMargin, kButtonSize, kButtonSize); - } else { - rect.Set(rtWidget.left + kButtonMargin + kButtonSize + kButtonSpan * 2, - rtWidget.top + kButtonMargin, 0, 0); - } -} -void CFWL_FormTP::CalMinBox(IFWL_Widget* pWidget, CFX_RectF& rect) { - uint32_t dwStyles = pWidget->GetStyles(); - CFX_RectF rtWidget; - pWidget->GetWidgetRect(rtWidget); - rtWidget.Offset(-rtWidget.left, -rtWidget.top); - if (dwStyles & FWL_WGTSTYLE_MinimizeBox) { - rect.Set(rtWidget.left + kButtonMargin + kButtonSize * 2 + kButtonSpan * 3, - rtWidget.top + kButtonMargin, kButtonSize, kButtonSize); - } else { - rect.Set(rtWidget.left + kButtonMargin + kButtonSize * 2 + kButtonSpan * 3, - rtWidget.top + kButtonMargin, 0, 0); - } -} -void CFWL_FormTP::CalCaption(IFWL_Widget* pWidget, CFX_RectF& rect) { - CFX_RectF rtWidget; - pWidget->GetWidgetRect(rtWidget); - rtWidget.Offset(-rtWidget.left, -rtWidget.top); - rect.Set(rtWidget.left + kButtonMargin, rtWidget.top + kButtonMargin - 2, - rtWidget.width - kButtonMargin * 2, - kButtonSize + 2 * kButtonMargin + 4); -} -void CFWL_FormTP::CalIcon(IFWL_Widget* pWidget, CFX_RectF& rect) {} -void CFWL_FormTP::DrawFormBorder(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive) { - CFX_RectF rt; - rt.Set(pRect->left, pRect->top, 1, pRect->height); - FX_FLOAT fBottom, fRight; - fBottom = pRect->bottom(); - fRight = pRect->right(); - CFX_Path path; - path.Create(); - CFX_Color clrLine; - path.Clear(); - path.MoveTo(pRect->left, pRect->top); - path.LineTo(pRect->left, fBottom - 1); - path.LineTo(fRight - 1, fBottom - 1); - path.LineTo(fRight - 1, pRect->top); - clrLine = m_pThemeData->clrFormBorder[iActive][2]; - pGraphics->SetStrokeColor(&clrLine); - pGraphics->StrokePath(&path, pMatrix); - path.Clear(); - path.MoveTo(pRect->left + 1, pRect->top); - path.LineTo(pRect->left + 1, fBottom - 2); - path.LineTo(fRight - 2, fBottom - 2); - path.LineTo(fRight - 2, pRect->top); - clrLine = m_pThemeData->clrFormBorder[iActive][1]; - pGraphics->SetStrokeColor(&clrLine); - pGraphics->StrokePath(&path, pMatrix); - path.Clear(); - path.MoveTo(pRect->left + 2, pRect->top); - path.LineTo(pRect->left + 2, fBottom - 3); - path.LineTo(fRight - 3, fBottom - 3); - path.LineTo(fRight - 3, pRect->top); - clrLine = m_pThemeData->clrFormBorder[iActive][0]; - pGraphics->SetStrokeColor(&clrLine); - pGraphics->StrokePath(&path, pMatrix); - path.Clear(); - path.MoveTo(pRect->left + 3, pRect->top); - path.LineTo(pRect->left + 3, fBottom - 4); - path.LineTo(fRight - 4, fBottom - 4); - path.LineTo(fRight - 4, pRect->top); - clrLine = m_pThemeData->clrFormBorder[iActive][4]; - pGraphics->SetStrokeColor(&clrLine); - pGraphics->StrokePath(&path, pMatrix); - m_rtDisLBorder.Set(pRect->left, pRect->top + 29, 4, pRect->height - 29); - m_rtDisRBorder.Set(pRect->right() - 4, pRect->top + 29, 4, - pRect->height - 29); - m_rtDisBBorder.Set(pRect->left, pRect->bottom() - 4, pRect->width, 4); - m_rtDisCaption.Set(pRect->left, pRect->top, pRect->width, 29); -} -void CFWL_FormTP::DrawCaption(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive) { - CFX_RectF rt; - FX_FLOAT fBottom, fRight; - fBottom = pRect->bottom(); - fRight = pRect->right(); - rt.Set(pRect->left, pRect->top, pRect->width, 1); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeTop[iActive][0], &rt, - pMatrix); - rt.Offset(0, 1); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeTop[iActive][1], &rt, - pMatrix); - rt.Offset(0, 1); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeTop[iActive][2], &rt, - pMatrix); - rt.Set(pRect->left, pRect->bottom() - 1, pRect->width, 1); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeBottom[iActive][2], &rt, - pMatrix); - rt.Offset(0, -1); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeBottom[iActive][1], &rt, - pMatrix); - rt.Set(pRect->left, pRect->top, 1, pRect->height); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeLeft[iActive][2], &rt, - pMatrix); - rt.Set(pRect->left + 1, pRect->top + 1, 1, fBottom - 1); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeLeft[iActive][1], &rt, - pMatrix); - rt.Set(pRect->left + 2, pRect->top + 2, 1, fBottom - 2); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeLeft[iActive][0], &rt, - pMatrix); - rt.Set(fRight - 1, pRect->top, pRect->width, pRect->height); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeRight[iActive][2], &rt, - pMatrix); - rt.Set(fRight - 2, pRect->top + 1, 1, fBottom - 1); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeRight[iActive][1], &rt, - pMatrix); - rt.Set(fRight - 3, pRect->top + 2, 1, fBottom - 2); - FillSoildRect(pGraphics, m_pThemeData->clrHeadEdgeRight[iActive][0], &rt, - pMatrix); - CFX_RectF rect(*pRect); - rect.Set(rect.left + 3, rect.top + 3, rect.width - 6, rect.height - 5); - if (iActive == 0) { - pGraphics->StretchImage(m_pActiveBitmap, rect, pMatrix); - } else { - pGraphics->StretchImage(m_pDeactivebitmap, rect, pMatrix); - } -} -void CFWL_FormTP::DrawNarrowCaption(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive) {} -void CFWL_FormTP::DrawCloseBox(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive) { - FX_FLOAT fRight = pRect->right(); - FX_FLOAT fBottom = pRect->bottom(); - FX_FLOAT fWidth = pRect->width; - FX_FLOAT fHeight = pRect->height; - pGraphics->SaveGraphState(); - CFX_RectF rt(*pRect); - pGraphics->SetLineWidth(1.0f); - CFX_Path path; - path.Create(); - path.AddRectangle(rt.left + 1, rt.top, fWidth - 2, 1); - path.AddRectangle(rt.left, rt.top + 1, 1, fHeight - 2); - path.AddRectangle(fRight - 1, rt.top + 1, 1, fHeight - 2); - path.AddRectangle(rt.left + 1, fBottom - 1, fWidth - 2, 1); - CFX_Color crFill; - crFill = m_pThemeData->clrBtnEdgeOut[iActive]; - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - path.Clear(); - path.AddRectangle(rt.left + 1, rt.top + 1, 1, 1); - path.AddRectangle(fRight - 2, rt.top + 1, 1, 1); - path.AddRectangle(rt.left + 1, fBottom - 2, 1, 1); - path.AddRectangle(fRight - 2, fBottom - 2, 1, 1); - crFill = m_pThemeData->clrBtnCornerLight[iActive][eState - 1]; - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - path.Clear(); - path.AddRectangle(rt.left + 2, rt.top + 1, fWidth - 4, 1); - path.AddRectangle(rt.left + 1, rt.top + 2, 1, fHeight - 4); - crFill = m_pThemeData->clrCloseBtEdgeLight[iActive][eState - 1]; - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - path.Clear(); - path.AddRectangle(fRight - 2, rt.top + 2, 1, fHeight - 4); - path.AddRectangle(rt.left + 2, fBottom - 2, fWidth - 4, 1); - crFill = m_pThemeData->clrCloseBtEdgeDark[iActive][eState - 1]; - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - path.Clear(); - path.AddRectangle(pRect->left + 2, pRect->top + 2, fWidth - 4, fHeight - 4); - DrawAxialShading(pGraphics, pRect->left + 2, pRect->top + 2, fRight - 2, - fBottom - 2, - m_pThemeData->clrCloseBtBKStart[iActive][eState - 1], - m_pThemeData->clrCloseBtBKEnd[iActive][eState - 1], &path, - FXFILL_WINDING, pMatrix); - CFX_RectF rtX(*pRect); - rtX.Inflate(-5, -5); - path.Clear(); - FX_FLOAT frtXRight = rtX.right(); - FX_FLOAT frtXBottom = rtX.bottom(); - path.AddLine(rtX.left, rtX.top + 1, frtXRight - 1, frtXBottom); - path.AddLine(rtX.left, rtX.top, frtXRight, frtXBottom); - path.AddLine(rtX.left + 1, rtX.top, frtXRight, frtXBottom - 1); - path.AddLine(rtX.left, frtXBottom - 1, frtXRight - 1, rtX.top); - path.AddLine(rtX.left, frtXBottom, frtXRight, rtX.top); - path.AddLine(rtX.left + 1, frtXBottom, frtXRight, rtX.top + 1); - CFX_Color clrLine(0xffffffff); - pGraphics->SetLineWidth(1.0f); - pGraphics->SetStrokeColor(&clrLine); - pGraphics->StrokePath(&path, pMatrix); - pGraphics->RestoreGraphState(); -} -void CFWL_FormTP::DrawMinMaxBoxCommon(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive) { - pGraphics->SaveGraphState(); - FX_FLOAT fRight = pRect->right(); - FX_FLOAT fBottom = pRect->bottom(); - FX_FLOAT fWidth = pRect->width; - FX_FLOAT fHeight = pRect->height; - CFX_RectF rt(*pRect); - pGraphics->SetLineWidth(1.0f); - CFX_Path path; - path.Create(); - path.AddRectangle(rt.left + 1, rt.top, fWidth - 2, 1); - path.AddRectangle(rt.left, rt.top + 1, 1, fHeight - 2); - path.AddRectangle(fRight - 1, rt.top + 1, 1, fHeight - 2); - path.AddRectangle(rt.left + 1, fBottom - 1, fWidth - 2, 1); - CFX_Color crFill; - crFill = m_pThemeData->clrBtnEdgeOut[iActive]; - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - path.Clear(); - path.AddRectangle(rt.left + 1, rt.top + 1, 1, 1); - path.AddRectangle(fRight - 2, rt.top + 1, 1, 1); - path.AddRectangle(rt.left + 1, fBottom - 2, 1, 1); - path.AddRectangle(fRight - 2, fBottom - 2, 1, 1); - crFill = m_pThemeData->clrBtnCornerLight[iActive][eState - 1]; - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - path.Clear(); - path.AddRectangle(rt.left + 2, rt.top + 1, fWidth - 4, 1); - path.AddRectangle(rt.left + 1, rt.top + 2, 1, fHeight - 4); - crFill = m_pThemeData->clrNormalBtEdgeLight[iActive][eState - 1]; - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - path.Clear(); - path.AddRectangle(fRight - 2, rt.top + 2, 1, fHeight - 4); - path.AddRectangle(rt.left + 2, fBottom - 2, fWidth - 4, 1); - crFill = m_pThemeData->clrNormalBtEdgeDark[iActive][eState - 1]; - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); - pGraphics->RestoreGraphState(); - path.Clear(); - path.AddRectangle(pRect->left + 2, pRect->top + 2, fWidth - 4, fHeight - 4); - DrawAxialShading(pGraphics, pRect->left + 2, pRect->top + 2, fRight - 2, - fBottom - 2, - m_pThemeData->clrNormalBtBKStart[iActive][eState - 1], - m_pThemeData->clrNormalBtBKEnd[iActive][eState - 1], &path, - FXFILL_WINDING, pMatrix); -} -void CFWL_FormTP::DrawMinimizeBox(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive) { - DrawMinMaxBoxCommon(pGraphics, pRect, eState, pMatrix); - CFX_RectF rtMin; - rtMin.Set(pRect->left + 5, pRect->top + 13, pRect->width - 14, - pRect->height - 18); - FillSoildRect(pGraphics, 0xFFFFFFFF, &rtMin, pMatrix); -} -void CFWL_FormTP::DrawMaximizeBox(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - bool bMax, - CFX_Matrix* pMatrix, - int32_t iActive) { - DrawMinMaxBoxCommon(pGraphics, pRect, eState, pMatrix); - FX_FLOAT fWidth = pRect->width; - FX_FLOAT fHeight = pRect->height; - if (bMax) { - CFX_Path path; - path.Create(); - path.AddLine(pRect->left + 7, pRect->top + 6, pRect->left + 14, - pRect->top + 6); - path.AddLine(pRect->left + 4, pRect->top + 9, pRect->left + 11, - pRect->top + 9); - pGraphics->SaveGraphState(); - pGraphics->SetLineWidth(2); - CFX_Color crStroke(0xFFFFFFFF); - pGraphics->SetStrokeColor(&crStroke); - pGraphics->StrokePath(&path, pMatrix); - pGraphics->SetLineWidth(1); - path.Clear(); - path.AddLine(pRect->left + 4, pRect->top + 10, pRect->left + 4, - pRect->top + 14); - path.AddLine(pRect->left + 10, pRect->top + 10, pRect->left + 10, - pRect->top + 14); - path.AddLine(pRect->left + 13, pRect->top + 7, pRect->left + 13, - pRect->top + 11); - path.AddLine(pRect->left + 4, pRect->top + 14, pRect->left + 10, - pRect->top + 14); - path.AddLine(pRect->left + 12, pRect->top + 11, pRect->left + 12, - pRect->top + 11); - pGraphics->StrokePath(&path, pMatrix); - pGraphics->RestoreGraphState(); - } else { - CFX_RectF rtMax(*pRect); - rtMax.Inflate(-5, -5); - CFX_Path path; - path.Create(); - path.AddRectangle(pRect->left + 5, pRect->top + 5, fWidth - 10, - fHeight - 10); - path.AddRectangle(pRect->left + 6, pRect->top + 8, fWidth - 12, - fHeight - 14); - pGraphics->SaveGraphState(); - CFX_Color crFill(0xFFFFFFFF); - pGraphics->SetFillColor(&crFill); - pGraphics->FillPath(&path, FXFILL_ALTERNATE, pMatrix); - pGraphics->RestoreGraphState(); - } -} -void CFWL_FormTP::DrawIconImage(CFX_Graphics* pGraphics, - CFX_DIBitmap* pDIBitmap, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive) { - pGraphics->StretchImage(pDIBitmap, *pRect, pMatrix); -} -void CFWL_FormTP::SetThemeData(uint32_t dwID) { - m_pThemeData->clrTransWhite = ArgbEncode(0x65, 255, 255, 255); - m_pThemeData->clrCloseBtBKStart[0][0] = ArgbEncode(0xff, 240, 166, 148); - m_pThemeData->clrCloseBtBKEnd[0][0] = ArgbEncode(0xff, 228, 61, 5); - m_pThemeData->clrCloseBtBKStart[0][1] = ArgbEncode(0xff, 255, 184, 176); - m_pThemeData->clrCloseBtBKEnd[0][1] = ArgbEncode(0xff, 252, 107, 71); - m_pThemeData->clrCloseBtBKStart[0][2] = ArgbEncode(0xff, 141, 44, 20); - m_pThemeData->clrCloseBtBKEnd[0][2] = ArgbEncode(0xff, 202, 72, 33); - m_pThemeData->clrCloseBtEdgeLight[0][0] = ArgbEncode(0xff, 255, 122, 107); - m_pThemeData->clrCloseBtEdgeDark[0][0] = ArgbEncode(0xff, 218, 77, 54); - m_pThemeData->clrCloseBtEdgeLight[0][1] = ArgbEncode(0xff, 255, 93, 74); - m_pThemeData->clrCloseBtEdgeDark[0][1] = ArgbEncode(0xff, 218, 74, 51); - m_pThemeData->clrCloseBtEdgeLight[0][2] = ArgbEncode(0xff, 191, 61, 28); - m_pThemeData->clrCloseBtEdgeDark[0][2] = ArgbEncode(0xff, 93, 30, 13); - if (dwID) { - m_pThemeData->clrHeadBK[0][0] = ArgbEncode(0xff, 194, 205, 149); - m_pThemeData->clrHeadBK[0][1] = ArgbEncode(0xff, 170, 184, 131); - m_pThemeData->clrHeadBK[0][2] = ArgbEncode(0xff, 168, 182, 128); - m_pThemeData->clrHeadBK[0][3] = ArgbEncode(0xff, 194, 205, 149); - m_pThemeData->clrHeadEdgeLeft[0][0] = ArgbEncode(0xff, 117, 141, 94); - m_pThemeData->clrHeadEdgeLeft[0][1] = ArgbEncode(0xff, 139, 161, 105); - m_pThemeData->clrHeadEdgeLeft[0][2] = ArgbEncode(0xff, 171, 189, 133); - m_pThemeData->clrHeadEdgeRight[0][0] = ArgbEncode(0xff, 155, 175, 125); - m_pThemeData->clrHeadEdgeRight[0][1] = ArgbEncode(0xff, 128, 146, 103); - m_pThemeData->clrHeadEdgeRight[0][2] = ArgbEncode(0xff, 94, 118, 79); - m_pThemeData->clrHeadEdgeTop[0][0] = ArgbEncode(0xff, 139, 161, 105); - m_pThemeData->clrHeadEdgeTop[0][1] = ArgbEncode(0xff, 234, 245, 201); - m_pThemeData->clrHeadEdgeTop[0][2] = ArgbEncode(0xff, 194, 205, 149); - m_pThemeData->clrHeadEdgeBottom[0][0] = ArgbEncode(0xff, 175, 189, 133); - m_pThemeData->clrHeadEdgeBottom[0][1] = ArgbEncode(0xff, 153, 168, 121); - m_pThemeData->clrHeadEdgeBottom[0][2] = ArgbEncode(0xff, 150, 168, 103); - m_pThemeData->clrNormalBtBKStart[0][0] = ArgbEncode(0xff, 182, 195, 162); - m_pThemeData->clrNormalBtBKEnd[0][0] = ArgbEncode(0xff, 128, 144, 84); - m_pThemeData->clrNormalBtBKStart[0][1] = ArgbEncode(0xff, 234, 241, 208); - m_pThemeData->clrNormalBtBKEnd[0][1] = ArgbEncode(0xff, 169, 186, 112); - m_pThemeData->clrNormalBtBKStart[0][2] = ArgbEncode(0xff, 199, 199, 190); - m_pThemeData->clrNormalBtBKEnd[0][2] = ArgbEncode(0xff, 133, 148, 88); - m_pThemeData->clrNormalBtEdgeLight[0][0] = ArgbEncode(0xff, 163, 176, 137); - m_pThemeData->clrNormalBtEdgeDark[0][0] = ArgbEncode(0xff, 118, 135, 83); - m_pThemeData->clrNormalBtEdgeLight[0][1] = ArgbEncode(0xff, 154, 174, 105); - m_pThemeData->clrNormalBtEdgeDark[0][1] = ArgbEncode(0xff, 154, 174, 105); - m_pThemeData->clrNormalBtEdgeLight[0][2] = ArgbEncode(0xff, 172, 193, 123); - m_pThemeData->clrNormalBtEdgeDark[0][2] = ArgbEncode(0xff, 154, 174, 105); - m_pThemeData->clrBtnCornerLight[0][0] = ArgbEncode(0xff, 220, 220, 220); - m_pThemeData->clrBtnCornerLight[0][1] = ArgbEncode(0xff, 255, 255, 255); - m_pThemeData->clrBtnCornerLight[0][2] = ArgbEncode(0xff, 225, 225, 225); - m_pThemeData->clrBtnEdgeOut[0] = ArgbEncode(0xff, 255, 255, 255); - m_pThemeData->clrFormBorder[0][0] = ArgbEncode(0xff, 117, 141, 94); - m_pThemeData->clrFormBorder[0][1] = ArgbEncode(0xff, 139, 161, 105); - m_pThemeData->clrFormBorder[0][2] = ArgbEncode(0xff, 171, 189, 133); - m_pThemeData->clrFormBorder[0][3] = ArgbEncode(0xff, 164, 178, 127); - m_pThemeData->clrFormBorder[0][4] = ArgbEncode(0xff, 255, 255, 255); - m_pThemeData->clrFormBorderLight[0] = ArgbEncode(0xff, 171, 189, 133); - } else { - m_pThemeData->clrHeadBK[0][0] = ArgbEncode(0xff, 3, 114, 255); - m_pThemeData->clrHeadBK[0][1] = ArgbEncode(0xff, 0, 85, 226); - m_pThemeData->clrHeadBK[0][2] = ArgbEncode(0xff, 0, 85, 226); - m_pThemeData->clrHeadBK[0][3] = ArgbEncode(0xff, 3, 114, 255); - m_pThemeData->clrHeadEdgeLeft[0][2] = ArgbEncode(0xff, 0, 32, 200); - m_pThemeData->clrHeadEdgeLeft[0][1] = ArgbEncode(0xff, 0, 61, 220); - m_pThemeData->clrHeadEdgeLeft[0][0] = ArgbEncode(0xff, 0, 54, 210); - m_pThemeData->clrHeadEdgeRight[0][0] = ArgbEncode(0xff, 0, 56, 234); - m_pThemeData->clrHeadEdgeRight[0][1] = ArgbEncode(0xff, 0, 50, 193); - m_pThemeData->clrHeadEdgeRight[0][2] = ArgbEncode(0xff, 0, 19, 139); - m_pThemeData->clrHeadEdgeTop[0][0] = ArgbEncode(0xff, 0, 88, 238); - m_pThemeData->clrHeadEdgeTop[0][1] = ArgbEncode(0xff, 63, 151, 255); - m_pThemeData->clrHeadEdgeTop[0][2] = ArgbEncode(0xff, 3, 114, 255); - m_pThemeData->clrHeadEdgeBottom[0][0] = ArgbEncode(0xff, 0, 96, 252); - m_pThemeData->clrHeadEdgeBottom[0][1] = ArgbEncode(0xff, 63, 151, 255); - m_pThemeData->clrHeadEdgeBottom[0][2] = ArgbEncode(0xff, 0, 67, 207); - m_pThemeData->clrNormalBtBKStart[0][2] = ArgbEncode(0xff, 0, 49, 112); - m_pThemeData->clrNormalBtBKEnd[0][2] = ArgbEncode(0xff, 0, 87, 188); - m_pThemeData->clrNormalBtBKStart[0][0] = ArgbEncode(0xff, 154, 183, 250); - m_pThemeData->clrNormalBtBKEnd[0][0] = ArgbEncode(0xff, 17, 110, 248); - m_pThemeData->clrNormalBtBKStart[0][1] = ArgbEncode(0xff, 164, 194, 255); - m_pThemeData->clrNormalBtBKEnd[0][1] = ArgbEncode(0xff, 29, 158, 255); - m_pThemeData->clrNormalBtEdgeLight[0][0] = ArgbEncode(0xff, 68, 120, 245); - m_pThemeData->clrNormalBtEdgeDark[0][0] = ArgbEncode(0xff, 24, 72, 187); - m_pThemeData->clrNormalBtEdgeLight[0][1] = ArgbEncode(0xff, 72, 122, 245); - m_pThemeData->clrNormalBtEdgeDark[0][1] = ArgbEncode(0xff, 35, 87, 195); - m_pThemeData->clrNormalBtEdgeLight[0][2] = ArgbEncode(0xff, 60, 114, 244); - m_pThemeData->clrNormalBtEdgeDark[0][2] = ArgbEncode(0xff, 21, 70, 185); - m_pThemeData->clrBtnCornerLight[0][0] = ArgbEncode(0xff, 220, 220, 220); - m_pThemeData->clrBtnCornerLight[0][1] = ArgbEncode(0xff, 255, 255, 255); - m_pThemeData->clrBtnCornerLight[0][2] = ArgbEncode(0xff, 225, 225, 225); - m_pThemeData->clrBtnEdgeOut[0] = ArgbEncode(0xff, 255, 255, 255); - m_pThemeData->clrFormBorder[0][0] = ArgbEncode(0xff, 0, 72, 241); - m_pThemeData->clrFormBorder[0][1] = ArgbEncode(0xff, 0, 61, 220); - m_pThemeData->clrFormBorder[0][2] = ArgbEncode(0xff, 0, 30, 160); - m_pThemeData->clrFormBorder[0][3] = ArgbEncode(0xff, 0, 19, 140); - m_pThemeData->clrFormBorder[0][4] = ArgbEncode(0xff, 255, 255, 255); - m_pThemeData->clrFormBorderLight[0] = ArgbEncode(0xff, 22, 106, 239); - } - m_pThemeData->clrCloseBtBKStart[1][0] = m_pThemeData->clrCloseBtBKStart[0][0]; - m_pThemeData->clrCloseBtBKEnd[1][0] = m_pThemeData->clrCloseBtBKEnd[0][0]; - m_pThemeData->clrCloseBtBKStart[1][1] = m_pThemeData->clrCloseBtBKStart[0][1]; - m_pThemeData->clrCloseBtBKEnd[1][1] = m_pThemeData->clrCloseBtBKEnd[0][1]; - m_pThemeData->clrCloseBtBKStart[1][2] = m_pThemeData->clrCloseBtBKStart[0][2]; - m_pThemeData->clrCloseBtBKEnd[1][2] = m_pThemeData->clrCloseBtBKEnd[0][2]; - m_pThemeData->clrCloseBtEdgeLight[1][0] = - m_pThemeData->clrCloseBtEdgeLight[0][0]; - m_pThemeData->clrCloseBtEdgeDark[1][0] = - m_pThemeData->clrCloseBtEdgeDark[0][0]; - m_pThemeData->clrCloseBtEdgeLight[1][1] = - m_pThemeData->clrCloseBtEdgeLight[0][1]; - m_pThemeData->clrCloseBtEdgeDark[1][1] = - m_pThemeData->clrCloseBtEdgeDark[0][1]; - m_pThemeData->clrCloseBtEdgeLight[1][2] = - m_pThemeData->clrCloseBtEdgeLight[0][2]; - m_pThemeData->clrCloseBtEdgeDark[1][2] = - m_pThemeData->clrCloseBtEdgeDark[0][2]; - m_pThemeData->clrHeadBK[1][0] = m_pThemeData->clrHeadBK[0][0]; - m_pThemeData->clrHeadBK[1][1] = m_pThemeData->clrHeadBK[0][1]; - m_pThemeData->clrHeadBK[1][2] = m_pThemeData->clrHeadBK[0][2]; - m_pThemeData->clrHeadBK[1][3] = m_pThemeData->clrHeadBK[0][3]; - m_pThemeData->clrHeadEdgeLeft[1][2] = m_pThemeData->clrHeadEdgeLeft[0][2]; - m_pThemeData->clrHeadEdgeLeft[1][1] = m_pThemeData->clrHeadEdgeLeft[0][1]; - m_pThemeData->clrHeadEdgeLeft[1][0] = m_pThemeData->clrHeadEdgeLeft[0][0]; - m_pThemeData->clrHeadEdgeRight[1][0] = m_pThemeData->clrHeadEdgeRight[0][0]; - m_pThemeData->clrHeadEdgeRight[1][1] = m_pThemeData->clrHeadEdgeRight[0][1]; - m_pThemeData->clrHeadEdgeRight[1][2] = m_pThemeData->clrHeadEdgeRight[0][2]; - m_pThemeData->clrHeadEdgeTop[1][0] = m_pThemeData->clrHeadEdgeTop[0][0]; - m_pThemeData->clrHeadEdgeTop[1][1] = m_pThemeData->clrHeadEdgeTop[0][1]; - m_pThemeData->clrHeadEdgeTop[1][2] = m_pThemeData->clrHeadEdgeTop[0][2]; - m_pThemeData->clrHeadEdgeBottom[1][0] = m_pThemeData->clrHeadEdgeBottom[0][0]; - m_pThemeData->clrHeadEdgeBottom[1][1] = m_pThemeData->clrHeadEdgeBottom[0][1]; - m_pThemeData->clrHeadEdgeBottom[1][2] = m_pThemeData->clrHeadEdgeBottom[0][2]; - m_pThemeData->clrNormalBtBKStart[1][2] = - m_pThemeData->clrNormalBtBKStart[0][2]; - m_pThemeData->clrNormalBtBKEnd[1][2] = m_pThemeData->clrNormalBtBKEnd[0][2]; - m_pThemeData->clrNormalBtBKStart[1][0] = - m_pThemeData->clrNormalBtBKStart[0][0]; - m_pThemeData->clrNormalBtBKEnd[1][0] = m_pThemeData->clrNormalBtBKEnd[1][0]; - m_pThemeData->clrNormalBtBKStart[1][1] = - m_pThemeData->clrNormalBtBKStart[0][1]; - m_pThemeData->clrNormalBtBKEnd[1][1] = m_pThemeData->clrNormalBtBKEnd[0][1]; - m_pThemeData->clrNormalBtEdgeLight[1][0] = - m_pThemeData->clrNormalBtEdgeLight[0][0]; - m_pThemeData->clrNormalBtEdgeDark[1][0] = - m_pThemeData->clrNormalBtEdgeDark[0][0]; - m_pThemeData->clrNormalBtEdgeLight[1][1] = - m_pThemeData->clrNormalBtEdgeLight[0][1]; - m_pThemeData->clrNormalBtEdgeDark[1][1] = - m_pThemeData->clrNormalBtEdgeDark[0][1]; - m_pThemeData->clrNormalBtEdgeLight[1][2] = - m_pThemeData->clrNormalBtEdgeLight[0][2]; - m_pThemeData->clrNormalBtEdgeDark[1][2] = - m_pThemeData->clrNormalBtEdgeDark[0][2]; - m_pThemeData->clrBtnCornerLight[1][0] = m_pThemeData->clrBtnCornerLight[0][0]; - m_pThemeData->clrBtnCornerLight[1][1] = m_pThemeData->clrBtnCornerLight[0][1]; - m_pThemeData->clrBtnCornerLight[1][2] = m_pThemeData->clrBtnCornerLight[0][2]; - m_pThemeData->clrBtnEdgeOut[1] = m_pThemeData->clrBtnEdgeOut[0]; - m_pThemeData->clrFormBorder[1][0] = m_pThemeData->clrFormBorder[0][0]; - m_pThemeData->clrFormBorder[1][1] = m_pThemeData->clrFormBorder[0][1]; - m_pThemeData->clrFormBorder[1][2] = m_pThemeData->clrFormBorder[0][2]; - m_pThemeData->clrFormBorder[1][3] = m_pThemeData->clrFormBorder[0][3]; - m_pThemeData->clrFormBorder[1][4] = m_pThemeData->clrFormBorder[0][4]; - m_pThemeData->clrFormBorderLight[1] = m_pThemeData->clrFormBorderLight[0]; - DeactiveForm(); -} -void CFWL_FormTP::DeactiveForm() { - TransModeColor(m_pThemeData->clrTransWhite, m_pThemeData->clrHeadBK[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, m_pThemeData->clrHeadBK[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, m_pThemeData->clrHeadBK[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, m_pThemeData->clrHeadBK[1][3]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeLeft[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeLeft[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeLeft[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeRight[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeRight[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeRight[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeTop[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeTop[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeTop[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeBottom[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeBottom[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrHeadEdgeBottom[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtBKStart[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtBKStart[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtBKStart[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtBKEnd[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtBKEnd[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtBKEnd[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtEdgeLight[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtEdgeLight[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtEdgeLight[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtEdgeDark[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtEdgeDark[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrNormalBtEdgeDark[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrBtnCornerLight[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrBtnCornerLight[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrBtnCornerLight[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, m_pThemeData->clrBtnEdgeOut[1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrFormBorder[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrFormBorder[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrFormBorder[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrFormBorder[1][3]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrFormBorder[1][4]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrFormBorderLight[1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtBKStart[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtBKStart[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtBKStart[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtBKEnd[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtBKEnd[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtBKEnd[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtEdgeLight[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtEdgeLight[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtEdgeLight[1][2]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtEdgeDark[1][0]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtEdgeDark[1][1]); - TransModeColor(m_pThemeData->clrTransWhite, - m_pThemeData->clrCloseBtEdgeDark[1][2]); -} -void CFWL_FormTP::TransModeColor(FX_ARGB clrFore, FX_ARGB& clrBack) { - int32_t iAlfaF, iRF, iGF, iBF; - int32_t iAlfaB, iRB, iGB, iBB; - ArgbDecode(clrFore, iAlfaF, iRF, iGF, iBF); - ArgbDecode(clrBack, iAlfaB, iRB, iGB, iBB); - clrBack = ArgbEncode(0xff, iRB + (iRF - iRB) * iAlfaF / 255, - iGB + (iGF - iGB) * iAlfaF / 255, - iBB + (iBF - iBB) * iAlfaF / 255); -} -void CFWL_FormTP::InitCaption(FX_BOOL bActive) { - if (bActive) { - CFX_FxgeDevice dev; - CFX_Graphics gs; - CFX_Path path; - path.Create(); - delete m_pActiveBitmap; - m_pActiveBitmap = new CFX_DIBitmap; - m_pActiveBitmap->Create(1, kCYCaption, FXDIB_Argb); - dev.Attach(m_pActiveBitmap, false, nullptr, false); - gs.Create(&dev); - path.AddRectangle(0, 0, 1, 5); - DrawAxialShading(&gs, 0, 0, 0, 5, m_pThemeData->clrHeadBK[0][0], - m_pThemeData->clrHeadBK[0][1], &path); - path.Clear(); - path.AddRectangle(0, 5, 1, 15); - DrawAxialShading(&gs, 0, 5, 0, 20, m_pThemeData->clrHeadBK[0][1], - m_pThemeData->clrHeadBK[0][2], &path); - path.Clear(); - path.AddRectangle(0, 20, 1, kCYCaption - 19); - DrawAxialShading(&gs, 0, 20, 0, kCYCaption, m_pThemeData->clrHeadBK[0][2], - m_pThemeData->clrHeadBK[0][3], &path); - } else { - CFX_FxgeDevice dev; - CFX_Graphics gs; - CFX_Path path; - path.Create(); - delete m_pDeactivebitmap; - m_pDeactivebitmap = new CFX_DIBitmap; - m_pDeactivebitmap->Create(1, kCYCaption, FXDIB_Argb); - dev.Attach(m_pDeactivebitmap, false, nullptr, false); - gs.Create(&dev); - path.AddRectangle(0, 0, 1, 5); - DrawAxialShading(&gs, 0, 0, 0, 5, m_pThemeData->clrHeadBK[1][0], - m_pThemeData->clrHeadBK[1][1], &path); - path.Clear(); - path.AddRectangle(0, 5, 1, 15); - DrawAxialShading(&gs, 0, 5, 0, 20, m_pThemeData->clrHeadBK[1][1], - m_pThemeData->clrHeadBK[1][2], &path); - path.Clear(); - path.AddRectangle(0, 20, 1, kCYCaption - 19); - DrawAxialShading(&gs, 0, 20, 0, kCYCaption, m_pThemeData->clrHeadBK[1][2], - m_pThemeData->clrHeadBK[1][3], &path); - } -} diff --git a/xfa/fwl/theme/cfwl_formtp.h b/xfa/fwl/theme/cfwl_formtp.h deleted file mode 100644 index ccbc71b2c2..0000000000 --- a/xfa/fwl/theme/cfwl_formtp.h +++ /dev/null @@ -1,113 +0,0 @@ -// 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 - -#ifndef XFA_FWL_THEME_CFWL_FORMTP_H_ -#define XFA_FWL_THEME_CFWL_FORMTP_H_ - -#include "xfa/fwl/theme/cfwl_utils.h" -#include "xfa/fwl/theme/cfwl_widgettp.h" - -class CFWL_FormTP : public CFWL_WidgetTP { - public: - CFWL_FormTP(); - ~CFWL_FormTP() override; - - // CFWL_WidgetTP - FWL_Error Initialize() override; - FWL_Error Finalize() override; - bool IsValidWidget(IFWL_Widget* pWidget) override; - uint32_t SetThemeID(IFWL_Widget* pWidget, - uint32_t dwThemeID, - FX_BOOL bChildren = TRUE) override; - FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; - FX_BOOL DrawText(CFWL_ThemeText* pParams) override; - void* GetCapacity(CFWL_ThemePart* pThemePart, - CFWL_WidgetCapacity dwCapacity) override; - FWL_Error GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) override; - - protected: - void CalCloseBox(IFWL_Widget* pWidget, CFX_RectF& rect); - void CalMaxBox(IFWL_Widget* pWidget, CFX_RectF& rect); - void CalMinBox(IFWL_Widget* pWidget, CFX_RectF& rect); - void CalCaption(IFWL_Widget* pWidget, CFX_RectF& rect); - void CalIcon(IFWL_Widget* pWidget, CFX_RectF& rect); - - void DrawFormBorder(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive = 0); - void DrawCaption(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive = 0); - void DrawNarrowCaption(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive = 0); - void DrawCloseBox(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive = 0); - void DrawMinMaxBoxCommon(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive = 0); - void DrawMinimizeBox(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive = 0); - void DrawMaximizeBox(CFX_Graphics* pGraphics, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - bool bMax, - CFX_Matrix* pMatrix, - int32_t iActive = 0); - void DrawIconImage(CFX_Graphics* pGraphics, - CFX_DIBitmap* pDIBitmap, - const CFX_RectF* pRect, - FWLTHEME_STATE eState, - CFX_Matrix* pMatrix, - int32_t iActive = 0); - void SetThemeData(uint32_t dwID); - void TransModeColor(FX_ARGB clrFore, FX_ARGB& clrBack); - void DeactiveForm(); - void InitCaption(FX_BOOL bActive); - CFX_DIBitmap* m_pActiveBitmap; - CFX_DIBitmap* m_pDeactivebitmap; - CFX_RectF m_rtDisCaption; - CFX_RectF m_rtDisLBorder; - CFX_RectF m_rtDisRBorder; - CFX_RectF m_rtDisBBorder; - struct SBThemeData { - FX_ARGB clrHeadBK[2][4]; - FX_ARGB clrHeadEdgeLeft[2][3]; - FX_ARGB clrHeadEdgeRight[2][3]; - FX_ARGB clrHeadEdgeTop[2][3]; - FX_ARGB clrHeadEdgeBottom[2][3]; - FX_ARGB clrCloseBtBKStart[2][3]; - FX_ARGB clrCloseBtBKEnd[2][3]; - FX_ARGB clrCloseBtEdgeLight[2][3]; - FX_ARGB clrCloseBtEdgeDark[2][3]; - FX_ARGB clrNormalBtBKStart[2][3]; - FX_ARGB clrNormalBtBKEnd[2][3]; - FX_ARGB clrNormalBtEdgeLight[2][3]; - FX_ARGB clrNormalBtEdgeDark[2][3]; - FX_ARGB clrBtnEdgeOut[2]; - FX_ARGB clrBtnCornerLight[2][3]; - FX_ARGB clrHeadText[2]; - FX_ARGB clrFormBorder[2][5]; - FX_ARGB clrFormBorderLight[2]; - FX_ARGB clrTransWhite; - } * m_pThemeData; -}; - -#endif // XFA_FWL_THEME_CFWL_FORMTP_H_ diff --git a/xfa/fxbarcode/BC_ResultPoint.cpp b/xfa/fxbarcode/BC_ResultPoint.cpp deleted file mode 100644 index 9726ea4240..0000000000 --- a/xfa/fxbarcode/BC_ResultPoint.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// 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 -// Original code is licensed as follows: -/* - * Copyright 2007 ZXing authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "xfa/fxbarcode/BC_ResultPoint.h" - -CBC_ResultPoint::CBC_ResultPoint(FX_FLOAT x, FX_FLOAT y) : m_x(x), m_y(y) {} -FX_FLOAT CBC_ResultPoint::GetX() { - return m_x; -} -FX_FLOAT CBC_ResultPoint::GetY() { - return m_y; -} diff --git a/xfa/fxbarcode/BC_ResultPoint.h b/xfa/fxbarcode/BC_ResultPoint.h deleted file mode 100644 index 81e27848ca..0000000000 --- a/xfa/fxbarcode/BC_ResultPoint.h +++ /dev/null @@ -1,25 +0,0 @@ -// 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 - -#ifndef XFA_FXBARCODE_BC_RESULTPOINT_H_ -#define XFA_FXBARCODE_BC_RESULTPOINT_H_ - -#include "core/fxcrt/include/fx_basic.h" - -class CBC_ResultPoint { - public: - CBC_ResultPoint(); - CBC_ResultPoint(FX_FLOAT x, FX_FLOAT y); - virtual ~CBC_ResultPoint() {} - virtual FX_FLOAT GetX(); - virtual FX_FLOAT GetY(); - - protected: - FX_FLOAT m_x; - FX_FLOAT m_y; -}; - -#endif // XFA_FXBARCODE_BC_RESULTPOINT_H_ diff --git a/xfa/fxbarcode/common/BC_CommonBitSource.cpp b/xfa/fxbarcode/common/BC_CommonBitSource.cpp deleted file mode 100644 index af91d5e0bd..0000000000 --- a/xfa/fxbarcode/common/BC_CommonBitSource.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// 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 -// Original code is licensed as follows: -/* - * Copyright 2007 ZXing authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "xfa/fxbarcode/common/BC_CommonBitSource.h" - -CBC_CommonBitSource::CBC_CommonBitSource(CFX_ByteArray* bytes) { - m_bytes.Copy((*bytes)); - m_bitOffset = 0; - m_byteOffset = 0; -} -CBC_CommonBitSource::~CBC_CommonBitSource() {} -int32_t CBC_CommonBitSource::ReadBits(int32_t numBits, int32_t& e) { - if (numBits < 1 || numBits > 32) { - e = BCExceptionIllegalArgument; - return 0; - } - int32_t result = 0; - if (m_bitOffset > 0) { - int32_t bitsLeft = 8 - m_bitOffset; - int32_t toRead = numBits < bitsLeft ? numBits : bitsLeft; - int32_t bitsToNotRead = bitsLeft - toRead; - int32_t mask = (0xff >> (8 - toRead)) << bitsToNotRead; - result = (m_bytes[m_byteOffset] & mask) >> bitsToNotRead; - numBits -= toRead; - m_bitOffset += toRead; - if (m_bitOffset == 8) { - m_bitOffset = 0; - m_byteOffset++; - } - } - if (numBits > 0) { - while (numBits >= 8) { - result = (result << 8) | (m_bytes[m_byteOffset] & 0xff); - m_byteOffset++; - numBits -= 8; - } - if (numBits > 0) { - int32_t bitsToNotRead = 8 - numBits; - int32_t mask = (0xff >> bitsToNotRead) << bitsToNotRead; - result = (result << numBits) | - ((m_bytes[m_byteOffset] & mask) >> bitsToNotRead); - m_bitOffset += numBits; - } - } - return result; -} -int32_t CBC_CommonBitSource::Available() { - return 8 * (m_bytes.GetSize() - m_byteOffset) - m_bitOffset; -} -int32_t CBC_CommonBitSource::getByteOffset() { - return m_byteOffset; -} diff --git a/xfa/fxbarcode/common/BC_CommonBitSource.h b/xfa/fxbarcode/common/BC_CommonBitSource.h deleted file mode 100644 index 7c6736cba3..0000000000 --- a/xfa/fxbarcode/common/BC_CommonBitSource.h +++ /dev/null @@ -1,28 +0,0 @@ -// 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 - -#ifndef XFA_FXBARCODE_COMMON_BC_COMMONBITSOURCE_H_ -#define XFA_FXBARCODE_COMMON_BC_COMMONBITSOURCE_H_ - -#include "core/fxcrt/include/fx_basic.h" -#include "xfa/fxbarcode/utils.h" - -class CBC_CommonBitSource { - public: - CBC_CommonBitSource(CFX_ByteArray* bytes); - ~CBC_CommonBitSource(); - - int32_t ReadBits(int32_t numBits, int32_t& e); - int32_t Available(); - int32_t getByteOffset(); - - private: - CFX_ByteArray m_bytes; - int32_t m_byteOffset; - int32_t m_bitOffset; -}; - -#endif // XFA_FXBARCODE_COMMON_BC_COMMONBITSOURCE_H_ diff --git a/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.cpp b/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.cpp deleted file mode 100644 index d84ed6163d..0000000000 --- a/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.cpp +++ /dev/null @@ -1,152 +0,0 @@ -// 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 -// Original code is licensed as follows: -/* - * Copyright 2007 ZXing authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h" - -#include <memory> - -#include "core/fxcrt/include/fx_basic.h" -#include "xfa/fxbarcode/utils.h" - -CBC_CommonPerspectiveTransform::CBC_CommonPerspectiveTransform(FX_FLOAT a11, - FX_FLOAT a21, - FX_FLOAT a31, - FX_FLOAT a12, - FX_FLOAT a22, - FX_FLOAT a32, - FX_FLOAT a13, - FX_FLOAT a23, - FX_FLOAT a33) - : m_a11(a11), - m_a12(a12), - m_a13(a13), - m_a21(a21), - m_a22(a22), - m_a23(a23), - m_a31(a31), - m_a32(a32), - m_a33(a33) {} -CBC_CommonPerspectiveTransform::~CBC_CommonPerspectiveTransform() {} -CBC_CommonPerspectiveTransform* -CBC_CommonPerspectiveTransform::QuadrilateralToQuadrilateral(FX_FLOAT x0, - FX_FLOAT y0, - FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - FX_FLOAT x3, - FX_FLOAT y3, - FX_FLOAT x0p, - FX_FLOAT y0p, - FX_FLOAT x1p, - FX_FLOAT y1p, - FX_FLOAT x2p, - FX_FLOAT y2p, - FX_FLOAT x3p, - FX_FLOAT y3p) { - std::unique_ptr<CBC_CommonPerspectiveTransform> qToS( - QuadrilateralToSquare(x0, y0, x1, y1, x2, y2, x3, y3)); - std::unique_ptr<CBC_CommonPerspectiveTransform> sToQ( - SquareToQuadrilateral(x0p, y0p, x1p, y1p, x2p, y2p, x3p, y3p)); - return sToQ->Times(*(qToS.get())); -} -void CBC_CommonPerspectiveTransform::TransformPoints(CFX_FloatArray* points) { - int32_t max = points->GetSize(); - FX_FLOAT a11 = m_a11; - FX_FLOAT a12 = m_a12; - FX_FLOAT a13 = m_a13; - FX_FLOAT a21 = m_a21; - FX_FLOAT a22 = m_a22; - FX_FLOAT a23 = m_a23; - FX_FLOAT a31 = m_a31; - FX_FLOAT a32 = m_a32; - FX_FLOAT a33 = m_a33; - int32_t i; - for (i = 0; i < max; i += 2) { - FX_FLOAT x = (*points)[i]; - FX_FLOAT y = (*points)[i + 1]; - FX_FLOAT denominator = a13 * x + a23 * y + a33; - (*points)[i] = (a11 * x + a21 * y + a31) / denominator; - (*points)[i + 1] = (a12 * x + a22 * y + a32) / denominator; - } -} -CBC_CommonPerspectiveTransform* -CBC_CommonPerspectiveTransform::SquareToQuadrilateral(FX_FLOAT x0, - FX_FLOAT y0, - FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - FX_FLOAT x3, - FX_FLOAT y3) { - FX_FLOAT dy2 = y3 - y2; - FX_FLOAT dy3 = y0 - y1 + y2 - y3; - if ((dy2 == 0.0f) && (dy3 == 0.0f)) { - return new CBC_CommonPerspectiveTransform(x1 - x0, x2 - x1, x0, y1 - y0, - y2 - y1, y0, 0.0f, 0.0f, 1.0f); - } else { - FX_FLOAT dx1 = x1 - x2; - FX_FLOAT dx2 = x3 - x2; - FX_FLOAT dx3 = x0 - x1 + x2 - x3; - FX_FLOAT dy1 = y1 - y2; - FX_FLOAT denominator = dx1 * dy2 - dx2 * dy1; - FX_FLOAT a13 = (dx3 * dy2 - dx2 * dy3) / denominator; - FX_FLOAT a23 = (dx1 * dy3 - dx3 * dy1) / denominator; - return new CBC_CommonPerspectiveTransform( - x1 - x0 + a13 * x1, x3 - x0 + a23 * x3, x0, y1 - y0 + a13 * y1, - y3 - y0 + a23 * y3, y0, a13, a23, 1.0f); - } -} -CBC_CommonPerspectiveTransform* -CBC_CommonPerspectiveTransform::QuadrilateralToSquare(FX_FLOAT x0, - FX_FLOAT y0, - FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - FX_FLOAT x3, - FX_FLOAT y3) { - std::unique_ptr<CBC_CommonPerspectiveTransform> temp1( - SquareToQuadrilateral(x0, y0, x1, y1, x2, y2, x3, y3)); - return temp1->BuildAdjoint(); -} -CBC_CommonPerspectiveTransform* CBC_CommonPerspectiveTransform::BuildAdjoint() { - return new CBC_CommonPerspectiveTransform( - m_a22 * m_a33 - m_a23 * m_a32, m_a23 * m_a31 - m_a21 * m_a33, - m_a21 * m_a32 - m_a22 * m_a31, m_a13 * m_a32 - m_a12 * m_a33, - m_a11 * m_a33 - m_a13 * m_a31, m_a12 * m_a31 - m_a11 * m_a32, - m_a12 * m_a23 - m_a13 * m_a22, m_a13 * m_a21 - m_a11 * m_a23, - m_a11 * m_a22 - m_a12 * m_a21); -} -CBC_CommonPerspectiveTransform* CBC_CommonPerspectiveTransform::Times( - CBC_CommonPerspectiveTransform& other) { - return new CBC_CommonPerspectiveTransform( - m_a11 * other.m_a11 + m_a21 * other.m_a12 + m_a31 * other.m_a13, - m_a11 * other.m_a21 + m_a21 * other.m_a22 + m_a31 * other.m_a23, - m_a11 * other.m_a31 + m_a21 * other.m_a32 + m_a31 * other.m_a33, - m_a12 * other.m_a11 + m_a22 * other.m_a12 + m_a32 * other.m_a13, - m_a12 * other.m_a21 + m_a22 * other.m_a22 + m_a32 * other.m_a23, - m_a12 * other.m_a31 + m_a22 * other.m_a32 + m_a32 * other.m_a33, - m_a13 * other.m_a11 + m_a23 * other.m_a12 + m_a33 * other.m_a13, - m_a13 * other.m_a21 + m_a23 * other.m_a22 + m_a33 * other.m_a23, - m_a13 * other.m_a31 + m_a23 * other.m_a32 + m_a33 * other.m_a33); -} diff --git a/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h b/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h deleted file mode 100644 index 8a5fd26f22..0000000000 --- a/xfa/fxbarcode/common/BC_CommonPerspectiveTransform.h +++ /dev/null @@ -1,66 +0,0 @@ -// 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 - -#ifndef XFA_FXBARCODE_COMMON_BC_COMMONPERSPECTIVETRANSFORM_H_ -#define XFA_FXBARCODE_COMMON_BC_COMMONPERSPECTIVETRANSFORM_H_ - -#include "core/fxcrt/include/fx_basic.h" - -class CBC_CommonPerspectiveTransform { - public: - CBC_CommonPerspectiveTransform(FX_FLOAT a11, - FX_FLOAT a21, - FX_FLOAT a31, - FX_FLOAT a12, - FX_FLOAT a22, - FX_FLOAT a32, - FX_FLOAT a13, - FX_FLOAT a23, - FX_FLOAT a33); - virtual ~CBC_CommonPerspectiveTransform(); - - static CBC_CommonPerspectiveTransform* QuadrilateralToQuadrilateral( - FX_FLOAT x0, - FX_FLOAT y0, - FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - FX_FLOAT x3, - FX_FLOAT y3, - FX_FLOAT x0p, - FX_FLOAT y0p, - FX_FLOAT x1p, - FX_FLOAT y1p, - FX_FLOAT x2p, - FX_FLOAT y2p, - FX_FLOAT x3p, - FX_FLOAT y3p); - static CBC_CommonPerspectiveTransform* SquareToQuadrilateral(FX_FLOAT x0, - FX_FLOAT y0, - FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - FX_FLOAT x3, - FX_FLOAT y3); - static CBC_CommonPerspectiveTransform* QuadrilateralToSquare(FX_FLOAT x0, - FX_FLOAT y0, - FX_FLOAT x1, - FX_FLOAT y1, - FX_FLOAT x2, - FX_FLOAT y2, - FX_FLOAT x3, - FX_FLOAT y3); - CBC_CommonPerspectiveTransform* BuildAdjoint(); - CBC_CommonPerspectiveTransform* Times(CBC_CommonPerspectiveTransform& other); - void TransformPoints(CFX_FloatArray* points); - - private: - FX_FLOAT m_a11, m_a12, m_a13, m_a21, m_a22, m_a23, m_a31, m_a32, m_a33; -}; - -#endif // XFA_FXBARCODE_COMMON_BC_COMMONPERSPECTIVETRANSFORM_H_ diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Codeword.cpp b/xfa/fxbarcode/pdf417/BC_PDF417Codeword.cpp deleted file mode 100644 index 0280ea0953..0000000000 --- a/xfa/fxbarcode/pdf417/BC_PDF417Codeword.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// 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 -// Original code is licensed as follows: -/* - * Copyright 2013 ZXing authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "xfa/fxbarcode/pdf417/BC_PDF417Codeword.h" - -int32_t CBC_Codeword::BARCODE_ROW_UNKNOWN = -1; -CBC_Codeword::CBC_Codeword(int32_t startX, - int32_t endX, - int32_t bucket, - int32_t cvalue) { - m_startX = startX; - m_endX = endX; - m_bucket = bucket; - m_value = cvalue; - m_rowNumber = BARCODE_ROW_UNKNOWN; -} -CBC_Codeword::~CBC_Codeword() {} -FX_BOOL CBC_Codeword::hasValidRowNumber() { - return isValidRowNumber(m_rowNumber); -} -FX_BOOL CBC_Codeword::isValidRowNumber(int32_t rowNumber) { - return m_rowNumber != BARCODE_ROW_UNKNOWN && - m_bucket == (m_rowNumber % 3) * 3; -} -void CBC_Codeword::setRowNumberAsRowIndicatorColumn() { - m_rowNumber = (m_value / 30) * 3 + m_bucket / 3; -} -int32_t CBC_Codeword::getWidth() { - return m_endX - m_startX; -} -int32_t CBC_Codeword::getStartX() { - return m_startX; -} -int32_t CBC_Codeword::getEndX() { - return m_endX; -} -int32_t CBC_Codeword::getBucket() { - return m_bucket; -} -int32_t CBC_Codeword::getValue() { - return m_value; -} -int32_t CBC_Codeword::getRowNumber() { - return m_rowNumber; -} -void CBC_Codeword::setRowNumber(int32_t rowNumber) { - m_rowNumber = rowNumber; -} -CFX_ByteString CBC_Codeword::toString() { - return m_rowNumber + (FX_CHAR)'|' + m_value; -} diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Codeword.h b/xfa/fxbarcode/pdf417/BC_PDF417Codeword.h deleted file mode 100644 index 2423cab757..0000000000 --- a/xfa/fxbarcode/pdf417/BC_PDF417Codeword.h +++ /dev/null @@ -1,38 +0,0 @@ -// 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 - -#ifndef XFA_FXBARCODE_PDF417_BC_PDF417CODEWORD_H_ -#define XFA_FXBARCODE_PDF417_BC_PDF417CODEWORD_H_ - -#include "core/fxcrt/include/fx_basic.h" - -class CBC_Codeword { - public: - CBC_Codeword(int32_t startX, int32_t endX, int32_t bucket, int32_t value); - virtual ~CBC_Codeword(); - - FX_BOOL hasValidRowNumber(); - FX_BOOL isValidRowNumber(int32_t rowNumber); - void setRowNumberAsRowIndicatorColumn(); - int32_t getWidth(); - int32_t getStartX(); - int32_t getEndX(); - int32_t getBucket(); - int32_t getValue(); - int32_t getRowNumber(); - void setRowNumber(int32_t rowNumber); - CFX_ByteString toString(); - - private: - static int32_t BARCODE_ROW_UNKNOWN; - int32_t m_startX; - int32_t m_endX; - int32_t m_bucket; - int32_t m_value; - int32_t m_rowNumber; -}; - -#endif // XFA_FXBARCODE_PDF417_BC_PDF417CODEWORD_H_ |