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

Tomaž Vajngerl tomaz.vajngerl at collabora.com
Mon Aug 25 12:32:45 PDT 2014


 include/svx/zoomsliderctrl.hxx         |    6 +
 sc/source/ui/view/tabcont.cxx          |    3 
 sc/source/ui/view/tabview.cxx          |   60 +++++++--------
 svx/source/stbctrls/zoomsliderctrl.cxx |   87 +++++++---------------
 sw/source/uibase/shells/drwtxtsh.cxx   |  125 ++++++++++++++++-----------------
 5 files changed, 125 insertions(+), 156 deletions(-)

New commits:
commit 1d1d1c62caf2ee6a96946e96d782e03f3ef80439
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Mon Aug 25 18:20:58 2014 +0200

    fdo#36772 Move the scrollbar and sheet tabs in a separate row.
    
    Change-Id: I57d891d9f6e89dafb4840a577ba55baa734fdcc2

diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index df49a42..3bfeb99 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -39,8 +39,7 @@
 
 ScTabControl::ScTabControl( Window* pParent, ScViewData* pData ) :
     TabBar( pParent,
-            WinBits(WB_BORDER | WB_3DLOOK | WB_SCROLL | WB_RANGESELECT |
-                    WB_MULTISELECT | WB_DRAG | WB_SIZEABLE) ),
+            WinBits(WB_BORDER | WB_3DLOOK | WB_SCROLL | WB_RANGESELECT | WB_MULTISELECT | WB_DRAG ) ),
             DropTargetHelper( this ),
             DragSourceHelper( this ),
             pViewData( pData ),
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 02b99b9..1b2520b 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -57,9 +57,6 @@
 #define SPLIT_HANDLE_SIZE   5
 #define SC_ICONSIZE     36
 
-#define SC_SCROLLBAR_MIN    30
-#define SC_TABBAR_MIN       6
-
 using namespace ::com::sun::star;
 
 //  Corner-Button
@@ -341,7 +338,12 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner )
     aBorderPos = rOffset;
     aFrameSize = rSize;
 
+    const StyleSettings& rStyleSettings = pFrameWin->GetSettings().GetStyleSettings();
+
+    sal_Int32 nTabWidth = pFrameWin->GetFont().GetHeight() + 4;
+
     if ( aViewData.GetHSplitMode() != SC_SPLIT_NONE )
+    {
         if ( aViewData.GetHSplitPos() > nSizeX - SPLIT_MARGIN )
         {
             aViewData.SetHSplitMode( SC_SPLIT_NONE );
@@ -349,7 +351,9 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner )
                 ActivatePart( SC_SPLIT_BOTTOMLEFT );
             InvalidateSplit();
         }
+    }
     if ( aViewData.GetVSplitMode() != SC_SPLIT_NONE )
+    {
         if ( aViewData.GetVSplitPos() > nSizeY - SPLIT_MARGIN )
         {
             aViewData.SetVSplitMode( SC_SPLIT_NONE );
@@ -357,12 +361,13 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner )
                 ActivatePart( SC_SPLIT_BOTTOMLEFT );
             InvalidateSplit();
         }
+    }
 
     UpdateShow();
 
     if (bHScroll || bVScroll)       // Scrollbars horizontal oder vertikal
     {
-        long nScrollBarSize = pFrameWin->GetSettings().GetStyleSettings().GetScrollBarSize();
+        long nScrollBarSize = rStyleSettings.GetScrollBarSize();
         if (bVScroll)
         {
             nBarX = nScrollBarSize;
@@ -370,7 +375,7 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner )
         }
         if (bHScroll)
         {
-            nBarY = nScrollBarSize;
+            nBarY = nScrollBarSize + nTabWidth;
             nSizeY -= nBarY - nOverlap;
         }
 
@@ -401,7 +406,6 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner )
             }
             nSizeRt = nSizeX - nSizeLt - nSizeSp;
 
-            long nTabSize = 0;
             if (bTabControl)
             {
                 // pending relative tab bar width from extended document options
@@ -410,39 +414,30 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner )
                     SetRelTabBarWidth( mfPendingTabBarWidth );
                     mfPendingTabBarWidth = -1.0;
                 }
