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 /sc | |
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 'sc')
-rw-r--r-- | sc/sdi/drtxtob.sdi | 2 | ||||
-rw-r--r-- | sc/sdi/editsh.sdi | 2 | ||||
-rw-r--r-- | sc/sdi/formatsh.sdi | 2 | ||||
-rw-r--r-- | sc/source/ui/drawfunc/drtxtob.cxx | 19 | ||||
-rw-r--r-- | sc/source/ui/view/editsh.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/view/formatsh.cxx | 31 |
6 files changed, 68 insertions, 0 deletions
diff --git a/sc/sdi/drtxtob.sdi b/sc/sdi/drtxtob.sdi index 9a77b17ca9a5..a6946e70bc3f 100644 --- a/sc/sdi/drtxtob.sdi +++ b/sc/sdi/drtxtob.sdi @@ -94,6 +94,8 @@ interface TableDrawText 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_GROW_FONT_SIZE [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] + SID_SHRINK_FONT_SIZE [ 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/sdi/editsh.sdi b/sc/sdi/editsh.sdi index 9bb5bd66f890..52cc6b4ac564 100644 --- a/sc/sdi/editsh.sdi +++ b/sc/sdi/editsh.sdi @@ -47,6 +47,8 @@ interface TableText SID_ATTR_CHAR_FONT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_ATTR_CHAR_FONTHEIGHT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] SID_ATTR_CHAR_COLOR [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] + SID_GROW_FONT_SIZE [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] + SID_SHRINK_FONT_SIZE [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] // ---- Attribut - Toggles: SID_ATTR_CHAR_WEIGHT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; Export = FALSE; ] diff --git a/sc/sdi/formatsh.sdi b/sc/sdi/formatsh.sdi index 903c5e5a0b16..a8bd8fbc0fb0 100644 --- a/sc/sdi/formatsh.sdi +++ b/sc/sdi/formatsh.sdi @@ -26,6 +26,8 @@ interface TableFont SID_ATTR_CHAR_PREVIEW_FONT [ ExecMethod = ExecuteAttr; ] SID_ATTR_CHAR_ENDPREVIEW_FONT [ ExecMethod = ExecuteAttr; ] SID_ATTR_CHAR_FONTHEIGHT [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ] + SID_GROW_FONT_SIZE [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ] + SID_SHRINK_FONT_SIZE [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ] SID_ATTR_CHAR_COLOR [ ExecMethod = ExecuteAttr; StateMethod = GetAttrState; ] SID_ATTR_CHAR_WEIGHT [ ExecMethod = ExecuteTextAttr; StateMethod = GetTextAttrState; ] SID_ATTR_CHAR_POSTURE [ ExecMethod = ExecuteTextAttr; StateMethod = GetTextAttrState; ] diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index ae5bb94123e1..c07b2dff7c03 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -27,8 +27,10 @@ #include <editeng/contouritem.hxx> #include <editeng/crossedoutitem.hxx> #include <editeng/editeng.hxx> +#include <editeng/editview.hxx> #include <editeng/escapementitem.hxx> #include <editeng/flditem.hxx> +#include <editeng/flstitem.hxx> #include <editeng/fontitem.hxx> #include <editeng/frmdiritem.hxx> #include <editeng/lrspitem.hxx> @@ -819,6 +821,23 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq ) } break; + case SID_GROW_FONT_SIZE: + case SID_SHRINK_FONT_SIZE: + { + OutlinerView* pOutView = pView->IsTextEdit() ? + pView->GetTextEditOutlinerView() : nullptr; + if ( pOutView ) + { + const SvxFontListItem* pFontListItem = static_cast< const SvxFontListItem* > + ( SfxObjectShell::Current()->GetItem( SID_ATTR_CHAR_FONTLIST ) ); + const FontList* pFontList = pFontListItem ? pFontListItem->GetFontList() : nullptr; + pOutView->GetEditView().ChangeFontSize( nSlot == SID_GROW_FONT_SIZE, pFontList ); + pViewData->GetBindings().Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); + bDone = false; + } + } + break; + case SID_CHAR_DLG_EFFECT: case SID_CHAR_DLG: // Dialog-Button case SID_ATTR_CHAR_FONT: // Controller nicht angezeigt diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index ea1a91265caa..676ba7c84b25 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -32,6 +32,7 @@ #include <editeng/editview.hxx> #include <editeng/escapementitem.hxx> #include <editeng/flditem.hxx> +#include <editeng/flstitem.hxx> #include <editeng/fontitem.hxx> #include <svx/hlnkitem.hxx> #include <sfx2/sidebar/EnumContext.hxx> @@ -1026,6 +1027,17 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq) } } break; + + case SID_GROW_FONT_SIZE: + case SID_SHRINK_FONT_SIZE: + { + const SvxFontListItem* pFontListItem = static_cast< const SvxFontListItem* > + ( SfxObjectShell::Current()->GetItem( SID_ATTR_CHAR_FONTLIST ) ); + const FontList* pFontList = pFontListItem ? pFontListItem->GetFontList() : nullptr; + pEditView->ChangeFontSize( nSlot == SID_GROW_FONT_SIZE, pFontList ); + rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); + } + break; } // anwenden diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 6ed2d7e03266..6badc3ecbcc6 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -55,6 +55,7 @@ #include <svtools/colorcfg.hxx> #include <editeng/shaditem.hxx> #include <editeng/justifyitem.hxx> +#include <editeng/fhgtitem.hxx> #include "formatsh.hxx" #include "sc.hrc" @@ -1607,6 +1608,36 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) { switch ( nSlot ) { + case SID_GROW_FONT_SIZE: + case SID_SHRINK_FONT_SIZE: + { + SfxItemPool& rPool = GetPool(); + SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, rPool ); + aSetItem.GetItemSet().Put( pTabViewShell->GetSelectionPattern()->GetItemSet(), false ); + + SvtScriptType nScriptTypes = pTabViewShell->GetSelectionScriptType(); + const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptTypes ) ) ); + + if ( pSize ) + { + SvxFontHeightItem aSize( *pSize ); + sal_uInt32 nSize = aSize.GetHeight(); + + const sal_uInt32 nFontInc = 40; // 2pt + const sal_uInt32 nFontMaxSz = 19998; // 999.9pt + if ( nSlot == SID_GROW_FONT_SIZE ) + nSize = std::min< sal_uInt32 >( nSize + nFontInc, nFontMaxSz ); + else + nSize = std::max< sal_Int32 >( nSize - nFontInc, nFontInc ); + + aSize.SetHeight( nSize ); + aSetItem.PutItemForScriptType( nScriptTypes, aSize ); + pTabViewShell->ApplyUserItemSet( aSetItem.GetItemSet() ); + } + rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); + } + break; + case SID_ATTR_CHAR_ENDPREVIEW_FONT: { pDoc->SetPreviewFont(NULL); |