summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/pdfwindow/PWL_Label.cpp
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2015-08-04 12:19:10 -0700
committerNico Weber <thakis@chromium.org>2015-08-04 12:19:10 -0700
commitb048f791a15f2da781a01eba5b09eb9d389f9c11 (patch)
tree6850a73c18bbc41eaf4b1fdc6b3c96646d45587b /fpdfsdk/src/pdfwindow/PWL_Label.cpp
parentc8eeed31f217d99a706b0cbf5e4ce0bcc12beb64 (diff)
downloadpdfium-b048f791a15f2da781a01eba5b09eb9d389f9c11.tar.xz
clang-format all pdfium code.
No behavior change. Generated by: find . -name '*.cpp' -o -name '*.h' | \ grep -E -v 'third_party|thirdparties|lpng_v163' | \ xargs ../../buildtools/mac/clang-format -i See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion. BUG=none R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1265503005 .
Diffstat (limited to 'fpdfsdk/src/pdfwindow/PWL_Label.cpp')
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Label.cpp231
1 files changed, 99 insertions, 132 deletions
diff --git a/fpdfsdk/src/pdfwindow/PWL_Label.cpp b/fpdfsdk/src/pdfwindow/PWL_Label.cpp
index e1780c69a8..797270ebba 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Label.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Label.cpp
@@ -11,177 +11,144 @@
/* ---------------------------- CPWL_Label ------------------------------ */
-CPWL_Label::CPWL_Label() : m_pEdit(NULL)
-{
- m_pEdit = IFX_Edit::NewEdit();
-
- ASSERT(m_pEdit != NULL);
+CPWL_Label::CPWL_Label() : m_pEdit(NULL) {
+ m_pEdit = IFX_Edit::NewEdit();
+
+ ASSERT(m_pEdit != NULL);
}
-CPWL_Label::~CPWL_Label()
-{
- IFX_Edit::DelEdit(m_pEdit);
+CPWL_Label::~CPWL_Label() {
+ IFX_Edit::DelEdit(m_pEdit);
}
-
-CFX_ByteString CPWL_Label::GetClassName() const
-{
- return "CPWL_Label";
-}
-
-void CPWL_Label::OnCreated()
-{
- SetParamByFlag();
- SetFontSize(GetCreationParam().fFontSize);
-
- m_pEdit->SetFontMap(GetFontMap());
- m_pEdit->Initialize();
-
- if (HasFlag(PES_TEXTOVERFLOW))
- {
- SetClipRect(CPDF_Rect(0.0f,0.0f,0.0f,0.0f));
- m_pEdit->SetTextOverflow(TRUE);
- }
+
+CFX_ByteString CPWL_Label::GetClassName() const {
+ return "CPWL_Label";
}
-void CPWL_Label::SetText(const FX_WCHAR* csText)
-{
- m_pEdit->SetText(csText);
+void CPWL_Label::OnCreated() {
+ SetParamByFlag();
+ SetFontSize(GetCreationParam().fFontSize);
+
+ m_pEdit->SetFontMap(GetFontMap());
+ m_pEdit->Initialize();
+
+ if (HasFlag(PES_TEXTOVERFLOW)) {
+ SetClipRect(CPDF_Rect(0.0f, 0.0f, 0.0f, 0.0f));
+ m_pEdit->SetTextOverflow(TRUE);
+ }
}
-void CPWL_Label::RePosChildWnd()
-{
- m_pEdit->SetPlateRect(GetClientRect());
+void CPWL_Label::SetText(const FX_WCHAR* csText) {
+ m_pEdit->SetText(csText);
}
-void CPWL_Label::SetFontSize(FX_FLOAT fFontSize)
-{
- m_pEdit->SetFontSize(fFontSize);
+void CPWL_Label::RePosChildWnd() {
+ m_pEdit->SetPlateRect(GetClientRect());
}
-FX_FLOAT CPWL_Label::GetFontSize() const
-{
- return m_pEdit->GetFontSize();
+void CPWL_Label::SetFontSize(FX_FLOAT fFontSize) {
+ m_pEdit->SetFontSize(fFontSize);
}
-void CPWL_Label::SetParamByFlag()
-{
- if (HasFlag(PES_LEFT))
- {
- m_pEdit->SetAlignmentH(0);
- }
- else if (HasFlag(PES_MIDDLE))
- {
- m_pEdit->SetAlignmentH(1);
- }
- else if (HasFlag(PES_RIGHT))
- {
- m_pEdit->SetAlignmentH(2);
- }
- else
- {
- m_pEdit->SetAlignmentH(0);
- }
+FX_FLOAT CPWL_Label::GetFontSize() const {
+ return m_pEdit->GetFontSize();
+}
+
+void CPWL_Label::SetParamByFlag() {
+ if (HasFlag(PES_LEFT)) {
+ m_pEdit->SetAlignmentH(0);
+ } else if (HasFlag(PES_MIDDLE)) {
+ m_pEdit->SetAlignmentH(1);
+ } else if (HasFlag(PES_RIGHT)) {
+ m_pEdit->SetAlignmentH(2);
+ } else {
+ m_pEdit->SetAlignmentH(0);
+ }
- if (HasFlag(PES_TOP))
- {
- m_pEdit->SetAlignmentV(0);
- }
- else if (HasFlag(PES_CENTER))
- {
- m_pEdit->SetAlignmentV(1);
- }
- else if (HasFlag(PES_BOTTOM))
- {
- m_pEdit->SetAlignmentV(2);
- }
- else
- {
- m_pEdit->SetAlignmentV(0);
- }
+ if (HasFlag(PES_TOP)) {
+ m_pEdit->SetAlignmentV(0);
+ } else if (HasFlag(PES_CENTER)) {
+ m_pEdit->SetAlignmentV(1);
+ } else if (HasFlag(PES_BOTTOM)) {
+ m_pEdit->SetAlignmentV(2);
+ } else {
+ m_pEdit->SetAlignmentV(0);
+ }
- if (HasFlag(PES_PASSWORD))
- {
- m_pEdit->SetPasswordChar('*');
- }
+ if (HasFlag(PES_PASSWORD)) {
+ m_pEdit->SetPasswordChar('*');
+ }
- m_pEdit->SetMultiLine(HasFlag(PES_MULTILINE));
- m_pEdit->SetAutoReturn(HasFlag(PES_AUTORETURN));
- m_pEdit->SetAutoFontSize(HasFlag(PWS_AUTOFONTSIZE));
- m_pEdit->SetAutoScroll(HasFlag(PES_AUTOSCROLL));
+ m_pEdit->SetMultiLine(HasFlag(PES_MULTILINE));
+ m_pEdit->SetAutoReturn(HasFlag(PES_AUTORETURN));
+ m_pEdit->SetAutoFontSize(HasFlag(PWS_AUTOFONTSIZE));
+ m_pEdit->SetAutoScroll(HasFlag(PES_AUTOSCROLL));
}
-void CPWL_Label::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device)
-{
- CPWL_Wnd::DrawThisAppearance(pDevice,pUser2Device);
+void CPWL_Label::DrawThisAppearance(CFX_RenderDevice* pDevice,
+ CPDF_Matrix* pUser2Device) {
+ CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);
- GetClientRect();
+ GetClientRect();
- CPDF_Rect rcClip;
- CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange();
- CPVT_WordRange* pRange = NULL;
+ CPDF_Rect rcClip;
+ CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange();
+ CPVT_WordRange* pRange = NULL;
- if (!HasFlag(PES_TEXTOVERFLOW))
- {
- rcClip = GetClientRect();
- pRange = &wrRange;
- }
-IFX_SystemHandler* pSysHandler = GetSystemHandler();
- IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pEdit,
- CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
- CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()),
- rcClip, CPDF_Point(0.0f,0.0f), pRange,pSysHandler, NULL);
+ if (!HasFlag(PES_TEXTOVERFLOW)) {
+ rcClip = GetClientRect();
+ pRange = &wrRange;
+ }
+ IFX_SystemHandler* pSysHandler = GetSystemHandler();
+ IFX_Edit::DrawEdit(
+ pDevice, pUser2Device, m_pEdit,
+ CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
+ CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()),
+ rcClip, CPDF_Point(0.0f, 0.0f), pRange, pSysHandler, NULL);
}
-void CPWL_Label::SetHorzScale(int32_t nHorzScale)
-{
- m_pEdit->SetHorzScale(nHorzScale);
+void CPWL_Label::SetHorzScale(int32_t nHorzScale) {
+ m_pEdit->SetHorzScale(nHorzScale);
}
-void CPWL_Label::SetCharSpace(FX_FLOAT fCharSpace)
-{
- m_pEdit->SetCharSpace(fCharSpace);
+void CPWL_Label::SetCharSpace(FX_FLOAT fCharSpace) {
+ m_pEdit->SetCharSpace(fCharSpace);
}
-CPDF_Rect CPWL_Label::GetContentRect() const
-{
- return m_pEdit->GetContentRect();
+CPDF_Rect CPWL_Label::GetContentRect() const {
+ return m_pEdit->GetContentRect();
}
-void CPWL_Label::GetThisAppearanceStream(CFX_ByteTextBuf & sAppStream)
-{
- CPWL_Wnd::GetThisAppearanceStream(sAppStream);
+void CPWL_Label::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
+ CPWL_Wnd::GetThisAppearanceStream(sAppStream);
- sAppStream << GetTextAppearanceStream(CPDF_Point(0.0f, 0.0f));
+ sAppStream << GetTextAppearanceStream(CPDF_Point(0.0f, 0.0f));
}
-CFX_ByteString CPWL_Label::GetTextAppearanceStream(const CPDF_Point & ptOffset) const
-{
- CFX_ByteTextBuf sRet;
- CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit,ptOffset);
+CFX_ByteString CPWL_Label::GetTextAppearanceStream(
+ const CPDF_Point& ptOffset) const {
+ CFX_ByteTextBuf sRet;
+ CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset);
- if (sEdit.GetLength() > 0)
- {
- sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) << sEdit << "ET\n";
- }
+ if (sEdit.GetLength() > 0) {
+ sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) << sEdit
+ << "ET\n";
+ }
- return sRet.GetByteString();
+ return sRet.GetByteString();
}
-CFX_WideString CPWL_Label::GetText() const
-{
- return m_pEdit->GetText();
+CFX_WideString CPWL_Label::GetText() const {
+ return m_pEdit->GetText();
}
-void CPWL_Label::SetLimitChar(int32_t nLimitChar)
-{
- m_pEdit->SetLimitChar(nLimitChar);
+void CPWL_Label::SetLimitChar(int32_t nLimitChar) {
+ m_pEdit->SetLimitChar(nLimitChar);
}
-int32_t CPWL_Label::GetTotalWords()
-{
- if (m_pEdit)
- return m_pEdit->GetTotalWords();
+int32_t CPWL_Label::GetTotalWords() {
+ if (m_pEdit)
+ return m_pEdit->GetTotalWords();
- return 0;
+ return 0;
}
-