summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2014-12-07 01:18:06 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2014-12-07 14:48:18 +0200
commit74ef8a4148f7d8fdf0d40481f879cdd13b27aafb (patch)
tree04b152a2e75d94854cd06bffa8dea5b8dd8fb806 /sw
parent6521e61c4e0e39ed285188f50e0856e56d86e3e5 (diff)
Introduce ParaspaceIncrease/Decrease commands in Writer and Calc
Change-Id: Ia8933697fd7bd827bb69c0976f13112eb2131888
Diffstat (limited to 'sw')
-rw-r--r--sw/sdi/_annotsh.sdi11
-rw-r--r--sw/sdi/_viewsh.sdi12
-rw-r--r--sw/sdi/drwtxtsh.sdi12
-rw-r--r--sw/source/uibase/shells/annotsh.cxx46
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx43
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx55
6 files changed, 168 insertions, 11 deletions
diff --git a/sw/sdi/_annotsh.sdi b/sw/sdi/_annotsh.sdi
index 15f03adf89d0..232388c69187 100644
--- a/sw/sdi/_annotsh.sdi
+++ b/sw/sdi/_annotsh.sdi
@@ -198,6 +198,17 @@ interface _Annotation
StateMethod = GetState ;
]
+ SID_PARASPACE_INCREASE
+ [
+ ExecMethod = Exec;
+ StateMethod = GetState;
+ ]
+ SID_PARASPACE_DECREASE
+ [
+ ExecMethod = Exec;
+ StateMethod = GetState;
+ ]
+
FN_INSERT_STRING
[
ExecMethod = Exec ;
diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi
index 357894cd964e..5e35f90c7f54 100644
--- a/sw/sdi/_viewsh.sdi
+++ b/sw/sdi/_viewsh.sdi
@@ -427,6 +427,18 @@ interface BaseTextEditView
StateMethod = StateTabWin ;
]
+ SID_PARASPACE_INCREASE
+ [
+ ExecMethod = ExecTabWin;
+ StateMethod = StateTabWin;
+ ]
+
+ SID_PARASPACE_DECREASE
+ [
+ ExecMethod = ExecTabWin;
+ StateMethod = StateTabWin;
+ ]
+
SID_ATTR_PAGE_COLUMN
[
ExecMethod = ExecTabWin ;
diff --git a/sw/sdi/drwtxtsh.sdi b/sw/sdi/drwtxtsh.sdi
index 20bba4f911fc..53ed9110ef09 100644
--- a/sw/sdi/drwtxtsh.sdi
+++ b/sw/sdi/drwtxtsh.sdi
@@ -211,6 +211,18 @@ interface TextDrawText
StateMethod = GetState ;
]
+ SID_PARASPACE_INCREASE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+
+ SID_PARASPACE_DECREASE
+ [
+ ExecMethod = Execute;
+ StateMethod = GetState;
+ ]
+
SID_ATTR_PARA_LINESPACE // api:
[
ExecMethod = Execute ;
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx
index 250b73b1c58a..b41a6070f209 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -193,6 +193,31 @@ void SwAnnotationShell::Exec( SfxRequest &rReq )
sal_uInt16 nEEWhich = 0;
switch (nSlot)
{
+ 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 = std::min< sal_uInt16 >( nUpper + 57, 5670 );
+ nLower = std::min< sal_uInt16 >( nLower + 57, 5670 );
+ }
+ else
+ {
+ nUpper = std::max< sal_Int16 >( nUpper - 57, 0 );
+ nLower = std::max< sal_Int16 >( nLower - 57, 0 );
+ }
+
+ aULSpace.SetUpper( nUpper );
+ aULSpace.SetLower( nLower );
+ aNewAttr.Put( aULSpace );
+ rReq.Done();
+ }
+ break;
case SID_ATTR_PARA_LRSPACE:
{
SvxLRSpaceItem aParaMargin(static_cast<const SvxLRSpaceItem&>(rReq.
@@ -659,18 +684,31 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet)
}
break;
case SID_ATTR_PARA_ULSPACE:
+ case SID_PARASPACE_INCREASE:
+ case SID_PARASPACE_DECREASE:
{
SfxItemState eState = aEditAttr.GetItemState( EE_PARA_ULSPACE );
if( eState >= SfxItemState::DEFAULT )
{
SvxULSpaceItem aULSpace = static_cast<const SvxULSpaceItem&>( aEditAttr.Get( EE_PARA_ULSPACE ) );
- aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE);
- rSet.Put(aULSpace);
+ if ( !aULSpace.GetUpper() && !aULSpace.GetLower() )
+ rSet.DisableItem( SID_PARASPACE_DECREASE );
+ else if ( aULSpace.GetUpper() >= 5670 && aULSpace.GetLower() >= 5670 )
+ rSet.DisableItem( SID_PARASPACE_INCREASE );
+ if ( nSlotId == SID_ATTR_PARA_ULSPACE )
+ {
+ aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE);
+ rSet.Put(aULSpace);
+ }
}
else
- rSet.InvalidateItem(nSlotId);
+ {
+ rSet.DisableItem( SID_PARASPACE_INCREASE );
+ rSet.DisableItem( SID_PARASPACE_DECREASE );
+ rSet.InvalidateItem( SID_ATTR_PARA_ULSPACE );
+ }
}
- break;
+ break;
case SID_ATTR_CHAR_FONT:
case SID_ATTR_CHAR_FONTHEIGHT:
case SID_ATTR_CHAR_WEIGHT:
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index 1104ea63bdb6..eb1b039f79ab 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -242,7 +242,31 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
rReq.Done();
}
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 = std::min< sal_uInt16 >( nUpper + 57, 5670 );
+ nLower = std::min< sal_uInt16 >( nLower + 57, 5670 );
+ }
+ else
+ {
+ nUpper = std::max< sal_Int16 >( nUpper - 57, 0 );
+ nLower = std::max< sal_Int16 >( nLower - 57, 0 );
+ }
+ aULSpace.SetUpper( nUpper );
+ aULSpace.SetLower( nLower );
+ aNewAttr.Put( aULSpace );
+ rReq.Done();
+ }
+ break;
case SID_ATTR_PARA_LINESPACE_10:
{
SvxLineSpacingItem aItem(SVX_LINESPACE_ONE_LINE, EE_PARA_SBL);
@@ -695,16 +719,29 @@ ASK_ADJUST:
}
break;
case SID_ATTR_PARA_ULSPACE:
+ case SID_PARASPACE_INCREASE:
+ case SID_PARASPACE_DECREASE:
{
SfxItemState eState = aEditAttr.GetItemState(EE_PARA_ULSPACE);
if( eState >= SfxItemState::DEFAULT )
{
SvxULSpaceItem aULSpace = static_cast<const SvxULSpaceItem&>( aEditAttr.Get( EE_PARA_ULSPACE ) );
- aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE);
- rSet.Put(aULSpace);
+ if ( !aULSpace.GetUpper() && !aULSpace.GetLower() )
+ rSet.DisableItem( SID_PARASPACE_DECREASE );
+ else if ( aULSpace.GetUpper() >= 5670 && aULSpace.GetLower() >= 5670 )
+ rSet.DisableItem( SID_PARASPACE_INCREASE );
+ if ( nSlotId == SID_ATTR_PARA_ULSPACE )
+ {
+ aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE);
+ rSet.Put(aULSpace);
+ }
}
else
- rSet.InvalidateItem(nSlotId);
+ {
+ rSet.DisableItem( SID_PARASPACE_INCREASE );
+ rSet.DisableItem( SID_PARASPACE_DECREASE );
+ rSet.InvalidateItem( SID_ATTR_PARA_ULSPACE );
+ }
nSlotId = 0;
}
break;
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index d34fd736c3d2..e8d99b1d6c7f 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -751,7 +751,40 @@ void SwView::ExecTabWin( SfxRequest& rReq )
rSh.SetAttrItem( aParaMargin );
}
break;
+ case SID_PARASPACE_INCREASE:
+ case SID_PARASPACE_DECREASE:
+ {
+ SfxItemSet aULSpaceSet( GetPool(), RES_UL_SPACE, RES_UL_SPACE );
+ rSh.GetCurAttr( aULSpaceSet );
+ SvxULSpaceItem aULSpace(
+ static_cast< const SvxULSpaceItem& >( aULSpaceSet.Get( RES_UL_SPACE ) ) );
+ sal_uInt16 nUpper = aULSpace.GetUpper();
+ sal_uInt16 nLower = aULSpace.GetLower();
+
+ if ( nSlot == SID_PARASPACE_INCREASE )
+ {
+ nUpper = std::min< sal_uInt16 >( nUpper + 57, 5670 );
+ nLower = std::min< sal_uInt16 >( nLower + 57, 5670 );
+ }
+ else
+ {
+ nUpper = std::max< sal_Int16 >( nUpper - 57, 0 );
+ nLower = std::max< sal_Int16 >( nLower - 57, 0 );
+ }
+ aULSpace.SetUpper( nUpper );
+ aULSpace.SetLower( nLower );
+
+ SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl();
+ if( pColl && pColl->IsAutoUpdateFmt() )
+ {
+ aULSpaceSet.Put( aULSpace );
+ rSh.AutoUpdatePara( pColl, aULSpaceSet );
+ }
+ else
+ rSh.SetAttrItem( aULSpace );
+ }
+ break;
case SID_RULER_BORDERS_VERTICAL:
case SID_RULER_BORDERS:
if ( pReqArgs )
@@ -1253,15 +1286,29 @@ void SwView::StateTabWin(SfxItemSet& rSet)
}
case SID_ATTR_PARA_ULSPACE:
+ case SID_PARASPACE_INCREASE:
+ case SID_PARASPACE_DECREASE:
{
SvxULSpaceItem aUL = static_cast<const SvxULSpaceItem&>(aCoreSet.Get(RES_UL_SPACE));
- aUL.SetWhich(nWhich);
-
SfxItemState e = aCoreSet.GetItemState(RES_UL_SPACE);
if( e >= SfxItemState::DEFAULT )
- rSet.Put( aUL );
+ {
+ if ( !aUL.GetUpper() && !aUL.GetLower() )
+ rSet.DisableItem( SID_PARASPACE_DECREASE );
+ else if ( aUL.GetUpper() >= 5670 && aUL.GetLower() >= 5670 )
+ rSet.DisableItem( SID_PARASPACE_INCREASE );
+ if ( nWhich == SID_ATTR_PARA_ULSPACE )
+ {
+ aUL.SetWhich( SID_ATTR_PARA_ULSPACE );
+ rSet.Put( aUL );
+ }
+ }
else
- rSet.InvalidateItem(nWhich);
+ {
+ rSet.DisableItem( SID_PARASPACE_INCREASE );
+ rSet.DisableItem( SID_PARASPACE_DECREASE );
+ rSet.InvalidateItem( SID_ATTR_PARA_ULSPACE );
+ }
}
break;