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