From 431950e1eade91f8587d3ecffa73fd09136e16b6 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 11 Nov 2019 12:22:56 +0000 Subject: tdf#121239 give writer, calc and draw/impress the same underline options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit uno:Underline is the "real" deal, and has multiple underline options uno:UnderlineSimple is "some underline on" vs no underline calc and writer had UnderlineSingle, UnderlineDouble and UnderlineDotted for that specific type of underline on vs not-on add those to draw/impress too and then use UnderlineSingle instead of Underline in the format menu so that when UnderlineDouble is applied, UnderlineSingle is not show as applied, instead of using Underline ot UnderlineSimple which would show as on if UnderlineDouble was applied Change-Id: I6f9fcf37c2c90d215ea52b536e4fa84734754850 Reviewed-on: https://gerrit.libreoffice.org/82469 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sd/source/ui/view/drtxtob.cxx | 29 +++++++++++++++++++++++++++++ sd/source/ui/view/drtxtob1.cxx | 32 ++++++++++++++++++++++++++++++++ sd/source/ui/view/drviews2.cxx | 32 ++++++++++++++++++++++++++++++++ sd/source/ui/view/drviewsf.cxx | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 127 insertions(+) (limited to 'sd/source') diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx index 022250103593..089964333274 100644 --- a/sd/source/ui/view/drtxtob.cxx +++ b/sd/source/ui/view/drtxtob.cxx @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -376,6 +377,34 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) } break; + case SID_ULINE_VAL_NONE: + case SID_ULINE_VAL_SINGLE: + case SID_ULINE_VAL_DOUBLE: + case SID_ULINE_VAL_DOTTED: + { + if( aAttrSet.GetItemState( EE_CHAR_UNDERLINE ) >= SfxItemState::DEFAULT ) + { + FontLineStyle eLineStyle = aAttrSet.Get(EE_CHAR_UNDERLINE).GetLineStyle(); + + switch (nSlotId) + { + case SID_ULINE_VAL_NONE: + rSet.Put(SfxBoolItem(nSlotId, eLineStyle == LINESTYLE_NONE)); + break; + case SID_ULINE_VAL_SINGLE: + rSet.Put(SfxBoolItem(nSlotId, eLineStyle == LINESTYLE_SINGLE)); + break; + case SID_ULINE_VAL_DOUBLE: + rSet.Put(SfxBoolItem(nSlotId, eLineStyle == LINESTYLE_DOUBLE)); + break; + case SID_ULINE_VAL_DOTTED: + rSet.Put(SfxBoolItem(nSlotId, eLineStyle == LINESTYLE_DOTTED)); + break; + } + } + } + break; + case SID_GROW_FONT_SIZE: case SID_SHRINK_FONT_SIZE: { diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index c686630d6a2d..0b06a88c267b 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -551,6 +551,38 @@ void TextObjectBar::Execute( SfxRequest &rReq ) EE_CHAR_UNDERLINE ) ); } break; + + case SID_ULINE_VAL_NONE: + { + aNewAttr.Put(SvxUnderlineItem(LINESTYLE_NONE, EE_CHAR_UNDERLINE)); + break; + } + + case SID_ULINE_VAL_SINGLE: + case SID_ULINE_VAL_DOUBLE: + case SID_ULINE_VAL_DOTTED: + { + FontLineStyle eOld = aEditAttr.Get(EE_CHAR_UNDERLINE).GetLineStyle(); + FontLineStyle eNew = eOld; + + switch (nSlot) + { + case SID_ULINE_VAL_SINGLE: + eNew = ( eOld == LINESTYLE_SINGLE ) ? LINESTYLE_NONE : LINESTYLE_SINGLE; + break; + case SID_ULINE_VAL_DOUBLE: + eNew = ( eOld == LINESTYLE_DOUBLE ) ? LINESTYLE_NONE : LINESTYLE_DOUBLE; + break; + case SID_ULINE_VAL_DOTTED: + eNew = ( eOld == LINESTYLE_DOTTED ) ? LINESTYLE_NONE : LINESTYLE_DOTTED; + break; + } + + SvxUnderlineItem aUnderline(eNew, EE_CHAR_UNDERLINE); + aNewAttr.Put(aUnderline); + } + break; + case SID_ATTR_CHAR_OVERLINE: { FontLineStyle eFO = aEditAttr.Get( EE_CHAR_OVERLINE ).GetLineStyle(); diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 00a595becb44..435aea90a925 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -3560,6 +3560,38 @@ void DrawViewShell::ExecChar( SfxRequest &rReq ) } } break; + + case SID_ULINE_VAL_NONE: + { + aNewAttr.Put(SvxUnderlineItem(LINESTYLE_NONE, EE_CHAR_UNDERLINE)); + break; + } + + case SID_ULINE_VAL_SINGLE: + case SID_ULINE_VAL_DOUBLE: + case SID_ULINE_VAL_DOTTED: + { + FontLineStyle eOld = aEditAttr.Get(EE_CHAR_UNDERLINE).GetLineStyle(); + FontLineStyle eNew = eOld; + + switch (nSId) + { + case SID_ULINE_VAL_SINGLE: + eNew = ( eOld == LINESTYLE_SINGLE ) ? LINESTYLE_NONE : LINESTYLE_SINGLE; + break; + case SID_ULINE_VAL_DOUBLE: + eNew = ( eOld == LINESTYLE_DOUBLE ) ? LINESTYLE_NONE : LINESTYLE_DOUBLE; + break; + case SID_ULINE_VAL_DOTTED: + eNew = ( eOld == LINESTYLE_DOTTED ) ? LINESTYLE_NONE : LINESTYLE_DOTTED; + break; + } + + SvxUnderlineItem aUnderline(eNew, EE_CHAR_UNDERLINE); + aNewAttr.Put(aUnderline); + } + break; + case SID_ATTR_CHAR_SHADOWED: if( rReq.GetArgs() ) { diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index ab8a9a720131..f5bffd9929d4 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -365,6 +366,39 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) Invalidate(SID_ATTR_PARA_ULSPACE); } break; + case SID_ULINE_VAL_NONE: + case SID_ULINE_VAL_SINGLE: + case SID_ULINE_VAL_DOUBLE: + case SID_ULINE_VAL_DOTTED: + { + SfxItemSet aAttrs( GetDoc()->GetPool() ); + mpDrawView->GetAttributes( aAttrs ); + if( aAttrs.GetItemState( EE_CHAR_UNDERLINE ) >= SfxItemState::DEFAULT ) + { + FontLineStyle eLineStyle = aAttrs.Get(EE_CHAR_UNDERLINE).GetLineStyle(); + + switch (nSlotId) + { + case SID_ULINE_VAL_NONE: + rSet.Put(SfxBoolItem(nSlotId, eLineStyle == LINESTYLE_NONE)); + break; + case SID_ULINE_VAL_SINGLE: + rSet.Put(SfxBoolItem(nSlotId, eLineStyle == LINESTYLE_SINGLE)); + break; + case SID_ULINE_VAL_DOUBLE: + rSet.Put(SfxBoolItem(nSlotId, eLineStyle == LINESTYLE_DOUBLE)); + break; + case SID_ULINE_VAL_DOTTED: + rSet.Put(SfxBoolItem(nSlotId, eLineStyle == LINESTYLE_DOTTED)); + break; + } + } + + bAttr = true; + + Invalidate(nSlotId); + } + break; case SID_ATTR_FILL_STYLE: case SID_ATTR_FILL_COLOR: case SID_ATTR_FILL_GRADIENT: -- cgit v1.2.3