1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef SC_VBA_CHART_HXX 24 #define SC_VBA_CHART_HXX 25 #include <cppuhelper/implbase1.hxx> 26 #include <com/sun/star/uno/XComponentContext.hpp> 27 #include <com/sun/star/table/XTableChart.hpp> 28 #include <com/sun/star/chart/XChartDocument.hpp> 29 #include <com/sun/star/chart/XAxisXSupplier.hpp> 30 #include <com/sun/star/chart/XAxisYSupplier.hpp> 31 #include <com/sun/star/chart/XAxisZSupplier.hpp> 32 #include <com/sun/star/chart/XTwoAxisXSupplier.hpp> 33 #include <com/sun/star/chart/XTwoAxisYSupplier.hpp> 34 #include <ooo/vba/excel/XChart.hpp> 35 #include <ooo/vba/excel/XDataLabels.hpp> 36 #include <ooo/vba/excel/XSeries.hpp> 37 #include <vbahelper/vbahelperinterface.hxx> 38 39 typedef InheritedHelperInterfaceImpl1<ov::excel::XChart > ChartImpl_BASE; 40 41 class ScVbaChart : public ChartImpl_BASE 42 { 43 friend class ScVbaAxis; 44 45 css::uno::Reference< css::chart::XChartDocument > mxChartDocument; 46 css::uno::Reference< css::table::XTableChart > mxTableChart; 47 css::uno::Reference< css::beans::XPropertySet > mxDiagramPropertySet; 48 css::uno::Reference< css::beans::XPropertySet > mxChartPropertySet; 49 css::uno::Reference< css::chart::XAxisXSupplier > xAxisXSupplier; 50 css::uno::Reference< css::chart::XAxisYSupplier> xAxisYSupplier; 51 css::uno::Reference< css::chart::XAxisZSupplier > xAxisZSupplier; 52 css::uno::Reference< css::chart::XTwoAxisXSupplier > xTwoAxisXSupplier; 53 css::uno::Reference< css::chart::XTwoAxisYSupplier > xTwoAxisYSupplier; 54 55 css::uno::Sequence< rtl::OUString > getDefaultSeriesDescriptions( sal_Int32 nCount ); 56 css::uno::Sequence< css::uno::Sequence< double > > dblValues; 57 void setDefaultChartType() ; 58 void setDiagram( const rtl::OUString& _sDiagramType); 59 bool isStacked(); 60 bool is100PercentStacked(); 61 sal_Int32 getStackedType( sal_Int32 _nStacked, sal_Int32 _n100PercentStacked, sal_Int32 _nUnStacked ); 62 sal_Int32 getSolidType(sal_Int32 _nDeep, sal_Int32 _nVertiStacked, sal_Int32 _nVerti100PercentStacked, sal_Int32 _nVertiUnStacked, sal_Int32 _nHoriStacked, sal_Int32 _nHori100PercentStacked, sal_Int32 _nHoriUnStacked); 63 sal_Int32 getStockUpDownValue(sal_Int32 _nUpDown, sal_Int32 _nNotUpDown); 64 bool hasMarkers(); 65 sal_Int32 getMarkerType(sal_Int32 _nWithMarkers, sal_Int32 _nWithoutMarkers); 66 void assignDiagramAttributes(); setDefaultSeriesDescriptionLabels()67 void setDefaultSeriesDescriptionLabels(){} 68 public: 69 ScVbaChart( const css::uno::Reference< ov::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext, const css::uno::Reference< css::lang::XComponent >& _xChartComponent, const css::uno::Reference< css::table::XTableChart >& _xTableChart ); 70 71 // Non-interface xDiagramPropertySet()72 css::uno::Reference< css::beans::XPropertySet > xDiagramPropertySet() { return mxDiagramPropertySet; } 73 bool isSeriesIndexValid(sal_Int32 _seriesindex); 74 bool areIndicesValid(sal_Int32 _seriesindex, sal_Int32 _valindex); 75 void setSeriesName(sal_Int32 _index, rtl::OUString _sname); 76 sal_Int32 getSeriesIndex(rtl::OUString _sseriesname); 77 sal_Int32 getSeriesCount(); 78 rtl::OUString getSeriesName(sal_Int32 _index); 79 double getValue(sal_Int32 _seriesIndex, sal_Int32 _valindex); 80 sal_Int32 getValuesCount(sal_Int32 _seriesIndex); 81 css::uno::Reference< ov::excel::XDataLabels > DataLabels( const css::uno::Reference< ov::excel::XSeries > _oSeries ); 82 bool getHasDataCaption( const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet ); 83 void setHasDataCaption( const css::uno::Reference< css::beans::XPropertySet >& _xPropertySet, bool _bHasDataLabels ); 84 bool is3D(); 85 css::uno::Reference< css::beans::XPropertySet > getAxisPropertySet(sal_Int32 _nAxisType, sal_Int32 _nAxisGroup); 86 // Methods 87 virtual ::rtl::OUString SAL_CALL getName(); 88 virtual css::uno::Any SAL_CALL SeriesCollection(const css::uno::Any&); 89 virtual ::sal_Int32 SAL_CALL getChartType(); 90 virtual void SAL_CALL setChartType( ::sal_Int32 _charttype ); 91 virtual void SAL_CALL Activate( ); 92 virtual void SAL_CALL setSourceData( const css::uno::Reference< ::ooo::vba::excel::XRange >& range, const css::uno::Any& PlotBy ); 93 virtual ::sal_Int32 SAL_CALL Location( ); 94 virtual ::sal_Int32 SAL_CALL getLocation( ); 95 virtual void SAL_CALL setLocation( ::sal_Int32 where, const css::uno::Any& Name ); 96 virtual ::sal_Bool SAL_CALL getHasTitle( ); 97 virtual void SAL_CALL setHasTitle( ::sal_Bool bTitle ); 98 virtual ::sal_Bool SAL_CALL getHasLegend( ); 99 virtual void SAL_CALL setHasLegend( ::sal_Bool bLegend ); 100 virtual void SAL_CALL setPlotBy( ::sal_Int32 xlRowCol ); 101 virtual ::sal_Int32 SAL_CALL getPlotBy( ); 102 virtual css::uno::Reference< ov::excel::XChartTitle > SAL_CALL getChartTitle( ); 103 virtual css::uno::Any SAL_CALL Axes( const css::uno::Any& Type, const css::uno::Any& AxisGroup ); 104 // XHelperInterface 105 virtual rtl::OUString& getServiceImplName(); 106 virtual css::uno::Sequence<rtl::OUString> getServiceNames(); 107 108 }; 109 110 #endif //SC_VBA_WINDOW_HXX 111