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 .
19 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_DATASOURCE_HXX
20 #define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_DATASOURCE_HXX
22 #include <vcl/wizardmachine.hxx>
24 #include <RangeSelectionListener.hxx>
26 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ class XChartType
; } } } }
27 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ class XDataSeries
; } } } }
29 namespace chart
{ class TabPageNotifiable
; }
34 class ChartTypeTemplateProvider
;
42 /// the corresponding data series
43 css::uno::Reference
< css::chart2::XDataSeries
> m_xDataSeries
;
45 /// the chart type that contains the series (via XDataSeriesContainer)
46 css::uno::Reference
< css::chart2::XChartType
> m_xChartType
;
49 class DataSourceTabPage final
:
50 public ::vcl::OWizardPage
,
51 public RangeSelectionListenerParent
54 explicit DataSourceTabPage(weld::Container
* pPage
, weld::DialogController
* pController
,
55 DialogModel
& rDialogModel
,
56 ChartTypeTemplateProvider
* pTemplateProvider
,
57 bool bHideDescription
= false);
58 virtual ~DataSourceTabPage() override
;
60 virtual void Activate() override
;
66 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason eReason
) override
;
69 virtual void Deactivate() override
;
71 virtual void initializePage() override
;
73 DECL_LINK( SeriesSelectionChangedHdl
, weld::TreeView
&, void );
74 DECL_LINK( RoleSelectionChangedHdl
, weld::TreeView
&, void );
75 DECL_LINK( MainRangeButtonClickedHdl
, weld::Button
&, void );
76 DECL_LINK( CategoriesRangeButtonClickedHdl
, weld::Button
&, void );
77 DECL_LINK( AddButtonClickedHdl
, weld::Button
&, void );
78 DECL_LINK( RemoveButtonClickedHdl
, weld::Button
&, void );
79 DECL_LINK( RangeModifiedHdl
, weld::Entry
&, void );
80 DECL_LINK( UpButtonClickedHdl
, weld::Button
&, void );
81 DECL_LINK( DownButtonClickedHdl
, weld::Button
&, void );
83 // ____ RangeSelectionListenerParent ____
84 virtual void listeningFinished( const OUString
& rNewRange
) override
;
85 virtual void disposingRangeSelection() override
;
87 void InsertRoleLBEntry(const OUString
& rRole
, const OUString
& rRange
);
89 void updateControlState();
91 /** updates the internal data according to the content of the given edit
92 field. If pField is 0, all relevant fields are used
95 <TRUE/> if the text from the field is a valid format to the internal
98 bool updateModelFromControl(const weld::Entry
* pField
= nullptr);
100 /** @return </sal_True>, if the edit field contains a valid range entry. If no
101 XCellRangesAccess can be obtained, </sal_False> is returned.
103 bool isRangeFieldContentValid(weld::Entry
& rEdit
);
105 /** @return </sal_True>, if the tab-page is in a consistent (committable) state
110 void updateControlsFromDialogModel();
112 void fillSeriesListBox();
113 void fillRoleListBox();
115 std::vector
<std::unique_ptr
<SeriesEntry
>> m_aEntries
;
117 OUString m_aFixedTextRange
;
119 ChartTypeTemplateProvider
* m_pTemplateProvider
;
120 DialogModel
& m_rDialogModel
;
121 weld::Entry
* m_pCurrentRangeChoosingField
;
124 TabPageNotifiable
* m_pTabPageNotifiable
;
126 std::unique_ptr
<weld::Label
> m_xFT_CAPTION
;
127 std::unique_ptr
<weld::Label
> m_xFT_SERIES
;
128 std::unique_ptr
<weld::TreeView
> m_xLB_SERIES
;
129 std::unique_ptr
<weld::Button
> m_xBTN_ADD
;
130 std::unique_ptr
<weld::Button
> m_xBTN_REMOVE
;
131 std::unique_ptr
<weld::Button
> m_xBTN_UP
;
132 std::unique_ptr
<weld::Button
> m_xBTN_DOWN
;
133 std::unique_ptr
<weld::Label
> m_xFT_ROLE
;
134 std::unique_ptr
<weld::TreeView
> m_xLB_ROLE
;
135 std::unique_ptr
<weld::Label
> m_xFT_RANGE
;
136 std::unique_ptr
<weld::Entry
> m_xEDT_RANGE
;
137 std::unique_ptr
<weld::Button
> m_xIMB_RANGE_MAIN
;
138 std::unique_ptr
<weld::Label
> m_xFT_CATEGORIES
;
139 std::unique_ptr
<weld::Label
> m_xFT_DATALABELS
;//used for xy charts
140 std::unique_ptr
<weld::Entry
> m_xEDT_CATEGORIES
;
141 std::unique_ptr
<weld::Button
> m_xIMB_RANGE_CAT
;
146 // INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_DATASOURCE_HXX
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */