LCOV - code coverage report
Current view: top level - libreoffice/cui/source/tabpages - textanim.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 370 0.3 %
Date: 2012-12-17 Functions: 2 24 8.3 %
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 <sfx2/app.hxx>
      21             : #include <sfx2/module.hxx>
      22             : #include <tools/shl.hxx>
      23             : 
      24             : #include <cuires.hrc>
      25             : #include <svx/dialogs.hrc>
      26             : 
      27             : #ifndef _SVX_TEXTANIM_CXX
      28             : #define _SVX_TEXTANIM_CXX
      29             : #endif
      30             : #include "textanim.hxx"
      31             : #include "textanim.hrc"
      32             : #include "textattr.hxx"
      33             : #include <dialmgr.hxx>
      34             : #include "svx/dlgutil.hxx"
      35             : 
      36             : static sal_uInt16 pRanges[] =
      37             : {
      38             :     SDRATTR_TEXT_ANIKIND,
      39             :     SDRATTR_TEXT_ANIAMOUNT,
      40             :     0
      41             : };
      42             : 
      43             : /*************************************************************************
      44             : |*
      45             : |* constructor of the tab dialog: adds pages to the dialog
      46             : |*
      47             : \************************************************************************/
      48             : 
      49           0 : SvxTextTabDialog::SvxTextTabDialog( Window* pParent,
      50             :                                 const SfxItemSet* pAttr,
      51             :                                 const SdrView* pSdrView ) :
      52           0 :         SfxTabDialog        ( pParent, CUI_RES( RID_SVXDLG_TEXT ), pAttr ),
      53           0 :         pView               ( pSdrView )
      54             : {
      55           0 :     FreeResource();
      56             : 
      57           0 :     AddTabPage( RID_SVXPAGE_TEXTATTR, SvxTextAttrPage::Create, 0);
      58           0 :     AddTabPage( RID_SVXPAGE_TEXTANIMATION, SvxTextAnimationPage::Create, 0);
      59           0 : }
      60             : 
      61             : /*************************************************************************
      62             : |*
      63             : |* PageCreated()
      64             : |*
      65             : \************************************************************************/
      66             : 
      67           0 : void SvxTextTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
      68             : {
      69           0 :     switch( nId )
      70             :     {
      71             :         case RID_SVXPAGE_TEXTATTR:
      72             :         {
      73           0 :             ( (SvxTextAttrPage&) rPage ).SetView( pView );
      74           0 :             ( (SvxTextAttrPage&) rPage ).Construct();
      75             :         }
      76           0 :         break;
      77             : 
      78             :         case RID_SVXPAGE_TEXTANIMATION:
      79           0 :         break;
      80             : 
      81             :         default:
      82           0 :         break;
      83             :     }
      84           0 : }
      85             : 
      86             : 
      87             : /*************************************************************************
      88             : |*
      89             : |* Page
      90             : |*
      91             : \************************************************************************/
      92             : 
      93           0 : SvxTextAnimationPage::SvxTextAnimationPage( Window* pWindow, const SfxItemSet& rInAttrs ) :
      94           0 :                 SfxTabPage      ( pWindow, CUI_RES( RID_SVXPAGE_TEXTANIMATION ),
      95             :                                   rInAttrs ),
      96           0 :                 aFlEffect       ( this, CUI_RES(FL_EFFECT)),
      97           0 :                 aFtEffects      ( this, CUI_RES(FT_EFFECTS)),
      98           0 :                 aLbEffect       ( this, CUI_RES( LB_EFFECT ) ),
      99             :                 //aCtlEffect        ( this, CUI_RES( CTL_EFFECT ) ),
     100           0 :                 aFtDirection    ( this, CUI_RES(FT_DIRECTION) ),
     101           0 :                 aBtnUp          ( this, CUI_RES( BTN_UP ) ),
     102           0 :                 aBtnLeft        ( this, CUI_RES( BTN_LEFT ) ),
     103           0 :                 aBtnRight       ( this, CUI_RES( BTN_RIGHT ) ),
     104           0 :                 aBtnDown        ( this, CUI_RES( BTN_DOWN ) ),
     105             : 
     106           0 :                 aFlProperties   ( this, CUI_RES(FL_PROPERTIES)),
     107           0 :                 aTsbStartInside ( this, CUI_RES( TSB_START_INSIDE ) ),
     108           0 :                 aTsbStopInside  ( this, CUI_RES( TSB_STOP_INSIDE ) ),
     109             : 
     110           0 :                 aFtCount        ( this, CUI_RES(FT_COUNT)),
     111           0 :                 aTsbEndless     ( this, CUI_RES( TSB_ENDLESS ) ),
     112           0 :                 aNumFldCount    ( this, CUI_RES( NUM_FLD_COUNT ) ),
     113             : 
     114           0 :                 aFtAmount       ( this, CUI_RES(FT_AMOUNT)),
     115           0 :                 aTsbPixel       ( this, CUI_RES( TSB_PIXEL ) ),
     116           0 :                 aMtrFldAmount   ( this, CUI_RES( MTR_FLD_AMOUNT ) ),
     117             : 
     118           0 :                 aFtDelay        ( this, CUI_RES(FT_DELAY)),
     119           0 :                 aTsbAuto        ( this, CUI_RES( TSB_AUTO ) ),
     120           0 :                 aMtrFldDelay    ( this, CUI_RES( MTR_FLD_DELAY ) ),
     121             : 
     122             :                 rOutAttrs       ( rInAttrs ),
     123           0 :                 eAniKind        ( SDRTEXTANI_NONE )
     124             : {
     125           0 :     FreeResource();
     126             : 
     127           0 :     eFUnit = GetModuleFieldUnit( rInAttrs );
     128           0 :     SfxItemPool* pPool = rOutAttrs.GetPool();
     129             :     DBG_ASSERT( pPool, "Wo ist der Pool" );
     130           0 :     eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST );
     131             : 
     132           0 :     Construct();
     133             : 
     134             :     aLbEffect.SetSelectHdl(
     135           0 :         LINK( this, SvxTextAnimationPage, SelectEffectHdl_Impl ) );
     136             :     aTsbEndless.SetClickHdl(
     137           0 :         LINK( this, SvxTextAnimationPage, ClickEndlessHdl_Impl ) );
     138             :     aTsbAuto.SetClickHdl(
     139           0 :         LINK( this, SvxTextAnimationPage, ClickAutoHdl_Impl ) );
     140             :     aTsbPixel.SetClickHdl(
     141           0 :         LINK( this, SvxTextAnimationPage, ClickPixelHdl_Impl ) );
     142             : 
     143           0 :     Link aLink( LINK( this, SvxTextAnimationPage, ClickDirectionHdl_Impl ) );
     144           0 :     aBtnUp.SetClickHdl( aLink );
     145           0 :     aBtnLeft.SetClickHdl( aLink );
     146           0 :     aBtnRight.SetClickHdl( aLink );
     147           0 :     aBtnDown.SetClickHdl( aLink );
     148             : 
     149           0 :     aNumFldCount.SetAccessibleRelationLabeledBy( &aTsbEndless );
     150           0 :     aMtrFldAmount.SetAccessibleRelationLabeledBy( &aTsbPixel );
     151           0 :     aMtrFldDelay.SetAccessibleRelationLabeledBy( &aTsbAuto );
     152             : 
     153           0 :     aBtnUp.SetAccessibleRelationLabeledBy( &aFtDirection );
     154           0 :     aBtnLeft.SetAccessibleRelationLabeledBy( &aFtDirection );
     155           0 :     aBtnRight.SetAccessibleRelationLabeledBy( &aFtDirection );
     156           0 :     aBtnDown.SetAccessibleRelationLabeledBy( &aFtDirection );
     157             : 
     158           0 :     aBtnUp.SetAccessibleRelationMemberOf( &aFlEffect );
     159           0 :     aBtnLeft.SetAccessibleRelationMemberOf( &aFlEffect );
     160           0 :     aBtnRight.SetAccessibleRelationMemberOf( &aFlEffect );
     161           0 :     aBtnDown.SetAccessibleRelationMemberOf( &aFlEffect );
     162             : 
     163           0 :     aTsbEndless.SetAccessibleRelationLabeledBy( &aFtCount );
     164           0 :     aTsbPixel.SetAccessibleRelationLabeledBy( &aFtAmount );
     165           0 :     aTsbAuto.SetAccessibleRelationLabeledBy( &aFtDelay );
     166           0 : }
     167             : 
     168             : /*************************************************************************
     169             : |*
     170             : |* Dtor
     171             : |*
     172             : \************************************************************************/
     173             : 
     174           0 : SvxTextAnimationPage::~SvxTextAnimationPage()
     175             : {
     176           0 : }
     177             : 
     178             : /*************************************************************************
     179             : |*
     180             : |* reads the passed item set
     181             : |*
     182             : \************************************************************************/
     183             : 
     184           0 : void SvxTextAnimationPage::Reset( const SfxItemSet& rAttrs )
     185             : {
     186           0 :     const SfxItemPool* pPool = rAttrs.GetPool();
     187             : 
     188             :     // animation type
     189           0 :     const SfxPoolItem* pItem = GetItem( rAttrs, SDRATTR_TEXT_ANIKIND );
     190             : 
     191           0 :     if( !pItem )
     192           0 :         pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIKIND );
     193           0 :     if( pItem )
     194             :     {
     195           0 :         eAniKind = ( ( const SdrTextAniKindItem* )pItem )->GetValue();
     196           0 :         aLbEffect.SelectEntryPos( sal::static_int_cast< sal_uInt16 >(eAniKind) );
     197             :     }
     198             :     else
     199           0 :         aLbEffect.SetNoSelection();
     200           0 :     aLbEffect.SaveValue();
     201             : 
     202             :     // animation direction
     203           0 :     pItem = GetItem( rAttrs, SDRATTR_TEXT_ANIDIRECTION );
     204           0 :     if( !pItem )
     205           0 :         pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIDIRECTION );
     206           0 :     if( pItem )
     207             :     {
     208           0 :         SdrTextAniDirection eValue = ( ( const SdrTextAniDirectionItem* )pItem )->GetValue();
     209           0 :         SelectDirection( eValue );
     210             :     }
     211             :     else
     212             :     {
     213           0 :         aBtnUp.Check( sal_False );
     214           0 :         aBtnLeft.Check( sal_False );
     215           0 :         aBtnRight.Check( sal_False );
     216           0 :         aBtnDown.Check( sal_False );
     217             :     }
     218           0 :     aBtnUp.SaveValue();
     219           0 :     aBtnLeft.SaveValue();
     220           0 :     aBtnRight.SaveValue();
     221           0 :     aBtnDown.SaveValue();
     222             : 
     223             :     // Start inside
     224           0 :     pItem = GetItem( rAttrs, SDRATTR_TEXT_ANISTARTINSIDE );
     225           0 :     if( !pItem )
     226           0 :         pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANISTARTINSIDE );
     227           0 :     if( pItem )
     228             :     {
     229           0 :         aTsbStartInside.EnableTriState( sal_False );
     230           0 :         sal_Bool bValue = ( ( const SdrTextAniStartInsideItem* )pItem )->GetValue();
     231           0 :         if( bValue )
     232           0 :             aTsbStartInside.SetState( STATE_CHECK );
     233             :         else
     234           0 :             aTsbStartInside.SetState( STATE_NOCHECK );
     235             :     }
     236             :     else
     237           0 :         aTsbStartInside.SetState( STATE_DONTKNOW );
     238           0 :     aTsbStartInside.SaveValue();
     239             : 
     240             :     // Stop inside
     241           0 :     pItem = GetItem( rAttrs, SDRATTR_TEXT_ANISTOPINSIDE );
     242           0 :     if( !pItem )
     243           0 :         pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANISTOPINSIDE );
     244           0 :     if( pItem )
     245             :     {
     246           0 :         aTsbStopInside.EnableTriState( sal_False );
     247           0 :         sal_Bool bValue = ( ( const SdrTextAniStopInsideItem* )pItem )->GetValue();
     248           0 :         if( bValue )
     249           0 :             aTsbStopInside.SetState( STATE_CHECK );
     250             :         else
     251           0 :             aTsbStopInside.SetState( STATE_NOCHECK );
     252             :     }
     253             :     else
     254           0 :         aTsbStopInside.SetState( STATE_DONTKNOW );
     255           0 :     aTsbStopInside.SaveValue();
     256             : 
     257             :     // quantity
     258           0 :     pItem = GetItem( rAttrs, SDRATTR_TEXT_ANICOUNT );
     259           0 :     if( !pItem )
     260           0 :         pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANICOUNT );
     261           0 :     if( pItem )
     262             :     {
     263           0 :         aTsbEndless.EnableTriState( sal_False );
     264           0 :         long nValue = (long) ( ( const SdrTextAniCountItem* )pItem )->GetValue();
     265           0 :         aNumFldCount.SetValue( nValue );
     266           0 :         if( nValue == 0 )
     267             :         {
     268           0 :             if( eAniKind == SDRTEXTANI_SLIDE )
     269             :             {
     270           0 :                 aTsbEndless.SetState( STATE_NOCHECK );
     271           0 :                 aTsbEndless.Enable( sal_False );
     272             :             }
     273             :             else
     274             :             {
     275           0 :                 aTsbEndless.SetState( STATE_CHECK );
     276           0 :                 aNumFldCount.SetEmptyFieldValue();
     277             :             }
     278             :         }
     279             :         else
     280           0 :             aTsbEndless.SetState( STATE_NOCHECK );
     281             :     }
     282             :     else
     283             :     {
     284           0 :         aNumFldCount.SetEmptyFieldValue();
     285           0 :         aTsbEndless.SetState( STATE_DONTKNOW );
     286             :     }
     287           0 :     aTsbEndless.SaveValue();
     288           0 :     aNumFldCount.SaveValue();
     289             : 
     290             :     // delay
     291           0 :     pItem = GetItem( rAttrs, SDRATTR_TEXT_ANIDELAY );
     292           0 :     if( !pItem )
     293           0 :         pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIDELAY );
     294           0 :     if( pItem )
     295             :     {
     296           0 :         aTsbAuto.EnableTriState( sal_False );
     297           0 :         long nValue = (long) ( ( const SdrTextAniDelayItem* )pItem )->GetValue();
     298           0 :         aMtrFldDelay.SetValue( nValue );
     299           0 :         if( nValue == 0 )
     300             :         {
     301           0 :             aTsbAuto.SetState( STATE_CHECK );
     302           0 :             aMtrFldDelay.SetEmptyFieldValue();
     303             :         }
     304             :         else
     305           0 :             aTsbAuto.SetState( STATE_NOCHECK );
     306             :     }
     307             :     else
     308             :     {
     309           0 :         aMtrFldDelay.SetEmptyFieldValue();
     310           0 :         aTsbAuto.SetState( STATE_DONTKNOW );
     311             :     }
     312           0 :     aTsbAuto.SaveValue();
     313           0 :     aMtrFldDelay.SaveValue();
     314             : 
     315             :     // step size
     316           0 :     pItem = GetItem( rAttrs, SDRATTR_TEXT_ANIAMOUNT );
     317           0 :     if( !pItem )
     318           0 :         pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIAMOUNT );
     319           0 :     if( pItem )
     320             :     {
     321           0 :         aTsbPixel.EnableTriState( sal_False );
     322           0 :         long nValue = (long) ( ( const SdrTextAniAmountItem* )pItem )->GetValue();
     323           0 :         if( nValue <= 0 )
     324             :         {
     325           0 :             aTsbPixel.SetState( STATE_CHECK );
     326           0 :             nValue = -nValue;
     327           0 :             if( nValue == 0 )
     328           0 :                 nValue++;
     329           0 :             aMtrFldAmount.SetUnit( FUNIT_CUSTOM );
     330           0 :             aMtrFldAmount.SetDecimalDigits( 0 );
     331             : 
     332           0 :             aMtrFldAmount.SetSpinSize( 1 );
     333           0 :             aMtrFldAmount.SetMin( 1 );
     334           0 :             aMtrFldAmount.SetFirst( 1 );
     335           0 :             aMtrFldAmount.SetMax( 100 );
     336           0 :             aMtrFldAmount.SetLast( 100 );
     337             : 
     338           0 :             aMtrFldAmount.SetValue( nValue );
     339             :         }
     340             :         else
     341             :         {
     342           0 :             aTsbPixel.SetState( STATE_NOCHECK );
     343           0 :             aMtrFldAmount.SetUnit( eFUnit );
     344           0 :             aMtrFldAmount.SetDecimalDigits( 2 );
     345             : 
     346           0 :             aMtrFldAmount.SetSpinSize( 10 );
     347           0 :             aMtrFldAmount.SetMin( 1 );
     348           0 :             aMtrFldAmount.SetFirst( 1 );
     349           0 :             aMtrFldAmount.SetMax( 10000 );
     350           0 :             aMtrFldAmount.SetLast( 10000 );
     351             : 
     352           0 :             SetMetricValue( aMtrFldAmount, nValue, eUnit );
     353             :         }
     354             :     }
     355             :     else
     356             :     {
     357           0 :         aMtrFldAmount.Disable();
     358           0 :         aMtrFldAmount.SetEmptyFieldValue();
     359           0 :         aTsbPixel.SetState( STATE_DONTKNOW );
     360             :     }
     361           0 :     aTsbPixel.SaveValue();
     362           0 :     aMtrFldAmount.SaveValue();
     363             : 
     364             : 
     365           0 :     SelectEffectHdl_Impl( NULL );
     366           0 :     ClickEndlessHdl_Impl( NULL );
     367           0 :     ClickAutoHdl_Impl( NULL );
     368             :     //ClickPixelHdl_Impl( NULL );
     369           0 : }
     370             : 
     371             : /*************************************************************************
     372             : |*
     373             : |* fills the passed item set with dialog box attributes
     374             : |*
     375             : \************************************************************************/
     376             : 
     377           0 : sal_Bool SvxTextAnimationPage::FillItemSet( SfxItemSet& rAttrs)
     378             : {
     379           0 :     sal_Bool bModified = sal_False;
     380             :     sal_uInt16 nPos;
     381             :     TriState eState;
     382             : 
     383             :     // animation type
     384           0 :     nPos = aLbEffect.GetSelectEntryPos();
     385           0 :     if( nPos != LISTBOX_ENTRY_NOTFOUND &&
     386           0 :         nPos != aLbEffect.GetSavedValue() )
     387             :     {
     388           0 :         rAttrs.Put( SdrTextAniKindItem( (SdrTextAniKind) nPos ) );
     389           0 :         bModified = sal_True;
     390             :     }
     391             : 
     392             :     // animation direction
     393           0 :     if( aBtnUp.GetSavedValue() != aBtnUp.IsChecked() ||
     394           0 :         aBtnLeft.GetSavedValue() != aBtnLeft.IsChecked() ||
     395           0 :         aBtnRight.GetSavedValue() != aBtnRight.IsChecked() ||
     396           0 :         aBtnDown.GetSavedValue() != aBtnDown.IsChecked() )
     397             :     {
     398           0 :         SdrTextAniDirection eValue = (SdrTextAniDirection) GetSelectedDirection();
     399           0 :         rAttrs.Put( SdrTextAniDirectionItem( eValue ) );
     400           0 :         bModified = sal_True;
     401             :     }
     402             : 
     403             :     // Start inside
     404           0 :     eState = aTsbStartInside.GetState();
     405           0 :     if( eState != aTsbStartInside.GetSavedValue() )
     406             :     {
     407           0 :         rAttrs.Put( SdrTextAniStartInsideItem( (sal_Bool) STATE_CHECK == eState ) );
     408           0 :         bModified = sal_True;
     409             :     }
     410             : 
     411             :     // Stop inside
     412           0 :     eState = aTsbStopInside.GetState();
     413           0 :     if( eState != aTsbStopInside.GetSavedValue() )
     414             :     {
     415           0 :         rAttrs.Put( SdrTextAniStopInsideItem( (sal_Bool) STATE_CHECK == eState ) );
     416           0 :         bModified = sal_True;
     417             :     }
     418             : 
     419             :     // quantity
     420           0 :     eState = aTsbEndless.GetState();
     421           0 :     String aStr = aNumFldCount.GetText();
     422           0 :     if( eState != aTsbEndless.GetSavedValue() ||
     423           0 :         aStr != aNumFldCount.GetSavedValue() )
     424             :     {
     425           0 :         sal_Int64 nValue = 0;
     426           0 :         if( eState == STATE_CHECK /*#89844#*/ && aTsbEndless.IsEnabled())
     427           0 :             bModified = sal_True;
     428             :         else
     429             :         {
     430           0 :             if( aStr != aNumFldCount.GetSavedValue() )
     431             :             {
     432           0 :                 nValue = aNumFldCount.GetValue();
     433           0 :                 bModified = sal_True;
     434             :             }
     435             :         }
     436           0 :         if( bModified )
     437           0 :             rAttrs.Put( SdrTextAniCountItem( (sal_uInt16) nValue ) );
     438             :     }
     439             : 
     440             :     // delay
     441           0 :     eState = aTsbAuto.GetState();
     442           0 :     aStr = aMtrFldDelay.GetText();
     443           0 :     if( eState != aTsbAuto.GetSavedValue() ||
     444           0 :         aStr != aMtrFldDelay.GetSavedValue() )
     445             :     {
     446           0 :         sal_Int64 nValue = 0;
     447           0 :         if( eState == STATE_CHECK )
     448           0 :             bModified = sal_True;
     449             :         else
     450             :         {
     451           0 :             if( aStr != aMtrFldDelay.GetSavedValue() )
     452             :             {
     453           0 :                 nValue = aMtrFldDelay.GetValue();
     454           0 :                 bModified = sal_True;
     455             :             }
     456             :         }
     457           0 :         if( bModified )
     458           0 :             rAttrs.Put( SdrTextAniDelayItem( (sal_uInt16) nValue ) );
     459             :     }
     460             : 
     461             :     // step size
     462           0 :     eState = aTsbPixel.GetState();
     463           0 :     aStr = aMtrFldAmount.GetText();
     464           0 :     if( eState != aTsbPixel.GetSavedValue() ||
     465           0 :         aStr != aMtrFldAmount.GetSavedValue() )
     466             :     {
     467           0 :         sal_Int64 nValue = 0;
     468           0 :         if( eState == STATE_CHECK )
     469             :         {
     470           0 :             nValue = aMtrFldAmount.GetValue();
     471           0 :             nValue = -nValue;
     472             :         }
     473             :         else
     474             :         {
     475           0 :             nValue = GetCoreValue( aMtrFldAmount, eUnit );
     476             :         }
     477           0 :         rAttrs.Put( SdrTextAniAmountItem( (sal_Int16) nValue ) );
     478             : 
     479           0 :         bModified = sal_True;
     480             :     }
     481             : 
     482           0 :     return( bModified );
     483             : }
     484             : 
     485           0 : void SvxTextAnimationPage::Construct()
     486             : {
     487           0 : }
     488             : 
     489           0 : sal_uInt16* SvxTextAnimationPage::GetRanges()
     490             : {
     491           0 :     return( pRanges );
     492             : }
     493             : 
     494             : /*************************************************************************
     495             : |*
     496             : |* creates the page
     497             : |*
     498             : \************************************************************************/
     499             : 
     500           0 : SfxTabPage* SvxTextAnimationPage::Create( Window* pWindow,
     501             :                 const SfxItemSet& rAttrs )
     502             : {
     503           0 :     return( new SvxTextAnimationPage( pWindow, rAttrs ) );
     504             : }
     505             : 
     506           0 : IMPL_LINK_NOARG(SvxTextAnimationPage, SelectEffectHdl_Impl)
     507             : {
     508           0 :     sal_uInt16 nPos = aLbEffect.GetSelectEntryPos();
     509           0 :     if( nPos != LISTBOX_ENTRY_NOTFOUND )
     510             :     {
     511           0 :         eAniKind = (SdrTextAniKind) nPos;
     512           0 :         switch( eAniKind )
     513             :         {
     514             :             case SDRTEXTANI_NONE:
     515             :             {
     516           0 :                 aFtDirection.Disable();
     517           0 :                 aBtnUp.Disable();
     518           0 :                 aBtnLeft.Disable();
     519           0 :                 aBtnRight.Disable();
     520           0 :                 aBtnDown.Disable();
     521           0 :                 aTsbStartInside.Disable();
     522           0 :                 aTsbStopInside.Disable();
     523             : 
     524           0 :                 aTsbEndless.Disable();
     525           0 :                 aNumFldCount.Disable();
     526           0 :                 aFtCount.Disable();
     527             : 
     528           0 :                 aTsbAuto.Disable();
     529           0 :                 aMtrFldDelay.Disable();
     530           0 :                 aFtDelay.Disable();
     531             : 
     532           0 :                 aTsbPixel.Disable();
     533           0 :                 aMtrFldAmount.Disable();
     534           0 :                 aFtAmount.Disable();
     535             :             }
     536           0 :             break;
     537             : 
     538             :             case SDRTEXTANI_BLINK:
     539             :             case SDRTEXTANI_SCROLL:
     540             :             case SDRTEXTANI_ALTERNATE:
     541             :             case SDRTEXTANI_SLIDE:
     542             :             {
     543           0 :                 if( eAniKind == SDRTEXTANI_SLIDE )
     544             :                 {
     545           0 :                     aTsbStartInside.Disable();
     546           0 :                     aTsbStopInside.Disable();
     547             : 
     548           0 :                     aTsbEndless.Disable();
     549           0 :                     aNumFldCount.Enable();
     550           0 :                     aNumFldCount.SetValue( aNumFldCount.GetValue() );
     551             :                 }
     552             :                 else
     553             :                 {
     554           0 :                     aTsbStartInside.Enable();
     555           0 :                     aTsbStopInside.Enable();
     556             : 
     557           0 :                     aTsbEndless.Enable();
     558           0 :                     ClickEndlessHdl_Impl( NULL );
     559             :                 }
     560           0 :                 aFtCount.Enable();
     561             : 
     562           0 :                 aTsbAuto.Enable();
     563           0 :                 aFtDelay.Enable();
     564           0 :                 ClickAutoHdl_Impl( NULL );
     565             : 
     566           0 :                 if( eAniKind == SDRTEXTANI_BLINK )
     567             :                 {
     568           0 :                     aFtDirection.Disable();
     569           0 :                     aBtnUp.Disable();
     570           0 :                     aBtnLeft.Disable();
     571           0 :                     aBtnRight.Disable();
     572           0 :                     aBtnDown.Disable();
     573             : 
     574           0 :                     aTsbPixel.Disable();
     575           0 :                     aMtrFldAmount.Disable();
     576           0 :                     aFtAmount.Disable();
     577             :                 }
     578             :                 else
     579             :                 {
     580           0 :                     aFtDirection.Enable();
     581           0 :                     aBtnUp.Enable();
     582           0 :                     aBtnLeft.Enable();
     583           0 :                     aBtnRight.Enable();
     584           0 :                     aBtnDown.Enable();
     585             : 
     586           0 :                     aTsbPixel.Enable();
     587           0 :                     aMtrFldAmount.Enable();
     588           0 :                     aFtAmount.Enable();
     589             :                 }
     590             :             }
     591           0 :             break;
     592             :         }
     593             : 
     594             :     }
     595           0 :     return( 0L );
     596             : }
     597             : 
     598           0 : IMPL_LINK_NOARG(SvxTextAnimationPage, ClickEndlessHdl_Impl)
     599             : {
     600             : 
     601           0 :     if( eAniKind != SDRTEXTANI_SLIDE )
     602             :     {
     603           0 :         TriState eState = aTsbEndless.GetState();
     604           0 :         if( eState != STATE_NOCHECK )
     605             :         {
     606           0 :             aNumFldCount.Disable();
     607           0 :             aNumFldCount.SetEmptyFieldValue();
     608             :         }
     609             :         else
     610             :         {
     611           0 :             aNumFldCount.Enable();
     612           0 :             aNumFldCount.SetValue( aNumFldCount.GetValue() );
     613             :         }
     614             :     }
     615           0 :     return( 0L );
     616             : }
     617             : 
     618           0 : IMPL_LINK_NOARG(SvxTextAnimationPage, ClickAutoHdl_Impl)
     619             : {
     620           0 :     TriState eState = aTsbAuto.GetState();
     621           0 :     if( eState != STATE_NOCHECK )
     622             :     {
     623           0 :         aMtrFldDelay.Disable();
     624           0 :         aMtrFldDelay.SetEmptyFieldValue();
     625             :     }
     626             :     else
     627             :     {
     628           0 :         aMtrFldDelay.Enable();
     629           0 :         aMtrFldDelay.SetValue( aMtrFldDelay.GetValue() );
     630             :     }
     631             : 
     632           0 :     return( 0L );
     633             : }
     634             : 
     635           0 : IMPL_LINK_NOARG(SvxTextAnimationPage, ClickPixelHdl_Impl)
     636             : {
     637           0 :     TriState eState = aTsbPixel.GetState();
     638           0 :     if( eState == STATE_CHECK )
     639             :     {
     640           0 :         sal_Int64 nValue = aMtrFldAmount.GetValue() / 10;
     641           0 :         aMtrFldAmount.Enable();
     642           0 :         aMtrFldAmount.SetUnit( FUNIT_CUSTOM );
     643             :         //SetFieldUnit( aMtrFldAmount, FUNIT_CUSTOM );
     644           0 :         aMtrFldAmount.SetDecimalDigits( 0 );
     645             : 
     646           0 :         aMtrFldAmount.SetSpinSize( 1 );
     647           0 :         aMtrFldAmount.SetMin( 1 );
     648           0 :         aMtrFldAmount.SetFirst( 1 );
     649           0 :         aMtrFldAmount.SetMax( 100 );
     650           0 :         aMtrFldAmount.SetLast( 100 );
     651             : 
     652           0 :         aMtrFldAmount.SetValue( nValue );
     653             :     }
     654           0 :     else if( eState == STATE_NOCHECK )
     655             :     {
     656           0 :         sal_Int64 nValue = aMtrFldAmount.GetValue() * 10;
     657           0 :         aMtrFldAmount.Enable();
     658           0 :         aMtrFldAmount.SetUnit( eFUnit );
     659             :         //SetFieldUnit( aMtrFldAmount, eFUnit );
     660           0 :         aMtrFldAmount.SetDecimalDigits( 2 );
     661             : 
     662           0 :         aMtrFldAmount.SetSpinSize( 10 );
     663           0 :         aMtrFldAmount.SetMin( 1 );
     664           0 :         aMtrFldAmount.SetFirst( 1 );
     665           0 :         aMtrFldAmount.SetMax( 10000 );
     666           0 :         aMtrFldAmount.SetLast( 10000 );
     667             : 
     668           0 :         aMtrFldAmount.SetValue( nValue );
     669             :     }
     670             : 
     671           0 :     return( 0L );
     672             : }
     673             : 
     674           0 : IMPL_LINK( SvxTextAnimationPage, ClickDirectionHdl_Impl, ImageButton *, pBtn )
     675             : {
     676           0 :     aBtnUp.Check( pBtn == &aBtnUp );
     677           0 :     aBtnLeft.Check( pBtn == &aBtnLeft );
     678           0 :     aBtnRight.Check( pBtn == &aBtnRight );
     679           0 :     aBtnDown.Check( pBtn == &aBtnDown );
     680             : 
     681           0 :     return( 0L );
     682             : }
     683             : 
     684           0 : void SvxTextAnimationPage::SelectDirection( SdrTextAniDirection nValue )
     685             : {
     686           0 :     aBtnUp.Check( nValue == SDRTEXTANI_UP );
     687           0 :     aBtnLeft.Check( nValue == SDRTEXTANI_LEFT );
     688           0 :     aBtnRight.Check( nValue == SDRTEXTANI_RIGHT );
     689           0 :     aBtnDown.Check( nValue == SDRTEXTANI_DOWN );
     690           0 : }
     691             : 
     692           0 : sal_uInt16 SvxTextAnimationPage::GetSelectedDirection()
     693             : {
     694           0 :     sal_uInt16 nValue = 0;
     695             : 
     696           0 :     if( aBtnUp.IsChecked() )
     697           0 :         nValue = SDRTEXTANI_UP;
     698           0 :     else if( aBtnLeft.IsChecked() )
     699           0 :         nValue = SDRTEXTANI_LEFT;
     700           0 :     else if( aBtnRight.IsChecked() )
     701           0 :         nValue = SDRTEXTANI_RIGHT;
     702           0 :     else if( aBtnDown.IsChecked() )
     703           0 :         nValue = SDRTEXTANI_DOWN;
     704             : 
     705           0 :     return( nValue );
     706           6 : }
     707             : 
     708             : 
     709             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10