-
-                nTabSize = pTabControl->GetSizePixel().Width()-nOverlap;
-
-                if ( aViewData.GetHSplitMode() != SC_SPLIT_FIX )    // bei linkem Scrollbar
-                {
-                    if (nTabSize > nSizeLt-SC_SCROLLBAR_MIN) nTabSize = nSizeLt-SC_SCROLLBAR_MIN;
-                    if (nTabSize < SC_TABBAR_MIN) nTabSize = SC_TABBAR_MIN;
-                    nSizeLt -= nTabSize;
-                }
-                else                                                // bei rechtem Scrollbar
-                {
-                    if (nTabSize > nSizeRt-SC_SCROLLBAR_MIN) nTabSize = nSizeRt-SC_SCROLLBAR_MIN;
-                    if (nTabSize < SC_TABBAR_MIN) nTabSize = SC_TABBAR_MIN;
-                    nSizeRt -= nTabSize;
-                }
             }
 
-            lcl_SetPosSize( *pTabControl, Point(nPosX-nOverlap, nPosY+nSizeY),
-                                                Size(nTabSize+nOverlap, nBarY), nTotalWidth, bLayoutRTL );
+            Point aTabPoint(nPosX - nOverlap, nPosY + nSizeY + nScrollBarSize);
+            Size aTabSize(nSizeX, nBarY - nScrollBarSize);
+            lcl_SetPosSize( *pTabControl, aTabPoint, aTabSize, nTotalWidth, bLayoutRTL );
             pTabControl->SetSheetLayoutRTL( bLayoutRTL );
 
-            lcl_SetPosSize( aHScrollLeft, Point(nPosX+nTabSize-nOverlap, nPosY+nSizeY),
-                                                Size(nSizeLt+2*nOverlap, nBarY), nTotalWidth, bLayoutRTL );
-            lcl_SetPosSize( *pHSplitter, Point( nPosX+nTabSize+nSizeLt, nPosY+nSizeY ),
-                                            Size( nSizeSp, nBarY ), nTotalWidth, bLayoutRTL );
-            lcl_SetPosSize( aHScrollRight, Point(nPosX+nTabSize+nSizeLt+nSizeSp-nOverlap,
-                                                    nPosY+nSizeY),
-                                            Size(nSizeRt+2*nOverlap, nBarY), nTotalWidth, bLayoutRTL );
+            Point aHScrollLeftPoint(nPosX - nOverlap, nPosY + nSizeY);
+            Size aHScrollLeftSize(nSizeLt + 2 * nOverlap, nScrollBarSize);
+            lcl_SetPosSize( aHScrollLeft, aHScrollLeftPoint, aHScrollLeftSize, nTotalWidth, bLayoutRTL );
+
+            Point aHSplitterPoint(nPosX + nSizeLt, nPosY + nSizeY);
+            Size aHSplitterSize(nSizeSp, nScrollBarSize);
+            lcl_SetPosSize( *pHSplitter, aHSplitterPoint, aHSplitterSize, nTotalWidth, bLayoutRTL );
+
+            Point aHScrollRightPoint(nPosX + nSizeLt + nSizeSp - nOverlap, nPosY + nSizeY);
+            Size aHScrollRightSize(nSizeRt + 2 * nOverlap, nScrollBarSize);
+
+            lcl_SetPosSize( aHScrollRight, aHScrollRightPoint, aHScrollRightSize, nTotalWidth, bLayoutRTL );
 
             //  SetDragRectPixel is done below
         }
 
