| 1 |
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 |
/* |
| 3 |
* This file is part of the LibreOffice project. |
| 4 |
* |
| 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/. |
| 8 |
* |
| 9 |
* This file incorporates work covered by the following license notice: |
| 10 |
* |
| 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 . |
| 18 |
*/ |
| 19 |
|
| 20 |
#include <ChartResourceGroupDlgs.hxx> |
| 21 |
#include <ChartTypeDialogController.hxx> |
| 22 |
|
| 23 |
#include <strings.hrc> |
| 24 |
#include <ResId.hxx> |
| 25 |
|
| 26 |
namespace chart |
| 27 |
{ |
| 28 |
using namespace ::com::sun::star; |
| 29 |
using namespace ::com::sun::star::chart2; |
| 30 |
|
| 31 |
const sal_uInt16 CUBIC_SPLINE_POS = 0; |
| 32 |
const sal_uInt16 B_SPLINE_POS = 1; |
| 33 |
|
| 34 |
SplinePropertiesDialog::SplinePropertiesDialog(weld::Window* pParent) |
| 35 |
: GenericDialogController(pParent, u"modules/schart/ui/smoothlinesdlg.ui"_ustr, |
| 36 |
u"SmoothLinesDialog"_ustr) |
| 37 |
, m_xLB_Spline_Type(m_xBuilder->weld_combo_box(u"SplineTypeComboBox"_ustr)) |
| 38 |
, m_xMF_SplineResolution(m_xBuilder->weld_spin_button(u"ResolutionSpinbutton"_ustr)) |
| 39 |
, m_xFT_SplineOrder(m_xBuilder->weld_label(u"PolynomialsLabel"_ustr)) |
| 40 |
, m_xMF_SplineOrder(m_xBuilder->weld_spin_button(u"PolynomialsSpinButton"_ustr)) |
| 41 |
{ |
| 42 |
m_xDialog->set_title(SchResId(STR_DLG_SMOOTH_LINE_PROPERTIES)); |
| 43 |
|
| 44 |
m_xLB_Spline_Type->connect_changed(LINK(this, SplinePropertiesDialog, SplineTypeListBoxHdl)); |
| 45 |
} |
| 46 |
|
| 47 |
void SplinePropertiesDialog::fillControls(const ChartTypeParameter& rParameter) |
| 48 |
{ |
| 49 |
switch (rParameter.eCurveStyle) |
| 50 |
{ |
| 51 |
case CurveStyle_CUBIC_SPLINES: |
| 52 |
m_xLB_Spline_Type->set_active(CUBIC_SPLINE_POS); |
| 53 |
break; |
| 54 |
case CurveStyle_B_SPLINES: |
| 55 |
m_xLB_Spline_Type->set_active(B_SPLINE_POS); |
| 56 |
break; |
| 57 |
default: |
| 58 |
m_xLB_Spline_Type->set_active(CUBIC_SPLINE_POS); |
| 59 |
break; |
| 60 |
} |
| 61 |
m_xMF_SplineOrder->set_value(rParameter.nSplineOrder); |
| 62 |
m_xMF_SplineResolution->set_value(rParameter.nCurveResolution); |
| 63 |
|
| 64 |
//dis/enabling |
| 65 |
m_xFT_SplineOrder->set_sensitive(m_xLB_Spline_Type->get_active() == B_SPLINE_POS); |
| 66 |
m_xMF_SplineOrder->set_sensitive(m_xLB_Spline_Type->get_active() == B_SPLINE_POS); |
| 67 |
} |
| 68 |
|
| 69 |
void SplinePropertiesDialog::fillParameter(ChartTypeParameter& rParameter, bool bSmoothLines) |
| 70 |
{ |
| 71 |
if (!bSmoothLines) |
| 72 |
rParameter.eCurveStyle = CurveStyle_LINES; |
| 73 |
else if (m_xLB_Spline_Type->get_active() == CUBIC_SPLINE_POS) |
| 74 |
rParameter.eCurveStyle = CurveStyle_CUBIC_SPLINES; |
| 75 |
else if (m_xLB_Spline_Type->get_active() == B_SPLINE_POS) |
| 76 |
rParameter.eCurveStyle = CurveStyle_B_SPLINES; |
| 77 |
|
| 78 |
rParameter.nCurveResolution = m_xMF_SplineResolution->get_value(); |
| 79 |
rParameter.nSplineOrder = m_xMF_SplineOrder->get_value(); |
| 80 |
} |
| 81 |
|
| 82 |
IMPL_LINK_NOARG(SplinePropertiesDialog, SplineTypeListBoxHdl, weld::ComboBox&, void) |
| 83 |
{ |
| 84 |
m_xFT_SplineOrder->set_sensitive(m_xLB_Spline_Type->get_active() == B_SPLINE_POS); |
| 85 |
m_xMF_SplineOrder->set_sensitive(m_xLB_Spline_Type->get_active() == B_SPLINE_POS); |
| 86 |
} |
| 87 |
|
| 88 |
SteppedPropertiesDialog::SteppedPropertiesDialog(weld::Window* pParent) |
| 89 |
: GenericDialogController(pParent, u"modules/schart/ui/steppedlinesdlg.ui"_ustr, |
| 90 |
u"SteppedLinesDialog"_ustr) |
| 91 |
, m_xRB_Start(m_xBuilder->weld_radio_button(u"step_start_rb"_ustr)) |
| 92 |
, m_xRB_End(m_xBuilder->weld_radio_button(u"step_end_rb"_ustr)) |
| 93 |
, m_xRB_CenterX(m_xBuilder->weld_radio_button(u"step_center_x_rb"_ustr)) |
| 94 |
, m_xRB_CenterY(m_xBuilder->weld_radio_button(u"step_center_y_rb"_ustr)) |
| 95 |
{ |
| 96 |
m_xDialog->set_title(SchResId(STR_DLG_STEPPED_LINE_PROPERTIES)); |
| 97 |
} |
| 98 |
|
| 99 |
void SteppedPropertiesDialog::fillControls(const ChartTypeParameter& rParameter) |
| 100 |
{ |
| 101 |
switch (rParameter.eCurveStyle) |
| 102 |
{ |
| 103 |
case CurveStyle_STEP_END: |
| 104 |
m_xRB_End->set_active(true); |
| 105 |
break; |
| 106 |
case CurveStyle_STEP_CENTER_X: |
| 107 |
m_xRB_CenterX->set_active(true); |
| 108 |
break; |
| 109 |
case CurveStyle_STEP_CENTER_Y: |
| 110 |
m_xRB_CenterY->set_active(true); |
| 111 |
break; |
| 112 |
default: // includes CurveStyle_STEP_START |
| 113 |
m_xRB_Start->set_active(true); |
| 114 |
break; |
| 115 |
} |
| 116 |
} |
| 117 |
void SteppedPropertiesDialog::fillParameter(ChartTypeParameter& rParameter, bool bSteppedLines) |
| 118 |
{ |
| 119 |
if (!bSteppedLines) |
| 120 |
rParameter.eCurveStyle = CurveStyle_LINES; |
| 121 |
else if (m_xRB_CenterY->get_active()) |
| 122 |
rParameter.eCurveStyle = CurveStyle_STEP_CENTER_Y; |
| 123 |
else if (m_xRB_Start->get_active()) |
| 124 |
rParameter.eCurveStyle = CurveStyle_STEP_START; |
| 125 |
else if (m_xRB_End->get_active()) |
| 126 |
rParameter.eCurveStyle = CurveStyle_STEP_END; |
| 127 |
else if (m_xRB_CenterX->get_active()) |
| 128 |
rParameter.eCurveStyle = CurveStyle_STEP_CENTER_X; |
| 129 |
} |
| 130 |
|
| 131 |
} //namespace chart |
| 132 |
|
| 133 |
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |