1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_chart2.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "res_ErrorBar.hxx" 32*cdf0e10cSrcweir #include "res_ErrorBar_IDs.hrc" 33*cdf0e10cSrcweir #include "ResId.hxx" 34*cdf0e10cSrcweir #include "Strings.hrc" 35*cdf0e10cSrcweir #include "Bitmaps.hrc" 36*cdf0e10cSrcweir #include "Bitmaps_HC.hrc" 37*cdf0e10cSrcweir #include "RangeSelectionHelper.hxx" 38*cdf0e10cSrcweir // for RANGE_SELECTION_INVALID_RANGE_BACKGROUND_COLOR 39*cdf0e10cSrcweir #include "TabPageNotifiable.hxx" 40*cdf0e10cSrcweir #include "macros.hxx" 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir #include <rtl/math.hxx> 43*cdf0e10cSrcweir #include <vcl/dialog.hxx> 44*cdf0e10cSrcweir #include <svl/stritem.hxx> 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir using namespace ::com::sun::star; 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir namespace 49*cdf0e10cSrcweir { 50*cdf0e10cSrcweir void lcl_enableRangeChoosing( bool bEnable, Dialog * pDialog ) 51*cdf0e10cSrcweir { 52*cdf0e10cSrcweir if( pDialog ) 53*cdf0e10cSrcweir { 54*cdf0e10cSrcweir pDialog->Show( bEnable ? sal_False : sal_True ); 55*cdf0e10cSrcweir pDialog->SetModalInputMode( bEnable ? sal_False : sal_True ); 56*cdf0e10cSrcweir } 57*cdf0e10cSrcweir } 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir sal_uInt16 lcl_getLbEntryPosByErrorKind( SvxChartKindError eErrorKind ) 60*cdf0e10cSrcweir { 61*cdf0e10cSrcweir sal_uInt16 nResult = 0; 62*cdf0e10cSrcweir switch( eErrorKind ) 63*cdf0e10cSrcweir { 64*cdf0e10cSrcweir // for these cases select the default in the list box 65*cdf0e10cSrcweir case CHERROR_NONE: 66*cdf0e10cSrcweir case CHERROR_PERCENT: 67*cdf0e10cSrcweir case CHERROR_CONST: 68*cdf0e10cSrcweir case CHERROR_RANGE: 69*cdf0e10cSrcweir nResult = CHART_LB_FUNCTION_STD_DEV; 70*cdf0e10cSrcweir break; 71*cdf0e10cSrcweir case CHERROR_VARIANT: 72*cdf0e10cSrcweir nResult = CHART_LB_FUNCTION_VARIANCE; 73*cdf0e10cSrcweir break; 74*cdf0e10cSrcweir case CHERROR_SIGMA: 75*cdf0e10cSrcweir nResult = CHART_LB_FUNCTION_STD_DEV; 76*cdf0e10cSrcweir break; 77*cdf0e10cSrcweir case CHERROR_BIGERROR: 78*cdf0e10cSrcweir nResult = CHART_LB_FUNCTION_ERROR_MARGIN; 79*cdf0e10cSrcweir break; 80*cdf0e10cSrcweir case CHERROR_STDERROR: 81*cdf0e10cSrcweir nResult = CHART_LB_FUNCTION_STD_ERROR; 82*cdf0e10cSrcweir break; 83*cdf0e10cSrcweir } 84*cdf0e10cSrcweir return nResult; 85*cdf0e10cSrcweir } 86*cdf0e10cSrcweir } // anonymous namespace 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir //............................................................................. 90*cdf0e10cSrcweir namespace chart 91*cdf0e10cSrcweir { 92*cdf0e10cSrcweir //............................................................................. 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir // macro for selecting a normal or high contrast bitmap the stack variable 95*cdf0e10cSrcweir // bIsHighContrast must exist and reflect the correct state 96*cdf0e10cSrcweir #define SELECT_IMAGE(name) Image( SchResId( bIsHighContrast ? name ## _HC : name )) 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir enum StatIndicator 99*cdf0e10cSrcweir { 100*cdf0e10cSrcweir INDICATE_BOTH, 101*cdf0e10cSrcweir INDICATE_UP, 102*cdf0e10cSrcweir INDICATE_DOWN 103*cdf0e10cSrcweir }; 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir ErrorBarResources::ErrorBarResources( Window* pParent, Dialog * pParentDialog, 106*cdf0e10cSrcweir const SfxItemSet& rInAttrs, bool bNoneAvailable, 107*cdf0e10cSrcweir tErrorBarType eType /* = ERROR_BAR_Y */ ) : 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir m_aFlErrorCategory( pParent, SchResId( FL_ERROR )), 110*cdf0e10cSrcweir m_aRbNone( pParent, SchResId( RB_NONE )), 111*cdf0e10cSrcweir m_aRbConst( pParent, SchResId( RB_CONST )), 112*cdf0e10cSrcweir m_aRbPercent( pParent, SchResId( RB_PERCENT )), 113*cdf0e10cSrcweir m_aRbFunction( pParent, SchResId( RB_FUNCTION )), 114*cdf0e10cSrcweir m_aRbRange( pParent, SchResId( RB_RANGE )), 115*cdf0e10cSrcweir m_aLbFunction( pParent, SchResId( LB_FUNCTION )), 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir m_aFlParameters( pParent, SchResId( FL_PARAMETERS )), 118*cdf0e10cSrcweir m_aFtPositive( pParent, SchResId( FT_POSITIVE )), 119*cdf0e10cSrcweir m_aMfPositive( pParent, SchResId( MF_POSITIVE )), 120*cdf0e10cSrcweir m_aEdRangePositive( pParent, SchResId( ED_RANGE_POSITIVE )), 121*cdf0e10cSrcweir m_aIbRangePositive( pParent, SchResId( IB_RANGE_POSITIVE )), 122*cdf0e10cSrcweir m_aFtNegative( pParent, SchResId( FT_NEGATIVE )), 123*cdf0e10cSrcweir m_aMfNegative( pParent, SchResId( MF_NEGATIVE )), 124*cdf0e10cSrcweir m_aEdRangeNegative( pParent, SchResId( ED_RANGE_NEGATIVE )), 125*cdf0e10cSrcweir m_aIbRangeNegative( pParent, SchResId( IB_RANGE_NEGATIVE )), 126*cdf0e10cSrcweir m_aCbSyncPosNeg( pParent, SchResId( CB_SYN_POS_NEG )), 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir m_aFlIndicate( pParent, SchResId( FL_INDICATE )), 129*cdf0e10cSrcweir m_aRbBoth( pParent, SchResId( RB_BOTH )), 130*cdf0e10cSrcweir m_aRbPositive( pParent, SchResId( RB_POSITIVE )), 131*cdf0e10cSrcweir m_aRbNegative( pParent, SchResId( RB_NEGATIVE )), 132*cdf0e10cSrcweir m_aFiBoth( pParent, SchResId( FI_BOTH )), 133*cdf0e10cSrcweir m_aFiPositive( pParent, SchResId( FI_POSITIVE )), 134*cdf0e10cSrcweir m_aFiNegative( pParent, SchResId( FI_NEGATIVE )), 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir m_eErrorKind( CHERROR_NONE ), 137*cdf0e10cSrcweir m_eIndicate( CHINDICATE_BOTH ), 138*cdf0e10cSrcweir m_bErrorKindUnique( true ), 139*cdf0e10cSrcweir m_bIndicatorUnique( true ), 140*cdf0e10cSrcweir m_bPlusUnique( true ), 141*cdf0e10cSrcweir m_bMinusUnique( true ), 142*cdf0e10cSrcweir m_bRangePosUnique( true ), 143*cdf0e10cSrcweir m_bRangeNegUnique( true ), 144*cdf0e10cSrcweir m_bNoneAvailable( bNoneAvailable ), 145*cdf0e10cSrcweir m_eErrorBarType( eType ), 146*cdf0e10cSrcweir m_nConstDecimalDigits( 1 ), 147*cdf0e10cSrcweir m_nConstSpinSize( 1 ), 148*cdf0e10cSrcweir m_pParentWindow( pParent ), 149*cdf0e10cSrcweir m_pParentDialog( pParentDialog ), 150*cdf0e10cSrcweir m_pCurrentRangeChoosingField( 0 ), 151*cdf0e10cSrcweir m_bHasInternalDataProvider( true ), 152*cdf0e10cSrcweir m_bDisableDataTableDialog( false ) 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir if( m_bNoneAvailable ) 155*cdf0e10cSrcweir m_aRbNone.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen )); 156*cdf0e10cSrcweir else 157*cdf0e10cSrcweir m_aRbNone.Hide(); 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir m_aRbConst.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen )); 160*cdf0e10cSrcweir m_aRbPercent.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen )); 161*cdf0e10cSrcweir m_aRbFunction.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen )); 162*cdf0e10cSrcweir m_aRbRange.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen )); 163*cdf0e10cSrcweir m_aLbFunction.SetSelectHdl( LINK( this, ErrorBarResources, CategoryChosen )); 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir m_aCbSyncPosNeg.Check( sal_False ); 166*cdf0e10cSrcweir m_aCbSyncPosNeg.SetToggleHdl( LINK( this, ErrorBarResources, SynchronizePosAndNeg )); 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir m_aMfPositive.SetModifyHdl( LINK( this, ErrorBarResources, PosValueChanged )); 169*cdf0e10cSrcweir m_aEdRangePositive.SetModifyHdl( LINK( this, ErrorBarResources, RangeChanged )); 170*cdf0e10cSrcweir m_aEdRangeNegative.SetModifyHdl( LINK( this, ErrorBarResources, RangeChanged )); 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir m_aRbPositive.SetClickHdl( LINK( this, ErrorBarResources, IndicatorChanged )); 173*cdf0e10cSrcweir m_aRbNegative.SetClickHdl( LINK( this, ErrorBarResources, IndicatorChanged )); 174*cdf0e10cSrcweir m_aRbBoth.SetClickHdl( LINK( this, ErrorBarResources, IndicatorChanged )); 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir m_aIbRangePositive.SetClickHdl( LINK( this, ErrorBarResources, ChooseRange )); 177*cdf0e10cSrcweir m_aIbRangeNegative.SetClickHdl( LINK( this, ErrorBarResources, ChooseRange )); 178*cdf0e10cSrcweir m_aIbRangePositive.SetQuickHelpText( String( SchResId( STR_TIP_SELECT_RANGE ))); 179*cdf0e10cSrcweir m_aIbRangeNegative.SetQuickHelpText( String( SchResId( STR_TIP_SELECT_RANGE ))); 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir FillValueSets(); 182*cdf0e10cSrcweir Reset( rInAttrs ); 183*cdf0e10cSrcweir } 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir ErrorBarResources::~ErrorBarResources() 186*cdf0e10cSrcweir { 187*cdf0e10cSrcweir } 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir void ErrorBarResources::SetErrorBarType( tErrorBarType eNewType ) 190*cdf0e10cSrcweir { 191*cdf0e10cSrcweir if( m_eErrorBarType != eNewType ) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir m_eErrorBarType = eNewType; 194*cdf0e10cSrcweir FillValueSets(); 195*cdf0e10cSrcweir } 196*cdf0e10cSrcweir } 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir void ErrorBarResources::SetChartDocumentForRangeChoosing( 199*cdf0e10cSrcweir const uno::Reference< chart2::XChartDocument > & xChartDocument ) 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir if( xChartDocument.is()) 202*cdf0e10cSrcweir { 203*cdf0e10cSrcweir m_bHasInternalDataProvider = xChartDocument->hasInternalDataProvider(); 204*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( xChartDocument, uno::UNO_QUERY ); 205*cdf0e10cSrcweir if ( xProps.is() ) 206*cdf0e10cSrcweir { 207*cdf0e10cSrcweir try 208*cdf0e10cSrcweir { 209*cdf0e10cSrcweir xProps->getPropertyValue( C2U( "DisableDataTableDialog" ) ) >>= m_bDisableDataTableDialog; 210*cdf0e10cSrcweir } 211*cdf0e10cSrcweir catch( uno::Exception& e ) 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir ASSERT_EXCEPTION( e ); 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir } 216*cdf0e10cSrcweir } 217*cdf0e10cSrcweir m_apRangeSelectionHelper.reset( new RangeSelectionHelper( xChartDocument )); 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir // has internal data provider => rename "cell range" to "from data" 220*cdf0e10cSrcweir OSL_ASSERT( m_apRangeSelectionHelper.get()); 221*cdf0e10cSrcweir if( m_bHasInternalDataProvider ) 222*cdf0e10cSrcweir { 223*cdf0e10cSrcweir m_aRbRange.SetText( String( SchResId( STR_CONTROLTEXT_ERROR_BARS_FROM_DATA ))); 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir if( m_aRbRange.IsChecked()) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir isRangeFieldContentValid( m_aEdRangePositive ); 229*cdf0e10cSrcweir isRangeFieldContentValid( m_aEdRangeNegative ); 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir void ErrorBarResources::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ) 234*cdf0e10cSrcweir { 235*cdf0e10cSrcweir if( fMinorStepWidth < 0 ) 236*cdf0e10cSrcweir fMinorStepWidth = -fMinorStepWidth; 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir sal_Int32 nExponent = static_cast< sal_Int32 >( ::rtl::math::approxFloor( log10( fMinorStepWidth ))); 239*cdf0e10cSrcweir if( nExponent <= 0 ) 240*cdf0e10cSrcweir { 241*cdf0e10cSrcweir // one digit precision more 242*cdf0e10cSrcweir m_nConstDecimalDigits = static_cast< sal_uInt16 >( (-nExponent) + 1 ); 243*cdf0e10cSrcweir m_nConstSpinSize = 10; 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir else 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir m_nConstDecimalDigits = 0; 248*cdf0e10cSrcweir m_nConstSpinSize = static_cast< sal_Int64 >( pow( 10.0, (int)nExponent )); 249*cdf0e10cSrcweir } 250*cdf0e10cSrcweir } 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir void ErrorBarResources::UpdateControlStates() 253*cdf0e10cSrcweir { 254*cdf0e10cSrcweir // function 255*cdf0e10cSrcweir bool bIsFunction = m_aRbFunction.IsChecked(); 256*cdf0e10cSrcweir m_aLbFunction.Enable( bIsFunction ); 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir // range buttons 259*cdf0e10cSrcweir m_aRbRange.Enable( !m_bHasInternalDataProvider || !m_bDisableDataTableDialog ); 260*cdf0e10cSrcweir bool bShowRange = ( m_aRbRange.IsChecked()); 261*cdf0e10cSrcweir bool bCanChooseRange = 262*cdf0e10cSrcweir ( bShowRange && 263*cdf0e10cSrcweir m_apRangeSelectionHelper.get() && 264*cdf0e10cSrcweir m_apRangeSelectionHelper->hasRangeSelection()); 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir m_aMfPositive.Show( ! bShowRange ); 267*cdf0e10cSrcweir m_aMfNegative.Show( ! bShowRange ); 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir // use range but without range chooser => hide controls 270*cdf0e10cSrcweir m_aEdRangePositive.Show( bShowRange && ! m_bHasInternalDataProvider ); 271*cdf0e10cSrcweir m_aIbRangePositive.Show( bCanChooseRange ); 272*cdf0e10cSrcweir m_aEdRangeNegative.Show( bShowRange && ! m_bHasInternalDataProvider ); 273*cdf0e10cSrcweir m_aIbRangeNegative.Show( bCanChooseRange ); 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir bool bShowPosNegAndSync = ! (bShowRange && m_bHasInternalDataProvider); 276*cdf0e10cSrcweir m_aFtPositive.Show( bShowPosNegAndSync ); 277*cdf0e10cSrcweir m_aFtNegative.Show( bShowPosNegAndSync ); 278*cdf0e10cSrcweir m_aCbSyncPosNeg.Show( bShowPosNegAndSync ); 279*cdf0e10cSrcweir m_aFlParameters.Show( bShowPosNegAndSync ); 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir // unit for metric fields 282*cdf0e10cSrcweir bool bIsErrorMargin( 283*cdf0e10cSrcweir ( m_aRbFunction.IsChecked()) && 284*cdf0e10cSrcweir ( m_aLbFunction.GetSelectEntryPos() == CHART_LB_FUNCTION_ERROR_MARGIN )); 285*cdf0e10cSrcweir bool bIsPercentage( m_aRbPercent.IsChecked() || bIsErrorMargin ); 286*cdf0e10cSrcweir String aCustomUnit; 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir if( bIsPercentage ) 289*cdf0e10cSrcweir { 290*cdf0e10cSrcweir aCustomUnit = String( RTL_CONSTASCII_USTRINGPARAM( " %" )); 291*cdf0e10cSrcweir m_aMfPositive.SetDecimalDigits( 1 ); 292*cdf0e10cSrcweir m_aMfPositive.SetSpinSize( 10 ); 293*cdf0e10cSrcweir m_aMfNegative.SetDecimalDigits( 1 ); 294*cdf0e10cSrcweir m_aMfNegative.SetSpinSize( 10 ); 295*cdf0e10cSrcweir } 296*cdf0e10cSrcweir else 297*cdf0e10cSrcweir { 298*cdf0e10cSrcweir m_aMfPositive.SetDecimalDigits( m_nConstDecimalDigits ); 299*cdf0e10cSrcweir m_aMfPositive.SetSpinSize( m_nConstSpinSize ); 300*cdf0e10cSrcweir m_aMfNegative.SetDecimalDigits( m_nConstDecimalDigits ); 301*cdf0e10cSrcweir m_aMfNegative.SetSpinSize( m_nConstSpinSize ); 302*cdf0e10cSrcweir } 303*cdf0e10cSrcweir m_aMfPositive.SetCustomUnitText( aCustomUnit ); 304*cdf0e10cSrcweir m_aMfNegative.SetCustomUnitText( aCustomUnit ); 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir // positive and negative value fields 307*cdf0e10cSrcweir bool bPosEnabled = ( m_aRbPositive.IsChecked() || m_aRbBoth.IsChecked()); 308*cdf0e10cSrcweir bool bNegEnabled = ( m_aRbNegative.IsChecked() || m_aRbBoth.IsChecked()); 309*cdf0e10cSrcweir if( !( bPosEnabled || bNegEnabled )) 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir // all three controls are not checked -> ambiguous state 312*cdf0e10cSrcweir bPosEnabled = true; 313*cdf0e10cSrcweir bNegEnabled = true; 314*cdf0e10cSrcweir } 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir // functions with only one parameter 317*cdf0e10cSrcweir bool bOneParameterCategory = 318*cdf0e10cSrcweir bIsErrorMargin || m_aRbPercent.IsChecked(); 319*cdf0e10cSrcweir if( bOneParameterCategory ) 320*cdf0e10cSrcweir { 321*cdf0e10cSrcweir m_aCbSyncPosNeg.Check(); 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir if( m_aCbSyncPosNeg.IsChecked()) 325*cdf0e10cSrcweir { 326*cdf0e10cSrcweir bPosEnabled = true; 327*cdf0e10cSrcweir bNegEnabled = false; 328*cdf0e10cSrcweir } 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir // all functions except error margin take no arguments 331*cdf0e10cSrcweir if( m_aRbFunction.IsChecked() && 332*cdf0e10cSrcweir ( m_aLbFunction.GetSelectEntryPos() != CHART_LB_FUNCTION_ERROR_MARGIN )) 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir bPosEnabled = false; 335*cdf0e10cSrcweir bNegEnabled = false; 336*cdf0e10cSrcweir } 337*cdf0e10cSrcweir 338*cdf0e10cSrcweir // enable/disable pos/neg fields 339*cdf0e10cSrcweir m_aFtPositive.Enable( bPosEnabled ); 340*cdf0e10cSrcweir m_aFtNegative.Enable( bNegEnabled ); 341*cdf0e10cSrcweir if( bShowRange ) 342*cdf0e10cSrcweir { 343*cdf0e10cSrcweir m_aEdRangePositive.Enable( bPosEnabled ); 344*cdf0e10cSrcweir m_aIbRangePositive.Enable( bPosEnabled ); 345*cdf0e10cSrcweir m_aEdRangeNegative.Enable( bNegEnabled ); 346*cdf0e10cSrcweir m_aIbRangeNegative.Enable( bNegEnabled ); 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir else 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir m_aMfPositive.Enable( bPosEnabled ); 351*cdf0e10cSrcweir m_aMfNegative.Enable( bNegEnabled ); 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir m_aCbSyncPosNeg.Enable( 355*cdf0e10cSrcweir !bOneParameterCategory && 356*cdf0e10cSrcweir ( bPosEnabled || bNegEnabled )); 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir // mark invalid entries in the range fields 359*cdf0e10cSrcweir if( bShowRange && ! m_bHasInternalDataProvider ) 360*cdf0e10cSrcweir { 361*cdf0e10cSrcweir isRangeFieldContentValid( m_aEdRangePositive ); 362*cdf0e10cSrcweir isRangeFieldContentValid( m_aEdRangeNegative ); 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir } 365*cdf0e10cSrcweir 366*cdf0e10cSrcweir IMPL_LINK( ErrorBarResources, CategoryChosen, void *, ) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir m_bErrorKindUnique = true; 369*cdf0e10cSrcweir SvxChartKindError eOldError = m_eErrorKind; 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir if( m_aRbNone.IsChecked()) 372*cdf0e10cSrcweir m_eErrorKind = CHERROR_NONE; 373*cdf0e10cSrcweir else if( m_aRbConst.IsChecked()) 374*cdf0e10cSrcweir m_eErrorKind = CHERROR_CONST; 375*cdf0e10cSrcweir else if( m_aRbPercent.IsChecked()) 376*cdf0e10cSrcweir m_eErrorKind = CHERROR_PERCENT; 377*cdf0e10cSrcweir else if( m_aRbRange.IsChecked()) 378*cdf0e10cSrcweir m_eErrorKind = CHERROR_RANGE; 379*cdf0e10cSrcweir else if( m_aRbFunction.IsChecked()) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir if( m_aLbFunction.GetSelectEntryCount() == 1 ) 382*cdf0e10cSrcweir { 383*cdf0e10cSrcweir switch( m_aLbFunction.GetSelectEntryPos()) 384*cdf0e10cSrcweir { 385*cdf0e10cSrcweir case CHART_LB_FUNCTION_STD_ERROR: 386*cdf0e10cSrcweir m_eErrorKind = CHERROR_STDERROR; break; 387*cdf0e10cSrcweir case CHART_LB_FUNCTION_STD_DEV: 388*cdf0e10cSrcweir m_eErrorKind = CHERROR_SIGMA; break; 389*cdf0e10cSrcweir case CHART_LB_FUNCTION_VARIANCE: 390*cdf0e10cSrcweir m_eErrorKind = CHERROR_VARIANT; break; 391*cdf0e10cSrcweir case CHART_LB_FUNCTION_ERROR_MARGIN: 392*cdf0e10cSrcweir m_eErrorKind = CHERROR_BIGERROR; break; 393*cdf0e10cSrcweir default: 394*cdf0e10cSrcweir m_bErrorKindUnique = false; 395*cdf0e10cSrcweir } 396*cdf0e10cSrcweir } 397*cdf0e10cSrcweir else 398*cdf0e10cSrcweir m_bErrorKindUnique = false; 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir else 401*cdf0e10cSrcweir { 402*cdf0e10cSrcweir OSL_ENSURE( false, "Unknown category chosen" ); 403*cdf0e10cSrcweir m_bErrorKindUnique = false; 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir // changed to range 407*cdf0e10cSrcweir if( m_eErrorKind == CHERROR_RANGE && 408*cdf0e10cSrcweir eOldError != CHERROR_RANGE ) 409*cdf0e10cSrcweir { 410*cdf0e10cSrcweir m_aCbSyncPosNeg.Check( 411*cdf0e10cSrcweir (m_aEdRangePositive.GetText().Len() > 0) && 412*cdf0e10cSrcweir m_aEdRangePositive.GetText().Equals( 413*cdf0e10cSrcweir m_aEdRangeNegative.GetText())); 414*cdf0e10cSrcweir } 415*cdf0e10cSrcweir // changed from range 416*cdf0e10cSrcweir else if( m_eErrorKind != CHERROR_RANGE && 417*cdf0e10cSrcweir eOldError == CHERROR_RANGE ) 418*cdf0e10cSrcweir { 419*cdf0e10cSrcweir m_aCbSyncPosNeg.Check( 420*cdf0e10cSrcweir m_aMfPositive.GetValue() == m_aMfNegative.GetValue()); 421*cdf0e10cSrcweir } 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir UpdateControlStates(); 424*cdf0e10cSrcweir return 0; 425*cdf0e10cSrcweir } 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir IMPL_LINK( ErrorBarResources, SynchronizePosAndNeg, void *, EMPTYARG ) 428*cdf0e10cSrcweir { 429*cdf0e10cSrcweir UpdateControlStates(); 430*cdf0e10cSrcweir PosValueChanged( 0 ); 431*cdf0e10cSrcweir return 0; 432*cdf0e10cSrcweir } 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir IMPL_LINK( ErrorBarResources, PosValueChanged, void *, EMPTYARG ) 435*cdf0e10cSrcweir { 436*cdf0e10cSrcweir if( m_aCbSyncPosNeg.IsChecked()) 437*cdf0e10cSrcweir { 438*cdf0e10cSrcweir if( m_aRbRange.IsChecked()) 439*cdf0e10cSrcweir { 440*cdf0e10cSrcweir m_aEdRangeNegative.SetText( m_aEdRangePositive.GetText()); 441*cdf0e10cSrcweir m_bRangeNegUnique = m_bRangePosUnique; 442*cdf0e10cSrcweir } 443*cdf0e10cSrcweir else 444*cdf0e10cSrcweir m_aMfNegative.SetValue( m_aMfPositive.GetValue()); 445*cdf0e10cSrcweir } 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir return 0; 448*cdf0e10cSrcweir } 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir IMPL_LINK( ErrorBarResources, IndicatorChanged, void *, EMPTYARG ) 451*cdf0e10cSrcweir { 452*cdf0e10cSrcweir m_bIndicatorUnique = true; 453*cdf0e10cSrcweir if( m_aRbBoth.IsChecked()) 454*cdf0e10cSrcweir m_eIndicate = CHINDICATE_BOTH; 455*cdf0e10cSrcweir else if( m_aRbPositive.IsChecked()) 456*cdf0e10cSrcweir m_eIndicate = CHINDICATE_UP; 457*cdf0e10cSrcweir else if( m_aRbNegative.IsChecked()) 458*cdf0e10cSrcweir m_eIndicate = CHINDICATE_DOWN; 459*cdf0e10cSrcweir else 460*cdf0e10cSrcweir m_bIndicatorUnique = false; 461*cdf0e10cSrcweir 462*cdf0e10cSrcweir UpdateControlStates(); 463*cdf0e10cSrcweir return 0; 464*cdf0e10cSrcweir } 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir IMPL_LINK( ErrorBarResources, ChooseRange, RangeSelectionButton *, pButton ) 467*cdf0e10cSrcweir { 468*cdf0e10cSrcweir OSL_ASSERT( m_apRangeSelectionHelper.get()); 469*cdf0e10cSrcweir if( ! m_apRangeSelectionHelper.get()) 470*cdf0e10cSrcweir return 0; 471*cdf0e10cSrcweir OSL_ASSERT( m_pCurrentRangeChoosingField == 0 ); 472*cdf0e10cSrcweir 473*cdf0e10cSrcweir ::rtl::OUString aUIString; 474*cdf0e10cSrcweir if( pButton == &m_aIbRangePositive ) 475*cdf0e10cSrcweir { 476*cdf0e10cSrcweir m_pCurrentRangeChoosingField = &m_aEdRangePositive; 477*cdf0e10cSrcweir aUIString = String( SchResId( STR_DATA_SELECT_RANGE_FOR_POSITIVE_ERRORBARS )); 478*cdf0e10cSrcweir } 479*cdf0e10cSrcweir else 480*cdf0e10cSrcweir { 481*cdf0e10cSrcweir m_pCurrentRangeChoosingField = &m_aEdRangeNegative; 482*cdf0e10cSrcweir aUIString = String( SchResId( STR_DATA_SELECT_RANGE_FOR_NEGATIVE_ERRORBARS )); 483*cdf0e10cSrcweir } 484*cdf0e10cSrcweir 485*cdf0e10cSrcweir OSL_ASSERT( m_pParentDialog ); 486*cdf0e10cSrcweir if( m_pParentDialog ) 487*cdf0e10cSrcweir { 488*cdf0e10cSrcweir lcl_enableRangeChoosing( true, m_pParentDialog ); 489*cdf0e10cSrcweir m_apRangeSelectionHelper->chooseRange( 490*cdf0e10cSrcweir m_pCurrentRangeChoosingField->GetText(), 491*cdf0e10cSrcweir aUIString, *this ); 492*cdf0e10cSrcweir } 493*cdf0e10cSrcweir else 494*cdf0e10cSrcweir m_pCurrentRangeChoosingField = 0; 495*cdf0e10cSrcweir 496*cdf0e10cSrcweir return 0; 497*cdf0e10cSrcweir } 498*cdf0e10cSrcweir 499*cdf0e10cSrcweir IMPL_LINK( ErrorBarResources, RangeChanged, Edit *, pEdit ) 500*cdf0e10cSrcweir { 501*cdf0e10cSrcweir if( pEdit == & m_aEdRangePositive ) 502*cdf0e10cSrcweir { 503*cdf0e10cSrcweir m_bRangePosUnique = true; 504*cdf0e10cSrcweir PosValueChanged( 0 ); 505*cdf0e10cSrcweir } 506*cdf0e10cSrcweir else 507*cdf0e10cSrcweir { 508*cdf0e10cSrcweir m_bRangeNegUnique = true; 509*cdf0e10cSrcweir } 510*cdf0e10cSrcweir 511*cdf0e10cSrcweir isRangeFieldContentValid( *pEdit ); 512*cdf0e10cSrcweir 513*cdf0e10cSrcweir return 0; 514*cdf0e10cSrcweir } 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir void ErrorBarResources::Reset(const SfxItemSet& rInAttrs) 517*cdf0e10cSrcweir { 518*cdf0e10cSrcweir const SfxPoolItem *pPoolItem = NULL; 519*cdf0e10cSrcweir SfxItemState aState = SFX_ITEM_UNKNOWN; 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir // category 522*cdf0e10cSrcweir m_eErrorKind = CHERROR_NONE; 523*cdf0e10cSrcweir aState = rInAttrs.GetItemState( SCHATTR_STAT_KIND_ERROR, sal_True, &pPoolItem ); 524*cdf0e10cSrcweir m_bErrorKindUnique = ( aState != SFX_ITEM_DONTCARE ); 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir if( aState == SFX_ITEM_SET ) 527*cdf0e10cSrcweir m_eErrorKind = ((const SvxChartKindErrorItem*) pPoolItem)->GetValue(); 528*cdf0e10cSrcweir 529*cdf0e10cSrcweir m_aLbFunction.SelectEntryPos( lcl_getLbEntryPosByErrorKind( m_eErrorKind )); 530*cdf0e10cSrcweir 531*cdf0e10cSrcweir if( m_bErrorKindUnique ) 532*cdf0e10cSrcweir { 533*cdf0e10cSrcweir switch( m_eErrorKind ) 534*cdf0e10cSrcweir { 535*cdf0e10cSrcweir case CHERROR_NONE: 536*cdf0e10cSrcweir m_aRbNone.Check(); 537*cdf0e10cSrcweir break; 538*cdf0e10cSrcweir case CHERROR_PERCENT: 539*cdf0e10cSrcweir m_aRbPercent.Check(); 540*cdf0e10cSrcweir break; 541*cdf0e10cSrcweir case CHERROR_CONST: 542*cdf0e10cSrcweir m_aRbConst.Check(); 543*cdf0e10cSrcweir break; 544*cdf0e10cSrcweir case CHERROR_STDERROR: 545*cdf0e10cSrcweir case CHERROR_VARIANT: 546*cdf0e10cSrcweir case CHERROR_SIGMA: 547*cdf0e10cSrcweir case CHERROR_BIGERROR: 548*cdf0e10cSrcweir m_aRbFunction.Check(); 549*cdf0e10cSrcweir break; 550*cdf0e10cSrcweir case CHERROR_RANGE: 551*cdf0e10cSrcweir m_aRbRange.Check(); 552*cdf0e10cSrcweir break; 553*cdf0e10cSrcweir } 554*cdf0e10cSrcweir } 555*cdf0e10cSrcweir else 556*cdf0e10cSrcweir { 557*cdf0e10cSrcweir m_aRbNone.Check( sal_False ); 558*cdf0e10cSrcweir m_aRbConst.Check( sal_False ); 559*cdf0e10cSrcweir m_aRbPercent.Check( sal_False ); 560*cdf0e10cSrcweir m_aRbFunction.Check( sal_False ); 561*cdf0e10cSrcweir } 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir // parameters 564*cdf0e10cSrcweir aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTPLUS, sal_True, &pPoolItem ); 565*cdf0e10cSrcweir m_bPlusUnique = ( aState != SFX_ITEM_DONTCARE ); 566*cdf0e10cSrcweir double fPlusValue = 0.0; 567*cdf0e10cSrcweir if( aState == SFX_ITEM_SET ) 568*cdf0e10cSrcweir { 569*cdf0e10cSrcweir fPlusValue = ((const SvxDoubleItem*) pPoolItem)->GetValue(); 570*cdf0e10cSrcweir sal_Int32 nPlusValue = static_cast< sal_Int32 >( fPlusValue * pow(10.0,m_aMfPositive.GetDecimalDigits()) ); 571*cdf0e10cSrcweir m_aMfPositive.SetValue( nPlusValue ); 572*cdf0e10cSrcweir } 573*cdf0e10cSrcweir 574*cdf0e10cSrcweir aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTMINUS, sal_True, &pPoolItem ); 575*cdf0e10cSrcweir m_bMinusUnique = ( aState != SFX_ITEM_DONTCARE ); 576*cdf0e10cSrcweir double fMinusValue = 0.0; 577*cdf0e10cSrcweir if( aState == SFX_ITEM_SET ) 578*cdf0e10cSrcweir { 579*cdf0e10cSrcweir fMinusValue = ((const SvxDoubleItem*) pPoolItem)->GetValue(); 580*cdf0e10cSrcweir sal_Int32 nMinusValue = static_cast< sal_Int32 >( fMinusValue * pow(10.0,m_aMfNegative.GetDecimalDigits()) ); 581*cdf0e10cSrcweir m_aMfNegative.SetValue( nMinusValue ); 582*cdf0e10cSrcweir 583*cdf0e10cSrcweir if( m_eErrorKind != CHERROR_RANGE && 584*cdf0e10cSrcweir fPlusValue == fMinusValue ) 585*cdf0e10cSrcweir m_aCbSyncPosNeg.Check(); 586*cdf0e10cSrcweir } 587*cdf0e10cSrcweir 588*cdf0e10cSrcweir // indicator 589*cdf0e10cSrcweir aState = rInAttrs.GetItemState( SCHATTR_STAT_INDICATE, sal_True, &pPoolItem ); 590*cdf0e10cSrcweir m_bIndicatorUnique = ( aState != SFX_ITEM_DONTCARE ); 591*cdf0e10cSrcweir if( aState == SFX_ITEM_SET) 592*cdf0e10cSrcweir m_eIndicate = ((const SvxChartIndicateItem * ) pPoolItem)->GetValue(); 593*cdf0e10cSrcweir 594*cdf0e10cSrcweir if( m_bIndicatorUnique ) 595*cdf0e10cSrcweir { 596*cdf0e10cSrcweir switch( m_eIndicate ) 597*cdf0e10cSrcweir { 598*cdf0e10cSrcweir case CHINDICATE_NONE : 599*cdf0e10cSrcweir // no longer used, use both as default 600*cdf0e10cSrcweir m_eIndicate = CHINDICATE_BOTH; 601*cdf0e10cSrcweir // fall-through intended to BOTH 602*cdf0e10cSrcweir case CHINDICATE_BOTH : 603*cdf0e10cSrcweir m_aRbBoth.Check(); break; 604*cdf0e10cSrcweir case CHINDICATE_UP : 605*cdf0e10cSrcweir m_aRbPositive.Check(); break; 606*cdf0e10cSrcweir case CHINDICATE_DOWN : 607*cdf0e10cSrcweir m_aRbNegative.Check(); break; 608*cdf0e10cSrcweir } 609*cdf0e10cSrcweir } 610*cdf0e10cSrcweir else 611*cdf0e10cSrcweir { 612*cdf0e10cSrcweir m_aRbBoth.Check( sal_False ); 613*cdf0e10cSrcweir m_aRbPositive.Check( sal_False ); 614*cdf0e10cSrcweir m_aRbNegative.Check( sal_False ); 615*cdf0e10cSrcweir } 616*cdf0e10cSrcweir 617*cdf0e10cSrcweir // ranges 618*cdf0e10cSrcweir aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_POS, sal_True, &pPoolItem ); 619*cdf0e10cSrcweir m_bRangePosUnique = ( aState != SFX_ITEM_DONTCARE ); 620*cdf0e10cSrcweir if( aState == SFX_ITEM_SET ) 621*cdf0e10cSrcweir { 622*cdf0e10cSrcweir String sRangePositive = (static_cast< const SfxStringItem * >( pPoolItem ))->GetValue(); 623*cdf0e10cSrcweir m_aEdRangePositive.SetText( sRangePositive ); 624*cdf0e10cSrcweir } 625*cdf0e10cSrcweir 626*cdf0e10cSrcweir aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_NEG, sal_True, &pPoolItem ); 627*cdf0e10cSrcweir m_bRangeNegUnique = ( aState != SFX_ITEM_DONTCARE ); 628*cdf0e10cSrcweir if( aState == SFX_ITEM_SET ) 629*cdf0e10cSrcweir { 630*cdf0e10cSrcweir String sRangeNegative = (static_cast< const SfxStringItem * >( pPoolItem ))->GetValue(); 631*cdf0e10cSrcweir m_aEdRangeNegative.SetText( sRangeNegative ); 632*cdf0e10cSrcweir if( m_eErrorKind == CHERROR_RANGE && 633*cdf0e10cSrcweir sRangeNegative.Len() > 0 && 634*cdf0e10cSrcweir sRangeNegative.Equals( m_aEdRangePositive.GetText())) 635*cdf0e10cSrcweir m_aCbSyncPosNeg.Check(); 636*cdf0e10cSrcweir } 637*cdf0e10cSrcweir 638*cdf0e10cSrcweir UpdateControlStates(); 639*cdf0e10cSrcweir } 640*cdf0e10cSrcweir 641*cdf0e10cSrcweir sal_Bool ErrorBarResources::FillItemSet(SfxItemSet& rOutAttrs) const 642*cdf0e10cSrcweir { 643*cdf0e10cSrcweir if( m_bErrorKindUnique ) 644*cdf0e10cSrcweir rOutAttrs.Put( SvxChartKindErrorItem( m_eErrorKind, SCHATTR_STAT_KIND_ERROR )); 645*cdf0e10cSrcweir if( m_bIndicatorUnique ) 646*cdf0e10cSrcweir rOutAttrs.Put( SvxChartIndicateItem( m_eIndicate, SCHATTR_STAT_INDICATE )); 647*cdf0e10cSrcweir 648*cdf0e10cSrcweir if( m_bErrorKindUnique ) 649*cdf0e10cSrcweir { 650*cdf0e10cSrcweir if( m_eErrorKind == CHERROR_RANGE ) 651*cdf0e10cSrcweir { 652*cdf0e10cSrcweir String aPosRange; 653*cdf0e10cSrcweir String aNegRange; 654*cdf0e10cSrcweir if( m_bHasInternalDataProvider ) 655*cdf0e10cSrcweir { 656*cdf0e10cSrcweir // the strings aPosRange/aNegRange have to be set to a non-empty 657*cdf0e10cSrcweir // arbitrary string to generate error-bar sequences 658*cdf0e10cSrcweir aPosRange.Assign( sal_Unicode('x')); 659*cdf0e10cSrcweir aNegRange = aPosRange; 660*cdf0e10cSrcweir } 661*cdf0e10cSrcweir else 662*cdf0e10cSrcweir { 663*cdf0e10cSrcweir aPosRange = m_aEdRangePositive.GetText(); 664*cdf0e10cSrcweir if( m_aCbSyncPosNeg.IsChecked()) 665*cdf0e10cSrcweir aNegRange = aPosRange; 666*cdf0e10cSrcweir else 667*cdf0e10cSrcweir aNegRange = m_aEdRangeNegative.GetText(); 668*cdf0e10cSrcweir } 669*cdf0e10cSrcweir 670*cdf0e10cSrcweir if( m_bRangePosUnique ) 671*cdf0e10cSrcweir rOutAttrs.Put( SfxStringItem( SCHATTR_STAT_RANGE_POS, aPosRange )); 672*cdf0e10cSrcweir if( m_bRangeNegUnique ) 673*cdf0e10cSrcweir rOutAttrs.Put( SfxStringItem( SCHATTR_STAT_RANGE_NEG, aNegRange )); 674*cdf0e10cSrcweir } 675*cdf0e10cSrcweir else if( m_eErrorKind == CHERROR_CONST || 676*cdf0e10cSrcweir m_eErrorKind == CHERROR_PERCENT || 677*cdf0e10cSrcweir m_eErrorKind == CHERROR_BIGERROR ) 678*cdf0e10cSrcweir { 679*cdf0e10cSrcweir double fPosValue = static_cast< double >( m_aMfPositive.GetValue()) / 680*cdf0e10cSrcweir pow( 10.0, m_aMfPositive.GetDecimalDigits()); 681*cdf0e10cSrcweir double fNegValue = 0.0; 682*cdf0e10cSrcweir 683*cdf0e10cSrcweir if( m_aCbSyncPosNeg.IsChecked()) 684*cdf0e10cSrcweir fNegValue = fPosValue; 685*cdf0e10cSrcweir else 686*cdf0e10cSrcweir fNegValue = static_cast< double >( m_aMfNegative.GetValue()) / 687*cdf0e10cSrcweir pow( 10.0, m_aMfNegative.GetDecimalDigits()); 688*cdf0e10cSrcweir 689*cdf0e10cSrcweir rOutAttrs.Put( SvxDoubleItem( fPosValue, SCHATTR_STAT_CONSTPLUS )); 690*cdf0e10cSrcweir rOutAttrs.Put( SvxDoubleItem( fNegValue, SCHATTR_STAT_CONSTMINUS )); 691*cdf0e10cSrcweir } 692*cdf0e10cSrcweir } 693*cdf0e10cSrcweir 694*cdf0e10cSrcweir return sal_True; 695*cdf0e10cSrcweir } 696*cdf0e10cSrcweir 697*cdf0e10cSrcweir void ErrorBarResources::FillValueSets() 698*cdf0e10cSrcweir { 699*cdf0e10cSrcweir bool bIsHighContrast = ( true && m_aRbConst.GetSettings().GetStyleSettings().GetHighContrastMode() ); 700*cdf0e10cSrcweir 701*cdf0e10cSrcweir // do not scale images, show then centered 702*cdf0e10cSrcweir // m_aFiPositive.SetStyle( (m_aFiPositive.GetStyle() & (~WB_SCALE)) | WB_CENTER ); 703*cdf0e10cSrcweir // m_aFiNegative.SetStyle( (m_aFiNegative.GetStyle() & (~WB_SCALE)) | WB_CENTER ); 704*cdf0e10cSrcweir // m_aFiBoth.SetStyle( (m_aFiBoth.GetStyle() & (~WB_SCALE)) | WB_CENTER ); 705*cdf0e10cSrcweir 706*cdf0e10cSrcweir if( m_eErrorBarType == ERROR_BAR_Y ) 707*cdf0e10cSrcweir { 708*cdf0e10cSrcweir m_aFiNegative.SetImage( SELECT_IMAGE( BMP_INDICATE_DOWN )); 709*cdf0e10cSrcweir m_aFiPositive.SetImage( SELECT_IMAGE( BMP_INDICATE_UP )); 710*cdf0e10cSrcweir m_aFiBoth.SetImage( SELECT_IMAGE( BMP_INDICATE_BOTH_VERTI )); 711*cdf0e10cSrcweir } 712*cdf0e10cSrcweir else if( m_eErrorBarType == ERROR_BAR_X ) 713*cdf0e10cSrcweir { 714*cdf0e10cSrcweir m_aFiNegative.SetImage( SELECT_IMAGE( BMP_INDICATE_LEFT )); 715*cdf0e10cSrcweir m_aFiPositive.SetImage( SELECT_IMAGE( BMP_INDICATE_RIGHT )); 716*cdf0e10cSrcweir m_aFiBoth.SetImage( SELECT_IMAGE( BMP_INDICATE_BOTH_HORI )); 717*cdf0e10cSrcweir } 718*cdf0e10cSrcweir } 719*cdf0e10cSrcweir 720*cdf0e10cSrcweir void ErrorBarResources::listeningFinished( 721*cdf0e10cSrcweir const ::rtl::OUString & rNewRange ) 722*cdf0e10cSrcweir { 723*cdf0e10cSrcweir OSL_ASSERT( m_apRangeSelectionHelper.get()); 724*cdf0e10cSrcweir if( ! m_apRangeSelectionHelper.get()) 725*cdf0e10cSrcweir return; 726*cdf0e10cSrcweir 727*cdf0e10cSrcweir // rNewRange becomes invalid after removing the listener 728*cdf0e10cSrcweir ::rtl::OUString aRange( rNewRange ); 729*cdf0e10cSrcweir 730*cdf0e10cSrcweir // m_rDialogModel.startControllerLockTimer(); 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir // stop listening 733*cdf0e10cSrcweir m_apRangeSelectionHelper->stopRangeListening(); 734*cdf0e10cSrcweir 735*cdf0e10cSrcweir // change edit field 736*cdf0e10cSrcweir if( m_pParentWindow ) 737*cdf0e10cSrcweir { 738*cdf0e10cSrcweir m_pParentWindow->ToTop(); 739*cdf0e10cSrcweir m_pParentWindow->GrabFocus(); 740*cdf0e10cSrcweir } 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir if( m_pCurrentRangeChoosingField ) 743*cdf0e10cSrcweir { 744*cdf0e10cSrcweir m_pCurrentRangeChoosingField->SetText( String( aRange )); 745*cdf0e10cSrcweir m_pCurrentRangeChoosingField->GrabFocus(); 746*cdf0e10cSrcweir PosValueChanged( 0 ); 747*cdf0e10cSrcweir } 748*cdf0e10cSrcweir 749*cdf0e10cSrcweir m_pCurrentRangeChoosingField = 0; 750*cdf0e10cSrcweir 751*cdf0e10cSrcweir UpdateControlStates(); 752*cdf0e10cSrcweir OSL_ASSERT( m_pParentDialog ); 753*cdf0e10cSrcweir if( m_pParentDialog ) 754*cdf0e10cSrcweir lcl_enableRangeChoosing( false, m_pParentDialog ); 755*cdf0e10cSrcweir } 756*cdf0e10cSrcweir 757*cdf0e10cSrcweir void ErrorBarResources::disposingRangeSelection() 758*cdf0e10cSrcweir { 759*cdf0e10cSrcweir OSL_ASSERT( m_apRangeSelectionHelper.get()); 760*cdf0e10cSrcweir if( m_apRangeSelectionHelper.get()) 761*cdf0e10cSrcweir m_apRangeSelectionHelper->stopRangeListening( false ); 762*cdf0e10cSrcweir } 763*cdf0e10cSrcweir 764*cdf0e10cSrcweir bool ErrorBarResources::isRangeFieldContentValid( Edit & rEdit ) 765*cdf0e10cSrcweir { 766*cdf0e10cSrcweir ::rtl::OUString aRange( rEdit.GetText()); 767*cdf0e10cSrcweir bool bIsValid = ( aRange.getLength() == 0 ) || 768*cdf0e10cSrcweir ( m_apRangeSelectionHelper.get() && 769*cdf0e10cSrcweir m_apRangeSelectionHelper->verifyCellRange( aRange )); 770*cdf0e10cSrcweir 771*cdf0e10cSrcweir if( bIsValid || !rEdit.IsEnabled()) 772*cdf0e10cSrcweir { 773*cdf0e10cSrcweir rEdit.SetControlForeground(); 774*cdf0e10cSrcweir rEdit.SetControlBackground(); 775*cdf0e10cSrcweir } 776*cdf0e10cSrcweir else 777*cdf0e10cSrcweir { 778*cdf0e10cSrcweir rEdit.SetControlBackground( RANGE_SELECTION_INVALID_RANGE_BACKGROUND_COLOR ); 779*cdf0e10cSrcweir rEdit.SetControlForeground( RANGE_SELECTION_INVALID_RANGE_FOREGROUND_COLOR ); 780*cdf0e10cSrcweir } 781*cdf0e10cSrcweir 782*cdf0e10cSrcweir return bIsValid; 783*cdf0e10cSrcweir } 784*cdf0e10cSrcweir 785*cdf0e10cSrcweir //............................................................................. 786*cdf0e10cSrcweir } //namespace chart 787*cdf0e10cSrcweir //............................................................................. 788