-        if (bVScroll)                               // Scrollbars vertikal
+        if (bVScroll)
         {
             long nSizeUp = 0;       // upper scroll bar
             long nSizeSp = 0;       // splitter
@@ -560,7 +555,8 @@ void ScTabView::DoResize( const Point& rOffset, const Size& rSize, bool bInner )
         }
         nSplitPosX = aViewData.GetHSplitPos();
         lcl_SetPosSize( *pHSplitter,
-            Point( nSplitPosX, nOutPosY ), Size( nSplitSizeX, nSplitHeight ), nTotalWidth, bLayoutRTL );
+                        Point(nSplitPosX, nOutPosY),
+                        Size( nSplitSizeX, nSplitHeight - nTabWidth ), nTotalWidth, bLayoutRTL );
         nLeftSize = nSplitPosX - nPosX;
         nSplitPosX += nSplitSizeX;
         nRightSize = nSizeX - nLeftSize - nSplitSizeX;
commit ae71b8305cf4385643bf04a0d524443de3dada62
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Mon Aug 25 18:15:52 2014 +0200

    reduce nesting at SID_CHINESE_CONVERSION
    
    Change-Id: I9ebf5f39b58839b79bdef9a93a2113d7566d05da

diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index 0a9d6f7..ddd535f 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -170,7 +170,6 @@ void SwDrawTextShell::SetAttrToMarked(const SfxItemSet& rAttr)
     if (aNullRect != aOutRect)
     {
         GetShell().GetDrawView()->SetAttributes(rAttr);
-//      Init();
     }
 }
 
