[Libreoffice-commits] core.git: sw/sdi sw/source sw/uiconfig
Maxim Monastirsky
momonasmon at gmail.com
Thu Jan 30 03:37:54 PST 2014
sw/sdi/drwtxtsh.sdi | 13 +++++
sw/source/ui/shells/drwtxtex.cxx | 50 +++++++++++++++++++++
sw/uiconfig/sglobal/toolbar/drawtextobjectbar.xml | 2
sw/uiconfig/sweb/toolbar/drawtextobjectbar.xml | 2
sw/uiconfig/swform/toolbar/drawtextobjectbar.xml | 2
sw/uiconfig/swreport/toolbar/drawtextobjectbar.xml | 2
sw/uiconfig/swriter/toolbar/drawtextobjectbar.xml | 2
sw/uiconfig/swxform/toolbar/drawtextobjectbar.xml | 2
8 files changed, 75 insertions(+)
New commits:
commit c885850e2e54da986bd85cfc00bc8a23c272704d
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date: Thu Jan 30 10:26:28 2014 +0200
Add Increase/Decrease font functionality to drawing objects
Change-Id: I9abfca6f8cefd1e1211a98fa36ce07a407c2fd06
Reviewed-on: https://gerrit.libreoffice.org/7655
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/sdi/drwtxtsh.sdi b/sw/sdi/drwtxtsh.sdi
index 23402a3..e019b76 100644
--- a/sw/sdi/drwtxtsh.sdi
+++ b/sw/sdi/drwtxtsh.sdi
@@ -609,6 +609,19 @@ interface TextDrawText
StateMethod = GetStatePropPanelAttr ;
DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
]
+
+ FN_GROW_FONT_SIZE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
+ FN_SHRINK_FONT_SIZE
+ [
+ ExecMethod = Execute ;
+ StateMethod = GetDrawTxtCtrlState ;
+ DisableFlags="SW_DISABLE_ON_PROTECTED_CURSOR";
+ ]
}
interface TextDrawFont
diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx
index 80a1049..43b0dfb 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);
diff --git a/sw/uiconfig/sglobal/toolbar/drawtextobjectbar.xml b/sw/uiconfig/sglobal/toolbar/drawtextobjectbar.xml
index f604605..5db228b 100644
--- a/sw/uiconfig/sglobal/toolbar/drawtextobjectbar.xml
+++ b/sw/uiconfig/sglobal/toolbar/drawtextobjectbar.xml
@@ -27,6 +27,8 @@
<toolbar:toolbaritem xlink:href=".uno:Underline"/>
<toolbar:toolbaritem xlink:href=".uno:SuperScript"/>
<toolbar:toolbaritem xlink:href=".uno:SubScript"/>
+ <toolbar:toolbaritem xlink:href=".uno:Grow"/>
+ <toolbar:toolbaritem xlink:href=".uno:Shrink"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:LeftPara" toolbar:style="radio"/>
<toolbar:toolbaritem xlink:href=".uno:CenterPara" toolbar:style="radio"/>
diff --git a/sw/uiconfig/sweb/toolbar/drawtextobjectbar.xml b/sw/uiconfig/sweb/toolbar/drawtextobjectbar.xml
index f604605..5db228b 100644
--- a/sw/uiconfig/sweb/toolbar/drawtextobjectbar.xml
+++ b/sw/uiconfig/sweb/toolbar/drawtextobjectbar.xml
@@ -27,6 +27,8 @@
<toolbar:toolbaritem xlink:href=".uno:Underline"/>
<toolbar:toolbaritem xlink:href=".uno:SuperScript"/>
<toolbar:toolbaritem xlink:href=".uno:SubScript"/>
+ <toolbar:toolbaritem xlink:href=".uno:Grow"/>
+ <toolbar:toolbaritem xlink:href=".uno:Shrink"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:LeftPara" toolbar:style="radio"/>
<toolbar:toolbaritem xlink:href=".uno:CenterPara" toolbar:style="radio"/>
diff --git a/sw/uiconfig/swform/toolbar/drawtextobjectbar.xml b/sw/uiconfig/swform/toolbar/drawtextobjectbar.xml
index f604605..5db228b 100644
--- a/sw/uiconfig/swform/toolbar/drawtextobjectbar.xml
+++ b/sw/uiconfig/swform/toolbar/drawtextobjectbar.xml
@@ -27,6 +27,8 @@
<toolbar:toolbaritem xlink:href=".uno:Underline"/>
<toolbar:toolbaritem xlink:href=".uno:SuperScript"/>
<toolbar:toolbaritem xlink:href=".uno:SubScript"/>
+ <toolbar:toolbaritem xlink:href=".uno:Grow"/>
+ <toolbar:toolbaritem xlink:href=".uno:Shrink"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:LeftPara" toolbar:style="radio"/>
<toolbar:toolbaritem xlink:href=".uno:CenterPara" toolbar:style="radio"/>
diff --git a/sw/uiconfig/swreport/toolbar/drawtextobjectbar.xml b/sw/uiconfig/swreport/toolbar/drawtextobjectbar.xml
index f604605..5db228b 100644
--- a/sw/uiconfig/swreport/toolbar/drawtextobjectbar.xml
+++ b/sw/uiconfig/swreport/toolbar/drawtextobjectbar.xml
@@ -27,6 +27,8 @@
<toolbar:toolbaritem xlink:href=".uno:Underline"/>
<toolbar:toolbaritem xlink:href=".uno:SuperScript"/>
<toolbar:toolbaritem xlink:href=".uno:SubScript"/>
+ <toolbar:toolbaritem xlink:href=".uno:Grow"/>
+ <toolbar:toolbaritem xlink:href=".uno:Shrink"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:LeftPara" toolbar:style="radio"/>
<toolbar:toolbaritem xlink:href=".uno:CenterPara" toolbar:style="radio"/>
diff --git a/sw/uiconfig/swriter/toolbar/drawtextobjectbar.xml b/sw/uiconfig/swriter/toolbar/drawtextobjectbar.xml
index f604605..5db228b 100644
--- a/sw/uiconfig/swriter/toolbar/drawtextobjectbar.xml
+++ b/sw/uiconfig/swriter/toolbar/drawtextobjectbar.xml
@@ -27,6 +27,8 @@
<toolbar:toolbaritem xlink:href=".uno:Underline"/>
<toolbar:toolbaritem xlink:href=".uno:SuperScript"/>
<toolbar:toolbaritem xlink:href=".uno:SubScript"/>
+ <toolbar:toolbaritem xlink:href=".uno:Grow"/>
+ <toolbar:toolbaritem xlink:href=".uno:Shrink"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:LeftPara" toolbar:style="radio"/>
<toolbar:toolbaritem xlink:href=".uno:CenterPara" toolbar:style="radio"/>
diff --git a/sw/uiconfig/swxform/toolbar/drawtextobjectbar.xml b/sw/uiconfig/swxform/toolbar/drawtextobjectbar.xml
index f604605..5db228b 100644
--- a/sw/uiconfig/swxform/toolbar/drawtextobjectbar.xml
+++ b/sw/uiconfig/swxform/toolbar/drawtextobjectbar.xml
@@ -27,6 +27,8 @@
<toolbar:toolbaritem xlink:href=".uno:Underline"/>
<toolbar:toolbaritem xlink:href=".uno:SuperScript"/>
<toolbar:toolbaritem xlink:href=".uno:SubScript"/>
+ <toolbar:toolbaritem xlink:href=".uno:Grow"/>
+ <toolbar:toolbaritem xlink:href=".uno:Shrink"/>
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:LeftPara" toolbar:style="radio"/>
<toolbar:toolbaritem xlink:href=".uno:CenterPara" toolbar:style="radio"/>
More information about the Libreoffice-commits
mailing list