LCOV - code coverage report
Current view: top level - svx/source/dialog - dialcontrol.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 308 0.0 %
Date: 2014-04-11 Functions: 0 52 0.0 %
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             : 
      20             : #include "svx/dialcontrol.hxx"
      21             : #include "bmpmask.hrc"
      22             : #include <svx/dialmgr.hxx>
      23             : #include <tools/rcid.h>
      24             : #include <cmath>
      25             : #include <vcl/virdev.hxx>
      26             : #include <vcl/svapp.hxx>
      27             : #include <vcl/bitmap.hxx>
      28             : #include <vcl/field.hxx>
      29             : #include <vcl/settings.hxx>
      30             : #include <svtools/colorcfg.hxx>
      31             : #include <vcl/builder.hxx>
      32             : 
      33             : namespace svx {
      34             : 
      35             : 
      36             : 
      37             : const long DIAL_OUTER_WIDTH = 8;
      38             : 
      39             : 
      40             : 
      41           0 : DialControlBmp::DialControlBmp( Window& rParent ) :
      42             :     VirtualDevice( rParent, 0, 0 ),
      43             :     mbEnabled( true ),
      44             :     mrParent( rParent ),
      45             :     mnCenterX(0),
      46           0 :     mnCenterY(0)
      47             : {
      48           0 :     EnableRTL( false );
      49           0 : }
      50             : 
      51           0 : void DialControlBmp::InitBitmap(const Font& rFont)
      52             : {
      53           0 :     Init();
      54           0 :     SetFont(rFont);
      55           0 : }
      56             : 
      57           0 : void DialControlBmp::CopyBackground( const DialControlBmp& rSrc )
      58             : {
      59           0 :     Init();
      60           0 :     SetSize(rSrc.maRect.GetSize());
      61           0 :     mbEnabled = rSrc.mbEnabled;
      62           0 :     Point aPos;
      63           0 :     DrawBitmapEx( aPos, rSrc.GetBitmapEx( aPos, maRect.GetSize() ) );
      64           0 : }
      65             : 
      66           0 : void DialControlBmp::DrawBackground( const Size& rSize, bool bEnabled )
      67             : {
      68           0 :     Init();
      69           0 :     SetSize(rSize);
      70           0 :     mbEnabled = bEnabled;
      71           0 :     DrawBackground();
      72           0 : }
      73             : 
      74           0 : void DialControlBmp::DrawElements( const OUString& rText, sal_Int32 nAngle )
      75             : {
      76           0 :     double fAngle = nAngle * F_PI180 / 100.0;
      77           0 :     double fSin = sin( fAngle );
      78           0 :     double fCos = cos( fAngle );
      79           0 :     double fWidth = GetTextWidth( rText ) / 2.0;
      80           0 :     double fHeight = GetTextHeight() / 2.0;
      81             : 
      82           0 :     if ( !rText.isEmpty() )
      83             :     {
      84             :         // rotated text
      85           0 :         Font aFont( GetFont() );
      86           0 :         aFont.SetColor( GetTextColor() );
      87           0 :         aFont.SetOrientation( static_cast< short >( (nAngle + 5) / 10 ) );  // Font uses 1/10 degrees
      88           0 :         aFont.SetWeight( WEIGHT_BOLD );
      89           0 :         SetFont( aFont );
      90             : 
      91           0 :         long nX = static_cast< long >( mnCenterX - fWidth * fCos - fHeight * fSin );
      92           0 :         long nY = static_cast< long >( mnCenterY + fWidth * fSin - fHeight * fCos );
      93           0 :         Rectangle aRect( nX, nY, 2 * mnCenterX - nX, 2 * mnCenterY - nY );
      94           0 :         DrawText( aRect, rText, mbEnabled ? 0 : TEXT_DRAW_DISABLE );
      95             :     }
      96             :     else
      97             :     {
      98             :         // only a line
      99           0 :         const sal_Int32 nDx (fCos * (maRect.GetWidth()-4) / 2);
     100           0 :         const sal_Int32 nDy (-fSin * (maRect.GetHeight()-4) / 2);
     101           0 :         Point pt1( maRect.Center() );
     102           0 :         Point pt2( pt1.X() + nDx, pt1.Y() + nDy);
     103             : 
     104           0 :         SetLineColor( GetTextColor() );
     105           0 :         DrawLine( pt1, pt2 );
     106             :     }
     107             : 
     108             :     // *** drag button ***
     109             : 
     110           0 :     bool bMain = (nAngle % 4500) != 0;
     111           0 :     SetLineColor( GetButtonLineColor() );
     112           0 :     SetFillColor( GetButtonFillColor( bMain ) );
     113             : 
     114           0 :     long nX = mnCenterX - static_cast< long >( (DIAL_OUTER_WIDTH / 2 - mnCenterX) * fCos );
     115           0 :     long nY = mnCenterY - static_cast< long >( (mnCenterY - DIAL_OUTER_WIDTH / 2) * fSin );
     116           0 :     long nSize = bMain ? (DIAL_OUTER_WIDTH / 4) : (DIAL_OUTER_WIDTH / 2 - 1);
     117           0 :     DrawEllipse( Rectangle( nX - nSize, nY - nSize, nX + nSize, nY + nSize ) );
     118           0 : }
     119             : 
     120             : // private --------------------------------------------------------------------
     121             : 
     122           0 : const Color& DialControlBmp::GetBackgroundColor() const
     123             : {
     124           0 :     return GetSettings().GetStyleSettings().GetDialogColor();
     125             : }
     126             : 
     127           0 : const Color& DialControlBmp::GetTextColor() const
     128             : {
     129           0 :     return GetSettings().GetStyleSettings().GetLabelTextColor();
     130             : }
     131             : 
     132           0 : const Color& DialControlBmp::GetScaleLineColor() const
     133             : {
     134           0 :     const StyleSettings& rSett = GetSettings().GetStyleSettings();
     135           0 :     return mbEnabled ? rSett.GetButtonTextColor() : rSett.GetDisableColor();
     136             : }
     137             : 
     138           0 : const Color& DialControlBmp::GetButtonLineColor() const
     139             : {
     140           0 :     const StyleSettings& rSett = GetSettings().GetStyleSettings();
     141           0 :     return mbEnabled ? rSett.GetButtonTextColor() : rSett.GetDisableColor();
     142             : }
     143             : 
     144           0 : const Color& DialControlBmp::GetButtonFillColor( bool bMain ) const
     145             : {
     146           0 :     const StyleSettings& rSett = GetSettings().GetStyleSettings();
     147           0 :     return mbEnabled ? (bMain ? rSett.GetMenuColor() : rSett.GetHighlightColor()) : rSett.GetDisableColor();
     148             : }
     149             : 
     150           0 : void DialControlBmp::Init()
     151             : {
     152           0 :     SetSettings(mrParent.GetSettings());
     153           0 :     SetBackground();
     154           0 : }
     155             : 
     156           0 : void DialControlBmp::SetSize( const Size& rSize )
     157             : {
     158           0 :     maRect.SetPos( Point( 0, 0 ) );
     159           0 :     maRect.SetSize( rSize );
     160           0 :     mnCenterX = rSize.Width() / 2;
     161           0 :     mnCenterY = rSize.Height() / 2;
     162           0 :     SetOutputSize( rSize );
     163           0 : }
     164             : 
     165           0 : void DialControlBmp::DrawBackground()
     166             : {
     167             :     // *** background with 3D effect ***
     168             : 
     169           0 :     SetLineColor();
     170           0 :     SetFillColor();
     171           0 :     Erase();
     172             : 
     173           0 :     EnableRTL( true ); // draw 3D effect in correct direction
     174             : 
     175           0 :     sal_uInt8 nDiff = mbEnabled ? 0x18 : 0x10;
     176           0 :     Color aColor;
     177             : 
     178           0 :     aColor = GetBackgroundColor();
     179           0 :     SetFillColor( aColor );
     180           0 :     DrawPie( maRect, maRect.TopRight(), maRect.TopCenter() );
     181           0 :     DrawPie( maRect, maRect.BottomLeft(), maRect.BottomCenter() );
     182             : 
     183           0 :     aColor.DecreaseLuminance( nDiff );
     184           0 :     SetFillColor( aColor );
     185           0 :     DrawPie( maRect, maRect.BottomCenter(), maRect.TopRight() );
     186             : 
     187           0 :     aColor.DecreaseLuminance( nDiff );
     188           0 :     SetFillColor( aColor );
     189           0 :     DrawPie( maRect, maRect.BottomRight(), maRect.RightCenter() );
     190             : 
     191           0 :     aColor = GetBackgroundColor();
     192           0 :     aColor.IncreaseLuminance( nDiff );
     193           0 :     SetFillColor( aColor );
     194           0 :     DrawPie( maRect, maRect.TopCenter(), maRect.BottomLeft() );
     195             : 
     196           0 :     aColor.IncreaseLuminance( nDiff );
     197           0 :     SetFillColor( aColor );
     198           0 :     DrawPie( maRect, maRect.TopLeft(), maRect.LeftCenter() );
     199             : 
     200           0 :     EnableRTL( false );
     201             : 
     202             :     // *** calibration ***
     203             : 
     204           0 :     Point aStartPos( mnCenterX, mnCenterY );
     205           0 :     Color aFullColor( GetScaleLineColor() );
     206           0 :     Color aLightColor( GetBackgroundColor() );
     207           0 :     aLightColor.Merge( aFullColor, 128 );
     208             : 
     209           0 :     for( int nAngle = 0; nAngle < 360; nAngle += 15 )
     210             :     {
     211           0 :         SetLineColor( (nAngle % 45) ? aLightColor : aFullColor );
     212           0 :         double fAngle = nAngle * F_PI180;
     213           0 :         long nX = static_cast< long >( -mnCenterX * cos( fAngle ) );
     214           0 :         long nY = static_cast< long >( mnCenterY * sin( fAngle ) );
     215           0 :         DrawLine( aStartPos, Point( mnCenterX - nX, mnCenterY - nY ) );
     216             :     }
     217             : 
     218             :     // *** clear inner area ***
     219             : 
     220           0 :     SetLineColor();
     221           0 :     SetFillColor( GetBackgroundColor() );
     222           0 :     DrawEllipse( Rectangle( maRect.Left() + DIAL_OUTER_WIDTH, maRect.Top() + DIAL_OUTER_WIDTH,
     223           0 :         maRect.Right() - DIAL_OUTER_WIDTH, maRect.Bottom() - DIAL_OUTER_WIDTH ) );
     224           0 : }
     225             : 
     226             : 
     227             : 
     228           0 : DialControl::DialControl_Impl::DialControl_Impl ( Window& rParent ) :
     229           0 :     mpBmpEnabled(new DialControlBmp(rParent)),
     230           0 :     mpBmpDisabled(new DialControlBmp(rParent)),
     231           0 :     mpBmpBuffered(new DialControlBmp(rParent)),
     232             :     mpLinkField( 0 ),
     233             :     mnLinkedFieldValueMultiplyer( 0 ),
     234             :     mnAngle( 0 ),
     235             :     mnInitialAngle( 0 ),
     236             :     mnOldAngle( 0 ),
     237             :     mnCenterX( 0 ),
     238             :     mnCenterY( 0 ),
     239           0 :     mbNoRot( false )
     240             : {
     241           0 : }
     242             : 
     243           0 : void DialControl::DialControl_Impl::Init( const Size& rWinSize, const Font& rWinFont )
     244             : {
     245           0 :     maWinFont = rWinFont;
     246           0 :     maWinFont.SetTransparent(true);
     247           0 :     mpBmpBuffered->InitBitmap(maWinFont);
     248           0 :     SetSize(rWinSize);
     249           0 : }
     250             : 
     251           0 : void DialControl::DialControl_Impl::SetSize( const Size& rWinSize )
     252             : {
     253             :     // make the control squared, and adjusted so that we have a well-defined
     254             :     // center ["(x - 1) | 1" creates odd value <= x]
     255           0 :     long nMin = (std::min(rWinSize.Width(), rWinSize.Height()) - 1) | 1;
     256             : 
     257           0 :     maWinSize = Size( nMin, nMin );
     258             : 
     259           0 :     mnCenterX = maWinSize.Width() / 2;
     260           0 :     mnCenterY = maWinSize.Height() / 2;
     261             : 
     262           0 :     mpBmpEnabled->DrawBackground( maWinSize, true );
     263           0 :     mpBmpDisabled->DrawBackground( maWinSize, false );
     264           0 :     mpBmpBuffered->SetSize( maWinSize );
     265           0 : }
     266             : 
     267             : 
     268             : 
     269           0 : DialControl::DialControl( Window* pParent, WinBits nBits ) :
     270             :     Control( pParent, nBits ),
     271           0 :      mpImpl( new DialControl_Impl( *this ) )
     272             : {
     273           0 :     Init( GetOutputSizePixel() );
     274           0 : }
     275             : 
     276           0 : DialControl::~DialControl()
     277             : {
     278           0 : }
     279             : 
     280           0 : extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeDialControl(Window *pParent, VclBuilder::stringmap &)
     281             : {
     282           0 :     return new DialControl(pParent, WB_TABSTOP);
     283             : }
     284             : 
     285           0 : void DialControl::Resize()
     286             : {
     287           0 :     mpImpl->SetSize(GetOutputSizePixel());
     288           0 :     InvalidateControl();
     289           0 : }
     290             : 
     291           0 : void DialControl::Paint( const Rectangle&  )
     292             : {
     293           0 :     Point aPos;
     294           0 :     DrawBitmapEx( aPos, mpImpl->mpBmpBuffered->GetBitmapEx( aPos, mpImpl->maWinSize ) );
     295           0 : }
     296             : 
     297           0 : void DialControl::StateChanged( StateChangedType nStateChange )
     298             : {
     299           0 :     if( nStateChange == STATE_CHANGE_ENABLE )
     300           0 :         InvalidateControl();
     301             : 
     302             :     // update the linked edit field
     303           0 :     if( mpImpl->mpLinkField )
     304             :     {
     305           0 :         NumericField& rField = *mpImpl->mpLinkField;
     306           0 :         switch( nStateChange )
     307             :         {
     308           0 :             case STATE_CHANGE_VISIBLE:  rField.Show( IsVisible() );     break;
     309           0 :             case STATE_CHANGE_ENABLE:   rField.Enable( IsEnabled() );   break;
     310             :         }
     311             :     }
     312             : 
     313           0 :     Control::StateChanged( nStateChange );
     314           0 : }
     315             : 
     316           0 : void DialControl::DataChanged( const DataChangedEvent& rDCEvt )
     317             : {
     318           0 :     if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
     319             :     {
     320           0 :         Init( mpImpl->maWinSize, mpImpl->maWinFont );
     321           0 :         InvalidateControl();
     322             :     }
     323           0 :     Control::DataChanged( rDCEvt );
     324           0 : }
     325             : 
     326           0 : void DialControl::MouseButtonDown( const MouseEvent& rMEvt )
     327             : {
     328           0 :     if( rMEvt.IsLeft() )
     329             :     {
     330           0 :         GrabFocus();
     331           0 :         CaptureMouse();
     332           0 :         mpImpl->mnOldAngle = mpImpl->mnAngle;
     333           0 :         HandleMouseEvent( rMEvt.GetPosPixel(), true );
     334             :     }
     335           0 :     Control::MouseButtonDown( rMEvt );
     336           0 : }
     337             : 
     338           0 : void DialControl::MouseMove( const MouseEvent& rMEvt )
     339             : {
     340           0 :     if( IsMouseCaptured() && rMEvt.IsLeft() )
     341           0 :         HandleMouseEvent( rMEvt.GetPosPixel(), false );
     342           0 :     Control::MouseMove(rMEvt );
     343           0 : }
     344             : 
     345           0 : void DialControl::MouseButtonUp( const MouseEvent& rMEvt )
     346             : {
     347           0 :     if( IsMouseCaptured() )
     348             :     {
     349           0 :         ReleaseMouse();
     350           0 :         if( mpImpl->mpLinkField )
     351           0 :             mpImpl->mpLinkField->GrabFocus();
     352             :     }
     353           0 :     Control::MouseButtonUp( rMEvt );
     354           0 : }
     355             : 
     356           0 : void DialControl::KeyInput( const KeyEvent& rKEvt )
     357             : {
     358           0 :     const KeyCode& rKCode = rKEvt.GetKeyCode();
     359           0 :     if( !rKCode.GetModifier() && (rKCode.GetCode() == KEY_ESCAPE) )
     360           0 :         HandleEscapeEvent();
     361             :     else
     362           0 :         Control::KeyInput( rKEvt );
     363           0 : }
     364             : 
     365           0 : void DialControl::LoseFocus()
     366             : {
     367             :     // release captured mouse
     368           0 :     HandleEscapeEvent();
     369           0 :     Control::LoseFocus();
     370           0 : }
     371             : 
     372           0 : bool DialControl::HasRotation() const
     373             : {
     374           0 :     return !mpImpl->mbNoRot;
     375             : }
     376             : 
     377           0 : void DialControl::SetNoRotation()
     378             : {
     379           0 :     if( !mpImpl->mbNoRot )
     380             :     {
     381           0 :         mpImpl->mbNoRot = true;
     382           0 :         InvalidateControl();
     383           0 :         if( mpImpl->mpLinkField )
     384           0 :             mpImpl->mpLinkField->SetText( "" );
     385             :     }
     386           0 : }
     387             : 
     388           0 : sal_Int32 DialControl::GetRotation() const
     389             : {
     390           0 :     return mpImpl->mnAngle;
     391             : }
     392             : 
     393           0 : Size DialControl::GetOptimalSize() const
     394             : {
     395           0 :     return LogicToPixel(Size(42 , 43), MAP_APPFONT);
     396             : }
     397             : 
     398           0 : void DialControl::SetRotation( sal_Int32 nAngle )
     399             : {
     400           0 :     SetRotation( nAngle, false );
     401           0 : }
     402             : 
     403           0 : void DialControl::SetLinkedField( NumericField* pField, sal_Int32 nDecimalPlaces )
     404             : {
     405           0 :     mpImpl->mnLinkedFieldValueMultiplyer = 100 / std::pow(10.0, double(nDecimalPlaces));
     406             : 
     407             :     // remove modify handler from old linked field
     408           0 :     ImplSetFieldLink( Link() );
     409             :     // remember the new linked field
     410           0 :     mpImpl->mpLinkField = pField;
     411             :     // set modify handler at new linked field
     412           0 :     ImplSetFieldLink( LINK( this, DialControl, LinkedFieldModifyHdl ) );
     413           0 : }
     414             : 
     415           0 : void DialControl::SaveValue()
     416             : {
     417           0 :     mpImpl->mnInitialAngle = mpImpl->mnAngle;
     418           0 : }
     419             : 
     420           0 : bool DialControl::IsValueModified()
     421             : {
     422           0 :     return mpImpl->mnInitialAngle != mpImpl->mnAngle;
     423             : }
     424             : 
     425           0 : void DialControl::SetModifyHdl( const Link& rLink )
     426             : {
     427           0 :     mpImpl->maModifyHdl = rLink;
     428           0 : }
     429             : 
     430             : // private --------------------------------------------------------------------
     431             : 
     432           0 : void DialControl::Init( const Size& rWinSize, const Font& rWinFont )
     433             : {
     434           0 :     mpImpl->Init( rWinSize, rWinFont );
     435           0 :     EnableRTL( false ); // don't mirror mouse handling
     436           0 :     SetOutputSizePixel( mpImpl->maWinSize );
     437           0 :     SetBackground();
     438           0 : }
     439             : 
     440           0 : void DialControl::Init( const Size& rWinSize )
     441             : {
     442             :     //hidpi TODO: GetDefaultFont() picks a font size too small, so fix it here.
     443           0 :     Font aDefaultSize = GetFont();
     444             : 
     445             :     Font aFont( OutputDevice::GetDefaultFont(
     446           0 :         DEFAULTFONT_UI_SANS, Application::GetSettings().GetUILanguageTag().getLanguageType(), DEFAULTFONT_FLAGS_ONLYONE ) );
     447             : 
     448           0 :     aFont.SetHeight(aDefaultSize.GetHeight());
     449           0 :     Init( rWinSize, aFont );
     450           0 : }
     451             : 
     452           0 : void DialControl::InvalidateControl()
     453             : {
     454           0 :     mpImpl->mpBmpBuffered->CopyBackground( IsEnabled() ? *mpImpl->mpBmpEnabled : *mpImpl->mpBmpDisabled );
     455           0 :     if( !mpImpl->mbNoRot )
     456           0 :         mpImpl->mpBmpBuffered->DrawElements( GetText(), mpImpl->mnAngle );
     457           0 :     Invalidate();
     458           0 : }
     459             : 
     460           0 : void DialControl::SetRotation( sal_Int32 nAngle, bool bBroadcast )
     461             : {
     462           0 :     bool bOldSel = mpImpl->mbNoRot;
     463           0 :     mpImpl->mbNoRot = false;
     464             : 
     465           0 :     while( nAngle < 0 )
     466           0 :         nAngle += 36000;
     467             : 
     468           0 :     if( !bOldSel || (mpImpl->mnAngle != nAngle) )
     469             :     {
     470           0 :         mpImpl->mnAngle = nAngle;
     471           0 :         InvalidateControl();
     472           0 :         if( mpImpl->mpLinkField )
     473           0 :             mpImpl->mpLinkField->SetValue( static_cast< long >( GetRotation() / mpImpl->mnLinkedFieldValueMultiplyer ) );
     474           0 :         if( bBroadcast )
     475           0 :             mpImpl->maModifyHdl.Call( this );
     476             :     }
     477           0 : }
     478             : 
     479           0 : void DialControl::ImplSetFieldLink( const Link& rLink )
     480             : {
     481           0 :     if( mpImpl->mpLinkField )
     482             :     {
     483           0 :         NumericField& rField = *mpImpl->mpLinkField;
     484           0 :         rField.SetModifyHdl( rLink );
     485           0 :         rField.SetUpHdl( rLink );
     486           0 :         rField.SetDownHdl( rLink );
     487           0 :         rField.SetFirstHdl( rLink );
     488           0 :         rField.SetLastHdl( rLink );
     489           0 :         rField.SetLoseFocusHdl( rLink );
     490             :     }
     491           0 : }
     492             : 
     493           0 : void DialControl::HandleMouseEvent( const Point& rPos, bool bInitial )
     494             : {
     495           0 :     long nX = rPos.X() - mpImpl->mnCenterX;
     496           0 :     long nY = mpImpl->mnCenterY - rPos.Y();
     497           0 :     double fH = sqrt( static_cast< double >( nX ) * nX + static_cast< double >( nY ) * nY );
     498           0 :     if( fH != 0.0 )
     499             :     {
     500           0 :         double fAngle = acos( nX / fH );
     501           0 :         sal_Int32 nAngle = static_cast< sal_Int32 >( fAngle / F_PI180 * 100.0 );
     502           0 :         if( nY < 0 )
     503           0 :             nAngle = 36000 - nAngle;
     504           0 :         if( bInitial )  // round to entire 15 degrees
     505           0 :             nAngle = ((nAngle + 750) / 1500) * 1500;
     506             :         // Round up to 1 degree
     507           0 :         nAngle = (((nAngle + 50) / 100) * 100) % 36000;
     508           0 :         SetRotation( nAngle, true );
     509             :     }
     510           0 : }
     511             : 
     512           0 : void DialControl::HandleEscapeEvent()
     513             : {
     514           0 :     if( IsMouseCaptured() )
     515             :     {
     516           0 :         ReleaseMouse();
     517           0 :         SetRotation( mpImpl->mnOldAngle, true );
     518           0 :         if( mpImpl->mpLinkField )
     519           0 :             mpImpl->mpLinkField->GrabFocus();
     520             :     }
     521           0 : }
     522             : 
     523           0 : IMPL_LINK( DialControl, LinkedFieldModifyHdl, NumericField*, pField )
     524             : {
     525           0 :     if( pField )
     526           0 :         SetRotation( static_cast< sal_Int32 >( pField->GetValue() * mpImpl->mnLinkedFieldValueMultiplyer ), false );
     527           0 :     return 0;
     528             : }
     529             : 
     530             : 
     531             : 
     532           0 : DialControlWrapper::DialControlWrapper( DialControl& rDial ) :
     533           0 :     SingleControlWrapperType( rDial )
     534             : {
     535           0 : }
     536             : 
     537           0 : bool DialControlWrapper::IsControlDontKnow() const
     538             : {
     539           0 :     return !GetControl().HasRotation();
     540             : }
     541             : 
     542           0 : void DialControlWrapper::SetControlDontKnow( bool bSet )
     543             : {
     544           0 :     if( bSet )
     545           0 :         GetControl().SetNoRotation();
     546           0 : }
     547             : 
     548           0 : sal_Int32 DialControlWrapper::GetControlValue() const
     549             : {
     550           0 :     return GetControl().GetRotation();
     551             : }
     552             : 
     553           0 : void DialControlWrapper::SetControlValue( sal_Int32 nValue )
     554             : {
     555           0 :     GetControl().SetRotation( nValue );
     556           0 : }
     557             : 
     558             : 
     559             : 
     560             : } // namespace svx
     561             : 
     562             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10