diff options
author | Tor Lillqvist <tml@collabora.com> | 2020-02-04 15:38:46 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2020-02-05 14:03:34 +0100 |
commit | ea63519d88fa111001fd2043e786b54d2f285de1 (patch) | |
tree | 0de107d523b6837dee729f46e44f2e0d75ee827e | |
parent | 80a85b950aa044ac77cdf6d0b9379c56ffb0b915 (diff) |
tdf#128468: Add SvxRuler::MoveTabstop() and use it
Change-Id: If223bde1ae5161da821530d36e50a971c62f6944
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87977
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
-rw-r--r-- | include/svx/ruler.hxx | 2 | ||||
-rw-r--r-- | svx/source/dialog/svxruler.cxx | 14 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh1.cxx | 5 |
3 files changed, 19 insertions, 2 deletions
diff --git a/include/svx/ruler.hxx b/include/svx/ruler.hxx index f456d6a7ec2f..11909eb6e602 100644 --- a/include/svx/ruler.hxx +++ b/include/svx/ruler.hxx @@ -279,6 +279,8 @@ public: void SetTabsRelativeToIndent( bool bRel ); void SetValues(RulerChangeType type, long value); long GetPageWidth() const; + + void MoveTabstop(int nTabstop, int nAmount); }; #endif diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index 8fa6a67df992..ff3b7b6bbca7 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -1732,6 +1732,20 @@ void SvxRuler::UpdateParaContents_Impl( SetIndents(INDENT_COUNT, &mpIndents[0] + INDENT_GAP); } +void SvxRuler::MoveTabstop(int nTabstop, int nAmount) +{ + SAL_INFO("svx", "MoveTabstop(" << nTabstop << "," << nAmount << ")"); + + if (nTabstop < 0 || nTabstop >= mxTabStopItem->Count()) + return; + + SvxTabStop aTabstop = mxTabStopItem->At(nTabstop); + mxTabStopItem->Remove(nTabstop); + aTabstop.GetTabPos() += nAmount; + mxTabStopItem->Insert(aTabstop); + pBindings->GetDispatcher()->ExecuteList(SID_ATTR_TABSTOP, SfxCallMode::RECORD, { mxTabStopItem.get() }); +} + void SvxRuler::DragBorders() { /* Dragging of Borders (Tables and other columns) */ diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 2ce3d6c7bbb8..b3fc13963a99 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1571,8 +1571,9 @@ void SwTextShell::Execute(SfxRequest &rReq) const SfxInt32Item* pAmount = rReq.GetArg<SfxInt32Item>(FN_PARAM_2); if (!pIndex || !pAmount) break; - SAL_INFO("sw.ui", "MoveTabstop(" << pIndex->GetValue() << "," << pAmount->GetValue() << ")"); - // To be implemented + auto &rRuler = GetView().GetHRuler(); + rRuler.MoveTabstop(pIndex->GetValue(), pAmount->GetValue()); + rRuler.ForceUpdate(); } break; default: |