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 .
21 #include <DataSeries.hxx>
22 #include <ChartType.hxx>
24 #include <vcl/wizardmachine.hxx>
26 #include <RangeSelectionListener.hxx>
28 namespace com::sun::star::chart2
{ class XChartType
; }
29 namespace com::sun::star::chart2
{ class XDataSeries
; }
31 namespace chart
{ class TabPageNotifiable
; }
36 class ChartTypeTemplateProvider
;
45 /// the corresponding data series
46 rtl::Reference
< ::chart::DataSeries
> m_xDataSeries
;
48 /// the chart type that contains the series (via XDataSeriesContainer)
49 rtl::Reference
< ::chart::ChartType
> m_xChartType
;
52 class DataSourceTabPage final
:
53 public ::vcl::OWizardPage
,
54 public RangeSelectionListenerParent
57 explicit DataSourceTabPage(weld::Container
* pPage
, weld::DialogController
* pController
,
58 DialogModel
& rDialogModel
,
59 ChartTypeTemplateProvider
* pTemplateProvider
,
60 bool bHideDescription
= false);
61 virtual ~DataSourceTabPage() override
;
63 virtual void Activate() override
;
69 virtual bool commitPage( ::vcl::WizardTypes::CommitPageReason eReason
) override
;
72 virtual void Deactivate() override
;
74 virtual void initializePage() override
;
76 DECL_LINK( SeriesSelectionChangedHdl
, weld::TreeView
&, void );
77 DECL_LINK( RoleSelectionChangedHdl
, weld::TreeView
&, void );
78 DECL_LINK( MainRangeButtonClickedHdl
, weld::Button
&, void );
79 DECL_LINK( CategoriesRangeButtonClickedHdl
, weld::Button
&, void );
80 DECL_LINK( AddButtonClickedHdl
, weld::Button
&, void );
81 DECL_LINK( RemoveButtonClickedHdl
, weld::Button
&, void );
82 DECL_LINK( RangeModifiedHdl
, weld::Entry
&, void );
83 DECL_LINK( UpButtonClickedHdl
, weld::Button
&, void );
84 DECL_LINK( DownButtonClickedHdl
, weld::Button
&, void );
86 // ____ RangeSelectionListenerParent ____
87 virtual void listeningFinished( const OUString
& rNewRange
) override
;
88 virtual void disposingRangeSelection() override
;
90 void InsertRoleLBEntry(const OUString
& rRole
, const OUString
& rRange
);
92 void updateControlState();
94 /** updates the internal data according to the content of the given edit
95 field. If pField is 0, all relevant fields are used
98 <TRUE/> if the text from the field is a valid format to the internal
101 bool updateModelFromControl(const weld::Entry
* pField
= nullptr);
103 /** @return </sal_True>, if the edit field contains a valid range entry. If no
104 XCellRangesAccess can be obtained, </sal_False> is returned.
106 bool isRangeFieldContentValid(weld::Entry
& rEdit
);
108 /** @return </sal_True>, if the tab-page is in a consistent (committable) state
113 void updateControlsFromDialogModel();
115 void fillSeriesListBox();
116 void fillRoleListBox();
118 std::vector
<std::unique_ptr
<SeriesEntry
>> m_aEntries
;
120 OUString m_aFixedTextRange
;
122 ChartTypeTemplateProvider
* m_pTemplateProvider
;
123 DialogModel
& m_rDialogModel
;
124 weld::Entry
* m_pCurrentRangeChoosingField
;
127 TabPageNotifiable
* m_pTabPageNotifiable
;
129 std::unique_ptr
<weld::Label
> m_xFT_CAPTION
;
130 std::unique_ptr
<weld::Label
> m_xFT_SERIES
;
131 std::unique_ptr
<weld::TreeView
> m_xLB_SERIES
;
132 std::unique_ptr
<weld::Button
> m_xBTN_ADD
;
133 std::unique_ptr
<weld::Button
> m_xBTN_REMOVE
;
134 std::unique_ptr
<weld::Button
> m_xBTN_UP
;
135 std::unique_ptr
<weld::Button
> m_xBTN_DOWN
;
136 std::unique_ptr
<weld::Label
> m_xFT_ROLE
;
137 std::unique_ptr
<weld::TreeView
> m_xLB_ROLE
;
138 std::unique_ptr
<weld::Label
> m_xFT_RANGE
;
139 std::unique_ptr
<weld::Entry
> m_xEDT_RANGE
;
140 std::unique_ptr
<weld::Button
> m_xIMB_RANGE_MAIN
;
141 std::unique_ptr
<weld::Label
> m_xFT_CATEGORIES
;
142 std::unique_ptr
<weld::Label
> m_xFT_DATALABELS
;//used for xy charts
143 std::unique_ptr
<weld::Entry
> m_xEDT_CATEGORIES
;
144 std::unique_ptr
<weld::Button
> m_xIMB_RANGE_CAT
;
149 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */