diff options
author | Mark Hung <marklh9@gmail.com> | 2019-05-31 23:22:43 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2019-06-04 06:44:31 +0200 |
commit | c1c3a3c619bd596e2a64e2c9b9328b4adfa990eb (patch) | |
tree | 57398cfa1fa2643425ac9a0c7ba77f1d173d7155 /sw/source/ui/misc | |
parent | d8d8cdecdb760500b06cacef3d17c8e05332967d (diff) |
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@gmail.com>
Diffstat (limited to 'sw/source/ui/misc')
-rw-r--r-- | sw/source/ui/misc/pggrid.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
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)))); |