Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #include "ChartModel.hxx"
21 : : #include "servicenames.hxx"
22 : : #include "MediaDescriptorHelper.hxx"
23 : : #include "macros.hxx"
24 : : #include "NoWarningThisInCTOR.hxx"
25 : : #include "DataSourceHelper.hxx"
26 : : #include "ChartModelHelper.hxx"
27 : : #include "DiagramHelper.hxx"
28 : : #include "DisposeHelper.hxx"
29 : : #include "ControllerLockGuard.hxx"
30 : : #include "ObjectIdentifier.hxx"
31 : : #include "PageBackground.hxx"
32 : : #include "CloneHelper.hxx"
33 : : #include "NameContainer.hxx"
34 : : #include "UndoManager.hxx"
35 : :
36 : : #include <com/sun/star/chart/ChartDataRowSource.hpp>
37 : :
38 : : #include <comphelper/InlineContainer.hxx>
39 : : #include <comphelper/processfactory.hxx>
40 : :
41 : : // header for class SvNumberFormatsSupplierObj
42 : : #include <svl/numuno.hxx>
43 : : #include <com/sun/star/lang/DisposedException.hpp>
44 : : #include <com/sun/star/lang/XInitialization.hpp>
45 : : #include <com/sun/star/view/XSelectionSupplier.hpp>
46 : : #include <com/sun/star/embed/XEmbedObjectCreator.hpp>
47 : : #include <com/sun/star/embed/XEmbedPersist.hpp>
48 : : #include <com/sun/star/embed/EmbedStates.hpp>
49 : : #include <com/sun/star/embed/XComponentSupplier.hpp>
50 : : #include <com/sun/star/embed/XStorage.hpp>
51 : : #include <com/sun/star/embed/EmbedMapUnits.hpp>
52 : : #include <com/sun/star/embed/Aspects.hpp>
53 : : #include <com/sun/star/awt/Gradient.hpp>
54 : : #include <com/sun/star/awt/XWindow.hpp>
55 : : #include <com/sun/star/awt/PosSize.hpp>
56 : : #include <com/sun/star/datatransfer/XTransferable.hpp>
57 : : #include <com/sun/star/drawing/Hatch.hpp>
58 : : #include <com/sun/star/drawing/LineDash.hpp>
59 : : #include <com/sun/star/drawing/XShapes.hpp>
60 : :
61 : : // header for class SvNumberFormatter
62 : : #include <svl/zforlist.hxx>
63 : :
64 : : using ::com::sun::star::uno::Sequence;
65 : : using ::com::sun::star::uno::Reference;
66 : : using ::com::sun::star::uno::RuntimeException;
67 : : using ::com::sun::star::uno::Any;
68 : : using ::rtl::OUString;
69 : : using ::osl::MutexGuard;
70 : :
71 : : using namespace ::com::sun::star;
72 : : using namespace ::apphelper;
73 : : using namespace ::chart::CloneHelper;
74 : :
75 : : namespace
76 : : {
77 : 16 : const OUString lcl_aGDIMetaFileMIMEType(
78 : : RTL_CONSTASCII_USTRINGPARAM("application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\""));
79 : 16 : const OUString lcl_aGDIMetaFileMIMETypeHighContrast(
80 : : RTL_CONSTASCII_USTRINGPARAM("application/x-openoffice-highcontrast-gdimetafile;windows_formatname=\"GDIMetaFile\""));
81 : :
82 : : } // anonymous namespace
83 : :
84 : : //-----------------------------------------------------------------
85 : : // ChartModel Constructor and Destructor
86 : : //-----------------------------------------------------------------
87 : :
88 : : namespace chart
89 : : {
90 : :
91 : 56 : ChartModel::ChartModel(uno::Reference<uno::XComponentContext > const & xContext)
92 : : : m_aLifeTimeManager( this, this )
93 : : , m_bReadOnly( sal_False )
94 : : , m_bModified( sal_False )
95 : : , m_nInLoad(0)
96 : : , m_bUpdateNotificationsPending(false)
97 : : , m_pUndoManager( NULL )
98 : : , m_aControllers( m_aModelMutex )
99 : : , m_nControllerLockCount(0)
100 : : , m_xContext( xContext )
101 : : , m_aVisualAreaSize( ChartModelHelper::getDefaultPageSize() )
102 : : , m_xDataProvider( 0 )
103 : : , m_xInternalDataProvider( 0 )
104 [ + - ]: 56 : , m_xPageBackground( new PageBackground( m_xContext ) )
105 [ + - ]: 56 : , m_xXMLNamespaceMap( createNameContainer( ::getCppuType( (const OUString*) 0 ),
106 [ + - ][ + - ]: 168 : C2U( "com.sun.star.xml.NamespaceMap" ), C2U( "com.sun.star.comp.chart.XMLNameSpaceMap" ) ), uno::UNO_QUERY)
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
107 : : {
108 : : OSL_TRACE( "ChartModel: CTOR called" );
109 : :
110 [ + - ]: 56 : osl_incrementInterlockedCount(&m_refCount);
111 : : {
112 : : m_xOldModelAgg.set(
113 [ + - ][ + - ]: 112 : m_xContext->getServiceManager()->createInstanceWithContext(
[ + - ]
114 : : CHART_CHARTAPIWRAPPER_SERVICE_NAME,
115 [ + - ][ + - ]: 56 : m_xContext ), uno::UNO_QUERY_THROW );
[ + - ]
116 [ + - ][ + - ]: 56 : m_xOldModelAgg->setDelegator( *this );
[ + - ]
117 : : }
118 : :
119 : : {
120 [ + - ][ + - ]: 56 : ModifyListenerHelper::addListener( m_xPageBackground, this );
121 [ + - ][ + - ]: 112 : m_xChartTypeManager.set( xContext->getServiceManager()->createInstanceWithContext(
[ + - ]
122 [ + - ][ + - ]: 56 : C2U( "com.sun.star.chart2.ChartTypeManager" ), m_xContext ), uno::UNO_QUERY );
[ + - ]
123 : : }
124 [ + - ]: 56 : osl_decrementInterlockedCount(&m_refCount);
125 : 56 : }
126 : :
127 : 0 : ChartModel::ChartModel( const ChartModel & rOther )
128 : : : impl::ChartModel_Base()
129 : : , m_aLifeTimeManager( this, this )
130 : : , m_bReadOnly( rOther.m_bReadOnly )
131 : : , m_bModified( rOther.m_bModified )
132 : : , m_nInLoad(0)
133 : : , m_bUpdateNotificationsPending(false)
134 : : , m_aResource( rOther.m_aResource )
135 : : , m_aMediaDescriptor( rOther.m_aMediaDescriptor )
136 : : , m_aControllers( m_aModelMutex )
137 : : , m_nControllerLockCount(0)
138 : : , m_xContext( rOther.m_xContext )
139 : : // @note: the old model aggregate must not be shared with other models if it
140 : : // is, you get mutex deadlocks
141 : : , m_xOldModelAgg( 0 ) //rOther.m_xOldModelAgg )
142 : : , m_xStorage( 0 ) //rOther.m_xStorage )
143 : : , m_aVisualAreaSize( rOther.m_aVisualAreaSize )
144 : : , m_aGraphicObjectVector( rOther.m_aGraphicObjectVector )
145 : : , m_xDataProvider( rOther.m_xDataProvider )
146 [ # # ][ # # ]: 0 : , m_xInternalDataProvider( rOther.m_xInternalDataProvider )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
147 : : {
148 : : OSL_TRACE( "ChartModel: Copy-CTOR called" );
149 : :
150 [ # # ]: 0 : osl_incrementInterlockedCount(&m_refCount);
151 : : {
152 : : m_xOldModelAgg.set(
153 [ # # ][ # # ]: 0 : m_xContext->getServiceManager()->createInstanceWithContext(
[ # # ]
154 : : CHART_CHARTAPIWRAPPER_SERVICE_NAME,
155 [ # # ][ # # ]: 0 : m_xContext ), uno::UNO_QUERY_THROW );
[ # # ]
156 [ # # ][ # # ]: 0 : m_xOldModelAgg->setDelegator( *this );
[ # # ]
157 : :
158 : 0 : Reference< util::XModifyListener > xListener;
159 [ # # ]: 0 : Reference< chart2::XTitle > xNewTitle = CreateRefClone< Reference< chart2::XTitle > >()( rOther.m_xTitle );
160 [ # # ]: 0 : Reference< chart2::XDiagram > xNewDiagram = CreateRefClone< Reference< chart2::XDiagram > >()( rOther.m_xDiagram );
161 [ # # ]: 0 : Reference< beans::XPropertySet > xNewPageBackground = CreateRefClone< Reference< beans::XPropertySet > >()( rOther.m_xPageBackground );
162 [ # # ]: 0 : Reference< chart2::XChartTypeManager > xChartTypeManager = CreateRefClone< Reference< chart2::XChartTypeManager > >()( rOther.m_xChartTypeManager );
163 [ # # ]: 0 : Reference< container::XNameAccess > xXMLNamespaceMap = CreateRefClone< Reference< container::XNameAccess > >()( rOther.m_xXMLNamespaceMap );
164 : :
165 : : {
166 [ # # ]: 0 : MutexGuard aGuard( m_aModelMutex );
167 [ # # ]: 0 : xListener = this;
168 [ # # ]: 0 : m_xTitle = xNewTitle;
169 [ # # ]: 0 : m_xDiagram = xNewDiagram;
170 [ # # ]: 0 : m_xPageBackground = xNewPageBackground;
171 [ # # ]: 0 : m_xChartTypeManager = xChartTypeManager;
172 [ # # ][ # # ]: 0 : m_xXMLNamespaceMap = xXMLNamespaceMap;
173 : : }
174 : :
175 [ # # ]: 0 : ModifyListenerHelper::addListener( xNewTitle, xListener );
176 [ # # ]: 0 : ModifyListenerHelper::addListener( xNewDiagram, xListener );
177 [ # # ]: 0 : ModifyListenerHelper::addListener( xNewPageBackground, xListener );
178 : 0 : xListener.clear();
179 : : }
180 [ # # ]: 0 : osl_decrementInterlockedCount(&m_refCount);
181 : 0 : }
182 : :
183 [ + - ][ + - ]: 56 : ChartModel::~ChartModel()
[ + - ][ + - ]
[ + - ]
184 : : {
185 : : OSL_TRACE( "ChartModel: DTOR called" );
186 [ + - ]: 56 : if( m_xOldModelAgg.is())
187 [ + - ][ + - ]: 56 : m_xOldModelAgg->setDelegator( NULL );
[ + - ]
188 [ - + ]: 112 : }
189 : :
190 : 24 : void SAL_CALL ChartModel::initialize( const Sequence< Any >& /*rArguments*/ )
191 : : throw (uno::Exception, uno::RuntimeException)
192 : : {
193 : : //#i113722# avoid duplicate creation
194 : :
195 : : //maybe additional todo?:
196 : : //support argument "EmbeddedObject"?
197 : : //support argument "EmbeddedScriptSupport"?
198 : : //support argument "DocumentRecoverySupport"?
199 : 24 : }
200 : :
201 : : //-----------------------------------------------------------------
202 : : // private methods
203 : : //-----------------------------------------------------------------
204 : :
205 : 56 : ::rtl::OUString ChartModel::impl_g_getLocation()
206 : : {
207 : :
208 [ + - ]: 56 : LifeTimeGuard aGuard(m_aLifeTimeManager);
209 [ + - ][ - + ]: 56 : if(!aGuard.startApiCall())
210 : 0 : return ::rtl::OUString(); //behave passive if already disposed or closed or throw exception @todo?
211 : : //mutex is acquired
212 [ + - ]: 56 : return m_aResource;
213 : : }
214 : :
215 : 34 : sal_Bool ChartModel::impl_isControllerConnected( const uno::Reference< frame::XController >& xController )
216 : : {
217 : : try
218 : : {
219 [ + - ]: 34 : uno::Sequence< uno::Reference<uno::XInterface> > aSeq = m_aControllers.getElements();
220 [ + - ]: 34 : for( sal_Int32 nN = aSeq.getLength(); nN--; )
221 : : {
222 [ + - ][ + - ]: 34 : if( aSeq[nN] == xController )
[ + - ]
223 : 34 : return sal_True;
224 [ + - ][ - + ]: 34 : }
[ # # ]
225 : : }
226 : 0 : catch (const uno::Exception&)
227 : : {
228 : : }
229 : 34 : return sal_False;
230 : : }
231 : :
232 : 418 : uno::Reference< frame::XController > ChartModel::impl_getCurrentController() throw(uno::RuntimeException)
233 : : {
234 : : //@todo? hold only weak references to controllers
235 : :
236 : : // get the last active controller of this model
237 [ + - ]: 418 : if( m_xCurrentController.is() )
238 : 418 : return m_xCurrentController;
239 : :
240 : : // get the first controller of this model
241 [ # # ]: 0 : if( m_aControllers.getLength() )
242 : : {
243 [ # # ][ # # ]: 0 : uno::Reference<uno::XInterface> xI = m_aControllers.getElements()[0];
[ # # ]
244 [ # # ]: 0 : return uno::Reference<frame::XController>( xI, uno::UNO_QUERY );
245 : : }
246 : :
247 : : //return nothing if no controllers are connected at all
248 : 418 : return uno::Reference< frame::XController > ();
249 : : }
250 : :
251 : 54 : void SAL_CALL ChartModel::impl_notifyCloseListeners()
252 : : throw( uno::RuntimeException)
253 : : {
254 : : ::cppu::OInterfaceContainerHelper* pIC = m_aLifeTimeManager.m_aListenerContainer
255 : 54 : .getContainer( ::getCppuType((const uno::Reference< util::XCloseListener >*)0) );
256 [ + - ]: 54 : if( pIC )
257 : : {
258 [ + - ][ + - ]: 54 : lang::EventObject aEvent( static_cast< lang::XComponent*>(this) );
259 [ + - ]: 54 : ::cppu::OInterfaceIteratorHelper aIt( *pIC );
260 [ - + ]: 54 : while( aIt.hasMoreElements() )
261 : : {
262 [ # # ][ # # ]: 0 : uno::Reference< util::XCloseListener > xListener( aIt.next(), uno::UNO_QUERY );
263 [ # # ]: 0 : if( xListener.is() )
264 [ # # ][ # # ]: 0 : xListener->notifyClosing( aEvent );
265 [ + - ][ + - ]: 54 : }
266 : : }
267 : 54 : }
268 : :
269 : 32 : void ChartModel::impl_adjustAdditionalShapesPositionAndSize( const awt::Size& aVisualAreaSize )
270 : : {
271 [ + - ]: 32 : uno::Reference< beans::XPropertySet > xProperties( static_cast< ::cppu::OWeakObject* >( this ), uno::UNO_QUERY );
272 [ + - ]: 32 : if ( xProperties.is() )
273 : : {
274 : 32 : uno::Reference< drawing::XShapes > xShapes;
275 [ + - ][ + - ]: 32 : xProperties->getPropertyValue( C2U( "AdditionalShapes" ) ) >>= xShapes;
[ + - ][ + - ]
276 [ - + ]: 32 : if ( xShapes.is() )
277 : : {
278 [ # # ][ # # ]: 0 : sal_Int32 nCount = xShapes->getCount();
279 [ # # ]: 0 : for ( sal_Int32 i = 0; i < nCount; ++i )
280 : : {
281 : 0 : Reference< drawing::XShape > xShape;
282 [ # # ][ # # ]: 0 : if ( xShapes->getByIndex( i ) >>= xShape )
[ # # ][ # # ]
283 : : {
284 [ # # ]: 0 : if ( xShape.is() )
285 : : {
286 [ # # ][ # # ]: 0 : awt::Point aPos( xShape->getPosition() );
287 [ # # ][ # # ]: 0 : awt::Size aSize( xShape->getSize() );
288 : :
289 : 0 : double fWidth = static_cast< double >( aVisualAreaSize.Width ) / m_aVisualAreaSize.Width;
290 : 0 : double fHeight = static_cast< double >( aVisualAreaSize.Height ) / m_aVisualAreaSize.Height;
291 : :
292 : 0 : aPos.X = static_cast< long >( aPos.X * fWidth );
293 : 0 : aPos.Y = static_cast< long >( aPos.Y * fHeight );
294 : 0 : aSize.Width = static_cast< long >( aSize.Width * fWidth );
295 : 0 : aSize.Height = static_cast< long >( aSize.Height * fHeight );
296 : :
297 [ # # ][ # # ]: 0 : xShape->setPosition( aPos );
298 [ # # ][ # # ]: 0 : xShape->setSize( aSize );
299 : : }
300 : : }
301 : 0 : }
302 : 32 : }
303 : 32 : }
304 : 32 : }
305 : :
306 : : //-----------------------------------------------------------------
307 : : // lang::XServiceInfo
308 : : //-----------------------------------------------------------------
309 : :
310 [ + - ][ + - ]: 2452 : APPHELPER_XSERVICEINFO_IMPL(ChartModel,CHART_MODEL_SERVICE_IMPLEMENTATION_NAME)
[ + + ][ + + ]
[ + - ]
311 : :
312 : 1110 : uno::Sequence< rtl::OUString > ChartModel::getSupportedServiceNames_Static()
313 : : {
314 : 1110 : uno::Sequence< rtl::OUString > aSNS( 3 );
315 [ + - ][ + - ]: 1110 : aSNS[0] = CHART_MODEL_SERVICE_NAME;
316 [ + - ][ + - ]: 1110 : aSNS[1] = C2U( "com.sun.star.document.OfficeDocument" );
317 [ + - ][ + - ]: 1110 : aSNS[2] = C2U( "com.sun.star.chart.ChartDocument" );
318 : : //// @todo : add additional services if you support any further
319 : 1110 : return aSNS;
320 : : }
321 : :
322 : : //-----------------------------------------------------------------
323 : : // frame::XModel (required interface)
324 : : //-----------------------------------------------------------------
325 : :
326 : 54 : sal_Bool SAL_CALL ChartModel::attachResource( const ::rtl::OUString& rURL
327 : : , const uno::Sequence< beans::PropertyValue >& rMediaDescriptor )
328 : : throw(uno::RuntimeException)
329 : : {
330 : : /*
331 : : The method attachResource() is used by the frame loader implementations
332 : : to inform the model about its URL and MediaDescriptor.
333 : : */
334 : :
335 [ + - ]: 54 : LifeTimeGuard aGuard(m_aLifeTimeManager);
336 [ + - ][ - + ]: 54 : if(!aGuard.startApiCall())
337 : 0 : return sal_False; //behave passive if already disposed or closed or throw exception @todo?
338 : : //mutex is acquired
339 : :
340 [ - + ]: 54 : if(!m_aResource.isEmpty())//we have a resource already //@todo? or is setting a new resource allowed?
341 : 0 : return sal_False;
342 : 54 : m_aResource = rURL;
343 [ + - ]: 54 : m_aMediaDescriptor = rMediaDescriptor;
344 : :
345 : : //@todo ? check rURL ??
346 : : //@todo ? evaluate m_aMediaDescriptor;
347 : : //@todo ? ... ??? --> nothing, this method is only for setting informations
348 : :
349 [ + - ]: 54 : return sal_True;
350 : : }
351 : :
352 : 56 : ::rtl::OUString SAL_CALL ChartModel::getURL() throw(uno::RuntimeException)
353 : : {
354 : 56 : return impl_g_getLocation();
355 : : }
356 : :
357 : 2 : uno::Sequence< beans::PropertyValue > SAL_CALL ChartModel::getArgs() throw(uno::RuntimeException)
358 : : {
359 : : /*
360 : : The method getArgs() returns a sequence of property values
361 : : that report the resource description according to com.sun.star.document.MediaDescriptor,
362 : : specified on loading or saving with storeAsURL.
363 : : */
364 : :
365 [ + - ]: 2 : LifeTimeGuard aGuard(m_aLifeTimeManager);
366 [ + - ][ - + ]: 2 : if(!aGuard.startApiCall())
367 [ # # ]: 0 : return uno::Sequence< beans::PropertyValue >(); //behave passive if already disposed or closed or throw exception @todo?
368 : : //mutex is acquired
369 : :
370 [ + - ][ + - ]: 2 : return m_aMediaDescriptor;
371 : : }
372 : :
373 : 34 : void SAL_CALL ChartModel::connectController( const uno::Reference< frame::XController >& xController )
374 : : throw(uno::RuntimeException)
375 : : {
376 : : //@todo? this method is declared as oneway -> ...?
377 : :
378 [ + - ]: 34 : LifeTimeGuard aGuard(m_aLifeTimeManager);
379 [ + - ][ - + ]: 34 : if(!aGuard.startApiCall())
380 : 34 : return ; //behave passive if already disposed or closed
381 : : //mutex is acquired
382 : :
383 : : //--add controller
384 [ + - ][ + - ]: 34 : m_aControllers.addInterface(xController);
[ + - ]
385 : : }
386 : :
387 : 2 : void SAL_CALL ChartModel::disconnectController( const uno::Reference< frame::XController >& xController )
388 : : throw(uno::RuntimeException)
389 : : {
390 : : //@todo? this method is declared as oneway -> ...?
391 : :
392 [ + - ]: 2 : LifeTimeGuard aGuard(m_aLifeTimeManager);
393 [ + - ][ - + ]: 2 : if(!aGuard.startApiCall())
394 : 2 : return; //behave passive if already disposed or closed
395 : :
396 : : //--remove controller
397 [ + - ]: 2 : m_aControllers.removeInterface(xController);
398 : :
399 : : //case: current controller is disconnected:
400 [ + - ][ + - ]: 2 : if( m_xCurrentController == xController )
401 : 2 : m_xCurrentController.clear();
402 : :
403 [ + - ][ + - ]: 2 : DisposeHelper::DisposeAndClear( m_xRangeHighlighter );
[ + - ]
404 : : }
405 : :
406 : 333 : void SAL_CALL ChartModel::lockControllers() throw(uno::RuntimeException)
407 : : {
408 : : /*
409 : : suspends some notifications to the controllers which are used for display updates.
410 : :
411 : : The calls to lockControllers() and unlockControllers() may be nested
412 : : and even overlapping, but they must be in pairs. While there is at least one lock
413 : : remaining, some notifications for display updates are not broadcasted.
414 : : */
415 : :
416 : : //@todo? this method is declared as oneway -> ...?
417 : :
418 [ + - ]: 333 : LifeTimeGuard aGuard(m_aLifeTimeManager);
419 [ + - ][ - + ]: 333 : if(!aGuard.startApiCall())
420 : 333 : return; //behave passive if already disposed or closed or throw exception @todo?
421 [ + - ][ + - ]: 333 : ++m_nControllerLockCount;
422 : : }
423 : :
424 : 333 : void SAL_CALL ChartModel::unlockControllers() throw(uno::RuntimeException)
425 : : {
426 : : /*
427 : : resumes the notifications which were suspended by lockControllers() .
428 : :
429 : : The calls to lockControllers() and unlockControllers() may be nested
430 : : and even overlapping, but they must be in pairs. While there is at least one lock
431 : : remaining, some notifications for display updates are not broadcasted.
432 : : */
433 : :
434 : : //@todo? this method is declared as oneway -> ...?
435 : :
436 [ + - ]: 333 : LifeTimeGuard aGuard(m_aLifeTimeManager);
437 [ + - ][ - + ]: 333 : if(!aGuard.startApiCall())
438 : : return; //behave passive if already disposed or closed or throw exception @todo?
439 [ - + ]: 333 : if( m_nControllerLockCount == 0 )
440 : : {
441 : : OSL_TRACE( "ChartModel: unlockControllers called with m_nControllerLockCount == 0" );
442 : : return;
443 : : }
444 : 333 : --m_nControllerLockCount;
445 [ + + ][ + + ]: 333 : if( m_nControllerLockCount == 0 && m_bUpdateNotificationsPending )
[ + + ]
446 : : {
447 [ + - ]: 178 : aGuard.clear();
448 [ + - ]: 333 : impl_notifyModifiedListeners();
449 [ + - ][ + - ]: 333 : }
450 : : }
451 : :
452 : 12 : sal_Bool SAL_CALL ChartModel::hasControllersLocked() throw(uno::RuntimeException)
453 : : {
454 [ + - ]: 12 : LifeTimeGuard aGuard(m_aLifeTimeManager);
455 [ + - ][ - + ]: 12 : if(!aGuard.startApiCall())
456 : 0 : return sal_False; //behave passive if already disposed or closed or throw exception @todo?
457 [ + - ]: 12 : return ( m_nControllerLockCount != 0 ) ;
458 : : }
459 : :
460 : 418 : uno::Reference< frame::XController > SAL_CALL ChartModel::getCurrentController() throw(uno::RuntimeException)
461 : : {
462 [ + - ]: 418 : LifeTimeGuard aGuard(m_aLifeTimeManager);
463 [ + - ][ - + ]: 418 : if(!aGuard.startApiCall())
464 : : throw lang::DisposedException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
465 : : "getCurrentController was called on an already disposed or closed model" ) )
466 [ # # ][ # # ]: 0 : , static_cast< ::cppu::OWeakObject* >(this));
[ # # ]
467 : :
468 [ + - ][ + - ]: 418 : return impl_getCurrentController();
469 : : }
470 : :
471 : 34 : void SAL_CALL ChartModel::setCurrentController( const uno::Reference< frame::XController >& xController )
472 : : throw(container::NoSuchElementException, uno::RuntimeException)
473 : : {
474 [ + - ]: 34 : LifeTimeGuard aGuard(m_aLifeTimeManager);
475 [ + - ][ - + ]: 34 : if(!aGuard.startApiCall())
476 : : throw lang::DisposedException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
477 : : "setCurrentController was called on an already disposed or closed model" ) )
478 [ # # ][ # # ]: 0 : , static_cast< ::cppu::OWeakObject* >(this));
[ # # ]
479 : :
480 : : //OSL_ENSURE( impl_isControllerConnected(xController), "setCurrentController is called with a Controller which is not connected" );
481 [ + - ][ - + ]: 34 : if(!impl_isControllerConnected(xController))
482 : : throw container::NoSuchElementException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
483 : : "setCurrentController is called with a Controller which is not connected" ) )
484 [ # # ][ # # ]: 0 : , static_cast< ::cppu::OWeakObject* >(this));
[ # # ]
485 : :
486 [ + - ]: 34 : m_xCurrentController = xController;
487 : :
488 [ + - ][ + - ]: 34 : DisposeHelper::DisposeAndClear( m_xRangeHighlighter );
489 : 34 : }
490 : :
491 : 0 : uno::Reference< uno::XInterface > SAL_CALL ChartModel::getCurrentSelection() throw(uno::RuntimeException)
492 : : {
493 [ # # ]: 0 : LifeTimeGuard aGuard(m_aLifeTimeManager);
494 [ # # ][ # # ]: 0 : if(!aGuard.startApiCall())
495 : : throw lang::DisposedException(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
496 : : "getCurrentSelection was called on an already disposed or closed model" ) )
497 [ # # ][ # # ]: 0 : , static_cast< ::cppu::OWeakObject* >(this));
[ # # ]
498 : :
499 : :
500 : 0 : uno::Reference< uno::XInterface > xReturn;
501 [ # # ]: 0 : uno::Reference< frame::XController > xController = impl_getCurrentController();
502 : :
503 [ # # ]: 0 : aGuard.clear();
504 [ # # ]: 0 : if( xController.is() )
505 : : {
506 [ # # ]: 0 : uno::Reference< view::XSelectionSupplier > xSelectionSupl( xController, uno::UNO_QUERY );
507 [ # # ]: 0 : if ( xSelectionSupl.is() )
508 : : {
509 [ # # ][ # # ]: 0 : uno::Any aSel = xSelectionSupl->getSelection();
510 : 0 : rtl::OUString aObjectCID;
511 [ # # ]: 0 : if( aSel >>= aObjectCID )
512 [ # # ][ # # ]: 0 : xReturn.set( ObjectIdentifier::getObjectPropertySet( aObjectCID, Reference< XChartDocument >(this)));
[ # # ]
513 : 0 : }
514 : : }
515 [ # # ]: 0 : return xReturn;
516 : : }
517 : :
518 : :
519 : : //-----------------------------------------------------------------
520 : : // lang::XComponent (base of XModel)
521 : : //-----------------------------------------------------------------
522 : 112 : void SAL_CALL ChartModel::dispose() throw(uno::RuntimeException)
523 : : {
524 [ + - ]: 112 : Reference< XInterface > xKeepAlive( *this );
525 : :
526 : : //This object should release all resources and references in the
527 : : //easiest possible manner
528 : : //This object must notify all registered listeners using the method
529 : : //<member>XEventListener::disposing</member>
530 : :
531 : : //hold no mutex
532 [ + - ][ + + ]: 112 : if( !m_aLifeTimeManager.dispose() )
533 : 112 : return;
534 : :
535 : : //--release all resources and references
536 : : //// @todo
537 : :
538 [ + - ]: 56 : if ( m_xDiagram.is() )
539 [ + - ][ + - ]: 56 : ModifyListenerHelper::removeListener( m_xDiagram, this );
540 : :
541 : 56 : m_xDataProvider.clear();
542 : 56 : m_xInternalDataProvider.clear();
543 : 56 : m_xNumberFormatsSupplier.clear();
544 [ + - ]: 56 : DisposeHelper::DisposeAndClear( m_xOwnNumberFormatsSupplier );
545 [ + - ]: 56 : DisposeHelper::DisposeAndClear( m_xChartTypeManager );
546 [ + - ]: 56 : DisposeHelper::DisposeAndClear( m_xDiagram );
547 [ + - ]: 56 : DisposeHelper::DisposeAndClear( m_xTitle );
548 [ + - ]: 56 : DisposeHelper::DisposeAndClear( m_xPageBackground );
549 [ + - ]: 56 : DisposeHelper::DisposeAndClear( m_xXMLNamespaceMap );
550 : :
551 : 56 : m_xStorage.clear();
552 : : // just clear, don't dispose - we're not the owner
553 : :
554 [ + + ]: 56 : if ( m_pUndoManager.is() )
555 [ + - ]: 34 : m_pUndoManager->disposing();
556 : 56 : m_pUndoManager.clear();
557 : : // that's important, since the UndoManager implementation delegates its ref counting to ourself.
558 : :
559 [ + - ][ + - ]: 56 : m_aControllers.disposeAndClear( lang::EventObject( static_cast< cppu::OWeakObject * >( this )));
[ + - ][ + - ]
560 : 56 : m_xCurrentController.clear();
561 : :
562 [ + - ]: 56 : DisposeHelper::DisposeAndClear( m_xRangeHighlighter );
563 : :
564 [ + - ]: 56 : if( m_xOldModelAgg.is())
565 [ + - ][ + - ]: 56 : m_xOldModelAgg->setDelegator( NULL );
[ + - ]
566 : :
567 [ + + ]: 112 : OSL_TRACE( "ChartModel: dispose() called" );
568 : : }
569 : :
570 : 43 : void SAL_CALL ChartModel::addEventListener( const uno::Reference< lang::XEventListener > & xListener )
571 : : throw(uno::RuntimeException)
572 : : {
573 [ - + ]: 43 : if( m_aLifeTimeManager.impl_isDisposedOrClosed() )
574 : 43 : return; //behave passive if already disposed or closed
575 : :
576 : 43 : m_aLifeTimeManager.m_aListenerContainer.addInterface( ::getCppuType((const uno::Reference< lang::XEventListener >*)0), xListener );
577 : : }
578 : :
579 : 41 : void SAL_CALL ChartModel::removeEventListener( const uno::Reference< lang::XEventListener > & xListener )
580 : : throw(uno::RuntimeException)
581 : : {
582 [ - + ]: 41 : if( m_aLifeTimeManager.impl_isDisposedOrClosed(false) )
583 : 0 : return; //behave passive if already disposed or closed
584 : :
585 : 41 : m_aLifeTimeManager.m_aListenerContainer.removeInterface( ::getCppuType((const uno::Reference< lang::XEventListener >*)0), xListener );
586 : 41 : return;
587 : : }
588 : :
589 : : //-----------------------------------------------------------------
590 : : // util::XCloseBroadcaster (base of XCloseable)
591 : : //-----------------------------------------------------------------
592 : 58 : void SAL_CALL ChartModel::addCloseListener( const uno::Reference< util::XCloseListener > & xListener )
593 : : throw(uno::RuntimeException)
594 : : {
595 : 58 : m_aLifeTimeManager.g_addCloseListener( xListener );
596 : 58 : }
597 : :
598 : 32 : void SAL_CALL ChartModel::removeCloseListener( const uno::Reference< util::XCloseListener > & xListener )
599 : : throw(uno::RuntimeException)
600 : : {
601 [ + + ]: 32 : if( m_aLifeTimeManager.impl_isDisposedOrClosed(false) )
602 : 30 : return; //behave passive if already disposed or closed
603 : :
604 : 2 : m_aLifeTimeManager.m_aListenerContainer.removeInterface( ::getCppuType((const uno::Reference< util::XCloseListener >*)0), xListener );
605 : 32 : return;
606 : : }
607 : :
608 : : //-----------------------------------------------------------------
609 : : // util::XCloseable
610 : : //-----------------------------------------------------------------
611 : 56 : void SAL_CALL ChartModel::close( sal_Bool bDeliverOwnership )
612 : : throw( util::CloseVetoException,
613 : : uno::RuntimeException )
614 : : {
615 : : //hold no mutex
616 : :
617 [ + + ][ + - ]: 56 : if( !m_aLifeTimeManager.g_close_startTryClose( bDeliverOwnership ) )
618 : 54 : return;
619 : : //no mutex is acquired
620 : :
621 : : // At the end of this method may we must dispose ourself ...
622 : : // and may nobody from outside hold a reference to us ...
623 : : // then it's a good idea to do that by ourself.
624 [ + - ]: 54 : uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >(this) );
625 : :
626 : : //the listeners have had no veto
627 : : //check whether we self can close
628 : : {
629 : : util::CloseVetoException aVetoException = util::CloseVetoException(
630 : : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
631 : : "the model itself could not be closed" ) )
632 [ + - ][ + - ]: 54 : , static_cast< ::cppu::OWeakObject* >(this));
[ + - ]
633 : :
634 [ - + ][ + - ]: 54 : if( m_aLifeTimeManager.g_close_isNeedToCancelLongLastingCalls( bDeliverOwnership, aVetoException ) )
635 : : {
636 : : ////you can empty this block, if you never start longlasting calls or
637 : : ////if your longlasting calls are per default not cancelable (check how you have constructed your LifeTimeManager)
638 : :
639 : 0 : sal_Bool bLongLastingCallsAreCanceled = sal_False;
640 : : try
641 : : {
642 : : //try to cancel running longlasting calls
643 : : //// @todo
644 : : }
645 : : catch (const uno::Exception&)
646 : : {
647 : : //// @todo
648 : : //do not throw anything here!! (without endTryClose)
649 : : }
650 : : //if not successful canceled
651 [ # # ]: 0 : if(!bLongLastingCallsAreCanceled)
652 : : {
653 [ # # ]: 0 : m_aLifeTimeManager.g_close_endTryClose( bDeliverOwnership, sal_True );
654 [ # # ]: 0 : throw aVetoException;
655 : : }
656 [ + - ]: 54 : }
657 : :
658 : : }
659 [ + - ]: 54 : m_aLifeTimeManager.g_close_endTryClose_doClose();
660 : :
661 : : // BM @todo: is it ok to call the listeners here?
662 [ + - ]: 56 : impl_notifyCloseListeners();
663 : : }
664 : :
665 : : //-----------------------------------------------------------------
666 : : // lang::XTypeProvider
667 : : //-----------------------------------------------------------------
668 : 0 : uno::Sequence< uno::Type > SAL_CALL ChartModel::getTypes()
669 : : throw (uno::RuntimeException)
670 : : {
671 : 0 : uno::Reference< lang::XTypeProvider > xAggTypeProvider;
672 [ # # ][ # # ]: 0 : if( (m_xOldModelAgg->queryAggregation( ::getCppuType( & xAggTypeProvider )) >>= xAggTypeProvider)
[ # # ]
[ # # # # ]
[ # # ]
[ # # # # ]
[ # # ]
673 : 0 : && xAggTypeProvider.is())
674 : : {
675 [ # # ]: 0 : uno::Sequence< uno::Type > aOwnTypes( impl::ChartModel_Base::getTypes());
676 [ # # ][ # # ]: 0 : uno::Sequence< uno::Type > aAggTypes( xAggTypeProvider->getTypes());
677 [ # # ]: 0 : uno::Sequence< uno::Type > aResult( aOwnTypes.getLength() + aAggTypes.getLength());
678 : 0 : sal_Int32 i=0;
679 [ # # ]: 0 : for( ;i<aOwnTypes.getLength(); ++i )
680 [ # # ][ # # ]: 0 : aResult[i] = aOwnTypes[i];
681 [ # # ]: 0 : for( sal_Int32 j=0; i<aResult.getLength(); ++j, ++i)
682 [ # # ][ # # ]: 0 : aResult[i] = aAggTypes[j];
683 [ # # ][ # # ]: 0 : return aResult;
[ # # ][ # # ]
684 : : }
685 : :
686 [ # # ]: 0 : return impl::ChartModel_Base::getTypes();
687 : : }
688 : :
689 : : //-----------------------------------------------------------------
690 : : // document::XDocumentPropertiesSupplier
691 : : //-----------------------------------------------------------------
692 : : uno::Reference< document::XDocumentProperties > SAL_CALL
693 : 165 : ChartModel::getDocumentProperties() throw (uno::RuntimeException)
694 : : {
695 [ + - ]: 165 : ::osl::MutexGuard aGuard( m_aModelMutex );
696 [ + + ]: 165 : if ( !m_xDocumentProperties.is() )
697 : : {
698 : : uno::Reference< document::XDocumentProperties > xDocProps(
699 [ + - ][ + - ]: 26 : ::comphelper::getProcessServiceFactory()->createInstance(
700 [ + - ][ + - ]: 13 : C2U("com.sun.star.document.DocumentProperties") ), uno::UNO_QUERY );
[ + - ]
701 [ + - ]: 13 : m_xDocumentProperties.set(xDocProps);
702 : : }
703 [ + - ]: 165 : return m_xDocumentProperties;
704 : : }
705 : :
706 : : //-----------------------------------------------------------------
707 : : // document::XDocumentPropertiesSupplier
708 : : //-----------------------------------------------------------------
709 : 76 : Reference< document::XUndoManager > SAL_CALL ChartModel::getUndoManager( ) throw (RuntimeException)
710 : : {
711 [ + - ]: 76 : ::osl::MutexGuard aGuard( m_aModelMutex );
712 [ + + ]: 76 : if ( !m_pUndoManager.is() )
713 [ + - ][ + - ]: 34 : m_pUndoManager.set( new UndoManager( *this, m_aModelMutex ) );
714 [ + - ][ + - ]: 76 : return m_pUndoManager.get();
[ + - ]
715 : : }
716 : :
717 : : //-----------------------------------------------------------------
718 : : // chart2::XChartDocument
719 : : //-----------------------------------------------------------------
720 : :
721 : 118250 : uno::Reference< chart2::XDiagram > SAL_CALL ChartModel::getFirstDiagram()
722 : : throw (uno::RuntimeException)
723 : : {
724 [ + - ]: 118250 : MutexGuard aGuard( m_aModelMutex );
725 [ + - ]: 118250 : return m_xDiagram;
726 : : }
727 : :
728 : 96 : void SAL_CALL ChartModel::setFirstDiagram( const uno::Reference< chart2::XDiagram >& xDiagram )
729 : : throw (uno::RuntimeException)
730 : : {
731 : 96 : Reference< chart2::XDiagram > xOldDiagram;
732 : 96 : Reference< util::XModifyListener > xListener;
733 : : {
734 [ + - ]: 96 : MutexGuard aGuard( m_aModelMutex );
735 [ + - ][ + + ]: 96 : if( xDiagram == m_xDiagram )
736 : 96 : return;
737 [ + - ]: 62 : xOldDiagram = m_xDiagram;
738 [ + - ]: 62 : m_xDiagram = xDiagram;
739 [ + - ][ + - ]: 96 : xListener = this;
[ + + ]
740 : : }
741 : : //don't keep the mutex locked while calling out
742 [ + - ]: 96 : ModifyListenerHelper::removeListener( xOldDiagram, xListener );
743 [ + - ]: 62 : ModifyListenerHelper::addListener( xDiagram, xListener );
744 [ + - ][ + + ]: 96 : setModified( sal_True );
[ + + ]
745 : : }
746 : :
747 : 50 : Reference< chart2::data::XDataSource > ChartModel::impl_createDefaultData()
748 : : {
749 : 50 : Reference< chart2::data::XDataSource > xDataSource;
750 [ + - ][ + - ]: 50 : if( hasInternalDataProvider() )
751 : : {
752 [ + - ]: 50 : uno::Reference< lang::XInitialization > xIni(m_xInternalDataProvider,uno::UNO_QUERY);
753 [ + - ]: 50 : if( xIni.is() )
754 : : {
755 : : //init internal dataprovider
756 : : {
757 [ + - ]: 50 : uno::Sequence< uno::Any > aArgs(1);
758 [ + - ][ + - ]: 50 : beans::NamedValue aParam(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CreateDefaultData")),uno::makeAny(sal_True));
759 [ + - ][ + - ]: 50 : aArgs[0] <<= aParam;
760 [ + - ][ + - ]: 50 : xIni->initialize(aArgs);
[ + - ]
761 : : }
762 : : //create data
763 [ + - ]: 50 : uno::Sequence< beans::PropertyValue > aArgs( 4 );
764 [ + - ]: 50 : aArgs[0] = beans::PropertyValue(
765 : : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CellRangeRepresentation" )), -1,
766 [ + - ][ + - ]: 100 : uno::makeAny( C2U("all") ), beans::PropertyState_DIRECT_VALUE );
[ + - ]
767 [ + - ]: 50 : aArgs[1] = beans::PropertyValue(
768 : : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HasCategories" )), -1,
769 [ + - ][ + - ]: 100 : uno::makeAny( true ), beans::PropertyState_DIRECT_VALUE );
770 [ + - ]: 50 : aArgs[2] = beans::PropertyValue(
771 : : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FirstCellAsLabel" )), -1,
772 [ + - ][ + - ]: 100 : uno::makeAny( true ), beans::PropertyState_DIRECT_VALUE );
773 [ + - ]: 50 : aArgs[3] = beans::PropertyValue(
774 : : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DataRowSource" )), -1,
775 [ + - ][ + - ]: 100 : uno::makeAny( ::com::sun::star::chart::ChartDataRowSource_COLUMNS ), beans::PropertyState_DIRECT_VALUE );
776 [ + - ][ + - ]: 50 : xDataSource = m_xInternalDataProvider->createDataSource( aArgs );
[ + - ][ + - ]
777 : 50 : }
778 : : }
779 : 50 : return xDataSource;
780 : : }
781 : :
782 : 76 : void SAL_CALL ChartModel::createInternalDataProvider( sal_Bool bCloneExistingData )
783 : : throw (util::CloseVetoException, uno::RuntimeException)
784 : : {
785 : : // don't lock the mutex, because this call calls out to code that tries to
786 : : // lock the solar mutex. On the other hand, a paint locks the solar mutex
787 : : // and calls to the model lock the model's mutex => deadlock
788 : : // @todo: lock a separate mutex in the InternalData class
789 [ + + ]: 76 : if( !hasInternalDataProvider() )
790 : : {
791 [ - + ]: 56 : if( bCloneExistingData )
792 [ # # ][ # # ]: 0 : m_xInternalDataProvider = ChartModelHelper::createInternalDataProvider( this, true );
793 : : else
794 [ + - ][ + - ]: 56 : m_xInternalDataProvider = ChartModelHelper::createInternalDataProvider( Reference<XChartDocument>(), true );
795 : 56 : m_xDataProvider.set( m_xInternalDataProvider );
796 : : }
797 : 76 : setModified( sal_True );
798 : 76 : }
799 : :
800 : 7906 : sal_Bool SAL_CALL ChartModel::hasInternalDataProvider()
801 : : throw (uno::RuntimeException)
802 : : {
803 [ + + ][ + + ]: 7906 : return m_xDataProvider.is() && m_xInternalDataProvider.is();
804 : : }
805 : :
806 : 3216 : uno::Reference< chart2::data::XDataProvider > SAL_CALL ChartModel::getDataProvider()
807 : : throw (uno::RuntimeException)
808 : : {
809 [ + - ]: 3216 : MutexGuard aGuard( m_aModelMutex );
810 [ + - ]: 3216 : return m_xDataProvider;
811 : : }
812 : :
813 : : // ____ XDataReceiver ____
814 : :
815 : 16 : void SAL_CALL ChartModel::attachDataProvider( const uno::Reference< chart2::data::XDataProvider >& xDataProvider )
816 : : throw (uno::RuntimeException)
817 : : {
818 : : {
819 [ + - ]: 16 : MutexGuard aGuard( m_aModelMutex );
820 [ + - ]: 16 : uno::Reference< beans::XPropertySet > xProp( xDataProvider, uno::UNO_QUERY );
821 [ + - ]: 16 : if( xProp.is() )
822 : : {
823 : : try
824 : : {
825 [ + - ][ + - ]: 16 : sal_Bool bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( Reference< frame::XModel >(this) );
826 [ + - ][ + - ]: 16 : xProp->setPropertyValue(C2U("IncludeHiddenCells"), uno::makeAny(bIncludeHiddenCells));
[ + - ][ # # ]
[ + - ]
827 : : }
828 [ # # ]: 0 : catch (const beans::UnknownPropertyException&)
829 : : {
830 : : }
831 : : }
832 : :
833 [ + - ]: 16 : m_xDataProvider.set( xDataProvider );
834 [ + - ]: 16 : m_xInternalDataProvider.clear();
835 : :
836 : : //the numberformatter is kept independent of the data provider!
837 : : }
838 : 16 : setModified( sal_True );
839 : 16 : }
840 : :
841 : 16 : void SAL_CALL ChartModel::attachNumberFormatsSupplier( const uno::Reference< util::XNumberFormatsSupplier >& xNewSupplier )
842 : : throw (uno::RuntimeException)
843 : : {
844 : : {
845 [ + - ]: 16 : MutexGuard aGuard( m_aModelMutex );
846 [ + - ][ - + ]: 16 : if( xNewSupplier==m_xNumberFormatsSupplier )
847 : : return;
848 [ + - ][ - + ]: 16 : if( xNewSupplier==m_xOwnNumberFormatsSupplier )
849 : : return;
850 [ - + ][ # # ]: 16 : if( m_xOwnNumberFormatsSupplier.is() && xNewSupplier.is() )
[ + - ]
851 : : {
852 : : //@todo
853 : : //merge missing numberformats from own to new formatter
854 : : }
855 [ - + ]: 16 : else if( !xNewSupplier.is() )
856 : : {
857 : 0 : if( m_xNumberFormatsSupplier.is() )
858 : : {
859 : : //@todo
860 : : //merge missing numberformats from old numberformatter to own numberformatter
861 : : //create own numberformatter if necessary
862 : : }
863 : : }
864 : :
865 [ + - ]: 16 : m_xNumberFormatsSupplier.set( xNewSupplier );
866 [ + - ][ + - ]: 16 : m_xOwnNumberFormatsSupplier.clear();
867 : : }
868 : 16 : setModified( sal_True );
869 : : }
870 : :
871 : 16 : void SAL_CALL ChartModel::setArguments( const Sequence< beans::PropertyValue >& aArguments )
872 : : throw (lang::IllegalArgumentException,
873 : : uno::RuntimeException)
874 : : {
875 : : {
876 [ + - ]: 16 : MutexGuard aGuard( m_aModelMutex );
877 [ - + ]: 16 : if( !m_xDataProvider.is() )
878 : 16 : return;
879 [ + - ]: 16 : lockControllers();
880 : :
881 : : try
882 : : {
883 [ + - ][ + - ]: 16 : Reference< chart2::data::XDataSource > xDataSource( m_xDataProvider->createDataSource( aArguments ) );
884 [ + - ]: 16 : if( xDataSource.is() )
885 : : {
886 [ + - ]: 16 : Reference< chart2::XDiagram > xDia( getFirstDiagram() );
887 [ - + ]: 16 : if( !xDia.is() )
888 : : {
889 [ # # ]: 0 : Reference< chart2::XChartTypeTemplate > xTemplate( impl_createDefaultChartTypeTemplate() );
890 [ # # ]: 0 : if( xTemplate.is())
891 [ # # ][ # # ]: 0 : setFirstDiagram( xTemplate->createDiagramByDataSource( xDataSource, aArguments ) );
[ # # ]
892 : : }
893 : : else
894 [ + - ][ + - ]: 16 : xDia->setDiagramData( xDataSource, aArguments );
895 : 16 : }
896 : : }
897 [ # # # ]: 0 : catch (const lang::IllegalArgumentException&)
898 : : {
899 : 0 : throw;
900 : : }
901 [ # # ]: 0 : catch (const uno::Exception& ex)
902 : : {
903 : : ASSERT_EXCEPTION( ex );
904 : : }
905 [ + - ][ + - ]: 16 : unlockControllers();
[ + - ]
906 : : }
907 : 16 : setModified( sal_True );
908 : : }
909 : :
910 : 6 : Sequence< OUString > SAL_CALL ChartModel::getUsedRangeRepresentations()
911 : : throw (uno::RuntimeException)
912 : : {
913 [ + - ]: 6 : return DataSourceHelper::getUsedDataRanges( Reference< frame::XModel >(this));
914 : : }
915 : :
916 : 25 : Reference< chart2::data::XDataSource > SAL_CALL ChartModel::getUsedData()
917 : : throw (uno::RuntimeException)
918 : : {
919 [ + - ]: 25 : return DataSourceHelper::getUsedData( Reference< chart2::XChartDocument >(this));
920 : : }
921 : :
922 : 2 : Reference< chart2::data::XRangeHighlighter > SAL_CALL ChartModel::getRangeHighlighter()
923 : : throw (uno::RuntimeException)
924 : : {
925 [ + - ]: 2 : if( ! m_xRangeHighlighter.is())
926 : : {
927 [ + - ][ + - ]: 2 : uno::Reference< view::XSelectionSupplier > xSelSupp( this->getCurrentController(), uno::UNO_QUERY );
928 [ + - ]: 2 : if( xSelSupp.is() )
929 [ + - ][ + - ]: 2 : m_xRangeHighlighter.set( ChartModelHelper::createRangeHighlighter( xSelSupp ));
930 : : }
931 : 2 : return m_xRangeHighlighter;
932 : : }
933 : :
934 : 50 : Reference< chart2::XChartTypeTemplate > ChartModel::impl_createDefaultChartTypeTemplate()
935 : : {
936 : 50 : Reference< chart2::XChartTypeTemplate > xTemplate;
937 [ + - ]: 50 : Reference< lang::XMultiServiceFactory > xFact( m_xChartTypeManager, uno::UNO_QUERY );
938 [ + - ]: 50 : if( xFact.is() )
939 [ + - ][ + - ]: 50 : xTemplate.set( xFact->createInstance( C2U( "com.sun.star.chart2.template.Column" ) ), uno::UNO_QUERY );
[ + - ][ + - ]
940 : 50 : return xTemplate;
941 : : }
942 : :
943 : 0 : void SAL_CALL ChartModel::setChartTypeManager( const uno::Reference< chart2::XChartTypeManager >& xNewManager )
944 : : throw (uno::RuntimeException)
945 : : {
946 : : {
947 [ # # ]: 0 : MutexGuard aGuard( m_aModelMutex );
948 [ # # ][ # # ]: 0 : m_xChartTypeManager = xNewManager;
949 : : }
950 : 0 : setModified( sal_True );
951 : 0 : }
952 : :
953 : 179 : uno::Reference< chart2::XChartTypeManager > SAL_CALL ChartModel::getChartTypeManager()
954 : : throw (uno::RuntimeException)
955 : : {
956 [ + - ]: 179 : MutexGuard aGuard( m_aModelMutex );
957 [ + - ]: 179 : return m_xChartTypeManager;
958 : : }
959 : :
960 : 1757 : uno::Reference< beans::XPropertySet > SAL_CALL ChartModel::getPageBackground()
961 : : throw (uno::RuntimeException)
962 : : {
963 [ + - ]: 1757 : MutexGuard aGuard( m_aModelMutex );
964 [ + - ]: 1757 : return m_xPageBackground;
965 : : }
966 : :
967 : : // ____ XTitled ____
968 : 14727 : uno::Reference< chart2::XTitle > SAL_CALL ChartModel::getTitleObject()
969 : : throw (uno::RuntimeException)
970 : : {
971 [ + - ]: 14727 : MutexGuard aGuard( m_aModelMutex );
972 [ + - ]: 14727 : return m_xTitle;
973 : : }
974 : :
975 : 34 : void SAL_CALL ChartModel::setTitleObject( const uno::Reference< chart2::XTitle >& xTitle )
976 : : throw (uno::RuntimeException)
977 : : {
978 : : {
979 [ + - ]: 34 : MutexGuard aGuard( m_aModelMutex );
980 [ + + ]: 34 : if( m_xTitle.is() )
981 [ + - ][ + - ]: 4 : ModifyListenerHelper::removeListener( m_xTitle, this );
982 [ + - ]: 34 : m_xTitle = xTitle;
983 [ + - ][ + - ]: 34 : ModifyListenerHelper::addListener( m_xTitle, this );
[ + - ]
984 : : }
985 : 34 : setModified( sal_True );
986 : 34 : }
987 : :
988 : : // ____ XInterface (for old API wrapper) ____
989 : 265517 : uno::Any SAL_CALL ChartModel::queryInterface( const uno::Type& aType )
990 : : throw (uno::RuntimeException)
991 : : {
992 : 265517 : uno::Any aResult( impl::ChartModel_Base::queryInterface( aType ));
993 : :
994 [ + + ]: 265517 : if( ! aResult.hasValue())
995 : : {
996 : : // try old API wrapper
997 : : try
998 : : {
999 [ + - ]: 14860 : if( m_xOldModelAgg.is())
1000 [ + - ][ + - ]: 14860 : aResult = m_xOldModelAgg->queryAggregation( aType );
1001 : : }
1002 [ # # ]: 0 : catch (const uno::Exception& ex)
1003 : : {
1004 : : ASSERT_EXCEPTION( ex );
1005 : : }
1006 : : }
1007 : :
1008 [ # # ]: 265516 : return aResult;
1009 : : }
1010 : :
1011 : : // ____ XCloneable ____
1012 : 0 : Reference< util::XCloneable > SAL_CALL ChartModel::createClone()
1013 : : throw (uno::RuntimeException)
1014 : : {
1015 [ # # ][ # # ]: 0 : return Reference< util::XCloneable >( new ChartModel( *this ));
1016 : : }
1017 : :
1018 : : // ____ XVisualObject ____
1019 : 35 : void SAL_CALL ChartModel::setVisualAreaSize( ::sal_Int64 nAspect, const awt::Size& aSize )
1020 : : throw (lang::IllegalArgumentException,
1021 : : embed::WrongStateException,
1022 : : uno::Exception,
1023 : : uno::RuntimeException)
1024 : : {
1025 [ + - ]: 35 : if( nAspect == embed::Aspects::MSOLE_CONTENT )
1026 : : {
1027 [ + - ][ + - ]: 35 : ControllerLockGuard aLockGuard( this );
1028 : : bool bChanged =
1029 : : (m_aVisualAreaSize.Width != aSize.Width ||
1030 [ - + ][ + + ]: 35 : m_aVisualAreaSize.Height != aSize.Height);
1031 : :
1032 : : // #i12587# support for shapes in chart
1033 [ + + ]: 35 : if ( bChanged )
1034 : : {
1035 [ + - ]: 32 : impl_adjustAdditionalShapesPositionAndSize( aSize );
1036 : : }
1037 : :
1038 : 35 : m_aVisualAreaSize = aSize;
1039 [ + + ]: 35 : if( bChanged )
1040 [ + - ][ + - ]: 35 : setModified( sal_True );
1041 : : }
1042 : : else
1043 : : {
1044 : : OSL_FAIL( "setVisualAreaSize: Aspect not implemented yet.");
1045 : : }
1046 : 35 : }
1047 : :
1048 : 1211 : awt::Size SAL_CALL ChartModel::getVisualAreaSize( ::sal_Int64 nAspect )
1049 : : throw (lang::IllegalArgumentException,
1050 : : embed::WrongStateException,
1051 : : uno::Exception,
1052 : : uno::RuntimeException)
1053 : : {
1054 : : OSL_ENSURE( nAspect == embed::Aspects::MSOLE_CONTENT,
1055 : : "No aspects other than content are supported" );
1056 : : (void)(nAspect); // avoid warning in non-debug builds
1057 : : // other possible aspects are MSOLE_THUMBNAIL, MSOLE_ICON and MSOLE_DOCPRINT
1058 : :
1059 : 1211 : return m_aVisualAreaSize;
1060 : : }
1061 : :
1062 : 90 : embed::VisualRepresentation SAL_CALL ChartModel::getPreferredVisualRepresentation( ::sal_Int64 nAspect )
1063 : : throw (lang::IllegalArgumentException,
1064 : : embed::WrongStateException,
1065 : : uno::Exception,
1066 : : uno::RuntimeException)
1067 : : {
1068 : : OSL_ENSURE( nAspect == embed::Aspects::MSOLE_CONTENT,
1069 : : "No aspects other than content are supported" );
1070 : : (void)(nAspect); // avoid warning in non-debug builds
1071 : :
1072 : 90 : embed::VisualRepresentation aResult;
1073 : :
1074 : : try
1075 : : {
1076 [ + - ]: 90 : Sequence< sal_Int8 > aMetafile;
1077 : :
1078 : : //get view from old api wrapper
1079 : : Reference< datatransfer::XTransferable > xTransferable(
1080 [ + - ][ + - ]: 90 : this->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
[ + - ]
1081 [ + - ]: 90 : if( xTransferable.is() )
1082 : : {
1083 : : datatransfer::DataFlavor aDataFlavor( lcl_aGDIMetaFileMIMEType,
1084 : : C2U( "GDIMetaFile" ),
1085 [ + - ][ + - ]: 90 : ::getCppuType( (const uno::Sequence< sal_Int8 >*) 0 ) );
1086 : :
1087 [ + - ][ + - ]: 90 : uno::Any aData( xTransferable->getTransferData( aDataFlavor ) );
1088 [ + - ]: 90 : aData >>= aMetafile;
1089 : : }
1090 : :
1091 : 90 : aResult.Flavor.MimeType = lcl_aGDIMetaFileMIMEType;
1092 [ + - ]: 90 : aResult.Flavor.DataType = getCppuType( &aMetafile );
1093 : :
1094 [ + - ][ # # ]: 90 : aResult.Data <<= aMetafile;
[ + - ]
1095 : : }
1096 [ # # ]: 0 : catch (const uno::Exception& ex)
1097 : : {
1098 : : ASSERT_EXCEPTION( ex );
1099 : : }
1100 : :
1101 : 90 : return aResult;
1102 : : }
1103 : :
1104 : 63 : ::sal_Int32 SAL_CALL ChartModel::getMapUnit( ::sal_Int64 nAspect )
1105 : : throw (uno::Exception,
1106 : : uno::RuntimeException)
1107 : : {
1108 : : OSL_ENSURE( nAspect == embed::Aspects::MSOLE_CONTENT,
1109 : : "No aspects other than content are supported" );
1110 : : (void)(nAspect); // avoid warning in non-debug builds
1111 : 63 : return embed::EmbedMapUnits::ONE_100TH_MM;
1112 : : }
1113 : :
1114 : : // ____ datatransfer::XTransferable ____
1115 : 0 : uno::Any SAL_CALL ChartModel::getTransferData( const datatransfer::DataFlavor& aFlavor )
1116 : : throw (datatransfer::UnsupportedFlavorException,
1117 : : io::IOException,
1118 : : uno::RuntimeException)
1119 : : {
1120 : 0 : uno::Any aResult;
1121 [ # # ][ # # ]: 0 : if( this->isDataFlavorSupported( aFlavor ))
1122 : : {
1123 : : try
1124 : : {
1125 : : //get view from old api wrapper
1126 : : Reference< datatransfer::XTransferable > xTransferable(
1127 [ # # ][ # # ]: 0 : this->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
[ # # ]
1128 [ # # ][ # # ]: 0 : if( xTransferable.is() &&
[ # # ]
1129 [ # # ][ # # ]: 0 : xTransferable->isDataFlavorSupported( aFlavor ))
1130 : : {
1131 [ # # ][ # # ]: 0 : aResult = xTransferable->getTransferData( aFlavor );
1132 [ # # ]: 0 : }
1133 : : }
1134 [ # # ]: 0 : catch (const uno::Exception& ex)
1135 : : {
1136 : : ASSERT_EXCEPTION( ex );
1137 : : }
1138 : : }
1139 : : else
1140 : : {
1141 : : throw datatransfer::UnsupportedFlavorException(
1142 [ # # ][ # # ]: 0 : aFlavor.MimeType, static_cast< ::cppu::OWeakObject* >( this ));
1143 : : }
1144 : :
1145 : 0 : return aResult;
1146 : : }
1147 : :
1148 : 0 : Sequence< datatransfer::DataFlavor > SAL_CALL ChartModel::getTransferDataFlavors()
1149 : : throw (uno::RuntimeException)
1150 : : {
1151 : 0 : uno::Sequence< datatransfer::DataFlavor > aRet(1);
1152 : :
1153 [ # # ]: 0 : aRet[0] = datatransfer::DataFlavor( lcl_aGDIMetaFileMIMETypeHighContrast,
1154 : : C2U( "GDIMetaFile" ),
1155 [ # # ][ # # ]: 0 : ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) );
1156 : :
1157 : 0 : return aRet;
1158 : : }
1159 : :
1160 : 0 : ::sal_Bool SAL_CALL ChartModel::isDataFlavorSupported( const datatransfer::DataFlavor& aFlavor )
1161 : : throw (uno::RuntimeException)
1162 : : {
1163 : 0 : return aFlavor.MimeType.equals(lcl_aGDIMetaFileMIMETypeHighContrast);
1164 : : }
1165 : :
1166 : :
1167 : :
1168 : : namespace
1169 : : {
1170 : : enum eServiceType
1171 : : {
1172 : : SERVICE_DASH_TABLE,
1173 : : SERVICE_GARDIENT_TABLE,
1174 : : SERVICE_HATCH_TABLE,
1175 : : SERVICE_BITMAP_TABLE,
1176 : : SERVICE_TRANSP_GRADIENT_TABLE,
1177 : : SERVICE_MARKER_TABLE,
1178 : : SERVICE_NAMESPACE_MAP
1179 : : };
1180 : :
1181 : : typedef ::std::map< ::rtl::OUString, enum eServiceType > tServiceNameMap;
1182 : : typedef ::comphelper::MakeMap< ::rtl::OUString, enum eServiceType > tMakeServiceNameMap;
1183 : :
1184 : 5193 : tServiceNameMap & lcl_getStaticServiceNameMap()
1185 : : {
1186 : : static tServiceNameMap aServiceNameMap(
1187 : : tMakeServiceNameMap
1188 : : ( C2U( "com.sun.star.drawing.DashTable" ), SERVICE_DASH_TABLE )
1189 [ + - ][ + - ]: 28 : ( C2U( "com.sun.star.drawing.GradientTable" ), SERVICE_GARDIENT_TABLE )
[ + - ][ + - ]
1190 [ + - ][ + - ]: 42 : ( C2U( "com.sun.star.drawing.HatchTable" ), SERVICE_HATCH_TABLE )
1191 [ + - ][ + - ]: 42 : ( C2U( "com.sun.star.drawing.BitmapTable" ), SERVICE_BITMAP_TABLE )
1192 [ + - ][ + - ]: 42 : ( C2U( "com.sun.star.drawing.TransparencyGradientTable" ), SERVICE_TRANSP_GRADIENT_TABLE )
1193 [ + - ][ + - ]: 42 : ( C2U( "com.sun.star.drawing.MarkerTable" ), SERVICE_MARKER_TABLE )
1194 [ + - ][ + - ]: 42 : ( C2U( "com.sun.star.xml.NamespaceMap" ), SERVICE_NAMESPACE_MAP )
1195 [ + + ][ + - ]: 5207 : );
[ + - ][ # # ]
1196 : 5193 : return aServiceNameMap;
1197 : : }
1198 : : }
1199 : : // ____ XMultiServiceFactory ____
1200 : 5193 : Reference< uno::XInterface > SAL_CALL ChartModel::createInstance( const OUString& rServiceSpecifier )
1201 : : throw( uno::Exception, uno::RuntimeException )
1202 : : {
1203 : 5193 : uno::Reference< uno::XInterface > xResult;
1204 [ + - ]: 5193 : tServiceNameMap & rMap = lcl_getStaticServiceNameMap();
1205 : :
1206 [ + - ]: 5193 : tServiceNameMap::const_iterator aIt( rMap.find( rServiceSpecifier ));
1207 [ + + ]: 5193 : if( aIt != rMap.end())
1208 : : {
1209 [ + + - ]: 385 : switch( (*aIt).second )
1210 : : {
1211 : : case SERVICE_DASH_TABLE:
1212 : : case SERVICE_GARDIENT_TABLE:
1213 : : case SERVICE_HATCH_TABLE:
1214 : : case SERVICE_BITMAP_TABLE:
1215 : : case SERVICE_TRANSP_GRADIENT_TABLE:
1216 : : case SERVICE_MARKER_TABLE:
1217 : : {
1218 : : uno::Reference< lang::XMultiServiceFactory > xFact(
1219 [ + - ][ + - ]: 358 : this->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
[ + - ]
1220 [ + - ]: 358 : if ( xFact.is() )
1221 : : {
1222 [ + - ][ + - ]: 358 : return xFact->createInstance( rServiceSpecifier );
1223 [ - + ]: 358 : }
1224 : : }
1225 : 358 : break;
1226 : : case SERVICE_NAMESPACE_MAP:
1227 : 27 : return Reference< uno::XInterface >( m_xXMLNamespaceMap );
1228 : : }
1229 : : }
1230 : : else
1231 : : {
1232 [ + - ]: 4808 : if( m_xOldModelAgg.is() )
1233 : : {
1234 [ + - ][ + - ]: 4808 : Any aAny = m_xOldModelAgg->queryAggregation( ::getCppuType((const uno::Reference< lang::XMultiServiceFactory >*)0) );
[ + - ]
1235 : 4808 : uno::Reference< lang::XMultiServiceFactory > xOldModelFactory;
1236 [ + - ][ + - ]: 4808 : if( (aAny >>= xOldModelFactory) && xOldModelFactory.is() )
[ + - ][ + - ]
1237 : : {
1238 [ + - ][ + - ]: 4808 : return xOldModelFactory->createInstance( rServiceSpecifier );
1239 [ + - ][ - + ]: 4808 : }
1240 : : }
1241 : : }
1242 [ # # ]: 5193 : return 0;
1243 : : }
1244 : :
1245 : 0 : Reference< uno::XInterface > SAL_CALL ChartModel::createInstanceWithArguments(
1246 : : const OUString& rServiceSpecifier , const Sequence< Any >& Arguments )
1247 : : throw( uno::Exception, uno::RuntimeException )
1248 : : {
1249 : : OSL_ENSURE( Arguments.getLength(), "createInstanceWithArguments: Warning: Arguments are ignored" );
1250 : : (void)(Arguments); // avoid warning in non-debug builds
1251 : 0 : return createInstance( rServiceSpecifier );
1252 : : }
1253 : :
1254 : 9 : Sequence< OUString > SAL_CALL ChartModel::getAvailableServiceNames()
1255 : : throw( uno::RuntimeException )
1256 : : {
1257 [ + - ]: 9 : uno::Sequence< ::rtl::OUString > aResult;
1258 : :
1259 [ + - ]: 9 : if( m_xOldModelAgg.is())
1260 : : {
1261 [ + - ][ + - ]: 9 : Any aAny = m_xOldModelAgg->queryAggregation( ::getCppuType((const uno::Reference< lang::XMultiServiceFactory >*)0) );
[ + - ]
1262 : 9 : uno::Reference< lang::XMultiServiceFactory > xOldModelFactory;
1263 [ + - ][ + - ]: 9 : if( (aAny >>= xOldModelFactory) && xOldModelFactory.is() )
[ + - ][ + - ]
1264 : : {
1265 [ + - ][ + - ]: 9 : return xOldModelFactory->getAvailableServiceNames();
1266 [ + - ][ - + ]: 9 : }
1267 : : }
1268 [ # # ][ + - ]: 9 : return aResult;
1269 : : }
1270 : :
1271 : 14989 : Reference< util::XNumberFormatsSupplier > ChartModel::impl_getNumberFormatsSupplier()
1272 : : {
1273 [ + + ]: 14989 : if( !m_xNumberFormatsSupplier.is() )
1274 : : {
1275 [ + - ]: 40 : if( !m_xOwnNumberFormatsSupplier.is() )
1276 : : {
1277 [ + - ][ + - ]: 40 : Reference< lang::XMultiServiceFactory > xFactory( m_xContext->getServiceManager(), uno::UNO_QUERY );
[ + - ]
1278 [ + - ][ + - ]: 40 : m_apSvNumberFormatter.reset( new SvNumberFormatter( xFactory, LANGUAGE_SYSTEM ) );
1279 [ + - ][ + - ]: 40 : m_xOwnNumberFormatsSupplier = new SvNumberFormatsSupplierObj( m_apSvNumberFormatter.get() );
[ + - ]
1280 : : //pOwnNumberFormatter->ChangeStandardPrec( 15 ); todo?
1281 : : }
1282 : 40 : m_xNumberFormatsSupplier = m_xOwnNumberFormatsSupplier;
1283 : : }
1284 : 14989 : return m_xNumberFormatsSupplier;
1285 : : }
1286 : :
1287 : : // ____ XUnoTunnel ___
1288 : 9920 : ::sal_Int64 SAL_CALL ChartModel::getSomething( const Sequence< ::sal_Int8 >& aIdentifier )
1289 : : throw( uno::RuntimeException)
1290 : : {
1291 [ + - + + ]: 29760 : if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory( SvNumberFormatsSupplierObj::getUnoTunnelId().getConstArray(),
[ + + ]
1292 : 19840 : aIdentifier.getConstArray(), 16 ) )
1293 : : {
1294 [ + - ][ + - ]: 8862 : Reference< lang::XUnoTunnel > xTunnel( impl_getNumberFormatsSupplier(), uno::UNO_QUERY );
1295 [ + - ]: 8862 : if( xTunnel.is() )
1296 [ + - ][ + - ]: 8862 : return xTunnel->getSomething( aIdentifier );
[ - + ]
1297 : : }
1298 : 9920 : return 0;
1299 : : }
1300 : :
1301 : : // ____ XNumberFormatsSupplier ____
1302 : 0 : uno::Reference< beans::XPropertySet > SAL_CALL ChartModel::getNumberFormatSettings()
1303 : : throw (uno::RuntimeException)
1304 : : {
1305 [ # # ]: 0 : Reference< util::XNumberFormatsSupplier > xSupplier( impl_getNumberFormatsSupplier() );
1306 [ # # ]: 0 : if( xSupplier.is() )
1307 [ # # ][ # # ]: 0 : return xSupplier->getNumberFormatSettings();
1308 : 0 : return uno::Reference< beans::XPropertySet >();
1309 : : }
1310 : :
1311 : 6127 : uno::Reference< util::XNumberFormats > SAL_CALL ChartModel::getNumberFormats()
1312 : : throw (uno::RuntimeException)
1313 : : {
1314 [ + - ]: 6127 : Reference< util::XNumberFormatsSupplier > xSupplier( impl_getNumberFormatsSupplier() );
1315 [ + - ]: 6127 : if( xSupplier.is() )
1316 [ + - ][ + - ]: 6127 : return xSupplier->getNumberFormats();
1317 : 6127 : return uno::Reference< util::XNumberFormats >();
1318 : : }
1319 : :
1320 : : // ____ XChild ____
1321 : 183 : Reference< uno::XInterface > SAL_CALL ChartModel::getParent()
1322 : : throw (uno::RuntimeException)
1323 : : {
1324 : 183 : return Reference< uno::XInterface >(m_xParent,uno::UNO_QUERY);
1325 : : }
1326 : :
1327 : 57 : void SAL_CALL ChartModel::setParent( const Reference< uno::XInterface >& Parent )
1328 : : throw (lang::NoSupportException,
1329 : : uno::RuntimeException)
1330 : : {
1331 [ + + ]: 57 : if( Parent != m_xParent )
1332 : 27 : m_xParent.set( Parent, uno::UNO_QUERY );
1333 : 57 : }
1334 : :
1335 : : // ____ XDataSource ____
1336 : 0 : uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > SAL_CALL ChartModel::getDataSequences()
1337 : : throw (uno::RuntimeException)
1338 : : {
1339 : : Reference< chart2::data::XDataSource > xSource(
1340 [ # # ][ # # ]: 0 : DataSourceHelper::getUsedData( uno::Reference< frame::XModel >(this) ) );
1341 [ # # ]: 0 : if( xSource.is())
1342 [ # # ][ # # ]: 0 : return xSource->getDataSequences();
1343 : :
1344 [ # # ]: 0 : return uno::Sequence< Reference< chart2::data::XLabeledDataSequence > >();
1345 : : }
1346 : :
1347 : : //XDumper
1348 : 0 : rtl::OUString SAL_CALL ChartModel::dump()
1349 : : throw (uno::RuntimeException)
1350 : : {
1351 : : uno::Reference< qa::XDumper > xDumper(
1352 [ # # ][ # # ]: 0 : this->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
[ # # ]
1353 [ # # ]: 0 : if (xDumper.is())
1354 [ # # ][ # # ]: 0 : return xDumper->dump();
1355 : :
1356 : 0 : return rtl::OUString();
1357 : : }
1358 : :
1359 [ + - ][ + - ]: 48 : } // namespace chart
1360 : :
1361 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|