summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow/cpwl_list_box.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/pdfwindow/cpwl_list_box.cpp')
-rw-r--r--fpdfsdk/pdfwindow/cpwl_list_box.cpp40
1 files changed, 19 insertions, 21 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_list_box.cpp b/fpdfsdk/pdfwindow/cpwl_list_box.cpp
index 5c161bfdda..f612c2945b 100644
--- a/fpdfsdk/pdfwindow/cpwl_list_box.cpp
+++ b/fpdfsdk/pdfwindow/cpwl_list_box.cpp
@@ -6,6 +6,8 @@
#include "fpdfsdk/pdfwindow/cpwl_list_box.h"
+#include <sstream>
+
#include "fpdfsdk/fxedit/fxet_edit.h"
#include "fpdfsdk/fxedit/fxet_list.h"
#include "fpdfsdk/pdfwindow/cpwl_edit.h"
@@ -95,10 +97,10 @@ void CPWL_ListBox::OnDestroy() {
m_pListNotify.reset();
}
-void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
- CPWL_Wnd::GetThisAppearanceStream(sAppStream);
+void CPWL_ListBox::GetThisAppearanceStream(std::ostringstream* psAppStream) {
+ CPWL_Wnd::GetThisAppearanceStream(psAppStream);
- CFX_ByteTextBuf sListItems;
+ std::ostringstream sListItems;
CFX_FloatRect rcPlate = m_pList->GetPlateRect();
for (int32_t i = 0, sz = m_pList->GetCount(); i < sz; i++) {
@@ -110,40 +112,36 @@ void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
CFX_PointF ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f);
if (m_pList->IsItemSelected(i)) {
sListItems << CPWL_Utils::GetRectFillAppStream(rcItem,
- PWL_DEFAULT_SELBACKCOLOR)
- .AsStringC();
+ PWL_DEFAULT_SELBACKCOLOR);
CFX_ByteString sItem =
CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);
if (sItem.GetLength() > 0) {
sListItems << "BT\n"
<< CPWL_Utils::GetColorAppStream(PWL_DEFAULT_SELTEXTCOLOR)
- .AsStringC()
- << sItem.AsStringC() << "ET\n";
+ << sItem << "ET\n";
}
} else {
CFX_ByteString sItem =
CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);
if (sItem.GetLength() > 0) {
sListItems << "BT\n"
- << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC()
- << sItem.AsStringC() << "ET\n";
+ << CPWL_Utils::GetColorAppStream(GetTextColor()) << sItem
+ << "ET\n";
}
}
}
- if (sListItems.GetLength() > 0) {
- CFX_ByteTextBuf sClip;
- CFX_FloatRect rcClient = GetClientRect();
-
- sClip << "q\n";
- sClip << rcClient.left << " " << rcClient.bottom << " "
- << rcClient.right - rcClient.left << " "
- << rcClient.top - rcClient.bottom << " re W n\n";
-
- sClip << sListItems << "Q\n";
+ if (sListItems.tellp() <= 0)
+ return;
- sAppStream << "/Tx BMC\n" << sClip << "EMC\n";
- }
+ CFX_FloatRect rcClient = GetClientRect();
+ *psAppStream << "/Tx BMC\n"
+ << "q\n"
+ << rcClient.left << " " << rcClient.bottom << " "
+ << rcClient.right - rcClient.left << " "
+ << rcClient.top - rcClient.bottom << " re W n\n"
+ << sListItems.str() << "Q\n"
+ << "EMC\n";
}
void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,