diff options
author | Sahil Gautam <sahil@libreoffice.org> | 2024-04-17 18:12:18 +0530 |
---|---|---|
committer | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2024-04-22 13:29:53 +0200 |
commit | 1cfc2e2c92e1259341ee18cf87be63c4dcebd33d (patch) | |
tree | bd8cd5f54e95bebe2740eb6de40681d149c93ee8 /sc/source/ui | |
parent | 44f48621a600b4b013115e2671c657725b77883c (diff) |
tdf#63374 Change cell background color when in edit mode
Set the edit cell background (EditView) color to CALCCELLFOCUS
and allow enabling/disabling via a checkbox
tools > options > Calc > View > Edit cell background highlighting
Change-Id: I1216dfa0880e1080d23059512e3801d6af3b3c11
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165075
Tested-by: Jenkins
Tested-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/inc/tpview.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/optdlg/tpview.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 10 |
3 files changed, 28 insertions, 0 deletions
diff --git a/sc/source/ui/inc/tpview.hxx b/sc/source/ui/inc/tpview.hxx index 97addc9f530d..ace65836d800 100644 --- a/sc/source/ui/inc/tpview.hxx +++ b/sc/source/ui/inc/tpview.hxx @@ -47,6 +47,8 @@ class ScTpContentOptions : public SfxTabPage std::unique_ptr<weld::Widget> m_xValueImg; std::unique_ptr<weld::CheckButton> m_xColRowHighCB; std::unique_ptr<weld::Widget> m_xColRowHighImg; + std::unique_ptr<weld::CheckButton> m_xEditCellBgHighCB; + std::unique_ptr<weld::Widget> m_xEditCellBgHighImg; std::unique_ptr<weld::CheckButton> m_xAnchorCB; std::unique_ptr<weld::Widget> m_xAnchorImg; std::unique_ptr<weld::CheckButton> m_xRangeFindCB; diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx index 779dcdd3a96c..d4d9f6731add 100644 --- a/sc/source/ui/optdlg/tpview.cxx +++ b/sc/source/ui/optdlg/tpview.cxx @@ -54,6 +54,8 @@ ScTpContentOptions::ScTpContentOptions(weld::Container* pPage, weld::DialogContr , m_xValueImg(m_xBuilder->weld_widget("lockvalue")) , m_xColRowHighCB(m_xBuilder->weld_check_button("colrowhigh")) , m_xColRowHighImg(m_xBuilder->weld_widget("lockcolrowhigh")) + , m_xEditCellBgHighCB(m_xBuilder->weld_check_button("editcellbg")) + , m_xEditCellBgHighImg(m_xBuilder->weld_widget("lockeditcellbghigh")) , m_xAnchorCB(m_xBuilder->weld_check_button("anchor")) , m_xAnchorImg(m_xBuilder->weld_widget("lockanchor")) , m_xRangeFindCB(m_xBuilder->weld_check_button("rangefind")) @@ -97,6 +99,7 @@ ScTpContentOptions::ScTpContentOptions(weld::Container* pPage, weld::DialogContr m_xFormulaMarkCB->connect_toggled(aCBHdl); m_xValueCB->connect_toggled(aCBHdl); m_xColRowHighCB->connect_toggled(aCBHdl); + m_xEditCellBgHighCB->connect_toggled(aCBHdl); m_xAnchorCB->connect_toggled(aCBHdl); m_xVScrollCB->connect_toggled(aCBHdl); @@ -189,6 +192,13 @@ bool ScTpContentOptions::FillItemSet( SfxItemSet* rCoreSet ) pChange->commit(); bRet = true; } + if (m_xEditCellBgHighCB->get_state_changed_from_saved()) + { + auto pChange(comphelper::ConfigurationChanges::create()); + officecfg::Office::Calc::Content::Display::EditCellBackgroundHighlighting::set(m_xEditCellBgHighCB->get_active(), pChange); + pChange->commit(); + bRet = true; + } return bRet; } @@ -205,6 +215,7 @@ void ScTpContentOptions::Reset( const SfxItemSet* rCoreSet ) m_xFormulaMarkCB->set_active(m_xLocalOptions->GetOption(VOPT_FORMULAS_MARKS)); m_xValueCB ->set_active(m_xLocalOptions->GetOption(VOPT_SYNTAX)); m_xColRowHighCB->set_active(officecfg::Office::Calc::Content::Display::ColumnRowHighlighting::get()); + m_xEditCellBgHighCB->set_active(officecfg::Office::Calc::Content::Display::EditCellBackgroundHighlighting::get()); m_xAnchorCB ->set_active(m_xLocalOptions->GetOption(VOPT_ANCHOR)); m_xObjGrfLB ->set_active( static_cast<sal_uInt16>(m_xLocalOptions->GetObjMode(VOBJ_TYPE_OLE)) ); @@ -269,6 +280,10 @@ void ScTpContentOptions::Reset( const SfxItemSet* rCoreSet ) m_xColRowHighCB->set_sensitive(!bReadOnly); m_xColRowHighImg->set_visible(bReadOnly); + bReadOnly = officecfg::Office::Calc::Content::Display::EditCellBackgroundHighlighting::isReadOnly(); + m_xEditCellBgHighCB->set_sensitive(!bReadOnly); + m_xEditCellBgHighImg->set_visible(bReadOnly); + bReadOnly = officecfg::Office::Calc::Content::Display::Anchor::isReadOnly(); m_xAnchorCB->set_sensitive(!bReadOnly); m_xAnchorImg->set_visible(bReadOnly); @@ -331,6 +346,7 @@ void ScTpContentOptions::Reset( const SfxItemSet* rCoreSet ) m_xFormulaMarkCB->save_state(); m_xValueCB->save_state(); m_xColRowHighCB->save_state(); + m_xEditCellBgHighCB->save_state(); m_xAnchorCB->save_state(); m_xObjGrfLB->save_value(); m_xDiagramLB->save_value(); diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 5c4ea63e268a..896d44f5898b 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -38,6 +38,7 @@ #include <comphelper/lok.hxx> #include <sfx2/lokhelper.hxx> #include <sfx2/lokcomponenthelpers.hxx> +#include <officecfg/Office/Calc.hxx> #include <svx/svdview.hxx> #include <svx/svdpagv.hxx> @@ -720,6 +721,15 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI SCCOL nEditEndCol = mrViewData.GetEditEndCol(); SCROW nEditEndRow = mrViewData.GetEditEndRow(); + if (officecfg::Office::Calc::Content::Display::EditCellBackgroundHighlighting::get() + && !getViewData().GetMarkData().IsMarked()) + { + const Color aBackgroundColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; + Color aHighlightColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCCELLFOCUS).nColor; + aHighlightColor.Merge(aBackgroundColor, 100); + pEditView->SetBackgroundColor(aHighlightColor); + } + if ( nEditEndCol >= nX1 && nEditCol <= nX2 && nEditEndRow >= nY1 && nEditRow <= nY2 ) aOutputData.SetEditCell( nEditCol, nEditRow ); else |