[Libreoffice-commits] core.git: svx/source sw/source

Maxim Monastirsky momonasmon at gmail.com
Thu Jan 16 12:37:49 PST 2014


 svx/source/sidebar/text/TextPropertyPanel.cxx |   76 +++-----------------------
 sw/source/ui/shells/txtattr.cxx               |   12 ++--
 2 files changed, 16 insertions(+), 72 deletions(-)

New commits:
commit 75043c23c7d08fcc9b22a38fe08014d1381e2f90
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Mon Jan 13 11:44:50 2014 +0200

    fdo#73414 Remove Increase Font limits for Writer
    
    and re-use the same code in sidebar.
    
    Change-Id: Ic342be479f6f5b23ea2dd79b7cf6c77897b27dc1
    Reviewed-on: https://gerrit.libreoffice.org/7398
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx
index 0b8283e..8f29d2f 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.cxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -81,6 +81,8 @@ namespace svx { namespace sidebar {
 
 #undef HAS_IA2
 
+#define FN_GROW_FONT_SIZE       (FN_FORMAT + 3 )
+#define FN_SHRINK_FONT_SIZE     (FN_FORMAT + 4 )
 
 PopupControl* TextPropertyPanel::CreateCharacterSpacingControl (PopupContainer* pParent)
 {
@@ -579,72 +581,14 @@ IMPL_LINK(TextPropertyPanel, ToolboxIncDecSelectHdl, ToolBox*, pToolBox)
             if(aCommand == UNO_GROW)
             {
                 EndTracking();
-                mbFocusOnFontSizeCtrl = false;
-                sal_Int64 iValue = mpFontSizeBox->GetValue();
-                int iPos = mpFontSizeBox->GetValuePos(iValue, FUNIT_NONE);
-                long nSize = iValue;
-                if(iPos != LISTBOX_ENTRY_NOTFOUND)
-                    nSize = mpFontSizeBox->GetValue(iPos+1 , FUNIT_NONE);
-                else if(iValue >= 100 && iValue < 105)
-                    nSize = 105;
-                else if(iValue >= 105 && iValue < 110)
-                    nSize = 110;
-                else if(iValue < 960)
-                {
-                    nSize = (nSize / 10) * 10 + 10;
-                    while(nSize < 960 && mpFontSizeBox->GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
-                        nSize += 10;
-                }
-                else
-                {
-                    nSize = iValue;
-                }
-
-                float fSize = (float)nSize / 10;
-
-                SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
-                SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
-
-                mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
-                mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
-                mpFontSizeBox->SetValue( nSize );
+                SfxVoidItem aItem(FN_GROW_FONT_SIZE);
+                mpBindings->GetDispatcher()->Execute( FN_GROW_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
             }
             else if(aCommand == UNO_SHRINK)
             {
                 EndTracking();
-                mbFocusOnFontSizeCtrl = false;
-                sal_Int64 iValue = mpFontSizeBox->GetValue();
-                int iPos = mpFontSizeBox->GetValuePos(iValue, FUNIT_NONE);
-                long nSize = iValue;
-                if(iPos != LISTBOX_ENTRY_NOTFOUND)
-                    nSize = mpFontSizeBox->GetValue(iPos-1, FUNIT_NONE);
-                else if(iValue > 100 && iValue <= 105)
-                    nSize = 100;
-                else if(iValue > 105 && iValue <= 110)
-                    nSize = 105;
-                else if(iValue > 960)
-                {
-                    nSize = 960;
-                }
-                else if(iValue > 60)
-                {
-                    nSize = (nSize / 10) * 10 ;
-                    while(nSize > 60 && mpFontSizeBox->GetValuePos(nSize, FUNIT_NONE) == LISTBOX_ENTRY_NOTFOUND)
-                        nSize -= 10;
-                }
-                else
-                {
-                    nSize = iValue;
-                }
-
-                float fSize = (float)nSize / 10;
-
-                SfxMapUnit eUnit = maFontSizeControl.GetCoreMetric();
-                SvxFontHeightItem aItem( CalcToUnit( fSize, eUnit ), 100, SID_ATTR_CHAR_FONTHEIGHT ) ;
-
-                mpBindings->GetDispatcher()->Execute( SID_ATTR_CHAR_FONTHEIGHT, SFX_CALLMODE_RECORD, &aItem, 0L );
-                mpBindings->Invalidate(SID_ATTR_CHAR_FONTHEIGHT,true,false);
-                mpFontSizeBox->SetValue( nSize );
+                SfxVoidItem aItem(FN_SHRINK_FONT_SIZE);
+                mpBindings->GetDispatcher()->Execute( FN_SHRINK_FONT_SIZE, SFX_CALLMODE_RECORD, &aItem, 0L );
             }
     }
     UpdateItem(SID_ATTR_CHAR_FONTHEIGHT);
@@ -805,8 +749,8 @@ void TextPropertyPanel::NotifyItemUpdate (
 
                     default:
                     {
-                        mpToolBoxIncDec->EnableItem(nIncreaseId, bIsEnabled && nValue<960);
-                        mpToolBoxIncDec->EnableItem(nDecreaseId, bIsEnabled && nValue>60);
+                        mpToolBoxIncDec->EnableItem(nIncreaseId, bIsEnabled && nValue<9999);
+                        mpToolBoxIncDec->EnableItem(nDecreaseId, bIsEnabled && nValue>20);
                         break;
                     }
                 }
@@ -1073,11 +1017,11 @@ void TextPropertyPanel::NotifyItemUpdate (
                     const sal_Int64 nSize (mpFontSizeBox->GetValue());
                     if(nSID == SID_GROW_FONT_SIZE)
                     {
-                        mpToolBoxIncDec->EnableItem(mpToolBoxIncDec->GetItemId(UNO_GROW), bIsEnabled && nSize<960);
+                        mpToolBoxIncDec->EnableItem(mpToolBoxIncDec->GetItemId(UNO_GROW), bIsEnabled && nSize<9999);
                     }
                     else if (nSID == SID_SHRINK_FONT_SIZE)
                     {
-                        mpToolBoxIncDec->EnableItem(mpToolBoxIncDec->GetItemId(UNO_SHRINK), bIsEnabled && nSize>60);
+                        mpToolBoxIncDec->EnableItem(mpToolBoxIncDec->GetItemId(UNO_SHRINK), bIsEnabled && nSize>20);
                     }
                 }
             }
diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx
index 0acaf93..b952a4a 100644
--- a/sw/source/ui/shells/txtattr.cxx
+++ b/sw/source/ui/shells/txtattr.cxx
@@ -55,8 +55,8 @@
 #include <SwStyleNameMapper.hxx>
 #include "swabstdlg.hxx"
 #include "chrdlg.hrc"
-const SwTwips lFontInc = 2 * 20;           // ==> PointToTwips(2)
-const SwTwips lFontMaxSz = 72 * 20;        // ==> PointToTwips(72)
+const SwTwips lFontInc = 40;        // 2pt
+const SwTwips lFontMaxSz = 19998;   // 999.9pt
 
 
 
@@ -239,7 +239,7 @@ void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq)
                     SvxFontHeightItem aSize( *(const SvxFontHeightItem*)pI );
                     SwTwips lSize = (SwTwips) aSize.GetHeight();
 
-                    if (bGrow)
+                    if ( bGrow )
                     {
                         if( lSize == lFontMaxSz )
                             break;      // That's all, further up is not possible
@@ -248,10 +248,10 @@ void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq)
                     }
                     else
                     {
-                        if( 4 == lSize )
+                        if( lSize == lFontInc )
                             break;
-                        if( ( lSize -= lFontInc ) < 4 )
-                            lSize = 4;
+                        if( ( lSize -= lFontInc ) < lFontInc )
+                            lSize = lFontInc;
                     }
                     aSize.SetHeight( lSize );
                     aAttrSet.Put( aSize );


More information about the Libreoffice-commits mailing list