summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2015-06-30 23:52:19 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2015-07-01 17:51:10 +0000
commit7adb6d218f50bbafea7998f67ed375c27694339c (patch)
treeb84158e19737a1d941498dcdfc06f2d7c0359bc7
parentf4f844952f1213283133fc848b0781bb0ce3bb53 (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>
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu22
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu22
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu22
-rw-r--r--sc/sdi/drtxtob.sdi2
-rw-r--r--sc/sdi/editsh.sdi2
-rw-r--r--sc/sdi/formatsh.sdi2
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx19
-rw-r--r--sc/source/ui/view/editsh.cxx12
-rw-r--r--sc/source/ui/view/formatsh.cxx31
-rw-r--r--svx/source/sidebar/text/TextPropertyPanel.cxx1
-rw-r--r--sw/sdi/_annotsh.sdi14
-rw-r--r--sw/source/uibase/shells/annotsh.cxx11
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx41
13 files changed, 123 insertions, 78 deletions
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
index 5b845f636cdd..9e611827be3f 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
@@ -1844,28 +1844,6 @@
<value>1</value>
</prop>
</node>
- <node oor:name=".uno:Grow" oor:op="replace">
- <prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="en-US">Increase Font Size</value>
- </prop>
- <prop oor:name="ContextLabel" oor:type="xs:string">
- <value xml:lang="en-US">Increase Size</value>
- </prop>
- <prop oor:name="Properties" oor:type="xs:int">
- <value>1</value>
- </prop>
- </node>
- <node oor:name=".uno:Shrink" oor:op="replace">
- <prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="en-US">Decrease Font Size</value>
- </prop>
- <prop oor:name="ContextLabel" oor:type="xs:string">
- <value xml:lang="en-US">Decrease Size</value>
- </prop>
- <prop oor:name="Properties" oor:type="xs:int">
- <value>1</value>
- </prop>
- </node>
<node oor:name=".uno:UnderlineDouble" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Double Underline </value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
index d221d56c8d86..1f33ada79e68 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu
@@ -1404,6 +1404,28 @@
<value>9</value>
</prop>
</node>
+ <node oor:name=".uno:Grow" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Increase Font Size</value>
+ </prop>
+ <prop oor:name="ContextLabel" oor:type="xs:string">
+ <value xml:lang="en-US">Increase Size</value>
+ </prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <value>1</value>
+ </prop>
+ </node>
+ <node oor:name=".uno:Shrink" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Decrease Font Size</value>
+ </prop>
+ <prop oor:name="ContextLabel" oor:type="xs:string">
+ <value xml:lang="en-US">Decrease Size</value>
+ </prop>
+ <prop oor:name="Properties" oor:type="xs:int">
+ <value>1</value>
+ </prop>
+ </node>
<node oor:name=".uno:ModuleDialog" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Select Module</value>
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
index 3069395f1c1a..d85988e128d2 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu
@@ -615,28 +615,6 @@
<value xml:lang="en-US">Page Number</value>
</prop>
</node>
- <node oor:name=".uno:Grow" oor:op="replace">
- <prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="en-US">Increase Font Size</value>
- </prop>
- <prop oor:name="ContextLabel" oor:type="xs:string">
- <value xml:lang="en-US">Increase Size</value>
- </prop>
- <prop oor:name="Properties" oor:type="xs:int">
- <value>1</value>
- </prop>
- </node>
- <node oor:name=".uno:Shrink" oor:op="replace">
- <prop oor:name="Label" oor:type="xs:string">
- <value xml:lang="en-US">Decrease Font Size</value>
- </prop>
- <prop oor:name="ContextLabel" oor:type="xs:string">
- <value xml:lang="en-US">Decrease Size</value>
- </prop>
- <prop oor:name="Properties" oor:type="xs:int">
- <value>1</value>
- </prop>
- </node>
<node oor:name=".uno:PageStyleName" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Page Style</value>
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);
diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx
index a831ab9cd162..63a122a2060a 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.cxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -142,7 +142,6 @@ void TextPropertyPanel::HandleContextChange (
return;
maContext = rContext;
- mpToolBoxIncDec->Show(maContext.GetApplication_DI() != sfx2::sidebar::EnumContext::Application_Calc);
bool bWriterText = false;
bool bDrawText = false;
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 );
}
}