summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorSzymon Kłos <eszkadev@gmail.com>2017-03-30 23:45:44 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-04-04 15:51:19 +0000
commitc1351a7b1363dac4349f37ac8876fdf950e62b97 (patch)
treef6039cf084d262cbc6bf7a08428c726a8397a97f /sw
parent387cdc35d79cd3dd235e4bb61e01e17d8781630a (diff)
Make HangingIndent a command
New command .uno:HangingIndent. Code moved from the sidebar to slots. Change-Id: Ib389f9fb3368409a90cf90ad8b19f1be322fa120 Reviewed-on: https://gerrit.libreoffice.org/35930 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sw')
-rw-r--r--sw/sdi/_viewsh.sdi6
-rw-r--r--sw/sdi/drwtxtsh.sdi6
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx16
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx23
4 files changed, 51 insertions, 0 deletions
diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index bc40a4dd8940..97e5c6eab343 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -537,6 +537,12 @@ interface BaseTextEditView
ExecMethod = ExecTabWin ;
StateMethod = StateTabWin ;
]
+ SID_HANGING_INDENT
+ [
+ ExecMethod = ExecTabWin ;
+ StateMethod = StateTabWin ;
+ DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
+ ]
SID_ATTR_PAGE_ULSPACE
[
ExecMethod = ExecTabWin ;
diff --git a/sw/sdi/drwtxtsh.sdi b/sw/sdi/drwtxtsh.sdi
index c2898fb066e0..2705712edb93 100644
--- a/sw/sdi/drwtxtsh.sdi
+++ b/sw/sdi/drwtxtsh.sdi
@@ -207,6 +207,12 @@ interface TextDrawText
DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
]
+ SID_HANGING_INDENT
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetState ;
+ ]
+
SID_ATTR_PARA_LRSPACE //for indent
[
ExecMethod = Execute ;
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index 04e1b6738a46..186ab8fcc0e1 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -221,6 +221,22 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
rReq.Done();
}
break;
+ case SID_HANGING_INDENT:
+ {
+ SfxItemState eState = aEditAttr.GetItemState( EE_PARA_LRSPACE );
+ if( eState >= SfxItemState::DEFAULT )
+ {
+ SvxLRSpaceItem aParaMargin = static_cast<const SvxLRSpaceItem&>( aEditAttr.Get( EE_PARA_LRSPACE ) );
+ aParaMargin.SetWhich( EE_PARA_LRSPACE );
+ short int nFirstLineOffset = aParaMargin.GetTextFirstLineOfst();
+ aParaMargin.SetTextLeft( aParaMargin.GetTextLeft() + nFirstLineOffset );
+ aParaMargin.SetRight( aParaMargin.GetRight() );
+ aParaMargin.SetTextFirstLineOfst( nFirstLineOffset * (-1) );
+ aNewAttr.Put(aParaMargin);
+ rReq.Done();
+ }
+ }
+ break;
case SID_ATTR_PARA_LINESPACE:
{
SvxLineSpacingItem aLineSpace = static_cast<const SvxLineSpacingItem&>(pNewAttrs->Get(
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index d30dbdb9be68..25ed16527b75 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -654,6 +654,21 @@ void SwView::ExecTabWin( SfxRequest& rReq )
}
break;
+ case SID_HANGING_INDENT:
+ {
+ SfxItemSet aLRSpaceSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE );
+ rSh.GetCurAttr( aLRSpaceSet );
+ SvxLRSpaceItem aParaMargin( static_cast<const SvxLRSpaceItem&>( aLRSpaceSet.Get( RES_LR_SPACE ) ) );
+
+ SvxLRSpaceItem aNewMargin( RES_LR_SPACE );
+ aNewMargin.SetTextLeft( aParaMargin.GetTextLeft() + aParaMargin.GetTextFirstLineOfst() );
+ aNewMargin.SetRight( aParaMargin.GetRight() );
+ aNewMargin.SetTextFirstLineOfst( (aParaMargin.GetTextFirstLineOfst()) * (-1) );
+
+ rSh.SetAttrItem( aNewMargin );
+ break;
+ }
+
case SID_ATTR_PARA_LRSPACE_VERTICAL:
case SID_ATTR_PARA_LRSPACE:
if ( pReqArgs )
@@ -1421,6 +1436,14 @@ void SwView::StateTabWin(SfxItemSet& rSet)
break;
}
+ case SID_HANGING_INDENT:
+ {
+ SfxItemState e = aCoreSet.GetItemState(RES_LR_SPACE);
+ if( e == SfxItemState::DISABLED )
+ rSet.DisableItem(nWhich);
+ break;
+ }
+
case SID_ATTR_PARA_LRSPACE_VERTICAL:
case SID_ATTR_PARA_LRSPACE:
case SID_ATTR_PARA_LEFTSPACE: