summaryrefslogtreecommitdiffstats
path: root/sw/source/ui/shells
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2014-01-30 10:26:28 +0200
committerCaolán McNamara <caolanm@redhat.com>2014-01-30 11:37:32 +0000
commitc885850e2e54da986bd85cfc00bc8a23c272704d (patch)
treeb92bf0ece25035662ce0d5d179e50dea24e72df7 /sw/source/ui/shells
parentreset Stati is presumably to reset state (diff)
downloadcore-c885850e2e54da986bd85cfc00bc8a23c272704d.tar.gz
core-c885850e2e54da986bd85cfc00bc8a23c272704d.zip
Add Increase/Decrease font functionality to drawing objects
Change-Id: I9abfca6f8cefd1e1211a98fa36ce07a407c2fd06 Reviewed-on: https://gerrit.libreoffice.org/7655 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/ui/shells')
-rw-r--r--sw/source/ui/shells/drwtxtex.cxx50
1 files changed, 50 insertions, 0 deletions
diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx
index 80a1049bf6da..43b0dfb54aec 100644
--- a/sw/source/ui/shells/drwtxtex.cxx
+++ b/sw/source/ui/shells/drwtxtex.cxx
@@ -101,6 +101,8 @@
#include "chrdlg.hrc"
#include "misc.hrc"
+const sal_uInt32 nFontInc = 40; // 2pt
+const sal_uInt32 nFontMaxSz = 19998; // 999.9pt
using namespace ::com::sun::star;
@@ -548,6 +550,32 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
rSh.GetView().AttrChangedNotify( &rSh );
}
return;
+
+ 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 );
+
+ sal_uInt16 nScriptTypes = pOLV->GetSelectedScriptType();
+ SvxFontHeightItem aSize( *static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptTypes ) ) );
+ 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() );
+ }
+ break;
+
default:
OSL_ENSURE(!this, "wrong dispatcher");
return;
@@ -888,6 +916,28 @@ void SwDrawTextShell::GetDrawTxtCtrlState(SfxItemSet& rSet)
case SID_ATTR_CHAR_SCALEWIDTH: nEEWhich = EE_CHAR_FONTWIDTH;break;
case SID_ATTR_CHAR_AUTOKERN : nEEWhich = EE_CHAR_PAIRKERNING; break;
case SID_ATTR_CHAR_ESCAPEMENT: nEEWhich = EE_CHAR_ESCAPEMENT; break;
+ case FN_GROW_FONT_SIZE:
+ case FN_SHRINK_FONT_SIZE:
+ {
+ SfxItemPool* pEditPool = aEditAttr.GetPool()->GetSecondaryPool();
+ if( !pEditPool )
+ pEditPool = aEditAttr.GetPool();
+
+ SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, *pEditPool );
+ aSetItem.GetItemSet().Put( aEditAttr, false );
+ const SvxFontHeightItem* aSize( static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptType ) ) );
+
+ if( !aSize )
+ rSet.DisableItem( nSlotId );
+ else
+ {
+ sal_uInt32 nSize = aSize->GetHeight();
+ if( nSize == nFontMaxSz )
+ rSet.DisableItem( FN_GROW_FONT_SIZE );
+ else if( nSize == nFontInc )
+ rSet.DisableItem( FN_SHRINK_FONT_SIZE );
+ }
+ }
}
if(nEEWhich)
rSet.Put(aEditAttr.Get(nEEWhich, sal_True), nWhich);