@@ -283,87 +282,87 @@ void SwDrawTextShell::GetFormTextState(SfxItemSet& rSet)
 void SwDrawTextShell::ExecDrawLingu(SfxRequest &rReq)
 {
     SwWrtShell &rSh = GetShell();
-    OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
+    OutlinerView* pOutlinerView = pSdrView->GetTextEditOutlinerView();
     if( rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() )
     {
         switch(rReq.GetSlot())
         {
         case SID_THESAURUS:
-            pOLV->StartThesaurus();
+            pOutlinerView->StartThesaurus();
             break;
 
         case SID_HANGUL_HANJA_CONVERSION:
-            pOLV->StartTextConversion( LANGUAGE_KOREAN, LANGUAGE_KOREAN, NULL,
-                    i18n::TextConversionOption::CHARACTER_BY_CHARACTER, true, false );
+            pOutlinerView->StartTextConversion(LANGUAGE_KOREAN, LANGUAGE_KOREAN, NULL,
+                    i18n::TextConversionOption::CHARACTER_BY_CHARACTER, true, false);
             break;
 
         case SID_CHINESE_CONVERSION:
             {
                 //open ChineseTranslationDialog
-                Reference< XComponentContext > xContext(
-                    ::cppu::defaultBootstrap_InitialComponentContext() ); //@todo get context from calc if that has one
-                if(xContext.is())
+                Reference<XComponentContext> xContext = comphelper::getProcessComponentContext();
+                if (!xContext.is())
+                    return;
+
+                Reference<lang::XMultiComponentFactory> xMCF(xContext->getServiceManager());
+                if (!xMCF.is())
+                    return;
+
+                OUString sService("com.sun.star.linguistic2.ChineseTranslationDialog");
+                Reference<ui::dialogs::XExecutableDialog> xDialog(
+                        xMCF->createInstanceWithContext(sService, xContext), UNO_QUERY);
+
+                Reference<lang::XInitialization> xInit(xDialog, UNO_QUERY);
+
+                if (!xInit.is())
+                    return;
+
+                //  initialize dialog
+                Reference<awt::XWindow> xDialogParentWindow(0);
+                Sequence<Any> aSequence(1);
+                Any* pArray = aSequence.getArray();
+                PropertyValue aParam;
+                aParam.Name = "ParentWindow";
+                aParam.Value <<= makeAny(xDialogParentWindow);
+                pArray[0] <<= makeAny(aParam);
+                xInit->initialize( aSequence );
+
+                //execute dialog
+                sal_Int16 nDialogRet = xDialog->execute();
+                if(RET_OK == nDialogRet)
                 {
-                    Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager() );
-                    if(xMCF.is())
+                    //get some parameters from the dialog
+                    bool bToSimplified = true;
+                    bool bUseVariants = true;
+                    bool bCommonTerms = true;
+                    Reference<beans::XPropertySet> xPropertySet(xDialog, UNO_QUERY);
+                    if (xPropertySet.is())
                     {
-                        Reference< ui::dialogs::XExecutableDialog > xDialog(
-                                xMCF->createInstanceWithContext(
-                                    OUString("com.sun.star.linguistic2.ChineseTranslationDialog")
-                                    , xContext), UNO_QUERY);
-                        Reference< lang::XInitialization > xInit( xDialog, UNO_QUERY );
-                        if( xInit.is() )
+                        try
+                        {
+                            xPropertySet->getPropertyValue("IsDirectionToSimplified") >>= bToSimplified;
+                            xPropertySet->getPropertyValue("IsUseCharacterVariants") >>= bUseVariants;
+                            xPropertySet->getPropertyValue("IsTranslateCommonTerms") >>= bCommonTerms;
+                        }
+                        catch (const Exception&)
                         {
-                            //  initialize dialog
-                            Reference< awt::XWindow > xDialogParentWindow(0);
-                            Sequence<Any> aSeq(1);
-                            Any* pArray = aSeq.getArray();
-                            PropertyValue aParam;
-                            aParam.Name = "ParentWindow";
-                            aParam.Value <<= makeAny(xDialogParentWindow);
-                            pArray[0] <<= makeAny(aParam);
-                            xInit->initialize( aSeq );
-
-                            //execute dialog
-                            sal_Int16 nDialogRet = xDialog->execute();
-                            if( RET_OK == nDialogRet )
-                            {
-                                //get some parameters from the dialog
-                                bool bToSimplified = true;
-                                bool bUseVariants = true;
-                                bool bCommonTerms = true;
-                                Reference< beans::XPropertySet >  xProp( xDialog, UNO_QUERY );
-                                if( xProp.is() )
-                                {
-                                    try
-                                    {
-                                        xProp->getPropertyValue( "IsDirectionToSimplified" ) >>= bToSimplified;
-                                        xProp->getPropertyValue( "IsUseCharacterVariants" ) >>= bUseVariants;
-                                        xProp->getPropertyValue( "IsTranslateCommonTerms" ) >>= bCommonTerms;
-                                    }
-                                    catch (const Exception&)
-                                    {
-                                    }
-                                }
-
-                                //execute translation
-                                sal_Int16 nSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED;
-                                sal_Int16 nTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL;
-                                sal_Int32 nOptions    = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
-                                if( !bCommonTerms )
-                                    nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
-
-                                Font aTargetFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_TEXT,
-                                            nTargetLang, DEFAULTFONT_FLAGS_ONLYONE );
-
-                                pOLV->StartTextConversion( nSourceLang, nTargetLang, &aTargetFont, nOptions, false, false );
-                            }
                         }
-                        Reference< lang::XComponent > xComponent( xDialog, UNO_QUERY );
-                        if( xComponent.is() )
-                            xComponent->dispose();
                     }
+
+                    //execute translation
+                    sal_Int16 nSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED;
+                    sal_Int16 nTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL;
+                    sal_Int32 nOptions    = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
+                    if(!bCommonTerms)
+                        nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
+
+                    Font aTargetFont = OutputDevice::GetDefaultFont(DEFAULTFONT_CJK_TEXT, nTargetLang, DEFAULTFONT_FLAGS_ONLYONE);
+
+                    pOutlinerView->StartTextConversion(nSourceLang, nTargetLang, &aTargetFont, nOptions, false, false);
                 }
+
+                Reference<lang::XComponent> xComponent(xDialog, UNO_QUERY);
+                if (xComponent.is())
+                    xComponent->dispose();
             }
             break;
 
commit 78d6eb63cb8bf7f031f4ea5527bac692e856003e
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Mon Aug 25 18:13:37 2014 +0200

    zoom slider: remove unneeded whitespaces
    
    Change-Id: I220a4074c6d62a89aaab435210f52300c63315b2

diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx
index c7b0092..e02063e 100644
--- a/svx/source/stbctrls/zoomsliderctrl.cxx
+++ b/svx/source/stbctrls/zoomsliderctrl.cxx
@@ -26,17 +26,12 @@
 #include <svx/zoomslideritem.hxx>
 #include <svx/dialmgr.hxx>
 #include <svx/dialogs.hrc>
-
 #include <basegfx/tools/zoomtools.hxx>
 
 #include <set>
 
-
-
 SFX_IMPL_STATUSBAR_CONTROL( SvxZoomSliderControl, SvxZoomSliderItem );
 
-
-
 struct SvxZoomSliderControl::SvxZoomSliderControl_Impl
 {
     sal_uInt16                   mnCurrentZoom;
@@ -65,14 +60,10 @@ struct SvxZoomSliderControl::SvxZoomSliderControl_Impl
         mbOmitPaint( false ) {}
 };
 
-
-
 const long nSliderXOffset = 20;
 const long nSnappingEpsilon = 5; // snapping epsilon in pixels
 const long nSnappingPointsMinDist = nSnappingEpsilon; // minimum distance of two adjacent snapping points
 
-
-
 // nOffset referes to the origin of the control:
 // + ----------- -
 sal_uInt16 SvxZoomSliderControl::Offset2Zoom( long nOffset ) const
@@ -161,8 +152,6 @@ long SvxZoomSliderControl::Zoom2Offset( sal_uInt16 nCurrentZoom ) const
     return nRet;
 }
 
