LCOV - code coverage report
Current view: top level - svx/source/tbxctrls - extrusioncontrols.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 425 0.2 %
Date: 2012-08-25 Functions: 1 66 1.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 794 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <string>
      31                 :            : 
      32                 :            : #include <com/sun/star/util/XURLTransformer.hpp>
      33                 :            : #include <com/sun/star/awt/MenuItemStyle.hpp>
      34                 :            : #include <com/sun/star/awt/XPopupMenuExtended.hpp>
      35                 :            : #include <com/sun/star/graphic/XGraphic.hpp>
      36                 :            : 
      37                 :            : #include <osl/mutex.hxx>
      38                 :            : 
      39                 :            : #include <svtools/toolbarmenu.hxx>
      40                 :            : #include <vcl/toolbox.hxx>
      41                 :            : #include <sfx2/app.hxx>
      42                 :            : #include <sfx2/dispatch.hxx>
      43                 :            : #include <sfx2/objsh.hxx>
      44                 :            : #include <svl/eitem.hxx>
      45                 :            : #include <vcl/settings.hxx>
      46                 :            : #include <svl/intitem.hxx>
      47                 :            : #include <editeng/colritem.hxx>
      48                 :            : 
      49                 :            : #include <svx/dialogs.hrc>
      50                 :            : #include <svx/svdtrans.hxx>
      51                 :            : #include <svx/sdasitm.hxx>
      52                 :            : #include <svx/dialmgr.hxx>
      53                 :            : #include "svx/extrusioncolorcontrol.hxx"
      54                 :            : 
      55                 :            : #include "helpid.hrc"
      56                 :            : #include "extrusioncontrols.hxx"
      57                 :            : #include "extrusioncontrols.hrc"
      58                 :            : #include "colorwindow.hxx"
      59                 :            : #include "extrusiondepthdialog.hxx"
      60                 :            : 
      61                 :            : ////////////
      62                 :            : 
      63                 :            : using ::rtl::OUString;
      64                 :            : //using ::svtools::ToolbarMenu;
      65                 :            : 
      66                 :            : using namespace ::com::sun::star;
      67                 :            : using namespace ::com::sun::star::uno;
      68                 :            : using namespace ::com::sun::star::lang;
      69                 :            : using namespace ::com::sun::star::beans;
      70                 :            : using namespace ::com::sun::star::util;
      71                 :            : using namespace ::com::sun::star::graphic;
      72                 :            : 
      73                 :            : namespace svx
      74                 :            : {
      75                 :            : 
      76                 :            : /*************************************************************************
      77                 :            : |*
      78                 :            : |* ExtrusionDirectionWindow
      79                 :            : |*
      80                 :            : \************************************************************************/
      81                 :            : 
      82                 :            : static sal_Int32 gSkewList[] = { 135, 90, 45, 180, 0, -360, -135, -90, -45 };
      83                 :            : 
      84                 :          0 : ExtrusionDirectionWindow::ExtrusionDirectionWindow(
      85                 :            :     svt::ToolboxController& rController,
      86                 :            :     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
      87                 :            :     Window* pParentWindow
      88                 :            : )
      89                 :          0 : :   ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DIRECTION )) ,
      90                 :            :     mrController( rController ) ,
      91         [ #  # ]:          0 :     maImgPerspective( SVX_RES( IMG_PERSPECTIVE ) ) ,
      92         [ #  # ]:          0 :     maImgParallel(    SVX_RES( IMG_PARALLEL    ) ) ,
      93                 :            :     msExtrusionDirection(  RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirection"  ) ) ,
      94 [ #  # ][ #  # ]:          0 :     msExtrusionProjection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionProjection" ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  #  
             #  #  #  # ]
                 [ #  # ]
      95                 :            : {
      96         [ #  # ]:          0 :     SetHelpId( HID_MENU_EXTRUSION_DIRECTION );
      97                 :            : 
      98                 :            :     sal_uInt16 i;
      99         [ #  # ]:          0 :     for( i = DIRECTION_NW; i <= DIRECTION_SE; i++ )
     100                 :            :     {
     101 [ #  # ][ #  # ]:          0 :         maImgDirection[i] = Image( SVX_RES( IMG_DIRECTION + i ) );
         [ #  # ][ #  # ]
     102                 :            :     }
     103                 :            : 
     104 [ #  # ][ #  # ]:          0 :     SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) );
     105         [ #  # ]:          0 :     mpDirectionSet = createEmptyValueSetControl();
     106         [ #  # ]:          0 :     mpDirectionSet->SetHelpId( HID_VALUESET_EXTRUSION_DIRECTION );
     107                 :            : 
     108         [ #  # ]:          0 :     mpDirectionSet->SetSelectHdl( LINK( this, ExtrusionDirectionWindow, SelectHdl ) );
     109         [ #  # ]:          0 :     mpDirectionSet->SetColCount( 3 );
     110         [ #  # ]:          0 :     mpDirectionSet->EnableFullItemMode( sal_False );
     111                 :            : 
     112         [ #  # ]:          0 :     for( i = DIRECTION_NW; i <= DIRECTION_SE; i++ )
     113                 :            :     {
     114 [ #  # ][ #  # ]:          0 :         String aText( SVX_RES( STR_DIRECTION + i ) );
     115         [ #  # ]:          0 :         mpDirectionSet->InsertItem( i+1, maImgDirection[ i ], aText );
     116         [ #  # ]:          0 :     }
     117                 :            : 
     118         [ #  # ]:          0 :     mpDirectionSet->SetOutputSizePixel( Size( 72, 72 ) );
     119                 :            : 
     120         [ #  # ]:          0 :     appendEntry( 2, mpDirectionSet );
     121         [ #  # ]:          0 :     appendSeparator();
     122 [ #  # ][ #  # ]:          0 :     appendEntry( 0, String( SVX_RES( STR_PERSPECTIVE ) ), maImgPerspective );
         [ #  # ][ #  # ]
     123 [ #  # ][ #  # ]:          0 :     appendEntry( 1, String( SVX_RES( STR_PARALLEL    ) ), maImgParallel    );
         [ #  # ][ #  # ]
     124                 :            : 
     125 [ #  # ][ #  # ]:          0 :     SetOutputSizePixel( getMenuSize() );
     126                 :            : 
     127         [ #  # ]:          0 :     FreeResource();
     128                 :            : 
     129         [ #  # ]:          0 :     AddStatusListener( msExtrusionDirection );
     130         [ #  # ]:          0 :     AddStatusListener( msExtrusionProjection );
     131   [ #  #  #  # ]:          0 : }
     132                 :            : 
     133                 :          0 : void ExtrusionDirectionWindow::DataChanged( const DataChangedEvent& rDCEvt )
     134                 :            : {
     135                 :          0 :     ToolbarMenu::DataChanged( rDCEvt );
     136                 :            : 
     137 [ #  # ][ #  # ]:          0 :     if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
                 [ #  # ]
     138                 :            :     {
     139         [ #  # ]:          0 :         for( sal_uInt16 i = DIRECTION_NW; i <= DIRECTION_SE; i++ )
     140                 :            :         {
     141                 :          0 :             mpDirectionSet->SetItemImage( i+1, maImgDirection[ i ] );
     142                 :            :         }
     143                 :            : 
     144                 :          0 :         setEntryImage( 0, maImgPerspective );
     145                 :          0 :         setEntryImage( 1, maImgParallel );
     146                 :            :     }
     147                 :          0 : }
     148                 :            : 
     149                 :            : // -----------------------------------------------------------------------
     150                 :            : 
     151                 :          0 : void ExtrusionDirectionWindow::implSetDirection( sal_Int32 nSkew, bool bEnabled )
     152                 :            : {
     153         [ #  # ]:          0 :     if( mpDirectionSet )
     154                 :            :     {
     155                 :            :         sal_uInt16 nItemId;
     156         [ #  # ]:          0 :         for( nItemId = DIRECTION_NW; nItemId <= DIRECTION_SE; nItemId++ )
     157                 :            :         {
     158         [ #  # ]:          0 :             if( gSkewList[nItemId] == nSkew )
     159                 :          0 :                 break;
     160                 :            :         }
     161                 :            : 
     162         [ #  # ]:          0 :         if( nItemId <= DIRECTION_SE )
     163                 :            :         {
     164                 :          0 :             mpDirectionSet->SelectItem( nItemId+1 );
     165                 :            :         }
     166                 :            :         else
     167                 :            :         {
     168                 :          0 :             mpDirectionSet->SetNoSelection();
     169                 :            :         }
     170                 :            :     }
     171                 :          0 :     enableEntry( 2, bEnabled );
     172                 :          0 : }
     173                 :            : 
     174                 :            : // -----------------------------------------------------------------------
     175                 :            : 
     176                 :          0 : void ExtrusionDirectionWindow::implSetProjection( sal_Int32 nProjection, bool bEnabled )
     177                 :            : {
     178 [ #  # ][ #  # ]:          0 :     checkEntry( 0, (nProjection == 0) && bEnabled );
     179 [ #  # ][ #  # ]:          0 :     checkEntry( 1, (nProjection == 1 ) && bEnabled );
     180                 :          0 :     enableEntry( 0, bEnabled );
     181                 :          0 :     enableEntry( 1, bEnabled );
     182                 :          0 : }
     183                 :            : 
     184                 :            : // -----------------------------------------------------------------------
     185                 :            : 
     186                 :          0 : void SAL_CALL ExtrusionDirectionWindow::statusChanged(
     187                 :            :     const ::com::sun::star::frame::FeatureStateEvent& Event
     188                 :            : )   throw ( ::com::sun::star::uno::RuntimeException )
     189                 :            : {
     190         [ #  # ]:          0 :     if( Event.FeatureURL.Main.equals( msExtrusionDirection ) )
     191                 :            :     {
     192         [ #  # ]:          0 :         if( !Event.IsEnabled )
     193                 :            :         {
     194                 :          0 :             implSetDirection( -1, false );
     195                 :            :         }
     196                 :            :         else
     197                 :            :         {
     198                 :          0 :             sal_Int32 nValue = 0;
     199         [ #  # ]:          0 :             if( Event.State >>= nValue )
     200         [ #  # ]:          0 :                 implSetDirection( nValue, true );
     201                 :            :         }
     202                 :            :     }
     203         [ #  # ]:          0 :     else if( Event.FeatureURL.Main.equals( msExtrusionProjection ) )
     204                 :            :     {
     205         [ #  # ]:          0 :         if( !Event.IsEnabled )
     206                 :            :         {
     207                 :          0 :             implSetProjection( -1, false );
     208                 :            :         }
     209                 :            :         else
     210                 :            :         {
     211                 :          0 :             sal_Int32 nValue = 0;
     212         [ #  # ]:          0 :             if( Event.State >>= nValue )
     213         [ #  # ]:          0 :                 implSetProjection( nValue, true );
     214                 :            :         }
     215                 :            :     }
     216                 :          0 : }
     217                 :            : 
     218                 :            : // -----------------------------------------------------------------------
     219                 :            : 
     220                 :          0 : IMPL_LINK( ExtrusionDirectionWindow, SelectHdl, void *, pControl )
     221                 :            : {
     222         [ #  # ]:          0 :     if ( IsInPopupMode() )
     223                 :          0 :         EndPopupMode();
     224                 :            : 
     225         [ #  # ]:          0 :     if( pControl == mpDirectionSet )
     226                 :            :     {
     227         [ #  # ]:          0 :         Sequence< PropertyValue > aArgs( 1 );
     228         [ #  # ]:          0 :         aArgs[0].Name = msExtrusionDirection.copy(5);
     229 [ #  # ][ #  # ]:          0 :         aArgs[0].Value <<= (sal_Int32)gSkewList[mpDirectionSet->GetSelectItemId()-1];
     230                 :            : 
     231 [ #  # ][ #  # ]:          0 :         mrController.dispatchCommand( msExtrusionDirection, aArgs );
     232                 :            :     }
     233                 :            :     else
     234                 :            :     {
     235                 :          0 :         int nProjection = getSelectedEntryId();
     236 [ #  # ][ #  # ]:          0 :         if( (nProjection >= 0) && (nProjection < 2 ) )
     237                 :            :         {
     238         [ #  # ]:          0 :             Sequence< PropertyValue > aArgs( 1 );
     239         [ #  # ]:          0 :             aArgs[0].Name = msExtrusionProjection.copy(5);
     240 [ #  # ][ #  # ]:          0 :             aArgs[0].Value <<= (sal_Int32)nProjection;
     241                 :            : 
     242         [ #  # ]:          0 :             mrController.dispatchCommand( msExtrusionProjection, aArgs );
     243 [ #  # ][ #  # ]:          0 :             implSetProjection( nProjection, true );
     244                 :            :         }
     245                 :            :     }
     246                 :            : 
     247                 :          0 :     return 0;
     248                 :            : }
     249                 :            : 
     250                 :            : // =======================================================================
     251                 :            : // ExtrusionDirectionControl
     252                 :            : // =======================================================================
     253                 :            : 
     254                 :          0 : ExtrusionDirectionControl::ExtrusionDirectionControl(
     255                 :            :     const Reference< lang::XMultiServiceFactory >& rServiceManager
     256                 :            : )   : svt::PopupWindowController(
     257                 :            :         rServiceManager,
     258                 :            :         Reference< frame::XFrame >(),
     259                 :            :         OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirectionFloater" ) )
     260         [ #  # ]:          0 :     )
     261                 :            : {
     262                 :          0 : }
     263                 :            : 
     264                 :            : // -----------------------------------------------------------------------
     265                 :            : 
     266                 :          0 : ::Window* ExtrusionDirectionControl::createPopupWindow( ::Window* pParent )
     267                 :            : {
     268         [ #  # ]:          0 :     return new ExtrusionDirectionWindow( *this, m_xFrame, pParent );
     269                 :            : }
     270                 :            : 
     271                 :            : // -----------------------------------------------------------------------
     272                 :            : // XServiceInfo
     273                 :            : // -----------------------------------------------------------------------
     274                 :            : 
     275                 :          0 : OUString SAL_CALL ExtrusionDirectionControl_getImplementationName()
     276                 :            : {
     277                 :          0 :     return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionDirectionController" ));
     278                 :            : }
     279                 :            : 
     280                 :            : // --------------------------------------------------------------------
     281                 :            : 
     282                 :          0 : Sequence< OUString > SAL_CALL ExtrusionDirectionControl_getSupportedServiceNames() throw( RuntimeException )
     283                 :            : {
     284                 :          0 :     Sequence< OUString > aSNS( 1 );
     285 [ #  # ][ #  # ]:          0 :     aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ));
     286                 :          0 :     return aSNS;
     287                 :            : }
     288                 :            : 
     289                 :            : // --------------------------------------------------------------------
     290                 :            : 
     291                 :          0 : Reference< XInterface > SAL_CALL SAL_CALL ExtrusionDirectionControl_createInstance(
     292                 :            :     const Reference< XMultiServiceFactory >& rSMgr
     293                 :            : )   throw( RuntimeException )
     294                 :            : {
     295         [ #  # ]:          0 :     return *new ExtrusionDirectionControl( rSMgr );
     296                 :            : }
     297                 :            : 
     298                 :            : // --------------------------------------------------------------------
     299                 :            : 
     300                 :          0 : OUString SAL_CALL ExtrusionDirectionControl::getImplementationName(  ) throw (RuntimeException)
     301                 :            : {
     302                 :          0 :     return ExtrusionDirectionControl_getImplementationName();
     303                 :            : }
     304                 :            : 
     305                 :            : // --------------------------------------------------------------------
     306                 :            : 
     307                 :          0 : Sequence< OUString > SAL_CALL ExtrusionDirectionControl::getSupportedServiceNames(  ) throw (RuntimeException)
     308                 :            : {
     309                 :          0 :     return ExtrusionDirectionControl_getSupportedServiceNames();
     310                 :            : }
     311                 :            : 
     312                 :            : // ####################################################################
     313                 :            : 
     314                 :          0 : ExtrusionDepthDialog::ExtrusionDepthDialog( Window* pParent, double fDepth, FieldUnit eDefaultUnit )
     315                 :          0 : :   ModalDialog( pParent, SVX_RES( RID_SVX_MDLG_EXTRUSION_DEPTH ) ),
     316         [ #  # ]:          0 :     maFLDepth( this, SVX_RES( FL_DEPTH ) ),
     317         [ #  # ]:          0 :     maMtrDepth( this, SVX_RES( MTR_DEPTH ) ),
     318         [ #  # ]:          0 :     maOKButton( this, SVX_RES( BTN_OK ) ),
     319         [ #  # ]:          0 :     maCancelButton( this, SVX_RES( BTN_CANCEL ) ),
     320 [ #  # ][ #  # ]:          0 :     maHelpButton( this, SVX_RES( BTN_HELP ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     321                 :            : {
     322                 :          0 :     bool bMetric = IsMetric( eDefaultUnit );
     323 [ #  # ][ #  # ]:          0 :     maMtrDepth.SetUnit( bMetric ? FUNIT_CM : FUNIT_INCH );
     324         [ #  # ]:          0 :     maMtrDepth.SetValue( (int) fDepth * 100, FUNIT_100TH_MM );
     325                 :            : 
     326         [ #  # ]:          0 :     FreeResource();
     327                 :          0 : }
     328                 :            : 
     329 [ #  # ][ #  # ]:          0 : ExtrusionDepthDialog::~ExtrusionDepthDialog()
         [ #  # ][ #  # ]
                 [ #  # ]
     330                 :            : {
     331         [ #  # ]:          0 : }
     332                 :            : 
     333                 :          0 : double ExtrusionDepthDialog::getDepth() const
     334                 :            : {
     335                 :          0 :     return (double)( maMtrDepth.GetValue( FUNIT_100TH_MM ) ) / 100.0;
     336                 :            : }
     337                 :            : 
     338                 :            : // ####################################################################
     339                 :            : 
     340                 :            : double aDepthListInch[] = { 0, 1270,2540,5080,10160 };
     341                 :            : double aDepthListMM[] = { 0, 1000, 2500, 5000, 10000 };
     342                 :            : 
     343                 :          0 : ExtrusionDepthWindow::ExtrusionDepthWindow(
     344                 :            :     svt::ToolboxController& rController,
     345                 :            :     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
     346                 :            :     Window* pParentWindow
     347                 :          0 : )   : ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_DEPTH ))
     348                 :            :     , mrController( rController )
     349         [ #  # ]:          0 :     , maImgDepth0( SVX_RES( IMG_DEPTH_0 ) )
     350         [ #  # ]:          0 :     , maImgDepth1( SVX_RES( IMG_DEPTH_1 ) )
     351         [ #  # ]:          0 :     , maImgDepth2( SVX_RES( IMG_DEPTH_2 ) )
     352         [ #  # ]:          0 :     , maImgDepth3( SVX_RES( IMG_DEPTH_3 ) )
     353         [ #  # ]:          0 :     , maImgDepth4( SVX_RES( IMG_DEPTH_4 ) )
     354         [ #  # ]:          0 :     , maImgDepthInfinity( SVX_RES( IMG_DEPTH_INFINITY ) )
     355                 :            :     , mfDepth( -1.0 )
     356                 :            :     , msExtrusionDepth( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepth" ) )
     357 [ #  # ][ #  # ]:          0 :     , msMetricUnit(     RTL_CONSTASCII_USTRINGPARAM( ".uno:MetricUnit"     ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     358                 :            : {
     359         [ #  # ]:          0 :     SetHelpId( HID_MENU_EXTRUSION_DEPTH );
     360                 :            : 
     361 [ #  # ][ #  # ]:          0 :     SetSelectHdl( LINK( this, ExtrusionDepthWindow, SelectHdl ) );
     362                 :            : 
     363         [ #  # ]:          0 :     String aEmpty;
     364         [ #  # ]:          0 :     appendEntry( 0, aEmpty, maImgDepth0 );
     365         [ #  # ]:          0 :     appendEntry( 1, aEmpty, maImgDepth1 );
     366         [ #  # ]:          0 :     appendEntry( 2, aEmpty, maImgDepth2 );
     367         [ #  # ]:          0 :     appendEntry( 3, aEmpty, maImgDepth3 );
     368         [ #  # ]:          0 :     appendEntry( 4, aEmpty, maImgDepth4 );
     369 [ #  # ][ #  # ]:          0 :     appendEntry( 5, String( SVX_RES( STR_INFINITY ) ), maImgDepthInfinity );
         [ #  # ][ #  # ]
     370 [ #  # ][ #  # ]:          0 :     appendEntry( 6, String( SVX_RES( STR_CUSTOM ) ) );
         [ #  # ][ #  # ]
     371                 :            : 
     372 [ #  # ][ #  # ]:          0 :     SetOutputSizePixel( getMenuSize() );
     373                 :            : 
     374         [ #  # ]:          0 :     FreeResource();
     375                 :            : 
     376         [ #  # ]:          0 :     AddStatusListener( msExtrusionDepth );
     377 [ #  # ][ #  # ]:          0 :     AddStatusListener( msMetricUnit );
     378                 :          0 : }
     379                 :            : 
     380                 :            : // -----------------------------------------------------------------------
     381                 :            : 
     382                 :          0 : void ExtrusionDepthWindow::implSetDepth( double fDepth )
     383                 :            : {
     384                 :          0 :     mfDepth = fDepth;
     385                 :            :     int i;
     386         [ #  # ]:          0 :     for( i = 0; i < 7; i++ )
     387                 :            :     {
     388         [ #  # ]:          0 :         if( i == 5 )
     389                 :            :         {
     390                 :          0 :             checkEntry( i, fDepth >= 338666 );
     391                 :            :         }
     392         [ #  # ]:          0 :         else if( i != 6 )
     393                 :            :         {
     394         [ #  # ]:          0 :             checkEntry( i, (fDepth == (IsMetric( meUnit ) ? aDepthListMM[i] : aDepthListInch[i]) ) );
     395                 :            :         }
     396                 :            :     }
     397                 :          0 : }
     398                 :            : 
     399                 :            : // -----------------------------------------------------------------------
     400                 :            : 
     401                 :          0 : void ExtrusionDepthWindow::implFillStrings( FieldUnit eUnit )
     402                 :            : {
     403                 :          0 :     meUnit = eUnit;
     404         [ #  # ]:          0 :     sal_uInt16 nResource = IsMetric( eUnit ) ? RID_SVXSTR_DEPTH_0 : RID_SVXSTR_DEPTH_0_INCH;
     405                 :            : 
     406         [ #  # ]:          0 :     for( int i = 0; i < 5; i++ )
     407                 :            :     {
     408 [ #  # ][ #  # ]:          0 :         String aStr( SVX_RES( nResource + i ) );
     409         [ #  # ]:          0 :         setEntryText( i, aStr );
     410         [ #  # ]:          0 :     };
     411                 :          0 : }
     412                 :            : 
     413                 :            : // -----------------------------------------------------------------------
     414                 :            : 
     415                 :          0 : void SAL_CALL ExtrusionDepthWindow::statusChanged(
     416                 :            :     const ::com::sun::star::frame::FeatureStateEvent& Event
     417                 :            : )   throw ( ::com::sun::star::uno::RuntimeException )
     418                 :            : {
     419         [ #  # ]:          0 :     if( Event.FeatureURL.Main.equals( msExtrusionDepth ) )
     420                 :            :     {
     421         [ #  # ]:          0 :         if( !Event.IsEnabled )
     422                 :            :         {
     423                 :          0 :             implSetDepth( 0 );
     424                 :            :         }
     425                 :            :         else
     426                 :            :         {
     427                 :          0 :             double fValue = 0.0;
     428         [ #  # ]:          0 :             if( Event.State >>= fValue )
     429         [ #  # ]:          0 :                 implSetDepth( fValue );
     430                 :            :         }
     431                 :            :     }
     432         [ #  # ]:          0 :     else if( Event.FeatureURL.Main.equals( msMetricUnit ) )
     433                 :            :     {
     434         [ #  # ]:          0 :         if( Event.IsEnabled )
     435                 :            :         {
     436                 :          0 :             sal_Int32 nValue = 0;
     437         [ #  # ]:          0 :             if( Event.State >>= nValue )
     438                 :            :             {
     439         [ #  # ]:          0 :                 implFillStrings( static_cast<FieldUnit>(nValue) );
     440         [ #  # ]:          0 :                 if( mfDepth >= 0.0 )
     441         [ #  # ]:          0 :                     implSetDepth( mfDepth );
     442                 :            :             }
     443                 :            :         }
     444                 :            :     }
     445                 :          0 : }
     446                 :            : 
     447                 :            : // -----------------------------------------------------------------------
     448                 :            : 
     449                 :          0 : void ExtrusionDepthWindow::DataChanged( const DataChangedEvent& rDCEvt )
     450                 :            : {
     451                 :          0 :     ToolbarMenu::DataChanged( rDCEvt );
     452                 :            : 
     453 [ #  # ][ #  # ]:          0 :     if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
                 [ #  # ]
     454                 :            :     {
     455                 :          0 :         setEntryImage( 0, maImgDepth0 );
     456                 :          0 :         setEntryImage( 1, maImgDepth1 );
     457                 :          0 :         setEntryImage( 2, maImgDepth2 );
     458                 :          0 :         setEntryImage( 3, maImgDepth3 );
     459                 :          0 :         setEntryImage( 4, maImgDepth4 );
     460                 :          0 :         setEntryImage( 5, maImgDepthInfinity );
     461                 :            :     }
     462                 :          0 : }
     463                 :            : 
     464                 :            : 
     465                 :            : // -----------------------------------------------------------------------
     466                 :            : 
     467                 :          0 : IMPL_LINK_NOARG(ExtrusionDepthWindow, SelectHdl)
     468                 :            : {
     469                 :          0 :     int nSelected = getSelectedEntryId();
     470         [ #  # ]:          0 :     if( nSelected != -1 )
     471                 :            :     {
     472         [ #  # ]:          0 :         if( nSelected == 6 )
     473                 :            :         {
     474 [ #  # ][ #  # ]:          0 :             if ( IsInPopupMode() )
     475         [ #  # ]:          0 :                 EndPopupMode();
     476                 :            : 
     477         [ #  # ]:          0 :             const rtl::OUString aCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepthDialog" ));
     478                 :            : 
     479                 :          0 :             Any a;
     480         [ #  # ]:          0 :             Sequence< PropertyValue > aArgs( 2 );
     481 [ #  # ][ #  # ]:          0 :             aArgs[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Depth" ));
     482 [ #  # ][ #  # ]:          0 :             aArgs[0].Value <<= mfDepth;
     483 [ #  # ][ #  # ]:          0 :             aArgs[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Metric" ));
     484 [ #  # ][ #  # ]:          0 :             aArgs[1].Value <<= static_cast<sal_Int32>( meUnit );
     485                 :            : 
     486 [ #  # ][ #  # ]:          0 :             mrController.dispatchCommand( aCommand, aArgs );
     487                 :            :         }
     488                 :            :         else
     489                 :            :         {
     490                 :            :             double fDepth;
     491                 :            : 
     492         [ #  # ]:          0 :             if( nSelected == 5 )
     493                 :            :             {
     494                 :          0 :                 fDepth = 338666.6;
     495                 :            :             }
     496                 :            :             else
     497                 :            :             {
     498         [ #  # ]:          0 :                 fDepth = IsMetric( meUnit ) ? aDepthListMM[nSelected] : aDepthListInch[nSelected];
     499                 :            :             }
     500                 :            : 
     501         [ #  # ]:          0 :             Sequence< PropertyValue > aArgs( 1 );
     502         [ #  # ]:          0 :             aArgs[0].Name = msExtrusionDepth.copy(5);
     503 [ #  # ][ #  # ]:          0 :             aArgs[0].Value <<= fDepth;
     504                 :            : 
     505         [ #  # ]:          0 :             mrController.dispatchCommand( msExtrusionDepth,  aArgs );
     506         [ #  # ]:          0 :             implSetDepth( fDepth );
     507                 :            : 
     508 [ #  # ][ #  # ]:          0 :             if ( IsInPopupMode() )
     509 [ #  # ][ #  # ]:          0 :                 EndPopupMode();
     510                 :            :         }
     511                 :            :     }
     512                 :          0 :     return 0;
     513                 :            : }
     514                 :            : 
     515                 :            : // =======================================================================
     516                 :            : // ExtrusionDirectionControl
     517                 :            : // =======================================================================
     518                 :            : 
     519                 :          0 : ExtrusionDepthController::ExtrusionDepthController(
     520                 :            :     const Reference< lang::XMultiServiceFactory >& rServiceManager
     521                 :            : )   : svt::PopupWindowController(
     522                 :            :         rServiceManager,
     523                 :            :         Reference< frame::XFrame >(),
     524                 :            :         OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDepthFloater" ) )
     525         [ #  # ]:          0 :     )
     526                 :            : {
     527                 :          0 : }
     528                 :            : 
     529                 :            : // -----------------------------------------------------------------------
     530                 :            : 
     531                 :          0 : ::Window* ExtrusionDepthController::createPopupWindow( ::Window* pParent )
     532                 :            : {
     533         [ #  # ]:          0 :     return new ExtrusionDepthWindow( *this, m_xFrame, pParent );
     534                 :            : }
     535                 :            : 
     536                 :            : 
     537                 :            : // -----------------------------------------------------------------------
     538                 :            : // XServiceInfo
     539                 :            : // -----------------------------------------------------------------------
     540                 :            : 
     541                 :          0 : OUString SAL_CALL ExtrusionDepthController_getImplementationName()
     542                 :            : {
     543                 :          0 :     return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionDepthController" ));
     544                 :            : }
     545                 :            : 
     546                 :            : // --------------------------------------------------------------------
     547                 :            : 
     548                 :          0 : Sequence< OUString > SAL_CALL ExtrusionDepthController_getSupportedServiceNames() throw( RuntimeException )
     549                 :            : {
     550                 :          0 :     Sequence< OUString > aSNS( 1 );
     551 [ #  # ][ #  # ]:          0 :     aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.PopupMenuController" ));
     552                 :          0 :     return aSNS;
     553                 :            : }
     554                 :            : 
     555                 :            : // --------------------------------------------------------------------
     556                 :            : 
     557                 :          0 : Reference< XInterface > SAL_CALL SAL_CALL ExtrusionDepthController_createInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( RuntimeException )
     558                 :            : {
     559         [ #  # ]:          0 :     return *new ExtrusionDepthController( rSMgr );
     560                 :            : }
     561                 :            : 
     562                 :            : // --------------------------------------------------------------------
     563                 :            : 
     564                 :          0 : OUString SAL_CALL ExtrusionDepthController::getImplementationName(  ) throw (RuntimeException)
     565                 :            : {
     566                 :          0 :     return ExtrusionDepthController_getImplementationName();
     567                 :            : }
     568                 :            : 
     569                 :            : // --------------------------------------------------------------------
     570                 :            : 
     571                 :          0 : Sequence< OUString > SAL_CALL ExtrusionDepthController::getSupportedServiceNames(  ) throw (RuntimeException)
     572                 :            : {
     573                 :          0 :     return ExtrusionDepthController_getSupportedServiceNames();
     574                 :            : }
     575                 :            : 
     576                 :            : 
     577                 :            : // ####################################################################
     578                 :            : 
     579                 :            : // -------------------------------------------------------------------------
     580                 :            : 
     581                 :          0 : ExtrusionLightingWindow::ExtrusionLightingWindow( svt::ToolboxController& rController, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, Window* pParentWindow )
     582                 :          0 : : ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_LIGHTING ))
     583                 :            : , mrController( rController )
     584         [ #  # ]:          0 : , maImgBright( SVX_RES( IMG_LIGHTING_BRIGHT ) )
     585         [ #  # ]:          0 : , maImgNormal( SVX_RES( IMG_LIGHTING_NORMAL ) )
     586         [ #  # ]:          0 : , maImgDim(    SVX_RES( IMG_LIGHTING_DIM    ) )
     587                 :            : , mnLevel( 0 )
     588                 :            : , mbLevelEnabled( false )
     589                 :            : , mnDirection( FROM_FRONT )
     590                 :            : , mbDirectionEnabled( false )
     591                 :            : , msExtrusionLightingDirection( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingDirection" ))
     592 [ #  # ][ #  # ]:          0 : , msExtrusionLightingIntensity( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionLightingIntensity" ))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
          #  #  #  #  #  
             #  #  #  #  
              # ][ #  # ]
     593                 :            : {
     594                 :            :     sal_uInt16 i;
     595         [ #  # ]:          0 :     for( i = FROM_TOP_LEFT; i <= FROM_BOTTOM_RIGHT; i++ )
     596                 :            :     {
     597         [ #  # ]:          0 :         if( i != FROM_FRONT )
     598                 :            :         {
     599 [ #  # ][ #  # ]:          0 :             maImgLightingOff[  i ] = Image( SVX_RES( IMG_LIGHT_OFF   + i ) );
         [ #  # ][ #  # ]
     600 [ #  # ][ #  # ]:          0 :             maImgLightingOn[   i ] = Image( SVX_RES( IMG_LIGHT_ON    + i ) );
         [ #  # ][ #  # ]
     601                 :            :         }
     602 [ #  # ][ #  # ]:          0 :         maImgLightingPreview[i] = Image( SVX_RES( IMG_LIGHT_PREVIEW + i ) );
         [ #  # ][ #  # ]
     603                 :            :     }
     604                 :            : 
     605         [ #  # ]:          0 :     SetHelpId( HID_MENU_EXTRUSION_LIGHTING );
     606 [ #  # ][ #  # ]:          0 :     SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) );
     607                 :            : 
     608         [ #  # ]:          0 :     mpLightingSet = createEmptyValueSetControl();
     609         [ #  # ]:          0 :     mpLightingSet->SetHelpId( HID_VALUESET_EXTRUSION_LIGHTING );
     610                 :            : 
     611         [ #  # ]:          0 :     mpLightingSet->SetSelectHdl( LINK( this, ExtrusionLightingWindow, SelectHdl ) );
     612         [ #  # ]:          0 :     mpLightingSet->SetColCount( 3 );
     613         [ #  # ]:          0 :     mpLightingSet->EnableFullItemMode( sal_False );
     614                 :            : 
     615         [ #  # ]:          0 :     for( i = FROM_TOP_LEFT; i <= FROM_BOTTOM_RIGHT; i++ )
     616                 :            :     {
     617         [ #  # ]:          0 :         if( i != FROM_FRONT )
     618                 :            :         {
     619         [ #  # ]:          0 :             mpLightingSet->InsertItem( i+1, maImgLightingOff[i] );
     620                 :            :         }
     621                 :            :         else
     622                 :            :         {
     623         [ #  # ]:          0 :             mpLightingSet->InsertItem( 5, maImgLightingPreview[FROM_FRONT] );
     624                 :            :         }
     625                 :            :     }
     626         [ #  # ]:          0 :     mpLightingSet->SetOutputSizePixel( Size( 72, 72 ) );
     627                 :            : 
     628         [ #  # ]:          0 :     appendEntry( 3, mpLightingSet );
     629         [ #  # ]:          0 :     appendSeparator();
     630 [ #  # ][ #  # ]:          0 :     appendEntry( 0, String( SVX_RES( STR_BRIGHT ) ), maImgBright );
         [ #  # ][ #  # ]
     631 [ #  # ][ #  # ]:          0 :     appendEntry( 1, String( SVX_RES( STR_NORMAL ) ), maImgNormal );
         [ #  # ][ #  # ]
     632 [ #  # ][ #  # ]:          0 :     appendEntry( 2, String( SVX_RES( STR_DIM    ) ), maImgDim    );
         [ #  # ][ #  # ]
     633                 :            : 
     634 [ #  # ][ #  # ]:          0 :     SetOutputSizePixel( getMenuSize() );
     635                 :            : 
     636         [ #  # ]:          0 :     FreeResource();
     637                 :            : 
     638         [ #  # ]:          0 :     AddStatusListener( msExtrusionLightingDirection );
     639         [ #  # ]:          0 :     AddStatusListener( msExtrusionLightingIntensity );
     640   [ #  #  #  #  :          0 : }
          #  #  #  #  #  
                #  #  # ]
     641                 :            : 
     642                 :            : // -----------------------------------------------------------------------
     643                 :            : 
     644                 :          0 : void ExtrusionLightingWindow::implSetIntensity( int nLevel, bool bEnabled )
     645                 :            : {
     646                 :          0 :     mnLevel = nLevel;
     647                 :          0 :     mbLevelEnabled = bEnabled;
     648                 :          0 :     int i = 0;
     649         [ #  # ]:          0 :     for( i = 0; i < 3; i++ )
     650                 :            :     {
     651 [ #  # ][ #  # ]:          0 :         checkEntry( i, (i == nLevel) && bEnabled );
     652                 :          0 :         enableEntry( i, bEnabled );
     653                 :            :     }
     654                 :          0 : }
     655                 :            : 
     656                 :            : // -----------------------------------------------------------------------
     657                 :            : 
     658                 :          0 : void ExtrusionLightingWindow::implSetDirection( int nDirection, bool bEnabled )
     659                 :            : {
     660                 :          0 :     mnDirection = nDirection;
     661                 :          0 :     mbDirectionEnabled = bEnabled;
     662                 :            : 
     663         [ #  # ]:          0 :     if( !bEnabled )
     664                 :          0 :         nDirection = FROM_FRONT;
     665                 :            : 
     666                 :            :     sal_uInt16 nItemId;
     667         [ #  # ]:          0 :     for( nItemId = FROM_TOP_LEFT; nItemId <= FROM_BOTTOM_RIGHT; nItemId++ )
     668                 :            :     {
     669         [ #  # ]:          0 :         if( nItemId == FROM_FRONT )
     670                 :            :         {
     671                 :          0 :             mpLightingSet->SetItemImage( nItemId + 1, maImgLightingPreview[ nDirection ] );
     672                 :            :         }
     673                 :            :         else
     674                 :            :         {
     675                 :            :             mpLightingSet->SetItemImage(
     676                 :            :                 nItemId + 1,
     677                 :          0 :                 (sal_uInt16)nDirection == nItemId ? maImgLightingOn[nItemId] : maImgLightingOff[nItemId]
     678         [ #  # ]:          0 :             );
     679                 :            :         }
     680                 :            :     }
     681                 :            : 
     682                 :          0 :     enableEntry( 3, bEnabled );
     683                 :          0 : }
     684                 :            : 
     685                 :            : // -----------------------------------------------------------------------
     686                 :            : 
     687                 :          0 : void SAL_CALL ExtrusionLightingWindow::statusChanged(
     688                 :            :     const ::com::sun::star::frame::FeatureStateEvent& Event
     689                 :            : )   throw ( ::com::sun::star::uno::RuntimeException )
     690                 :            : {
     691         [ #  # ]:          0 :     if( Event.FeatureURL.Main.equals( msExtrusionLightingIntensity ) )
     692                 :            :     {
     693         [ #  # ]:          0 :         if( !Event.IsEnabled )
     694                 :            :         {
     695                 :          0 :             implSetIntensity( 0, false );
     696                 :            :         }
     697                 :            :         else
     698                 :            :         {
     699                 :          0 :             sal_Int32 nValue = 0;
     700         [ #  # ]:          0 :             if( Event.State >>= nValue )
     701         [ #  # ]:          0 :                 implSetIntensity( nValue, true );
     702                 :            :         }
     703                 :            :     }
     704         [ #  # ]:          0 :     else if( Event.FeatureURL.Main.equals( msExtrusionLightingDirection ) )
     705                 :            :     {
     706         [ #  # ]:          0 :         if( !Event.IsEnabled )
     707                 :            :         {
     708                 :          0 :             implSetDirection( 0, false );
     709                 :            :         }
     710                 :            :         else
     711                 :            :         {
     712                 :          0 :             sal_Int32 nValue = 0;
     713         [ #  # ]:          0 :             if( Event.State >>= nValue )
     714         [ #  # ]:          0 :                 implSetDirection( nValue, true );
     715                 :            :         }
     716                 :            :     }
     717                 :          0 : }
     718                 :            : 
     719                 :            : // -----------------------------------------------------------------------
     720                 :            : 
     721                 :          0 : void ExtrusionLightingWindow::DataChanged( const DataChangedEvent& rDCEvt )
     722                 :            : {
     723                 :          0 :     ToolbarMenu::DataChanged( rDCEvt );
     724                 :            : 
     725 [ #  # ][ #  # ]:          0 :     if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
                 [ #  # ]
     726                 :            :     {
     727                 :          0 :         implSetDirection( mnDirection, mbDirectionEnabled );
     728                 :          0 :         setEntryImage( 0, maImgBright );
     729                 :          0 :         setEntryImage( 1, maImgNormal );
     730                 :          0 :         setEntryImage( 2, maImgDim    );
     731                 :            :     }
     732                 :          0 : }
     733                 :            : 
     734                 :            : // -----------------------------------------------------------------------
     735                 :            : 
     736                 :          0 : IMPL_LINK( ExtrusionLightingWindow, SelectHdl, void *, pControl )
     737                 :            : {
     738         [ #  # ]:          0 :     if ( IsInPopupMode() )
     739                 :          0 :         EndPopupMode();
     740                 :            : 
     741         [ #  # ]:          0 :     if( pControl == this )
     742                 :            :     {
     743                 :          0 :         int nLevel = getSelectedEntryId();
     744         [ #  # ]:          0 :         if( nLevel >= 0 )
     745                 :            :         {
     746         [ #  # ]:          0 :             if( nLevel != 3 )
     747                 :            :             {
     748         [ #  # ]:          0 :                 Sequence< PropertyValue > aArgs( 1 );
     749         [ #  # ]:          0 :                 aArgs[0].Name = msExtrusionLightingIntensity.copy(5);
     750 [ #  # ][ #  # ]:          0 :                 aArgs[0].Value <<= (sal_Int32)nLevel;
     751                 :            : 
     752         [ #  # ]:          0 :                 mrController.dispatchCommand( msExtrusionLightingIntensity, aArgs );
     753                 :            : 
     754 [ #  # ][ #  # ]:          0 :                 implSetIntensity( nLevel, true );
     755                 :            :             }
     756                 :            :         }
     757                 :            :     }
     758                 :            :     else
     759                 :            :     {
     760                 :          0 :         sal_Int32 nDirection = mpLightingSet->GetSelectItemId();
     761                 :            : 
     762 [ #  # ][ #  # ]:          0 :         if( (nDirection > 0) && (nDirection < 10) )
     763                 :            :         {
     764                 :          0 :             nDirection--;
     765                 :            : 
     766         [ #  # ]:          0 :             Sequence< PropertyValue > aArgs( 1 );
     767         [ #  # ]:          0 :             aArgs[0].Name = msExtrusionLightingDirection.copy(5);
     768 [ #  # ][ #  # ]:          0 :             aArgs[0].Value <<= (sal_Int32)nDirection;
     769                 :            : 
     770         [ #  # ]:          0 :             mrController.dispatchCommand( msExtrusionLightingDirection, aArgs );
     771                 :            : 
     772 [ #  # ][ #  # ]:          0 :             implSetDirection( nDirection, true );
     773                 :            :         }
     774                 :            : 
     775                 :            :     }
     776                 :            : 
     777                 :          0 :     return 0;
     778                 :            : }
     779                 :            : 
     780                 :            : // ========================================================================
     781                 :            : 
     782                 :          0 : ExtrusionLightingControl::ExtrusionLightingControl(
     783                 :            :     const Reference< lang::XMultiServiceFactory >& rServiceManager
     784                 :            : )   : svt::PopupWindowController( rServiceManager,
     785                 :            :                 Reference< frame::XFrame >(),
     786                 :            :                 OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionDirectionFloater" ) )
     787         [ #  # ]:          0 :     )
     788                 :            : {
     789                 :          0 : }
     790                 :            : 
     791                 :            : // -----------------------------------------------------------------------
     792                 :            : 
     793                 :          0 : ::Window* ExtrusionLightingControl::createPopupWindow( ::Window* pParent )
     794                 :            : {
     795         [ #  # ]:          0 :     return new ExtrusionLightingWindow( *this, m_xFrame, pParent );
     796                 :            : }
     797                 :            : 
     798                 :            : // -----------------------------------------------------------------------
     799                 :            : // XServiceInfo
     800                 :            : // -----------------------------------------------------------------------
     801                 :            : 
     802                 :          0 : OUString SAL_CALL ExtrusionLightingControl_getImplementationName()
     803                 :            : {
     804                 :          0 :     return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionLightingController" ));
     805                 :            : }
     806                 :            : 
     807                 :            : // --------------------------------------------------------------------
     808                 :            : 
     809                 :          0 : Sequence< OUString > SAL_CALL ExtrusionLightingControl_getSupportedServiceNames() throw( RuntimeException )
     810                 :            : {
     811                 :          0 :     Sequence< OUString > aSNS( 1 );
     812 [ #  # ][ #  # ]:          0 :     aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ));
     813                 :          0 :     return aSNS;
     814                 :            : }
     815                 :            : 
     816                 :            : // --------------------------------------------------------------------
     817                 :            : 
     818                 :          0 : Reference< XInterface > SAL_CALL SAL_CALL ExtrusionLightingControl_createInstance(
     819                 :            :     const Reference< XMultiServiceFactory >& rSMgr
     820                 :            : )   throw( RuntimeException )
     821                 :            : {
     822         [ #  # ]:          0 :     return *new ExtrusionLightingControl( rSMgr );
     823                 :            : }
     824                 :            : 
     825                 :            : // --------------------------------------------------------------------
     826                 :            : 
     827                 :          0 : OUString SAL_CALL ExtrusionLightingControl::getImplementationName(  ) throw (RuntimeException)
     828                 :            : {
     829                 :          0 :     return ExtrusionLightingControl_getImplementationName();
     830                 :            : }
     831                 :            : 
     832                 :            : // --------------------------------------------------------------------
     833                 :            : 
     834                 :          0 : Sequence< OUString > SAL_CALL ExtrusionLightingControl::getSupportedServiceNames(  ) throw (RuntimeException)
     835                 :            : {
     836                 :          0 :     return ExtrusionLightingControl_getSupportedServiceNames();
     837                 :            : }
     838                 :            : 
     839                 :            : // ####################################################################
     840                 :            : 
     841                 :          0 : ExtrusionSurfaceWindow::ExtrusionSurfaceWindow(
     842                 :            :     svt::ToolboxController& rController,
     843                 :            :     const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
     844                 :            :     Window* pParentWindow
     845                 :          0 : )   : ToolbarMenu( rFrame, pParentWindow, SVX_RES( RID_SVXFLOAT_EXTRUSION_SURFACE ) )
     846                 :            :     , mrController( rController )
     847         [ #  # ]:          0 :     , maImgSurface1( SVX_RES( IMG_WIRE_FRAME ) )
     848         [ #  # ]:          0 :     , maImgSurface2( SVX_RES( IMG_MATTE ) )
     849         [ #  # ]:          0 :     , maImgSurface3( SVX_RES( IMG_PLASTIC ) )
     850         [ #  # ]:          0 :     , maImgSurface4( SVX_RES( IMG_METAL ) )
     851 [ #  # ][ #  # ]:          0 :     , msExtrusionSurface( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurface" ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     852                 :            : {
     853         [ #  # ]:          0 :     SetHelpId( HID_MENU_EXTRUSION_SURFACE );
     854 [ #  # ][ #  # ]:          0 :     SetSelectHdl( LINK( this, ExtrusionSurfaceWindow, SelectHdl ) );
     855                 :            : 
     856 [ #  # ][ #  # ]:          0 :     appendEntry( 0, String( SVX_RES( STR_WIREFRAME ) ), maImgSurface1 );
         [ #  # ][ #  # ]
     857 [ #  # ][ #  # ]:          0 :     appendEntry( 1, String( SVX_RES( STR_MATTE     ) ), maImgSurface2 );
         [ #  # ][ #  # ]
     858 [ #  # ][ #  # ]:          0 :     appendEntry( 2, String( SVX_RES( STR_PLASTIC   ) ), maImgSurface3 );
         [ #  # ][ #  # ]
     859 [ #  # ][ #  # ]:          0 :     appendEntry( 3, String( SVX_RES( STR_METAL     ) ), maImgSurface4 );
         [ #  # ][ #  # ]
     860                 :            : 
     861 [ #  # ][ #  # ]:          0 :     SetOutputSizePixel( getMenuSize() );
     862                 :            : 
     863         [ #  # ]:          0 :     FreeResource();
     864                 :            : 
     865         [ #  # ]:          0 :     AddStatusListener( msExtrusionSurface );
     866                 :          0 : }
     867                 :            : 
     868                 :            : // -----------------------------------------------------------------------
     869                 :            : 
     870                 :          0 : void ExtrusionSurfaceWindow::implSetSurface( int nSurface, bool bEnabled )
     871                 :            : {
     872                 :            :     int i;
     873         [ #  # ]:          0 :     for( i = 0; i < 4; i++ )
     874                 :            :     {
     875 [ #  # ][ #  # ]:          0 :         checkEntry( i, (i == nSurface) && bEnabled );
     876                 :          0 :         enableEntry( i, bEnabled );
     877                 :            :     }
     878                 :          0 : }
     879                 :            : 
     880                 :            : // -----------------------------------------------------------------------
     881                 :            : 
     882                 :          0 : void SAL_CALL ExtrusionSurfaceWindow::statusChanged(
     883                 :            :     const ::com::sun::star::frame::FeatureStateEvent& Event
     884                 :            : )   throw ( ::com::sun::star::uno::RuntimeException )
     885                 :            : {
     886         [ #  # ]:          0 :     if( Event.FeatureURL.Main.equals( msExtrusionSurface ) )
     887                 :            :     {
     888         [ #  # ]:          0 :         if( !Event.IsEnabled )
     889                 :            :         {
     890                 :          0 :             implSetSurface( 0, false );
     891                 :            :         }
     892                 :            :         else
     893                 :            :         {
     894                 :          0 :             sal_Int32 nValue = 0;
     895         [ #  # ]:          0 :             if( Event.State >>= nValue )
     896         [ #  # ]:          0 :                 implSetSurface( nValue, true );
     897                 :            :         }
     898                 :            :     }
     899                 :          0 : }
     900                 :            : 
     901                 :            : // -----------------------------------------------------------------------
     902                 :            : 
     903                 :          0 : IMPL_LINK_NOARG(ExtrusionSurfaceWindow, SelectHdl)
     904                 :            : {
     905         [ #  # ]:          0 :     if ( IsInPopupMode() )
     906                 :          0 :         EndPopupMode();
     907                 :            : 
     908                 :          0 :     sal_Int32 nSurface = getSelectedEntryId();
     909         [ #  # ]:          0 :     if( nSurface >= 0 )
     910                 :            :     {
     911         [ #  # ]:          0 :         Sequence< PropertyValue > aArgs( 1 );
     912         [ #  # ]:          0 :         aArgs[0].Name = msExtrusionSurface.copy(5);
     913 [ #  # ][ #  # ]:          0 :         aArgs[0].Value <<= (sal_Int32)nSurface;
     914                 :            : 
     915         [ #  # ]:          0 :         mrController.dispatchCommand( msExtrusionSurface, aArgs );
     916                 :            : 
     917 [ #  # ][ #  # ]:          0 :         implSetSurface( nSurface, true );
     918                 :            :     }
     919                 :            : 
     920                 :          0 :     return 0;
     921                 :            : }
     922                 :            : 
     923                 :            : // ========================================================================
     924                 :            : 
     925                 :          0 : ExtrusionSurfaceControl::ExtrusionSurfaceControl(
     926                 :            :     const Reference< lang::XMultiServiceFactory >& rServiceManager
     927                 :            : )
     928                 :            : :   svt::PopupWindowController(
     929                 :            :         rServiceManager,
     930                 :            :         Reference< frame::XFrame >(),
     931                 :            :         OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ExtrusionSurfaceFloater" ) )
     932         [ #  # ]:          0 :     )
     933                 :            : {
     934                 :          0 : }
     935                 :            : 
     936                 :            : // -----------------------------------------------------------------------
     937                 :            : 
     938                 :          0 : ::Window* ExtrusionSurfaceControl::createPopupWindow( ::Window* pParent )
     939                 :            : {
     940         [ #  # ]:          0 :     return new ExtrusionSurfaceWindow( *this, m_xFrame, pParent );
     941                 :            : }
     942                 :            : 
     943                 :            : // -----------------------------------------------------------------------
     944                 :            : // XServiceInfo
     945                 :            : // -----------------------------------------------------------------------
     946                 :            : 
     947                 :          0 : OUString SAL_CALL ExtrusionSurfaceControl_getImplementationName()
     948                 :            : {
     949                 :          0 :     return OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svx.ExtrusionSurfaceController" ));
     950                 :            : }
     951                 :            : 
     952                 :            : // --------------------------------------------------------------------
     953                 :            : 
     954                 :          0 : Sequence< OUString > SAL_CALL ExtrusionSurfaceControl_getSupportedServiceNames() throw( RuntimeException )
     955                 :            : {
     956                 :          0 :     Sequence< OUString > aSNS( 1 );
     957 [ #  # ][ #  # ]:          0 :     aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ToolbarController" ));
     958                 :          0 :     return aSNS;
     959                 :            : }
     960                 :            : 
     961                 :            : // --------------------------------------------------------------------
     962                 :            : 
     963                 :          0 : Reference< XInterface > SAL_CALL SAL_CALL ExtrusionSurfaceControl_createInstance(
     964                 :            :     const Reference< XMultiServiceFactory >& rSMgr
     965                 :            : )   throw( RuntimeException )
     966                 :            : {
     967         [ #  # ]:          0 :     return *new ExtrusionSurfaceControl( rSMgr );
     968                 :            : }
     969                 :            : 
     970                 :            : // --------------------------------------------------------------------
     971                 :            : 
     972                 :          0 : OUString SAL_CALL ExtrusionSurfaceControl::getImplementationName(  ) throw (RuntimeException)
     973                 :            : {
     974                 :          0 :     return ExtrusionSurfaceControl_getImplementationName();
     975                 :            : }
     976                 :            : 
     977                 :            : // --------------------------------------------------------------------
     978                 :            : 
     979                 :          0 : Sequence< OUString > SAL_CALL ExtrusionSurfaceControl::getSupportedServiceNames(  ) throw (RuntimeException)
     980                 :            : {
     981                 :          0 :     return ExtrusionSurfaceControl_getSupportedServiceNames();
     982                 :            : }
     983                 :            : 
     984                 :            : //========================================================================
     985                 :            : 
     986         [ #  # ]:        149 : SFX_IMPL_TOOLBOX_CONTROL( ExtrusionColorControl, SvxColorItem );
     987                 :            : 
     988                 :          0 : ExtrusionColorControl::ExtrusionColorControl(
     989                 :            :     sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
     990                 :            : : SfxToolBoxControl ( nSlotId, nId, rTbx ),
     991                 :          0 :   mLastColor( COL_AUTO )
     992                 :            : {
     993 [ #  # ][ #  # ]:          0 :     rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
     994 [ #  # ][ #  # ]:          0 :     mpBtnUpdater = new ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox(), TBX_UPDATER_MODE_CHAR_COLOR_NEW );
                 [ #  # ]
     995                 :          0 : }
     996                 :            : 
     997                 :            : // -----------------------------------------------------------------------
     998                 :            : 
     999                 :          0 : ExtrusionColorControl::~ExtrusionColorControl()
    1000                 :            : {
    1001 [ #  # ][ #  # ]:          0 :     delete mpBtnUpdater;
    1002         [ #  # ]:          0 : }
    1003                 :            : 
    1004                 :            : // -----------------------------------------------------------------------
    1005                 :            : 
    1006                 :          0 : SfxPopupWindowType ExtrusionColorControl::GetPopupWindowType() const
    1007                 :            : {
    1008                 :          0 :     return SFX_POPUPWINDOW_ONCLICK;
    1009                 :            : }
    1010                 :            : 
    1011                 :            : // -----------------------------------------------------------------------
    1012                 :            : 
    1013                 :          0 : SfxPopupWindow* ExtrusionColorControl::CreatePopupWindow()
    1014                 :            : {
    1015                 :            :     SvxColorWindow_Impl* pColorWin = new SvxColorWindow_Impl(
    1016                 :            :         rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Extrusion3DColor" )),
    1017                 :            :         SID_EXTRUSION_3D_COLOR,
    1018                 :            :         m_xFrame,
    1019         [ #  # ]:          0 :         SVX_RESSTR( RID_SVXSTR_EXTRUSION_COLOR ),
    1020                 :          0 :         &GetToolBox(),
    1021 [ #  # ][ #  # ]:          0 :         mLastColor );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1022                 :          0 :     pColorWin->StartPopupMode( &GetToolBox(), FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF );
    1023                 :          0 :     pColorWin->StartSelection();
    1024                 :          0 :     SetPopupWindow( pColorWin );
    1025                 :          0 :     return pColorWin;
    1026                 :            : }
    1027                 :            : 
    1028                 :            : // -----------------------------------------------------------------------
    1029                 :            : 
    1030                 :          0 : void ExtrusionColorControl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
    1031                 :            : {
    1032                 :          0 :     sal_uInt16 nId = GetId();
    1033                 :          0 :     ToolBox& rTbx = GetToolBox();
    1034                 :            : 
    1035         [ #  # ]:          0 :     if( nSID == SID_EXTRUSION_3D_COLOR )
    1036                 :            :     {
    1037                 :          0 :         const SvxColorItem* pItem = 0;
    1038                 :            : 
    1039         [ #  # ]:          0 :         if( SFX_ITEM_DONTCARE != eState )
    1040 [ #  # ][ #  # ]:          0 :             pItem = PTR_CAST( SvxColorItem, pState );
    1041                 :            : 
    1042         [ #  # ]:          0 :         if ( pItem )
    1043                 :            :         {
    1044                 :          0 :             mpBtnUpdater->Update( pItem->GetValue());
    1045                 :          0 :             mLastColor = pItem->GetValue();
    1046                 :            :         }
    1047                 :            :     }
    1048                 :            : 
    1049                 :          0 :     rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
    1050         [ #  # ]:          0 :     rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK );
    1051                 :          0 : }
    1052                 :            : 
    1053                 :            : }
    1054                 :            : 
    1055                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10