[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sw/source
Pranam Lashkari (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 23 06:58:56 UTC 2021
sw/source/uibase/uiview/viewtab.cxx | 51 +++++++++++++++++++++---------------
1 file changed, 30 insertions(+), 21 deletions(-)
New commits:
commit 2e1ee0ccb1c9b58fa98e618484ca5e4eecdcea51
Author: Pranam Lashkari <lpranam at collabora.com>
AuthorDate: Thu Aug 19 18:49:59 2021 +0530
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Aug 23 08:58:20 2021 +0200
LOK make sure single row/column table are resizable
First row/column are treated as heading in the table,
that's why need some special case handling for it
First row/column are not counted in regular row/column
Change-Id: If67b759911ea87f2b166a69243b85e98d90c4d22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120778
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index 7a2f8c852625..4edf541aa973 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -1112,24 +1112,30 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
if (sType == "column-left")
{
- auto & rEntry = aTabCols.GetEntry(0);
- long nNewPosition = aTabCols.GetLeft() + long(nOffset);
- long nPosition = std::min(nNewPosition, rEntry.nPos - constDistanceOffset);
- aTabCols.SetLeft(nPosition);
+ long nNewPosition = aTabCols.GetLeft() + nOffset;
+ if(aTabCols.Count() > 0)
+ {
+ auto & rEntry = aTabCols.GetEntry(0);
+ nNewPosition = std::min(nNewPosition, rEntry.nPos - constDistanceOffset);
+ }
+ aTabCols.SetLeft(nNewPosition);
}
else if (sType == "column-right")
{
- auto & rEntry = aTabCols.GetEntry(aTabCols.Count() - 1);
- long nNewPosition = aTabCols.GetRight() + long(nOffset);
- long nPosition = std::max(nNewPosition, rEntry.nPos + constDistanceOffset);
- aTabCols.SetRight(nPosition);
+ long nNewPosition = aTabCols.GetRight() + nOffset;
+ if(aTabCols.Count() > 0)
+ {
+ auto & rEntry = aTabCols.GetEntry(aTabCols.Count() - 1);
+ nNewPosition = std::max(nNewPosition, rEntry.nPos + constDistanceOffset);
+ }
+ aTabCols.SetRight(nNewPosition);
}
else if (sType == "column-middle" && nIndex < aTabCols.Count())
{
auto & rEntry = aTabCols.GetEntry(nIndex);
- long nNewPosition = rEntry.nPos + long(nOffset);
- long nPosition = std::clamp(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset);
- rEntry.nPos = nPosition;
+ long nNewPosition = rEntry.nPos + nOffset;
+ nNewPosition = std::clamp(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset);
+ rEntry.nPos = nNewPosition;
}
rSh.SetTabCols(aTabCols, false);
@@ -1142,23 +1148,26 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
if (sType == "row-left")
{
auto & rEntry = aTabRows.GetEntry(0);
- long nNewPosition = aTabRows.GetLeft() + long(nOffset);
- long nPosition = std::min(nNewPosition, rEntry.nPos - constDistanceOffset);
- aTabRows.SetLeft(nPosition);
+ long nNewPosition = aTabRows.GetLeft() + nOffset;
+ nNewPosition = std::min(nNewPosition, rEntry.nPos - constDistanceOffset);
+ aTabRows.SetLeft(nNewPosition);
}
else if (sType == "row-right")
{
- auto & rEntry = aTabRows.GetEntry(aTabRows.Count() - 1);
- long nNewPosition = aTabRows.GetRight() + long(nOffset);
- long nPosition = std::max(nNewPosition, rEntry.nPos + constDistanceOffset);
- aTabRows.SetRight(nPosition);
+ long nNewPosition = aTabRows.GetRight() + nOffset;
+ if(aTabRows.Count() > 0)
+ {
+ auto & rEntry = aTabRows.GetEntry(aTabRows.Count() - 1);
+ nNewPosition = std::max(nNewPosition, rEntry.nPos + constDistanceOffset);
+ }
+ aTabRows.SetRight(nNewPosition);
}
else if (sType == "row-middle" && nIndex < aTabRows.Count())
{
auto & rEntry = aTabRows.GetEntry(nIndex);
- long nNewPosition = rEntry.nPos + long(nOffset);
- long nPosition = std::clamp(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset);
- rEntry.nPos = nPosition;
+ long nNewPosition = rEntry.nPos + nOffset;
+ nNewPosition = std::clamp(nNewPosition, rEntry.nMin, rEntry.nMax - constDistanceOffset);
+ rEntry.nPos = nNewPosition;
}
rSh.SetTabRows(aTabRows, false);
More information about the Libreoffice-commits
mailing list