-
-
 SvxZoomSliderControl::SvxZoomSliderControl( sal_uInt16 _nSlotId,  sal_uInt16 _nId, StatusBar& _rStb ) :
     SfxStatusBarControl( _nSlotId, _nId, _rStb ),
     mpImpl( new SvxZoomSliderControl_Impl )
@@ -190,14 +179,10 @@ SvxZoomSliderControl::SvxZoomSliderControl( sal_uInt16 _nSlotId,  sal_uInt16 _nI
 //#endif
 }
 
-
-
 SvxZoomSliderControl::~SvxZoomSliderControl()
 {
 }
 
-
-
 void SvxZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
 {
     if ( (SFX_ITEM_AVAILABLE != eState) || pState->ISA( SfxVoidItem ) )
@@ -258,8 +243,6 @@ void SvxZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eStat
         forceRepaint();
 }
 
-
-
 void SvxZoomSliderControl::Paint( const UserDrawEvent& rUsrEvt )
 {
     if ( !mpImpl->mbValuesSet || mpImpl->mbOmitPaint )
@@ -322,8 +305,6 @@ void SvxZoomSliderControl::Paint( const UserDrawEvent& rUsrEvt )
     pDev->SetFillColor( aOldFillColor );
 }
 
-
-
 bool SvxZoomSliderControl::MouseButtonDown( const MouseEvent & rEvt )
 {
     if ( !mpImpl->mbValuesSet )
@@ -364,8 +345,6 @@ bool SvxZoomSliderControl::MouseButtonDown( const MouseEvent & rEvt )
     return true;
 }
 
-
-
 bool SvxZoomSliderControl::MouseMove( const MouseEvent & rEvt )
 {
     if ( !mpImpl->mbValuesSet )
commit f785c166bd80a4c9f50e6c4f7811bfd7ece16c81
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Mon Aug 25 18:11:29 2014 +0200

    zoom slider: impl as scoped_ptr and reduce code duplication
    
    Change-Id: I274e731c70c2735f513e9e8fbf2273aa52310fd2

diff --git a/include/svx/zoomsliderctrl.hxx b/include/svx/zoomsliderctrl.hxx
index a151217..7af69db 100644
--- a/include/svx/zoomsliderctrl.hxx
+++ b/include/svx/zoomsliderctrl.hxx
@@ -22,6 +22,7 @@
 
 #include <sfx2/stbitem.hxx>
 #include <svx/svxdllapi.h>
+#include <boost/scoped_ptr.hpp>
 
 // class SvxZoomSliderControl ----------------------------------------
 
@@ -30,11 +31,14 @@ class SVX_DLLPUBLIC SvxZoomSliderControl : public SfxStatusBarControl
 private:
 
     struct SvxZoomSliderControl_Impl;
-    SvxZoomSliderControl_Impl* mpImpl;
+    boost::scoped_ptr<SvxZoomSliderControl_Impl> mpImpl;
 
     sal_uInt16 Offset2Zoom( long nOffset ) const;
     long Zoom2Offset( sal_uInt16 nZoom ) const;
 
+    void repaintAndExecute();
+    void forceRepaint() const;
+
 public:
 
     SFX_DECL_STATUSBAR_CONTROL();
diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx
index e0fa879..c7b0092 100644
--- a/svx/source/stbctrls/zoomsliderctrl.cxx
+++ b/svx/source/stbctrls/zoomsliderctrl.cxx
@@ -194,7 +194,6 @@ SvxZoomSliderControl::SvxZoomSliderControl( sal_uInt16 _nSlotId,  sal_uInt16 _nI
 
 SvxZoomSliderControl::~SvxZoomSliderControl()
 {
-    delete mpImpl;
 }
 
 
@@ -255,8 +254,8 @@ void SvxZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eStat
         }
     }
 
-    if ( !mpImpl->mbOmitPaint && GetStatusBar().AreItemsVisible() )
-        GetStatusBar().SetItemData( GetId(), 0 );    // force repaint
+    if (!mpImpl->mbOmitPaint)
+        forceRepaint();
 }
 
 
@@ -360,24 +359,7 @@ bool SvxZoomSliderControl::MouseButtonDown( const MouseEvent & rEvt )
     if ( nOldZoom == mpImpl->mnCurrentZoom )
         return true;
 
-    if ( GetStatusBar().AreItemsVisible() )
-        GetStatusBar().SetItemData( GetId(), 0 );    // force repaint
-
-    mpImpl->mbOmitPaint = true; // optimization: paint before executing command,
-                                // then omit painting which is triggered by the execute function
-
-    SvxZoomSliderItem aZoomSliderItem( mpImpl->mnCurrentZoom );
-
-    ::com::sun::star::uno::Any a;
-    aZoomSliderItem.QueryValue( a );
-
-    ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
-    aArgs[0].Name = "ZoomSlider";
-    aArgs[0].Value = a;
-
-    execute( aArgs );
-
-    mpImpl->mbOmitPaint = false;
+    repaintAndExecute();
 
     return true;
 }
@@ -402,29 +384,39 @@ bool SvxZoomSliderControl::MouseMove( const MouseEvent & rEvt )
         {
             mpImpl->mnCurrentZoom = Offset2Zoom( nXDiff );
 
-            if ( GetStatusBar().AreItemsVisible() )
-                GetStatusBar().SetItemData( GetId(), 0 );    // force repaint
+            repaintAndExecute();
+        }
+    }
+
+    return true;
+}
 
-            mpImpl->mbOmitPaint = true; // optimization: paint before executing command,
-                                        // then omit painting which is triggered by the execute function
+void SvxZoomSliderControl::forceRepaint() const
+{
+    if (GetStatusBar().AreItemsVisible())
+        GetStatusBar().SetItemData(GetId(), 0);
+}
 
-            // commit state change
-            SvxZoomSliderItem aZoomSliderItem( mpImpl->mnCurrentZoom );
+void SvxZoomSliderControl::repaintAndExecute()
+{
+    forceRepaint();
 
-            ::com::sun::star::uno::Any a;
-            aZoomSliderItem.QueryValue( a );
+    mpImpl->mbOmitPaint = true; // optimization: paint before executing command,
+                                // then omit painting which is triggered by the execute function
 
-            ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
-            aArgs[0].Name = "ZoomSlider";
-            aArgs[0].Value = a;
+    // commit state change
+    SvxZoomSliderItem aZoomSliderItem(mpImpl->mnCurrentZoom);
 
-            execute( aArgs );
+    css::uno::Any any;
+    aZoomSliderItem.QueryValue(any);
 
-            mpImpl->mbOmitPaint = false;
-        }
-    }
+    css::uno::Sequence<css::beans::PropertyValue> aArgs(1);
+    aArgs[0].Name = "ZoomSlider";
+    aArgs[0].Value = any;
 
-    return true;
+    execute(aArgs);
+
+    mpImpl->mbOmitPaint = false;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list