1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <ChartResourceGroupDlgs.hxx>
21 #include <ChartTypeDialogController.hxx>
23 #include <strings.hrc>
28 using namespace ::com::sun::star
;
29 using namespace ::com::sun::star::chart2
;
31 const sal_uInt16 CUBIC_SPLINE_POS
= 0;
32 const sal_uInt16 B_SPLINE_POS
= 1;
34 SplinePropertiesDialog::SplinePropertiesDialog(weld::Window
* pParent
)
35 : GenericDialogController(pParent
, "modules/schart/ui/smoothlinesdlg.ui", "SmoothLinesDialog")
36 , m_xLB_Spline_Type(m_xBuilder
->weld_combo_box("SplineTypeComboBox"))
37 , m_xMF_SplineResolution(m_xBuilder
->weld_spin_button("ResolutionSpinbutton"))
38 , m_xFT_SplineOrder(m_xBuilder
->weld_label("PolynomialsLabel"))
39 , m_xMF_SplineOrder(m_xBuilder
->weld_spin_button("PolynomialsSpinButton"))
41 m_xDialog
->set_title(SchResId(STR_DLG_SMOOTH_LINE_PROPERTIES
));
43 m_xLB_Spline_Type
->connect_changed(LINK(this, SplinePropertiesDialog
, SplineTypeListBoxHdl
));
46 void SplinePropertiesDialog::fillControls(const ChartTypeParameter
& rParameter
)
48 switch (rParameter
.eCurveStyle
)
50 case CurveStyle_CUBIC_SPLINES
:
51 m_xLB_Spline_Type
->set_active(CUBIC_SPLINE_POS
);
53 case CurveStyle_B_SPLINES
:
54 m_xLB_Spline_Type
->set_active(B_SPLINE_POS
);
57 m_xLB_Spline_Type
->set_active(CUBIC_SPLINE_POS
);
60 m_xMF_SplineOrder
->set_value(rParameter
.nSplineOrder
);
61 m_xMF_SplineResolution
->set_value(rParameter
.nCurveResolution
);
64 m_xFT_SplineOrder
->set_sensitive(m_xLB_Spline_Type
->get_active() == B_SPLINE_POS
);
65 m_xMF_SplineOrder
->set_sensitive(m_xLB_Spline_Type
->get_active() == B_SPLINE_POS
);
68 void SplinePropertiesDialog::fillParameter(ChartTypeParameter
& rParameter
, bool bSmoothLines
)
71 rParameter
.eCurveStyle
= CurveStyle_LINES
;
72 else if (m_xLB_Spline_Type
->get_active() == CUBIC_SPLINE_POS
)
73 rParameter
.eCurveStyle
= CurveStyle_CUBIC_SPLINES
;
74 else if (m_xLB_Spline_Type
->get_active() == B_SPLINE_POS
)
75 rParameter
.eCurveStyle
= CurveStyle_B_SPLINES
;
77 rParameter
.nCurveResolution
= m_xMF_SplineResolution
->get_value();
78 rParameter
.nSplineOrder
= m_xMF_SplineOrder
->get_value();
81 IMPL_LINK_NOARG(SplinePropertiesDialog
, SplineTypeListBoxHdl
, weld::ComboBox
&, void)
83 m_xFT_SplineOrder
->set_sensitive(m_xLB_Spline_Type
->get_active() == B_SPLINE_POS
);
84 m_xMF_SplineOrder
->set_sensitive(m_xLB_Spline_Type
->get_active() == B_SPLINE_POS
);
87 SteppedPropertiesDialog::SteppedPropertiesDialog(weld::Window
* pParent
)
88 : GenericDialogController(pParent
, "modules/schart/ui/steppedlinesdlg.ui", "SteppedLinesDialog")
89 , m_xRB_Start(m_xBuilder
->weld_radio_button("step_start_rb"))
90 , m_xRB_End(m_xBuilder
->weld_radio_button("step_end_rb"))
91 , m_xRB_CenterX(m_xBuilder
->weld_radio_button("step_center_x_rb"))
92 , m_xRB_CenterY(m_xBuilder
->weld_radio_button("step_center_y_rb"))
94 m_xDialog
->set_title(SchResId(STR_DLG_STEPPED_LINE_PROPERTIES
));
97 void SteppedPropertiesDialog::fillControls(const ChartTypeParameter
& rParameter
)
99 switch (rParameter
.eCurveStyle
)
101 case CurveStyle_STEP_END
:
102 m_xRB_End
->set_active(true);
104 case CurveStyle_STEP_CENTER_X
:
105 m_xRB_CenterX
->set_active(true);
107 case CurveStyle_STEP_CENTER_Y
:
108 m_xRB_CenterY
->set_active(true);
110 default: // includes CurveStyle_STEP_START
111 m_xRB_Start
->set_active(true);
115 void SteppedPropertiesDialog::fillParameter(ChartTypeParameter
& rParameter
, bool bSteppedLines
)
118 rParameter
.eCurveStyle
= CurveStyle_LINES
;
119 else if (m_xRB_CenterY
->get_active())
120 rParameter
.eCurveStyle
= CurveStyle_STEP_CENTER_Y
;
121 else if (m_xRB_Start
->get_active())
122 rParameter
.eCurveStyle
= CurveStyle_STEP_START
;
123 else if (m_xRB_End
->get_active())
124 rParameter
.eCurveStyle
= CurveStyle_STEP_END
;
125 else if (m_xRB_CenterX
->get_active())
126 rParameter
.eCurveStyle
= CurveStyle_STEP_CENTER_X
;
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */