21#include <bitmaps.hlst>
28#include <rtl/math.hxx>
30#include <osl/diagnose.h>
33#define CHART_LB_FUNCTION_STD_ERROR 0
34#define CHART_LB_FUNCTION_STD_DEV 1
35#define CHART_LB_FUNCTION_VARIANCE 2
36#define CHART_LB_FUNCTION_ERROR_MARGIN 3
51 sal_uInt16 nResult = 0;
55 case SvxChartKindError::NONE:
56 case SvxChartKindError::Percent:
57 case SvxChartKindError::Const:
58 case SvxChartKindError::Range:
61 case SvxChartKindError::Variant:
64 case SvxChartKindError::Sigma:
67 case SvxChartKindError::BigError:
70 case SvxChartKindError::StdError:
82 const SfxItemSet& rInAttrs,
bool bNoneAvailable,
86 , m_bErrorKindUnique( true )
87 , m_bIndicatorUnique( true )
88 , m_bRangePosUnique( true )
89 , m_bRangeNegUnique( true )
90 , m_eErrorBarType(
eType )
91 , m_nConstDecimalDigits( 1 )
92 , m_nConstSpinSize( 1 )
95 , m_pController(pController)
96 , m_pCurrentRangeChoosingField( nullptr )
97 , m_bHasInternalDataProvider( true )
98 , m_bEnableDataTableDialog( true )
99 , m_xRbNone(pParent->weld_radio_button(
"RB_NONE"))
100 , m_xRbConst(pParent->weld_radio_button(
"RB_CONST"))
101 , m_xRbPercent(pParent->weld_radio_button(
"RB_PERCENT"))
102 , m_xRbFunction(pParent->weld_radio_button(
"RB_FUNCTION"))
103 , m_xRbRange(pParent->weld_radio_button(
"RB_RANGE"))
104 , m_xLbFunction(pParent->weld_combo_box(
"LB_FUNCTION"))
105 , m_xFlParameters(pParent->weld_frame(
"framePARAMETERS"))
106 , m_xBxPositive(pParent->weld_widget(
"boxPOSITIVE"))
107 , m_xMfPositive(pParent->weld_metric_spin_button(
"MF_POSITIVE",
FieldUnit::
NONE))
108 , m_xEdRangePositive(pParent->weld_entry(
"ED_RANGE_POSITIVE"))
109 , m_xIbRangePositive(pParent->weld_button(
"IB_RANGE_POSITIVE"))
110 , m_xBxNegative(pParent->weld_widget(
"boxNEGATIVE"))
111 , m_xMfNegative(pParent->weld_metric_spin_button(
"MF_NEGATIVE",
FieldUnit::
NONE))
112 , m_xEdRangeNegative(pParent->weld_entry(
"ED_RANGE_NEGATIVE"))
113 , m_xIbRangeNegative(pParent->weld_button(
"IB_RANGE_NEGATIVE"))
114 , m_xCbSyncPosNeg(pParent->weld_check_button(
"CB_SYN_POS_NEG"))
115 , m_xRbBoth(pParent->weld_radio_button(
"RB_BOTH"))
116 , m_xRbPositive(pParent->weld_radio_button(
"RB_POSITIVE"))
117 , m_xRbNegative(pParent->weld_radio_button(
"RB_NEGATIVE"))
118 , m_xFiBoth(pParent->weld_image(
"FI_BOTH"))
119 , m_xFiPositive(pParent->weld_image(
"FI_POSITIVE"))
120 , m_xFiNegative(pParent->weld_image(
"FI_NEGATIVE"))
121 , m_xUIStringPos(pParent->weld_label(
"STR_DATA_SELECT_RANGE_FOR_POSITIVE_ERRORBARS"))
122 , m_xUIStringNeg(pParent->weld_label(
"STR_DATA_SELECT_RANGE_FOR_NEGATIVE_ERRORBARS"))
123 , m_xUIStringRbRange(pParent->weld_label(
"STR_CONTROLTEXT_ERROR_BARS_FROM_DATA"))
170 if( xChartDocument.is())
180 catch(
const uno::Exception& )
205 if( fMinorStepWidth < 0 )
206 fMinorStepWidth = -fMinorStepWidth;
208 sal_Int32 nExponent =
static_cast< sal_Int32
>( ::rtl::math::approxFloor( log10( fMinorStepWidth )));
218 m_nConstSpinSize =
static_cast< sal_Int64
>( pow( 10.0,
static_cast<int>(nExponent) ));
231 bool bCanChooseRange =
252 bool bIsPercentage(
m_xRbPercent->get_active() || bIsErrorMargin );
257 eFieldUnit = FieldUnit::PERCENT;
283 if( !( bPosEnabled || bNegEnabled ))
291 bool bOneParameterCategory =
293 if( bOneParameterCategory )
327 m_xCbSyncPosNeg->set_sensitive( !bOneParameterCategory && ( bPosEnabled || bNegEnabled ));
339 CategoryChosen(*m_xRbConst);
344 m_bErrorKindUnique =
true;
347 if( m_xRbNone->get_active())
348 m_eErrorKind = SvxChartKindError::NONE;
349 else if( m_xRbConst->get_active())
350 m_eErrorKind = SvxChartKindError::Const;
351 else if( m_xRbPercent->get_active())
352 m_eErrorKind = SvxChartKindError::Percent;
353 else if( m_xRbRange->get_active())
354 m_eErrorKind = SvxChartKindError::Range;
355 else if( m_xRbFunction->get_active())
357 switch( m_xLbFunction->get_active())
360 m_eErrorKind = SvxChartKindError::StdError;
break;
362 m_eErrorKind = SvxChartKindError::Sigma;
break;
364 m_eErrorKind = SvxChartKindError::Variant;
break;
366 m_eErrorKind = SvxChartKindError::BigError;
break;
368 m_bErrorKindUnique =
false;
373 OSL_FAIL(
"Unknown category chosen" );
374 m_bErrorKindUnique =
false;
378 if( m_eErrorKind == SvxChartKindError::Range &&
379 eOldError != SvxChartKindError::Range )
381 m_xCbSyncPosNeg->set_active(
382 (!m_xEdRangePositive->get_text().isEmpty()) &&
383 m_xEdRangePositive->get_text() == m_xEdRangeNegative->get_text());
386 else if( m_eErrorKind != SvxChartKindError::Range &&
387 eOldError == SvxChartKindError::Range )
389 m_xCbSyncPosNeg->set_active( m_xMfPositive->get_value(FieldUnit::NONE) == m_xMfNegative->get_value(FieldUnit::NONE));
392 UpdateControlStates();
397 UpdateControlStates();
398 PosValueChanged( *m_xMfPositive );
403 if( m_xCbSyncPosNeg->get_active())
405 if( m_xRbRange->get_active())
407 m_xEdRangeNegative->set_text( m_xEdRangePositive->get_text());
408 m_bRangeNegUnique = m_bRangePosUnique;
411 m_xMfNegative->set_value(m_xMfPositive->get_value(FieldUnit::NONE), FieldUnit::NONE);
417 m_bIndicatorUnique =
true;
418 if( m_xRbBoth->get_active())
419 m_eIndicate = SvxChartIndicate::Both;
420 else if( m_xRbPositive->get_active())
421 m_eIndicate = SvxChartIndicate::Up;
422 else if( m_xRbNegative->get_active())
423 m_eIndicate = SvxChartIndicate::Down;
425 m_bIndicatorUnique =
false;
427 UpdateControlStates();
432 OSL_ASSERT(m_apRangeSelectionHelper);
433 if (!m_apRangeSelectionHelper)
435 OSL_ASSERT( m_pCurrentRangeChoosingField ==
nullptr );
439 if (&rButton == m_xIbRangePositive.get())
441 m_pCurrentRangeChoosingField = m_xEdRangePositive.get();
442 aUIString = m_xUIStringPos->get_label();
446 m_pCurrentRangeChoosingField = m_xEdRangeNegative.get();
447 aUIString = m_xUIStringNeg->get_label();
450 lcl_enableRangeChoosing(
true, m_pController);
451 m_apRangeSelectionHelper->chooseRange(
452 m_pCurrentRangeChoosingField->get_text(),
458 if( &rEdit == m_xEdRangePositive.get() )
460 m_bRangePosUnique =
true;
461 PosValueChanged( *m_xMfPositive );
465 m_bRangeNegUnique =
true;
468 isRangeFieldContentValid( rEdit );
480 if( aState == SfxItemState::SET )
489 case SvxChartKindError::NONE:
492 case SvxChartKindError::Percent:
495 case SvxChartKindError::Const:
498 case SvxChartKindError::StdError:
499 case SvxChartKindError::Variant:
500 case SvxChartKindError::Sigma:
501 case SvxChartKindError::BigError:
504 case SvxChartKindError::Range:
535 if( aState == SfxItemState::SET)
542 case SvxChartIndicate::NONE :
546 case SvxChartIndicate::Both :
548 case SvxChartIndicate::Up :
550 case SvxChartIndicate::Down :
564 if( aState == SfxItemState::SET )
572 if( aState == SfxItemState::SET )
577 !sRangeNegative.isEmpty() &&
603 aNegRange = aPosRange;
609 aNegRange = aPosRange;
623 double fPosValue =
static_cast< double >(
m_xMfPositive->get_value(FieldUnit::NONE)) /
625 double fNegValue = 0.0;
628 fNegValue = fPosValue;
630 fNegValue =
static_cast< double >(
m_xMfNegative->get_value(FieldUnit::NONE)) /
647 m_xFiBoth->set_from_icon_name(BMP_INDICATE_BOTH_VERTI);
653 m_xFiBoth->set_from_icon_name(BMP_INDICATE_BOTH_HORI);
658 const OUString & rNewRange )
665 OUString aRange( rNewRange );
700 bool bIsValid = ( aRange.isEmpty() ) ||
constexpr TypedWhichId< SfxStringItem > SCHATTR_STAT_RANGE_POS(SCHATTR_STAT_START+7)
constexpr TypedWhichId< SvxChartIndicateItem > SCHATTR_STAT_INDICATE(SCHATTR_STAT_START+6)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_STAT_ERRORBAR_TYPE(SCHATTR_STAT_START+9)
constexpr TypedWhichId< SvxChartKindErrorItem > SCHATTR_STAT_KIND_ERROR(SCHATTR_STAT_START+1)
constexpr TypedWhichId< SfxStringItem > SCHATTR_STAT_RANGE_NEG(SCHATTR_STAT_START+8)
constexpr TypedWhichId< SvxDoubleItem > SCHATTR_STAT_CONSTPLUS(SCHATTR_STAT_START+4)
constexpr TypedWhichId< SvxDoubleItem > SCHATTR_STAT_CONSTMINUS(SCHATTR_STAT_START+5)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
std::unique_ptr< RangeSelectionHelper > m_apRangeSelectionHelper
void FillItemSet(SfxItemSet &rOutAttrs) const
void SetErrorBarType(tErrorBarType eNewType)
std::unique_ptr< weld::Button > m_xIbRangePositive
std::unique_ptr< weld::RadioButton > m_xRbPositive
tErrorBarType m_eErrorBarType
std::unique_ptr< weld::RadioButton > m_xRbRange
sal_Int64 m_nConstSpinSize
std::unique_ptr< weld::Frame > m_xFlParameters
void Reset(const SfxItemSet &rInAttrs)
std::unique_ptr< weld::RadioButton > m_xRbNone
weld::Entry * m_pCurrentRangeChoosingField
SvxChartIndicate m_eIndicate
void UpdateControlStates()
std::unique_ptr< weld::MetricSpinButton > m_xMfNegative
bool m_bEnableDataTableDialog
virtual ~ErrorBarResources()
sal_uInt16 m_nConstDecimalDigits
std::unique_ptr< weld::CheckButton > m_xCbSyncPosNeg
bool m_bHasInternalDataProvider
std::unique_ptr< weld::Widget > m_xBxPositive
void SetAxisMinorStepWidthForErrorBarDecimals(double fMinorStepWidth)
virtual void listeningFinished(const OUString &rNewRange) override
std::unique_ptr< weld::Image > m_xFiBoth
void SetChartDocumentForRangeChoosing(const rtl::Reference<::chart::ChartModel > &xChartDocument)
void isRangeFieldContentValid(weld::Entry &rEdit)
std::unique_ptr< weld::Label > m_xUIStringRbRange
std::unique_ptr< weld::Entry > m_xEdRangePositive
std::unique_ptr< weld::Entry > m_xEdRangeNegative
virtual void disposingRangeSelection() override
std::unique_ptr< weld::MetricSpinButton > m_xMfPositive
std::unique_ptr< weld::Image > m_xFiPositive
std::unique_ptr< weld::Button > m_xIbRangeNegative
ErrorBarResources(weld::Builder *pParent, weld::DialogController *pControllerDialog, const SfxItemSet &rInAttrs, bool bNoneAvailable, chart::ErrorBarResources::tErrorBarType eType=ERROR_BAR_Y)
std::unique_ptr< weld::RadioButton > m_xRbPercent
SvxChartKindError m_eErrorKind
std::unique_ptr< weld::RadioButton > m_xRbNegative
weld::DialogController * m_pController
std::unique_ptr< weld::ComboBox > m_xLbFunction
std::unique_ptr< weld::Image > m_xFiNegative
std::unique_ptr< weld::RadioButton > m_xRbConst
std::unique_ptr< weld::RadioButton > m_xRbFunction
std::unique_ptr< weld::RadioButton > m_xRbBoth
std::unique_ptr< weld::Widget > m_xBxNegative
virtual Dialog * getDialog()=0
virtual void set_text(const OUString &rText)=0
virtual void set_message_type(EntryMessageType eType)=0
virtual OUString get_text() const=0
virtual void set_modal(bool bModal)=0
#define TOOLS_WARN_EXCEPTION(area, stream)
constexpr OUStringLiteral HID_SCH_ERROR_BARS_FROM_DATA
#define LINK(Instance, Class, Member)
IMPL_LINK(StackingResourceGroup, StackingChangeHdl, weld::Toggleable &, rRadio, void)
IMPL_LINK_NOARG(SplinePropertiesDialog, SplineTypeListBoxHdl, weld::ComboBox &, void)
#define CHART_LB_FUNCTION_STD_ERROR
#define CHART_LB_FUNCTION_STD_DEV
#define CHART_LB_FUNCTION_ERROR_MARGIN
#define CHART_LB_FUNCTION_VARIANCE