OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "fpdfsdk/pdfwindow/PWL_Label.h" | 7 #include "fpdfsdk/pdfwindow/PWL_Label.h" |
8 #include "fpdfsdk/pdfwindow/PWL_Utils.h" | 8 #include "fpdfsdk/pdfwindow/PWL_Utils.h" |
9 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" | 9 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" |
10 | 10 |
(...skipping 100 matching lines...) Loading... |
111 m_pEdit->SetCharSpace(fCharSpace); | 111 m_pEdit->SetCharSpace(fCharSpace); |
112 } | 112 } |
113 | 113 |
114 CFX_FloatRect CPWL_Label::GetContentRect() const { | 114 CFX_FloatRect CPWL_Label::GetContentRect() const { |
115 return m_pEdit->GetContentRect(); | 115 return m_pEdit->GetContentRect(); |
116 } | 116 } |
117 | 117 |
118 void CPWL_Label::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { | 118 void CPWL_Label::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { |
119 CPWL_Wnd::GetThisAppearanceStream(sAppStream); | 119 CPWL_Wnd::GetThisAppearanceStream(sAppStream); |
120 | 120 |
121 sAppStream << GetTextAppearanceStream(CFX_FloatPoint(0.0f, 0.0f)); | 121 sAppStream << GetTextAppearanceStream(CFX_FloatPoint(0.0f, 0.0f)) |
| 122 .AsByteStringC(); |
122 } | 123 } |
123 | 124 |
124 CFX_ByteString CPWL_Label::GetTextAppearanceStream( | 125 CFX_ByteString CPWL_Label::GetTextAppearanceStream( |
125 const CFX_FloatPoint& ptOffset) const { | 126 const CFX_FloatPoint& ptOffset) const { |
126 CFX_ByteTextBuf sRet; | 127 CFX_ByteTextBuf sRet; |
127 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset); | 128 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset); |
128 | 129 |
129 if (sEdit.GetLength() > 0) { | 130 if (sEdit.GetLength() > 0) { |
130 sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) << sEdit | 131 sRet << "BT\n" |
131 << "ET\n"; | 132 << CPWL_Utils::GetColorAppStream(GetTextColor()).AsByteStringC() |
| 133 << sEdit.AsByteStringC() << "ET\n"; |
132 } | 134 } |
133 | 135 |
134 return sRet.GetByteString(); | 136 return sRet.GetByteString(); |
135 } | 137 } |
136 | 138 |
137 CFX_WideString CPWL_Label::GetText() const { | 139 CFX_WideString CPWL_Label::GetText() const { |
138 return m_pEdit->GetText(); | 140 return m_pEdit->GetText(); |
139 } | 141 } |
140 | 142 |
141 void CPWL_Label::SetLimitChar(int32_t nLimitChar) { | 143 void CPWL_Label::SetLimitChar(int32_t nLimitChar) { |
142 m_pEdit->SetLimitChar(nLimitChar); | 144 m_pEdit->SetLimitChar(nLimitChar); |
143 } | 145 } |
144 | 146 |
145 int32_t CPWL_Label::GetTotalWords() { | 147 int32_t CPWL_Label::GetTotalWords() { |
146 if (m_pEdit) | 148 if (m_pEdit) |
147 return m_pEdit->GetTotalWords(); | 149 return m_pEdit->GetTotalWords(); |
148 | 150 |
149 return 0; | 151 return 0; |
150 } | 152 } |
OLD | NEW |