diff options
author | Olivier Hallot <olivier.hallot@edx.srv.br> | 2013-12-25 14:39:59 -0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-12-27 20:20:35 +0000 |
commit | acf3949da96d678239e83df5b47c2f20014ca71f (patch) | |
tree | 71e40dbe5c9d98688ee1fc3eab8a0ffae615c630 /chart2 | |
parent | 6a59fbefbfbc90d6febd43e689773f88deaf36b3 (diff) |
Convert chart error bars tab page to widget UI
Change-Id: I9f3cb1fb3186e77b5c5ee57ff3e6086022c80bfd
Note: kept old resouce to allow dialog to be called by dlg_InsertErrorBars, util we find a way to have a dialog to call a tab page and access the resources. Once a solution is found, old- resources can be deleted, RangeEdit and RangeSelectionHelper can be nuked too.
Reviewed-on: https://gerrit.libreoffice.org/7198
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/UIConfig_chart2.mk | 1 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/Strings.src | 2 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/Strings_Statistic.src | 1 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx | 6 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/res_ErrorBar.cxx | 731 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/tp_ErrorBars.cxx | 7 | ||||
-rw-r--r-- | chart2/source/controller/inc/dlg_InsertErrorBars.hxx | 4 | ||||
-rw-r--r-- | chart2/source/controller/inc/res_ErrorBar.hxx | 100 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Insert.cxx | 2 | ||||
-rw-r--r-- | chart2/uiconfig/ui/tp_ErrorBars.ui | 577 |
10 files changed, 1389 insertions, 42 deletions
diff --git a/chart2/UIConfig_chart2.mk b/chart2/UIConfig_chart2.mk index 2e3a21c127be..1385a0204b79 100644 --- a/chart2/UIConfig_chart2.mk +++ b/chart2/UIConfig_chart2.mk @@ -45,6 +45,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/schart,\ chart2/uiconfig/ui/tp_axisLabel \ chart2/uiconfig/ui/tp_AxisPositions \ chart2/uiconfig/ui/tp_DataLabel \ + chart2/uiconfig/ui/tp_ErrorBars \ chart2/uiconfig/ui/tp_LegendPosition \ chart2/uiconfig/ui/tp_PolarOptions \ chart2/uiconfig/ui/tp_SeriesToAxis \ diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src index 6904f970c0e4..c79b847c4b50 100644 --- a/chart2/source/controller/dialogs/Strings.src +++ b/chart2/source/controller/dialogs/Strings.src @@ -591,10 +591,12 @@ String STR_DATA_SELECT_RANGE_FOR_DATALABELS { Text [ en-US ] = "Select Range for data labels" ; }; +//TODO: ohallot: String inserted into tp_ErrorBars.ui String STR_DATA_SELECT_RANGE_FOR_POSITIVE_ERRORBARS { Text [ en-US ] = "Select Range for Positive Error Bars" ; }; +//TODO: ohallot: String inserted into tp_ErrorBars.ui String STR_DATA_SELECT_RANGE_FOR_NEGATIVE_ERRORBARS { Text [ en-US ] = "Select Range for Negative Error Bars" ; diff --git a/chart2/source/controller/dialogs/Strings_Statistic.src b/chart2/source/controller/dialogs/Strings_Statistic.src index 0be3a37ffcf9..ab91545e24f6 100644 --- a/chart2/source/controller/dialogs/Strings_Statistic.src +++ b/chart2/source/controller/dialogs/Strings_Statistic.src @@ -33,6 +33,7 @@ String STR_INDICATE_UP }; // used for own data in error bar dialog +//TODO: ohallot: String inserted into tp_ErrorBars.ui String STR_CONTROLTEXT_ERROR_BARS_FROM_DATA { Text [ en-US ] = "From Data Table" ; diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx index f539abe64336..bb8b513afcf0 100644 --- a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx +++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx @@ -43,18 +43,18 @@ namespace chart InsertErrorBarsDialog::InsertErrorBarsDialog( Window* pParent, const SfxItemSet& rMyAttrs, const uno::Reference< chart2::XChartDocument > & xChartDocument, - ErrorBarResources::tErrorBarType eType /* = ErrorBarResources::ERROR_BAR_Y */ ) : + oldErrorBarResources::tErrorBarType eType /* = ErrorBarResources::ERROR_BAR_Y */ ) : ModalDialog( pParent, SchResId( DLG_DATA_YERRORBAR )), rInAttrs( rMyAttrs ), aBtnOK( this, SchResId( BTN_OK )), aBtnCancel( this, SchResId( BTN_CANCEL )), aBtnHelp( this, SchResId( BTN_HELP )), - m_apErrorBarResources( new ErrorBarResources( + m_apErrorBarResources( new oldErrorBarResources( this, this, rInAttrs, /* bNoneAvailable = */ true, eType )) { FreeResource(); - ObjectType objType = eType == ErrorBarResources::ERROR_BAR_Y ? OBJECTTYPE_DATA_ERRORS_Y : OBJECTTYPE_DATA_ERRORS_X; + ObjectType objType = eType == oldErrorBarResources::ERROR_BAR_Y ? OBJECTTYPE_DATA_ERRORS_Y : OBJECTTYPE_DATA_ERRORS_X; this->SetText( ObjectNameProvider::getName_ObjectForAllSeries(objType) ); diff --git a/chart2/source/controller/dialogs/res_ErrorBar.cxx b/chart2/source/controller/dialogs/res_ErrorBar.cxx index 38da2fe96c61..e622fb903046 100644 --- a/chart2/source/controller/dialogs/res_ErrorBar.cxx +++ b/chart2/source/controller/dialogs/res_ErrorBar.cxx @@ -76,7 +76,672 @@ sal_uInt16 lcl_getLbEntryPosByErrorKind( SvxChartKindError eErrorKind ) namespace chart { -ErrorBarResources::ErrorBarResources( Window* pParent, Dialog * pParentDialog, +ErrorBarResources::ErrorBarResources( SfxTabPage* pParent, Dialog * pParentDialog, + const SfxItemSet& rInAttrs, bool bNoneAvailable, + tErrorBarType eType /* = ERROR_BAR_Y */ ) : + m_eErrorKind( CHERROR_NONE ), + m_eIndicate( CHINDICATE_BOTH ), + m_bErrorKindUnique( true ), + m_bIndicatorUnique( true ), + m_bPlusUnique( true ), + m_bMinusUnique( true ), + m_bRangePosUnique( true ), + m_bRangeNegUnique( true ), + m_bNoneAvailable( bNoneAvailable ), + m_eErrorBarType( eType ), + m_nConstDecimalDigits( 1 ), + m_nConstSpinSize( 1 ), + m_pParentWindow( pParent ), + m_pParentDialog( pParentDialog ), + m_pCurrentRangeChoosingField( 0 ), + m_bHasInternalDataProvider( true ), + m_bDisableDataTableDialog( false ) +{ + pParent->get(m_pRbNone,"RB_NONE"); + pParent->get(m_pRbConst, "RB_CONST"); + pParent->get(m_pRbPercent, "RB_PERCENT"); + pParent->get(m_pRbFunction, "RB_FUNCTION"); + pParent->get(m_pRbRange, "RB_RANGE"); + pParent->get(m_pLbFunction, "LB_FUNCTION"); + + pParent->get(m_pFlParameters, "framePARAMETERS"); + pParent->get(m_pBxPositive, "boxPOSITIVE"); + pParent->get(m_pMfPositive, "MF_POSITIVE"); + pParent->get(m_pEdRangePositive, "ED_RANGE_POSITIVE"); + pParent->get(m_pIbRangePositive, "IB_RANGE_POSITIVE"); + pParent->get(m_pBxNegative, "boxNEGATIVE"); + pParent->get(m_pMfNegative, "MF_NEGATIVE"); + pParent->get(m_pEdRangeNegative, "ED_RANGE_NEGATIVE"); + pParent->get(m_pIbRangeNegative, "IB_RANGE_NEGATIVE"); + pParent->get(m_pCbSyncPosNeg, "CB_SYN_POS_NEG"); + + pParent->get(m_pRbBoth, "RB_BOTH"); + pParent->get(m_pRbPositive, "RB_POSITIVE"); + pParent->get(m_pRbNegative, "RB_NEGATIVE"); + pParent->get(m_pFiBoth, "FI_BOTH"); + pParent->get(m_pFiPositive, "FI_POSITIVE"); + pParent->get(m_pFiNegative, "FI_NEGATIVE"); + +//TODO: ohallot: Remove these strings from .src files + pParent->get(m_pUIStringPos, "STR_DATA_SELECT_RANGE_FOR_POSITIVE_ERRORBARS"); + pParent->get(m_pUIStringNeg, "STR_DATA_SELECT_RANGE_FOR_NEGATIVE_ERRORBARS"); + pParent->get(m_pUIStringRbRange, "STR_CONTROLTEXT_ERROR_BARS_FROM_DATA"); + + if( m_bNoneAvailable ) + m_pRbNone->SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen )); + else + m_pRbNone->Hide(); + + m_pRbConst->SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen )); + m_pRbPercent->SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen )); + m_pRbFunction->SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen )); + m_pRbRange->SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen )); + m_pLbFunction->SetSelectHdl( LINK( this, ErrorBarResources, CategoryChosen )); + + m_pCbSyncPosNeg->Check( sal_False ); + m_pCbSyncPosNeg->SetToggleHdl( LINK( this, ErrorBarResources, SynchronizePosAndNeg )); + + m_pMfPositive->SetModifyHdl( LINK( this, ErrorBarResources, PosValueChanged )); + m_pEdRangePositive->SetModifyHdl( LINK( this, ErrorBarResources, RangeChanged )); + m_pEdRangeNegative->SetModifyHdl( LINK( this, ErrorBarResources, RangeChanged )); + + m_pRbPositive->SetClickHdl( LINK( this, ErrorBarResources, IndicatorChanged )); + m_pRbNegative->SetClickHdl( LINK( this, ErrorBarResources, IndicatorChanged )); + m_pRbBoth->SetClickHdl( LINK( this, ErrorBarResources, IndicatorChanged )); + + m_pIbRangePositive->SetClickHdl( LINK( this, ErrorBarResources, ChooseRange )); + m_pIbRangeNegative->SetClickHdl( LINK( this, ErrorBarResources, ChooseRange )); + + FillValueSets(); + Reset( rInAttrs ); +} + +ErrorBarResources::~ErrorBarResources() +{ +} + +void ErrorBarResources::SetErrorBarType( tErrorBarType eNewType ) +{ + if( m_eErrorBarType != eNewType ) + { + m_eErrorBarType = eNewType; + FillValueSets(); + } +} + +void ErrorBarResources::SetChartDocumentForRangeChoosing( + const uno::Reference< chart2::XChartDocument > & xChartDocument ) +{ + if( xChartDocument.is()) + { + m_bHasInternalDataProvider = xChartDocument->hasInternalDataProvider(); + uno::Reference< beans::XPropertySet > xProps( xChartDocument, uno::UNO_QUERY ); + if ( xProps.is() ) + { + try + { + xProps->getPropertyValue( "DisableDataTableDialog" ) >>= m_bDisableDataTableDialog; + } + catch( const uno::Exception& e ) + { + ASSERT_EXCEPTION( e ); + } + } + } + m_apRangeSelectionHelper.reset( new RangeSelectionHelper( xChartDocument )); + + // has internal data provider => rename "cell range" to "from data" + OSL_ASSERT( m_apRangeSelectionHelper.get()); + if( m_bHasInternalDataProvider ) + { + m_pRbRange->SetText(m_pUIStringRbRange->GetText()); + } + + if( m_pRbRange->IsChecked()) + { + isRangeFieldContentValid( *m_pEdRangePositive ); + isRangeFieldContentValid( *m_pEdRangeNegative ); + } +} + +void ErrorBarResources::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ) +{ + if( fMinorStepWidth < 0 ) + fMinorStepWidth = -fMinorStepWidth; + + sal_Int32 nExponent = static_cast< sal_Int32 >( ::rtl::math::approxFloor( log10( fMinorStepWidth ))); + if( nExponent <= 0 ) + { + // one digit precision more + m_nConstDecimalDigits = static_cast< sal_uInt16 >( (-nExponent) + 1 ); + m_nConstSpinSize = 10; + } + else + { + m_nConstDecimalDigits = 0; + m_nConstSpinSize = static_cast< sal_Int64 >( pow( 10.0, (int)nExponent )); + } +} + +void ErrorBarResources::UpdateControlStates() +{ + // function + bool bIsFunction = m_pRbFunction->IsChecked(); + m_pLbFunction->Enable( bIsFunction ); + + // range buttons + m_pRbRange->Enable( !m_bHasInternalDataProvider || !m_bDisableDataTableDialog ); + bool bShowRange = ( m_pRbRange->IsChecked()); + bool bCanChooseRange = + ( bShowRange && + m_apRangeSelectionHelper.get() && + m_apRangeSelectionHelper->hasRangeSelection()); + + m_pMfPositive->Show( ! bShowRange ); + m_pMfNegative->Show( ! bShowRange ); + + // use range but without range chooser => hide controls + m_pEdRangePositive->Show( bShowRange && ! m_bHasInternalDataProvider ); + m_pIbRangePositive->Show( bCanChooseRange ); + m_pEdRangeNegative->Show( bShowRange && ! m_bHasInternalDataProvider ); + m_pIbRangeNegative->Show( bCanChooseRange ); + + bool bShowPosNegAndSync = ! (bShowRange && m_bHasInternalDataProvider); + m_pFlParameters->Show( bShowPosNegAndSync ); + + // unit for metric fields + bool bIsErrorMargin( + ( m_pRbFunction->IsChecked()) && + ( m_pLbFunction->GetSelectEntryPos() == CHART_LB_FUNCTION_ERROR_MARGIN )); + bool bIsPercentage( m_pRbPercent->IsChecked() || bIsErrorMargin ); + OUString aCustomUnit; + + if( bIsPercentage ) + { + aCustomUnit = " %"; + m_pMfPositive->SetDecimalDigits( 1 ); + m_pMfPositive->SetSpinSize( 10 ); + m_pMfNegative->SetDecimalDigits( 1 ); + m_pMfNegative->SetSpinSize( 10 ); + } + else + { + m_pMfPositive->SetDecimalDigits( m_nConstDecimalDigits ); + m_pMfPositive->SetSpinSize( m_nConstSpinSize ); + m_pMfNegative->SetDecimalDigits( m_nConstDecimalDigits ); + m_pMfNegative->SetSpinSize( m_nConstSpinSize ); + } + m_pMfPositive->SetCustomUnitText( aCustomUnit ); + m_pMfNegative->SetCustomUnitText( aCustomUnit ); + + // positive and negative value fields + bool bPosEnabled = ( m_pRbPositive->IsChecked() || m_pRbBoth->IsChecked()); + bool bNegEnabled = ( m_pRbNegative->IsChecked() || m_pRbBoth->IsChecked()); + if( !( bPosEnabled || bNegEnabled )) + { + // all three controls are not checked -> ambiguous state + bPosEnabled = true; + bNegEnabled = true; + } + + // functions with only one parameter + bool bOneParameterCategory = + bIsErrorMargin || m_pRbPercent->IsChecked(); + if( bOneParameterCategory ) + { + m_pCbSyncPosNeg->Check(); + } + + if( m_pCbSyncPosNeg->IsChecked()) + { + bPosEnabled = true; + bNegEnabled = false; + } + + // all functions except error margin take no arguments + if( m_pRbFunction->IsChecked() && ( m_pLbFunction->GetSelectEntryPos() != CHART_LB_FUNCTION_ERROR_MARGIN )) + { + bPosEnabled = false; + bNegEnabled = false; + } + + // enable/disable pos/neg fields + m_pBxPositive->Enable( bPosEnabled ); + m_pBxNegative->Enable( bNegEnabled ); + if( bShowRange ) + { + m_pEdRangePositive->Enable( bPosEnabled ); + m_pIbRangePositive->Enable( bPosEnabled ); + m_pEdRangeNegative->Enable( bNegEnabled ); + m_pIbRangeNegative->Enable( bNegEnabled ); + } + else + { + m_pMfPositive->Enable( bPosEnabled ); + m_pMfNegative->Enable( bNegEnabled ); + } + + m_pCbSyncPosNeg->Enable( !bOneParameterCategory && ( bPosEnabled || bNegEnabled )); + + // mark invalid entries in the range fields + if( bShowRange && ! m_bHasInternalDataProvider ) + { + isRangeFieldContentValid( *m_pEdRangePositive ); + isRangeFieldContentValid( *m_pEdRangeNegative ); + } +} + +IMPL_LINK( ErrorBarResources, CategoryChosen, void *, ) +{ + m_bErrorKindUnique = true; + SvxChartKindError eOldError = m_eErrorKind; + + if( m_pRbNone->IsChecked()) + m_eErrorKind = CHERROR_NONE; + else if( m_pRbConst->IsChecked()) + m_eErrorKind = CHERROR_CONST; + else if( m_pRbPercent->IsChecked()) + m_eErrorKind = CHERROR_PERCENT; + else if( m_pRbRange->IsChecked()) + m_eErrorKind = CHERROR_RANGE; + else if( m_pRbFunction->IsChecked()) + { + if( m_pLbFunction->GetSelectEntryCount() == 1 ) + { + switch( m_pLbFunction->GetSelectEntryPos()) + { + case CHART_LB_FUNCTION_STD_ERROR: + m_eErrorKind = CHERROR_STDERROR; break; + case CHART_LB_FUNCTION_STD_DEV: + m_eErrorKind = CHERROR_SIGMA; break; + case CHART_LB_FUNCTION_VARIANCE: + m_eErrorKind = CHERROR_VARIANT; break; + case CHART_LB_FUNCTION_ERROR_MARGIN: + m_eErrorKind = CHERROR_BIGERROR; break; + default: + m_bErrorKindUnique = false; + } + } + else + m_bErrorKindUnique = false; + } + else + { + OSL_FAIL( "Unknown category chosen" ); + m_bErrorKindUnique = false; + } + + // changed to range + if( m_eErrorKind == CHERROR_RANGE && + eOldError != CHERROR_RANGE ) + { + m_pCbSyncPosNeg->Check( + (!m_pEdRangePositive->GetText().isEmpty()) && + m_pEdRangePositive->GetText() == m_pEdRangeNegative->GetText()); + } + // changed from range + else if( m_eErrorKind != CHERROR_RANGE && + eOldError == CHERROR_RANGE ) + { + m_pCbSyncPosNeg->Check( m_pMfPositive->GetValue() == m_pMfNegative->GetValue()); + } + + UpdateControlStates(); + return 0; +} + +IMPL_LINK_NOARG(ErrorBarResources, SynchronizePosAndNeg) +{ + UpdateControlStates(); + PosValueChanged( 0 ); + return 0; +} + +IMPL_LINK_NOARG(ErrorBarResources, PosValueChanged) +{ + if( m_pCbSyncPosNeg->IsChecked()) + { + if( m_pRbRange->IsChecked()) + { + m_pEdRangeNegative->SetText( m_pEdRangePositive->GetText()); + m_bRangeNegUnique = m_bRangePosUnique; + } + else + m_pMfNegative->SetValue( m_pMfPositive->GetValue()); + } + + return 0; +} + +IMPL_LINK_NOARG(ErrorBarResources, IndicatorChanged) +{ + m_bIndicatorUnique = true; + if( m_pRbBoth->IsChecked()) + m_eIndicate = CHINDICATE_BOTH; + else if( m_pRbPositive->IsChecked()) + m_eIndicate = CHINDICATE_UP; + else if( m_pRbNegative->IsChecked()) + m_eIndicate = CHINDICATE_DOWN; + else + m_bIndicatorUnique = false; + + UpdateControlStates(); + return 0; +} + +IMPL_LINK( ErrorBarResources, ChooseRange, RangeSelectionButton *, pButton ) +{ + OSL_ASSERT( m_apRangeSelectionHelper.get()); + if( ! m_apRangeSelectionHelper.get()) + return 0; + OSL_ASSERT( m_pCurrentRangeChoosingField == 0 ); + + OUString aUIString; + + if( pButton == m_pIbRangePositive ) + { + m_pCurrentRangeChoosingField = m_pEdRangePositive; + aUIString = m_pUIStringPos->GetText(); + } + else + { + m_pCurrentRangeChoosingField = m_pEdRangeNegative; + aUIString = m_pUIStringNeg->GetText(); + } + + assert( m_pParentDialog ); + if( m_pParentDialog ) + { + lcl_enableRangeChoosing( true, m_pParentDialog ); + m_apRangeSelectionHelper->chooseRange( + m_pCurrentRangeChoosingField->GetText(), + aUIString, *this ); + } + else + m_pCurrentRangeChoosingField = 0; + + return 0; +} + +IMPL_LINK( ErrorBarResources, RangeChanged, Edit *, pEdit ) +{ + if( pEdit == m_pEdRangePositive ) + { + m_bRangePosUnique = true; + PosValueChanged( 0 ); + } + else + { + m_bRangeNegUnique = true; + } + + isRangeFieldContentValid( *pEdit ); + + return 0; +} + +void ErrorBarResources::Reset(const SfxItemSet& rInAttrs) +{ + const SfxPoolItem *pPoolItem = NULL; + SfxItemState aState = SFX_ITEM_UNKNOWN; + + // category + m_eErrorKind = CHERROR_NONE; + aState = rInAttrs.GetItemState( SCHATTR_STAT_KIND_ERROR, sal_True, &pPoolItem ); + m_bErrorKindUnique = ( aState != SFX_ITEM_DONTCARE ); + + if( aState == SFX_ITEM_SET ) + m_eErrorKind = ((const SvxChartKindErrorItem*) pPoolItem)->GetValue(); + + m_pLbFunction->SelectEntryPos( lcl_getLbEntryPosByErrorKind( m_eErrorKind )); + + if( m_bErrorKindUnique ) + { + switch( m_eErrorKind ) + { + case CHERROR_NONE: + m_pRbNone->Check(); + break; + case CHERROR_PERCENT: + m_pRbPercent->Check(); + break; + case CHERROR_CONST: + m_pRbConst->Check(); + break; + case CHERROR_STDERROR: + case CHERROR_VARIANT: + case CHERROR_SIGMA: + case CHERROR_BIGERROR: + m_pRbFunction->Check(); + break; + case CHERROR_RANGE: + m_pRbRange->Check(); + break; + } + } + else + { + m_pRbNone->Check( sal_False ); + m_pRbConst->Check( sal_False ); + m_pRbPercent->Check( sal_False ); + m_pRbFunction->Check( sal_False ); + } + + // parameters + aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTPLUS, sal_True, &pPoolItem ); + m_bPlusUnique = ( aState != SFX_ITEM_DONTCARE ); + double fPlusValue = 0.0; + if( aState == SFX_ITEM_SET ) + { + fPlusValue = ((const SvxDoubleItem*) pPoolItem)->GetValue(); + sal_Int32 nPlusValue = static_cast< sal_Int32 >( fPlusValue * pow(10.0,m_pMfPositive->GetDecimalDigits()) ); + m_pMfPositive->SetValue( nPlusValue ); + } + + aState = rInAttrs.GetItemState( SCHATTR_STAT_CONSTMINUS, sal_True, &pPoolItem ); + m_bMinusUnique = ( aState != SFX_ITEM_DONTCARE ); + if( aState == SFX_ITEM_SET ) + { + double fMinusValue = ((const SvxDoubleItem*) pPoolItem)->GetValue(); + sal_Int32 nMinusValue = static_cast< sal_Int32 >( fMinusValue * pow(10.0,m_pMfNegative->GetDecimalDigits()) ); + m_pMfNegative->SetValue( nMinusValue ); + + if( m_eErrorKind != CHERROR_RANGE && + fPlusValue == fMinusValue ) + m_pCbSyncPosNeg->Check(); + } + + // indicator + aState = rInAttrs.GetItemState( SCHATTR_STAT_INDICATE, sal_True, &pPoolItem ); + m_bIndicatorUnique = ( aState != SFX_ITEM_DONTCARE ); + if( aState == SFX_ITEM_SET) + m_eIndicate = ((const SvxChartIndicateItem * ) pPoolItem)->GetValue(); + + if( m_bIndicatorUnique ) + { + switch( m_eIndicate ) + { + case CHINDICATE_NONE : + // no longer used, use both as default + m_eIndicate = CHINDICATE_BOTH; + // fall-through intended to BOTH + case CHINDICATE_BOTH : + m_pRbBoth->Check(); break; + case CHINDICATE_UP : + m_pRbPositive->Check(); break; + case CHINDICATE_DOWN : + m_pRbNegative->Check(); break; + } + } + else + { + m_pRbBoth->Check( sal_False ); + m_pRbPositive->Check( sal_False ); + m_pRbNegative->Check( sal_False ); + } + + // ranges + aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_POS, sal_True, &pPoolItem ); + m_bRangePosUnique = ( aState != SFX_ITEM_DONTCARE ); + if( aState == SFX_ITEM_SET ) + { + OUString sRangePositive = (static_cast< const SfxStringItem * >( pPoolItem ))->GetValue(); + m_pEdRangePositive->SetText( sRangePositive ); + } + + aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_NEG, sal_True, &pPoolItem ); + m_bRangeNegUnique = ( aState != SFX_ITEM_DONTCARE ); + if( aState == SFX_ITEM_SET ) + { + OUString sRangeNegative = (static_cast< const SfxStringItem * >( pPoolItem ))->GetValue(); + m_pEdRangeNegative->SetText( sRangeNegative ); + if( m_eErrorKind == CHERROR_RANGE && + !sRangeNegative.isEmpty() && + sRangeNegative == m_pEdRangePositive->GetText() ) + m_pCbSyncPosNeg->Check(); + } + + UpdateControlStates(); +} + +sal_Bool ErrorBarResources::FillItemSet(SfxItemSet& rOutAttrs) const +{ + if( m_bErrorKindUnique ) + rOutAttrs.Put( SvxChartKindErrorItem( m_eErrorKind, SCHATTR_STAT_KIND_ERROR )); + if( m_bIndicatorUnique ) + rOutAttrs.Put( SvxChartIndicateItem( m_eIndicate, SCHATTR_STAT_INDICATE )); + + if( m_bErrorKindUnique ) + { + if( m_eErrorKind == CHERROR_RANGE ) + { + OUString aPosRange; + OUString aNegRange; + if( m_bHasInternalDataProvider ) + { + // the strings aPosRange/aNegRange have to be set to a non-empty + // arbitrary string to generate error-bar sequences + aPosRange = "x"; + aNegRange = aPosRange; + } + else + { + aPosRange = m_pEdRangePositive->GetText(); + if( m_pCbSyncPosNeg->IsChecked()) + aNegRange = aPosRange; + else + aNegRange = m_pEdRangeNegative->GetText(); + } + + if( m_bRangePosUnique ) + rOutAttrs.Put( SfxStringItem( SCHATTR_STAT_RANGE_POS, aPosRange )); + if( m_bRangeNegUnique ) + rOutAttrs.Put( SfxStringItem( SCHATTR_STAT_RANGE_NEG, aNegRange )); + } + else if( m_eErrorKind == CHERROR_CONST || + m_eErrorKind == CHERROR_PERCENT || + m_eErrorKind == CHERROR_BIGERROR ) + { + double fPosValue = static_cast< double >( m_pMfPositive->GetValue()) / + pow( 10.0, m_pMfPositive->GetDecimalDigits()); + double fNegValue = 0.0; + + if( m_pCbSyncPosNeg->IsChecked()) + fNegValue = fPosValue; + else + fNegValue = static_cast< double >( m_pMfNegative->GetValue()) / + pow( 10.0, m_pMfNegative->GetDecimalDigits()); + + rOutAttrs.Put( SvxDoubleItem( fPosValue, SCHATTR_STAT_CONSTPLUS )); + rOutAttrs.Put( SvxDoubleItem( fNegValue, SCHATTR_STAT_CONSTMINUS )); + } + } + + rOutAttrs.Put( SfxBoolItem( SCHATTR_STAT_ERRORBAR_TYPE , m_eErrorBarType == ERROR_BAR_Y )); + + return sal_True; +} + +void ErrorBarResources::FillValueSets() +{ + if( m_eErrorBarType == ERROR_BAR_Y ) + { + m_pFiNegative->SetImage( Image( SchResId( BMP_INDICATE_DOWN ) ) ); + m_pFiPositive->SetImage( Image( SchResId( BMP_INDICATE_UP ) ) ); + m_pFiBoth->SetImage( Image( SchResId( BMP_INDICATE_BOTH_VERTI ) ) ); + } + else if( m_eErrorBarType == ERROR_BAR_X ) + { + m_pFiNegative->SetImage( Image( SchResId( BMP_INDICATE_LEFT ) ) ); + m_pFiPositive->SetImage( Image( SchResId( BMP_INDICATE_RIGHT ) ) ); + m_pFiBoth->SetImage( Image( SchResId( BMP_INDICATE_BOTH_HORI ) ) ); + } +} + +void ErrorBarResources::listeningFinished( + const OUString & rNewRange ) +{ + OSL_ASSERT( m_apRangeSelectionHelper.get()); + if( ! m_apRangeSelectionHelper.get()) + return; + + // rNewRange becomes invalid after removing the listener + OUString aRange( rNewRange ); + + // stop listening + m_apRangeSelectionHelper->stopRangeListening(); + + // change edit field + if( m_pParentWindow ) + { + m_pParentWindow->ToTop(); + m_pParentWindow->GrabFocus(); + } + + if( m_pCurrentRangeChoosingField ) + { + m_pCurrentRangeChoosingField->SetText( aRange ); + m_pCurrentRangeChoosingField->GrabFocus(); + PosValueChanged( 0 ); + } + + m_pCurrentRangeChoosingField = 0; + + UpdateControlStates(); + OSL_ASSERT( m_pParentDialog ); + if( m_pParentDialog ) + lcl_enableRangeChoosing( false, m_pParentDialog ); +} + +void ErrorBarResources::disposingRangeSelection() +{ + OSL_ASSERT( m_apRangeSelectionHelper.get()); + if( m_apRangeSelectionHelper.get()) + m_apRangeSelectionHelper->stopRangeListening( false ); +} + +bool ErrorBarResources::isRangeFieldContentValid( Edit & rEdit ) +{ + OUString aRange( rEdit.GetText()); + bool bIsValid = ( aRange.isEmpty() ) || + ( m_apRangeSelectionHelper.get() && + m_apRangeSelectionHelper->verifyCellRange( aRange )); + + if( bIsValid || !rEdit.IsEnabled()) + { + rEdit.SetControlForeground(); + rEdit.SetControlBackground(); + } + else + { + rEdit.SetControlBackground( RANGE_SELECTION_INVALID_RANGE_BACKGROUND_COLOR ); + rEdit.SetControlForeground( RANGE_SELECTION_INVALID_RANGE_FOREGROUND_COLOR ); + } + + return bIsValid; +} + +oldErrorBarResources::oldErrorBarResources( Window* pParent, Dialog * pParentDialog, const SfxItemSet& rInAttrs, bool bNoneAvailable, tErrorBarType eType /* = ERROR_BAR_Y */ ) : @@ -126,29 +791,29 @@ ErrorBarResources::ErrorBarResources( Window* pParent, Dialog * pParentDialog, m_bDisableDataTableDialog( false ) { if( m_bNoneAvailable ) - m_aRbNone.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen )); + m_aRbNone.SetClickHdl( LINK( this, oldErrorBarResources, CategoryChosen )); else m_aRbNone.Hide(); - m_aRbConst.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen )); - m_aRbPercent.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen )); - m_aRbFunction.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen )); - m_aRbRange.SetClickHdl( LINK( this, ErrorBarResources, CategoryChosen )); - m_aLbFunction.SetSelectHdl( LINK( this, ErrorBarResources, CategoryChosen )); + m_aRbConst.SetClickHdl( LINK( this, oldErrorBarResources, CategoryChosen )); + m_aRbPercent.SetClickHdl( LINK( this, oldErrorBarResources, CategoryChosen )); + m_aRbFunction.SetClickHdl( LINK( this, oldErrorBarResources, CategoryChosen )); + m_aRbRange.SetClickHdl( LINK( this, oldErrorBarResources, CategoryChosen )); + m_aLbFunction.SetSelectHdl( LINK( this, oldErrorBarResources, CategoryChosen )); m_aCbSyncPosNeg.Check( sal_False ); - m_aCbSyncPosNeg.SetToggleHdl( LINK( this, ErrorBarResources, SynchronizePosAndNeg )); + m_aCbSyncPosNeg.SetToggleHdl( LINK( this, oldErrorBarResources, SynchronizePosAndNeg )); - m_aMfPositive.SetModifyHdl( LINK( this, ErrorBarResources, PosValueChanged )); - m_aEdRangePositive.SetModifyHdl( LINK( this, ErrorBarResources, RangeChanged )); - m_aEdRangeNegative.SetModifyHdl( LINK( this, ErrorBarResources, RangeChanged )); + m_aMfPositive.SetModifyHdl( LINK( this, oldErrorBarResources, PosValueChanged )); + m_aEdRangePositive.SetModifyHdl( LINK( this, oldErrorBarResources, RangeChanged )); + m_aEdRangeNegative.SetModifyHdl( LINK( this, oldErrorBarResources, RangeChanged )); - m_aRbPositive.SetClickHdl( LINK( this, ErrorBarResources, IndicatorChanged )); - m_aRbNegative.SetClickHdl( LINK( this, ErrorBarResources, IndicatorChanged )); - m_aRbBoth.SetClickHdl( LINK( this, ErrorBarResources, IndicatorChanged )); + m_aRbPositive.SetClickHdl( LINK( this, oldErrorBarResources, IndicatorChanged )); + m_aRbNegative.SetClickHdl( LINK( this, oldErrorBarResources, IndicatorChanged )); + m_aRbBoth.SetClickHdl( LINK( this, oldErrorBarResources, IndicatorChanged )); - m_aIbRangePositive.SetClickHdl( LINK( this, ErrorBarResources, ChooseRange )); - m_aIbRangeNegative.SetClickHdl( LINK( this, ErrorBarResources, ChooseRange )); + m_aIbRangePositive.SetClickHdl( LINK( this, oldErrorBarResources, ChooseRange )); + m_aIbRangeNegative.SetClickHdl( LINK( this, oldErrorBarResources, ChooseRange )); m_aIbRangePositive.SetQuickHelpText(SCH_RESSTR(STR_TIP_SELECT_RANGE)); m_aIbRangeNegative.SetQuickHelpText(SCH_RESSTR(STR_TIP_SELECT_RANGE)); @@ -156,11 +821,11 @@ ErrorBarResources::ErrorBarResources( Window* pParent, Dialog * pParentDialog, Reset( rInAttrs ); } -ErrorBarResources::~ErrorBarResources() +oldErrorBarResources::~oldErrorBarResources() { } -void ErrorBarResources::SetErrorBarType( tErrorBarType eNewType ) +void oldErrorBarResources::SetErrorBarType( tErrorBarType eNewType ) { if( m_eErrorBarType != eNewType ) { @@ -169,7 +834,7 @@ void ErrorBarResources::SetErrorBarType( tErrorBarType eNewType ) } } -void ErrorBarResources::SetChartDocumentForRangeChoosing( +void oldErrorBarResources::SetChartDocumentForRangeChoosing( const uno::Reference< chart2::XChartDocument > & xChartDocument ) { if( xChartDocument.is()) @@ -204,7 +869,7 @@ void ErrorBarResources::SetChartDocumentForRangeChoosing( } } -void ErrorBarResources::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ) +void oldErrorBarResources::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ) { if( fMinorStepWidth < 0 ) fMinorStepWidth = -fMinorStepWidth; @@ -223,7 +888,7 @@ void ErrorBarResources::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorS } } -void ErrorBarResources::UpdateControlStates() +void oldErrorBarResources::UpdateControlStates() { // function bool bIsFunction = m_aRbFunction.IsChecked(); @@ -337,7 +1002,7 @@ void ErrorBarResources::UpdateControlStates() } } -IMPL_LINK( ErrorBarResources, CategoryChosen, void *, ) +IMPL_LINK( oldErrorBarResources, CategoryChosen, void *, ) { m_bErrorKindUnique = true; SvxChartKindError eOldError = m_eErrorKind; @@ -397,14 +1062,14 @@ IMPL_LINK( ErrorBarResources, CategoryChosen, void *, ) return 0; } -IMPL_LINK_NOARG(ErrorBarResources, SynchronizePosAndNeg) +IMPL_LINK_NOARG(oldErrorBarResources, SynchronizePosAndNeg) { UpdateControlStates(); PosValueChanged( 0 ); return 0; } -IMPL_LINK_NOARG(ErrorBarResources, PosValueChanged) +IMPL_LINK_NOARG(oldErrorBarResources, PosValueChanged) { if( m_aCbSyncPosNeg.IsChecked()) { @@ -420,7 +1085,7 @@ IMPL_LINK_NOARG(ErrorBarResources, PosValueChanged) return 0; } -IMPL_LINK_NOARG(ErrorBarResources, IndicatorChanged) +IMPL_LINK_NOARG(oldErrorBarResources, IndicatorChanged) { m_bIndicatorUnique = true; if( m_aRbBoth.IsChecked()) @@ -436,7 +1101,7 @@ IMPL_LINK_NOARG(ErrorBarResources, IndicatorChanged) return 0; } -IMPL_LINK( ErrorBarResources, ChooseRange, RangeSelectionButton *, pButton ) +IMPL_LINK( oldErrorBarResources, ChooseRange, RangeSelectionButton *, pButton ) { OSL_ASSERT( m_apRangeSelectionHelper.get()); if( ! m_apRangeSelectionHelper.get()) @@ -469,7 +1134,7 @@ IMPL_LINK( ErrorBarResources, ChooseRange, RangeSelectionButton *, pButton ) return 0; } -IMPL_LINK( ErrorBarResources, RangeChanged, Edit *, pEdit ) +IMPL_LINK( oldErrorBarResources, RangeChanged, Edit *, pEdit ) { if( pEdit == & m_aEdRangePositive ) { @@ -486,7 +1151,7 @@ IMPL_LINK( ErrorBarResources, RangeChanged, Edit *, pEdit ) return 0; } -void ErrorBarResources::Reset(const SfxItemSet& rInAttrs) +void oldErrorBarResources::Reset(const SfxItemSet& rInAttrs) { const SfxPoolItem *pPoolItem = NULL; SfxItemState aState = SFX_ITEM_UNKNOWN; @@ -610,7 +1275,7 @@ void ErrorBarResources::Reset(const SfxItemSet& rInAttrs) UpdateControlStates(); } -sal_Bool ErrorBarResources::FillItemSet(SfxItemSet& rOutAttrs) const +sal_Bool oldErrorBarResources::FillItemSet(SfxItemSet& rOutAttrs) const { if( m_bErrorKindUnique ) rOutAttrs.Put( SvxChartKindErrorItem( m_eErrorKind, SCHATTR_STAT_KIND_ERROR )); @@ -668,7 +1333,7 @@ sal_Bool ErrorBarResources::FillItemSet(SfxItemSet& rOutAttrs) const return sal_True; } -void ErrorBarResources::FillValueSets() +void oldErrorBarResources::FillValueSets() { if( m_eErrorBarType == ERROR_BAR_Y ) { @@ -684,7 +1349,7 @@ void ErrorBarResources::FillValueSets() } } -void ErrorBarResources::listeningFinished( +void oldErrorBarResources::listeningFinished( const OUString & rNewRange ) { OSL_ASSERT( m_apRangeSelectionHelper.get()); @@ -719,14 +1384,14 @@ void ErrorBarResources::listeningFinished( lcl_enableRangeChoosing( false, m_pParentDialog ); } -void ErrorBarResources::disposingRangeSelection() +void oldErrorBarResources::disposingRangeSelection() { OSL_ASSERT( m_apRangeSelectionHelper.get()); if( m_apRangeSelectionHelper.get()) m_apRangeSelectionHelper->stopRangeListening( false ); } -bool ErrorBarResources::isRangeFieldContentValid( Edit & rEdit ) +bool oldErrorBarResources::isRangeFieldContentValid( Edit & rEdit ) { OUString aRange( rEdit.GetText()); bool bIsValid = ( aRange.isEmpty() ) || diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.cxx b/chart2/source/controller/dialogs/tp_ErrorBars.cxx index 5bc51e61d8f7..995babd2887f 100644 --- a/chart2/source/controller/dialogs/tp_ErrorBars.cxx +++ b/chart2/source/controller/dialogs/tp_ErrorBars.cxx @@ -28,14 +28,17 @@ namespace chart { ErrorBarsTabPage::ErrorBarsTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : - SfxTabPage( pParent, SchResId( TP_YERRORBAR ), rInAttrs ), + SfxTabPage( pParent + ,"tp_ErrorBars" + ,"modules/schart/ui/tp_ErrorBars.ui" + , rInAttrs ), m_aErrorBarResources( this, // the parent is the tab control, of which the parent is the dialog pParent->GetParentDialog(), rInAttrs, /* bNoneAvailable = */ false ) { - FreeResource(); +// FreeResource(); } ErrorBarsTabPage::~ErrorBarsTabPage() diff --git a/chart2/source/controller/inc/dlg_InsertErrorBars.hxx b/chart2/source/controller/inc/dlg_InsertErrorBars.hxx index dd693a7aa072..862b27919079 100644 --- a/chart2/source/controller/inc/dlg_InsertErrorBars.hxx +++ b/chart2/source/controller/inc/dlg_InsertErrorBars.hxx @@ -36,7 +36,7 @@ public: InsertErrorBarsDialog( Window* pParent, const SfxItemSet& rMyAttrs, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > & xChartDocument, - ErrorBarResources::tErrorBarType eType ); + oldErrorBarResources::tErrorBarType eType ); virtual ~InsertErrorBarsDialog(); void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ); @@ -58,7 +58,7 @@ private: CancelButton aBtnCancel; HelpButton aBtnHelp; - ::std::auto_ptr< ErrorBarResources > m_apErrorBarResources; + boost::scoped_ptr< oldErrorBarResources > m_apErrorBarResources; }; } //namespace chart diff --git a/chart2/source/controller/inc/res_ErrorBar.hxx b/chart2/source/controller/inc/res_ErrorBar.hxx index 51033432e196..c568560ebde6 100644 --- a/chart2/source/controller/inc/res_ErrorBar.hxx +++ b/chart2/source/controller/inc/res_ErrorBar.hxx @@ -20,6 +20,8 @@ #define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_ERRORBAR_HXX #include <vcl/button.hxx> +// #include <vcl/dialog.hxx> +#include <sfx2/tabdlg.hxx> #include <vcl/fixed.hxx> #include <vcl/field.hxx> #include <vcl/lstbox.hxx> @@ -51,10 +53,106 @@ public: }; ErrorBarResources( + SfxTabPage* pParent, Dialog* pParentDialog, const SfxItemSet& rInAttrs, bool bNoneAvailable, chart::ErrorBarResources::tErrorBarType eType = ERROR_BAR_Y ); + virtual ~ErrorBarResources(); + + void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ); + void SetErrorBarType( tErrorBarType eNewType ); + void SetChartDocumentForRangeChoosing( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xChartDocument ); + void Reset(const SfxItemSet& rInAttrs); + sal_Bool FillItemSet(SfxItemSet& rOutAttrs) const; + + void FillValueSets(); + + // ____ RangeSelectionListenerParent ____ + virtual void listeningFinished( const OUString & rNewRange ); + virtual void disposingRangeSelection(); + +private: + // category +// FixedLine m_pFlErrorCategory; + RadioButton* m_pRbNone; + RadioButton* m_pRbConst; + RadioButton* m_pRbPercent; + RadioButton* m_pRbFunction; + RadioButton* m_pRbRange; + ListBox* m_pLbFunction; + + // parameters + VclFrame* m_pFlParameters; + VclBox* m_pBxPositive; + MetricField* m_pMfPositive; + Edit* m_pEdRangePositive; + PushButton* m_pIbRangePositive; + VclBox* m_pBxNegative; + MetricField* m_pMfNegative; + Edit* m_pEdRangeNegative; + PushButton* m_pIbRangeNegative; + CheckBox* m_pCbSyncPosNeg; + + // indicator +// FixedLine* m_pFlIndicate; + RadioButton* m_pRbBoth; + RadioButton* m_pRbPositive; + RadioButton* m_pRbNegative; + FixedImage* m_pFiBoth; + FixedImage* m_pFiPositive; + FixedImage* m_pFiNegative; + + FixedText* m_pUIStringPos; + FixedText* m_pUIStringNeg; + FixedText* m_pUIStringRbRange; + + SvxChartKindError m_eErrorKind; + SvxChartIndicate m_eIndicate; + + bool m_bErrorKindUnique; + bool m_bIndicatorUnique; + bool m_bPlusUnique; + bool m_bMinusUnique; + bool m_bRangePosUnique; + bool m_bRangeNegUnique; + + bool m_bNoneAvailable; + + tErrorBarType m_eErrorBarType; + sal_uInt16 m_nConstDecimalDigits; + sal_Int64 m_nConstSpinSize; + + SfxTabPage* m_pParentWindow; + Dialog * m_pParentDialog; + boost::scoped_ptr< RangeSelectionHelper > m_apRangeSelectionHelper; + Edit * m_pCurrentRangeChoosingField; + bool m_bHasInternalDataProvider; + bool m_bDisableDataTableDialog; + + DECL_LINK( CategoryChosen, void * ); + DECL_LINK( SynchronizePosAndNeg, void * ); + DECL_LINK( PosValueChanged, void * ); + DECL_LINK( IndicatorChanged, void * ); + DECL_LINK( ChooseRange, RangeSelectionButton * ); + DECL_LINK( RangeChanged, Edit * ); + + void UpdateControlStates(); + bool isRangeFieldContentValid( Edit & rEdit ); +}; + +class oldErrorBarResources : public RangeSelectionListenerParent +{ +public: + enum tErrorBarType + { + ERROR_BAR_X, + ERROR_BAR_Y + }; + + oldErrorBarResources( Window* pParent, Dialog * pParentDialog, const SfxItemSet& rInAttrst, bool bNoneAvailable, tErrorBarType eType = ERROR_BAR_Y ); - virtual ~ErrorBarResources(); + virtual ~oldErrorBarResources(); void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ); void SetErrorBarType( tErrorBarType eNewType ); diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx index 034b32678e94..db3aa6d80507 100644 --- a/chart2/source/controller/main/ChartController_Insert.cxx +++ b/chart2/source/controller/main/ChartController_Insert.cxx @@ -496,7 +496,7 @@ void ChartController::executeDispatch_InsertErrorBars( bool bYError ) InsertErrorBarsDialog aDlg( m_pChartWindow, aItemSet, uno::Reference< chart2::XChartDocument >( getModel(), uno::UNO_QUERY ), - bYError ? ErrorBarResources::ERROR_BAR_Y : ErrorBarResources::ERROR_BAR_X); + bYError ? oldErrorBarResources::ERROR_BAR_Y : oldErrorBarResources::ERROR_BAR_X); aDlg.SetAxisMinorStepWidthForErrorBarDecimals( InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getModel(), m_xChartView, OUString() ) ); diff --git a/chart2/uiconfig/ui/tp_ErrorBars.ui b/chart2/uiconfig/ui/tp_ErrorBars.ui new file mode 100644 index 000000000000..ab8424289b93 --- /dev/null +++ b/chart2/uiconfig/ui/tp_ErrorBars.ui @@ -0,0 +1,577 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkAdjustment" id="adjustmentPOS_NEG"> + <property name="upper">100</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkImage" id="imageRANGE_SELECT_POSITIVE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">formula/res/refinp1.png</property> + </object> + <object class="GtkImage" id="imageRANGE_SELECT_NEG"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="pixbuf">formula/res/refinp1.png</property> + </object> + <object class="GtkListStore" id="liststoreFUNCTION"> + <columns> + <!-- column-name gchararray1 --> + <column type="gchararray"/> + <!-- column-name guint1 --> + <column type="guint"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">Standard Error</col> + <col id="1">0</col> + </row> + <row> + <col id="0" translatable="yes">Standard Deviation</col> + <col id="1">1</col> + </row> + <row> + <col id="0" translatable="yes">Variance</col> + <col id="1">2</col> + </row> + <row> + <col id="0" translatable="yes">Error Margin</col> + <col id="1">3</col> + </row> + </data> + </object> + <object class="GtkBox" id="tp_ErrorBars"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <property name="homogeneous">True</property> + <child> + <object class="GtkFrame" id="FL_ERROR"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkRadioButton" id="RB_NONE"> + <property name="label" translatable="yes">_None</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <property name="group">RB_CONST</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="RB_CONST"> + <property name="label" translatable="yes">_Constant Value</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <property name="group">RB_PERCENT</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="RB_PERCENT"> + <property name="label" translatable="yes">_Percentage</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <property name="group">RB_FUNCTION</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkRadioButton" id="RB_FUNCTION"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <property name="group">RB_RANGE</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="LB_FUNCTION"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="model">liststoreFUNCTION</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="RB_RANGE"> + <property name="label" translatable="yes">Cell _Range</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <property name="group">RB_NONE</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Error Category</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkRadioButton" id="RB_BOTH"> + <property name="label" translatable="yes">Positive _and Negative</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <property name="group">RB_POSITIVE</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="RB_POSITIVE"> + <property name="label" translatable="yes">Pos_itive</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <property name="group">RB_NEGATIVE</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="RB_NEGATIVE"> + <property name="label" translatable="yes">Ne_gative</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <property name="group">RB_BOTH</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkImage" id="FI_BOTH"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-missing-image</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkImage" id="FI_POSITIVE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-missing-image</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + <child> + <object class="GtkImage" id="FI_NEGATIVE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="stock">gtk-missing-image</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Error Indicator</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="framePARAMETERS"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkBox" id="boxPOSITIVE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="FT_POSITIVE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">P_ositive (+)</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">MF_POSITIVE:0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="MF_POSITIVE:0"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="invisible_char">•</property> + <property name="digits">2</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="ED_RANGE_POSITIVE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="invisible_char">•</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="IB_RANGE_POSITIVE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">True</property> + <property name="image">imageRANGE_SELECT_POSITIVE</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="boxNEGATIVE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="FT_NEGATIVE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Negative (-)</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">MF_NEGATIVE:0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="MF_NEGATIVE:0"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="invisible_char">•</property> + <property name="digits">2</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="ED_RANGE_NEGATIVE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="invisible_char">•</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkButton" id="IB_RANGE_NEGATIVE"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes">Select data range</property> + <property name="image">imageRANGE_SELECT_NEG</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="CB_SYN_POS_NEG"> + <property name="label" translatable="yes">Same value for both</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Parameters</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="STR_DATA_SELECT_RANGE_FOR_POSITIVE_ERRORBARS"> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Select Range for Positive Error Bars</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="STR_DATA_SELECT_RANGE_FOR_NEGATIVE_ERRORBARS"> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Select Range for Negative Error Bars</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="STR_CONTROLTEXT_ERROR_BARS_FROM_DATA"> + <property name="can_focus">False</property> + <property name="label" translatable="yes">From Data Table</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">4</property> + </packing> + </child> + </object> + <object class="GtkSizeGroup" id="sizegroup1"> + <widgets> + <widget name="FT_POSITIVE"/> + <widget name="FT_NEGATIVE"/> + </widgets> + </object> +</interface> |