PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() { ASSERT(m_pApp); PWL_CREATEPARAM cp; cp.pParentWnd = nullptr; cp.pProvider = this; cp.rcRectWnd = GetPDFWindowRect(); uint32_t dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE; uint32_t dwFieldFlag = m_pWidget->GetFieldFlags(); if (dwFieldFlag & FIELDFLAG_READONLY) { dwCreateFlags |= PWS_READONLY; } FX_COLORREF color; if (m_pWidget->GetFillColor(color)) { cp.sBackgroundColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color)); } if (m_pWidget->GetBorderColor(color)) { cp.sBorderColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color)); } cp.sTextColor = CPWL_Color(COLORTYPE_GRAY, 0); if (m_pWidget->GetTextColor(color)) { cp.sTextColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color)); } cp.fFontSize = m_pWidget->GetFontSize(); cp.dwBorderWidth = m_pWidget->GetBorderWidth(); cp.nBorderStyle = m_pWidget->GetBorderStyle(); switch (cp.nBorderStyle) { case BorderStyle::DASH: cp.sDash = CPWL_Dash(3, 3, 0); break; case BorderStyle::BEVELED: cp.dwBorderWidth *= 2; break; case BorderStyle::INSET: cp.dwBorderWidth *= 2; break; default: break; } if (cp.fFontSize <= 0) dwCreateFlags |= PWS_AUTOFONTSIZE; cp.dwFlags = dwCreateFlags; cp.pSystemHandler = m_pApp->GetSysHandler(); return cp; }
CPWL_Color CPWL_Wnd::GetBorderRightBottomColor(BorderStyle nBorderStyle) const { switch (nBorderStyle) { case BorderStyle::BEVELED: return CPWL_Utils::DevideColor(GetBackgroundColor(), 2); case BorderStyle::INSET: return CPWL_Color(COLORTYPE_GRAY, 0.75f); default: return CPWL_Color(); } }
CPWL_Color CPWL_Wnd::GetBorderLeftTopColor(BorderStyle nBorderStyle) const { switch (nBorderStyle) { case BorderStyle::BEVELED: return CPWL_Color(COLORTYPE_GRAY, 1); case BorderStyle::INSET: return CPWL_Color(COLORTYPE_GRAY, 0.5f); default: return CPWL_Color(); } }
void color::ConvertArrayToPWLColor(CJS_Array& array, CPWL_Color& color) { int nArrayLen = array.GetLength(); if (nArrayLen < 1) return; CJS_Value value(array.GetIsolate()); array.GetElement(0, value); CFX_ByteString sSpace = value.ToCFXByteString(); double d1 = 0; double d2 = 0; double d3 = 0; double d4 = 0; if (nArrayLen > 1) { array.GetElement(1, value); d1 = value.ToDouble(); } if (nArrayLen > 2) { array.GetElement(2, value); d2 = value.ToDouble(); } if (nArrayLen > 3) { array.GetElement(3, value); d3 = value.ToDouble(); } if (nArrayLen > 4) { array.GetElement(4, value); d4 = value.ToDouble(); } if (sSpace == "T") { color = CPWL_Color(COLORTYPE_TRANSPARENT); } else if (sSpace == "G") { color = CPWL_Color(COLORTYPE_GRAY, (FX_FLOAT)d1); } else if (sSpace == "RGB") { color = CPWL_Color(COLORTYPE_RGB, (FX_FLOAT)d1, (FX_FLOAT)d2, (FX_FLOAT)d3); } else if (sSpace == "CMYK") { color = CPWL_Color(COLORTYPE_CMYK, (FX_FLOAT)d1, (FX_FLOAT)d2, (FX_FLOAT)d3, (FX_FLOAT)d4); } }
void CPWL_NoteItem::CreateChildWnd(const PWL_CREATEPARAM & cp) { CPWL_Color sTextColor; if (CPWL_Utils::IsBlackOrWhite(this->GetBackgroundColor())) sTextColor = PWL_DEFAULT_WHITECOLOR; else sTextColor = PWL_DEFAULT_BLACKCOLOR; m_pSubject = new CPWL_Label; PWL_CREATEPARAM scp = cp; scp.pParentWnd = this; scp.dwFlags = PWS_VISIBLE | PWS_CHILD | PES_LEFT | PES_TOP; scp.sTextColor = sTextColor; m_pSubject->Create(scp); m_pDateTime = new CPWL_Label; PWL_CREATEPARAM dcp = cp; dcp.pParentWnd = this; dcp.dwFlags = PWS_VISIBLE | PWS_CHILD | PES_RIGHT | PES_TOP; dcp.sTextColor = sTextColor; m_pDateTime->Create(dcp); m_pContents = new CPWL_Note_Contents; PWL_CREATEPARAM ccp = cp; ccp.pParentWnd = this; //ccp.sBackgroundColor = PWL_DEFAULT_WHITECOLOR; ccp.sBackgroundColor = CPWL_Color(COLORTYPE_RGB, 240/255.0f, 240/255.0f, 240/255.0f); ccp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BACKGROUND; m_pContents->Create(ccp); m_pContents->SetItemSpace(POPUP_ITEM_SPACE); m_pContents->SetTopSpace(POPUP_ITEM_SPACE); m_pContents->SetBottomSpace(POPUP_ITEM_SPACE); }
void CPWL_Note::CreateChildWnd(const PWL_CREATEPARAM & cp) { CPWL_NoteItem::CreateChildWnd(cp); CPWL_Color sTextColor; if (CPWL_Utils::IsBlackOrWhite(this->GetBackgroundColor())) sTextColor = PWL_DEFAULT_WHITECOLOR; else sTextColor = PWL_DEFAULT_BLACKCOLOR; m_pAuthor = new CPWL_Label; PWL_CREATEPARAM acp = cp; acp.pParentWnd = this; acp.dwFlags = PWS_VISIBLE | PWS_CHILD | PES_LEFT | PES_TOP; acp.sTextColor = sTextColor; m_pAuthor->Create(acp); m_pCloseBox = new CPWL_Note_CloseBox; PWL_CREATEPARAM ccp = cp; ccp.pParentWnd = this; ccp.dwBorderWidth = 2; ccp.nBorderStyle = PBS_BEVELED; ccp.dwFlags = PWS_VISIBLE | PWS_CHILD | PWS_BORDER; ccp.sTextColor = sTextColor; m_pCloseBox->Create(ccp); m_pIcon = new CPWL_Note_Icon; PWL_CREATEPARAM icp = cp; icp.pParentWnd = this; icp.dwFlags = PWS_VISIBLE | PWS_CHILD; m_pIcon->Create(icp); m_pOptions = new CPWL_Note_Options; PWL_CREATEPARAM ocp = cp; ocp.pParentWnd = this; ocp.dwFlags = PWS_CHILD | PWS_VISIBLE; ocp.sTextColor = sTextColor; m_pOptions->Create(ocp); m_pLBBox = new CPWL_Note_LBBox; PWL_CREATEPARAM lcp = cp; lcp.pParentWnd = this; lcp.dwFlags = PWS_VISIBLE | PWS_CHILD; lcp.eCursorType = FXCT_NESW; lcp.sTextColor = sTextColor; m_pLBBox->Create(lcp); m_pRBBox = new CPWL_Note_RBBox; PWL_CREATEPARAM rcp = cp; rcp.pParentWnd = this; rcp.dwFlags = PWS_VISIBLE | PWS_CHILD; rcp.eCursorType = FXCT_NWSE; rcp.sTextColor = sTextColor; m_pRBBox->Create(rcp); m_pContentsBar = new CPWL_ScrollBar(SBT_VSCROLL); PWL_CREATEPARAM scp = cp; scp.pParentWnd = this; scp.sBackgroundColor = CPWL_Color(COLORTYPE_RGB, 240/255.0f, 240/255.0f, 240/255.0f); scp.dwFlags = PWS_CHILD | PWS_VISIBLE | PWS_BACKGROUND; m_pContentsBar->Create(scp); m_pContentsBar->SetNotifyForever(TRUE); }
void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { CPWL_Wnd::GetThisAppearanceStream(sAppStream); CPDF_Rect rcClient = GetClientRect(); CFX_ByteTextBuf sLine; int32_t nCharArray = m_pEdit->GetCharArray(); if (nCharArray > 0) { switch (GetBorderStyle()) { case PBS_SOLID: { sLine << "q\n" << GetBorderWidth() << " w\n" << CPWL_Utils::GetColorAppStream(GetBorderColor(), FALSE) << " 2 J 0 j\n"; for (int32_t i = 1; i < nCharArray; i++) { sLine << rcClient.left + ((rcClient.right - rcClient.left) / nCharArray) * i << " " << rcClient.bottom << " m\n" << rcClient.left + ((rcClient.right - rcClient.left) / nCharArray) * i << " " << rcClient.top << " l S\n"; } sLine << "Q\n"; } break; case PBS_DASH: { sLine << "q\n" << GetBorderWidth() << " w\n" << CPWL_Utils::GetColorAppStream(GetBorderColor(), FALSE) << " 2 J 0 j\n" << "[" << GetBorderDash().nDash << " " << GetBorderDash().nGap << "] " << GetBorderDash().nPhase << " d\n"; for (int32_t i = 1; i < nCharArray; i++) { sLine << rcClient.left + ((rcClient.right - rcClient.left) / nCharArray) * i << " " << rcClient.bottom << " m\n" << rcClient.left + ((rcClient.right - rcClient.left) / nCharArray) * i << " " << rcClient.top << " l S\n"; } sLine << "Q\n"; } break; } } sAppStream << sLine; CFX_ByteTextBuf sText; CPDF_Point ptOffset = CPDF_Point(0.0f, 0.0f); CPVT_WordRange wrWhole = m_pEdit->GetWholeWordRange(); CPVT_WordRange wrSelect = GetSelectWordRange(); CPVT_WordRange wrVisible = (HasFlag(PES_TEXTOVERFLOW) ? wrWhole : m_pEdit->GetVisibleWordRange()); CPVT_WordRange wrSelBefore(wrWhole.BeginPos, wrSelect.BeginPos); CPVT_WordRange wrSelAfter(wrSelect.EndPos, wrWhole.EndPos); CPVT_WordRange wrTemp = CPWL_Utils::OverlapWordRange(GetSelectWordRange(), wrVisible); CFX_ByteString sEditSel = CPWL_Utils::GetEditSelAppStream(m_pEdit, ptOffset, &wrTemp); if (sEditSel.GetLength() > 0) sText << CPWL_Utils::GetColorAppStream(PWL_DEFAULT_SELBACKCOLOR) << sEditSel; wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelBefore); CFX_ByteString sEditBefore = CPWL_Utils::GetEditAppStream( m_pEdit, ptOffset, &wrTemp, !HasFlag(PES_CHARARRAY), m_pEdit->GetPasswordChar()); if (sEditBefore.GetLength() > 0) sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) << sEditBefore << "ET\n"; wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelect); CFX_ByteString sEditMid = CPWL_Utils::GetEditAppStream( m_pEdit, ptOffset, &wrTemp, !HasFlag(PES_CHARARRAY), m_pEdit->GetPasswordChar()); if (sEditMid.GetLength() > 0) sText << "BT\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_GRAY, 1)) << sEditMid << "ET\n"; wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelAfter); CFX_ByteString sEditAfter = CPWL_Utils::GetEditAppStream( m_pEdit, ptOffset, &wrTemp, !HasFlag(PES_CHARARRAY), m_pEdit->GetPasswordChar()); if (sEditAfter.GetLength() > 0) sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) << sEditAfter << "ET\n"; if (HasFlag(PES_SPELLCHECK)) { CFX_ByteString sSpellCheck = CPWL_Utils::GetSpellCheckAppStream( m_pEdit, m_pSpellCheck, ptOffset, &wrVisible); if (sSpellCheck.GetLength() > 0) sText << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_RGB, 1, 0, 0), FALSE) << sSpellCheck; } if (sText.GetLength() > 0) { CPDF_Rect rcClient = GetClientRect(); sAppStream << "q\n/Tx BMC\n"; if (!HasFlag(PES_TEXTOVERFLOW)) sAppStream << rcClient.left << " " << rcClient.bottom << " " << rcClient.right - rcClient.left << " " << rcClient.top - rcClient.bottom << " re W n\n"; sAppStream << sText; sAppStream << "EMC\nQ\n"; } }
CPWL_Color CPWL_Wnd::GetBorderColor() const { if (HasFlag(PWS_BORDER)) return m_sPrivateParam.sBorderColor; return CPWL_Color(); }
color::color(CJS_Object* pJSObject): CJS_EmbedObj(pJSObject) { m_crTransparent = CPWL_Color(COLORTYPE_TRANSPARENT); m_crBlack = CPWL_Color(COLORTYPE_GRAY, 0); m_crWhite = CPWL_Color(COLORTYPE_GRAY, 1); m_crRed = CPWL_Color(COLORTYPE_RGB, 1, 0 ,0); m_crGreen = CPWL_Color(COLORTYPE_RGB, 0, 1 ,0); m_crBlue = CPWL_Color(COLORTYPE_RGB, 0, 0 ,1); m_crCyan = CPWL_Color(COLORTYPE_CMYK, 1, 0 ,0, 0); m_crMagenta = CPWL_Color(COLORTYPE_CMYK, 0, 1 ,0, 0); m_crYellow = CPWL_Color(COLORTYPE_CMYK, 0, 0 ,1, 0); m_crDKGray = CPWL_Color(COLORTYPE_GRAY, 0.25); m_crGray = CPWL_Color(COLORTYPE_GRAY, 0.5); m_crLTGray = CPWL_Color(COLORTYPE_GRAY, 0.75); }