diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-08-26 19:44:14 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2019-09-05 15:47:41 +0200 |
commit | 155ab0c0818c3348f2d75f4c1db3ae97c4174d7e (patch) | |
tree | a88986671ca9e88b309119fe1fc7a24a26e436e1 /sw/source | |
parent | 3212254df1a56bd19fa0da4a5540256850d4ddb1 (diff) |
lok: change table border position param. from new pos. to offset
To implement table border position changing for Impress requires
that instead of parameter with new absolute position, we use
offset from the previous position.
It's easy to change the code for Writer to do this instead of
Impress so this commit does this.
Reviewed-on: https://gerrit.libreoffice.org/78121
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit 19d88b15ec52a0560b96c5e71b5a328952ba7f28)
Change-Id: I2d3ebe5ba0dc30fb8b4a58cc9ca820cc8330204b
Reviewed-on: https://gerrit.libreoffice.org/78330
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/uibase/uiview/viewtab.cxx | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index d822343b885d..fd9e6684bf49 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -1017,16 +1017,16 @@ void SwView::ExecTabWin( SfxRequest const & rReq ) { const SfxPoolItem *pBorderType; const SfxPoolItem *pIndex; - const SfxPoolItem *pNewPosition; + const SfxPoolItem *pOffset; constexpr long constDistanceOffset = 40; if (pReqArgs->GetItemState(SID_TABLE_BORDER_TYPE, true, &pBorderType) == SfxItemState::SET && pReqArgs->GetItemState(SID_TABLE_BORDER_INDEX, true, &pIndex) == SfxItemState::SET - && pReqArgs->GetItemState(SID_TABLE_BORDER_NEW_POSITION, true, &pNewPosition) == SfxItemState::SET) + && pReqArgs->GetItemState(SID_TABLE_BORDER_OFFSET, true, &pOffset) == SfxItemState::SET) { const OUString sType = static_cast<const SfxStringItem*>(pBorderType)->GetValue(); const sal_uInt16 nIndex = static_cast<const SfxUInt16Item*>(pIndex)->GetValue(); - const sal_Int32 nNewPosition = static_cast<const SfxInt32Item*>(pNewPosition)->GetValue(); + const sal_Int32 nOffset = static_cast<const SfxInt32Item*>(pOffset)->GetValue(); if (sType.startsWith("column")) { @@ -1036,23 +1036,23 @@ void SwView::ExecTabWin( SfxRequest const & rReq ) if (sType == "column-left") { auto & rEntry = aTabCols.GetEntry(0); - long nPosition = std::min(long(nNewPosition), rEntry.nPos - constDistanceOffset); + long nNewPosition = aTabCols.GetLeft() + long(nOffset); + long nPosition = std::min(nNewPosition, rEntry.nPos - constDistanceOffset); aTabCols.SetLeft(nPosition); } else if (sType == "column-right") { auto & rEntry = aTabCols.GetEntry(aTabCols.Count() - 1); - long nPosition = std::max(long(nNewPosition), rEntry.nPos + constDistanceOffset); + long nNewPosition = aTabCols.GetRight() + long(nOffset); + long nPosition = std::max(nNewPosition, rEntry.nPos + constDistanceOffset); aTabCols.SetRight(nPosition); } - else if (sType == "column-middle") + else if (sType == "column-middle" && nIndex < aTabCols.Count()) { - if (nIndex < aTabCols.Count()) - { - auto & rEntry = aTabCols.GetEntry(nIndex); - long nPosition = MinMax(long(nNewPosition), rEntry.nMin, rEntry.nMax - constDistanceOffset); - rEntry.nPos = nPosition; - } + auto & rEntry = aTabCols.GetEntry(nIndex); + long nNewPosition = rEntry.nPos + long(nOffset); + long nPosition = MinMax(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset); + rEntry.nPos = nPosition; } rSh.SetTabCols(aTabCols, false); @@ -1065,23 +1065,23 @@ void SwView::ExecTabWin( SfxRequest const & rReq ) if (sType == "row-left") { auto & rEntry = aTabRows.GetEntry(0); - long nPosition = std::min(long(nNewPosition), rEntry.nPos - constDistanceOffset); + long nNewPosition = aTabRows.GetLeft() + long(nOffset); + long nPosition = std::min(nNewPosition, rEntry.nPos - constDistanceOffset); aTabRows.SetLeft(nPosition); } else if (sType == "row-right") { auto & rEntry = aTabRows.GetEntry(aTabRows.Count() - 1); - long nPosition = std::max(long(nNewPosition), rEntry.nPos + constDistanceOffset); + long nNewPosition = aTabRows.GetRight() + long(nOffset); + long nPosition = std::max(nNewPosition, rEntry.nPos + constDistanceOffset); aTabRows.SetRight(nPosition); } - else if (sType == "row-middle") + else if (sType == "row-middle" && nIndex < aTabRows.Count()) { - if (nIndex < aTabRows.Count()) - { - auto & rEntry = aTabRows.GetEntry(nIndex); - long nPosition = MinMax(long(nNewPosition), rEntry.nMin, rEntry.nMax - constDistanceOffset); - rEntry.nPos = nPosition; - } + auto & rEntry = aTabRows.GetEntry(nIndex); + long nNewPosition = rEntry.nPos + long(nOffset); + long nPosition = MinMax(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset); + rEntry.nPos = nPosition; } rSh.SetTabRows(aTabRows, false); |