diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-08-19 12:17:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-08-19 18:09:35 +0200 |
commit | 5070c0095433e5169dd4a34b1c6a6469726c197c (patch) | |
tree | 77fe9e57e0807482c7b9294546f9d0c47d5b31ce | |
parent | 3a5a81e74308c03b2cf774cccb78f3a102d5be72 (diff) |
make a LabelType enum distinct from MessageType
Change-Id: Ib548cf9f97eb356dfe8f612c177dc29883e9128a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100993
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/vcl/weld.hxx | 9 | ||||
-rw-r--r-- | sc/source/ui/namedlg/namedefdlg.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/namedlg/namedlg.cxx | 8 | ||||
-rw-r--r-- | vcl/inc/salvtables.hxx | 2 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 8 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 8 |
6 files changed, 25 insertions, 18 deletions
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index cd56690f0575..bafc571d2c80 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1909,13 +1909,20 @@ public: weld::SpinButton& get_widget() { return *m_xSpinButton; } }; +enum class LabelType +{ + Normal, + Warning, + Error, +}; + class VCL_DLLPUBLIC Label : virtual public Widget { public: virtual void set_label(const OUString& rText) = 0; virtual OUString get_label() const = 0; virtual void set_mnemonic_widget(Widget* pTarget) = 0; - virtual void set_message_type(EntryMessageType eType) = 0; + virtual void set_label_type(LabelType eType) = 0; // font size is in points, not pixels, e.g. see Window::[G]etPointFont virtual void set_font(const vcl::Font& rFont) = 0; }; diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx index 012b785b88a2..0cd43c9b68c6 100644 --- a/sc/source/ui/namedlg/namedefdlg.cxx +++ b/sc/source/ui/namedlg/namedefdlg.cxx @@ -132,7 +132,7 @@ bool ScNameDefDlg::IsNameValid() } ScRangeData::IsNameValidType eType; - m_xFtInfo->set_message_type(weld::EntryMessageType::Normal); + m_xFtInfo->set_label_type(weld::LabelType::Normal); if ( aName.isEmpty() ) { m_xBtnAdd->set_sensitive(false); @@ -141,7 +141,7 @@ bool ScNameDefDlg::IsNameValid() } else if ((eType = ScRangeData::IsNameValid( aName, &mrDoc )) != ScRangeData::NAME_VALID) { - m_xFtInfo->set_message_type(weld::EntryMessageType::Error); + m_xFtInfo->set_label_type(weld::LabelType::Error); if (eType == ScRangeData::NAME_INVALID_BAD_STRING) { m_xFtInfo->set_label(maErrInvalidNameStr); @@ -155,7 +155,7 @@ bool ScNameDefDlg::IsNameValid() } else if (pRangeName->findByUpperName(ScGlobal::getCharClassPtr()->uppercase(aName))) { - m_xFtInfo->set_message_type(weld::EntryMessageType::Error); + m_xFtInfo->set_label_type(weld::LabelType::Error); m_xFtInfo->set_label(maErrNameInUse); m_xBtnAdd->set_sensitive(false); return false; @@ -163,7 +163,7 @@ bool ScNameDefDlg::IsNameValid() if (!IsFormulaValid()) { - m_xFtInfo->set_message_type(weld::EntryMessageType::Error); + m_xFtInfo->set_label_type(weld::LabelType::Error); m_xBtnAdd->set_sensitive(false); return false; } diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index dbc3180a2ad7..ab459e1bc31d 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -252,13 +252,13 @@ bool ScNameDlg::IsNameValid() if (ScRangeData::IsNameValid( aName, mpDoc ) != ScRangeData::NAME_VALID) { - m_xFtInfo->set_message_type(weld::EntryMessageType::Error); + m_xFtInfo->set_label_type(weld::LabelType::Error); m_xFtInfo->set_label(maErrInvalidNameStr); return false; } else if (pRangeName && pRangeName->findByUpperName(ScGlobal::getCharClassPtr()->uppercase(aName))) { - m_xFtInfo->set_message_type(weld::EntryMessageType::Error); + m_xFtInfo->set_label_type(weld::LabelType::Error); m_xFtInfo->set_label(maErrNameInUse); return false; } @@ -272,7 +272,7 @@ bool ScNameDlg::IsFormulaValid() std::unique_ptr<ScTokenArray> pCode = aComp.CompileString(m_xEdAssign->GetText()); if (pCode->GetCodeError() != FormulaError::NONE) { - m_xFtInfo->set_message_type(weld::EntryMessageType::Error); + m_xFtInfo->set_label_type(weld::LabelType::Error); return false; } else @@ -343,7 +343,7 @@ void ScNameDlg::NameModified() OUString aOldName = aLine.aName; OUString aNewName = m_xEdName->get_text(); aNewName = aNewName.trim(); - m_xFtInfo->set_message_type(weld::EntryMessageType::Normal); + m_xFtInfo->set_label_type(weld::LabelType::Normal); if (aNewName != aOldName) { if (!IsNameValid()) diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index f7addeea389e..be3d99ada9bb 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -407,7 +407,7 @@ public: virtual void set_mnemonic_widget(Widget* pTarget) override; - virtual void set_message_type(weld::EntryMessageType eType) override; + virtual void set_label_type(weld::LabelType eType) override; virtual void set_font(const vcl::Font& rFont) override; }; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 9e6fb8e54904..8979efdec4d6 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -5486,17 +5486,17 @@ void SalInstanceLabel::set_mnemonic_widget(Widget* pTarget) pLabel->set_mnemonic_widget(pTargetWidget ? pTargetWidget->getWidget() : nullptr); } -void SalInstanceLabel::set_message_type(weld::EntryMessageType eType) +void SalInstanceLabel::set_label_type(weld::LabelType eType) { switch (eType) { - case weld::EntryMessageType::Normal: + case weld::LabelType::Normal: m_xLabel->SetControlBackground(); break; - case weld::EntryMessageType::Warning: + case weld::LabelType::Warning: m_xLabel->SetControlBackground(COL_YELLOW); break; - case weld::EntryMessageType::Error: + case weld::LabelType::Error: m_xLabel->SetControlBackground( m_xLabel->GetSettings().GetStyleSettings().GetHighlightColor()); break; diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index e743a6b8556e..a6ee2e32fe4c 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -12554,17 +12554,17 @@ public: gtk_label_set_mnemonic_widget(m_pLabel, pTargetWidget ? pTargetWidget->getWidget() : nullptr); } - virtual void set_message_type(weld::EntryMessageType eType) override + virtual void set_label_type(weld::LabelType eType) override { switch (eType) { - case weld::EntryMessageType::Normal: + case weld::LabelType::Normal: gtk_label_set_attributes(m_pLabel, nullptr); break; - case weld::EntryMessageType::Warning: + case weld::LabelType::Warning: set_text_color(COL_YELLOW); break; - case weld::EntryMessageType::Error: + case weld::LabelType::Error: set_text_color(Application::GetSettings().GetStyleSettings().GetHighlightColor()); break; } |