Files
libreoffice/sc/source/ui/vba/vbaaxis.cxx

659 lines
19 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patches contributed by Herbert Duerr i#118735 prevent endless loop if vlookup/hlookup doesn't find anything http://svn.apache.org/viewvc?view=revision&revision=1239673 Patches contributed by Andre Fischer remove lp_solver http://svn.apache.org/viewvc?view=revision&revision=1199180 i#118160: Added external CoinMP library. http://svn.apache.org/viewvc?view=revision&revision=1233909 Patches contributed by Armin Le-Grand i#118485 - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 i#118524: apply patch, followup fixes to 118485 http://svn.apache.org/viewvc?view=revision&revision=1186077 Patches contributed by lihuiibm i#108860 - Fix range validation. http://svn.apache.org/viewvc?view=revision&revision=1242846 i#118954 Chart data will lost after copy to different file http://svn.apache.org/viewvc?view=revision&revision=1301345 Patches contributed by Ariel Constenla-Haile Fix Linux build breaker: extra qualification on member http://svn.apache.org/viewvc?view=revision&revision=1301591 i#118696 - i#118697 - Fix some Sheet Tab Color API issues http://svn.apache.org/viewvc?view=revision&revision=1225428 i#118697 - Fix uninitialized variable http://svn.apache.org/viewvc?view=revision&revision=1225859 i#118771 - ScUndoImportTab should preserve tab background color http://svn.apache.org/viewvc?view=revision&revision=1230356 i#118921 - Repaint linked sheet tab background color after updating link http://svn.apache.org/viewvc?view=revision&revision=1245177 i#118927 - Undo/Redo "Update Link" does not reset sheet tab color http://svn.apache.org/viewvc?view=revision&revision=1245241 i#118747 - Copy tab color when transferring sheets across documents http://svn.apache.org/viewvc?view=revision&revision=1230355 Patch contributed by Oliver Rainer-Wittman i#118012 - methods <ScBroadcastAreaSlot::AreaBroadcast(..)> and <ScBroadcastAreaSlot::AreaBroadcastInRange(..)> adapt stl-container iteration in order to avoid destroyed iterators during iteration. http://svn.apache.org/viewvc?view=revision&revision=1297916 Patches contributed by Mathias Bauer gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1397315 Patch contributed by Daniel Rentz calc69: #i116936# fix VBA symbol Cells http://svn.apache.org/viewvc?view=revision&revision=1172135 Patches contributed by leiw: i#118546 CPU 100% on switched off AutoCalculate with Conditional Formatting on date values http://svn.apache.org/viewvc?view=revision&revision=1301380 Re-add new function documentation. Many various cleanups. Add missing calc66: #o11817313# also look at formula result number format, remove redundant binaries.
2012-11-30 12:23:25 +00:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "vbaaxis.hxx"
CWS-TOOLING: integrate CWS npower11 2009-01-21 11:00:00 +0100 npower r266639 : replace ScAddress::CONV_XL_R1C1 with formula::FormulaGrammar::CONV_XL_R1C1 2009-01-21 10:58:33 +0100 npower r266638 : fixup access for changes to compiler.[ch]xx 2009-01-21 10:57:46 +0100 npower r266637 : replace the static with non-static member ( to align with the latest m39 ) changes 2009-01-20 11:53:52 +0100 npower r266562 : CWS-TOOLING: rebase CWS npower11 to trunk@266428 (milestone: DEV300:m39) 2009-01-09 23:31:00 +0100 cloph r266122 : fix typo (missing "="), initialize variables to avoid WaE breakage 2009-01-09 11:57:20 +0100 npower r266071 : wae Mac OSX gcc-4.0.1 (PPC) 2009-01-08 11:09:49 +0100 npower r265986 : wae - Mac OSX gcc-4.0.1 (PPC) 2009-01-07 10:33:20 +0100 npower r265952 : wae Mac OSX gcc-4.0.1 2008-12-18 19:14:10 +0100 npower r265712 : wae for wntmsci12 target 2008-12-17 16:14:54 +0100 npower r265640 : add Outline property for Font, also remove growing list of friend classes for ScCellRangeObj and replace by a single class. 2008-12-17 16:11:02 +0100 npower r265639 : fix path variable for 3.1, also tweak the unix logs 2008-12-11 02:39:58 +0100 hanbo r265233 : fix the vba/vba namespace of constants 2008-11-25 17:05:39 +0100 npower r264317 : namespace changes 2008-11-25 14:12:37 +0100 npower r264308 : revert changes made by mistake when migrating cws 2008-11-25 13:30:59 +0100 npower r264296 : i#93944# namespace changes 2008-11-25 13:29:25 +0100 npower r264293 : i#93944# namespace changes 2008-11-25 13:27:08 +0100 npower r264289 : i#93944# namespace changes 2008-11-24 18:24:17 +0100 npower r264263 : svn migration 2008-11-24 18:22:47 +0100 npower r264262 : not needed anymore 2008-11-24 18:21:23 +0100 npower r264261 : svn migration 2008-11-24 18:18:31 +0100 npower r264260 : svn migration
2009-02-13 13:03:24 +00:00
#include <ooo/vba/excel/XlAxisCrosses.hpp>
#include <ooo/vba/excel/XlAxisType.hpp>
#include <ooo/vba/excel/XlScaleType.hpp>
#include "vbaaxistitle.hxx"
#include "vbachart.hxx"
using namespace ::com::sun::star;
CWS-TOOLING: integrate CWS npower11 2009-01-21 11:00:00 +0100 npower r266639 : replace ScAddress::CONV_XL_R1C1 with formula::FormulaGrammar::CONV_XL_R1C1 2009-01-21 10:58:33 +0100 npower r266638 : fixup access for changes to compiler.[ch]xx 2009-01-21 10:57:46 +0100 npower r266637 : replace the static with non-static member ( to align with the latest m39 ) changes 2009-01-20 11:53:52 +0100 npower r266562 : CWS-TOOLING: rebase CWS npower11 to trunk@266428 (milestone: DEV300:m39) 2009-01-09 23:31:00 +0100 cloph r266122 : fix typo (missing "="), initialize variables to avoid WaE breakage 2009-01-09 11:57:20 +0100 npower r266071 : wae Mac OSX gcc-4.0.1 (PPC) 2009-01-08 11:09:49 +0100 npower r265986 : wae - Mac OSX gcc-4.0.1 (PPC) 2009-01-07 10:33:20 +0100 npower r265952 : wae Mac OSX gcc-4.0.1 2008-12-18 19:14:10 +0100 npower r265712 : wae for wntmsci12 target 2008-12-17 16:14:54 +0100 npower r265640 : add Outline property for Font, also remove growing list of friend classes for ScCellRangeObj and replace by a single class. 2008-12-17 16:11:02 +0100 npower r265639 : fix path variable for 3.1, also tweak the unix logs 2008-12-11 02:39:58 +0100 hanbo r265233 : fix the vba/vba namespace of constants 2008-11-25 17:05:39 +0100 npower r264317 : namespace changes 2008-11-25 14:12:37 +0100 npower r264308 : revert changes made by mistake when migrating cws 2008-11-25 13:30:59 +0100 npower r264296 : i#93944# namespace changes 2008-11-25 13:29:25 +0100 npower r264293 : i#93944# namespace changes 2008-11-25 13:27:08 +0100 npower r264289 : i#93944# namespace changes 2008-11-24 18:24:17 +0100 npower r264263 : svn migration 2008-11-24 18:22:47 +0100 npower r264262 : not needed anymore 2008-11-24 18:21:23 +0100 npower r264261 : svn migration 2008-11-24 18:18:31 +0100 npower r264260 : svn migration
2009-02-13 13:03:24 +00:00
using namespace ::ooo::vba;
using namespace ::ooo::vba::excel::XlAxisCrosses;
using namespace ::ooo::vba::excel::XlAxisType;
using namespace ::ooo::vba::excel::XlScaleType;
const OUString ORIGIN("Origin");
const OUString AUTOORIGIN("AutoOrigin");
const OUString VBA_MIN("Max");
const OUString VBA_MAX("Min");
ScVbaChart*
ScVbaAxis::getChartPtr() throw( uno::RuntimeException )
{
ScVbaChart* pChart = static_cast< ScVbaChart* >( moChartParent.get() );
if ( !pChart )
throw uno::RuntimeException("Can't access parent chart impl" );
return pChart;
}
bool
ScVbaAxis::isValueAxis() throw( script::BasicErrorException )
{
if ( getType() == xlCategory )
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString());
}
return true;
}
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 )
{
oShapeHelper.reset( new ShapeHelper( uno::Reference< drawing::XShape >( mxPropertySet, uno::UNO_QUERY ) ) );
moChartParent.set( xParent, uno::UNO_QUERY_THROW );
setType(_nType);
setCrosses(xlAxisCrossesAutomatic);
}
void SAL_CALL
ScVbaAxis::Delete( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
uno::Reference< lang::XComponent > xComponent( mxPropertySet, uno::UNO_QUERY_THROW );
xComponent->dispose();
}
CWS-TOOLING: integrate CWS npower11 2009-01-21 11:00:00 +0100 npower r266639 : replace ScAddress::CONV_XL_R1C1 with formula::FormulaGrammar::CONV_XL_R1C1 2009-01-21 10:58:33 +0100 npower r266638 : fixup access for changes to compiler.[ch]xx 2009-01-21 10:57:46 +0100 npower r266637 : replace the static with non-static member ( to align with the latest m39 ) changes 2009-01-20 11:53:52 +0100 npower r266562 : CWS-TOOLING: rebase CWS npower11 to trunk@266428 (milestone: DEV300:m39) 2009-01-09 23:31:00 +0100 cloph r266122 : fix typo (missing "="), initialize variables to avoid WaE breakage 2009-01-09 11:57:20 +0100 npower r266071 : wae Mac OSX gcc-4.0.1 (PPC) 2009-01-08 11:09:49 +0100 npower r265986 : wae - Mac OSX gcc-4.0.1 (PPC) 2009-01-07 10:33:20 +0100 npower r265952 : wae Mac OSX gcc-4.0.1 2008-12-18 19:14:10 +0100 npower r265712 : wae for wntmsci12 target 2008-12-17 16:14:54 +0100 npower r265640 : add Outline property for Font, also remove growing list of friend classes for ScCellRangeObj and replace by a single class. 2008-12-17 16:11:02 +0100 npower r265639 : fix path variable for 3.1, also tweak the unix logs 2008-12-11 02:39:58 +0100 hanbo r265233 : fix the vba/vba namespace of constants 2008-11-25 17:05:39 +0100 npower r264317 : namespace changes 2008-11-25 14:12:37 +0100 npower r264308 : revert changes made by mistake when migrating cws 2008-11-25 13:30:59 +0100 npower r264296 : i#93944# namespace changes 2008-11-25 13:29:25 +0100 npower r264293 : i#93944# namespace changes 2008-11-25 13:27:08 +0100 npower r264289 : i#93944# namespace changes 2008-11-24 18:24:17 +0100 npower r264263 : svn migration 2008-11-24 18:22:47 +0100 npower r264262 : not needed anymore 2008-11-24 18:21:23 +0100 npower r264261 : svn migration 2008-11-24 18:18:31 +0100 npower r264260 : svn migration
2009-02-13 13:03:24 +00:00
uno::Reference< ::ooo::vba::excel::XAxisTitle > SAL_CALL
ScVbaAxis::getAxisTitle( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
uno::Reference< excel::XAxisTitle > xAxisTitle;
try
{
ScVbaChart* pChart = getChartPtr();
if (getHasTitle() )
{
int nType = getType();
switch(nType)
{
case xlCategory:
xAxisTitle = new ScVbaAxisTitle(this, mxContext, pChart->xAxisXSupplier->getXAxisTitle());
break;
case xlSeriesAxis:
xAxisTitle = new ScVbaAxisTitle(this, mxContext, pChart->xAxisZSupplier->getZAxisTitle());
break;
default: // xlValue:
xAxisTitle = new ScVbaAxisTitle(this, mxContext, pChart->xAxisYSupplier->getYAxisTitle());
break;
}
}
}
2011-11-04 02:02:20 +09:00
catch (const uno::Exception& e)
{
DebugHelper::basicexception(e);
}
return xAxisTitle;
}
void SAL_CALL
ScVbaAxis::setDisplayUnit( ::sal_Int32 /*DisplayUnit*/ ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
DebugHelper::basicexception(SbERR_NOT_IMPLEMENTED, OUString());
}
::sal_Int32 SAL_CALL
ScVbaAxis::getDisplayUnit( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
DebugHelper::basicexception(SbERR_NOT_IMPLEMENTED, OUString());
return -1;
}
void SAL_CALL
ScVbaAxis::setCrosses( ::sal_Int32 _nCrosses ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
try
{
double fNum = 0.0;
switch (_nCrosses)
{
case xlAxisCrossesAutomatic: //Microsoft Excel sets the axis crossing point.
mxPropertySet->setPropertyValue(AUTOORIGIN, uno::makeAny( sal_True ) );
bCrossesAreCustomized = false;
return;
case xlAxisCrossesMinimum: // The axis crosses at the minimum value.
CWS-TOOLING: integrate CWS npower11 2009-01-21 11:00:00 +0100 npower r266639 : replace ScAddress::CONV_XL_R1C1 with formula::FormulaGrammar::CONV_XL_R1C1 2009-01-21 10:58:33 +0100 npower r266638 : fixup access for changes to compiler.[ch]xx 2009-01-21 10:57:46 +0100 npower r266637 : replace the static with non-static member ( to align with the latest m39 ) changes 2009-01-20 11:53:52 +0100 npower r266562 : CWS-TOOLING: rebase CWS npower11 to trunk@266428 (milestone: DEV300:m39) 2009-01-09 23:31:00 +0100 cloph r266122 : fix typo (missing "="), initialize variables to avoid WaE breakage 2009-01-09 11:57:20 +0100 npower r266071 : wae Mac OSX gcc-4.0.1 (PPC) 2009-01-08 11:09:49 +0100 npower r265986 : wae - Mac OSX gcc-4.0.1 (PPC) 2009-01-07 10:33:20 +0100 npower r265952 : wae Mac OSX gcc-4.0.1 2008-12-18 19:14:10 +0100 npower r265712 : wae for wntmsci12 target 2008-12-17 16:14:54 +0100 npower r265640 : add Outline property for Font, also remove growing list of friend classes for ScCellRangeObj and replace by a single class. 2008-12-17 16:11:02 +0100 npower r265639 : fix path variable for 3.1, also tweak the unix logs 2008-12-11 02:39:58 +0100 hanbo r265233 : fix the vba/vba namespace of constants 2008-11-25 17:05:39 +0100 npower r264317 : namespace changes 2008-11-25 14:12:37 +0100 npower r264308 : revert changes made by mistake when migrating cws 2008-11-25 13:30:59 +0100 npower r264296 : i#93944# namespace changes 2008-11-25 13:29:25 +0100 npower r264293 : i#93944# namespace changes 2008-11-25 13:27:08 +0100 npower r264289 : i#93944# namespace changes 2008-11-24 18:24:17 +0100 npower r264263 : svn migration 2008-11-24 18:22:47 +0100 npower r264262 : not needed anymore 2008-11-24 18:21:23 +0100 npower r264261 : svn migration 2008-11-24 18:18:31 +0100 npower r264260 : svn migration
2009-02-13 13:03:24 +00:00
mxPropertySet->getPropertyValue(VBA_MIN) >>= fNum;
setCrossesAt( fNum );
bCrossesAreCustomized = false;
break;
case xlAxisCrossesMaximum: // The axis crosses at the maximum value.
CWS-TOOLING: integrate CWS npower11 2009-01-21 11:00:00 +0100 npower r266639 : replace ScAddress::CONV_XL_R1C1 with formula::FormulaGrammar::CONV_XL_R1C1 2009-01-21 10:58:33 +0100 npower r266638 : fixup access for changes to compiler.[ch]xx 2009-01-21 10:57:46 +0100 npower r266637 : replace the static with non-static member ( to align with the latest m39 ) changes 2009-01-20 11:53:52 +0100 npower r266562 : CWS-TOOLING: rebase CWS npower11 to trunk@266428 (milestone: DEV300:m39) 2009-01-09 23:31:00 +0100 cloph r266122 : fix typo (missing "="), initialize variables to avoid WaE breakage 2009-01-09 11:57:20 +0100 npower r266071 : wae Mac OSX gcc-4.0.1 (PPC) 2009-01-08 11:09:49 +0100 npower r265986 : wae - Mac OSX gcc-4.0.1 (PPC) 2009-01-07 10:33:20 +0100 npower r265952 : wae Mac OSX gcc-4.0.1 2008-12-18 19:14:10 +0100 npower r265712 : wae for wntmsci12 target 2008-12-17 16:14:54 +0100 npower r265640 : add Outline property for Font, also remove growing list of friend classes for ScCellRangeObj and replace by a single class. 2008-12-17 16:11:02 +0100 npower r265639 : fix path variable for 3.1, also tweak the unix logs 2008-12-11 02:39:58 +0100 hanbo r265233 : fix the vba/vba namespace of constants 2008-11-25 17:05:39 +0100 npower r264317 : namespace changes 2008-11-25 14:12:37 +0100 npower r264308 : revert changes made by mistake when migrating cws 2008-11-25 13:30:59 +0100 npower r264296 : i#93944# namespace changes 2008-11-25 13:29:25 +0100 npower r264293 : i#93944# namespace changes 2008-11-25 13:27:08 +0100 npower r264289 : i#93944# namespace changes 2008-11-24 18:24:17 +0100 npower r264263 : svn migration 2008-11-24 18:22:47 +0100 npower r264262 : not needed anymore 2008-11-24 18:21:23 +0100 npower r264261 : svn migration 2008-11-24 18:18:31 +0100 npower r264260 : svn migration
2009-02-13 13:03:24 +00:00
mxPropertySet->getPropertyValue(VBA_MAX) >>= fNum;
setCrossesAt(fNum);
bCrossesAreCustomized = false;
break;
default: //xlAxisCrossesCustom
bCrossesAreCustomized = true;
break;
}
mxPropertySet->setPropertyValue(AUTOORIGIN, uno::makeAny(false) );
}
catch (const uno::Exception&)
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString());
}
}
::sal_Int32 SAL_CALL
ScVbaAxis::getCrosses( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
sal_Int32 nCrosses = xlAxisCrossesCustom;
try
{
bool bisAutoOrigin = false;
mxPropertySet->getPropertyValue(AUTOORIGIN) >>= bisAutoOrigin;
if (bisAutoOrigin)
nCrosses = xlAxisCrossesAutomatic;
else
{
if (bCrossesAreCustomized)
nCrosses = xlAxisCrossesCustom;
else
{
double forigin = 0.0;
mxPropertySet->getPropertyValue(ORIGIN) >>= forigin;
double fmin = 0.0;
CWS-TOOLING: integrate CWS npower11 2009-01-21 11:00:00 +0100 npower r266639 : replace ScAddress::CONV_XL_R1C1 with formula::FormulaGrammar::CONV_XL_R1C1 2009-01-21 10:58:33 +0100 npower r266638 : fixup access for changes to compiler.[ch]xx 2009-01-21 10:57:46 +0100 npower r266637 : replace the static with non-static member ( to align with the latest m39 ) changes 2009-01-20 11:53:52 +0100 npower r266562 : CWS-TOOLING: rebase CWS npower11 to trunk@266428 (milestone: DEV300:m39) 2009-01-09 23:31:00 +0100 cloph r266122 : fix typo (missing "="), initialize variables to avoid WaE breakage 2009-01-09 11:57:20 +0100 npower r266071 : wae Mac OSX gcc-4.0.1 (PPC) 2009-01-08 11:09:49 +0100 npower r265986 : wae - Mac OSX gcc-4.0.1 (PPC) 2009-01-07 10:33:20 +0100 npower r265952 : wae Mac OSX gcc-4.0.1 2008-12-18 19:14:10 +0100 npower r265712 : wae for wntmsci12 target 2008-12-17 16:14:54 +0100 npower r265640 : add Outline property for Font, also remove growing list of friend classes for ScCellRangeObj and replace by a single class. 2008-12-17 16:11:02 +0100 npower r265639 : fix path variable for 3.1, also tweak the unix logs 2008-12-11 02:39:58 +0100 hanbo r265233 : fix the vba/vba namespace of constants 2008-11-25 17:05:39 +0100 npower r264317 : namespace changes 2008-11-25 14:12:37 +0100 npower r264308 : revert changes made by mistake when migrating cws 2008-11-25 13:30:59 +0100 npower r264296 : i#93944# namespace changes 2008-11-25 13:29:25 +0100 npower r264293 : i#93944# namespace changes 2008-11-25 13:27:08 +0100 npower r264289 : i#93944# namespace changes 2008-11-24 18:24:17 +0100 npower r264263 : svn migration 2008-11-24 18:22:47 +0100 npower r264262 : not needed anymore 2008-11-24 18:21:23 +0100 npower r264261 : svn migration 2008-11-24 18:18:31 +0100 npower r264260 : svn migration
2009-02-13 13:03:24 +00:00
mxPropertySet->getPropertyValue(VBA_MIN) >>= fmin;
if (forigin == fmin)
nCrosses = xlAxisCrossesMinimum;
else
nCrosses = xlAxisCrossesMaximum;
}
}
}
catch (uno::Exception& )
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString() );
}
return nCrosses;
}
void SAL_CALL
ScVbaAxis::setCrossesAt( double _fCrossesAt ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
try
{
setMaximumScaleIsAuto( false );
setMinimumScaleIsAuto( false );
mxPropertySet->setPropertyValue(ORIGIN, uno::makeAny(_fCrossesAt));
}
2011-11-04 02:02:20 +09:00
catch (const uno::Exception& e)
{
DebugHelper::basicexception(e);
}
}
double SAL_CALL
ScVbaAxis::getCrossesAt( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
double fCrosses = 0.0;
try
{
mxPropertySet->getPropertyValue(ORIGIN) >>= fCrosses;
}
catch (uno::Exception& )
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString());
}
return fCrosses;
}
void SAL_CALL
ScVbaAxis::setType( ::sal_Int32 _nType ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
mnType = _nType;
}
::sal_Int32 SAL_CALL
ScVbaAxis::getType( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
return mnType;
}
void SAL_CALL
ScVbaAxis::setHasTitle( sal_Bool _bHasTitle ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
try
{
ScVbaChart* pChart = getChartPtr();
sal_Int32 nType = getType();
switch(nType)
{
case xlCategory:
pChart->mxDiagramPropertySet->setPropertyValue("HasXAxisTitle", uno::makeAny(_bHasTitle));
break;
case xlSeriesAxis:
pChart->mxDiagramPropertySet->setPropertyValue("HasZAxisTitle", uno::makeAny(_bHasTitle));
break;
default: // xlValue:
pChart->mxDiagramPropertySet->setPropertyValue("HasYAxisTitle", uno::makeAny(_bHasTitle));
}
}
2011-11-04 02:02:20 +09:00
catch (const uno::Exception& e)
{
DebugHelper::basicexception(e);
}
}
sal_Bool SAL_CALL
ScVbaAxis::getHasTitle( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
bool bHasTitle = false;
try
{
ScVbaChart* pChart = getChartPtr();
int nType = getType();
switch(nType)
{
case xlCategory:
pChart->mxDiagramPropertySet->getPropertyValue("HasXAxisTitle") >>= bHasTitle;
break;
case xlSeriesAxis:
pChart->mxDiagramPropertySet->getPropertyValue("HasZAxisTitle") >>= bHasTitle;
break;
default: // xlValue:
pChart->mxDiagramPropertySet->getPropertyValue("HasYAxisTitle") >>= bHasTitle;
}
}
2011-11-04 02:02:20 +09:00
catch (const uno::Exception& e)
{
DebugHelper::basicexception(e);
}
return bHasTitle;
}
void SAL_CALL
ScVbaAxis::setMinorUnit( double _fMinorUnit ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
try
{
if (isValueAxis())
mxPropertySet->setPropertyValue("StepHelp", uno::makeAny(_fMinorUnit));
}
catch (uno::Exception& )
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString());
}
}
double SAL_CALL
ScVbaAxis::getMinorUnit( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
double fMinor = 1.0;
try
{
if (isValueAxis())
mxPropertySet->getPropertyValue("StepHelp") >>= fMinor;
}
catch (uno::Exception& )
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString());
}
return fMinor;
}
void SAL_CALL
ScVbaAxis::setMinorUnitIsAuto( sal_Bool _bMinorUnitIsAuto ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
try
{
if (isValueAxis())
mxPropertySet->setPropertyValue("AutoStepHelp", uno::makeAny(_bMinorUnitIsAuto));
}
catch (uno::Exception& )
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString() );
}
}
sal_Bool SAL_CALL
ScVbaAxis::getMinorUnitIsAuto( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
bool bIsAuto = false;
try
{
if (isValueAxis())
{
mxPropertySet->getPropertyValue("AutoStepHelp") >>= bIsAuto;
}
}
catch (const uno::Exception&)
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString());
}
return bIsAuto;
}
void SAL_CALL
ScVbaAxis::setReversePlotOrder( sal_Bool /*ReversePlotOrder*/ ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
DebugHelper::basicexception(SbERR_NOT_IMPLEMENTED, OUString());
}
sal_Bool SAL_CALL
ScVbaAxis::getReversePlotOrder( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
DebugHelper::basicexception(SbERR_NOT_IMPLEMENTED, OUString());
return false;
}
void SAL_CALL
ScVbaAxis::setMajorUnit( double _fMajorUnit ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
try
{
if (isValueAxis())
{
mxPropertySet->setPropertyValue("StepMain", uno::makeAny(_fMajorUnit));
}
}
catch (const uno::Exception&)
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString());
}
}
double SAL_CALL
ScVbaAxis::getMajorUnit( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
double fMax = 1.0;
try
{
if (isValueAxis())
mxPropertySet->getPropertyValue("StepMain") >>= fMax;
}
catch (const uno::Exception&)
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString() );
}
return fMax;
}
void SAL_CALL
ScVbaAxis::setMajorUnitIsAuto( sal_Bool _bMajorUnitIsAuto ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
try
{
if (isValueAxis())
{
mxPropertySet->setPropertyValue("AutoStepMain", uno::makeAny( _bMajorUnitIsAuto ));
}
}
catch (const uno::Exception&)
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString());
}
}
sal_Bool SAL_CALL
ScVbaAxis::getMajorUnitIsAuto( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
bool bIsAuto = false;
try
{
if (isValueAxis())
{
mxPropertySet->getPropertyValue("AutoStepMain") >>= bIsAuto;
}
}
catch (const uno::Exception&)
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString());
}
return bIsAuto;
}
void SAL_CALL
ScVbaAxis::setMaximumScale( double _fMaximumScale ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
try
{
if ( isValueAxis() )
{
mxPropertySet->setPropertyValue("Max", uno::makeAny(_fMaximumScale));
}
}
catch (const uno::Exception&)
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString());
}
}
double SAL_CALL
ScVbaAxis::getMaximumScale( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
double fMax = 1.0;
try
{
if (isValueAxis())
{
mxPropertySet->getPropertyValue("Max") >>= fMax;
}
}
catch (const uno::Exception&)
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString());
}
return fMax;
}
void SAL_CALL
ScVbaAxis::setMaximumScaleIsAuto( sal_Bool _bMaximumScaleIsAuto ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
try
{
if ( isValueAxis() )
mxPropertySet->setPropertyValue("AutoMax", uno::makeAny( _bMaximumScaleIsAuto ));
}
catch (const uno::Exception&)
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString());
}
}
sal_Bool SAL_CALL
ScVbaAxis::getMaximumScaleIsAuto( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
bool bIsAuto = false;
try
{
if (isValueAxis())
mxPropertySet->getPropertyValue("AutoMax") >>= bIsAuto;
}
catch (const uno::Exception&)
{
DebugHelper::basicexception( SbERR_METHOD_FAILED, OUString() );
}
return bIsAuto;
}
void SAL_CALL
ScVbaAxis::setMinimumScale( double _fMinimumScale ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
try
{
if (isValueAxis())
mxPropertySet->setPropertyValue("Min", uno::makeAny( _fMinimumScale ) );
}
catch ( uno::Exception& )
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString() );
}
}
double SAL_CALL
ScVbaAxis::getMinimumScale( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
double fMin = 0.0;
try
{
if (isValueAxis())
mxPropertySet->getPropertyValue("Min") >>= fMin;
}
2011-11-04 02:02:20 +09:00
catch (const uno::Exception& e)
{
DebugHelper::basicexception(e);
}
return fMin;
}
void SAL_CALL
ScVbaAxis::setMinimumScaleIsAuto( sal_Bool _bMinimumScaleIsAuto ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
try
{
if (isValueAxis())
{
mxPropertySet->setPropertyValue("AutoMin", uno::makeAny(_bMinimumScaleIsAuto));
}
}
catch (const uno::Exception&)
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString());
}
}
sal_Bool SAL_CALL
ScVbaAxis::getMinimumScaleIsAuto( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
bool bIsAuto = false;
try
{
if (isValueAxis())
{
mxPropertySet->getPropertyValue("AutoMin") >>= bIsAuto;
}
}
catch (const uno::Exception&)
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString());
}
return bIsAuto;
}
::sal_Int32 SAL_CALL
ScVbaAxis::getAxisGroup( ) throw (uno::RuntimeException, std::exception)
{
return mnGroup;
}
void SAL_CALL
ScVbaAxis::setScaleType( ::sal_Int32 _nScaleType ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
try
{
if (isValueAxis())
{
switch (_nScaleType)
{
case xlScaleLinear:
mxPropertySet->setPropertyValue("Logarithmic", uno::makeAny( sal_False ) );
break;
case xlScaleLogarithmic:
mxPropertySet->setPropertyValue("Logarithmic", uno::makeAny( sal_True ) );
break;
default:
// According to MS the paramenter is ignored and no Error is thrown
break;
}
}
}
catch (const uno::Exception&)
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString());
}
}
::sal_Int32 SAL_CALL
ScVbaAxis::getScaleType( ) throw (script::BasicErrorException, uno::RuntimeException, std::exception)
{
sal_Int32 nScaleType = xlScaleLinear;
try
{
if (isValueAxis())
{
bool bisLogarithmic = false;
mxPropertySet->getPropertyValue( OUString( OUString("Logarithmic")) ) >>= bisLogarithmic;
if (bisLogarithmic)
nScaleType = xlScaleLogarithmic;
else
nScaleType = xlScaleLinear;
}
}
catch (const uno::Exception&)
{
DebugHelper::basicexception(SbERR_METHOD_FAILED, OUString());
}
return nScaleType;
}
double SAL_CALL
ScVbaAxis::getHeight( ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception)
{
return oShapeHelper->getHeight();
}
void SAL_CALL ScVbaAxis::setHeight( double height ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception)
{
oShapeHelper->setHeight( height );
}
double SAL_CALL ScVbaAxis::getWidth( ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception)
{
return oShapeHelper->getWidth( );
}
void SAL_CALL ScVbaAxis::setWidth( double width ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception)
{
oShapeHelper->setWidth( width );
}
double SAL_CALL ScVbaAxis::getTop( ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception)
{
return oShapeHelper->getTop( );
}
void SAL_CALL ScVbaAxis::setTop( double top ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception)
{
oShapeHelper->setTop( top );
}
double SAL_CALL ScVbaAxis::getLeft( ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception)
{
return oShapeHelper->getLeft( );
}
void SAL_CALL ScVbaAxis::setLeft( double left ) throw (css::script::BasicErrorException, css::uno::RuntimeException, std::exception)
{
oShapeHelper->setLeft( left );
}
OUString
ScVbaAxis::getServiceImplName()
{
return OUString("ScVbaAxis");
}
uno::Sequence< OUString >
ScVbaAxis::getServiceNames()
{
static uno::Sequence< OUString > aServiceNames;
if ( aServiceNames.getLength() == 0 )
{
aServiceNames.realloc( 1 );
aServiceNames[ 0 ] = "ooo.vba.excel.Axis";
}
return aServiceNames;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */