diff options
author | Gülşah Köse <gulsah.kose@collabora.com> | 2019-03-27 18:40:37 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-03-28 09:50:45 +0100 |
commit | 6f41502b82fa108246b7547d9da3c6bf6b42f72f (patch) | |
tree | 876507e2a5b0bf52e2864025add61fb560df25b5 /sd/source/ui/view | |
parent | 4fda02a8310dbb42b504f379e3f2f594391b16cb (diff) |
Implement sidebar increase/decrease indent buttons on Impress
Change-Id: Ie7c115e041a6dee7b5e5d938ad3fbf37cf9bc89b
Reviewed-on: https://gerrit.libreoffice.org/69840
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sd/source/ui/view')
-rw-r--r-- | sd/source/ui/view/drtxtob.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob1.cxx | 53 |
2 files changed, 55 insertions, 0 deletions
diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index fc55682275e9..b4430486834d 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -434,6 +434,8 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) rSet.DisableItem( SID_ATTR_PARA_LINESPACE_10 ); rSet.DisableItem( SID_ATTR_PARA_LINESPACE_15 ); rSet.DisableItem( SID_ATTR_PARA_LINESPACE_20 ); + rSet.DisableItem( SID_DEC_INDENT ); + rSet.DisableItem( SID_INC_INDENT ); rSet.DisableItem( SID_PARASPACE_INCREASE ); rSet.DisableItem( SID_PARASPACE_DECREASE ); rSet.DisableItem( SID_TEXTDIRECTION_TOP_TO_BOTTOM ); diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index 898643cb79e3..2cdd86ad58a2 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -130,6 +130,59 @@ void TextObjectBar::Execute( SfxRequest &rReq ) } break; + case SID_INC_INDENT: + case SID_DEC_INDENT: + { + if( pOLV ) + { + ESelection aSel = pOLV->GetSelection(); + aSel.Adjust(); + sal_Int32 nStartPara = aSel.nStartPara; + sal_Int32 nEndPara = aSel.nEndPara; + if( !aSel.HasRange() ) + { + nStartPara = 0; + nEndPara = pOLV->GetOutliner()->GetParagraphCount() - 1; + } + for( sal_Int32 nPara = nStartPara; nPara <= nEndPara; nPara++ ) + { + SfxStyleSheet* pStyleSheet = nullptr; + if (pOLV->GetOutliner() != nullptr) + pStyleSheet = pOLV->GetOutliner()->GetStyleSheet(nPara); + if (pStyleSheet != nullptr) + { + SfxItemSet aAttr( pStyleSheet->GetItemSet() ); + SfxItemSet aTmpSet( pOLV->GetOutliner()->GetParaAttribs( nPara ) ); + aAttr.Put( aTmpSet, false ); + const SvxLRSpaceItem& rItem = aAttr.Get( EE_PARA_LRSPACE ); + std::unique_ptr<SvxLRSpaceItem> pNewItem(static_cast<SvxLRSpaceItem*>(rItem.Clone())); + + long nLeft = pNewItem->GetLeft(); + if( nSlot == SID_INC_INDENT ) + nLeft += 1000; + else + { + nLeft -= 1000; + nLeft = std::max<long>( nLeft, 0 ); + } + pNewItem->SetLeftValue( static_cast<sal_uInt16>(nLeft) ); + + SfxItemSet aNewAttrs( aAttr ); + aNewAttrs.Put( *pNewItem ); + pNewItem.reset(); + pOLV->GetOutliner()->SetParaAttribs( nPara, aNewAttrs ); + } + } + } + rReq.Done(); + + Invalidate(); + // to refresh preview (in outline mode), slot has to be invalidated: + mpViewShell->GetViewFrame()->GetBindings().Invalidate( SID_PREVIEW_STATE, true ); + + } + break; + case SID_PARASPACE_INCREASE: case SID_PARASPACE_DECREASE: { |