diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-02-21 11:25:16 +0300 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-03-25 21:24:02 +0200 |
commit | 3cc59cfae1cf8701ec7a5e7d85fc7a3645f55d96 (patch) | |
tree | bf3f5ba8efe4fcd11f298f1e0851d40526931e51 /sfx2 | |
parent | 9af3a946d23ba4906de7be69f0e1496e84f49390 (diff) |
tdf#115938: Properly detect shadow size control's changed state
This change makes sure that only if the shadow size edit box' text
is changed, it is converted to the size in twips. It sets wrapper's
default value on each SetControlValue, to return proper initial
size when the size text wasn't modified.
Also both ExampleSet and OutSet in SfxTabDialog's Reset handler are
processed to set relevant items back to initial value; otherwise,
as the restored item (marked as unchanged) will be absent in tab's
result set, it would not modify the old items in the two, and they
would keep previous modified values.
Change-Id: Ie4362811968c6e6cbe0f9229bd3c9b29462f5704
Reviewed-on: https://gerrit.libreoffice.org/50196
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit b37a46fdf91dbc66f6ddc1c070aec70716d94a01)
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/tabdlg.cxx | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 5dc6a5bee5b4..5ca195ed887f 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -965,6 +965,50 @@ IMPL_LINK_NOARG(SfxTabDialog, ResetHdl, Button*, void) DBG_ASSERT( pDataObject, "Id not known" ); pDataObject->pTabPage->Reset( m_pSet ); + // Also reset relevant items of ExampleSet and OutSet to initial state + if (pDataObject->fnGetRanges) + { + if (!m_pExampleSet) + m_pExampleSet = new SfxItemSet(*m_pSet); + + const SfxItemPool* pPool = m_pSet->GetPool(); + const sal_uInt16* pTmpRanges = (pDataObject->fnGetRanges)(); + + while (*pTmpRanges) + { + const sal_uInt16* pU = pTmpRanges + 1; + + // Correct Range with multiple values + sal_uInt16 nTmp = *pTmpRanges, nTmpEnd = *pU; + DBG_ASSERT(nTmp <= nTmpEnd, "Range is sorted the wrong way"); + + if (nTmp > nTmpEnd) + { + // If really sorted wrongly, then set new + std::swap(nTmp, nTmpEnd); + } + + while (nTmp && nTmp <= nTmpEnd) + { + // Iterate over the Range and set the Items + sal_uInt16 nWh = pPool->GetWhich(nTmp); + const SfxPoolItem* pItem; + if (SfxItemState::SET == m_pSet->GetItemState(nWh, false, &pItem)) + { + m_pExampleSet->Put(*pItem); + m_pOutSet->Put(*pItem); + } + else + { + m_pExampleSet->ClearItem(nWh); + m_pOutSet->ClearItem(nWh); + } + nTmp++; + } + // Go to the next pair + pTmpRanges += 2; + } + } } |