[Libreoffice-commits] core.git: officecfg/registry sc/sdi sc/source svx/source sw/sdi sw/source

Maxim Monastirsky momonasmon at gmail.com
Wed Jul 1 10:51:38 PDT 2015


 officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu |   22 -----
 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu     |   22 +++++
 officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu      |   22 -----
 sc/sdi/drtxtob.sdi                                                       |    2 
 sc/sdi/editsh.sdi                                                        |    2 
 sc/sdi/formatsh.sdi                                                      |    2 
 sc/source/ui/drawfunc/drtxtob.cxx                                        |   19 ++++
 sc/source/ui/view/editsh.cxx                                             |   12 ++
 sc/source/ui/view/formatsh.cxx                                           |   31 +++++++
 svx/source/sidebar/text/TextPropertyPanel.cxx                            |    1 
 sw/sdi/_annotsh.sdi                                                      |   14 +++
 sw/source/uibase/shells/annotsh.cxx                                      |   11 ++
 sw/source/uibase/shells/drwtxtex.cxx                                     |   41 +---------
 13 files changed, 123 insertions(+), 78 deletions(-)

New commits:
commit 7adb6d218f50bbafea7998f67ed375c27694339c
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Tue Jun 30 23:52:19 2015 +0300

    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 at libreoffice.org>
    Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>

diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu
index 5b845f6..9e61182 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 d221d56..1f33ada 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 3069395..d85988e 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 9a77b17..a6946e7 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 9bb5bd6..52cc6b4 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 903c5e5..a8bd8fb 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 ae5bb94..c07b2df 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 ea1a912..676ba7c 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 6ed2d7e..6badc3e 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 a831ab9..63a122a 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 232388c..43bef1e 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 ba0a7f6..614b181 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 57a8b3c..d826f12 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 );
                 }
             }


More information about the Libreoffice-commits mailing list