LCOV - code coverage report
Current view: top level - sc/source/ui/cctrl - tbzoomsliderctrl.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 141 238 59.2 %
Date: 2014-04-11 Functions: 16 19 84.2 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #include "tbzoomsliderctrl.hxx"
      20             : #include <vcl/image.hxx>
      21             : #include <vcl/toolbox.hxx>
      22             : #include <vcl/virdev.hxx>
      23             : #include <vcl/svapp.hxx>
      24             : #include <vcl/gradient.hxx>
      25             : #include <vcl/settings.hxx>
      26             : #include <svl/itemset.hxx>
      27             : #include <sfx2/viewfrm.hxx>
      28             : #include <sfx2/objsh.hxx>
      29             : #include <svx/zoomslideritem.hxx>
      30             : #include <svx/dialmgr.hxx>
      31             : #include <svx/dialogs.hrc>
      32             : #include <set>
      33             : #include "docsh.hxx"
      34             : #include "stlpool.hxx"
      35             : #include "scitems.hxx"
      36             : #include "printfun.hxx"
      37             : 
      38             : 
      39             : // class ScZoomSliderControl ---------------------------------------
      40             : 
      41             : 
      42          42 : SFX_IMPL_TOOLBOX_CONTROL( ScZoomSliderControl, SvxZoomSliderItem );
      43             : 
      44           8 : ScZoomSliderControl::ScZoomSliderControl(
      45             :     sal_uInt16     nSlotId,
      46             :     sal_uInt16     nId,
      47             :     ToolBox&   rTbx )
      48           8 :     :SfxToolBoxControl( nSlotId, nId, rTbx )
      49             : {
      50           8 :     rTbx.Invalidate();
      51           8 : }
      52             : 
      53          16 : ScZoomSliderControl::~ScZoomSliderControl()
      54             : {
      55             : 
      56          16 : }
      57             : 
      58          14 : void ScZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eState,
      59             :                                        const SfxPoolItem* pState )
      60             : {
      61          14 :     sal_uInt16                  nId  = GetId();
      62          14 :     ToolBox&                rTbx = GetToolBox();
      63          14 :     ScZoomSliderWnd*        pBox = (ScZoomSliderWnd*)(rTbx.GetItemWindow( nId ));
      64             :     OSL_ENSURE( pBox ,"Control not found!" );
      65             : 
      66          14 :     if ( SFX_ITEM_AVAILABLE != eState || pState->ISA( SfxVoidItem ) )
      67             :     {
      68           0 :         SvxZoomSliderItem aZoomSliderItem( 100 );
      69           0 :         pBox->Disable();
      70           0 :         pBox->UpdateFromItem( &aZoomSliderItem );
      71             :     }
      72             :     else
      73             :     {
      74          14 :         pBox->Enable();
      75             :         OSL_ENSURE( pState->ISA( SvxZoomSliderItem ), "invalid item type" );
      76          14 :         const SvxZoomSliderItem* pZoomSliderItem = dynamic_cast< const SvxZoomSliderItem* >( pState );
      77             : 
      78             :         OSL_ENSURE( pZoomSliderItem, "Sc::ScZoomSliderControl::StateChanged(), wrong item type!" );
      79          14 :         if( pZoomSliderItem )
      80          14 :             pBox->UpdateFromItem( pZoomSliderItem );
      81             :     }
      82          14 : }
      83             : 
      84           8 : Window* ScZoomSliderControl::CreateItemWindow( Window *pParent )
      85             : {
      86             :     // #i98000# Don't try to get a value via SfxViewFrame::Current here.
      87             :     // The view's value is always notified via StateChanged later.
      88             :     ScZoomSliderWnd* pSlider    = new ScZoomSliderWnd( pParent,
      89           8 :         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >( m_xFrame->getController(),
      90           8 :         ::com::sun::star::uno::UNO_QUERY ), m_xFrame, 100 );
      91           8 :     return  pSlider;
      92             : }
      93             : 
      94           8 : struct ScZoomSliderWnd::ScZoomSliderWnd_Impl
      95             : {
      96             :     sal_uInt16                   mnCurrentZoom;
      97             :     sal_uInt16                   mnMinZoom;
      98             :     sal_uInt16                   mnMaxZoom;
      99             :     sal_uInt16                   mnSliderCenter;
     100             :     std::vector< long >      maSnappingPointOffsets;
     101             :     std::vector< sal_uInt16 >    maSnappingPointZooms;
     102             :     Image                    maSliderButton;
     103             :     Image                    maIncreaseButton;
     104             :     Image                    maDecreaseButton;
     105             :     bool                     mbValuesSet;
     106             :     bool                     mbOmitPaint;
     107             : 
     108           8 :     ScZoomSliderWnd_Impl( sal_uInt16 nCurrentZoom ) :
     109             :         mnCurrentZoom( nCurrentZoom ),
     110             :         mnMinZoom( 10 ),
     111             :         mnMaxZoom( 400 ),
     112             :         mnSliderCenter( 100 ),
     113             :         maSnappingPointOffsets(),
     114             :         maSnappingPointZooms(),
     115             :         maSliderButton(),
     116             :         maIncreaseButton(),
     117             :         maDecreaseButton(),
     118             :         mbValuesSet( true ),
     119           8 :         mbOmitPaint( false )
     120             :         {
     121             : 
     122           8 :         }
     123             : };
     124             : 
     125             : const long nButtonWidth     = 10;
     126             : const long nButtonHeight    = 10;
     127             : const long nIncDecWidth     = 11;
     128             : const long nIncDecHeight    = 11;
     129             : const long nSliderHeight    = 2;
     130             : const long nSliderWidth     = 4;
     131             : const long nSnappingHeight  = 4;
     132             : const long nSliderXOffset   = 20;
     133             : const long nSnappingEpsilon = 5; // snapping epsilon in pixels
     134             : const long nSnappingPointsMinDist = nSnappingEpsilon; // minimum distance of two adjacent snapping points
     135             : 
     136             : 
     137           0 : sal_uInt16 ScZoomSliderWnd::Offset2Zoom( long nOffset ) const
     138             : {
     139           0 :     Size aSliderWindowSize = GetOutputSizePixel();
     140           0 :     const long nControlWidth = aSliderWindowSize.Width();
     141           0 :     sal_uInt16 nRet = 0;
     142             : 
     143           0 :     if( nOffset < nSliderXOffset )
     144           0 :         return mpImpl->mnMinZoom;
     145           0 :     if( nOffset > nControlWidth - nSliderXOffset )
     146           0 :         return mpImpl->mnMaxZoom;
     147             : 
     148             :     // check for snapping points:
     149           0 :     sal_uInt16 nCount = 0;
     150           0 :     std::vector< long >::iterator aSnappingPointIter;
     151           0 :     for ( aSnappingPointIter = mpImpl->maSnappingPointOffsets.begin();
     152           0 :         aSnappingPointIter != mpImpl->maSnappingPointOffsets.end();
     153             :         ++aSnappingPointIter )
     154             :     {
     155           0 :         const long nCurrent = *aSnappingPointIter;
     156           0 :         if ( std::abs(nCurrent - nOffset) < nSnappingEpsilon )
     157             :         {
     158           0 :             nOffset = nCurrent;
     159           0 :             nRet = mpImpl->maSnappingPointZooms[ nCount ];
     160           0 :             break;
     161             :         }
     162           0 :         ++nCount;
     163             :     }
     164             : 
     165           0 :     if( 0 == nRet )
     166             :     {
     167           0 :         if( nOffset < nControlWidth / 2 )
     168             :         {
     169             :             // first half of slider
     170           0 :             const long nFirstHalfRange      = mpImpl->mnSliderCenter - mpImpl->mnMinZoom;
     171           0 :             const long nHalfSliderWidth     = nControlWidth/2 - nSliderXOffset;
     172           0 :             const long nZoomPerSliderPixel  = (1000 * nFirstHalfRange) / nHalfSliderWidth;
     173           0 :             const long nOffsetToSliderLeft  = nOffset - nSliderXOffset;
     174           0 :             nRet = mpImpl->mnMinZoom + sal_uInt16( nOffsetToSliderLeft * nZoomPerSliderPixel / 1000 );
     175             :         }
     176             :         else
     177             :         {
     178             :             // second half of slider
     179           0 :             const long nSecondHalfRange         = mpImpl->mnMaxZoom - mpImpl->mnSliderCenter;
     180           0 :             const long nHalfSliderWidth         = nControlWidth/2 - nSliderXOffset;
     181           0 :             const long nZoomPerSliderPixel      = 1000 * nSecondHalfRange / nHalfSliderWidth;
     182           0 :             const long nOffsetToSliderCenter    = nOffset - nControlWidth/2;
     183           0 :             nRet = mpImpl->mnSliderCenter + sal_uInt16( nOffsetToSliderCenter * nZoomPerSliderPixel / 1000 );
     184             :         }
     185             :     }
     186             : 
     187           0 :     if( nRet < mpImpl->mnMinZoom )
     188           0 :         return mpImpl->mnMinZoom;
     189             : 
     190           0 :     else if( nRet > mpImpl->mnMaxZoom )
     191           0 :         return mpImpl->mnMaxZoom;
     192             : 
     193           0 :     return nRet;
     194             : }
     195             : 
     196          36 : long ScZoomSliderWnd::Zoom2Offset( sal_uInt16 nCurrentZoom ) const
     197             : {
     198          36 :     Size aSliderWindowSize = GetOutputSizePixel();
     199          36 :     const long nControlWidth = aSliderWindowSize.Width();
     200          36 :     long  nRect = nSliderXOffset;
     201             : 
     202          36 :     const long nHalfSliderWidth = nControlWidth/2 - nSliderXOffset;
     203          36 :     if( nCurrentZoom <= mpImpl->mnSliderCenter )
     204             :     {
     205          36 :         nCurrentZoom = nCurrentZoom - mpImpl->mnMinZoom;
     206          36 :         const long nFirstHalfRange = mpImpl->mnSliderCenter - mpImpl->mnMinZoom;
     207          36 :         const long nSliderPixelPerZoomPercent = 1000 * nHalfSliderWidth  / nFirstHalfRange;
     208          36 :         const long nOffset = (nSliderPixelPerZoomPercent * nCurrentZoom) / 1000;
     209          36 :         nRect += nOffset;
     210             :     }
     211             :     else
     212             :     {
     213           0 :         nCurrentZoom = nCurrentZoom - mpImpl->mnSliderCenter;
     214           0 :         const long nSecondHalfRange = mpImpl->mnMaxZoom - mpImpl->mnSliderCenter;
     215           0 :         const long nSliderPixelPerZoomPercent = 1000 * nHalfSliderWidth  / nSecondHalfRange;
     216           0 :         const long nOffset = (nSliderPixelPerZoomPercent * nCurrentZoom) / 1000;
     217           0 :         nRect += nHalfSliderWidth + nOffset;
     218             :     }
     219          36 :     return nRect;
     220             : }
     221             : 
     222             : 
     223           8 : ScZoomSliderWnd::ScZoomSliderWnd( Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& rDispatchProvider,
     224             :                 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame , sal_uInt16 nCurrentZoom ):
     225             :                 Window( pParent ),
     226           8 :                 mpImpl( new ScZoomSliderWnd_Impl( nCurrentZoom ) ),
     227             :                 aLogicalSize( 115, 40 ),
     228             :                 m_xDispatchProvider( rDispatchProvider ),
     229          16 :                 m_xFrame( _xFrame )
     230             : {
     231           8 :     mpImpl->maSliderButton      = Image( SVX_RES( RID_SVXBMP_SLIDERBUTTON   ) );
     232           8 :     mpImpl->maIncreaseButton    = Image( SVX_RES( RID_SVXBMP_SLIDERINCREASE ) );
     233           8 :     mpImpl->maDecreaseButton    = Image( SVX_RES( RID_SVXBMP_SLIDERDECREASE ) );
     234           8 :     Size  aSliderSize           = LogicToPixel( Size( aLogicalSize), MapMode( MAP_10TH_MM ) );
     235           8 :     SetSizePixel( Size( aSliderSize.Width() * nSliderWidth-1, aSliderSize.Height() + nSliderHeight ) );
     236           8 : }
     237             : 
     238          24 : ScZoomSliderWnd::~ScZoomSliderWnd()
     239             : {
     240           8 :     delete mpImpl;
     241          16 : }
     242             : 
     243           0 : void ScZoomSliderWnd::MouseButtonDown( const MouseEvent& rMEvt )
     244             : {
     245           0 :     if ( !mpImpl->mbValuesSet )
     246           0 :         return ;
     247           0 :     Size aSliderWindowSize = GetOutputSizePixel();
     248             : 
     249           0 :     const Point aPoint = rMEvt.GetPosPixel();
     250             : 
     251           0 :     const long nButtonLeftOffset    = ( nSliderXOffset - nIncDecWidth )/2;
     252           0 :     const long nButtonRightOffset   = ( nSliderXOffset + nIncDecWidth )/2;
     253             : 
     254           0 :     const long nOldZoom = mpImpl->mnCurrentZoom;
     255             : 
     256             :     // click to - button
     257           0 :     if ( aPoint.X() >= nButtonLeftOffset && aPoint.X() <= nButtonRightOffset )
     258             :     {
     259           0 :         mpImpl->mnCurrentZoom = mpImpl->mnCurrentZoom - 5;
     260             :     }
     261             :     // click to + button
     262           0 :     else if ( aPoint.X() >= aSliderWindowSize.Width() - nSliderXOffset + nButtonLeftOffset &&
     263           0 :               aPoint.X() <= aSliderWindowSize.Width() - nSliderXOffset + nButtonRightOffset )
     264             :     {
     265           0 :         mpImpl->mnCurrentZoom = mpImpl->mnCurrentZoom + 5;
     266             :     }
     267           0 :     else if( aPoint.X() >= nSliderXOffset && aPoint.X() <= aSliderWindowSize.Width() - nSliderXOffset )
     268             :     {
     269           0 :         mpImpl->mnCurrentZoom = Offset2Zoom( aPoint.X() );
     270             :     }
     271             : 
     272           0 :     if( mpImpl->mnCurrentZoom < mpImpl->mnMinZoom )
     273           0 :         mpImpl->mnCurrentZoom = mpImpl->mnMinZoom;
     274           0 :     else if( mpImpl->mnCurrentZoom > mpImpl->mnMaxZoom )
     275           0 :         mpImpl->mnCurrentZoom = mpImpl->mnMaxZoom;
     276             : 
     277           0 :     if( nOldZoom == mpImpl->mnCurrentZoom )
     278           0 :         return ;
     279             : 
     280           0 :     Rectangle aRect( Point( 0, 0 ), aSliderWindowSize );
     281             : 
     282           0 :     Paint( aRect );
     283           0 :     mpImpl->mbOmitPaint = true;
     284             : 
     285           0 :     SvxZoomSliderItem   aZoomSliderItem( mpImpl->mnCurrentZoom );
     286             : 
     287           0 :     ::com::sun::star::uno::Any  a;
     288           0 :     aZoomSliderItem.QueryValue( a );
     289             : 
     290           0 :     ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
     291           0 :     aArgs[0].Name = "ScalingFactor";
     292           0 :     aArgs[0].Value = a;
     293             : 
     294           0 :     SfxToolBoxControl::Dispatch( m_xDispatchProvider, OUString(".uno:ScalingFactor"), aArgs );
     295             : 
     296           0 :     mpImpl->mbOmitPaint = false;
     297             : }
     298             : 
     299           0 : void ScZoomSliderWnd::MouseMove( const MouseEvent& rMEvt )
     300             : {
     301           0 :     if ( !mpImpl->mbValuesSet )
     302           0 :         return ;
     303             : 
     304           0 :     Size aSliderWindowSize   = GetOutputSizePixel();
     305           0 :     const long nControlWidth = aSliderWindowSize.Width();
     306           0 :     const short nButtons     = rMEvt.GetButtons();
     307             : 
     308             :     // check mouse move with button pressed
     309           0 :     if ( 1 == nButtons )
     310             :     {
     311           0 :         const Point aPoint = rMEvt.GetPosPixel();
     312             : 
     313           0 :         if ( aPoint.X() >= nSliderXOffset && aPoint.X() <= nControlWidth - nSliderXOffset )
     314             :         {
     315           0 :             mpImpl->mnCurrentZoom = Offset2Zoom( aPoint.X() );
     316             : 
     317           0 :             Rectangle aRect( Point( 0, 0 ), aSliderWindowSize  );
     318           0 :             Paint( aRect );
     319             : 
     320           0 :             mpImpl->mbOmitPaint = true; // optimization: paint before executing command,
     321             : 
     322             :             // commit state change
     323           0 :             SvxZoomSliderItem aZoomSliderItem( mpImpl->mnCurrentZoom );
     324             : 
     325           0 :             ::com::sun::star::uno::Any a;
     326           0 :             aZoomSliderItem.QueryValue( a );
     327             : 
     328           0 :             ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs( 1 );
     329           0 :             aArgs[0].Name = "ScalingFactor";
     330           0 :             aArgs[0].Value = a;
     331             : 
     332           0 :             SfxToolBoxControl::Dispatch( m_xDispatchProvider, OUString(".uno:ScalingFactor"), aArgs );
     333             : 
     334           0 :             mpImpl->mbOmitPaint = false;
     335             :         }
     336             :     }
     337             : }
     338             : 
     339          14 : void ScZoomSliderWnd::UpdateFromItem( const SvxZoomSliderItem* pZoomSliderItem )
     340             : {
     341          14 :     if( pZoomSliderItem )
     342             :     {
     343          14 :         mpImpl->mnCurrentZoom = pZoomSliderItem->GetValue();
     344          14 :         mpImpl->mnMinZoom     = pZoomSliderItem->GetMinZoom();
     345          14 :         mpImpl->mnMaxZoom     = pZoomSliderItem->GetMaxZoom();
     346             : 
     347             :         OSL_ENSURE( mpImpl->mnMinZoom <= mpImpl->mnCurrentZoom &&
     348             :             mpImpl->mnMinZoom <  mpImpl->mnSliderCenter &&
     349             :             mpImpl->mnMaxZoom >= mpImpl->mnCurrentZoom &&
     350             :             mpImpl->mnMaxZoom > mpImpl->mnSliderCenter,
     351             :             "Looks like the zoom slider item is corrupted" );
     352          14 :        const com::sun::star::uno::Sequence < sal_Int32 > rSnappingPoints = pZoomSliderItem->GetSnappingPoints();
     353          14 :        mpImpl->maSnappingPointOffsets.clear();
     354          14 :        mpImpl->maSnappingPointZooms.clear();
     355             : 
     356             :        // get all snapping points:
     357          28 :        std::set< sal_uInt16 > aTmpSnappingPoints;
     358          28 :        for ( sal_uInt16 j = 0; j < rSnappingPoints.getLength(); ++j )
     359             :        {
     360          14 :            const sal_Int32 nSnappingPoint = rSnappingPoints[j];
     361          14 :            aTmpSnappingPoints.insert( (sal_uInt16)nSnappingPoint );
     362             :        }
     363             : 
     364             :        // remove snapping points that are to close to each other:
     365          14 :        std::set< sal_uInt16 >::iterator aSnappingPointIter;
     366          14 :        long nLastOffset = 0;
     367             : 
     368          28 :        for ( aSnappingPointIter = aTmpSnappingPoints.begin(); aSnappingPointIter != aTmpSnappingPoints.end(); ++aSnappingPointIter )
     369             :        {
     370          14 :            const sal_uInt16 nCurrent = *aSnappingPointIter;
     371          14 :            const long nCurrentOffset = Zoom2Offset( nCurrent );
     372             : 
     373          14 :            if ( nCurrentOffset - nLastOffset >= nSnappingPointsMinDist )
     374             :            {
     375          14 :                mpImpl->maSnappingPointOffsets.push_back( nCurrentOffset );
     376          14 :                mpImpl->maSnappingPointZooms.push_back( nCurrent );
     377          14 :                nLastOffset = nCurrentOffset;
     378             :            }
     379          14 :        }
     380             :     }
     381             : 
     382          14 :     Size aSliderWindowSize = GetOutputSizePixel();
     383          14 :     Rectangle aRect( Point( 0, 0 ), aSliderWindowSize );
     384             : 
     385          14 :     if ( !mpImpl->mbOmitPaint )
     386          14 :        Paint(aRect);
     387          14 : }
     388             : 
     389          22 : void ScZoomSliderWnd::Paint( const Rectangle& rRect )
     390             : {
     391          22 :     DoPaint( rRect );
     392          22 : }
     393             : 
     394          22 : void ScZoomSliderWnd::DoPaint( const Rectangle& /*rRect*/ )
     395             : {
     396          22 :     if( mpImpl->mbOmitPaint )
     397          22 :         return;
     398             : 
     399          22 :     Size aSliderWindowSize = GetOutputSizePixel();
     400          22 :     Rectangle aRect( Point( 0, 0 ), aSliderWindowSize );
     401             : 
     402          22 :     VirtualDevice* pVDev = new VirtualDevice( *this );
     403          22 :     pVDev->SetOutputSizePixel( aSliderWindowSize );
     404             : 
     405          22 :     Rectangle   aSlider = aRect;
     406             : 
     407          22 :     aSlider.Top()     += ( aSliderWindowSize.Height() - nSliderHeight )/2 - 1;
     408          22 :     aSlider.Bottom()   = aSlider.Top() + nSliderHeight;
     409          22 :     aSlider.Left()    += nSliderXOffset;
     410          22 :     aSlider.Right()   -= nSliderXOffset;
     411             : 
     412          22 :     Rectangle aFirstLine( aSlider );
     413          22 :     aFirstLine.Bottom() = aFirstLine.Top();
     414             : 
     415          22 :     Rectangle aSecondLine( aSlider );
     416          22 :     aSecondLine.Top() = aSecondLine.Bottom();
     417             : 
     418          22 :     Rectangle aLeft( aSlider );
     419          22 :     aLeft.Right() = aLeft.Left();
     420             : 
     421          22 :     Rectangle aRight( aSlider );
     422          22 :     aRight.Left() = aRight.Right();
     423             : 
     424             :     // draw VirtualDevice's background color
     425          22 :     Color  aStartColor,aEndColor;
     426          22 :     aStartColor = GetSettings().GetStyleSettings().GetFaceColor();
     427          22 :     aEndColor   = GetSettings().GetStyleSettings().GetFaceColor();
     428          22 :     if( aEndColor.IsDark() )
     429           0 :         aStartColor = aEndColor;
     430             : 
     431          22 :     Gradient g;
     432          22 :     g.SetAngle( 0 );
     433          22 :     g.SetStyle( GradientStyle_LINEAR );
     434             : 
     435          22 :     g.SetStartColor( aStartColor );
     436          22 :     g.SetEndColor( aEndColor );
     437          22 :     pVDev->DrawGradient( aRect, g );
     438             : 
     439             :     // draw slider
     440          22 :     pVDev->SetLineColor( Color ( COL_WHITE ) );
     441          22 :     pVDev->DrawRect( aSecondLine );
     442          22 :     pVDev->DrawRect( aRight );
     443             : 
     444          22 :     pVDev->SetLineColor( Color( COL_GRAY ) );
     445          22 :     pVDev->DrawRect( aFirstLine );
     446          22 :     pVDev->DrawRect( aLeft );
     447             : 
     448             :     // draw snapping points:
     449          22 :     std::vector< long >::iterator aSnappingPointIter;
     450         108 :     for ( aSnappingPointIter = mpImpl->maSnappingPointOffsets.begin();
     451          72 :         aSnappingPointIter != mpImpl->maSnappingPointOffsets.end();
     452             :         ++aSnappingPointIter )
     453             :     {
     454          14 :         pVDev->SetLineColor( Color( COL_GRAY ) );
     455          14 :         Rectangle aSnapping( aRect );
     456          14 :         aSnapping.Bottom()   = aSlider.Top();
     457          14 :         aSnapping.Top() = aSnapping.Bottom() - nSnappingHeight;
     458          14 :         aSnapping.Left() += *aSnappingPointIter;
     459          14 :         aSnapping.Right() = aSnapping.Left();
     460          14 :         pVDev->DrawRect( aSnapping );
     461             : 
     462          14 :         aSnapping.Top() += nSnappingHeight + nSliderHeight;
     463          14 :         aSnapping.Bottom() += nSnappingHeight + nSliderHeight;
     464          14 :         pVDev->DrawRect( aSnapping );
     465             :     }
     466             : 
     467             :     // draw slider button
     468          22 :     Point aImagePoint = aRect.TopLeft();
     469          22 :     aImagePoint.X() += Zoom2Offset( mpImpl->mnCurrentZoom );
     470          22 :     aImagePoint.X() -= nButtonWidth/2;
     471          22 :     aImagePoint.Y() += ( aSliderWindowSize.Height() - nButtonHeight)/2;
     472          22 :     pVDev->DrawImage( aImagePoint, mpImpl->maSliderButton );
     473             : 
     474             :     // draw decrease button
     475          22 :     aImagePoint = aRect.TopLeft();
     476          22 :     aImagePoint.X() += (nSliderXOffset - nIncDecWidth)/2;
     477          22 :     aImagePoint.Y() += ( aSliderWindowSize.Height() - nIncDecHeight)/2;
     478          22 :     pVDev->DrawImage( aImagePoint, mpImpl->maDecreaseButton );
     479             : 
     480             :     // draw increase button
     481          22 :     aImagePoint.X() = aRect.TopLeft().X() + aSliderWindowSize.Width() - nIncDecWidth - (nSliderXOffset - nIncDecWidth)/2;
     482          22 :     pVDev->DrawImage( aImagePoint, mpImpl->maIncreaseButton );
     483             : 
     484          22 :     DrawOutDev( Point(0, 0), aSliderWindowSize, Point(0, 0), aSliderWindowSize, *pVDev );
     485             : 
     486          22 :     delete pVDev;
     487             : 
     488             : }
     489             : 
     490             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10