[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - sw/source
Mark Hung (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jun 5 09:30:14 UTC 2019
sw/source/ui/misc/pggrid.cxx | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
New commits:
commit 595d28ab771c9acdfc613502a28486e4a85b38d7
Author: Mark Hung <marklh9 at gmail.com>
AuthorDate: Fri May 31 23:22:43 2019 +0800
Commit: Xisco FaulĂ <xiscofauli at libreoffice.org>
CommitDate: Wed Jun 5 11:29:33 2019 +0200
tdf#104922 recover text grid setting properly.
Lines per page and chars per line can not be set before the
max values determined, otherwise we may get incorrect result
because of truncating to incorrect max values.
Change-Id: I9829af0dcfd744f4383a5f9034270b00fdfb15b8
Reviewed-on: https://gerrit.libreoffice.org/73280
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9 at gmail.com>
(cherry picked from commit c1c3a3c619bd596e2a64e2c9b9328b4adfa990eb)
Reviewed-on: https://gerrit.libreoffice.org/73458
Reviewed-by: Xisco FaulĂ <xiscofauli at libreoffice.org>
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index dbef0e81300b..860f913985cd 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -171,6 +171,8 @@ bool SwTextGridPage::FillItemSet(SfxItemSet *rSet)
void SwTextGridPage::Reset(const SfxItemSet *rSet)
{
+ sal_Int32 nLinesPerPage = 0;
+
if(SfxItemState::DEFAULT <= rSet->GetItemState(RES_TEXTGRID))
{
const SwTextGridItem& rGridItem = rSet->Get(RES_TEXTGRID);
@@ -185,7 +187,8 @@ void SwTextGridPage::Reset(const SfxItemSet *rSet)
m_xDisplayCB->set_active(rGridItem.IsDisplayGrid());
GridTypeHdl(*pButton);
m_xSnapToCharsCB->set_active(rGridItem.IsSnapToChars());
- m_xLinesPerPageNF->set_value(rGridItem.GetLines());
+ nLinesPerPage = rGridItem.GetLines();
+
SetLinesOrCharsRanges(*m_xLinesRangeFT , m_xLinesPerPageNF->get_max());
m_nRubyUserValue = rGridItem.GetBaseHeight();
m_bRubyUserValue = true;
@@ -198,6 +201,9 @@ void SwTextGridPage::Reset(const SfxItemSet *rSet)
}
UpdatePageSize(*rSet);
+ if (nLinesPerPage > 0)
+ m_xLinesPerPageNF->set_value(nLinesPerPage);
+
m_xNoGridRB->save_state();
m_xLinesGridRB->save_state();
m_xSnapToCharsCB->save_state();
@@ -301,8 +307,9 @@ void SwTextGridPage::UpdatePageSize(const SfxItemSet& rSet)
if ( m_bSquaredMode )
{
- m_xCharsPerLineNF->set_value(m_aPageSize.Width() / nTextSize);
- m_xCharsPerLineNF->set_max(m_xCharsPerLineNF->get_value());
+ sal_Int32 nCharsPerLine = m_aPageSize.Width() / nTextSize;
+ m_xCharsPerLineNF->set_max(nCharsPerLine);
+ m_xCharsPerLineNF->set_value(nCharsPerLine);
m_xLinesPerPageNF->set_max(m_aPageSize.Height() /
( m_xTextSizeMF->denormalize(m_xTextSizeMF->get_value(FieldUnit::TWIP)) +
m_xRubySizeMF->denormalize(m_xRubySizeMF->get_value(FieldUnit::TWIP))));
More information about the Libreoffice-commits
mailing list