Debian Codegraph @

chart2/source/controller/dialogs/tp_DataSource.hxx

raw
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 #pragma once
20
21 #include <DataSeries.hxx>
22 #include <ChartType.hxx>
23
24 #include <vcl/wizardmachine.hxx>
25
26 #include <RangeSelectionListener.hxx>
27
28 namespace chart { class TabPageNotifiable; }
29
30 namespace chart
31 {
32 class ChartTypeTemplateProvider;
33 class DialogModel;
34
35 class SeriesEntry
36 {
37 public:
38 OUString m_sRole;
39
40 /// the corresponding data series
41 rtl::Reference< ::chart::DataSeries > m_xDataSeries;
42
43 /// the chart type that contains the series (via XDataSeriesContainer)
44 rtl::Reference< ::chart::ChartType > m_xChartType;
45 };
46
47 class DataSourceTabPage final :
48 public ::vcl::OWizardPage,
49 public RangeSelectionListenerParent
50 {
51 public:
52 explicit DataSourceTabPage(weld::Container* pPage, weld::DialogController* pController,
53 DialogModel & rDialogModel,
54 ChartTypeTemplateProvider* pTemplateProvider,
55 bool bHideDescription = false);
56 virtual ~DataSourceTabPage() override;
57
58 virtual void Activate() override;
59
60 void commitPage();
61
62 private:
63 // OWizardPage
64 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason eReason ) override;
65
66 //TabPage
67 virtual void Deactivate() override;
68
69 virtual void initializePage() override;
70
71 DECL_LINK( SeriesSelectionChangedHdl, weld::TreeView&, void );
72 DECL_LINK( RoleSelectionChangedHdl, weld::TreeView&, void );
73 DECL_LINK( MainRangeButtonClickedHdl, weld::Button&, void );
74 DECL_LINK( CategoriesRangeButtonClickedHdl, weld::Button&, void );
75 DECL_LINK( AddButtonClickedHdl, weld::Button&, void );
76 DECL_LINK( RemoveButtonClickedHdl, weld::Button&, void );
77 DECL_LINK( RangeModifiedHdl, weld::Entry&, void );
78 DECL_LINK( UpButtonClickedHdl, weld::Button&, void );
79 DECL_LINK( DownButtonClickedHdl, weld::Button&, void );
80
81 // ____ RangeSelectionListenerParent ____
82 virtual void listeningFinished( const OUString & rNewRange ) override;
83 virtual void disposingRangeSelection() override;
84
85 void InsertRoleLBEntry(const OUString& rRole, const OUString& rRange);
86
87 void updateControlState();
88
89 /** updates the internal data according to the content of the given edit
90 field. If pField is 0, all relevant fields are used
91
92 @return
93 <TRUE/> if the text from the field is a valid format to the internal
94 data was valid
95 */
96 bool updateModelFromControl(const weld::Entry* pField = nullptr);
97
98 /** @return </sal_True>, if the edit field contains a valid range entry. If no
99 XCellRangesAccess can be obtained, </sal_False> is returned.
100 */
101 bool isRangeFieldContentValid(weld::Entry& rEdit);
102
103 /** @return </sal_True>, if the tab-page is in a consistent (committable) state
104 */
105 bool isValid();
106 void setDirty();
107
108 void updateControlsFromDialogModel();
109
110 void fillSeriesListBox();
111 void fillRoleListBox();
112
113 std::vector<std::unique_ptr<SeriesEntry>> m_aEntries;
114
115 OUString m_aFixedTextRange;
116
117 ChartTypeTemplateProvider * m_pTemplateProvider;
118 DialogModel & m_rDialogModel;
119 weld::Entry* m_pCurrentRangeChoosingField;
120 bool m_bIsDirty;
121
122 TabPageNotifiable * m_pTabPageNotifiable;
123
124 std::unique_ptr<weld::Label> m_xFT_CAPTION;
125 std::unique_ptr<weld::Label> m_xFT_SERIES;
126 std::unique_ptr<weld::TreeView> m_xLB_SERIES;
127 std::unique_ptr<weld::Button> m_xBTN_ADD;
128 std::unique_ptr<weld::Button> m_xBTN_REMOVE;
129 std::unique_ptr<weld::Button> m_xBTN_UP;
130 std::unique_ptr<weld::Button> m_xBTN_DOWN;
131 std::unique_ptr<weld::Label> m_xFT_ROLE;
132 std::unique_ptr<weld::TreeView> m_xLB_ROLE;
133 std::unique_ptr<weld::Label> m_xFT_RANGE;
134 std::unique_ptr<weld::Entry> m_xEDT_RANGE;
135 std::unique_ptr<weld::Button> m_xIMB_RANGE_MAIN;
136 std::unique_ptr<weld::Label> m_xFT_CATEGORIES;
137 std::unique_ptr<weld::Label> m_xFT_DATALABELS;//used for xy charts
138 std::unique_ptr<weld::Entry> m_xEDT_CATEGORIES;
139 std::unique_ptr<weld::Button> m_xIMB_RANGE_CAT;
140 };
141
142 } // namespace chart
143
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */