Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "vbaaxis.hxx"
30 : : #include <ooo/vba/excel/XlAxisCrosses.hpp>
31 : : #include <ooo/vba/excel/XlAxisType.hpp>
32 : : #include <ooo/vba/excel/XlScaleType.hpp>
33 : : #include "vbaaxistitle.hxx"
34 : : #include "vbachart.hxx"
35 : : using namespace ::com::sun::star;
36 : : using namespace ::ooo::vba;
37 : : using namespace ::ooo::vba::excel::XlAxisCrosses;
38 : : using namespace ::ooo::vba::excel::XlAxisType;
39 : : using namespace ::ooo::vba::excel::XlScaleType;
40 : :
41 : 3 : const rtl::OUString ORIGIN( RTL_CONSTASCII_USTRINGPARAM("Origin") );
42 : 3 : const rtl::OUString AUTOORIGIN( RTL_CONSTASCII_USTRINGPARAM("AutoOrigin") );
43 : 3 : const rtl::OUString VBA_MIN( RTL_CONSTASCII_USTRINGPARAM("Max") );
44 : 3 : const rtl::OUString VBA_MAX( RTL_CONSTASCII_USTRINGPARAM("Min") );
45 : : ScVbaChart*
46 : 0 : ScVbaAxis::getChartPtr() throw( uno::RuntimeException )
47 : : {
48 [ # # ]: 0 : ScVbaChart* pChart = static_cast< ScVbaChart* >( moChartParent.get() );
49 [ # # ]: 0 : if ( !pChart )
50 [ # # ][ # # ]: 0 : throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Can't access parent chart impl")), uno::Reference< uno::XInterface >() );
51 : 0 : return pChart;
52 : : }
53 : :
54 : : sal_Bool
55 : 0 : ScVbaAxis::isValueAxis() throw( script::BasicErrorException )
56 : : {
57 [ # # ]: 0 : if ( getType() == xlCategory )
58 : : {
59 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
60 : : }
61 : 0 : return sal_True;
62 : : }
63 : :
64 : 0 : ScVbaAxis::ScVbaAxis( const uno::Reference< XHelperInterface >& xParent,const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& _xPropertySet, sal_Int32 _nType, sal_Int32 _nGroup ) : ScVbaAxis_BASE( xParent, xContext ), mxPropertySet( _xPropertySet ), mnType( _nType ), mnGroup( _nGroup ), bCrossesAreCustomized( false )
65 : : {
66 [ # # ][ # # ]: 0 : oShapeHelper.reset( new ShapeHelper( uno::Reference< drawing::XShape >( mxPropertySet, uno::UNO_QUERY ) ) );
[ # # ]
67 [ # # ]: 0 : moChartParent.set( xParent, uno::UNO_QUERY_THROW );
68 : 0 : setType(_nType);
69 [ # # ]: 0 : setCrosses(xlAxisCrossesAutomatic);
70 : 0 : }
71 : :
72 : : void SAL_CALL
73 : 0 : ScVbaAxis::Delete( ) throw (script::BasicErrorException, uno::RuntimeException)
74 : : {
75 [ # # ]: 0 : uno::Reference< lang::XComponent > xComponent( mxPropertySet, uno::UNO_QUERY_THROW );
76 [ # # ][ # # ]: 0 : xComponent->dispose();
77 : 0 : }
78 : :
79 : : uno::Reference< ::ooo::vba::excel::XAxisTitle > SAL_CALL
80 : 0 : ScVbaAxis::getAxisTitle( ) throw (script::BasicErrorException, uno::RuntimeException)
81 : : {
82 : 0 : uno::Reference< excel::XAxisTitle > xAxisTitle;
83 : : try
84 : : {
85 [ # # ]: 0 : ScVbaChart* pChart = getChartPtr();
86 : :
87 [ # # ][ # # ]: 0 : if (getHasTitle() )
88 : : {
89 [ # # ]: 0 : int nType = getType();
90 [ # # # ]: 0 : switch(nType)
91 : : {
92 : : case xlCategory:
93 [ # # ][ # # ]: 0 : xAxisTitle = new ScVbaAxisTitle(this, mxContext, pChart->xAxisXSupplier->getXAxisTitle());
[ # # ][ # # ]
[ # # ][ # # ]
94 : 0 : break;
95 : : case xlSeriesAxis:
96 [ # # ][ # # ]: 0 : xAxisTitle = new ScVbaAxisTitle(this, mxContext, pChart->xAxisZSupplier->getZAxisTitle());
[ # # ][ # # ]
[ # # ][ # # ]
97 : 0 : break;
98 : : default: // xlValue:
99 [ # # ][ # # ]: 0 : xAxisTitle = new ScVbaAxisTitle(this, mxContext, pChart->xAxisYSupplier->getYAxisTitle());
[ # # ][ # # ]
[ # # ][ # # ]
100 : 0 : break;
101 : : }
102 : : }
103 : : }
104 [ # # # # ]: 0 : catch (const uno::Exception& e)
105 : : {
106 [ # # ]: 0 : DebugHelper::exception(e);
107 : : }
108 : 0 : return xAxisTitle;
109 : :
110 : : }
111 : :
112 : : void SAL_CALL
113 : 0 : ScVbaAxis::setDisplayUnit( ::sal_Int32 /*DisplayUnit*/ ) throw (script::BasicErrorException, uno::RuntimeException)
114 : : {
115 [ # # ]: 0 : DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
116 : 0 : }
117 : :
118 : : ::sal_Int32 SAL_CALL
119 : 0 : ScVbaAxis::getDisplayUnit( ) throw (script::BasicErrorException, uno::RuntimeException)
120 : : {
121 [ # # ]: 0 : DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
122 : 0 : return -1;
123 : : }
124 : :
125 : : void SAL_CALL
126 : 0 : ScVbaAxis::setCrosses( ::sal_Int32 _nCrosses ) throw (script::BasicErrorException, uno::RuntimeException)
127 : : {
128 : : try
129 : : {
130 : 0 : double fNum = 0.0;
131 [ # # # # ]: 0 : switch (_nCrosses)
132 : : {
133 : : case xlAxisCrossesAutomatic: //Microsoft Excel sets the axis crossing point.
134 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue(AUTOORIGIN, uno::makeAny( sal_True ) );
[ # # ]
135 : 0 : bCrossesAreCustomized = false;
136 : 0 : return;
137 : : case xlAxisCrossesMinimum: // The axis crosses at the minimum value.
138 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue(VBA_MIN) >>= fNum;
139 [ # # ]: 0 : setCrossesAt( fNum );
140 : 0 : bCrossesAreCustomized = false;
141 : 0 : break;
142 : : case xlAxisCrossesMaximum: // The axis crosses at the maximum value.
143 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue(VBA_MAX) >>= fNum;
144 [ # # ]: 0 : setCrossesAt(fNum);
145 : 0 : bCrossesAreCustomized = false;
146 : 0 : break;
147 : : default: //xlAxisCrossesCustom
148 : 0 : bCrossesAreCustomized = sal_True;
149 : 0 : break;
150 : : }
151 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue(AUTOORIGIN, uno::makeAny(false) );
[ # # ]
152 : : }
153 [ # # ]: 0 : catch (uno::Exception& )
154 : : {
155 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
156 : : }
157 : : }
158 : : ::sal_Int32 SAL_CALL
159 : 0 : ScVbaAxis::getCrosses( ) throw (script::BasicErrorException, uno::RuntimeException)
160 : : {
161 : 0 : sal_Int32 nCrosses = xlAxisCrossesCustom;
162 : : try
163 : : {
164 : 0 : sal_Bool bisAutoOrigin = false;
165 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue(AUTOORIGIN) >>= bisAutoOrigin;
166 [ # # ]: 0 : if (bisAutoOrigin)
167 : 0 : nCrosses = xlAxisCrossesAutomatic;
168 : : else
169 : : {
170 [ # # ]: 0 : if (bCrossesAreCustomized)
171 : 0 : nCrosses = xlAxisCrossesCustom;
172 : : else
173 : : {
174 : 0 : double forigin = 0.0;
175 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue(ORIGIN) >>= forigin;
176 : 0 : double fmin = 0.0;
177 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue(VBA_MIN) >>= fmin;
178 [ # # ]: 0 : if (forigin == fmin)
179 : 0 : nCrosses = xlAxisCrossesMinimum;
180 : : else
181 : 0 : nCrosses = xlAxisCrossesMaximum;
182 : : }
183 : : }
184 : : }
185 [ # # ]: 0 : catch (uno::Exception& )
186 : : {
187 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
188 : : }
189 : 0 : return nCrosses;
190 : : }
191 : :
192 : : void SAL_CALL
193 : 0 : ScVbaAxis::setCrossesAt( double _fCrossesAt ) throw (script::BasicErrorException, uno::RuntimeException)
194 : : {
195 : : try
196 : : {
197 [ # # ]: 0 : setMaximumScaleIsAuto( false );
198 [ # # ]: 0 : setMinimumScaleIsAuto( false );
199 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue(ORIGIN, uno::makeAny(_fCrossesAt));
[ # # ]
200 : : }
201 [ # # ]: 0 : catch (const uno::Exception& e)
202 : : {
203 [ # # ]: 0 : DebugHelper::exception(e);
204 : : }
205 : 0 : }
206 : :
207 : : double SAL_CALL
208 : 0 : ScVbaAxis::getCrossesAt( ) throw (script::BasicErrorException, uno::RuntimeException)
209 : : {
210 : 0 : double fCrosses = 0.0;
211 : : try
212 : : {
213 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue(ORIGIN) >>= fCrosses;
214 : : }
215 [ # # # # ]: 0 : catch (uno::Exception& )
216 : : {
217 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
218 : : }
219 : 0 : return fCrosses;
220 : : }
221 : :
222 : : void SAL_CALL
223 : 0 : ScVbaAxis::setType( ::sal_Int32 _nType ) throw (script::BasicErrorException, uno::RuntimeException)
224 : : {
225 : 0 : mnType = _nType;
226 : 0 : }
227 : :
228 : : ::sal_Int32 SAL_CALL
229 : 0 : ScVbaAxis::getType( ) throw (script::BasicErrorException, uno::RuntimeException)
230 : : {
231 : 0 : return mnType;
232 : : }
233 : :
234 : : void SAL_CALL
235 : 0 : ScVbaAxis::setHasTitle( ::sal_Bool _bHasTitle ) throw (script::BasicErrorException, uno::RuntimeException)
236 : : {
237 : : try
238 : : {
239 [ # # ]: 0 : ScVbaChart* pChart = getChartPtr();
240 [ # # ]: 0 : sal_Int32 nType = getType();
241 [ # # # ]: 0 : switch(nType)
242 : : {
243 : : case xlCategory:
244 [ # # ][ # # ]: 0 : pChart->mxDiagramPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HasXAxisTitle")), uno::makeAny(_bHasTitle));
[ # # ][ # # ]
245 : 0 : break;
246 : : case xlSeriesAxis:
247 [ # # ][ # # ]: 0 : pChart->mxDiagramPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HasZAxisTitle")), uno::makeAny(_bHasTitle));
[ # # ][ # # ]
248 : 0 : break;
249 : : default: // xlValue:
250 [ # # ][ # # ]: 0 : pChart->mxDiagramPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HasYAxisTitle")), uno::makeAny(_bHasTitle));
[ # # ][ # # ]
251 : : }
252 : :
253 : : }
254 [ # # ]: 0 : catch (const uno::Exception& e)
255 : : {
256 [ # # ]: 0 : DebugHelper::exception(e);
257 : : }
258 : 0 : }
259 : :
260 : : ::sal_Bool SAL_CALL
261 : 0 : ScVbaAxis::getHasTitle( ) throw (script::BasicErrorException, uno::RuntimeException)
262 : : {
263 : 0 : sal_Bool bHasTitle = false;
264 : : try
265 : : {
266 [ # # ]: 0 : ScVbaChart* pChart = getChartPtr();
267 [ # # ]: 0 : int nType = getType();
268 [ # # # ]: 0 : switch(nType)
269 : : {
270 : : case xlCategory:
271 [ # # ][ # # ]: 0 : pChart->mxDiagramPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HasXAxisTitle")) ) >>= bHasTitle;
[ # # ]
272 : 0 : break;
273 : : case xlSeriesAxis:
274 [ # # ][ # # ]: 0 : pChart->mxDiagramPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HasZAxisTitle")) ) >>= bHasTitle;
[ # # ]
275 : 0 : break;
276 : : default: // xlValue:
277 [ # # ][ # # ]: 0 : pChart->mxDiagramPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HasYAxisTitle")) ) >>= bHasTitle;
[ # # ]
278 : : }
279 : : }
280 [ # # # # ]: 0 : catch (const uno::Exception& e)
281 : : {
282 [ # # ]: 0 : DebugHelper::exception(e);
283 : : }
284 : 0 : return bHasTitle;
285 : : }
286 : :
287 : : void SAL_CALL
288 : 0 : ScVbaAxis::setMinorUnit( double _fMinorUnit ) throw (script::BasicErrorException, uno::RuntimeException)
289 : : {
290 : : try
291 : : {
292 [ # # ][ # # ]: 0 : if (isValueAxis())
293 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StepHelp") ), uno::makeAny(_fMinorUnit));
[ # # ][ # # ]
294 : : }
295 [ # # ]: 0 : catch (uno::Exception& )
296 : : {
297 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
298 : : }
299 : 0 : }
300 : :
301 : : double SAL_CALL
302 : 0 : ScVbaAxis::getMinorUnit( ) throw (script::BasicErrorException, uno::RuntimeException)
303 : : {
304 : 0 : double fMinor = 1.0;
305 : : try
306 : : {
307 [ # # ][ # # ]: 0 : if (isValueAxis())
308 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StepHelp"))) >>= fMinor;
[ # # ]
309 : : }
310 [ # # # # ]: 0 : catch (uno::Exception& )
311 : : {
312 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
313 : : }
314 : 0 : return fMinor;
315 : : }
316 : :
317 : : void SAL_CALL
318 : 0 : ScVbaAxis::setMinorUnitIsAuto( ::sal_Bool _bMinorUnitIsAuto ) throw (script::BasicErrorException, uno::RuntimeException)
319 : : {
320 : : try
321 : : {
322 [ # # ][ # # ]: 0 : if (isValueAxis())
323 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoStepHelp" ) ), uno::makeAny(_bMinorUnitIsAuto));
[ # # ][ # # ]
324 : : }
325 [ # # ]: 0 : catch (uno::Exception& )
326 : : {
327 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
328 : : }
329 : 0 : }
330 : :
331 : : ::sal_Bool SAL_CALL
332 : 0 : ScVbaAxis::getMinorUnitIsAuto( ) throw (script::BasicErrorException, uno::RuntimeException)
333 : : {
334 : 0 : sal_Bool bIsAuto = false;
335 : : try
336 : : {
337 [ # # ][ # # ]: 0 : if (isValueAxis())
338 : : {
339 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoStepHelp")) ) >>= bIsAuto;
[ # # ]
340 : : }
341 : : }
342 [ # # # # ]: 0 : catch (uno::Exception& )
343 : : {
344 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
345 : : }
346 : 0 : return bIsAuto;
347 : : }
348 : :
349 : : void SAL_CALL
350 : 0 : ScVbaAxis::setReversePlotOrder( ::sal_Bool /*ReversePlotOrder*/ ) throw (script::BasicErrorException, uno::RuntimeException)
351 : : {
352 [ # # ]: 0 : DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
353 : 0 : }
354 : :
355 : : ::sal_Bool SAL_CALL
356 : 0 : ScVbaAxis::getReversePlotOrder( ) throw (script::BasicErrorException, uno::RuntimeException)
357 : : {
358 [ # # ]: 0 : DebugHelper::exception(SbERR_NOT_IMPLEMENTED, rtl::OUString());
359 : 0 : return false;
360 : : }
361 : :
362 : : void SAL_CALL
363 : 0 : ScVbaAxis::setMajorUnit( double _fMajorUnit ) throw (script::BasicErrorException, uno::RuntimeException)
364 : : {
365 : : try
366 : : {
367 [ # # ][ # # ]: 0 : if (isValueAxis())
368 : : {
369 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StepMain")), uno::makeAny(_fMajorUnit));
[ # # ][ # # ]
370 : : }
371 : : }
372 [ # # ]: 0 : catch (uno::Exception& )
373 : : {
374 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
375 : : }
376 : 0 : }
377 : :
378 : : double SAL_CALL
379 : 0 : ScVbaAxis::getMajorUnit( ) throw (script::BasicErrorException, uno::RuntimeException)
380 : : {
381 : 0 : double fMax = 1.0;
382 : : try
383 : : {
384 [ # # ][ # # ]: 0 : if (isValueAxis())
385 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("StepMain"))) >>= fMax;
[ # # ]
386 : : }
387 [ # # # # ]: 0 : catch (uno::Exception& )
388 : : {
389 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
390 : : }
391 : 0 : return fMax;
392 : : }
393 : :
394 : : void SAL_CALL
395 : 0 : ScVbaAxis::setMajorUnitIsAuto( ::sal_Bool _bMajorUnitIsAuto ) throw (script::BasicErrorException, uno::RuntimeException)
396 : : {
397 : : try
398 : : {
399 [ # # ][ # # ]: 0 : if (isValueAxis())
400 : : {
401 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoStepMain" ) ), uno::makeAny( _bMajorUnitIsAuto ));
[ # # ][ # # ]
402 : : }
403 : : }
404 [ # # ]: 0 : catch (uno::Exception& )
405 : : {
406 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
407 : : }
408 : 0 : }
409 : :
410 : : ::sal_Bool SAL_CALL
411 : 0 : ScVbaAxis::getMajorUnitIsAuto( ) throw (script::BasicErrorException, uno::RuntimeException)
412 : : {
413 : 0 : sal_Bool bIsAuto = false;
414 : : try
415 : : {
416 [ # # ][ # # ]: 0 : if (isValueAxis())
417 : : {
418 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoStepMain"))) >>= bIsAuto;
[ # # ]
419 : : }
420 : : }
421 [ # # # # ]: 0 : catch (uno::Exception& )
422 : : {
423 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
424 : : }
425 : 0 : return bIsAuto;
426 : : }
427 : :
428 : : void SAL_CALL
429 : 0 : ScVbaAxis::setMaximumScale( double _fMaximumScale ) throw (script::BasicErrorException, uno::RuntimeException)
430 : : {
431 : : try
432 : : {
433 [ # # ][ # # ]: 0 : if ( isValueAxis() )
434 : : {
435 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Max" ) ), uno::makeAny(_fMaximumScale));
[ # # ][ # # ]
436 : : }
437 : : }
438 [ # # ]: 0 : catch ( uno::Exception& )
439 : : {
440 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
441 : : }
442 : 0 : }
443 : :
444 : : double SAL_CALL
445 : 0 : ScVbaAxis::getMaximumScale( ) throw (script::BasicErrorException, uno::RuntimeException)
446 : : {
447 : 0 : double fMax = 1.0;
448 : : try
449 : : {
450 [ # # ][ # # ]: 0 : if (isValueAxis())
451 : : {
452 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Max" ))) >>= fMax;
[ # # ]
453 : : }
454 : : }
455 [ # # # # ]: 0 : catch (uno::Exception& )
456 : : {
457 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
458 : : }
459 : 0 : return fMax;
460 : :
461 : : }
462 : :
463 : : void SAL_CALL
464 : 0 : ScVbaAxis::setMaximumScaleIsAuto( ::sal_Bool _bMaximumScaleIsAuto ) throw (script::BasicErrorException, uno::RuntimeException)
465 : : {
466 : : try
467 : : {
468 [ # # ][ # # ]: 0 : if ( isValueAxis() )
469 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoMax" ) ), uno::makeAny( _bMaximumScaleIsAuto ));
[ # # ][ # # ]
470 : :
471 : : }
472 [ # # ]: 0 : catch ( uno::Exception& )
473 : : {
474 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
475 : : }
476 : 0 : }
477 : :
478 : :
479 : : ::sal_Bool SAL_CALL
480 : 0 : ScVbaAxis::getMaximumScaleIsAuto( ) throw (script::BasicErrorException, uno::RuntimeException)
481 : : {
482 : 0 : sal_Bool bIsAuto = false;
483 : : try
484 : : {
485 [ # # ][ # # ]: 0 : if (isValueAxis())
486 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AutoMax" )) ) >>= bIsAuto;
[ # # ]
487 : : }
488 [ # # # # ]: 0 : catch ( uno::Exception& )
489 : : {
490 [ # # ]: 0 : DebugHelper::exception( SbERR_METHOD_FAILED, rtl::OUString() );
491 : : }
492 : 0 : return bIsAuto;
493 : : }
494 : :
495 : : void SAL_CALL
496 : 0 : ScVbaAxis::setMinimumScale( double _fMinimumScale ) throw (script::BasicErrorException, uno::RuntimeException)
497 : : {
498 : : try
499 : : {
500 [ # # ][ # # ]: 0 : if (isValueAxis())
501 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Min") ), uno::makeAny( _fMinimumScale ) );
[ # # ][ # # ]
502 : : }
503 [ # # ]: 0 : catch ( uno::Exception& )
504 : : {
505 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
506 : : }
507 : 0 : }
508 : :
509 : : double SAL_CALL
510 : 0 : ScVbaAxis::getMinimumScale( ) throw (script::BasicErrorException, uno::RuntimeException)
511 : : {
512 : 0 : double fMin = 0.0;
513 : : try
514 : : {
515 [ # # ][ # # ]: 0 : if (isValueAxis())
516 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Min") )) >>= fMin;
[ # # ]
517 : : }
518 [ # # # # ]: 0 : catch (const uno::Exception& e)
519 : : {
520 [ # # ]: 0 : DebugHelper::exception(e);
521 : : }
522 : 0 : return fMin;
523 : : }
524 : :
525 : : void SAL_CALL
526 : 0 : ScVbaAxis::setMinimumScaleIsAuto( ::sal_Bool _bMinimumScaleIsAuto ) throw (script::BasicErrorException, uno::RuntimeException)
527 : : {
528 : : try
529 : : {
530 [ # # ][ # # ]: 0 : if (isValueAxis())
531 : : {
532 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoMin") ), uno::makeAny(_bMinimumScaleIsAuto));
[ # # ][ # # ]
533 : : }
534 : : }
535 [ # # ]: 0 : catch (uno::Exception& )
536 : : {
537 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
538 : : }
539 : 0 : }
540 : :
541 : : ::sal_Bool SAL_CALL
542 : 0 : ScVbaAxis::getMinimumScaleIsAuto( ) throw (script::BasicErrorException, uno::RuntimeException)
543 : : {
544 : 0 : sal_Bool bIsAuto = false;
545 : : try
546 : : {
547 [ # # ][ # # ]: 0 : if (isValueAxis())
548 : : {
549 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AutoMin")) ) >>= bIsAuto;
[ # # ]
550 : : }
551 : : }
552 [ # # # # ]: 0 : catch (uno::Exception& )
553 : : {
554 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
555 : : }
556 : 0 : return bIsAuto;
557 : : }
558 : :
559 : : ::sal_Int32 SAL_CALL
560 : 0 : ScVbaAxis::getAxisGroup( ) throw (uno::RuntimeException)
561 : : {
562 : 0 : return mnGroup;
563 : : }
564 : :
565 : : void SAL_CALL
566 : 0 : ScVbaAxis::setScaleType( ::sal_Int32 _nScaleType ) throw (script::BasicErrorException, uno::RuntimeException)
567 : : {
568 : : try
569 : : {
570 [ # # ][ # # ]: 0 : if (isValueAxis())
571 : : {
572 [ # # # ]: 0 : switch (_nScaleType)
573 : : {
574 : : case xlScaleLinear:
575 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Logarithmic" ) ), uno::makeAny( sal_False ) );
[ # # ][ # # ]
576 : 0 : break;
577 : : case xlScaleLogarithmic:
578 [ # # ][ # # ]: 0 : mxPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Logarithmic" ) ), uno::makeAny( sal_True ) );
[ # # ][ # # ]
579 : 0 : break;
580 : : default:
581 : : // According to MS the paramenter is ignored and no Error is thrown
582 : 0 : break;
583 : : }
584 : : }
585 : : }
586 [ # # ]: 0 : catch (uno::Exception& )
587 : : {
588 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString() );
589 : : }
590 : 0 : }
591 : :
592 : : ::sal_Int32 SAL_CALL
593 : 0 : ScVbaAxis::getScaleType( ) throw (script::BasicErrorException, uno::RuntimeException)
594 : : {
595 : 0 : sal_Int32 nScaleType = xlScaleLinear;
596 : : try
597 : : {
598 [ # # ][ # # ]: 0 : if (isValueAxis())
599 : : {
600 : 0 : sal_Bool bisLogarithmic = false;
601 [ # # ][ # # ]: 0 : mxPropertySet->getPropertyValue( rtl::OUString( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Logarithmic"))) ) >>= bisLogarithmic;
[ # # ]
602 [ # # ]: 0 : if (bisLogarithmic)
603 : 0 : nScaleType = xlScaleLogarithmic;
604 : : else
605 : 0 : nScaleType = xlScaleLinear;
606 : : }
607 : : }
608 [ # # ]: 0 : catch (uno::Exception& )
609 : : {
610 [ # # ]: 0 : DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
611 : : }
612 : 0 : return nScaleType;
613 : : }
614 : :
615 : : double SAL_CALL
616 : 0 : ScVbaAxis::getHeight( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
617 : : {
618 : 0 : return oShapeHelper->getHeight();
619 : : }
620 : :
621 : 0 : void SAL_CALL ScVbaAxis::setHeight( double height ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
622 : : {
623 : 0 : oShapeHelper->setHeight( height );
624 : 0 : }
625 : 0 : double SAL_CALL ScVbaAxis::getWidth( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
626 : : {
627 : 0 : return oShapeHelper->getWidth( );
628 : : }
629 : 0 : void SAL_CALL ScVbaAxis::setWidth( double width ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
630 : : {
631 : 0 : oShapeHelper->setWidth( width );
632 : 0 : }
633 : 0 : double SAL_CALL ScVbaAxis::getTop( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
634 : : {
635 : 0 : return oShapeHelper->getTop( );
636 : : }
637 : 0 : void SAL_CALL ScVbaAxis::setTop( double top ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
638 : : {
639 : 0 : oShapeHelper->setTop( top );
640 : 0 : }
641 : 0 : double SAL_CALL ScVbaAxis::getLeft( ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
642 : : {
643 : 0 : return oShapeHelper->getLeft( );
644 : : }
645 : 0 : void SAL_CALL ScVbaAxis::setLeft( double left ) throw (css::script::BasicErrorException, css::uno::RuntimeException)
646 : : {
647 : 0 : oShapeHelper->setLeft( left );
648 : 0 : }
649 : :
650 : : rtl::OUString
651 : 0 : ScVbaAxis::getServiceImplName()
652 : : {
653 : 0 : return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScVbaAxis"));
654 : : }
655 : :
656 : : uno::Sequence< rtl::OUString >
657 : 0 : ScVbaAxis::getServiceNames()
658 : : {
659 [ # # ][ # # ]: 0 : static uno::Sequence< rtl::OUString > aServiceNames;
[ # # ][ # # ]
660 [ # # ]: 0 : if ( aServiceNames.getLength() == 0 )
661 : : {
662 : 0 : aServiceNames.realloc( 1 );
663 [ # # ]: 0 : aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.Axis" ) );
664 : : }
665 : 0 : return aServiceNames;
666 [ + - ][ + - ]: 9 : }
667 : :
668 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|