From 74ef8a4148f7d8fdf0d40481f879cdd13b27aafb Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Sun, 7 Dec 2014 01:18:06 +0200 Subject: Introduce ParaspaceIncrease/Decrease commands in Writer and Calc Change-Id: Ia8933697fd7bd827bb69c0976f13112eb2131888 --- sc/sdi/drtxtob.sdi | 2 ++ sc/source/ui/drawfunc/drtxtob.cxx | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) (limited to 'sc') diff --git a/sc/sdi/drtxtob.sdi b/sc/sdi/drtxtob.sdi index 903f6ee0a9af..9a77b17ca9a5 100644 --- a/sc/sdi/drtxtob.sdi +++ b/sc/sdi/drtxtob.sdi @@ -92,6 +92,8 @@ interface TableDrawText SID_ATTR_PARA_LINESPACE_10 [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_ATTR_PARA_LINESPACE_15 [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_ATTR_PARA_LINESPACE_20 [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] + SID_PARASPACE_INCREASE [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] + SID_PARASPACE_DECREASE [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_SET_SUPER_SCRIPT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_SET_SUB_SCRIPT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_ATTR_CHAR_KERNING [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 06f5d7bfc2a0..4f7637baef5b 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -761,6 +761,31 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq ) } break; + case SID_PARASPACE_INCREASE: + case SID_PARASPACE_DECREASE: + { + SvxULSpaceItem aULSpace( + static_cast< const SvxULSpaceItem& >( aEditAttr.Get( EE_PARA_ULSPACE ) ) ); + sal_uInt16 nUpper = aULSpace.GetUpper(); + sal_uInt16 nLower = aULSpace.GetLower(); + + if ( nSlot == SID_PARASPACE_INCREASE ) + { + nUpper += 100; + nLower += 100; + } + else + { + nUpper = std::max< sal_Int16 >( nUpper - 100, 0 ); + nLower = std::max< sal_Int16 >( nLower - 100, 0 ); + } + + aULSpace.SetUpper( nUpper ); + aULSpace.SetLower( nLower ); + aNewAttr.Put( aULSpace ); + } + break; + default: bSet = false; } @@ -1023,9 +1048,20 @@ void ScDrawTextObjectBar::GetAttrState( SfxItemSet& rDestSet ) aULSP.SetWhich(SID_ATTR_PARA_ULSPACE); rDestSet.Put(aULSP); Invalidate(SID_ATTR_PARA_ULSPACE); + Invalidate(SID_PARASPACE_INCREASE); + Invalidate(SID_PARASPACE_DECREASE); eState = aAttrSet.GetItemState( EE_PARA_ULSPACE ); - if ( eState == SfxItemState::DONTCARE ) + if( eState >= SfxItemState::DEFAULT ) + { + if ( !aULSP.GetUpper() && !aULSP.GetLower() ) + rDestSet.DisableItem( SID_PARASPACE_DECREASE ); + } + else + { + rDestSet.DisableItem( SID_PARASPACE_INCREASE ); + rDestSet.DisableItem( SID_PARASPACE_DECREASE ); rDestSet.InvalidateItem(SID_ATTR_PARA_ULSPACE); + } // Zeilenabstand -- cgit