1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_chart2.hxx"
30*cdf0e10cSrcweir #include "ChartDocumentWrapper.hxx"
31*cdf0e10cSrcweir #include "macros.hxx"
32*cdf0e10cSrcweir #include "servicenames.hxx"
33*cdf0e10cSrcweir #include "PropertyHelper.hxx"
34*cdf0e10cSrcweir #include "TitleHelper.hxx"
35*cdf0e10cSrcweir #include "LegendHelper.hxx"
36*cdf0e10cSrcweir #include "ControllerLockGuard.hxx"
37*cdf0e10cSrcweir #include "ModifyListenerHelper.hxx"
38*cdf0e10cSrcweir #include "DisposeHelper.hxx"
39*cdf0e10cSrcweir #include "DataSeriesPointWrapper.hxx"
40*cdf0e10cSrcweir #include "chartview/ExplicitValueProvider.hxx"
41*cdf0e10cSrcweir #include "chartview/DrawModelWrapper.hxx"
42*cdf0e10cSrcweir #include "Chart2ModelContact.hxx"
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir #include "DiagramHelper.hxx"
45*cdf0e10cSrcweir #include "DataSourceHelper.hxx"
46*cdf0e10cSrcweir #include "ChartModelHelper.hxx"
47*cdf0e10cSrcweir #include "ContainerHelper.hxx"
48*cdf0e10cSrcweir #include "AxisHelper.hxx"
49*cdf0e10cSrcweir #include "ThreeDHelper.hxx"
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir #include "TitleWrapper.hxx"
52*cdf0e10cSrcweir #include "ChartDataWrapper.hxx"
53*cdf0e10cSrcweir #include "DiagramWrapper.hxx"
54*cdf0e10cSrcweir #include "LegendWrapper.hxx"
55*cdf0e10cSrcweir #include "AreaWrapper.hxx"
56*cdf0e10cSrcweir #include "WrappedAddInProperty.hxx"
57*cdf0e10cSrcweir #include "WrappedIgnoreProperty.hxx"
58*cdf0e10cSrcweir #include "ChartRenderer.hxx"
59*cdf0e10cSrcweir #include <com/sun/star/chart2/XTitled.hpp>
60*cdf0e10cSrcweir #include <com/sun/star/chart2/data/XDataReceiver.hpp>
61*cdf0e10cSrcweir #include <com/sun/star/chart/ChartDataRowSource.hpp>
62*cdf0e10cSrcweir #include <comphelper/InlineContainer.hxx>
63*cdf0e10cSrcweir // header for function SvxShapeCollection_NewInstance
64*cdf0e10cSrcweir #include <svx/unoshcol.hxx>
65*cdf0e10cSrcweir // header for define DBG_ASSERT
66*cdf0e10cSrcweir #include <tools/debug.hxx>
67*cdf0e10cSrcweir #include <vcl/svapp.hxx>
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
70*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
71*cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp>
72*cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
73*cdf0e10cSrcweir #include <com/sun/star/util/DateTime.hpp>
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir #include <vector>
76*cdf0e10cSrcweir #include <algorithm>
77*cdf0e10cSrcweir #include <functional>
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir using namespace ::com::sun::star;
80*cdf0e10cSrcweir using namespace ::com::sun::star::chart;
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir using ::com::sun::star::uno::Any;
83*cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY_THROW;
84*cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
85*cdf0e10cSrcweir using ::com::sun::star::uno::Sequence;
86*cdf0e10cSrcweir using ::com::sun::star::beans::Property;
87*cdf0e10cSrcweir using ::osl::MutexGuard;
88*cdf0e10cSrcweir using ::rtl::OUString;
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir namespace
91*cdf0e10cSrcweir {
92*cdf0e10cSrcweir enum eServiceType
93*cdf0e10cSrcweir {
94*cdf0e10cSrcweir     SERVICE_NAME_AREA_DIAGRAM = 0,
95*cdf0e10cSrcweir     SERVICE_NAME_BAR_DIAGRAM,
96*cdf0e10cSrcweir     SERVICE_NAME_DONUT_DIAGRAM,
97*cdf0e10cSrcweir     SERVICE_NAME_LINE_DIAGRAM,
98*cdf0e10cSrcweir     SERVICE_NAME_NET_DIAGRAM,
99*cdf0e10cSrcweir     SERVICE_NAME_FILLED_NET_DIAGRAM,
100*cdf0e10cSrcweir     SERVICE_NAME_PIE_DIAGRAM,
101*cdf0e10cSrcweir     SERVICE_NAME_STOCK_DIAGRAM,
102*cdf0e10cSrcweir     SERVICE_NAME_XY_DIAGRAM,
103*cdf0e10cSrcweir     SERVICE_NAME_BUBBLE_DIAGRAM,
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir     SERVICE_NAME_DASH_TABLE,
106*cdf0e10cSrcweir     SERVICE_NAME_GARDIENT_TABLE,
107*cdf0e10cSrcweir     SERVICE_NAME_HATCH_TABLE,
108*cdf0e10cSrcweir     SERVICE_NAME_BITMAP_TABLE,
109*cdf0e10cSrcweir     SERVICE_NAME_TRANSP_GRADIENT_TABLE,
110*cdf0e10cSrcweir     SERVICE_NAME_MARKER_TABLE,
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir     SERVICE_NAME_NAMESPACE_MAP,
113*cdf0e10cSrcweir     SERVICE_NAME_EXPORT_GRAPHIC_RESOLVER,
114*cdf0e10cSrcweir     SERVICE_NAME_IMPORT_GRAPHIC_RESOLVER
115*cdf0e10cSrcweir };
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir typedef ::std::map< ::rtl::OUString, enum eServiceType > tServiceNameMap;
118*cdf0e10cSrcweir typedef ::comphelper::MakeMap< ::rtl::OUString, enum eServiceType > tMakeServiceNameMap;
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir tServiceNameMap & lcl_getStaticServiceNameMap()
121*cdf0e10cSrcweir {
122*cdf0e10cSrcweir     static tServiceNameMap aServiceNameMap(
123*cdf0e10cSrcweir         tMakeServiceNameMap
124*cdf0e10cSrcweir         ( C2U( "com.sun.star.chart.AreaDiagram" ),                    SERVICE_NAME_AREA_DIAGRAM )
125*cdf0e10cSrcweir         ( C2U( "com.sun.star.chart.BarDiagram" ),                     SERVICE_NAME_BAR_DIAGRAM )
126*cdf0e10cSrcweir         ( C2U( "com.sun.star.chart.DonutDiagram" ),                   SERVICE_NAME_DONUT_DIAGRAM )
127*cdf0e10cSrcweir         ( C2U( "com.sun.star.chart.LineDiagram" ),                    SERVICE_NAME_LINE_DIAGRAM )
128*cdf0e10cSrcweir         ( C2U( "com.sun.star.chart.NetDiagram" ),                     SERVICE_NAME_NET_DIAGRAM )
129*cdf0e10cSrcweir         ( C2U( "com.sun.star.chart.FilledNetDiagram" ),               SERVICE_NAME_FILLED_NET_DIAGRAM )
130*cdf0e10cSrcweir         ( C2U( "com.sun.star.chart.PieDiagram" ),                     SERVICE_NAME_PIE_DIAGRAM )
131*cdf0e10cSrcweir         ( C2U( "com.sun.star.chart.StockDiagram" ),                   SERVICE_NAME_STOCK_DIAGRAM )
132*cdf0e10cSrcweir         ( C2U( "com.sun.star.chart.XYDiagram" ),                      SERVICE_NAME_XY_DIAGRAM )
133*cdf0e10cSrcweir         ( C2U( "com.sun.star.chart.BubbleDiagram" ),                  SERVICE_NAME_BUBBLE_DIAGRAM )
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir         ( C2U( "com.sun.star.drawing.DashTable" ),                    SERVICE_NAME_DASH_TABLE )
136*cdf0e10cSrcweir         ( C2U( "com.sun.star.drawing.GradientTable" ),                SERVICE_NAME_GARDIENT_TABLE )
137*cdf0e10cSrcweir         ( C2U( "com.sun.star.drawing.HatchTable" ),                   SERVICE_NAME_HATCH_TABLE )
138*cdf0e10cSrcweir         ( C2U( "com.sun.star.drawing.BitmapTable" ),                  SERVICE_NAME_BITMAP_TABLE )
139*cdf0e10cSrcweir         ( C2U( "com.sun.star.drawing.TransparencyGradientTable" ),    SERVICE_NAME_TRANSP_GRADIENT_TABLE )
140*cdf0e10cSrcweir         ( C2U( "com.sun.star.drawing.MarkerTable" ),                  SERVICE_NAME_MARKER_TABLE )
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir         ( C2U( "com.sun.star.xml.NamespaceMap" ),                     SERVICE_NAME_NAMESPACE_MAP )
143*cdf0e10cSrcweir         ( C2U( "com.sun.star.document.ExportGraphicObjectResolver" ), SERVICE_NAME_EXPORT_GRAPHIC_RESOLVER )
144*cdf0e10cSrcweir         ( C2U( "com.sun.star.document.ImportGraphicObjectResolver" ), SERVICE_NAME_IMPORT_GRAPHIC_RESOLVER )
145*cdf0e10cSrcweir         );
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir     return aServiceNameMap;
148*cdf0e10cSrcweir }
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir enum
151*cdf0e10cSrcweir {
152*cdf0e10cSrcweir     PROP_DOCUMENT_HAS_MAIN_TITLE,
153*cdf0e10cSrcweir     PROP_DOCUMENT_HAS_SUB_TITLE,
154*cdf0e10cSrcweir     PROP_DOCUMENT_HAS_LEGEND,
155*cdf0e10cSrcweir     PROP_DOCUMENT_LABELS_IN_FIRST_ROW,
156*cdf0e10cSrcweir     PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN,
157*cdf0e10cSrcweir     PROP_DOCUMENT_ADDIN,
158*cdf0e10cSrcweir     PROP_DOCUMENT_BASEDIAGRAM,
159*cdf0e10cSrcweir     PROP_DOCUMENT_ADDITIONAL_SHAPES,
160*cdf0e10cSrcweir     PROP_DOCUMENT_UPDATE_ADDIN,
161*cdf0e10cSrcweir     PROP_DOCUMENT_NULL_DATE,
162*cdf0e10cSrcweir     PROP_DOCUMENT_DISABLE_COMPLEX_CHARTTYPES,
163*cdf0e10cSrcweir     PROP_DOCUMENT_DISABLE_DATATABLE_DIALOG
164*cdf0e10cSrcweir };
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir void lcl_AddPropertiesToVector(
167*cdf0e10cSrcweir     ::std::vector< Property > & rOutProperties )
168*cdf0e10cSrcweir {
169*cdf0e10cSrcweir     rOutProperties.push_back(
170*cdf0e10cSrcweir         Property( C2U( "HasMainTitle" ),
171*cdf0e10cSrcweir                   PROP_DOCUMENT_HAS_MAIN_TITLE,
172*cdf0e10cSrcweir                   ::getBooleanCppuType(),
173*cdf0e10cSrcweir                   //#i111967# no PropertyChangeEvent is fired on change so far
174*cdf0e10cSrcweir                   beans::PropertyAttribute::MAYBEDEFAULT ));
175*cdf0e10cSrcweir     rOutProperties.push_back(
176*cdf0e10cSrcweir         Property( C2U( "HasSubTitle" ),
177*cdf0e10cSrcweir                   PROP_DOCUMENT_HAS_SUB_TITLE,
178*cdf0e10cSrcweir                   ::getBooleanCppuType(),
179*cdf0e10cSrcweir                   //#i111967# no PropertyChangeEvent is fired on change so far
180*cdf0e10cSrcweir                   beans::PropertyAttribute::MAYBEDEFAULT ));
181*cdf0e10cSrcweir     rOutProperties.push_back(
182*cdf0e10cSrcweir         Property( C2U( "HasLegend" ),
183*cdf0e10cSrcweir                   PROP_DOCUMENT_HAS_LEGEND,
184*cdf0e10cSrcweir                   ::getBooleanCppuType(),
185*cdf0e10cSrcweir                   //#i111967# no PropertyChangeEvent is fired on change so far
186*cdf0e10cSrcweir                   beans::PropertyAttribute::MAYBEDEFAULT ));
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir     // really needed?
189*cdf0e10cSrcweir     rOutProperties.push_back(
190*cdf0e10cSrcweir         Property( C2U( "DataSourceLabelsInFirstRow" ),
191*cdf0e10cSrcweir                   PROP_DOCUMENT_LABELS_IN_FIRST_ROW,
192*cdf0e10cSrcweir                   ::getBooleanCppuType(),
193*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
194*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEDEFAULT ));
195*cdf0e10cSrcweir     rOutProperties.push_back(
196*cdf0e10cSrcweir         Property( C2U( "DataSourceLabelsInFirstColumn" ),
197*cdf0e10cSrcweir                   PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN,
198*cdf0e10cSrcweir                   ::getBooleanCppuType(),
199*cdf0e10cSrcweir                   //#i111967# no PropertyChangeEvent is fired on change so far
200*cdf0e10cSrcweir                   beans::PropertyAttribute::MAYBEDEFAULT ));
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir     //add-in
203*cdf0e10cSrcweir     rOutProperties.push_back(
204*cdf0e10cSrcweir         Property( C2U( "AddIn" ),
205*cdf0e10cSrcweir                   PROP_DOCUMENT_ADDIN,
206*cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< Reference< util::XRefreshable > * >(0)),
207*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
208*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEVOID ));
209*cdf0e10cSrcweir     rOutProperties.push_back(
210*cdf0e10cSrcweir         Property( C2U( "BaseDiagram" ),
211*cdf0e10cSrcweir                   PROP_DOCUMENT_BASEDIAGRAM,
212*cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
213*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
214*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEVOID ));
215*cdf0e10cSrcweir     rOutProperties.push_back(
216*cdf0e10cSrcweir         Property( C2U( "AdditionalShapes" ),
217*cdf0e10cSrcweir                   PROP_DOCUMENT_ADDITIONAL_SHAPES,
218*cdf0e10cSrcweir                   ::getCppuType( reinterpret_cast< Reference< drawing::XShapes > * >(0)),
219*cdf0e10cSrcweir                   beans::PropertyAttribute::BOUND
220*cdf0e10cSrcweir                   | beans::PropertyAttribute::MAYBEVOID
221*cdf0e10cSrcweir                   | beans::PropertyAttribute::READONLY ));
222*cdf0e10cSrcweir     rOutProperties.push_back(
223*cdf0e10cSrcweir         Property( C2U( "RefreshAddInAllowed" ),
224*cdf0e10cSrcweir                   PROP_DOCUMENT_UPDATE_ADDIN,
225*cdf0e10cSrcweir                   ::getBooleanCppuType(),
226*cdf0e10cSrcweir                   //#i111967# no PropertyChangeEvent is fired on change so far
227*cdf0e10cSrcweir                   beans::PropertyAttribute::TRANSIENT ));
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir     // table:null-date // i99104
230*cdf0e10cSrcweir     rOutProperties.push_back(
231*cdf0e10cSrcweir         Property( C2U( "NullDate" ),
232*cdf0e10cSrcweir                   PROP_DOCUMENT_NULL_DATE,
233*cdf0e10cSrcweir                   ::getCppuType( static_cast< const ::com::sun::star::util::DateTime * >(0)),
234*cdf0e10cSrcweir                   beans::PropertyAttribute::MAYBEVOID ));
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir     rOutProperties.push_back(
237*cdf0e10cSrcweir         Property( C2U( "DisableComplexChartTypes" ),
238*cdf0e10cSrcweir                   PROP_DOCUMENT_DISABLE_COMPLEX_CHARTTYPES,
239*cdf0e10cSrcweir                   ::getBooleanCppuType(),
240*cdf0e10cSrcweir                   //#i112666# no PropertyChangeEvent is fired on change so far
241*cdf0e10cSrcweir                   beans::PropertyAttribute::MAYBEDEFAULT ) );
242*cdf0e10cSrcweir     rOutProperties.push_back(
243*cdf0e10cSrcweir         Property( C2U( "DisableDataTableDialog" ),
244*cdf0e10cSrcweir                   PROP_DOCUMENT_DISABLE_DATATABLE_DIALOG,
245*cdf0e10cSrcweir                   ::getBooleanCppuType(),
246*cdf0e10cSrcweir                   //#i112666# no PropertyChangeEvent is fired on change so far
247*cdf0e10cSrcweir                   beans::PropertyAttribute::MAYBEDEFAULT ) );
248*cdf0e10cSrcweir }
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir struct StaticChartDocumentWrapperPropertyArray_Initializer
251*cdf0e10cSrcweir {
252*cdf0e10cSrcweir     Sequence< Property >* operator()()
253*cdf0e10cSrcweir     {
254*cdf0e10cSrcweir         static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
255*cdf0e10cSrcweir         return &aPropSeq;
256*cdf0e10cSrcweir     }
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir private:
259*cdf0e10cSrcweir     uno::Sequence< Property > lcl_GetPropertySequence()
260*cdf0e10cSrcweir     {
261*cdf0e10cSrcweir         ::std::vector< ::com::sun::star::beans::Property > aProperties;
262*cdf0e10cSrcweir         lcl_AddPropertiesToVector( aProperties );
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir         ::std::sort( aProperties.begin(), aProperties.end(),
265*cdf0e10cSrcweir                      ::chart::PropertyNameLess() );
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir         return ::chart::ContainerHelper::ContainerToSequence( aProperties );
268*cdf0e10cSrcweir     }
269*cdf0e10cSrcweir };
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir struct StaticChartDocumentWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticChartDocumentWrapperPropertyArray_Initializer >
272*cdf0e10cSrcweir {
273*cdf0e10cSrcweir };
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir } //  anonymous namespace
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir namespace chart
278*cdf0e10cSrcweir {
279*cdf0e10cSrcweir namespace wrapper
280*cdf0e10cSrcweir {
281*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
282*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
283*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir //PROP_DOCUMENT_LABELS_IN_FIRST_ROW
286*cdf0e10cSrcweir class WrappedDataSourceLabelsInFirstRowProperty : public WrappedProperty
287*cdf0e10cSrcweir {
288*cdf0e10cSrcweir public:
289*cdf0e10cSrcweir     WrappedDataSourceLabelsInFirstRowProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
290*cdf0e10cSrcweir     virtual ~WrappedDataSourceLabelsInFirstRowProperty();
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
293*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
296*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
299*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir private: //member
302*cdf0e10cSrcweir     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
303*cdf0e10cSrcweir     mutable Any                                 m_aOuterValue;
304*cdf0e10cSrcweir };
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir WrappedDataSourceLabelsInFirstRowProperty::WrappedDataSourceLabelsInFirstRowProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
307*cdf0e10cSrcweir             : WrappedProperty(C2U("DataSourceLabelsInFirstRow"),OUString())
308*cdf0e10cSrcweir             , m_spChart2ModelContact( spChart2ModelContact )
309*cdf0e10cSrcweir             , m_aOuterValue()
310*cdf0e10cSrcweir {
311*cdf0e10cSrcweir     m_aOuterValue = WrappedDataSourceLabelsInFirstRowProperty::getPropertyDefault( 0 );
312*cdf0e10cSrcweir }
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir WrappedDataSourceLabelsInFirstRowProperty::~WrappedDataSourceLabelsInFirstRowProperty()
315*cdf0e10cSrcweir {
316*cdf0e10cSrcweir }
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir void WrappedDataSourceLabelsInFirstRowProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
319*cdf0e10cSrcweir                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
320*cdf0e10cSrcweir {
321*cdf0e10cSrcweir     sal_Bool bLabelsInFirstRow = sal_True;
322*cdf0e10cSrcweir     if( ! (rOuterValue >>= bLabelsInFirstRow) )
323*cdf0e10cSrcweir         throw lang::IllegalArgumentException( C2U("Property DataSourceLabelsInFirstRow requires value of type boolean"), 0, 0 );
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir     m_aOuterValue = rOuterValue;
326*cdf0e10cSrcweir     bool bNewValue = bLabelsInFirstRow;
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir     ::rtl::OUString aRangeString;
329*cdf0e10cSrcweir     bool bUseColumns = true;
330*cdf0e10cSrcweir     bool bFirstCellAsLabel = true;
331*cdf0e10cSrcweir     bool bHasCategories = true;
332*cdf0e10cSrcweir     uno::Sequence< sal_Int32 > aSequenceMapping;
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir     if( DataSourceHelper::detectRangeSegmentation(
335*cdf0e10cSrcweir             m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
336*cdf0e10cSrcweir             , bFirstCellAsLabel, bHasCategories ) )
337*cdf0e10cSrcweir     {
338*cdf0e10cSrcweir         if( bUseColumns && bNewValue != bFirstCellAsLabel )
339*cdf0e10cSrcweir         {
340*cdf0e10cSrcweir             DataSourceHelper::setRangeSegmentation(
341*cdf0e10cSrcweir                 m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns ,bNewValue, bHasCategories );
342*cdf0e10cSrcweir         }
343*cdf0e10cSrcweir         else if( !bUseColumns && bNewValue != bHasCategories )
344*cdf0e10cSrcweir         {
345*cdf0e10cSrcweir             DataSourceHelper::setRangeSegmentation(
346*cdf0e10cSrcweir                 m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns , bFirstCellAsLabel, bNewValue );
347*cdf0e10cSrcweir         }
348*cdf0e10cSrcweir     }
349*cdf0e10cSrcweir }
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir Any WrappedDataSourceLabelsInFirstRowProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
352*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
353*cdf0e10cSrcweir {
354*cdf0e10cSrcweir     ::rtl::OUString aRangeString;
355*cdf0e10cSrcweir     bool bUseColumns = true;
356*cdf0e10cSrcweir     bool bFirstCellAsLabel = true;
357*cdf0e10cSrcweir     bool bHasCategories = true;
358*cdf0e10cSrcweir     uno::Sequence< sal_Int32 > aSequenceMapping;
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir     if( DataSourceHelper::detectRangeSegmentation(
361*cdf0e10cSrcweir             m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
362*cdf0e10cSrcweir             , bFirstCellAsLabel, bHasCategories ) )
363*cdf0e10cSrcweir     {
364*cdf0e10cSrcweir         sal_Bool bLabelsInFirstRow = sal_True;
365*cdf0e10cSrcweir         if( bUseColumns )
366*cdf0e10cSrcweir             bLabelsInFirstRow = bFirstCellAsLabel;
367*cdf0e10cSrcweir         else
368*cdf0e10cSrcweir             bLabelsInFirstRow = bHasCategories;
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir         m_aOuterValue <<= bLabelsInFirstRow;
371*cdf0e10cSrcweir     }
372*cdf0e10cSrcweir     return m_aOuterValue;
373*cdf0e10cSrcweir }
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir Any WrappedDataSourceLabelsInFirstRowProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
376*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
377*cdf0e10cSrcweir {
378*cdf0e10cSrcweir     Any aRet;
379*cdf0e10cSrcweir     aRet <<= sal_True;
380*cdf0e10cSrcweir     return aRet;
381*cdf0e10cSrcweir }
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
384*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
385*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir //PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN
388*cdf0e10cSrcweir class WrappedDataSourceLabelsInFirstColumnProperty : public WrappedProperty
389*cdf0e10cSrcweir {
390*cdf0e10cSrcweir public:
391*cdf0e10cSrcweir     WrappedDataSourceLabelsInFirstColumnProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
392*cdf0e10cSrcweir     virtual ~WrappedDataSourceLabelsInFirstColumnProperty();
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
395*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
398*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
401*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir private: //member
404*cdf0e10cSrcweir     ::boost::shared_ptr< Chart2ModelContact >   m_spChart2ModelContact;
405*cdf0e10cSrcweir     mutable Any                                 m_aOuterValue;
406*cdf0e10cSrcweir };
407*cdf0e10cSrcweir 
408*cdf0e10cSrcweir WrappedDataSourceLabelsInFirstColumnProperty::WrappedDataSourceLabelsInFirstColumnProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
409*cdf0e10cSrcweir             : WrappedProperty(C2U("DataSourceLabelsInFirstColumn"),OUString())
410*cdf0e10cSrcweir             , m_spChart2ModelContact( spChart2ModelContact )
411*cdf0e10cSrcweir             , m_aOuterValue()
412*cdf0e10cSrcweir {
413*cdf0e10cSrcweir     m_aOuterValue = WrappedDataSourceLabelsInFirstColumnProperty::getPropertyDefault( 0 );
414*cdf0e10cSrcweir }
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir WrappedDataSourceLabelsInFirstColumnProperty::~WrappedDataSourceLabelsInFirstColumnProperty()
417*cdf0e10cSrcweir {
418*cdf0e10cSrcweir }
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir void WrappedDataSourceLabelsInFirstColumnProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
421*cdf0e10cSrcweir                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
422*cdf0e10cSrcweir {
423*cdf0e10cSrcweir     sal_Bool bLabelsInFirstRow = sal_True;
424*cdf0e10cSrcweir     if( ! (rOuterValue >>= bLabelsInFirstRow) )
425*cdf0e10cSrcweir         throw lang::IllegalArgumentException( C2U("Property DataSourceLabelsInFirstRow requires value of type boolean"), 0, 0 );
426*cdf0e10cSrcweir 
427*cdf0e10cSrcweir     m_aOuterValue = rOuterValue;
428*cdf0e10cSrcweir     bool bNewValue = bLabelsInFirstRow;
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir     ::rtl::OUString aRangeString;
431*cdf0e10cSrcweir     bool bUseColumns = true;
432*cdf0e10cSrcweir     bool bFirstCellAsLabel = true;
433*cdf0e10cSrcweir     bool bHasCategories = true;
434*cdf0e10cSrcweir     uno::Sequence< sal_Int32 > aSequenceMapping;
435*cdf0e10cSrcweir 
436*cdf0e10cSrcweir     if( DataSourceHelper::detectRangeSegmentation(
437*cdf0e10cSrcweir             m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
438*cdf0e10cSrcweir             , bFirstCellAsLabel, bHasCategories ) )
439*cdf0e10cSrcweir     {
440*cdf0e10cSrcweir         if( bUseColumns && bNewValue != bHasCategories )
441*cdf0e10cSrcweir         {
442*cdf0e10cSrcweir             DataSourceHelper::setRangeSegmentation(
443*cdf0e10cSrcweir                 m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns, bFirstCellAsLabel, bNewValue );
444*cdf0e10cSrcweir         }
445*cdf0e10cSrcweir         else if( !bUseColumns && bNewValue != bFirstCellAsLabel )
446*cdf0e10cSrcweir         {
447*cdf0e10cSrcweir             DataSourceHelper::setRangeSegmentation(
448*cdf0e10cSrcweir                 m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns , bNewValue, bHasCategories );
449*cdf0e10cSrcweir         }
450*cdf0e10cSrcweir     }
451*cdf0e10cSrcweir }
452*cdf0e10cSrcweir 
453*cdf0e10cSrcweir Any WrappedDataSourceLabelsInFirstColumnProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
454*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
455*cdf0e10cSrcweir {
456*cdf0e10cSrcweir     ::rtl::OUString aRangeString;
457*cdf0e10cSrcweir     bool bUseColumns = true;
458*cdf0e10cSrcweir     bool bFirstCellAsLabel = true;
459*cdf0e10cSrcweir     bool bHasCategories = true;
460*cdf0e10cSrcweir     uno::Sequence< sal_Int32 > aSequenceMapping;
461*cdf0e10cSrcweir 
462*cdf0e10cSrcweir     if( DataSourceHelper::detectRangeSegmentation(
463*cdf0e10cSrcweir             m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
464*cdf0e10cSrcweir             , bFirstCellAsLabel, bHasCategories ) )
465*cdf0e10cSrcweir     {
466*cdf0e10cSrcweir         sal_Bool bLabelsInFirstColumn = sal_True;
467*cdf0e10cSrcweir         if( bUseColumns )
468*cdf0e10cSrcweir             bLabelsInFirstColumn = bHasCategories;
469*cdf0e10cSrcweir         else
470*cdf0e10cSrcweir             bLabelsInFirstColumn = bFirstCellAsLabel;
471*cdf0e10cSrcweir 
472*cdf0e10cSrcweir         m_aOuterValue <<= bLabelsInFirstColumn;
473*cdf0e10cSrcweir     }
474*cdf0e10cSrcweir     return m_aOuterValue;
475*cdf0e10cSrcweir }
476*cdf0e10cSrcweir 
477*cdf0e10cSrcweir Any WrappedDataSourceLabelsInFirstColumnProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
478*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
479*cdf0e10cSrcweir {
480*cdf0e10cSrcweir     Any aRet;
481*cdf0e10cSrcweir     aRet <<= sal_True;
482*cdf0e10cSrcweir     return aRet;
483*cdf0e10cSrcweir }
484*cdf0e10cSrcweir 
485*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
486*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
487*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
488*cdf0e10cSrcweir 
489*cdf0e10cSrcweir //PROP_DOCUMENT_HAS_LEGEND
490*cdf0e10cSrcweir class WrappedHasLegendProperty : public WrappedProperty
491*cdf0e10cSrcweir {
492*cdf0e10cSrcweir public:
493*cdf0e10cSrcweir     WrappedHasLegendProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
494*cdf0e10cSrcweir     virtual ~WrappedHasLegendProperty();
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
497*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
498*cdf0e10cSrcweir 
499*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
500*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
501*cdf0e10cSrcweir 
502*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
503*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
504*cdf0e10cSrcweir 
505*cdf0e10cSrcweir private: //member
506*cdf0e10cSrcweir     ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
507*cdf0e10cSrcweir };
508*cdf0e10cSrcweir 
509*cdf0e10cSrcweir WrappedHasLegendProperty::WrappedHasLegendProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
510*cdf0e10cSrcweir             : WrappedProperty(C2U("HasLegend"),OUString())
511*cdf0e10cSrcweir             , m_spChart2ModelContact( spChart2ModelContact )
512*cdf0e10cSrcweir {
513*cdf0e10cSrcweir }
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir WrappedHasLegendProperty::~WrappedHasLegendProperty()
516*cdf0e10cSrcweir {
517*cdf0e10cSrcweir }
518*cdf0e10cSrcweir 
519*cdf0e10cSrcweir void WrappedHasLegendProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
520*cdf0e10cSrcweir                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
521*cdf0e10cSrcweir {
522*cdf0e10cSrcweir     sal_Bool bNewValue = sal_True;
523*cdf0e10cSrcweir     if( ! (rOuterValue >>= bNewValue) )
524*cdf0e10cSrcweir         throw lang::IllegalArgumentException( C2U("Property HasLegend requires value of type boolean"), 0, 0 );
525*cdf0e10cSrcweir 
526*cdf0e10cSrcweir     try
527*cdf0e10cSrcweir     {
528*cdf0e10cSrcweir         Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext,bNewValue ));
529*cdf0e10cSrcweir         if(xLegend.is())
530*cdf0e10cSrcweir         {
531*cdf0e10cSrcweir             Reference< beans::XPropertySet > xLegendProp( xLegend, uno::UNO_QUERY_THROW );
532*cdf0e10cSrcweir             sal_Bool bOldValue = sal_True;
533*cdf0e10cSrcweir             Any aAOld = xLegendProp->getPropertyValue( C2U("Show") );
534*cdf0e10cSrcweir             aAOld >>= bOldValue;
535*cdf0e10cSrcweir             if( bOldValue != bNewValue )
536*cdf0e10cSrcweir                 xLegendProp->setPropertyValue( C2U("Show"), uno::makeAny( bNewValue ));
537*cdf0e10cSrcweir         }
538*cdf0e10cSrcweir     }
539*cdf0e10cSrcweir     catch( uno::Exception & ex )
540*cdf0e10cSrcweir     {
541*cdf0e10cSrcweir         ASSERT_EXCEPTION( ex );
542*cdf0e10cSrcweir     }
543*cdf0e10cSrcweir }
544*cdf0e10cSrcweir 
545*cdf0e10cSrcweir Any WrappedHasLegendProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
546*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
547*cdf0e10cSrcweir {
548*cdf0e10cSrcweir     Any aRet;
549*cdf0e10cSrcweir     try
550*cdf0e10cSrcweir     {
551*cdf0e10cSrcweir         Reference< beans::XPropertySet > xLegendProp(
552*cdf0e10cSrcweir             LegendHelper::getLegend( m_spChart2ModelContact->getChartModel() ), uno::UNO_QUERY );
553*cdf0e10cSrcweir         if( xLegendProp.is())
554*cdf0e10cSrcweir             aRet = xLegendProp->getPropertyValue( C2U("Show"));
555*cdf0e10cSrcweir         else
556*cdf0e10cSrcweir             aRet <<= sal_False;
557*cdf0e10cSrcweir     }
558*cdf0e10cSrcweir     catch( uno::Exception & ex )
559*cdf0e10cSrcweir     {
560*cdf0e10cSrcweir         ASSERT_EXCEPTION( ex );
561*cdf0e10cSrcweir     }
562*cdf0e10cSrcweir     return aRet;
563*cdf0e10cSrcweir }
564*cdf0e10cSrcweir 
565*cdf0e10cSrcweir Any WrappedHasLegendProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
566*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
567*cdf0e10cSrcweir {
568*cdf0e10cSrcweir     Any aRet;
569*cdf0e10cSrcweir     aRet <<= sal_False;
570*cdf0e10cSrcweir     return aRet;
571*cdf0e10cSrcweir }
572*cdf0e10cSrcweir 
573*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
574*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
575*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
576*cdf0e10cSrcweir 
577*cdf0e10cSrcweir //PROP_DOCUMENT_HAS_MAIN_TITLE
578*cdf0e10cSrcweir class WrappedHasMainTitleProperty : public WrappedProperty
579*cdf0e10cSrcweir {
580*cdf0e10cSrcweir public:
581*cdf0e10cSrcweir     WrappedHasMainTitleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
582*cdf0e10cSrcweir     virtual ~WrappedHasMainTitleProperty();
583*cdf0e10cSrcweir 
584*cdf0e10cSrcweir     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
585*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
586*cdf0e10cSrcweir 
587*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
588*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
589*cdf0e10cSrcweir 
590*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
591*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
592*cdf0e10cSrcweir 
593*cdf0e10cSrcweir private: //member
594*cdf0e10cSrcweir     ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
595*cdf0e10cSrcweir };
596*cdf0e10cSrcweir 
597*cdf0e10cSrcweir WrappedHasMainTitleProperty::WrappedHasMainTitleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
598*cdf0e10cSrcweir             : WrappedProperty(C2U("HasMainTitle"),OUString())
599*cdf0e10cSrcweir             , m_spChart2ModelContact( spChart2ModelContact )
600*cdf0e10cSrcweir {
601*cdf0e10cSrcweir }
602*cdf0e10cSrcweir 
603*cdf0e10cSrcweir WrappedHasMainTitleProperty::~WrappedHasMainTitleProperty()
604*cdf0e10cSrcweir {
605*cdf0e10cSrcweir }
606*cdf0e10cSrcweir 
607*cdf0e10cSrcweir void WrappedHasMainTitleProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
608*cdf0e10cSrcweir                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
609*cdf0e10cSrcweir {
610*cdf0e10cSrcweir     sal_Bool bNewValue = sal_True;
611*cdf0e10cSrcweir     if( ! (rOuterValue >>= bNewValue) )
612*cdf0e10cSrcweir         throw lang::IllegalArgumentException( C2U("Property HasMainTitle requires value of type boolean"), 0, 0 );
613*cdf0e10cSrcweir 
614*cdf0e10cSrcweir     try
615*cdf0e10cSrcweir     {
616*cdf0e10cSrcweir         if( bNewValue )
617*cdf0e10cSrcweir             TitleHelper::createTitle( TitleHelper::MAIN_TITLE, C2U("main-title"), m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
618*cdf0e10cSrcweir         else
619*cdf0e10cSrcweir             TitleHelper::removeTitle( TitleHelper::MAIN_TITLE, m_spChart2ModelContact->getChartModel() );
620*cdf0e10cSrcweir     }
621*cdf0e10cSrcweir     catch( uno::Exception & ex )
622*cdf0e10cSrcweir     {
623*cdf0e10cSrcweir         ASSERT_EXCEPTION( ex );
624*cdf0e10cSrcweir     }
625*cdf0e10cSrcweir }
626*cdf0e10cSrcweir 
627*cdf0e10cSrcweir Any WrappedHasMainTitleProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
628*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
629*cdf0e10cSrcweir {
630*cdf0e10cSrcweir     Any aRet;
631*cdf0e10cSrcweir     try
632*cdf0e10cSrcweir     {
633*cdf0e10cSrcweir         aRet <<= sal_Bool( TitleHelper::getTitle( TitleHelper::MAIN_TITLE, m_spChart2ModelContact->getChartModel() ).is() );
634*cdf0e10cSrcweir     }
635*cdf0e10cSrcweir     catch( uno::Exception & ex )
636*cdf0e10cSrcweir     {
637*cdf0e10cSrcweir         ASSERT_EXCEPTION( ex );
638*cdf0e10cSrcweir     }
639*cdf0e10cSrcweir     return aRet;
640*cdf0e10cSrcweir }
641*cdf0e10cSrcweir 
642*cdf0e10cSrcweir Any WrappedHasMainTitleProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
643*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
644*cdf0e10cSrcweir {
645*cdf0e10cSrcweir     Any aRet;
646*cdf0e10cSrcweir     aRet <<= sal_False;
647*cdf0e10cSrcweir     return aRet;
648*cdf0e10cSrcweir }
649*cdf0e10cSrcweir 
650*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
651*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
652*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
653*cdf0e10cSrcweir 
654*cdf0e10cSrcweir //PROP_DOCUMENT_HAS_SUB_TITLE
655*cdf0e10cSrcweir class WrappedHasSubTitleProperty : public WrappedProperty
656*cdf0e10cSrcweir {
657*cdf0e10cSrcweir public:
658*cdf0e10cSrcweir     WrappedHasSubTitleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
659*cdf0e10cSrcweir     virtual ~WrappedHasSubTitleProperty();
660*cdf0e10cSrcweir 
661*cdf0e10cSrcweir     virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
662*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
663*cdf0e10cSrcweir 
664*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
665*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
666*cdf0e10cSrcweir 
667*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
668*cdf0e10cSrcweir                         throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
669*cdf0e10cSrcweir 
670*cdf0e10cSrcweir private: //member
671*cdf0e10cSrcweir     ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
672*cdf0e10cSrcweir };
673*cdf0e10cSrcweir 
674*cdf0e10cSrcweir WrappedHasSubTitleProperty::WrappedHasSubTitleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
675*cdf0e10cSrcweir             : WrappedProperty(C2U("HasSubTitle"),OUString())
676*cdf0e10cSrcweir             , m_spChart2ModelContact( spChart2ModelContact )
677*cdf0e10cSrcweir {
678*cdf0e10cSrcweir }
679*cdf0e10cSrcweir 
680*cdf0e10cSrcweir WrappedHasSubTitleProperty::~WrappedHasSubTitleProperty()
681*cdf0e10cSrcweir {
682*cdf0e10cSrcweir }
683*cdf0e10cSrcweir 
684*cdf0e10cSrcweir void WrappedHasSubTitleProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
685*cdf0e10cSrcweir                 throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
686*cdf0e10cSrcweir {
687*cdf0e10cSrcweir     sal_Bool bNewValue = sal_True;
688*cdf0e10cSrcweir     if( ! (rOuterValue >>= bNewValue) )
689*cdf0e10cSrcweir         throw lang::IllegalArgumentException( C2U("Property HasSubTitle requires value of type boolean"), 0, 0 );
690*cdf0e10cSrcweir 
691*cdf0e10cSrcweir 
692*cdf0e10cSrcweir     try
693*cdf0e10cSrcweir     {
694*cdf0e10cSrcweir         if( bNewValue )
695*cdf0e10cSrcweir             TitleHelper::createTitle( TitleHelper::SUB_TITLE, C2U("sub-title"), m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
696*cdf0e10cSrcweir         else
697*cdf0e10cSrcweir             TitleHelper::removeTitle( TitleHelper::SUB_TITLE, m_spChart2ModelContact->getChartModel() );
698*cdf0e10cSrcweir     }
699*cdf0e10cSrcweir     catch( uno::Exception & ex )
700*cdf0e10cSrcweir     {
701*cdf0e10cSrcweir         ASSERT_EXCEPTION( ex );
702*cdf0e10cSrcweir     }
703*cdf0e10cSrcweir }
704*cdf0e10cSrcweir 
705*cdf0e10cSrcweir Any WrappedHasSubTitleProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
706*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
707*cdf0e10cSrcweir {
708*cdf0e10cSrcweir     Any aRet;
709*cdf0e10cSrcweir     try
710*cdf0e10cSrcweir     {
711*cdf0e10cSrcweir         aRet <<= sal_Bool( TitleHelper::getTitle( TitleHelper::SUB_TITLE, m_spChart2ModelContact->getChartModel() ).is() );
712*cdf0e10cSrcweir     }
713*cdf0e10cSrcweir     catch( uno::Exception & ex )
714*cdf0e10cSrcweir     {
715*cdf0e10cSrcweir         ASSERT_EXCEPTION( ex );
716*cdf0e10cSrcweir     }
717*cdf0e10cSrcweir     return aRet;
718*cdf0e10cSrcweir }
719*cdf0e10cSrcweir 
720*cdf0e10cSrcweir Any WrappedHasSubTitleProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
721*cdf0e10cSrcweir                         throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
722*cdf0e10cSrcweir {
723*cdf0e10cSrcweir     Any aRet;
724*cdf0e10cSrcweir     aRet <<= sal_False;
725*cdf0e10cSrcweir     return aRet;
726*cdf0e10cSrcweir }
727*cdf0e10cSrcweir 
728*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
729*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
730*cdf0e10cSrcweir //-----------------------------------------------------------------------------------------------------------------
731*cdf0e10cSrcweir ChartDocumentWrapper::ChartDocumentWrapper(
732*cdf0e10cSrcweir     const Reference< uno::XComponentContext > & xContext ) :
733*cdf0e10cSrcweir         m_spChart2ModelContact( new Chart2ModelContact( xContext ) ),
734*cdf0e10cSrcweir         m_bUpdateAddIn( sal_True ),
735*cdf0e10cSrcweir         m_bIsDisposed( false )
736*cdf0e10cSrcweir {
737*cdf0e10cSrcweir }
738*cdf0e10cSrcweir 
739*cdf0e10cSrcweir ChartDocumentWrapper::~ChartDocumentWrapper()
740*cdf0e10cSrcweir {
741*cdf0e10cSrcweir     stopAllComponentListening();
742*cdf0e10cSrcweir }
743*cdf0e10cSrcweir 
744*cdf0e10cSrcweir // ____ XInterface (for new interfaces) ____
745*cdf0e10cSrcweir uno::Any SAL_CALL ChartDocumentWrapper::queryInterface( const uno::Type& aType )
746*cdf0e10cSrcweir     throw (uno::RuntimeException)
747*cdf0e10cSrcweir {
748*cdf0e10cSrcweir     if( m_xDelegator.is())
749*cdf0e10cSrcweir         // calls queryAggregation if the delegator doesn't know aType
750*cdf0e10cSrcweir         return m_xDelegator->queryInterface( aType );
751*cdf0e10cSrcweir     else
752*cdf0e10cSrcweir         return queryAggregation( aType );
753*cdf0e10cSrcweir }
754*cdf0e10cSrcweir 
755*cdf0e10cSrcweir // ____ chart::XChartDocument (old API wrapper) ____
756*cdf0e10cSrcweir Reference< drawing::XShape > SAL_CALL ChartDocumentWrapper::getTitle()
757*cdf0e10cSrcweir     throw (uno::RuntimeException)
758*cdf0e10cSrcweir {
759*cdf0e10cSrcweir     if( !m_xTitle.is()  )
760*cdf0e10cSrcweir     {
761*cdf0e10cSrcweir         ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
762*cdf0e10cSrcweir         m_xTitle = new TitleWrapper( TitleHelper::MAIN_TITLE, m_spChart2ModelContact );
763*cdf0e10cSrcweir     }
764*cdf0e10cSrcweir     return m_xTitle;
765*cdf0e10cSrcweir }
766*cdf0e10cSrcweir 
767*cdf0e10cSrcweir Reference< drawing::XShape > SAL_CALL ChartDocumentWrapper::getSubTitle()
768*cdf0e10cSrcweir     throw (uno::RuntimeException)
769*cdf0e10cSrcweir {
770*cdf0e10cSrcweir     if( !m_xSubTitle.is() )
771*cdf0e10cSrcweir     {
772*cdf0e10cSrcweir         ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
773*cdf0e10cSrcweir         m_xSubTitle = new TitleWrapper( TitleHelper::SUB_TITLE, m_spChart2ModelContact );
774*cdf0e10cSrcweir     }
775*cdf0e10cSrcweir     return m_xSubTitle;
776*cdf0e10cSrcweir }
777*cdf0e10cSrcweir 
778*cdf0e10cSrcweir Reference< drawing::XShape > SAL_CALL ChartDocumentWrapper::getLegend()
779*cdf0e10cSrcweir     throw (uno::RuntimeException)
780*cdf0e10cSrcweir {
781*cdf0e10cSrcweir     if( ! m_xLegend.is())
782*cdf0e10cSrcweir     {
783*cdf0e10cSrcweir         m_xLegend = new LegendWrapper( m_spChart2ModelContact );
784*cdf0e10cSrcweir         Reference< lang::XComponent > xComp( m_xLegend, uno::UNO_QUERY );
785*cdf0e10cSrcweir     }
786*cdf0e10cSrcweir 
787*cdf0e10cSrcweir     return m_xLegend;
788*cdf0e10cSrcweir }
789*cdf0e10cSrcweir 
790*cdf0e10cSrcweir Reference< beans::XPropertySet > SAL_CALL ChartDocumentWrapper::getArea()
791*cdf0e10cSrcweir     throw (uno::RuntimeException)
792*cdf0e10cSrcweir {
793*cdf0e10cSrcweir     if( ! m_xArea.is())
794*cdf0e10cSrcweir     {
795*cdf0e10cSrcweir         m_xArea.set( new AreaWrapper( m_spChart2ModelContact ) );
796*cdf0e10cSrcweir         Reference< lang::XComponent > xComp( m_xArea, uno::UNO_QUERY );
797*cdf0e10cSrcweir     }
798*cdf0e10cSrcweir 
799*cdf0e10cSrcweir     return m_xArea;
800*cdf0e10cSrcweir }
801*cdf0e10cSrcweir 
802*cdf0e10cSrcweir Reference< XDiagram > SAL_CALL ChartDocumentWrapper::getDiagram()
803*cdf0e10cSrcweir     throw (uno::RuntimeException)
804*cdf0e10cSrcweir {
805*cdf0e10cSrcweir     if( !m_xDiagram.is()  )
806*cdf0e10cSrcweir     {
807*cdf0e10cSrcweir         try
808*cdf0e10cSrcweir         {
809*cdf0e10cSrcweir             m_xDiagram = new DiagramWrapper( m_spChart2ModelContact );
810*cdf0e10cSrcweir         }
811*cdf0e10cSrcweir         catch( uno::Exception & ex )
812*cdf0e10cSrcweir         {
813*cdf0e10cSrcweir             ASSERT_EXCEPTION( ex );
814*cdf0e10cSrcweir         }
815*cdf0e10cSrcweir     }
816*cdf0e10cSrcweir 
817*cdf0e10cSrcweir     return m_xDiagram;
818*cdf0e10cSrcweir }
819*cdf0e10cSrcweir 
820*cdf0e10cSrcweir void SAL_CALL ChartDocumentWrapper::setDiagram( const Reference< XDiagram >& xDiagram )
821*cdf0e10cSrcweir     throw (uno::RuntimeException)
822*cdf0e10cSrcweir {
823*cdf0e10cSrcweir     uno::Reference< util::XRefreshable > xAddIn( xDiagram, uno::UNO_QUERY );
824*cdf0e10cSrcweir 	if( xAddIn.is() )
825*cdf0e10cSrcweir     {
826*cdf0e10cSrcweir         setAddIn( xAddIn );
827*cdf0e10cSrcweir     }
828*cdf0e10cSrcweir     else if( xDiagram.is() && xDiagram != m_xDiagram )
829*cdf0e10cSrcweir     {
830*cdf0e10cSrcweir         // set new wrapped diagram at new chart.  This requires the old
831*cdf0e10cSrcweir         // diagram given as parameter to implement the new interface.  If
832*cdf0e10cSrcweir         // this is not possible throw an exception
833*cdf0e10cSrcweir         Reference< chart2::XDiagramProvider > xNewDiaProvider( xDiagram, uno::UNO_QUERY_THROW );
834*cdf0e10cSrcweir         Reference< chart2::XDiagram > xNewDia( xNewDiaProvider->getDiagram());
835*cdf0e10cSrcweir 
836*cdf0e10cSrcweir         try
837*cdf0e10cSrcweir         {
838*cdf0e10cSrcweir             Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
839*cdf0e10cSrcweir             if( xChartDoc.is() )
840*cdf0e10cSrcweir             {
841*cdf0e10cSrcweir                 // set the new diagram
842*cdf0e10cSrcweir                 xChartDoc->setFirstDiagram( xNewDia );
843*cdf0e10cSrcweir                 m_xDiagram = xDiagram;
844*cdf0e10cSrcweir             }
845*cdf0e10cSrcweir         }
846*cdf0e10cSrcweir         catch( uno::Exception & ex )
847*cdf0e10cSrcweir         {
848*cdf0e10cSrcweir             ASSERT_EXCEPTION( ex );
849*cdf0e10cSrcweir         }
850*cdf0e10cSrcweir     }
851*cdf0e10cSrcweir }
852*cdf0e10cSrcweir 
853*cdf0e10cSrcweir Reference< XChartData > SAL_CALL ChartDocumentWrapper::getData()
854*cdf0e10cSrcweir     throw (uno::RuntimeException)
855*cdf0e10cSrcweir {
856*cdf0e10cSrcweir     if( !m_xChartData.is() )
857*cdf0e10cSrcweir     {
858*cdf0e10cSrcweir         m_xChartData.set( new ChartDataWrapper( m_spChart2ModelContact ) );
859*cdf0e10cSrcweir     }
860*cdf0e10cSrcweir     //@todo: check hasInternalDataProvider also in else?
861*cdf0e10cSrcweir 
862*cdf0e10cSrcweir     return m_xChartData;
863*cdf0e10cSrcweir }
864*cdf0e10cSrcweir 
865*cdf0e10cSrcweir void SAL_CALL ChartDocumentWrapper::attachData( const Reference< XChartData >& xNewData )
866*cdf0e10cSrcweir     throw (uno::RuntimeException)
867*cdf0e10cSrcweir {
868*cdf0e10cSrcweir     if( !xNewData.is() )
869*cdf0e10cSrcweir         return;
870*cdf0e10cSrcweir 
871*cdf0e10cSrcweir     // /-- locked controllers
872*cdf0e10cSrcweir     ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( m_spChart2ModelContact->getChart2Document(), uno::UNO_QUERY ));
873*cdf0e10cSrcweir     m_xChartData.set( new ChartDataWrapper( m_spChart2ModelContact, xNewData ) );
874*cdf0e10cSrcweir     // \-- locked controllers
875*cdf0e10cSrcweir }
876*cdf0e10cSrcweir 
877*cdf0e10cSrcweir // ____ XModel ____
878*cdf0e10cSrcweir sal_Bool SAL_CALL ChartDocumentWrapper::attachResource(
879*cdf0e10cSrcweir     const ::rtl::OUString& URL,
880*cdf0e10cSrcweir     const Sequence< beans::PropertyValue >& Arguments )
881*cdf0e10cSrcweir     throw (uno::RuntimeException)
882*cdf0e10cSrcweir {
883*cdf0e10cSrcweir     Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
884*cdf0e10cSrcweir     if( xModel.is() )
885*cdf0e10cSrcweir         return xModel->attachResource( URL, Arguments );
886*cdf0e10cSrcweir     return sal_False;
887*cdf0e10cSrcweir }
888*cdf0e10cSrcweir 
889*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ChartDocumentWrapper::getURL()
890*cdf0e10cSrcweir     throw (uno::RuntimeException)
891*cdf0e10cSrcweir {
892*cdf0e10cSrcweir     Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
893*cdf0e10cSrcweir     if( xModel.is() )
894*cdf0e10cSrcweir         return xModel->getURL();
895*cdf0e10cSrcweir     return ::rtl::OUString();
896*cdf0e10cSrcweir }
897*cdf0e10cSrcweir 
898*cdf0e10cSrcweir Sequence< beans::PropertyValue > SAL_CALL ChartDocumentWrapper::getArgs()
899*cdf0e10cSrcweir     throw (uno::RuntimeException)
900*cdf0e10cSrcweir {
901*cdf0e10cSrcweir     Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
902*cdf0e10cSrcweir     if( xModel.is() )
903*cdf0e10cSrcweir         return xModel->getArgs();
904*cdf0e10cSrcweir     return Sequence< beans::PropertyValue >();
905*cdf0e10cSrcweir }
906*cdf0e10cSrcweir 
907*cdf0e10cSrcweir void SAL_CALL ChartDocumentWrapper::connectController( const Reference< frame::XController >& Controller )
908*cdf0e10cSrcweir     throw (uno::RuntimeException)
909*cdf0e10cSrcweir {
910*cdf0e10cSrcweir     Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
911*cdf0e10cSrcweir     if( xModel.is() )
912*cdf0e10cSrcweir         xModel->connectController( Controller );
913*cdf0e10cSrcweir }
914*cdf0e10cSrcweir 
915*cdf0e10cSrcweir void SAL_CALL ChartDocumentWrapper::disconnectController(
916*cdf0e10cSrcweir     const Reference< frame::XController >& Controller )
917*cdf0e10cSrcweir     throw (uno::RuntimeException)
918*cdf0e10cSrcweir {
919*cdf0e10cSrcweir     Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
920*cdf0e10cSrcweir     if( xModel.is() )
921*cdf0e10cSrcweir         xModel->disconnectController( Controller );
922*cdf0e10cSrcweir }
923*cdf0e10cSrcweir 
924*cdf0e10cSrcweir void SAL_CALL ChartDocumentWrapper::lockControllers()
925*cdf0e10cSrcweir     throw (uno::RuntimeException)
926*cdf0e10cSrcweir {
927*cdf0e10cSrcweir     Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
928*cdf0e10cSrcweir     if( xModel.is() )
929*cdf0e10cSrcweir         xModel->lockControllers();
930*cdf0e10cSrcweir }
931*cdf0e10cSrcweir 
932*cdf0e10cSrcweir void SAL_CALL ChartDocumentWrapper::unlockControllers()
933*cdf0e10cSrcweir     throw (uno::RuntimeException)
934*cdf0e10cSrcweir {
935*cdf0e10cSrcweir     Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
936*cdf0e10cSrcweir     if( xModel.is() )
937*cdf0e10cSrcweir         xModel->unlockControllers();
938*cdf0e10cSrcweir }
939*cdf0e10cSrcweir 
940*cdf0e10cSrcweir sal_Bool SAL_CALL ChartDocumentWrapper::hasControllersLocked()
941*cdf0e10cSrcweir     throw (uno::RuntimeException)
942*cdf0e10cSrcweir {
943*cdf0e10cSrcweir     Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
944*cdf0e10cSrcweir     if( xModel.is() )
945*cdf0e10cSrcweir         return xModel->hasControllersLocked();
946*cdf0e10cSrcweir     return sal_False;
947*cdf0e10cSrcweir }
948*cdf0e10cSrcweir 
949*cdf0e10cSrcweir Reference< frame::XController > SAL_CALL ChartDocumentWrapper::getCurrentController()
950*cdf0e10cSrcweir     throw (uno::RuntimeException)
951*cdf0e10cSrcweir {
952*cdf0e10cSrcweir     Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
953*cdf0e10cSrcweir     if( xModel.is() )
954*cdf0e10cSrcweir         return xModel->getCurrentController();
955*cdf0e10cSrcweir     return 0;
956*cdf0e10cSrcweir }
957*cdf0e10cSrcweir 
958*cdf0e10cSrcweir void SAL_CALL ChartDocumentWrapper::setCurrentController(
959*cdf0e10cSrcweir     const Reference< frame::XController >& Controller )
960*cdf0e10cSrcweir     throw (container::NoSuchElementException,
961*cdf0e10cSrcweir            uno::RuntimeException)
962*cdf0e10cSrcweir {
963*cdf0e10cSrcweir     Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
964*cdf0e10cSrcweir     if( xModel.is() )
965*cdf0e10cSrcweir         xModel->setCurrentController( Controller );
966*cdf0e10cSrcweir }
967*cdf0e10cSrcweir 
968*cdf0e10cSrcweir Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::getCurrentSelection()
969*cdf0e10cSrcweir     throw (uno::RuntimeException)
970*cdf0e10cSrcweir {
971*cdf0e10cSrcweir     Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
972*cdf0e10cSrcweir     if( xModel.is() )
973*cdf0e10cSrcweir         return xModel->getCurrentSelection();
974*cdf0e10cSrcweir     return 0;
975*cdf0e10cSrcweir }
976*cdf0e10cSrcweir 
977*cdf0e10cSrcweir 
978*cdf0e10cSrcweir // ____ XComponent ____
979*cdf0e10cSrcweir void SAL_CALL ChartDocumentWrapper::dispose()
980*cdf0e10cSrcweir     throw (uno::RuntimeException)
981*cdf0e10cSrcweir {
982*cdf0e10cSrcweir     if( m_bIsDisposed )
983*cdf0e10cSrcweir 		throw lang::DisposedException(
984*cdf0e10cSrcweir             C2U("ChartDocumentWrapper is disposed" ),
985*cdf0e10cSrcweir             static_cast< ::cppu::OWeakObject* >( this ));
986*cdf0e10cSrcweir 
987*cdf0e10cSrcweir     m_bIsDisposed = true;
988*cdf0e10cSrcweir 
989*cdf0e10cSrcweir     try
990*cdf0e10cSrcweir     {
991*cdf0e10cSrcweir         Reference< lang::XComponent > xFormerDelegator( m_xDelegator, uno::UNO_QUERY );
992*cdf0e10cSrcweir         DisposeHelper::DisposeAndClear( m_xTitle );
993*cdf0e10cSrcweir         DisposeHelper::DisposeAndClear( m_xSubTitle );
994*cdf0e10cSrcweir         DisposeHelper::DisposeAndClear( m_xLegend );
995*cdf0e10cSrcweir         DisposeHelper::DisposeAndClear( m_xChartData );
996*cdf0e10cSrcweir         DisposeHelper::DisposeAndClear( m_xDiagram );
997*cdf0e10cSrcweir         DisposeHelper::DisposeAndClear( m_xArea );
998*cdf0e10cSrcweir         m_xChartView.set( 0 );
999*cdf0e10cSrcweir         m_xShapeFactory.set( 0 );
1000*cdf0e10cSrcweir         m_xDelegator.set( 0 );
1001*cdf0e10cSrcweir 
1002*cdf0e10cSrcweir         clearWrappedPropertySet();
1003*cdf0e10cSrcweir         m_spChart2ModelContact->clear();
1004*cdf0e10cSrcweir         impl_resetAddIn();
1005*cdf0e10cSrcweir 
1006*cdf0e10cSrcweir         stopAllComponentListening();
1007*cdf0e10cSrcweir 
1008*cdf0e10cSrcweir         try
1009*cdf0e10cSrcweir         {
1010*cdf0e10cSrcweir             if( xFormerDelegator.is())
1011*cdf0e10cSrcweir                 xFormerDelegator->dispose();
1012*cdf0e10cSrcweir         }
1013*cdf0e10cSrcweir         catch( lang::DisposedException )
1014*cdf0e10cSrcweir         {
1015*cdf0e10cSrcweir             // this is ok, don't panic
1016*cdf0e10cSrcweir         }
1017*cdf0e10cSrcweir     }
1018*cdf0e10cSrcweir     catch( uno::Exception &ex )
1019*cdf0e10cSrcweir     {
1020*cdf0e10cSrcweir         ASSERT_EXCEPTION( ex );
1021*cdf0e10cSrcweir     }
1022*cdf0e10cSrcweir }
1023*cdf0e10cSrcweir 
1024*cdf0e10cSrcweir void ChartDocumentWrapper::impl_resetAddIn()
1025*cdf0e10cSrcweir {
1026*cdf0e10cSrcweir     Reference< util::XRefreshable > xAddIn( m_xAddIn );
1027*cdf0e10cSrcweir     m_xAddIn.set( 0 );
1028*cdf0e10cSrcweir 
1029*cdf0e10cSrcweir     if( xAddIn.is() )
1030*cdf0e10cSrcweir     {
1031*cdf0e10cSrcweir         try
1032*cdf0e10cSrcweir         {
1033*cdf0e10cSrcweir             //make sure that the add-in does not hold a refernce to us anymore:
1034*cdf0e10cSrcweir             Reference< lang::XComponent > xComp( xAddIn, uno::UNO_QUERY );
1035*cdf0e10cSrcweir             if( xComp.is())
1036*cdf0e10cSrcweir                 xComp->dispose();
1037*cdf0e10cSrcweir             else
1038*cdf0e10cSrcweir             {
1039*cdf0e10cSrcweir                 uno::Reference< lang::XInitialization > xInit( xAddIn, uno::UNO_QUERY );
1040*cdf0e10cSrcweir 	            if( xInit.is() )
1041*cdf0e10cSrcweir 	            {
1042*cdf0e10cSrcweir                     uno::Any aParam;
1043*cdf0e10cSrcweir                     uno::Reference< com::sun::star::chart::XChartDocument > xDoc( 0 );
1044*cdf0e10cSrcweir 		            aParam <<= xDoc;
1045*cdf0e10cSrcweir 		            uno::Sequence< uno::Any > aSeq( &aParam, 1 );
1046*cdf0e10cSrcweir 		            xInit->initialize( aSeq );
1047*cdf0e10cSrcweir                 }
1048*cdf0e10cSrcweir             }
1049*cdf0e10cSrcweir         }
1050*cdf0e10cSrcweir         catch( const uno::RuntimeException& ex )
1051*cdf0e10cSrcweir         {
1052*cdf0e10cSrcweir             ASSERT_EXCEPTION( ex );
1053*cdf0e10cSrcweir         }
1054*cdf0e10cSrcweir         catch( const uno::Exception& ex )
1055*cdf0e10cSrcweir         {
1056*cdf0e10cSrcweir             ASSERT_EXCEPTION( ex );
1057*cdf0e10cSrcweir         }
1058*cdf0e10cSrcweir     }
1059*cdf0e10cSrcweir }
1060*cdf0e10cSrcweir 
1061*cdf0e10cSrcweir void ChartDocumentWrapper::setBaseDiagram( const rtl::OUString& rBaseDiagram )
1062*cdf0e10cSrcweir {
1063*cdf0e10cSrcweir     ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
1064*cdf0e10cSrcweir     m_aBaseDiagram = rBaseDiagram;
1065*cdf0e10cSrcweir 
1066*cdf0e10cSrcweir     uno::Reference< XDiagram > xDiagram( ChartDocumentWrapper::createInstance( rBaseDiagram ), uno::UNO_QUERY );
1067*cdf0e10cSrcweir     if( xDiagram.is() )
1068*cdf0e10cSrcweir         this->setDiagram( xDiagram );
1069*cdf0e10cSrcweir }
1070*cdf0e10cSrcweir 
1071*cdf0e10cSrcweir rtl::OUString ChartDocumentWrapper::getBaseDiagram() const
1072*cdf0e10cSrcweir {
1073*cdf0e10cSrcweir     return m_aBaseDiagram;
1074*cdf0e10cSrcweir }
1075*cdf0e10cSrcweir 
1076*cdf0e10cSrcweir Reference< util::XRefreshable > ChartDocumentWrapper::getAddIn() const
1077*cdf0e10cSrcweir {
1078*cdf0e10cSrcweir     return m_xAddIn;
1079*cdf0e10cSrcweir }
1080*cdf0e10cSrcweir 
1081*cdf0e10cSrcweir void ChartDocumentWrapper::setAddIn( const Reference< util::XRefreshable >& xAddIn )
1082*cdf0e10cSrcweir {
1083*cdf0e10cSrcweir     if( m_xAddIn == xAddIn )
1084*cdf0e10cSrcweir         return;
1085*cdf0e10cSrcweir 
1086*cdf0e10cSrcweir     ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
1087*cdf0e10cSrcweir     impl_resetAddIn();
1088*cdf0e10cSrcweir     m_xAddIn = xAddIn;
1089*cdf0e10cSrcweir     // initialize AddIn with this as chart document
1090*cdf0e10cSrcweir 	uno::Reference< lang::XInitialization > xInit( m_xAddIn, uno::UNO_QUERY );
1091*cdf0e10cSrcweir 	if( xInit.is() )
1092*cdf0e10cSrcweir 	{
1093*cdf0e10cSrcweir 		uno::Any aParam;
1094*cdf0e10cSrcweir         uno::Reference< XChartDocument > xDoc( (XChartDocument*)this, uno::UNO_QUERY );
1095*cdf0e10cSrcweir 		aParam <<= xDoc;
1096*cdf0e10cSrcweir 		uno::Sequence< uno::Any > aSeq( &aParam, 1 );
1097*cdf0e10cSrcweir 		xInit->initialize( aSeq );
1098*cdf0e10cSrcweir 	}
1099*cdf0e10cSrcweir }
1100*cdf0e10cSrcweir 
1101*cdf0e10cSrcweir void ChartDocumentWrapper::setUpdateAddIn( sal_Bool bUpdateAddIn )
1102*cdf0e10cSrcweir {
1103*cdf0e10cSrcweir     m_bUpdateAddIn = bUpdateAddIn;
1104*cdf0e10cSrcweir }
1105*cdf0e10cSrcweir sal_Bool ChartDocumentWrapper::getUpdateAddIn() const
1106*cdf0e10cSrcweir {
1107*cdf0e10cSrcweir     return m_bUpdateAddIn;
1108*cdf0e10cSrcweir }
1109*cdf0e10cSrcweir 
1110*cdf0e10cSrcweir Reference< drawing::XShapes > ChartDocumentWrapper::getAdditionalShapes() const
1111*cdf0e10cSrcweir {
1112*cdf0e10cSrcweir     // get additional non-chart shapes for XML export
1113*cdf0e10cSrcweir     uno::Reference< drawing::XShapes > xFoundShapes;
1114*cdf0e10cSrcweir     uno::Reference< drawing::XDrawPage > xDrawPage( this->impl_getDrawPage() );
1115*cdf0e10cSrcweir 
1116*cdf0e10cSrcweir     uno::Reference< drawing::XShapes > xDrawPageShapes( xDrawPage, uno::UNO_QUERY );
1117*cdf0e10cSrcweir     if( !xDrawPageShapes.is() )
1118*cdf0e10cSrcweir         return xFoundShapes;
1119*cdf0e10cSrcweir 
1120*cdf0e10cSrcweir     uno::Reference<drawing::XShapes> xChartRoot( DrawModelWrapper::getChartRootShape( xDrawPage ) );
1121*cdf0e10cSrcweir 
1122*cdf0e10cSrcweir     // iterate 'flat' over all top-level objects
1123*cdf0e10cSrcweir     // and determine all that are no chart objects
1124*cdf0e10cSrcweir     ::std::vector< uno::Reference< drawing::XShape > > aShapeVector;
1125*cdf0e10cSrcweir     sal_Int32 nSubCount = xDrawPageShapes->getCount();
1126*cdf0e10cSrcweir     uno::Reference< drawing::XShape > xShape;
1127*cdf0e10cSrcweir     for( sal_Int32 nS = 0; nS < nSubCount; nS++ )
1128*cdf0e10cSrcweir     {
1129*cdf0e10cSrcweir         if( xDrawPageShapes->getByIndex( nS ) >>= xShape )
1130*cdf0e10cSrcweir         {
1131*cdf0e10cSrcweir             if( xShape.is() && xChartRoot!=xShape )
1132*cdf0e10cSrcweir                 aShapeVector.push_back( xShape );
1133*cdf0e10cSrcweir         }
1134*cdf0e10cSrcweir     }
1135*cdf0e10cSrcweir 
1136*cdf0e10cSrcweir     if( !aShapeVector.empty() )
1137*cdf0e10cSrcweir     {
1138*cdf0e10cSrcweir         // create a shape collection
1139*cdf0e10cSrcweir         xFoundShapes = uno::Reference< drawing::XShapes >( SvxShapeCollection_NewInstance(), uno::UNO_QUERY );
1140*cdf0e10cSrcweir 
1141*cdf0e10cSrcweir         DBG_ASSERT( xFoundShapes.is(), "Couldn't create a shape collection!" );
1142*cdf0e10cSrcweir         if( xFoundShapes.is())
1143*cdf0e10cSrcweir         {
1144*cdf0e10cSrcweir             ::std::vector< uno::Reference< drawing::XShape > >::iterator aIter;
1145*cdf0e10cSrcweir             for( aIter = aShapeVector.begin(); aIter != aShapeVector.end(); ++aIter )
1146*cdf0e10cSrcweir                 xFoundShapes->add( *aIter );
1147*cdf0e10cSrcweir         }
1148*cdf0e10cSrcweir     }
1149*cdf0e10cSrcweir 
1150*cdf0e10cSrcweir     return xFoundShapes;
1151*cdf0e10cSrcweir }
1152*cdf0e10cSrcweir 
1153*cdf0e10cSrcweir void SAL_CALL ChartDocumentWrapper::addEventListener( const Reference< lang::XEventListener >& xListener )
1154*cdf0e10cSrcweir     throw (uno::RuntimeException)
1155*cdf0e10cSrcweir {
1156*cdf0e10cSrcweir     Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
1157*cdf0e10cSrcweir     if( xModel.is() )
1158*cdf0e10cSrcweir         xModel->addEventListener( xListener );
1159*cdf0e10cSrcweir }
1160*cdf0e10cSrcweir 
1161*cdf0e10cSrcweir void SAL_CALL ChartDocumentWrapper::removeEventListener( const Reference< lang::XEventListener >& aListener )
1162*cdf0e10cSrcweir     throw (uno::RuntimeException)
1163*cdf0e10cSrcweir {
1164*cdf0e10cSrcweir     Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
1165*cdf0e10cSrcweir     if( xModel.is() )
1166*cdf0e10cSrcweir         xModel->removeEventListener( aListener );
1167*cdf0e10cSrcweir }
1168*cdf0e10cSrcweir 
1169*cdf0e10cSrcweir // ____ XDrawPageSupplier ____
1170*cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > SAL_CALL ChartDocumentWrapper::getDrawPage()
1171*cdf0e10cSrcweir     throw (uno::RuntimeException)
1172*cdf0e10cSrcweir {
1173*cdf0e10cSrcweir     return this->impl_getDrawPage();
1174*cdf0e10cSrcweir }
1175*cdf0e10cSrcweir 
1176*cdf0e10cSrcweir uno::Reference< drawing::XDrawPage > ChartDocumentWrapper::impl_getDrawPage() const
1177*cdf0e10cSrcweir     throw (uno::RuntimeException)
1178*cdf0e10cSrcweir {
1179*cdf0e10cSrcweir     return m_spChart2ModelContact->getDrawPage();
1180*cdf0e10cSrcweir }
1181*cdf0e10cSrcweir 
1182*cdf0e10cSrcweir // ____ XMultiServiceFactory ____
1183*cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
1184*cdf0e10cSrcweir     const ::rtl::OUString& aServiceSpecifier )
1185*cdf0e10cSrcweir     throw (uno::Exception,
1186*cdf0e10cSrcweir            uno::RuntimeException)
1187*cdf0e10cSrcweir {
1188*cdf0e10cSrcweir     uno::Reference< uno::XInterface > xResult;
1189*cdf0e10cSrcweir 
1190*cdf0e10cSrcweir     Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
1191*cdf0e10cSrcweir     if( !xChartDoc.is() )
1192*cdf0e10cSrcweir         return xResult;
1193*cdf0e10cSrcweir 
1194*cdf0e10cSrcweir     bool bServiceFound = false;
1195*cdf0e10cSrcweir     tServiceNameMap & rMap = lcl_getStaticServiceNameMap();
1196*cdf0e10cSrcweir 
1197*cdf0e10cSrcweir     tServiceNameMap::const_iterator aIt( rMap.find( aServiceSpecifier ));
1198*cdf0e10cSrcweir     if( aIt != rMap.end())
1199*cdf0e10cSrcweir     {
1200*cdf0e10cSrcweir         bool bCreateDiagram = false;
1201*cdf0e10cSrcweir         uno::Reference< lang::XMultiServiceFactory > xManagerFact(
1202*cdf0e10cSrcweir             xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
1203*cdf0e10cSrcweir         uno::Reference< chart2::XChartTypeTemplate > xTemplate;
1204*cdf0e10cSrcweir 
1205*cdf0e10cSrcweir         switch( (*aIt).second )
1206*cdf0e10cSrcweir         {
1207*cdf0e10cSrcweir             case SERVICE_NAME_AREA_DIAGRAM:
1208*cdf0e10cSrcweir                 if( xManagerFact.is())
1209*cdf0e10cSrcweir                 {
1210*cdf0e10cSrcweir                     xTemplate.set(
1211*cdf0e10cSrcweir                         xManagerFact->createInstance(
1212*cdf0e10cSrcweir                             C2U( "com.sun.star.chart2.template.Area" )), uno::UNO_QUERY );
1213*cdf0e10cSrcweir                     bCreateDiagram = true;
1214*cdf0e10cSrcweir                 }
1215*cdf0e10cSrcweir                 break;
1216*cdf0e10cSrcweir             case SERVICE_NAME_BAR_DIAGRAM:
1217*cdf0e10cSrcweir                 if( xManagerFact.is())
1218*cdf0e10cSrcweir                 {
1219*cdf0e10cSrcweir                     // this is for bar and column (the latter is the default if
1220*cdf0e10cSrcweir                     // no "Vertical=false" property was set)
1221*cdf0e10cSrcweir                     xTemplate.set(
1222*cdf0e10cSrcweir                         xManagerFact->createInstance(
1223*cdf0e10cSrcweir                             C2U( "com.sun.star.chart2.template.Column" )), uno::UNO_QUERY );
1224*cdf0e10cSrcweir                     bCreateDiagram = true;
1225*cdf0e10cSrcweir                 }
1226*cdf0e10cSrcweir                 break;
1227*cdf0e10cSrcweir             case SERVICE_NAME_DONUT_DIAGRAM:
1228*cdf0e10cSrcweir                 if( xManagerFact.is())
1229*cdf0e10cSrcweir                 {
1230*cdf0e10cSrcweir                     xTemplate.set(
1231*cdf0e10cSrcweir                         xManagerFact->createInstance(
1232*cdf0e10cSrcweir                             C2U( "com.sun.star.chart2.template.Donut" )), uno::UNO_QUERY );
1233*cdf0e10cSrcweir                     bCreateDiagram = true;
1234*cdf0e10cSrcweir                 }
1235*cdf0e10cSrcweir                 break;
1236*cdf0e10cSrcweir             case SERVICE_NAME_LINE_DIAGRAM:
1237*cdf0e10cSrcweir                 if( xManagerFact.is())
1238*cdf0e10cSrcweir                 {
1239*cdf0e10cSrcweir                     xTemplate.set(
1240*cdf0e10cSrcweir                         xManagerFact->createInstance(
1241*cdf0e10cSrcweir                             C2U( "com.sun.star.chart2.template.Line" )), uno::UNO_QUERY );
1242*cdf0e10cSrcweir                     bCreateDiagram = true;
1243*cdf0e10cSrcweir                 }
1244*cdf0e10cSrcweir                 break;
1245*cdf0e10cSrcweir             case SERVICE_NAME_NET_DIAGRAM:
1246*cdf0e10cSrcweir                 if( xManagerFact.is())
1247*cdf0e10cSrcweir                 {
1248*cdf0e10cSrcweir                     xTemplate.set(
1249*cdf0e10cSrcweir                         xManagerFact->createInstance(
1250*cdf0e10cSrcweir                             C2U( "com.sun.star.chart2.template.Net" )), uno::UNO_QUERY );
1251*cdf0e10cSrcweir                     bCreateDiagram = true;
1252*cdf0e10cSrcweir                 }
1253*cdf0e10cSrcweir                 break;
1254*cdf0e10cSrcweir             case SERVICE_NAME_FILLED_NET_DIAGRAM:
1255*cdf0e10cSrcweir                 if( xManagerFact.is())
1256*cdf0e10cSrcweir                 {
1257*cdf0e10cSrcweir                     xTemplate.set(
1258*cdf0e10cSrcweir                         xManagerFact->createInstance(
1259*cdf0e10cSrcweir                             C2U( "com.sun.star.chart2.template.FilledNet" )), uno::UNO_QUERY );
1260*cdf0e10cSrcweir                     bCreateDiagram = true;
1261*cdf0e10cSrcweir                 }
1262*cdf0e10cSrcweir             case SERVICE_NAME_PIE_DIAGRAM:
1263*cdf0e10cSrcweir                 if( xManagerFact.is())
1264*cdf0e10cSrcweir                 {
1265*cdf0e10cSrcweir                     xTemplate.set(
1266*cdf0e10cSrcweir                         xManagerFact->createInstance(
1267*cdf0e10cSrcweir                             C2U( "com.sun.star.chart2.template.Pie" )), uno::UNO_QUERY );
1268*cdf0e10cSrcweir                     bCreateDiagram = true;
1269*cdf0e10cSrcweir                 }
1270*cdf0e10cSrcweir                 break;
1271*cdf0e10cSrcweir             case SERVICE_NAME_STOCK_DIAGRAM:
1272*cdf0e10cSrcweir                 if( xManagerFact.is())
1273*cdf0e10cSrcweir                 {
1274*cdf0e10cSrcweir                     xTemplate.set(
1275*cdf0e10cSrcweir                         xManagerFact->createInstance(
1276*cdf0e10cSrcweir                             C2U( "com.sun.star.chart2.template.StockLowHighClose" )), uno::UNO_QUERY );
1277*cdf0e10cSrcweir                     bCreateDiagram = true;
1278*cdf0e10cSrcweir                 }
1279*cdf0e10cSrcweir                 break;
1280*cdf0e10cSrcweir             case SERVICE_NAME_XY_DIAGRAM:
1281*cdf0e10cSrcweir                 if( xManagerFact.is())
1282*cdf0e10cSrcweir                 {
1283*cdf0e10cSrcweir                     xTemplate.set(
1284*cdf0e10cSrcweir                         xManagerFact->createInstance(
1285*cdf0e10cSrcweir                             C2U( "com.sun.star.chart2.template.ScatterLineSymbol" )), uno::UNO_QUERY );
1286*cdf0e10cSrcweir                     bCreateDiagram = true;
1287*cdf0e10cSrcweir                 }
1288*cdf0e10cSrcweir                 break;
1289*cdf0e10cSrcweir 
1290*cdf0e10cSrcweir             case SERVICE_NAME_BUBBLE_DIAGRAM:
1291*cdf0e10cSrcweir                 if( xManagerFact.is())
1292*cdf0e10cSrcweir                 {
1293*cdf0e10cSrcweir                     xTemplate.set(
1294*cdf0e10cSrcweir                         xManagerFact->createInstance(
1295*cdf0e10cSrcweir                             C2U( "com.sun.star.chart2.template.Bubble" )), uno::UNO_QUERY );
1296*cdf0e10cSrcweir                     bCreateDiagram = true;
1297*cdf0e10cSrcweir                 }
1298*cdf0e10cSrcweir                 break;
1299*cdf0e10cSrcweir 
1300*cdf0e10cSrcweir             case SERVICE_NAME_DASH_TABLE:
1301*cdf0e10cSrcweir             case SERVICE_NAME_GARDIENT_TABLE:
1302*cdf0e10cSrcweir             case SERVICE_NAME_HATCH_TABLE:
1303*cdf0e10cSrcweir             case SERVICE_NAME_BITMAP_TABLE:
1304*cdf0e10cSrcweir             case SERVICE_NAME_TRANSP_GRADIENT_TABLE:
1305*cdf0e10cSrcweir             case SERVICE_NAME_MARKER_TABLE:
1306*cdf0e10cSrcweir                 {
1307*cdf0e10cSrcweir                     uno::Reference< lang::XMultiServiceFactory > xTableFactory( xChartDoc, uno::UNO_QUERY );
1308*cdf0e10cSrcweir                     DBG_ASSERT( xTableFactory.get() != this, "new model is expected to implement service factory for gradient table etc" );
1309*cdf0e10cSrcweir                     if( xTableFactory.is() && xTableFactory.get() != this )
1310*cdf0e10cSrcweir                         xResult.set( xTableFactory->createInstance( aIt->first ), uno::UNO_QUERY );
1311*cdf0e10cSrcweir                 }
1312*cdf0e10cSrcweir                 break;
1313*cdf0e10cSrcweir 
1314*cdf0e10cSrcweir             case SERVICE_NAME_NAMESPACE_MAP:
1315*cdf0e10cSrcweir //                 xResult = svx::NamespaceMap_createInstance( aWhichIds, &m_pModel->GetPool() );
1316*cdf0e10cSrcweir                 break;
1317*cdf0e10cSrcweir             case SERVICE_NAME_EXPORT_GRAPHIC_RESOLVER:
1318*cdf0e10cSrcweir //                 xResult = static_cast< ::cppu::OWeakObject * >( new SvXMLGraphicHelper( GRAPHICHELPER_MODE_WRITE ));
1319*cdf0e10cSrcweir                 break;
1320*cdf0e10cSrcweir             case SERVICE_NAME_IMPORT_GRAPHIC_RESOLVER:
1321*cdf0e10cSrcweir //                 xResult = static_cast< ::cppu::OWeakObject * >( new SvXMLGraphicHelper( GRAPHICHELPER_MODE_READ ));
1322*cdf0e10cSrcweir                 break;
1323*cdf0e10cSrcweir         }
1324*cdf0e10cSrcweir 
1325*cdf0e10cSrcweir         if( bCreateDiagram && xTemplate.is() )
1326*cdf0e10cSrcweir         {
1327*cdf0e10cSrcweir             try
1328*cdf0e10cSrcweir             {
1329*cdf0e10cSrcweir                 uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram());
1330*cdf0e10cSrcweir                 if( xDia.is())
1331*cdf0e10cSrcweir                 {
1332*cdf0e10cSrcweir                     // /-- locked controllers
1333*cdf0e10cSrcweir                     Reference< frame::XModel > xModel( xChartDoc, uno::UNO_QUERY );
1334*cdf0e10cSrcweir                     ControllerLockGuard aCtrlLockGuard( xModel );
1335*cdf0e10cSrcweir                     Reference< chart2::XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
1336*cdf0e10cSrcweir                     ThreeDLookScheme e3DScheme = ThreeDHelper::detectScheme( xDiagram );
1337*cdf0e10cSrcweir                     Reference< lang::XMultiServiceFactory > xTemplateManager( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
1338*cdf0e10cSrcweir                     DiagramHelper::tTemplateWithServiceName aTemplateWithService(
1339*cdf0e10cSrcweir                         DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager ));
1340*cdf0e10cSrcweir                     if( aTemplateWithService.first.is())
1341*cdf0e10cSrcweir                         aTemplateWithService.first->resetStyles( xDiagram );//#i109371#
1342*cdf0e10cSrcweir                     xTemplate->changeDiagram( xDiagram );
1343*cdf0e10cSrcweir                     if( Application::GetSettings().GetLayoutRTL() )
1344*cdf0e10cSrcweir                         AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
1345*cdf0e10cSrcweir                     ThreeDHelper::setScheme( xDiagram, e3DScheme );
1346*cdf0e10cSrcweir                     // \-- locked controllers
1347*cdf0e10cSrcweir                 }
1348*cdf0e10cSrcweir                 else
1349*cdf0e10cSrcweir                 {
1350*cdf0e10cSrcweir                     // /-- locked controllers
1351*cdf0e10cSrcweir                     ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ));
1352*cdf0e10cSrcweir                     xDia.set( xTemplate->createDiagramByDataSource(
1353*cdf0e10cSrcweir                                   uno::Reference< chart2::data::XDataSource >(),
1354*cdf0e10cSrcweir                                   uno::Sequence< beans::PropertyValue >()));
1355*cdf0e10cSrcweir                     xChartDoc->setFirstDiagram( xDia );
1356*cdf0e10cSrcweir                     // \-- locked controllers
1357*cdf0e10cSrcweir                 }
1358*cdf0e10cSrcweir 
1359*cdf0e10cSrcweir                 xResult = static_cast< ::cppu::OWeakObject* >( new DiagramWrapper( m_spChart2ModelContact ));
1360*cdf0e10cSrcweir             }
1361*cdf0e10cSrcweir             catch( uno::Exception & ex )
1362*cdf0e10cSrcweir             {
1363*cdf0e10cSrcweir                 ASSERT_EXCEPTION( ex );
1364*cdf0e10cSrcweir             }
1365*cdf0e10cSrcweir         }
1366*cdf0e10cSrcweir 
1367*cdf0e10cSrcweir         bServiceFound = true;
1368*cdf0e10cSrcweir     }
1369*cdf0e10cSrcweir     else if( aServiceSpecifier.equals( CHART_RENDERER_SERVICE_IMPLEMENTATION_NAME ) )
1370*cdf0e10cSrcweir     {
1371*cdf0e10cSrcweir         Reference< lang::XUnoTunnel > xChartRenderer( new ChartRenderer( m_spChart2ModelContact->getChartModel() ) );
1372*cdf0e10cSrcweir         xResult.set( xChartRenderer );
1373*cdf0e10cSrcweir         bServiceFound = true;
1374*cdf0e10cSrcweir     }
1375*cdf0e10cSrcweir     else if( aServiceSpecifier.equals( C2U("com.sun.star.comp.chart2.DataSeriesWrapper") ) )
1376*cdf0e10cSrcweir     {
1377*cdf0e10cSrcweir         Reference< beans::XPropertySet > xDataSeries( new DataSeriesPointWrapper( m_spChart2ModelContact ) );
1378*cdf0e10cSrcweir         xResult.set( xDataSeries );
1379*cdf0e10cSrcweir         bServiceFound = true;
1380*cdf0e10cSrcweir     }
1381*cdf0e10cSrcweir     else if( aServiceSpecifier.equals( CHART_VIEW_SERVICE_NAME ) )
1382*cdf0e10cSrcweir     {
1383*cdf0e10cSrcweir         if( !m_xChartView.is() )
1384*cdf0e10cSrcweir         {
1385*cdf0e10cSrcweir             Reference< lang::XMultiServiceFactory > xFact(
1386*cdf0e10cSrcweir                 m_spChart2ModelContact->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
1387*cdf0e10cSrcweir             if( xFact.is() )
1388*cdf0e10cSrcweir             {
1389*cdf0e10cSrcweir                 Reference< lang::XInitialization > xViewInit( xFact->createInstance(
1390*cdf0e10cSrcweir                         CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
1391*cdf0e10cSrcweir                 if(xViewInit.is())
1392*cdf0e10cSrcweir                 {
1393*cdf0e10cSrcweir                     try
1394*cdf0e10cSrcweir                     {
1395*cdf0e10cSrcweir                         m_xChartView = xViewInit;
1396*cdf0e10cSrcweir 
1397*cdf0e10cSrcweir                         Sequence< Any > aArguments(2);
1398*cdf0e10cSrcweir                         Reference<frame::XModel> xModel(this);
1399*cdf0e10cSrcweir                         aArguments[0]=uno::makeAny(xModel);
1400*cdf0e10cSrcweir                         sal_Bool bRefreshAddIn = sal_True;
1401*cdf0e10cSrcweir                         aArguments[1]=uno::makeAny(bRefreshAddIn);
1402*cdf0e10cSrcweir                         xViewInit->initialize(aArguments);
1403*cdf0e10cSrcweir                     }
1404*cdf0e10cSrcweir                     catch( uno::Exception & ex )
1405*cdf0e10cSrcweir                     {
1406*cdf0e10cSrcweir                         ASSERT_EXCEPTION( ex );
1407*cdf0e10cSrcweir                     }
1408*cdf0e10cSrcweir                 }
1409*cdf0e10cSrcweir             }
1410*cdf0e10cSrcweir         }
1411*cdf0e10cSrcweir         xResult.set( m_xChartView );
1412*cdf0e10cSrcweir         bServiceFound = true;
1413*cdf0e10cSrcweir     }
1414*cdf0e10cSrcweir     else
1415*cdf0e10cSrcweir     {
1416*cdf0e10cSrcweir         // try to create a shape
1417*cdf0e10cSrcweir         try
1418*cdf0e10cSrcweir         {
1419*cdf0e10cSrcweir             if( !m_xShapeFactory.is() && m_xChartView.is() )
1420*cdf0e10cSrcweir             {
1421*cdf0e10cSrcweir                 Reference< lang::XUnoTunnel> xUnoTunnel(m_xChartView,uno::UNO_QUERY);
1422*cdf0e10cSrcweir                 if(xUnoTunnel.is())
1423*cdf0e10cSrcweir                 {
1424*cdf0e10cSrcweir                     ExplicitValueProvider* pProvider = reinterpret_cast<ExplicitValueProvider*>(xUnoTunnel->getSomething(
1425*cdf0e10cSrcweir                         ExplicitValueProvider::getUnoTunnelId() ));
1426*cdf0e10cSrcweir                     if( pProvider )
1427*cdf0e10cSrcweir                         m_xShapeFactory.set( pProvider->getDrawModelWrapper()->getShapeFactory() );
1428*cdf0e10cSrcweir                 }
1429*cdf0e10cSrcweir             }
1430*cdf0e10cSrcweir             if( m_xShapeFactory.is() )
1431*cdf0e10cSrcweir             {
1432*cdf0e10cSrcweir                 xResult = m_xShapeFactory->createInstance( aServiceSpecifier );
1433*cdf0e10cSrcweir                 bServiceFound = true;
1434*cdf0e10cSrcweir             }
1435*cdf0e10cSrcweir         }
1436*cdf0e10cSrcweir         catch( const uno::Exception )
1437*cdf0e10cSrcweir         {
1438*cdf0e10cSrcweir             // couldn't create shape
1439*cdf0e10cSrcweir         }
1440*cdf0e10cSrcweir     }
1441*cdf0e10cSrcweir 
1442*cdf0e10cSrcweir     // finally, try to create an addin
1443*cdf0e10cSrcweir     if( !bServiceFound )
1444*cdf0e10cSrcweir     {
1445*cdf0e10cSrcweir         try
1446*cdf0e10cSrcweir         {
1447*cdf0e10cSrcweir             Reference< lang::XMultiServiceFactory > xFact(
1448*cdf0e10cSrcweir                 m_spChart2ModelContact->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
1449*cdf0e10cSrcweir             if( xFact.is() )
1450*cdf0e10cSrcweir             {
1451*cdf0e10cSrcweir                 uno::Reference< util::XRefreshable > xAddIn(
1452*cdf0e10cSrcweir                     xFact->createInstance( aServiceSpecifier ), uno::UNO_QUERY );
1453*cdf0e10cSrcweir                 if( xAddIn.is() )
1454*cdf0e10cSrcweir                 {
1455*cdf0e10cSrcweir                     xResult = xAddIn;
1456*cdf0e10cSrcweir                     bServiceFound = true;
1457*cdf0e10cSrcweir                 }
1458*cdf0e10cSrcweir             }
1459*cdf0e10cSrcweir         }
1460*cdf0e10cSrcweir         catch( const uno::Exception& ex )
1461*cdf0e10cSrcweir         {
1462*cdf0e10cSrcweir             (void)ex;
1463*cdf0e10cSrcweir             // couldn't create service
1464*cdf0e10cSrcweir         }
1465*cdf0e10cSrcweir     }
1466*cdf0e10cSrcweir 
1467*cdf0e10cSrcweir     return xResult;
1468*cdf0e10cSrcweir }
1469*cdf0e10cSrcweir 
1470*cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstanceWithArguments(
1471*cdf0e10cSrcweir     const ::rtl::OUString& ServiceSpecifier,
1472*cdf0e10cSrcweir     const uno::Sequence< uno::Any >& Arguments )
1473*cdf0e10cSrcweir     throw (uno::Exception,
1474*cdf0e10cSrcweir            uno::RuntimeException)
1475*cdf0e10cSrcweir {
1476*cdf0e10cSrcweir     OSL_ENSURE( Arguments.getLength(), "createInstanceWithArguments: Warning: Arguments are ignored" );
1477*cdf0e10cSrcweir     (void)(Arguments);
1478*cdf0e10cSrcweir 
1479*cdf0e10cSrcweir     return createInstance( ServiceSpecifier );
1480*cdf0e10cSrcweir }
1481*cdf0e10cSrcweir 
1482*cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SAL_CALL ChartDocumentWrapper::getAvailableServiceNames()
1483*cdf0e10cSrcweir     throw (uno::RuntimeException)
1484*cdf0e10cSrcweir {
1485*cdf0e10cSrcweir     tServiceNameMap & rMap = lcl_getStaticServiceNameMap();
1486*cdf0e10cSrcweir     uno::Sequence< ::rtl::OUString > aResult( rMap.size());
1487*cdf0e10cSrcweir 
1488*cdf0e10cSrcweir     ::std::transform( rMap.begin(), rMap.end(),
1489*cdf0e10cSrcweir                       aResult.getArray(),
1490*cdf0e10cSrcweir                       ::std::select1st< tServiceNameMap::value_type >() );
1491*cdf0e10cSrcweir 
1492*cdf0e10cSrcweir     return aResult;
1493*cdf0e10cSrcweir 
1494*cdf0e10cSrcweir //         // shapes
1495*cdf0e10cSrcweir // //         uno::Sequence< OUString > aDrawServices( SvxUnoDrawMSFactory::getAvailableServiceNames() );
1496*cdf0e10cSrcweir // //         const OUString * pArr = aDrawServices.getConstArray();
1497*cdf0e10cSrcweir // //         aServices.insert( aServices.end(), pArr, pArr + aDrawServices.getLength() );
1498*cdf0e10cSrcweir //     }
1499*cdf0e10cSrcweir 
1500*cdf0e10cSrcweir 
1501*cdf0e10cSrcweir     // add-ins
1502*cdf0e10cSrcweir  //    uno::Sequence< OUString > aAddIns( GetAddInCollection().GetAddInNames() );
1503*cdf0e10cSrcweir //     pArr = aAddIns.getConstArray();
1504*cdf0e10cSrcweir //     aServices.insert( aServices.end(), pArr, pArr + aAddIns.getLength() );
1505*cdf0e10cSrcweir 
1506*cdf0e10cSrcweir //     return ContainerToSequence( aServices );
1507*cdf0e10cSrcweir }
1508*cdf0e10cSrcweir 
1509*cdf0e10cSrcweir // ____ XAggregation ____
1510*cdf0e10cSrcweir void SAL_CALL ChartDocumentWrapper::setDelegator(
1511*cdf0e10cSrcweir     const uno::Reference< uno::XInterface >& rDelegator )
1512*cdf0e10cSrcweir     throw (uno::RuntimeException)
1513*cdf0e10cSrcweir {
1514*cdf0e10cSrcweir     if( m_bIsDisposed )
1515*cdf0e10cSrcweir     {
1516*cdf0e10cSrcweir         if( rDelegator.is() )
1517*cdf0e10cSrcweir             throw lang::DisposedException(
1518*cdf0e10cSrcweir                 C2U("ChartDocumentWrapper is disposed" ),
1519*cdf0e10cSrcweir                 static_cast< ::cppu::OWeakObject* >( this ));
1520*cdf0e10cSrcweir         else
1521*cdf0e10cSrcweir             return;
1522*cdf0e10cSrcweir     }
1523*cdf0e10cSrcweir 
1524*cdf0e10cSrcweir     if( rDelegator.is())
1525*cdf0e10cSrcweir     {
1526*cdf0e10cSrcweir         m_xDelegator = rDelegator;
1527*cdf0e10cSrcweir         m_spChart2ModelContact->setModel( uno::Reference< frame::XModel >(m_xDelegator, uno::UNO_QUERY) );
1528*cdf0e10cSrcweir     }
1529*cdf0e10cSrcweir     else
1530*cdf0e10cSrcweir     {
1531*cdf0e10cSrcweir         // this is a sort of dispose() from the new model,so release ressources here
1532*cdf0e10cSrcweir         try
1533*cdf0e10cSrcweir         {
1534*cdf0e10cSrcweir             this->dispose();
1535*cdf0e10cSrcweir         }
1536*cdf0e10cSrcweir         catch( uno::Exception &ex )
1537*cdf0e10cSrcweir         {
1538*cdf0e10cSrcweir             ASSERT_EXCEPTION( ex );
1539*cdf0e10cSrcweir         }
1540*cdf0e10cSrcweir     }
1541*cdf0e10cSrcweir }
1542*cdf0e10cSrcweir 
1543*cdf0e10cSrcweir uno::Any SAL_CALL ChartDocumentWrapper::queryAggregation( const uno::Type& rType )
1544*cdf0e10cSrcweir     throw (uno::RuntimeException)
1545*cdf0e10cSrcweir {
1546*cdf0e10cSrcweir     return ChartDocumentWrapper_Base::queryInterface( rType );
1547*cdf0e10cSrcweir }
1548*cdf0e10cSrcweir 
1549*cdf0e10cSrcweir // ____ ::utl::OEventListenerAdapter ____
1550*cdf0e10cSrcweir void ChartDocumentWrapper::_disposing( const lang::EventObject& rSource )
1551*cdf0e10cSrcweir {
1552*cdf0e10cSrcweir     if( rSource.Source == m_xTitle )
1553*cdf0e10cSrcweir         m_xTitle.set( 0 );
1554*cdf0e10cSrcweir     else if( rSource.Source == m_xSubTitle )
1555*cdf0e10cSrcweir         m_xSubTitle.set( 0 );
1556*cdf0e10cSrcweir     else if( rSource.Source == m_xLegend )
1557*cdf0e10cSrcweir         m_xLegend.set( 0 );
1558*cdf0e10cSrcweir     else if( rSource.Source == m_xChartData )
1559*cdf0e10cSrcweir         m_xChartData.set( 0 );
1560*cdf0e10cSrcweir     else if( rSource.Source == m_xDiagram )
1561*cdf0e10cSrcweir         m_xDiagram.set( 0 );
1562*cdf0e10cSrcweir     else if( rSource.Source == m_xArea )
1563*cdf0e10cSrcweir         m_xArea.set( 0 );
1564*cdf0e10cSrcweir     else if( rSource.Source == m_xAddIn )
1565*cdf0e10cSrcweir         m_xAddIn.set( 0 );
1566*cdf0e10cSrcweir     else if( rSource.Source == m_xChartView )
1567*cdf0e10cSrcweir         m_xChartView.set( 0 );
1568*cdf0e10cSrcweir }
1569*cdf0e10cSrcweir 
1570*cdf0e10cSrcweir // ================================================================================
1571*cdf0e10cSrcweir 
1572*cdf0e10cSrcweir // WrappedPropertySet
1573*cdf0e10cSrcweir Reference< beans::XPropertySet > ChartDocumentWrapper::getInnerPropertySet()
1574*cdf0e10cSrcweir {
1575*cdf0e10cSrcweir     return 0;
1576*cdf0e10cSrcweir }
1577*cdf0e10cSrcweir const Sequence< beans::Property >& ChartDocumentWrapper::getPropertySequence()
1578*cdf0e10cSrcweir {
1579*cdf0e10cSrcweir     return *StaticChartDocumentWrapperPropertyArray::get();
1580*cdf0e10cSrcweir }
1581*cdf0e10cSrcweir 
1582*cdf0e10cSrcweir const std::vector< WrappedProperty* > ChartDocumentWrapper::createWrappedProperties()
1583*cdf0e10cSrcweir {
1584*cdf0e10cSrcweir     ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
1585*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedDataSourceLabelsInFirstRowProperty( m_spChart2ModelContact ) );
1586*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedDataSourceLabelsInFirstColumnProperty( m_spChart2ModelContact ) );
1587*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedHasLegendProperty( m_spChart2ModelContact ) );
1588*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedHasMainTitleProperty( m_spChart2ModelContact ) );
1589*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedHasSubTitleProperty( m_spChart2ModelContact ) );
1590*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedAddInProperty( *this ) );
1591*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedBaseDiagramProperty( *this ) );
1592*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedAdditionalShapesProperty( *this ) );
1593*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedRefreshAddInAllowedProperty( *this ) );
1594*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U("NullDate"),Any() ) ); // i99104
1595*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U( "DisableComplexChartTypes" ), uno::makeAny( sal_False ) ) );
1596*cdf0e10cSrcweir     aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U( "DisableDataTableDialog" ), uno::makeAny( sal_False ) ) );
1597*cdf0e10cSrcweir 
1598*cdf0e10cSrcweir     return aWrappedProperties;
1599*cdf0e10cSrcweir }
1600*cdf0e10cSrcweir 
1601*cdf0e10cSrcweir // ================================================================================
1602*cdf0e10cSrcweir 
1603*cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > ChartDocumentWrapper::getSupportedServiceNames_Static()
1604*cdf0e10cSrcweir {
1605*cdf0e10cSrcweir     uno::Sequence< ::rtl::OUString > aServices( 4 );
1606*cdf0e10cSrcweir     aServices[ 0 ] = C2U( "com.sun.star.chart.ChartDocument" );
1607*cdf0e10cSrcweir     aServices[ 1 ] = CHART_CHARTAPIWRAPPER_SERVICE_NAME;
1608*cdf0e10cSrcweir     aServices[ 2 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
1609*cdf0e10cSrcweir     aServices[ 3 ] = C2U( "com.sun.star.beans.PropertySet" );
1610*cdf0e10cSrcweir     return aServices;
1611*cdf0e10cSrcweir }
1612*cdf0e10cSrcweir 
1613*cdf0e10cSrcweir // implement XServiceInfo methods basing upon getSupportedServiceNames_Static
1614*cdf0e10cSrcweir APPHELPER_XSERVICEINFO_IMPL( ChartDocumentWrapper, CHART_CHARTAPIWRAPPER_IMPLEMENTATION_NAME );
1615*cdf0e10cSrcweir 
1616*cdf0e10cSrcweir } //  namespace wrapper
1617*cdf0e10cSrcweir } //  namespace chart
1618