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