1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ImplChartModel.hxx,v $
10 * $Revision: 1.10.44.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef CHART_IMPLCHARTMODEL_HXX
31 #define CHART_IMPLCHARTMODEL_HXX
33 #include <com/sun/star/chart2/data/XDataSource.hpp>
34 #include <com/sun/star/chart2/XDataSeries.hpp>
35 #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
36 #include <com/sun/star/chart2/XDiagram.hpp>
37 #include <com/sun/star/chart2/data/XDataProvider.hpp>
38 #include <com/sun/star/chart2/XChartTypeManager.hpp>
39 #include <com/sun/star/chart2/XChartTypeTemplate.hpp>
40 #include <com/sun/star/chart2/XTitle.hpp>
41 #include <com/sun/star/chart2/XChartDocument.hpp>
42 #include <com/sun/star/chart2/XUndoManager.hpp>
44 #include <com/sun/star/container/XNameContainer.hpp>
45 #include <com/sun/star/container/NoSuchElementException.hpp>
46 #include <com/sun/star/io/IOException.hpp>
47 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
49 #include <cppuhelper/weakref.hxx>
51 #include "ChartData.hxx"
55 #include <boost/shared_ptr.hpp>
57 namespace com
{ namespace sun
{ namespace star
{
62 class XComponentContext
;
71 class XModifyListener
;
75 class SvNumberFormatter
;
84 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::data::XDataSource
> tDataSourceType
;
87 ImplChartModel( ::com::sun::star::uno::Reference
<
88 ::com::sun::star::uno::XComponentContext
> const & xContext
,
89 const ::com::sun::star::uno::Reference
<
90 ::com::sun::star::util::XModifyListener
> & xListener
);
91 explicit ImplChartModel( const ImplChartModel
& rOther
,
92 const ::com::sun::star::uno::Reference
<
93 ::com::sun::star::util::XModifyListener
> & xListener
);
96 // ::com::sun::star::uno::Sequence<
97 // ::com::sun::star::uno::Reference<
98 // ::com::sun::star::chart2::XDataSeries > >
99 // GetDataSeries() const;
101 ::com::sun::star::uno::Reference
<
102 ::com::sun::star::container::XNameAccess
>
106 void RemoveAllDiagrams();
107 /** @return true, if the chart was found and removed, false otherwise.
109 void AppendDiagram( const ::com::sun::star::uno::Reference
<
110 ::com::sun::star::chart2::XDiagram
> & xDiagram
);
111 ::com::sun::star::uno::Reference
<
112 ::com::sun::star::chart2::XDiagram
>
113 GetDiagram( size_t nIndex
) const
114 throw( ::com::sun::star::container::NoSuchElementException
);
116 void SetDataProvider( const ::com::sun::star::uno::Reference
<
117 ::com::sun::star::chart2::data::XDataProvider
> & xProvider
);
119 ::com::sun::star::uno::Reference
<
120 ::com::sun::star::chart2::data::XDataProvider
> GetDataProvider() const;
122 void CreateInternalDataProvider(
123 bool bCloneExistingData
,
124 const ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartDocument
> & xChartDoc
);
126 bool HasInternalDataProvider() const;
128 ::com::sun::star::uno::Reference
<
129 ::com::sun::star::chart2::data::XDataSource
> SAL_CALL
SetArguments(
130 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> & rArgs
,
132 throw (::com::sun::star::lang::IllegalArgumentException
);
134 void SetChartTypeManager(
135 const ::com::sun::star::uno::Reference
<
136 ::com::sun::star::chart2::XChartTypeManager
> & xManager
);
138 ::com::sun::star::uno::Reference
<
139 ::com::sun::star::chart2::XChartTypeManager
>
140 GetChartTypeManager();
142 ::com::sun::star::uno::Reference
<
143 ::com::sun::star::chart2::XChartTypeTemplate
>
144 GetChartTypeTemplate();
146 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XTitle
>
149 void SetTitle( const ::com::sun::star::uno::Reference
<
150 ::com::sun::star::chart2::XTitle
>& rTitle
);
152 /** Is called by the ChartModel's XComponent::dispose() to notify the
153 impl-class to release resources
157 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
160 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XUndoManager
>
163 void CreateDefaultChart();
165 ::com::sun::star::uno::Reference
<
166 ::com::sun::star::uno::XInterface
> GetDashTable() const;
167 ::com::sun::star::uno::Reference
<
168 ::com::sun::star::uno::XInterface
> GetGradientTable() const;
169 ::com::sun::star::uno::Reference
<
170 ::com::sun::star::uno::XInterface
> GetHatchTable() const;
171 ::com::sun::star::uno::Reference
<
172 ::com::sun::star::uno::XInterface
> GetBitmapTable() const;
173 ::com::sun::star::uno::Reference
<
174 ::com::sun::star::uno::XInterface
> GetTransparencyGradientTable() const;
176 ::com::sun::star::uno::Reference
<
177 ::com::sun::star::uno::XInterface
> GetXMLNameSpaceMap() const;
179 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XNumberFormatsSupplier
>
180 GetNumberFormatsSupplier();
182 void SetNumberFormatsSupplier(
183 const ::com::sun::star::uno::Reference
<
184 ::com::sun::star::util::XNumberFormatsSupplier
> & xNumberFormatsSupplier
);
187 void CreateDefaultChartTypeTemplate();
188 ::com::sun::star::uno::Reference
<
189 ::com::sun::star::chart2::data::XDataSource
> CreateDefaultData();
190 void SetNewData( const ::com::sun::star::uno::Reference
<
191 ::com::sun::star::chart2::data::XDataSource
> & xDataSource
,
192 const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> & rArgs
);
193 ::com::sun::star::uno::Reference
<
194 ::com::sun::star::chart2::data::XDataSource
> SAL_CALL
SetRangeRepresentation(
195 const ::rtl::OUString
& rRangeRepresentation
, bool bSetData
)
196 throw (::com::sun::star::lang::IllegalArgumentException
);
198 // void CreateDefaultLayout();
200 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
201 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xFamilies
;
203 ::boost::shared_ptr
< ChartData
> m_spChartData
;
205 // Data Access (deprecated, temporary solution)
206 // ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource > m_xChartData;
207 // ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > m_xDataProvider;
209 // ::std::vector< ::com::sun::star::uno::Reference<
210 // ::com::sun::star::chart2::XDataSeries > > m_aInterpretedData;
212 ::com::sun::star::uno::Reference
< com::sun::star::util::XNumberFormatsSupplier
>
213 m_xOwnNumberFormatsSupplier
;
214 ::com::sun::star::uno::Reference
< com::sun::star::util::XNumberFormatsSupplier
>
215 m_xNumberFormatsSupplier
;
217 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartTypeManager
>
219 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartTypeTemplate
>
220 m_xChartTypeTemplate
;
223 typedef ::std::vector
< ::com::sun::star::uno::Reference
<
224 ::com::sun::star::chart2::XDiagram
> >
227 tDiagramContainer m_aDiagrams
;
229 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XTitle
>
233 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
235 ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XUndoManager
>
238 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> m_xDashTable
;
239 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> m_xGradientTable
;
240 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> m_xHatchTable
;
241 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> m_xBitmapTable
;
242 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameContainer
> m_xTransparencyGradientTable
;
244 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> m_xXMLNamespaceMap
;
246 ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
> m_xModifyListener
;
252 // CHART_IMPLCHARTMODEL_HXX