1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef CHART2_DATASOURCETABPAGE_HXX 28 #define CHART2_DATASOURCETABPAGE_HXX 29 30 #include <svtools/wizardmachine.hxx> 31 32 #include "DialogModel.hxx" 33 #include "TabPageNotifiable.hxx" 34 35 // header for class Edit 36 #include <vcl/edit.hxx> 37 // header for class ListBox 38 #include <vcl/lstbox.hxx> 39 // header for class PushButton, OKButton, CancelButton, HelpButton 40 #ifndef _SV_BUTTON_HXX 41 #include <vcl/button.hxx> 42 #endif 43 // header for class FixedText, FixedLine 44 #include <vcl/fixed.hxx> 45 // header for class SvTabListBox 46 #include <svtools/svtabbx.hxx> 47 // header for class SvTreeListBox 48 #include <svtools/svtreebx.hxx> 49 #include <com/sun/star/chart2/XChartDocument.hpp> 50 #include <com/sun/star/chart2/XDiagram.hpp> 51 #include <com/sun/star/chart2/data/XDataProvider.hpp> 52 #include <com/sun/star/chart2/XDataSeries.hpp> 53 #include <com/sun/star/sheet/XRangeSelection.hpp> 54 55 #include <utility> 56 #include <vector> 57 #include <memory> 58 59 #include "RangeSelectionListener.hxx" 60 #include "RangeSelectionButton.hxx" 61 #include "RangeEdit.hxx" 62 63 namespace com { namespace sun { namespace star { 64 namespace chart2 { 65 class XChartType; 66 }}}} 67 68 namespace chart 69 { 70 71 class ChartTypeTemplateProvider; 72 class DialogModel; 73 74 class DataSourceTabPage : 75 public ::svt::OWizardPage, 76 public RangeSelectionListenerParent 77 { 78 public: 79 explicit DataSourceTabPage( 80 Window * pParent, 81 DialogModel & rDialogModel, 82 ChartTypeTemplateProvider* pTemplateProvider, 83 Dialog * pParentDialog, 84 bool bHideDescription = false ); 85 virtual ~DataSourceTabPage(); 86 87 void commitPage(); 88 89 protected: 90 // OWizardPage 91 virtual void ActivatePage(); 92 virtual sal_Bool commitPage( ::svt::WizardTypes::CommitPageReason eReason ); 93 94 //TabPage 95 virtual void DeactivatePage(); 96 97 virtual void initializePage(); 98 99 DECL_LINK( SeriesSelectionChangedHdl, void* ); 100 DECL_LINK( RoleSelectionChangedHdl, void* ); 101 DECL_LINK( MainRangeButtonClickedHdl, void* ); 102 DECL_LINK( CategoriesRangeButtonClickedHdl, void* ); 103 DECL_LINK( AddButtonClickedHdl, void* ); 104 DECL_LINK( RemoveButtonClickedHdl, void* ); 105 DECL_LINK( RangeModifiedHdl, Edit* ); 106 DECL_LINK( RangeUpdateDataHdl, Edit* ); 107 DECL_LINK( UpButtonClickedHdl, void* ); 108 DECL_LINK( DownButtonClickedHdl, void* ); 109 110 // ____ RangeSelectionListenerParent ____ 111 virtual void listeningFinished( const ::rtl::OUString & rNewRange ); 112 virtual void disposingRangeSelection(); 113 114 void updateControlState(); 115 116 protected: 117 /** updates the internal data according to the content of the given edit 118 field. If pField is 0, all relevant fields are used 119 120 @return 121 <TRUE/> if the text from the field is a valid format to the internal 122 data was valid 123 */ 124 bool updateModelFromControl( Edit * pField = 0 ); 125 126 ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelectionListener > 127 getSelectionRangeListener(); 128 129 /** @return </sal_True>, if the edit field contains a valid range entry. if no 130 XCellRangesAccess can be obtained, </sal_True> is returned. 131 */ 132 bool isRangeFieldContentValid( Edit & rEdit ); 133 134 /** @return </sal_True>, if the tab-page is in a consistent (commitable) state 135 */ 136 bool isValid(); 137 void setDirty(); 138 139 void updateControlsFromDialogModel(); 140 141 void fillSeriesListBox(); 142 void fillRoleListBox(); 143 144 private: 145 FixedText m_aFT_CAPTION; 146 FixedText m_aFT_SERIES; 147 ::std::auto_ptr< SvTreeListBox > m_apLB_SERIES; 148 PushButton m_aBTN_ADD; 149 PushButton m_aBTN_REMOVE; 150 PushButton m_aBTN_UP; 151 PushButton m_aBTN_DOWN; 152 153 FixedText m_aFT_ROLE; 154 SvTabListBox m_aLB_ROLE; 155 FixedText m_aFT_RANGE; 156 RangeEdit m_aEDT_RANGE; 157 RangeSelectionButton m_aIMB_RANGE_MAIN; 158 159 FixedText m_aFT_CATEGORIES; 160 FixedText m_aFT_DATALABELS;//used for xy charts 161 RangeEdit m_aEDT_CATEGORIES; 162 RangeSelectionButton m_aIMB_RANGE_CAT; 163 164 ::rtl::OUString m_aFixedTextRange; 165 166 ChartTypeTemplateProvider * m_pTemplateProvider; 167 DialogModel & m_rDialogModel; 168 Edit * m_pCurrentRangeChoosingField; 169 bool m_bIsDirty; 170 sal_Int32 m_nLastChartTypeGroupIndex; 171 172 Dialog * m_pParentDialog; 173 TabPageNotifiable * m_pTabPageNotifiable; 174 }; 175 176 } // namespace chart 177 178 // CHART2_DATASOURCETABPAGE_HXX 179 #endif 180