diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2015-06-30 23:52:19 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2015-07-01 17:51:10 +0000 |
commit | 7adb6d218f50bbafea7998f67ed375c27694339c (patch) | |
tree | b84158e19737a1d941498dcdfc06f2d7c0359bc7 /sw | |
parent | f4f844952f1213283133fc848b0781bb0ce3bb53 (diff) |
tdf#86179 inc/dec font is missing in some shells
Mostly in Calc, but also for the SwAnnotationShell.
Also replace the current code in SwDrawTextShell with a call
to EditView::ChangeFontSize. The latter is able to handle
text with different sizes out of the box.
Change-Id: I4b55da579ea51683140bce0544e481606d7e5f3e
Reviewed-on: https://gerrit.libreoffice.org/16658
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/sdi/_annotsh.sdi | 14 | ||||
-rw-r--r-- | sw/source/uibase/shells/annotsh.cxx | 11 | ||||
-rw-r--r-- | sw/source/uibase/shells/drwtxtex.cxx | 41 |
3 files changed, 33 insertions, 33 deletions
diff --git a/sw/sdi/_annotsh.sdi b/sw/sdi/_annotsh.sdi index 232388c69187..43bef1e6b77c 100644 --- a/sw/sdi/_annotsh.sdi +++ b/sw/sdi/_annotsh.sdi @@ -230,6 +230,20 @@ interface _Annotation DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; ] + FN_GROW_FONT_SIZE + [ + ExecMethod = Exec; + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + + FN_SHRINK_FONT_SIZE + [ + ExecMethod = Exec; + StateMethod = GetState ; + DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR"; + ] + SID_ATTR_CHAR_COLOR // api: [ ExecMethod = Exec; diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index ba0a7f642c94..614b18177c98 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -31,6 +31,7 @@ #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/request.hxx> +#include <editeng/flstitem.hxx> #include <editeng/spltitem.hxx> #include <editeng/lrspitem.hxx> #include <editeng/ulspitem.hxx> @@ -245,6 +246,16 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) rReq.Done(); } break; + case FN_GROW_FONT_SIZE: + case FN_SHRINK_FONT_SIZE: + { + const SvxFontListItem* pFontListItem = static_cast< const SvxFontListItem* > + ( SfxObjectShell::Current()->GetItem( SID_ATTR_CHAR_FONTLIST ) ); + const FontList* pFontList = pFontListItem ? pFontListItem->GetFontList() : nullptr; + pOLV->GetEditView().ChangeFontSize( nSlot == FN_GROW_FONT_SIZE, pFontList ); + } + 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 57a8b3cb7438..d826f1293649 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -35,6 +35,7 @@ #include <editeng/kernitem.hxx> #include <editeng/escapementitem.hxx> #include <editeng/lspcitem.hxx> +#include <editeng/flstitem.hxx> #include <editeng/adjustitem.hxx> #include <editeng/crossedoutitem.hxx> #include <editeng/shdditem.hxx> @@ -99,9 +100,6 @@ #include "misc.hrc" #include <boost/scoped_ptr.hpp> -const sal_uInt32 nFontInc = 40; // 2pt -const sal_uInt32 nFontMaxSz = 19998; // 999.9pt - using namespace ::com::sun::star; void SwDrawTextShell::Execute( SfxRequest &rReq ) @@ -553,31 +551,10 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) case FN_GROW_FONT_SIZE: case FN_SHRINK_FONT_SIZE: { - SfxItemPool* pPool2 = aEditAttr.GetPool()->GetSecondaryPool(); - if( !pPool2 ) - pPool2 = aEditAttr.GetPool(); - - SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, *pPool2 ); - aSetItem.GetItemSet().Put( aEditAttr, false ); - - SvtScriptType nScriptTypes = pOLV->GetSelectedScriptType(); - const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptTypes ) ) ); - - if (pSize) - { - SvxFontHeightItem aSize(*pSize); - - sal_uInt32 nSize = aSize.GetHeight(); - - if( nSlot == FN_GROW_FONT_SIZE && ( nSize += nFontInc ) > nFontMaxSz ) - nSize = nFontMaxSz; - else if( nSlot == FN_SHRINK_FONT_SIZE && ( nSize -= nFontInc ) < nFontInc ) - nSize = nFontInc; - - aSize.SetHeight( nSize ); - aSetItem.PutItemForScriptType( nScriptTypes, aSize ); - aNewAttr.Put( aSetItem.GetItemSet() ); - } + const SvxFontListItem* pFontListItem = static_cast< const SvxFontListItem* > + ( SfxObjectShell::Current()->GetItem( SID_ATTR_CHAR_FONTLIST ) ); + const FontList* pFontList = pFontListItem ? pFontListItem->GetFontList() : nullptr; + pOLV->GetEditView().ChangeFontSize( nSlot == FN_GROW_FONT_SIZE, pFontList ); } break; @@ -945,14 +922,12 @@ void SwDrawTextShell::GetDrawTextCtrlState(SfxItemSet& rSet) aSetItem.GetItemSet().Put( aEditAttr, false ); const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptType ) ) ); - if( !pSize ) - rSet.DisableItem( nSlotId ); - else + if( pSize ) { sal_uInt32 nSize = pSize->GetHeight(); - if( nSize == nFontMaxSz ) + if( nSize >= 19998 ) rSet.DisableItem( FN_GROW_FONT_SIZE ); - else if( nSize == nFontInc ) + else if( nSize <= 40 ) rSet.DisableItem( FN_SHRINK_FONT_SIZE ); } } |