21#include <bitmaps.hlst>
24#include <com/sun/star/chart2/MovingAverageType.hpp>
32using namespace css::chart2;
46 , m_bTrendLineUnique(true)
47 , m_pNumFormatter(nullptr)
49 , m_xRB_Linear(rBuilder.weld_radio_button(
"linear"))
50 , m_xRB_Logarithmic(rBuilder.weld_radio_button(
"logarithmic"))
51 , m_xRB_Exponential(rBuilder.weld_radio_button(
"exponential"))
52 , m_xRB_Power(rBuilder.weld_radio_button(
"power"))
53 , m_xRB_Polynomial(rBuilder.weld_radio_button(
"polynomial"))
54 , m_xRB_MovingAverage(rBuilder.weld_radio_button(
"movingAverage"))
55 , m_xFI_Linear(rBuilder.weld_image(
"imageLinear"))
56 , m_xFI_Logarithmic(rBuilder.weld_image(
"imageLogarithmic"))
57 , m_xFI_Exponential(rBuilder.weld_image(
"imageExponential"))
58 , m_xFI_Power(rBuilder.weld_image(
"imagePower"))
59 , m_xFI_Polynomial(rBuilder.weld_image(
"imagePolynomial"))
60 , m_xFI_MovingAverage(rBuilder.weld_image(
"imageMovingAverage"))
61 , m_xNF_Degree(rBuilder.weld_spin_button(
"degree"))
62 , m_xNF_Period(rBuilder.weld_spin_button(
"period"))
63 , m_xEE_Name(rBuilder.weld_entry(
"entry_name"))
64 , m_xFmtFld_ExtrapolateForward(rBuilder.weld_formatted_spin_button(
"extrapolateForward"))
65 , m_xFmtFld_ExtrapolateBackward(rBuilder.weld_formatted_spin_button(
"extrapolateBackward"))
66 , m_xCB_SetIntercept(rBuilder.weld_check_button(
"setIntercept"))
67 , m_xFmtFld_InterceptValue(rBuilder.weld_formatted_spin_button(
"interceptValue"))
68 , m_xCB_ShowEquation(rBuilder.weld_check_button(
"showEquation"))
69 , m_xEE_XName(rBuilder.weld_entry(
"entry_Xname"))
70 , m_xEE_YName(rBuilder.weld_entry(
"entry_Yname"))
71 , m_xCB_ShowCorrelationCoeff(rBuilder.weld_check_button(
"showCorrelationCoefficient"))
72 , m_xCB_RegressionMovingType(rBuilder.weld_combo_box(
"combo_moving_type"))
110 if (m_xRB_Linear->get_active())
111 m_eTrendLineType = SvxChartRegress::Linear;
112 else if (m_xRB_Logarithmic->get_active())
113 m_eTrendLineType = SvxChartRegress::Log;
114 else if (m_xRB_Exponential->get_active())
115 m_eTrendLineType = SvxChartRegress::Exp;
116 else if (m_xRB_Power->get_active())
117 m_eTrendLineType = SvxChartRegress::Power;
118 else if (m_xRB_Polynomial->get_active())
119 m_eTrendLineType = SvxChartRegress::Polynomial;
120 else if (m_xRB_MovingAverage->get_active())
121 m_eTrendLineType = SvxChartRegress::MovingAverage;
122 m_bTrendLineUnique =
true;
124 UpdateControlStates();
131 OUString
aName = pCurveNameItem->GetValue();
140 OUString
aName = pRegressionXNameItem->GetValue();
149 OUString
aName = pRegressionYNameItem->GetValue();
160 if( aState == SfxItemState::SET )
171 sal_Int32 nDegree = pDegreeItem->GetValue();
183 sal_Int32 nPeriod = pPeriodItem->GetValue();
196 nValue = pForwardItem->GetValue() ;
203 nValue = pBackwardItem->GetValue() ;
210 nValue = pValueItem->GetValue() ;
215 if( aState == SfxItemState::DONTCARE )
221 if( aState == SfxItemState::SET )
226 if( aState == SfxItemState::DONTCARE )
232 if( aState == SfxItemState::SET )
237 if( aState == SfxItemState::DONTCARE )
243 if( aState == SfxItemState::SET )
249 sal_Int32 nMovingType = pMovingTypeItem->GetValue();
250 if (nMovingType == MovingAverageType::Prior)
252 else if (nMovingType == MovingAverageType::Central)
254 else if (nMovingType == MovingAverageType::AveragedAbscissa)
267 case SvxChartRegress::Linear :
270 case SvxChartRegress::Log :
273 case SvxChartRegress::Exp :
276 case SvxChartRegress::Power :
279 case SvxChartRegress::Polynomial :
282 case SvxChartRegress::MovingAverage :
297 sal_Int32
nType = MovingAverageType::Prior;
299 nType = MovingAverageType::Central;
301 nType = MovingAverageType::AveragedAbscissa;
315 if (
aName.isEmpty() )
319 if (
aName.isEmpty() )
348 m_xFI_Linear->set_from_icon_name(BMP_REGRESSION_LINEAR);
351 m_xFI_Power->set_from_icon_name(BMP_REGRESSION_POWER);
364 bool bMovingAverage = (
m_eTrendLineType == SvxChartRegress::MovingAverage );
387 if (&rNumericField == m_xNF_Degree.get())
389 if (!m_xRB_Polynomial->get_active() && m_xNF_Degree->get_value_changed_from_saved())
391 m_xRB_Polynomial->set_active(
true);
392 SelectTrendLine(*m_xRB_Polynomial);
395 else if (&rNumericField == m_xNF_Period.get())
397 if (!m_xRB_MovingAverage->get_active() && m_xNF_Period->get_value_changed_from_saved())
399 m_xRB_MovingAverage->set_active(
true);
400 SelectTrendLine(*m_xRB_MovingAverage);
403 UpdateControlStates();
408 if (!m_xCB_SetIntercept->get_active())
409 m_xCB_SetIntercept->set_active(
true);
410 UpdateControlStates();
429 UpdateControlStates();
constexpr TypedWhichId< SvxChartRegressItem > SCHATTR_REGRESSION_TYPE(SCHATTR_REGRESSION_START)
constexpr TypedWhichId< SvxDoubleItem > SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD(SCHATTR_REGRESSION_START+5)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_REGRESSION_SHOW_EQUATION(SCHATTR_REGRESSION_START+1)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_REGRESSION_SET_INTERCEPT(SCHATTR_REGRESSION_START+7)
constexpr TypedWhichId< SfxInt32Item > SCHATTR_REGRESSION_MOVING_TYPE(SCHATTR_REGRESSION_START+12)
constexpr TypedWhichId< SfxStringItem > SCHATTR_REGRESSION_CURVE_NAME(SCHATTR_REGRESSION_START+9)
constexpr TypedWhichId< SfxStringItem > SCHATTR_REGRESSION_YNAME(SCHATTR_REGRESSION_START+11)
constexpr TypedWhichId< SfxInt32Item > SCHATTR_REGRESSION_DEGREE(SCHATTR_REGRESSION_START+3)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_REGRESSION_SHOW_COEFF(SCHATTR_REGRESSION_START+2)
constexpr TypedWhichId< SvxDoubleItem > SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD(SCHATTR_REGRESSION_START+6)
constexpr TypedWhichId< SfxStringItem > SCHATTR_REGRESSION_XNAME(SCHATTR_REGRESSION_START+10)
constexpr TypedWhichId< SvxDoubleItem > SCHATTR_REGRESSION_INTERCEPT_VALUE(SCHATTR_REGRESSION_START+8)
constexpr TypedWhichId< SfxInt32Item > SCHATTR_REGRESSION_PERIOD(SCHATTR_REGRESSION_START+4)
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< weld::RadioButton > m_xRB_Logarithmic
std::unique_ptr< weld::Entry > m_xEE_Name
void SetNbPoints(sal_Int32 nNbPoints)
TrendlineResources(weld::Builder &rParent, const SfxItemSet &rInAttrs)
std::unique_ptr< weld::CheckButton > m_xCB_ShowEquation
std::unique_ptr< weld::FormattedSpinButton > m_xFmtFld_ExtrapolateBackward
std::unique_ptr< weld::RadioButton > m_xRB_Linear
std::unique_ptr< weld::RadioButton > m_xRB_Exponential
std::unique_ptr< weld::RadioButton > m_xRB_Polynomial
std::unique_ptr< weld::Entry > m_xEE_YName
std::unique_ptr< weld::Image > m_xFI_Logarithmic
void UpdateControlStates()
std::unique_ptr< weld::ComboBox > m_xCB_RegressionMovingType
SvxChartRegress m_eTrendLineType
std::unique_ptr< weld::SpinButton > m_xNF_Degree
std::unique_ptr< weld::Entry > m_xEE_XName
std::unique_ptr< weld::FormattedSpinButton > m_xFmtFld_ExtrapolateForward
std::unique_ptr< weld::CheckButton > m_xCB_SetIntercept
std::unique_ptr< weld::Image > m_xFI_Linear
std::unique_ptr< weld::RadioButton > m_xRB_Power
void FillItemSet(SfxItemSet *rOutAttrs) const
void Reset(const SfxItemSet &rInAttrs)
std::unique_ptr< weld::RadioButton > m_xRB_MovingAverage
std::unique_ptr< weld::Image > m_xFI_Polynomial
std::unique_ptr< weld::CheckButton > m_xCB_ShowCorrelationCoeff
std::unique_ptr< weld::Image > m_xFI_Exponential
std::unique_ptr< weld::FormattedSpinButton > m_xFmtFld_InterceptValue
void SetNumFormatter(SvNumberFormatter *pFormatter)
std::unique_ptr< weld::SpinButton > m_xNF_Period
SvNumberFormatter * m_pNumFormatter
std::unique_ptr< weld::Image > m_xFI_MovingAverage
std::unique_ptr< weld::Image > m_xFI_Power
#define LINK(Instance, Class, Member)
static void lcl_setValue(weld::FormattedSpinButton &rFmtField, double fValue)
IMPL_LINK(StackingResourceGroup, StackingChangeHdl, weld::Toggleable &, rRadio, void)
IMPL_LINK_NOARG(SplinePropertiesDialog, SplineTypeListBoxHdl, weld::ComboBox &, void)