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