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