sw/source/ui/misc/pggrid.cxx | 52 ++++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 13 deletions(-)
New commits: commit b9534138d604a30e9c73d0819a0dacee0b3178b9 Author: Kevin Suo <suokunl...@126.com> AuthorDate: Thu Nov 10 16:07:41 2022 +0800 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Nov 16 20:34:41 2022 +0100 tdf#151988: Enable "Characters per line" and "Character width" when switch... ... back to grid type "lines and characters". Also enable "Snap to characters" for grid type "lines and characters" and disbale it for grid types "lines only" and "no grid". Change-Id: I101c8d80a79798fc6c992da766c658c3ba8802dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142513 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit f4fbd3ca939fbf70eee110e4c601a5e7eeade714) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142621 Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index 263009f26290..18f66cc08c1a 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -468,20 +468,43 @@ IMPL_LINK(SwTextGridPage, GridTypeHdl, weld::Toggleable&, rButton, void) if (!rButton.get_active()) return; - const bool bNoGrid = m_xNoGridRB.get() == &rButton; - m_xLayoutFL->set_sensitive(!bNoGrid); - m_xDisplayFL->set_sensitive(!bNoGrid); - - //one special case - if (!bNoGrid) + if (m_xNoGridRB.get() == &rButton) + { + // GRID_NONE mode: + // "Layout" and "Display" sections should all be disabled. + m_xLayoutFL->set_sensitive(false); + m_xDisplayFL->set_sensitive(false); + } + else + { + // GRID_LINES_ONLY or GRID_LINES_CHARS mode: + // "Layout" and "Display" sections should all be enabled; + // DisplayGridHdl should be executed; + m_xLayoutFL->set_sensitive(true); + m_xDisplayFL->set_sensitive(true); DisplayGridHdl(*m_xDisplayCB); + } - bool bEnable = m_xCharsGridRB.get() == &rButton; - m_xSnapToCharsCB->set_sensitive(bEnable); - - bEnable = m_xLinesGridRB.get() == &rButton; - if (bEnable && !m_bSquaredMode) + if (m_xCharsGridRB.get() == &rButton) + { + // GRID_LINES_CHARS mode: + // "Snap to character" should be enabled; + // "Characters per line" should be enabled; + // "Characters range" should be enabled; + m_xSnapToCharsCB->set_sensitive(true); + m_xCharsPerLineFT->set_sensitive(true); + m_xCharsPerLineNF->set_sensitive(true); + m_xCharsRangeFT->set_sensitive(true); + m_xCharWidthFT->set_sensitive(true); + m_xCharWidthMF->set_sensitive(true); + } + else { + // GRID_NONE or GRID_LINES_ONLY mode: + // "Snap to character" should be disabled; + // "Characters per line" should be disabled; + // "Characters range" should be disabled; + m_xSnapToCharsCB->set_sensitive(false); m_xCharsPerLineFT->set_sensitive(false); m_xCharsPerLineNF->set_sensitive(false); m_xCharsRangeFT->set_sensitive(false); @@ -489,9 +512,12 @@ IMPL_LINK(SwTextGridPage, GridTypeHdl, weld::Toggleable&, rButton, void) m_xCharWidthMF->set_sensitive(false); } - //recalc which dependencies are sensitive - if (!bNoGrid) + if (m_xNoGridRB.get() != &rButton) + { + // GRID_LINES_ONLY or GRID_LINES_CHARS mode: (additionally) + // TextSizeChangedHdl should be executed to recalculate which dependencies are sensitive. TextSizeChangedHdl(*m_xTextSizeMF); + } GridModifyHdl(); }