summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Suo <suokunlong@126.com>2022-11-10 16:07:41 +0800
committerMike Kaganski <mike.kaganski@collabora.com>2022-11-12 06:06:32 +0100
commit1bfb323801b9c88879b5948b16d47cdbbee87ab9 (patch)
tree88abfc8520bb381713963aa8ef024b50f2d7c445
parentab4e40941e9ebae83f98ba918440b03eac5bdcaa (diff)
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.kaganski@collabora.com>
-rw-r--r--sw/source/ui/misc/pggrid.cxx52
1 files changed, 39 insertions, 13 deletions
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index 2e9f99e9d538..4d26eead12d9 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();
}