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