summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-05-12 10:41:56 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-12 10:41:56 -0700
commit732f6a01f11749192badba3d5151a33460560b7f (patch)
tree97898803a9f794d62caa608b456ab5f4a3e24ac0 /fpdfsdk/pdfwindow
parentaadedf904d6e072e885f6ccd142c5f874833d5c5 (diff)
downloadpdfium-732f6a01f11749192badba3d5151a33460560b7f.tar.xz
IFX_Edit::NewEdit never returns nullptr.
Review-Url: https://codereview.chromium.org/1969353002
Diffstat (limited to 'fpdfsdk/pdfwindow')
-rw-r--r--fpdfsdk/pdfwindow/PWL_EditCtrl.cpp61
-rw-r--r--fpdfsdk/pdfwindow/PWL_Label.cpp10
-rw-r--r--fpdfsdk/pdfwindow/PWL_Utils.cpp384
3 files changed, 214 insertions, 241 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
index 07ac4af781..8a0dea1980 100644
--- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
+++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
@@ -21,15 +21,12 @@
#define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb))
CPWL_EditCtrl::CPWL_EditCtrl()
- : m_pEdit(NULL),
+ : m_pEdit(IFX_Edit::NewEdit()),
m_pEditCaret(NULL),
m_bMouseDown(FALSE),
m_pEditNotify(NULL),
m_nCharSet(DEFAULT_CHARSET),
- m_nCodePage(0) {
- m_pEdit = IFX_Edit::NewEdit();
- ASSERT(m_pEdit);
-}
+ m_nCodePage(0) {}
CPWL_EditCtrl::~CPWL_EditCtrl() {
IFX_Edit::DelEdit(m_pEdit);
@@ -121,19 +118,20 @@ void CPWL_EditCtrl::CreateChildWnd(const PWL_CREATEPARAM& cp) {
}
void CPWL_EditCtrl::CreateEditCaret(const PWL_CREATEPARAM& cp) {
- if (!m_pEditCaret) {
- m_pEditCaret = new CPWL_Caret;
- m_pEditCaret->SetInvalidRect(GetClientRect());
-
- PWL_CREATEPARAM ecp = cp;
- ecp.pParentWnd = this;
- ecp.dwFlags = PWS_CHILD | PWS_NOREFRESHCLIP;
- ecp.dwBorderWidth = 0;
- ecp.nBorderStyle = PBS_SOLID;
- ecp.rcRectWnd = CFX_FloatRect(0, 0, 0, 0);
-
- m_pEditCaret->Create(ecp);
- }
+ if (m_pEditCaret)
+ return;
+
+ m_pEditCaret = new CPWL_Caret;
+ m_pEditCaret->SetInvalidRect(GetClientRect());
+
+ PWL_CREATEPARAM ecp = cp;
+ ecp.pParentWnd = this;
+ ecp.dwFlags = PWS_CHILD | PWS_NOREFRESHCLIP;
+ ecp.dwBorderWidth = 0;
+ ecp.nBorderStyle = PBS_SOLID;
+ ecp.rcRectWnd = CFX_FloatRect(0, 0, 0, 0);
+
+ m_pEditCaret->Create(ecp);
}
void CPWL_EditCtrl::SetFontSize(FX_FLOAT fFontSize) {
@@ -409,44 +407,31 @@ void CPWL_EditCtrl::SelectAll() {
}
void CPWL_EditCtrl::Paint() {
- if (m_pEdit)
- m_pEdit->Paint();
+ m_pEdit->Paint();
}
void CPWL_EditCtrl::EnableRefresh(FX_BOOL bRefresh) {
- if (m_pEdit)
- m_pEdit->EnableRefresh(bRefresh);
+ m_pEdit->EnableRefresh(bRefresh);
}
int32_t CPWL_EditCtrl::GetCaret() const {
- if (m_pEdit)
- return m_pEdit->GetCaret();
-
- return -1;
+ return m_pEdit->GetCaret();
}
void CPWL_EditCtrl::SetCaret(int32_t nPos) {
- if (m_pEdit)
- m_pEdit->SetCaret(nPos);
+ m_pEdit->SetCaret(nPos);
}
int32_t CPWL_EditCtrl::GetTotalWords() const {
- if (m_pEdit)
- return m_pEdit->GetTotalWords();
-
- return 0;
+ return m_pEdit->GetTotalWords();
}
void CPWL_EditCtrl::SetScrollPos(const CFX_FloatPoint& point) {
- if (m_pEdit)
- m_pEdit->SetScrollPos(point);
+ m_pEdit->SetScrollPos(point);
}
CFX_FloatPoint CPWL_EditCtrl::GetScrollPos() const {
- if (m_pEdit)
- return m_pEdit->GetScrollPos();
-
- return CFX_FloatPoint(0.0f, 0.0f);
+ return m_pEdit->GetScrollPos();
}
CPDF_Font* CPWL_EditCtrl::GetCaretFont() const {
diff --git a/fpdfsdk/pdfwindow/PWL_Label.cpp b/fpdfsdk/pdfwindow/PWL_Label.cpp
index 9cb9791444..7abeb0d558 100644
--- a/fpdfsdk/pdfwindow/PWL_Label.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Label.cpp
@@ -9,10 +9,7 @@
#include "fpdfsdk/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
-CPWL_Label::CPWL_Label() : m_pEdit(NULL) {
- m_pEdit = IFX_Edit::NewEdit();
- ASSERT(m_pEdit);
-}
+CPWL_Label::CPWL_Label() : m_pEdit(IFX_Edit::NewEdit()) {}
CPWL_Label::~CPWL_Label() {
IFX_Edit::DelEdit(m_pEdit);
@@ -144,8 +141,5 @@ void CPWL_Label::SetLimitChar(int32_t nLimitChar) {
}
int32_t CPWL_Label::GetTotalWords() {
- if (m_pEdit)
- return m_pEdit->GetTotalWords();
-
- return 0;
+ return m_pEdit->GetTotalWords();
}
diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp
index 2c52309b3f..2e60471927 100644
--- a/fpdfsdk/pdfwindow/PWL_Utils.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp
@@ -441,29 +441,26 @@ CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox,
const CPWL_Color& crText) {
CFX_ByteTextBuf sRet;
- if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) {
- pEdit->SetFontMap(pFontMap);
- pEdit->SetPlateRect(rcBBox);
- pEdit->SetAlignmentH(nAlignmentH);
- pEdit->SetAlignmentV(nAlignmentV);
- pEdit->SetMultiLine(bMultiLine);
- pEdit->SetAutoReturn(bAutoReturn);
- if (IsFloatZero(fFontSize))
- pEdit->SetAutoFontSize(TRUE);
- else
- pEdit->SetFontSize(fFontSize);
-
- pEdit->Initialize();
- pEdit->SetText(sText.c_str());
+ IFX_Edit* pEdit = IFX_Edit::NewEdit();
+ pEdit->SetFontMap(pFontMap);
+ pEdit->SetPlateRect(rcBBox);
+ pEdit->SetAlignmentH(nAlignmentH);
+ pEdit->SetAlignmentV(nAlignmentV);
+ pEdit->SetMultiLine(bMultiLine);
+ pEdit->SetAutoReturn(bAutoReturn);
+ if (IsFloatZero(fFontSize))
+ pEdit->SetAutoFontSize(TRUE);
+ else
+ pEdit->SetFontSize(fFontSize);
- CFX_ByteString sEdit =
- CPWL_Utils::GetEditAppStream(pEdit, CFX_FloatPoint(0.0f, 0.0f));
- if (sEdit.GetLength() > 0) {
- sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit
- << "ET\n";
- }
- IFX_Edit::DelEdit(pEdit);
- }
+ pEdit->Initialize();
+ pEdit->SetText(sText.c_str());
+
+ CFX_ByteString sEdit =
+ CPWL_Utils::GetEditAppStream(pEdit, CFX_FloatPoint(0.0f, 0.0f));
+ if (sEdit.GetLength() > 0)
+ sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n";
+ IFX_Edit::DelEdit(pEdit);
return sRet.AsStringC();
}
@@ -478,222 +475,219 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
int32_t nLayOut) {
const FX_FLOAT fAutoFontScale = 1.0f / 3.0f;
- if (IFX_Edit* pEdit = IFX_Edit::NewEdit()) {
- pEdit->SetFontMap(pFontMap);
- pEdit->SetAlignmentH(1);
- pEdit->SetAlignmentV(1);
- pEdit->SetMultiLine(FALSE);
- pEdit->SetAutoReturn(FALSE);
- if (IsFloatZero(fFontSize))
- pEdit->SetAutoFontSize(TRUE);
- else
- pEdit->SetFontSize(fFontSize);
-
- pEdit->Initialize();
- pEdit->SetText(sLabel.c_str());
-
- CFX_FloatRect rcLabelContent = pEdit->GetContentRect();
- CPWL_Icon Icon;
- PWL_CREATEPARAM cp;
- cp.dwFlags = PWS_VISIBLE;
- Icon.Create(cp);
- Icon.SetIconFit(&IconFit);
- Icon.SetPDFStream(pIconStream);
-
- CFX_FloatRect rcLabel = CFX_FloatRect(0, 0, 0, 0);
- CFX_FloatRect rcIcon = CFX_FloatRect(0, 0, 0, 0);
- FX_FLOAT fWidth = 0.0f;
- FX_FLOAT fHeight = 0.0f;
-
- switch (nLayOut) {
- case PPBL_LABEL:
- rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
- break;
- case PPBL_ICON:
- rcIcon = rcBBox;
- rcLabel = CFX_FloatRect(0, 0, 0, 0);
- break;
- case PPBL_ICONTOPLABELBOTTOM:
+ IFX_Edit* pEdit = IFX_Edit::NewEdit();
+ pEdit->SetFontMap(pFontMap);
+ pEdit->SetAlignmentH(1);
+ pEdit->SetAlignmentV(1);
+ pEdit->SetMultiLine(FALSE);
+ pEdit->SetAutoReturn(FALSE);
+ if (IsFloatZero(fFontSize))
+ pEdit->SetAutoFontSize(TRUE);
+ else
+ pEdit->SetFontSize(fFontSize);
+
+ pEdit->Initialize();
+ pEdit->SetText(sLabel.c_str());
+
+ CFX_FloatRect rcLabelContent = pEdit->GetContentRect();
+ CPWL_Icon Icon;
+ PWL_CREATEPARAM cp;
+ cp.dwFlags = PWS_VISIBLE;
+ Icon.Create(cp);
+ Icon.SetIconFit(&IconFit);
+ Icon.SetPDFStream(pIconStream);
+
+ CFX_FloatRect rcLabel = CFX_FloatRect(0, 0, 0, 0);
+ CFX_FloatRect rcIcon = CFX_FloatRect(0, 0, 0, 0);
+ FX_FLOAT fWidth = 0.0f;
+ FX_FLOAT fHeight = 0.0f;
+
+ switch (nLayOut) {
+ case PPBL_LABEL:
+ rcLabel = rcBBox;
+ rcIcon = CFX_FloatRect(0, 0, 0, 0);
+ break;
+ case PPBL_ICON:
+ rcIcon = rcBBox;
+ rcLabel = CFX_FloatRect(0, 0, 0, 0);
+ break;
+ case PPBL_ICONTOPLABELBOTTOM:
+
+ if (pIconStream) {
+ if (IsFloatZero(fFontSize)) {
+ fHeight = rcBBox.top - rcBBox.bottom;
+ rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcBBox.right,
+ rcBBox.bottom + fHeight * fAutoFontScale);
+ rcIcon =
+ CFX_FloatRect(rcBBox.left, rcLabel.top, rcBBox.right, rcBBox.top);
+ } else {
+ fHeight = rcLabelContent.Height();
- if (pIconStream) {
- if (IsFloatZero(fFontSize)) {
- fHeight = rcBBox.top - rcBBox.bottom;
+ if (rcBBox.bottom + fHeight > rcBBox.top) {
+ rcIcon = CFX_FloatRect(0, 0, 0, 0);
+ rcLabel = rcBBox;
+ } else {
rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcBBox.right,
- rcBBox.bottom + fHeight * fAutoFontScale);
+ rcBBox.bottom + fHeight);
rcIcon = CFX_FloatRect(rcBBox.left, rcLabel.top, rcBBox.right,
rcBBox.top);
- } else {
- fHeight = rcLabelContent.Height();
-
- if (rcBBox.bottom + fHeight > rcBBox.top) {
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
- rcLabel = rcBBox;
- } else {
- rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcBBox.right,
- rcBBox.bottom + fHeight);
- rcIcon = CFX_FloatRect(rcBBox.left, rcLabel.top, rcBBox.right,
- rcBBox.top);
- }
}
- } else {
- rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
}
+ } else {
+ rcLabel = rcBBox;
+ rcIcon = CFX_FloatRect(0, 0, 0, 0);
+ }
- break;
- case PPBL_LABELTOPICONBOTTOM:
+ break;
+ case PPBL_LABELTOPICONBOTTOM:
+
+ if (pIconStream) {
+ if (IsFloatZero(fFontSize)) {
+ fHeight = rcBBox.top - rcBBox.bottom;
+ rcLabel =
+ CFX_FloatRect(rcBBox.left, rcBBox.top - fHeight * fAutoFontScale,
+ rcBBox.right, rcBBox.top);
+ rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcBBox.right,
+ rcLabel.bottom);
+ } else {
+ fHeight = rcLabelContent.Height();
- if (pIconStream) {
- if (IsFloatZero(fFontSize)) {
- fHeight = rcBBox.top - rcBBox.bottom;
- rcLabel = CFX_FloatRect(rcBBox.left,
- rcBBox.top - fHeight * fAutoFontScale,
+ if (rcBBox.bottom + fHeight > rcBBox.top) {
+ rcIcon = CFX_FloatRect(0, 0, 0, 0);
+ rcLabel = rcBBox;
+ } else {
+ rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.top - fHeight,
rcBBox.right, rcBBox.top);
rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcBBox.right,
rcLabel.bottom);
- } else {
- fHeight = rcLabelContent.Height();
-
- if (rcBBox.bottom + fHeight > rcBBox.top) {
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
- rcLabel = rcBBox;
- } else {
- rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.top - fHeight,
- rcBBox.right, rcBBox.top);
- rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcBBox.right,
- rcLabel.bottom);
- }
}
- } else {
- rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
}
+ } else {
+ rcLabel = rcBBox;
+ rcIcon = CFX_FloatRect(0, 0, 0, 0);
+ }
- break;
- case PPBL_ICONLEFTLABELRIGHT:
-
- if (pIconStream) {
- if (IsFloatZero(fFontSize)) {
- fWidth = rcBBox.right - rcBBox.left;
- rcLabel = CFX_FloatRect(rcBBox.right - fWidth * fAutoFontScale,
- rcBBox.bottom, rcBBox.right, rcBBox.top);
- rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcLabel.left,
- rcBBox.top);
+ break;
+ case PPBL_ICONLEFTLABELRIGHT:
- if (rcLabelContent.Width() < fWidth * fAutoFontScale) {
- } else {
- if (rcLabelContent.Width() < fWidth) {
- rcLabel =
- CFX_FloatRect(rcBBox.right - rcLabelContent.Width(),
+ if (pIconStream) {
+ if (IsFloatZero(fFontSize)) {
+ fWidth = rcBBox.right - rcBBox.left;
+ rcLabel = CFX_FloatRect(rcBBox.right - fWidth * fAutoFontScale,
rcBBox.bottom, rcBBox.right, rcBBox.top);
- rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcLabel.left,
- rcBBox.top);
- } else {
- rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
- }
- }
- } else {
- fWidth = rcLabelContent.Width();
+ rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcLabel.left,
+ rcBBox.top);
- if (rcBBox.left + fWidth > rcBBox.right) {
- rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
- } else {
- rcLabel = CFX_FloatRect(rcBBox.right - fWidth, rcBBox.bottom,
- rcBBox.right, rcBBox.top);
+ if (rcLabelContent.Width() < fWidth * fAutoFontScale) {
+ } else {
+ if (rcLabelContent.Width() < fWidth) {
+ rcLabel = CFX_FloatRect(rcBBox.right - rcLabelContent.Width(),
+ rcBBox.bottom, rcBBox.right, rcBBox.top);
rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcLabel.left,
rcBBox.top);
+ } else {
+ rcLabel = rcBBox;
+ rcIcon = CFX_FloatRect(0, 0, 0, 0);
}
}
} else {
- rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
- }
+ fWidth = rcLabelContent.Width();
- break;
- case PPBL_LABELLEFTICONRIGHT:
-
- if (pIconStream) {
- if (IsFloatZero(fFontSize)) {
- fWidth = rcBBox.right - rcBBox.left;
- rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom,
- rcBBox.left + fWidth * fAutoFontScale,
- rcBBox.top);
- rcIcon = CFX_FloatRect(rcLabel.right, rcBBox.bottom, rcBBox.right,
+ if (rcBBox.left + fWidth > rcBBox.right) {
+ rcLabel = rcBBox;
+ rcIcon = CFX_FloatRect(0, 0, 0, 0);
+ } else {
+ rcLabel = CFX_FloatRect(rcBBox.right - fWidth, rcBBox.bottom,
+ rcBBox.right, rcBBox.top);
+ rcIcon = CFX_FloatRect(rcBBox.left, rcBBox.bottom, rcLabel.left,
rcBBox.top);
+ }
+ }
+ } else {
+ rcLabel = rcBBox;
+ rcIcon = CFX_FloatRect(0, 0, 0, 0);
+ }
- if (rcLabelContent.Width() < fWidth * fAutoFontScale) {
- } else {
- if (rcLabelContent.Width() < fWidth) {
- rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom,
- rcBBox.left + rcLabelContent.Width(),
- rcBBox.top);
- rcIcon = CFX_FloatRect(rcLabel.right, rcBBox.bottom,
- rcBBox.right, rcBBox.top);
- } else {
- rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
- }
- }
+ break;
+ case PPBL_LABELLEFTICONRIGHT:
+
+ if (pIconStream) {
+ if (IsFloatZero(fFontSize)) {
+ fWidth = rcBBox.right - rcBBox.left;
+ rcLabel =
+ CFX_FloatRect(rcBBox.left, rcBBox.bottom,
+ rcBBox.left + fWidth * fAutoFontScale, rcBBox.top);
+ rcIcon = CFX_FloatRect(rcLabel.right, rcBBox.bottom, rcBBox.right,
+ rcBBox.top);
+
+ if (rcLabelContent.Width() < fWidth * fAutoFontScale) {
} else {
- fWidth = rcLabelContent.Width();
-
- if (rcBBox.left + fWidth > rcBBox.right) {
- rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
- } else {
+ if (rcLabelContent.Width() < fWidth) {
rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom,
- rcBBox.left + fWidth, rcBBox.top);
+ rcBBox.left + rcLabelContent.Width(),
+ rcBBox.top);
rcIcon = CFX_FloatRect(rcLabel.right, rcBBox.bottom, rcBBox.right,
rcBBox.top);
+ } else {
+ rcLabel = rcBBox;
+ rcIcon = CFX_FloatRect(0, 0, 0, 0);
}
}
} else {
- rcLabel = rcBBox;
- rcIcon = CFX_FloatRect(0, 0, 0, 0);
- }
+ fWidth = rcLabelContent.Width();
- break;
- case PPBL_LABELOVERICON:
+ if (rcBBox.left + fWidth > rcBBox.right) {
+ rcLabel = rcBBox;
+ rcIcon = CFX_FloatRect(0, 0, 0, 0);
+ } else {
+ rcLabel = CFX_FloatRect(rcBBox.left, rcBBox.bottom,
+ rcBBox.left + fWidth, rcBBox.top);
+ rcIcon = CFX_FloatRect(rcLabel.right, rcBBox.bottom, rcBBox.right,
+ rcBBox.top);
+ }
+ }
+ } else {
rcLabel = rcBBox;
- rcIcon = rcBBox;
- break;
- }
-
- CFX_ByteTextBuf sAppStream, sTemp;
+ rcIcon = CFX_FloatRect(0, 0, 0, 0);
+ }
- if (!rcIcon.IsEmpty()) {
- Icon.Move(rcIcon, FALSE, FALSE);
- sTemp << Icon.GetImageAppStream();
- }
+ break;
+ case PPBL_LABELOVERICON:
+ rcLabel = rcBBox;
+ rcIcon = rcBBox;
+ break;
+ }
- Icon.Destroy();
+ CFX_ByteTextBuf sAppStream, sTemp;
- if (!rcLabel.IsEmpty()) {
- pEdit->SetPlateRect(rcLabel);
- CFX_ByteString sEdit =
- CPWL_Utils::GetEditAppStream(pEdit, CFX_FloatPoint(0.0f, 0.0f));
- if (sEdit.GetLength() > 0) {
- sTemp << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit
- << "ET\n";
- }
- }
+ if (!rcIcon.IsEmpty()) {
+ Icon.Move(rcIcon, FALSE, FALSE);
+ sTemp << Icon.GetImageAppStream();
+ }
- IFX_Edit::DelEdit(pEdit);
+ Icon.Destroy();
- if (sTemp.GetSize() > 0) {
- sAppStream << "q\n" << rcBBox.left << " " << rcBBox.bottom << " "
- << rcBBox.right - rcBBox.left << " "
- << rcBBox.top - rcBBox.bottom << " re W n\n";
- sAppStream << sTemp << "Q\n";
+ if (!rcLabel.IsEmpty()) {
+ pEdit->SetPlateRect(rcLabel);
+ CFX_ByteString sEdit =
+ CPWL_Utils::GetEditAppStream(pEdit, CFX_FloatPoint(0.0f, 0.0f));
+ if (sEdit.GetLength() > 0) {
+ sTemp << "BT\n"
+ << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n";
}
+ }
- return sAppStream.AsStringC();
+ IFX_Edit::DelEdit(pEdit);
+
+ if (sTemp.GetSize() > 0) {
+ sAppStream << "q\n"
+ << rcBBox.left << " " << rcBBox.bottom << " "
+ << rcBBox.right - rcBBox.left << " "
+ << rcBBox.top - rcBBox.bottom << " re W n\n";
+ sAppStream << sTemp << "Q\n";
}
- return "";
+ return sAppStream.AsStringC();
}
CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color& color,