LCOV - code coverage report
Current view: top level - sd/source/ui/dlg - diactrl.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 57 0.0 %
Date: 2014-04-14 Functions: 0 14 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 <com/sun/star/presentation/FadeEffect.hpp>
      21             : 
      22             : #include <svx/dialogs.hrc>
      23             : 
      24             : #include "sdattr.hxx"
      25             : #include "strings.hrc"
      26             : 
      27             : #include "diactrl.hxx"
      28             : 
      29             : #include "sdresid.hxx"
      30             : #include "app.hrc"
      31             : #include "res_bmp.hrc"
      32             : #include <sfx2/dispatch.hxx>
      33             : #include <sfx2/viewfrm.hxx>
      34             : #include <sfx2/app.hxx>
      35             : 
      36             : using namespace ::com::sun::star;
      37             : 
      38           0 : SFX_IMPL_TOOLBOX_CONTROL( SdTbxCtlDiaPages,  SfxUInt16Item )
      39             : 
      40             : // SdPagesField
      41           0 : SdPagesField::SdPagesField( Window* pParent,
      42             :                             const uno::Reference< frame::XFrame >& rFrame,
      43             :                             WinBits nBits ) :
      44             :     SvxMetricField  ( pParent, rFrame, nBits ),
      45           0 :     m_xFrame        ( rFrame )
      46             : {
      47           0 :     OUString aStr( SD_RESSTR( STR_SLIDE_PLURAL ) );
      48           0 :     SetCustomUnitText( aStr );
      49             : 
      50             :     // set size
      51           0 :     aStr += "XXX";
      52           0 :     Size aSize( GetTextWidth( aStr )+20, GetTextHeight()+6 );
      53             : 
      54             : 
      55           0 :     SetSizePixel( aSize );
      56             : 
      57             :     // set parameter of MetricFields
      58           0 :     SetUnit( FUNIT_CUSTOM );
      59           0 :     SetMin( 1 );
      60           0 :     SetFirst( 1 );
      61           0 :     SetMax( 15 );
      62           0 :     SetLast( 15 );
      63           0 :     SetSpinSize( 1 );
      64           0 :     SetDecimalDigits( 0 );
      65           0 :     Show();
      66           0 : }
      67             : 
      68             : 
      69             : 
      70           0 : SdPagesField::~SdPagesField()
      71             : {
      72           0 : }
      73             : 
      74             : 
      75             : 
      76           0 : void SdPagesField::UpdatePagesField( const SfxUInt16Item* pItem )
      77             : {
      78           0 :     if( pItem )
      79             :     {
      80           0 :         long nValue = (long) pItem->GetValue();
      81           0 :         SetValue( nValue );
      82           0 :         if( nValue == 1 )
      83           0 :             SetCustomUnitText( SD_RESSTR( STR_SLIDE_SINGULAR ) );
      84             :         else
      85           0 :             SetCustomUnitText( SD_RESSTR( STR_SLIDE_PLURAL ) );
      86             :     }
      87             :     else
      88           0 :         SetText( OUString() );
      89           0 : }
      90             : 
      91             : 
      92             : 
      93           0 : void SdPagesField::Modify()
      94             : {
      95           0 :     SfxUInt16Item aItem( SID_PAGES_PER_ROW, (sal_uInt16) GetValue() );
      96             : 
      97           0 :     ::uno::Any a;
      98           0 :     ::uno::Sequence< ::beans::PropertyValue > aArgs( 1 );
      99           0 :     aArgs[0].Name   = "PagesPerRow";
     100           0 :     aItem.QueryValue( a );
     101           0 :     aArgs[0].Value  = a;
     102           0 :     SfxToolBoxControl::Dispatch( ::uno::Reference< ::frame::XDispatchProvider >( m_xFrame->getController(), ::uno::UNO_QUERY ),
     103             :                                  ".uno:PagesPerRow",
     104           0 :                                  aArgs );
     105           0 : }
     106             : 
     107           0 : SdTbxCtlDiaPages::SdTbxCtlDiaPages( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
     108           0 :     SfxToolBoxControl( nSlotId, nId, rTbx )
     109             : {
     110           0 : }
     111             : 
     112             : 
     113             : 
     114           0 : SdTbxCtlDiaPages::~SdTbxCtlDiaPages()
     115             : {
     116           0 : }
     117             : 
     118             : 
     119             : 
     120           0 : void SdTbxCtlDiaPages::StateChanged( sal_uInt16,
     121             :                 SfxItemState eState, const SfxPoolItem* pState )
     122             : {
     123           0 :     SdPagesField* pFld = (SdPagesField*) GetToolBox().GetItemWindow( GetId() );
     124             :     DBG_ASSERT( pFld, "Window not found" );
     125             : 
     126           0 :     if ( eState == SFX_ITEM_DISABLED )
     127             :     {
     128           0 :         pFld->Disable();
     129           0 :         pFld->SetText( OUString() );
     130             :     }
     131             :     else
     132             :     {
     133           0 :         pFld->Enable();
     134             : 
     135           0 :         const SfxUInt16Item* pItem = 0;
     136           0 :         if ( eState == SFX_ITEM_AVAILABLE )
     137             :         {
     138           0 :             pItem = dynamic_cast< const SfxUInt16Item* >( pState );
     139             :             DBG_ASSERT( pItem, "sd::SdTbxCtlDiaPages::StateChanged(), wrong item type!" );
     140             :         }
     141             : 
     142           0 :         pFld->UpdatePagesField( pItem );
     143             :     }
     144           0 : }
     145             : 
     146             : 
     147             : 
     148           0 : Window* SdTbxCtlDiaPages::CreateItemWindow( Window* pParent )
     149             : {
     150           0 :     return new SdPagesField( pParent, m_xFrame );
     151           0 : }
     152             : 
     153             : 
     154             : 
     155             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10