summaryrefslogtreecommitdiffstats
path: root/chart2/source/controller/inc/res_ErrorBar.hxx
blob: 0514855a2d60d4eb7bee1ff5428175158f9a7c14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */
#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_ERRORBAR_HXX
#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_ERRORBAR_HXX

#include <memory>
#include <tools/link.hxx>
#include <svl/itemset.hxx>
#include <svx/chrtitem.hxx>
#include "RangeSelectionListener.hxx"

namespace com::sun::star::chart2 { class XChartDocument; }
namespace weld { class Builder; }
namespace weld { class Button; }
namespace weld { class CheckButton; }
namespace weld { class ComboBox; }
namespace weld { class DialogController; }
namespace weld { class Entry; }
namespace weld { class Frame; }
namespace weld { class Image; }
namespace weld { class Label; }
namespace weld { class MetricSpinButton; }
namespace weld { class RadioButton; }
namespace weld { class ToggleButton; }
namespace weld { class Widget; }

namespace chart
{

class RangeSelectionHelper;

class ErrorBarResources : public RangeSelectionListenerParent
{
public:
    enum tErrorBarType
    {
        ERROR_BAR_X,
        ERROR_BAR_Y
    };

    ErrorBarResources(
        weld::Builder* pParent, weld::DialogController* pControllerDialog, 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 css::uno::Reference< css::chart2::XChartDocument > & xChartDocument );
    void Reset(const SfxItemSet& rInAttrs);
    void FillItemSet(SfxItemSet& rOutAttrs) const;

    void FillValueSets();

    // ____ RangeSelectionListenerParent ____
    virtual void listeningFinished( const OUString & rNewRange ) override;
    virtual void disposingRangeSelection() override;

private:
    SvxChartKindError    m_eErrorKind;
    SvxChartIndicate     m_eIndicate;

    bool                 m_bErrorKindUnique;
    bool                 m_bIndicatorUnique;
    bool                 m_bRangePosUnique;
    bool                 m_bRangeNegUnique;

    tErrorBarType        m_eErrorBarType;
    sal_uInt16           m_nConstDecimalDigits;
    sal_Int64            m_nConstSpinSize;
    double               m_fPlusValue;
    double               m_fMinusValue;

    weld::DialogController* m_pController;
    std::unique_ptr< RangeSelectionHelper >  m_apRangeSelectionHelper;
    weld::Entry*         m_pCurrentRangeChoosingField;
    bool                 m_bHasInternalDataProvider;
    bool                 m_bEnableDataTableDialog;


    // category
    std::unique_ptr<weld::RadioButton> m_xRbNone;
    std::unique_ptr<weld::RadioButton> m_xRbConst;
    std::unique_ptr<weld::RadioButton> m_xRbPercent;
    std::unique_ptr<weld::RadioButton> m_xRbFunction;
    std::unique_ptr<weld::RadioButton> m_xRbRange;
    std::unique_ptr<weld::ComboBox> m_xLbFunction;

    // parameters
    std::unique_ptr<weld::Frame> m_xFlParameters;
    std::unique_ptr<weld::Widget> m_xBxPositive;
    std::unique_ptr<weld::MetricSpinButton> m_xMfPositive;
    std::unique_ptr<weld::Entry> m_xEdRangePositive;
    std::unique_ptr<weld::Button> m_xIbRangePositive;
    std::unique_ptr<weld::Widget> m_xBxNegative;
    std::unique_ptr<weld::MetricSpinButton> m_xMfNegative;
    std::unique_ptr<weld::Entry> m_xEdRangeNegative;
    std::unique_ptr<weld::Button> m_xIbRangeNegative;
    std::unique_ptr<weld::CheckButton> m_xCbSyncPosNeg;

    // indicator
    std::unique_ptr<weld::RadioButton> m_xRbBoth;
    std::unique_ptr<weld::RadioButton> m_xRbPositive;
    std::unique_ptr<weld::RadioButton> m_xRbNegative;
    std::unique_ptr<weld::Image> m_xFiBoth;
    std::unique_ptr<weld::Image> m_xFiPositive;
    std::unique_ptr<weld::Image> m_xFiNegative;

    std::unique_ptr<weld::Label> m_xUIStringPos;
    std::unique_ptr<weld::Label> m_xUIStringNeg;
    std::unique_ptr<weld::Label> m_xUIStringRbRange;

    DECL_LINK( CategoryChosen, weld::ToggleButton&, void );
    DECL_LINK( CategoryChosen2, weld::ComboBox&, void );
    DECL_LINK( SynchronizePosAndNeg, weld::ToggleButton&, void );
    DECL_LINK( PosValueChanged, weld::MetricSpinButton&, void );
    DECL_LINK( IndicatorChanged, weld::ToggleButton&, void );
    DECL_LINK( ChooseRange, weld::Button&, void );
    DECL_LINK( RangeChanged, weld::Entry&, void );

    void UpdateControlStates();
    void isRangeFieldContentValid(weld::Entry& rEdit);
};

} //namespace chart

#endif

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */