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/fxedit/include/fx_edit.h" | 7 #include "fpdfsdk/fxedit/include/fx_edit.h" |
8 #include "fpdfsdk/pdfwindow/PWL_Label.h" | 8 #include "fpdfsdk/pdfwindow/PWL_Label.h" |
9 #include "fpdfsdk/pdfwindow/PWL_Utils.h" | 9 #include "fpdfsdk/pdfwindow/PWL_Utils.h" |
10 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" | 10 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 m_pEdit->SetCharSpace(fCharSpace); | 112 m_pEdit->SetCharSpace(fCharSpace); |
113 } | 113 } |
114 | 114 |
115 CFX_FloatRect CPWL_Label::GetContentRect() const { | 115 CFX_FloatRect CPWL_Label::GetContentRect() const { |
116 return m_pEdit->GetContentRect(); | 116 return m_pEdit->GetContentRect(); |
117 } | 117 } |
118 | 118 |
119 void CPWL_Label::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { | 119 void CPWL_Label::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { |
120 CPWL_Wnd::GetThisAppearanceStream(sAppStream); | 120 CPWL_Wnd::GetThisAppearanceStream(sAppStream); |
121 | 121 |
122 sAppStream << GetTextAppearanceStream(CFX_FloatPoint(0.0f, 0.0f)) | 122 sAppStream << GetTextAppearanceStream(CFX_FloatPoint(0.0f, 0.0f)).AsStringC(); |
123 .AsByteStringC(); | |
124 } | 123 } |
125 | 124 |
126 CFX_ByteString CPWL_Label::GetTextAppearanceStream( | 125 CFX_ByteString CPWL_Label::GetTextAppearanceStream( |
127 const CFX_FloatPoint& ptOffset) const { | 126 const CFX_FloatPoint& ptOffset) const { |
128 CFX_ByteTextBuf sRet; | 127 CFX_ByteTextBuf sRet; |
129 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset); | 128 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset); |
130 | 129 |
131 if (sEdit.GetLength() > 0) { | 130 if (sEdit.GetLength() > 0) { |
132 sRet << "BT\n" | 131 sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() |
133 << CPWL_Utils::GetColorAppStream(GetTextColor()).AsByteStringC() | 132 << sEdit.AsStringC() << "ET\n"; |
134 << sEdit.AsByteStringC() << "ET\n"; | |
135 } | 133 } |
136 | 134 |
137 return sRet.GetByteString(); | 135 return sRet.GetByteString(); |
138 } | 136 } |
139 | 137 |
140 CFX_WideString CPWL_Label::GetText() const { | 138 CFX_WideString CPWL_Label::GetText() const { |
141 return m_pEdit->GetText(); | 139 return m_pEdit->GetText(); |
142 } | 140 } |
143 | 141 |
144 void CPWL_Label::SetLimitChar(int32_t nLimitChar) { | 142 void CPWL_Label::SetLimitChar(int32_t nLimitChar) { |
145 m_pEdit->SetLimitChar(nLimitChar); | 143 m_pEdit->SetLimitChar(nLimitChar); |
146 } | 144 } |
147 | 145 |
148 int32_t CPWL_Label::GetTotalWords() { | 146 int32_t CPWL_Label::GetTotalWords() { |
149 if (m_pEdit) | 147 if (m_pEdit) |
150 return m_pEdit->GetTotalWords(); | 148 return m_pEdit->GetTotalWords(); |
151 | 149 |
152 return 0; | 150 return 0; |
153 } | 151 } |
OLD | NEW |