diff options
author | Kevin Suo <suokunlong@126.com> | 2022-11-03 23:26:28 +0800 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-11-09 21:24:29 +0100 |
commit | 875c27dc7975de9b007a215fe1d6f171b4ef090e (patch) | |
tree | fad4937076b7bd963bcf491d2bbe7ee6b72b66d1 /sw/source/ui/misc/pggrid.cxx | |
parent | 789872ad1b5916cc5b5abebe5221e80f77725445 (diff) |
tdf#151544: Page grid: ruby height should be zero when not in square page mode
Ruby height is used to show the ruby line in square page mode only (e.g. to show the
Pinyin etc above or below base line). When not in square page mode (i.e., when in
normal mode), the ruby height should be zero.
The code was trying to set the ruby height to zero by using the following:
m_xRubySizeMF->set_value(0, FieldUnit::TWIP);
and then pass this to aGridItem.SetRubyHeight in SwTextGridPage::PutGridItem.
However, there seems to be always a conversion loss, thus each line will have a tiny
ruby height, which makes the vertical space not enough to hold the desired number
of lines on the page.
Fix this by setting ruby height to zero directly in SwTextGridPage::PutGridItem if
we are not in square page mode.
Change-Id: I24a74b96c12eb58e46e163e2a9c73b540023ab39
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142243
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/ui/misc/pggrid.cxx')
-rw-r--r-- | sw/source/ui/misc/pggrid.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index db3ade6edb6b..f849f6dcc48a 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -232,7 +232,12 @@ void SwTextGridPage::PutGridItem(SfxItemSet& rSet) aGridItem.SetBaseHeight( static_cast< sal_uInt16 >( m_bRubyUserValue ? m_nRubyUserValue : m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP))) ); - aGridItem.SetRubyHeight( static_cast< sal_uInt16 >(m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP))) ); + // Tdf#151544: set ruby height from the value get from UI only when in square page mode. + // When in normal mode, the ruby height should be zero. + if (m_bSquaredMode) + aGridItem.SetRubyHeight(static_cast<sal_uInt16>(m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP)))); + else + aGridItem.SetRubyHeight(0); aGridItem.SetBaseWidth( static_cast< sal_uInt16 >(m_xCharWidthMF->denormalize(m_xCharWidthMF->get_value(FieldUnit::TWIP))) ); aGridItem.SetRubyTextBelow(m_xRubyBelowCB->get_active()); aGridItem.SetSquaredMode(m_bSquaredMode); @@ -385,7 +390,6 @@ IMPL_LINK(SwTextGridPage, CharorLineChangedHdl, weld::SpinButton&, rField, void) assert(nValue && "div-by-zero"); auto nHeight = m_aPageSize.Height() / nValue; m_xTextSizeMF->set_value(m_xTextSizeMF->normalize(nHeight), FieldUnit::TWIP); - m_xRubySizeMF->set_value(0, FieldUnit::TWIP); SetLinesOrCharsRanges( *m_xLinesRangeFT , m_xLinesPerPageNF->get_max() ); m_nRubyUserValue = nHeight; |