Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / chart2 / source / controller / dialogs / tp_DataSource.hxx
blobd3507fcc9bfe2b2cb2f6cee5637a09c528e80f43
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <svtools/wizardmachine.hxx>
24 #include "DialogModel.hxx"
25 #include <TabPageNotifiable.hxx>
27 #include <vcl/edit.hxx>
28 #include <vcl/lstbox.hxx>
29 #include <vcl/button.hxx>
30 #include <vcl/fixed.hxx>
31 #include <svtools/svtabbx.hxx>
32 #include <svtools/treelistbox.hxx>
33 #include <com/sun/star/chart2/XChartDocument.hpp>
34 #include <com/sun/star/chart2/XDiagram.hpp>
35 #include <com/sun/star/chart2/data/XDataProvider.hpp>
36 #include <com/sun/star/chart2/XDataSeries.hpp>
37 #include <com/sun/star/sheet/XRangeSelection.hpp>
39 #include <utility>
40 #include <vector>
42 #include <RangeSelectionListener.hxx>
44 namespace chart
47 class ChartTypeTemplateProvider;
48 class DialogModel;
50 class DataSourceTabPage final :
51 public ::svt::OWizardPage,
52 public RangeSelectionListenerParent
54 public:
55 explicit DataSourceTabPage(
56 vcl::Window * pParent,
57 DialogModel & rDialogModel,
58 ChartTypeTemplateProvider* pTemplateProvider,
59 Dialog * pParentDialog,
60 bool bHideDescription = false );
61 virtual ~DataSourceTabPage() override;
62 virtual void dispose() override;
64 void commitPage();
66 private:
67 // OWizardPage
68 virtual void ActivatePage() override;
69 virtual bool commitPage( ::svt::WizardTypes::CommitPageReason eReason ) override;
71 //TabPage
72 virtual void DeactivatePage() override;
74 virtual void initializePage() override;
76 DECL_LINK( SeriesSelectionChangedHdl, SvTreeListBox*, void );
77 DECL_LINK( RoleSelectionChangedHdl, SvTreeListBox*, void );
78 DECL_LINK( MainRangeButtonClickedHdl, Button*, void );
79 DECL_LINK( CategoriesRangeButtonClickedHdl, Button*, void );
80 DECL_LINK( AddButtonClickedHdl, Button*, void );
81 DECL_LINK( RemoveButtonClickedHdl, Button*, void );
82 DECL_LINK( RangeModifiedHdl, Edit&, void );
83 DECL_LINK( RangeUpdateDataHdl, Edit&, void );
84 DECL_LINK( UpButtonClickedHdl, Button*, void );
85 DECL_LINK( DownButtonClickedHdl, Button*, void );
87 // ____ RangeSelectionListenerParent ____
88 virtual void listeningFinished( const OUString & rNewRange ) override;
89 virtual void disposingRangeSelection() override;
91 void updateControlState();
93 /** updates the internal data according to the content of the given edit
94 field. If pField is 0, all relevant fields are used
96 @return
97 <TRUE/> if the text from the field is a valid format to the internal
98 data was valid
100 bool updateModelFromControl( Edit * pField = nullptr );
102 /** @return </sal_True>, if the edit field contains a valid range entry. If no
103 XCellRangesAccess can be obtained, </sal_False> is returned.
105 bool isRangeFieldContentValid( Edit & rEdit );
107 /** @return </sal_True>, if the tab-page is in a consistent (commitable) state
109 bool isValid();
110 void setDirty();
112 void updateControlsFromDialogModel();
114 void fillSeriesListBox();
115 void fillRoleListBox();
117 VclPtr<FixedText> m_pFT_CAPTION;
118 VclPtr<FixedText> m_pFT_SERIES;
119 VclPtr<SvTreeListBox> m_pLB_SERIES;
120 VclPtr<PushButton> m_pBTN_ADD;
121 VclPtr<PushButton> m_pBTN_REMOVE;
122 VclPtr<PushButton> m_pBTN_UP;
123 VclPtr<PushButton> m_pBTN_DOWN;
125 VclPtr<FixedText> m_pFT_ROLE;
126 VclPtr<SvTabListBox> m_pLB_ROLE;
127 VclPtr<FixedText> m_pFT_RANGE;
128 VclPtr<Edit> m_pEDT_RANGE;
129 VclPtr<PushButton> m_pIMB_RANGE_MAIN;
131 VclPtr<FixedText> m_pFT_CATEGORIES;
132 VclPtr<FixedText> m_pFT_DATALABELS;//used for xy charts
133 VclPtr<Edit> m_pEDT_CATEGORIES;
134 VclPtr<PushButton> m_pIMB_RANGE_CAT;
136 OUString m_aFixedTextRange;
138 ChartTypeTemplateProvider * m_pTemplateProvider;
139 DialogModel & m_rDialogModel;
140 VclPtr<Edit> m_pCurrentRangeChoosingField;
141 bool m_bIsDirty;
143 VclPtr<Dialog> m_pParentDialog;
144 TabPageNotifiable * m_pTabPageNotifiable;
147 } // namespace chart
149 // INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_DATASOURCE_HXX
150 #endif
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */