summaryrefslogtreecommitdiff
path: root/sw/source/uibase/uiview
diff options
context:
space:
mode:
authorKira Tubo <kira.tubo@gmail.com>2024-09-26 22:15:15 -0700
committerMike Kaganski <mike.kaganski@collabora.com>2024-09-29 02:40:18 +0200
commit4cc532c0393914a743c11e806bd25dfa3d28fb5c (patch)
tree76268a8325f921725982b20c7067e2b4434eafee /sw/source/uibase/uiview
parentc7c52f60657baa65e104530247ed05a90479e99e (diff)
tdf#156374: Create hanging indent on paragraph without one
If the paragraph has no First Line Indent applied, create a hanging indent. - In Writer: the indentation distance is based on the default tab distance. - In Draw/Impress: the indentation distance is based on the distance set for the Increase/Decrease Indent buttons (1000 twips), which is different from the default tab distance. Change-Id: Ifc36c63ad7e6aa852a4b10aca22b7b4de6e10e95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174001 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/source/uibase/uiview')
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx14
1 files changed, 12 insertions, 2 deletions
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index fb1cec99c40c..761df9d72f59 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -732,8 +732,18 @@ void SwView::ExecTabWin( SfxRequest const & rReq )
rSh.GetCurAttr( aLRSpaceSet );
SvxFirstLineIndentItem firstLine(aLRSpaceSet.Get(RES_MARGIN_FIRSTLINE));
SvxTextLeftMarginItem leftMargin(aLRSpaceSet.Get(RES_MARGIN_TEXTLEFT));
- leftMargin.SetTextLeft(leftMargin.GetTextLeft() + firstLine.GetTextFirstLineOffset());
- firstLine.SetTextFirstLineOffset((firstLine.GetTextFirstLineOffset()) * -1);
+
+ tools::Long nIndentDist = firstLine.GetTextFirstLineOffset();
+
+ if (nIndentDist == 0)
+ {
+ const SvxTabStopItem& rDefTabItem = rSh.GetDefault(RES_PARATR_TABSTOP);
+ nIndentDist = ::GetTabDist(rDefTabItem);
+ }
+
+ leftMargin.SetTextLeft(leftMargin.GetTextLeft() + nIndentDist);
+ firstLine.SetTextFirstLineOffset(nIndentDist * -1);
+
firstLine.SetAutoFirst(false); // old code would do this, is it wanted?
rSh.SetAttrItem(firstLine);
rSh.SetAttrItem(leftMargin);