2003-10-06 08:58:36 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 19:43:10 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2008-04-10 19:43:10 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2008-04-10 19:43:10 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2008-04-10 19:43:10 +00:00
|
|
|
* $RCSfile: AxisItemConverter.cxx,v $
|
2008-10-01 07:35:04 +00:00
|
|
|
* $Revision: 1.14.44.1 $
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2008-04-10 19:43:10 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2008-04-10 19:43:10 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2008-04-10 19:43:10 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2008-04-10 19:43:10 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2006-09-17 12:02:03 +00:00
|
|
|
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_chart2.hxx"
|
2003-10-06 08:58:36 +00:00
|
|
|
#include "AxisItemConverter.hxx"
|
|
|
|
#include "ItemPropertyMap.hxx"
|
|
|
|
#include "CharacterPropertyItemConverter.hxx"
|
|
|
|
#include "GraphicPropertyItemConverter.hxx"
|
2007-05-22 17:00:06 +00:00
|
|
|
#include "chartview/ChartSfxItemIds.hxx"
|
|
|
|
#include "chartview/ExplicitValueProvider.hxx"
|
2003-10-06 08:58:36 +00:00
|
|
|
#include "SchWhichPairs.hxx"
|
|
|
|
#include "macros.hxx"
|
|
|
|
#include "Scaling.hxx"
|
2007-05-22 17:00:06 +00:00
|
|
|
#include "ChartModelHelper.hxx"
|
|
|
|
#include "AxisHelper.hxx"
|
|
|
|
#include "CommonConverters.hxx"
|
2004-01-26 08:13:31 +00:00
|
|
|
#include <com/sun/star/chart2/XAxis.hpp>
|
2007-10-22 15:50:54 +00:00
|
|
|
#include <com/sun/star/chart2/AxisOrientation.hpp>
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
// #ifndef _COMPHELPER_PROCESSFACTORY_HXX_
|
|
|
|
// #include <comphelper/processfactory.hxx>
|
|
|
|
// #endif
|
|
|
|
// for SfxBoolItem
|
|
|
|
#include <svtools/eitem.hxx>
|
|
|
|
// for SvxDoubleItem
|
|
|
|
#include <svx/chrtitem.hxx>
|
|
|
|
// for SfxInt32Item
|
|
|
|
#include <svtools/intitem.hxx>
|
|
|
|
#include <rtl/math.hxx>
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
2007-05-22 17:00:06 +00:00
|
|
|
using namespace ::com::sun::star::chart2;
|
|
|
|
using ::com::sun::star::uno::Reference;
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
2003-10-07 16:18:46 +00:00
|
|
|
::comphelper::ItemPropertyMapType & lcl_GetAxisPropertyMap()
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2003-10-07 16:18:46 +00:00
|
|
|
static ::comphelper::ItemPropertyMapType aAxisPropertyMap(
|
|
|
|
::comphelper::MakeItemPropertyMap
|
2007-05-22 17:00:06 +00:00
|
|
|
IPM_MAP_ENTRY( SCHATTR_AXIS_SHOWDESCR, "DisplayLabels", 0 )
|
|
|
|
IPM_MAP_ENTRY( SCHATTR_AXIS_TICKS, "MajorTickmarks", 0 )
|
|
|
|
IPM_MAP_ENTRY( SCHATTR_AXIS_HELPTICKS, "MinorTickmarks", 0 )
|
|
|
|
IPM_MAP_ENTRY( SCHATTR_TEXT_ORDER, "ArrangeOrder", 0 )
|
|
|
|
IPM_MAP_ENTRY( SCHATTR_TEXT_STACKED, "StackCharacters", 0 )
|
|
|
|
IPM_MAP_ENTRY( SCHATTR_TEXTBREAK, "TextBreak", 0 )
|
|
|
|
IPM_MAP_ENTRY( SCHATTR_TEXT_OVERLAP, "TextOverlap", 0 )
|
2003-10-06 08:58:36 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return aAxisPropertyMap;
|
|
|
|
};
|
|
|
|
} // anonymous namespace
|
|
|
|
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
namespace wrapper
|
|
|
|
{
|
|
|
|
|
|
|
|
AxisItemConverter::AxisItemConverter(
|
2007-05-22 17:00:06 +00:00
|
|
|
const Reference< beans::XPropertySet > & rPropertySet,
|
2003-10-06 08:58:36 +00:00
|
|
|
SfxItemPool& rItemPool,
|
|
|
|
SdrModel& rDrawModel,
|
2007-05-22 17:00:06 +00:00
|
|
|
const Reference< chart2::XChartDocument > & xChartDoc,
|
2003-10-06 08:58:36 +00:00
|
|
|
chart2::ExplicitScaleData * pScale /* = NULL */,
|
|
|
|
chart2::ExplicitIncrementData * pIncrement /* = NULL */,
|
2003-11-25 12:08:01 +00:00
|
|
|
::std::auto_ptr< awt::Size > pRefSize /* = NULL */ ) :
|
2003-10-06 08:58:36 +00:00
|
|
|
ItemConverter( rPropertySet, rItemPool ),
|
2007-05-22 17:00:06 +00:00
|
|
|
m_xChartDoc( xChartDoc ),
|
2003-10-06 08:58:36 +00:00
|
|
|
m_pExplicitScale( NULL ),
|
2007-05-22 17:00:06 +00:00
|
|
|
m_pExplicitIncrement( NULL )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
Reference< lang::XMultiServiceFactory > xNamedPropertyContainerFactory( xChartDoc, uno::UNO_QUERY );
|
|
|
|
|
2003-10-06 08:58:36 +00:00
|
|
|
if( pScale )
|
|
|
|
m_pExplicitScale = new chart2::ExplicitScaleData( *pScale );
|
|
|
|
if( pIncrement )
|
|
|
|
m_pExplicitIncrement = new chart2::ExplicitIncrementData( *pIncrement );
|
|
|
|
|
|
|
|
m_aConverters.push_back( new GraphicPropertyItemConverter(
|
|
|
|
rPropertySet, rItemPool, rDrawModel,
|
2007-05-22 17:00:06 +00:00
|
|
|
xNamedPropertyContainerFactory,
|
2003-10-06 08:58:36 +00:00
|
|
|
GraphicPropertyItemConverter::LINE_PROPERTIES ));
|
2003-11-25 12:08:01 +00:00
|
|
|
m_aConverters.push_back( new CharacterPropertyItemConverter( rPropertySet, rItemPool, pRefSize,
|
2008-10-01 07:35:04 +00:00
|
|
|
C2U( "ReferencePageSize" ) ));
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2007-05-22 17:00:06 +00:00
|
|
|
m_xAxis.set( Reference< chart2::XAxis >( rPropertySet, uno::UNO_QUERY ) );
|
|
|
|
OSL_ASSERT( m_xAxis.is());
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AxisItemConverter::~AxisItemConverter()
|
|
|
|
{
|
|
|
|
delete m_pExplicitScale;
|
|
|
|
delete m_pExplicitIncrement;
|
|
|
|
|
|
|
|
::std::for_each( m_aConverters.begin(), m_aConverters.end(),
|
2003-10-07 16:18:46 +00:00
|
|
|
::comphelper::DeleteItemConverterPtr() );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AxisItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
|
|
|
|
{
|
|
|
|
::std::for_each( m_aConverters.begin(), m_aConverters.end(),
|
2003-10-07 16:18:46 +00:00
|
|
|
::comphelper::FillItemSetFunc( rOutItemSet ));
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
// own items
|
|
|
|
ItemConverter::FillItemSet( rOutItemSet );
|
|
|
|
}
|
|
|
|
|
|
|
|
bool AxisItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
|
|
|
|
{
|
|
|
|
bool bResult = false;
|
|
|
|
|
|
|
|
::std::for_each( m_aConverters.begin(), m_aConverters.end(),
|
2003-10-07 16:18:46 +00:00
|
|
|
::comphelper::ApplyItemSetFunc( rItemSet, bResult ));
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
// own items
|
|
|
|
return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
const USHORT * AxisItemConverter::GetWhichPairs() const
|
|
|
|
{
|
|
|
|
// must span all used items!
|
|
|
|
return nAxisWhichPairs;
|
|
|
|
}
|
|
|
|
|
2007-05-22 17:00:06 +00:00
|
|
|
bool AxisItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2003-10-07 16:18:46 +00:00
|
|
|
::comphelper::ItemPropertyMapType & rMap( lcl_GetAxisPropertyMap());
|
|
|
|
::comphelper::ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
if( aIt == rMap.end())
|
|
|
|
return false;
|
|
|
|
|
2007-05-22 17:00:06 +00:00
|
|
|
rOutProperty =(*aIt).second;
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void AxisItemConverter::FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
|
2003-10-17 13:30:15 +00:00
|
|
|
throw( uno::Exception )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
if( ! m_xAxis.is() )
|
2003-10-06 08:58:36 +00:00
|
|
|
return;
|
|
|
|
|
2007-05-22 17:00:06 +00:00
|
|
|
const chart2::ScaleData aScale( m_xAxis->getScaleData() );
|
|
|
|
const chart2::IncrementData aInc( aScale.IncrementData );
|
|
|
|
const uno::Sequence< chart2::SubIncrement > aSubIncs( aScale.IncrementData.SubIncrements );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
switch( nWhichId )
|
|
|
|
{
|
|
|
|
case SCHATTR_AXIS_AUTO_MAX:
|
|
|
|
// if the any has no value => auto is on
|
|
|
|
rOutItemSet.Put( SfxBoolItem( nWhichId, ( ! aScale.Maximum.hasValue())));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_AXIS_MAX:
|
|
|
|
if( aScale.Maximum.hasValue())
|
|
|
|
{
|
|
|
|
OSL_ASSERT( aScale.Maximum.getValueTypeClass() == uno::TypeClass_DOUBLE );
|
|
|
|
rOutItemSet.Put(
|
|
|
|
SvxDoubleItem(
|
|
|
|
*reinterpret_cast< const double * >( aScale.Maximum.getValue()), nWhichId ));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
double fExplicitMax = 10.0;
|
|
|
|
if( m_pExplicitScale )
|
|
|
|
fExplicitMax = m_pExplicitScale->Maximum;
|
|
|
|
|
|
|
|
rOutItemSet.Put(
|
|
|
|
SvxDoubleItem( fExplicitMax, nWhichId ));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_AXIS_AUTO_MIN:
|
|
|
|
// if the any has no value => auto is on
|
|
|
|
rOutItemSet.Put( SfxBoolItem( nWhichId, ( ! aScale.Minimum.hasValue())));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_AXIS_MIN:
|
|
|
|
if( aScale.Minimum.hasValue())
|
|
|
|
{
|
|
|
|
OSL_ASSERT( aScale.Minimum.getValueTypeClass() == uno::TypeClass_DOUBLE );
|
|
|
|
rOutItemSet.Put(
|
|
|
|
SvxDoubleItem(
|
|
|
|
*reinterpret_cast< const double * >( aScale.Minimum.getValue()), nWhichId ));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( m_pExplicitScale )
|
|
|
|
rOutItemSet.Put( SvxDoubleItem( m_pExplicitScale->Minimum, nWhichId ));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_AXIS_LOGARITHM:
|
|
|
|
{
|
2007-09-18 13:55:41 +00:00
|
|
|
BOOL bValue = AxisHelper::isLogarithmic( aScale.Scaling );
|
2003-10-06 08:58:36 +00:00
|
|
|
rOutItemSet.Put( SfxBoolItem( nWhichId, bValue ));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2007-10-22 15:50:54 +00:00
|
|
|
case SCHATTR_AXIS_REVERSE:
|
|
|
|
rOutItemSet.Put( SfxBoolItem( nWhichId, (AxisOrientation_REVERSE == aScale.Orientation) ));
|
|
|
|
break;
|
|
|
|
|
2003-10-06 08:58:36 +00:00
|
|
|
// Increment
|
|
|
|
case SCHATTR_AXIS_AUTO_STEP_MAIN:
|
|
|
|
// if the any has no value => auto is on
|
|
|
|
rOutItemSet.Put( SfxBoolItem( nWhichId, ( ! aInc.Distance.hasValue())));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_AXIS_STEP_MAIN:
|
|
|
|
if( aInc.Distance.hasValue())
|
|
|
|
{
|
|
|
|
OSL_ASSERT( aInc.Distance.getValueTypeClass() == uno::TypeClass_DOUBLE );
|
|
|
|
rOutItemSet.Put(
|
|
|
|
SvxDoubleItem(
|
|
|
|
*reinterpret_cast< const double * >( aInc.Distance.getValue()), nWhichId ));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( m_pExplicitIncrement )
|
|
|
|
rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->Distance, nWhichId ));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
// SubIncrement
|
|
|
|
case SCHATTR_AXIS_AUTO_STEP_HELP:
|
|
|
|
{
|
|
|
|
// if the any has no value => auto is on
|
|
|
|
rOutItemSet.Put(
|
|
|
|
SfxBoolItem(
|
|
|
|
nWhichId,
|
|
|
|
! ( aSubIncs.getLength() > 0 &&
|
|
|
|
aSubIncs[0].IntervalCount.hasValue() )));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_AXIS_STEP_HELP:
|
|
|
|
{
|
|
|
|
if( aSubIncs.getLength() > 0 &&
|
|
|
|
aSubIncs[0].IntervalCount.hasValue())
|
|
|
|
{
|
|
|
|
OSL_ASSERT( aSubIncs[0].IntervalCount.getValueTypeClass() == uno::TypeClass_LONG );
|
|
|
|
rOutItemSet.Put(
|
|
|
|
SfxInt32Item(
|
|
|
|
nWhichId,
|
|
|
|
*reinterpret_cast< const sal_Int32 * >(
|
|
|
|
aSubIncs[0].IntervalCount.getValue()) ));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( m_pExplicitIncrement &&
|
|
|
|
m_pExplicitIncrement->SubIncrements.getLength() > 0 )
|
|
|
|
{
|
|
|
|
rOutItemSet.Put(
|
|
|
|
SfxInt32Item(
|
|
|
|
nWhichId,
|
|
|
|
m_pExplicitIncrement->SubIncrements[0].IntervalCount ));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_AXIS_AUTO_ORIGIN:
|
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
// if the any has no double value => auto is on
|
|
|
|
rOutItemSet.Put( SfxBoolItem( nWhichId, ( !hasDoubleValue(aScale.Origin) )));
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_AXIS_ORIGIN:
|
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
double fOrigin = 0.0;
|
|
|
|
if( !(aScale.Origin >>= fOrigin) )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
if( m_pExplicitScale )
|
|
|
|
fOrigin = m_pExplicitScale->Origin;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
2007-05-22 17:00:06 +00:00
|
|
|
rOutItemSet.Put( SvxDoubleItem( fOrigin, nWhichId ));
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_TEXT_DEGREES:
|
|
|
|
{
|
|
|
|
// convert double to int (times 100)
|
2007-08-03 11:35:16 +00:00
|
|
|
double fVal = 0;
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
if( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fVal )
|
|
|
|
{
|
|
|
|
rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >(
|
|
|
|
::rtl::math::round( fVal * 100.0 ) ) ));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_ATTR_NUMBERFORMAT_VALUE:
|
|
|
|
// case SCHATTR_AXIS_NUMFMT:
|
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
if( m_pExplicitScale )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
Reference< chart2::XCoordinateSystem > xCooSys(
|
|
|
|
AxisHelper::getCoordinateSystemOfAxis(
|
|
|
|
m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
|
|
|
|
|
|
|
|
sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
|
|
|
|
m_xAxis, xCooSys, Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ) );
|
|
|
|
|
|
|
|
rOutItemSet.Put( SfxUInt32Item( nWhichId, nFormatKey ));
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2007-05-22 17:00:06 +00:00
|
|
|
case SID_ATTR_NUMBERFORMAT_SOURCE:
|
|
|
|
{
|
|
|
|
bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )).hasValue());
|
|
|
|
rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet ));
|
|
|
|
}
|
|
|
|
break;
|
2007-10-22 15:50:54 +00:00
|
|
|
|
|
|
|
case SCHATTR_AXISTYPE:
|
|
|
|
rOutItemSet.Put( SfxInt32Item( nWhichId, aScale.AxisType ));
|
|
|
|
break;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-04 11:37:45 +00:00
|
|
|
bool AxisItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet )
|
2003-10-17 13:30:15 +00:00
|
|
|
throw( uno::Exception )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
if( !m_xAxis.is() )
|
2003-10-06 08:58:36 +00:00
|
|
|
return false;
|
|
|
|
|
2007-05-22 17:00:06 +00:00
|
|
|
chart2::ScaleData aScale( m_xAxis->getScaleData() );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2007-05-22 17:00:06 +00:00
|
|
|
bool bSetScale = false;
|
2003-10-06 08:58:36 +00:00
|
|
|
bool bChangedOtherwise = false;
|
|
|
|
|
|
|
|
uno::Any aValue;
|
|
|
|
|
|
|
|
switch( nWhichId )
|
|
|
|
{
|
|
|
|
case SCHATTR_AXIS_AUTO_MAX:
|
2007-07-25 07:42:13 +00:00
|
|
|
if( (static_cast< const SfxBoolItem & >(
|
2003-10-06 08:58:36 +00:00
|
|
|
rItemSet.Get( nWhichId )).GetValue() ))
|
|
|
|
{
|
|
|
|
aScale.Maximum.clear();
|
|
|
|
bSetScale = true;
|
|
|
|
}
|
|
|
|
// else SCHATTR_AXIS_MAX must have some value
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_AXIS_MAX:
|
|
|
|
// only if auto if false
|
2007-07-25 07:42:13 +00:00
|
|
|
if( ! (static_cast< const SfxBoolItem & >(
|
2003-10-06 08:58:36 +00:00
|
|
|
rItemSet.Get( SCHATTR_AXIS_AUTO_MAX )).GetValue() ))
|
|
|
|
{
|
|
|
|
rItemSet.Get( nWhichId ).QueryValue( aValue );
|
|
|
|
|
|
|
|
if( aScale.Maximum != aValue )
|
|
|
|
{
|
|
|
|
aScale.Maximum = aValue;
|
|
|
|
bSetScale = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_AXIS_AUTO_MIN:
|
2007-07-25 07:42:13 +00:00
|
|
|
if( (static_cast< const SfxBoolItem & >(
|
2003-10-06 08:58:36 +00:00
|
|
|
rItemSet.Get( nWhichId )).GetValue() ))
|
|
|
|
{
|
|
|
|
aScale.Minimum.clear();
|
|
|
|
bSetScale = true;
|
|
|
|
}
|
|
|
|
// else SCHATTR_AXIS_MIN must have some value
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_AXIS_MIN:
|
|
|
|
// only if auto if false
|
2007-07-25 07:42:13 +00:00
|
|
|
if( ! (static_cast< const SfxBoolItem & >(
|
2003-10-06 08:58:36 +00:00
|
|
|
rItemSet.Get( SCHATTR_AXIS_AUTO_MIN )).GetValue() ))
|
|
|
|
{
|
|
|
|
rItemSet.Get( nWhichId ).QueryValue( aValue );
|
|
|
|
|
|
|
|
if( aScale.Minimum != aValue )
|
|
|
|
{
|
|
|
|
aScale.Minimum = aValue;
|
|
|
|
bSetScale = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_AXIS_LOGARITHM:
|
|
|
|
{
|
2007-09-18 13:55:41 +00:00
|
|
|
bool bWasLogarithm = AxisHelper::isLogarithmic( aScale.Scaling );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2007-07-25 07:42:13 +00:00
|
|
|
if( (static_cast< const SfxBoolItem & >(
|
2003-10-06 08:58:36 +00:00
|
|
|
rItemSet.Get( nWhichId )).GetValue() ))
|
|
|
|
{
|
|
|
|
// logarithm is true
|
|
|
|
if( ! bWasLogarithm )
|
|
|
|
{
|
|
|
|
aScale.Scaling = new LogarithmicScaling( 10.0 );
|
|
|
|
bSetScale = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// logarithm is false => linear scaling
|
|
|
|
if( bWasLogarithm )
|
|
|
|
{
|
|
|
|
aScale.Scaling = new LinearScaling( 1.0, 0.0 );
|
|
|
|
bSetScale = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2007-10-22 15:50:54 +00:00
|
|
|
case SCHATTR_AXIS_REVERSE:
|
|
|
|
{
|
|
|
|
bool bWasReverse = ( AxisOrientation_REVERSE == aScale.Orientation );
|
|
|
|
bool bNewReverse = (static_cast< const SfxBoolItem & >(
|
|
|
|
rItemSet.Get( nWhichId )).GetValue() );
|
|
|
|
if( bWasReverse != bNewReverse )
|
|
|
|
{
|
|
|
|
aScale.Orientation = bNewReverse ? AxisOrientation_REVERSE : AxisOrientation_MATHEMATICAL;
|
|
|
|
bSetScale = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2003-10-06 08:58:36 +00:00
|
|
|
// Increment
|
|
|
|
case SCHATTR_AXIS_AUTO_STEP_MAIN:
|
2007-07-25 07:42:13 +00:00
|
|
|
if( (static_cast< const SfxBoolItem & >(
|
2003-10-06 08:58:36 +00:00
|
|
|
rItemSet.Get( nWhichId )).GetValue() ))
|
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
aScale.IncrementData.Distance.clear();
|
|
|
|
bSetScale = true;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
// else SCHATTR_AXIS_STEP_MAIN must have some value
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_AXIS_STEP_MAIN:
|
|
|
|
// only if auto if false
|
2007-07-25 07:42:13 +00:00
|
|
|
if( ! (static_cast< const SfxBoolItem & >(
|
2003-10-06 08:58:36 +00:00
|
|
|
rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_MAIN )).GetValue() ))
|
|
|
|
{
|
|
|
|
rItemSet.Get( nWhichId ).QueryValue( aValue );
|
|
|
|
|
2007-05-22 17:00:06 +00:00
|
|
|
if( aScale.IncrementData.Distance != aValue )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
aScale.IncrementData.Distance = aValue;
|
|
|
|
bSetScale = true;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
// SubIncrement
|
|
|
|
case SCHATTR_AXIS_AUTO_STEP_HELP:
|
2007-07-25 07:42:13 +00:00
|
|
|
if( (static_cast< const SfxBoolItem & >(
|
2003-10-06 08:58:36 +00:00
|
|
|
rItemSet.Get( nWhichId )).GetValue() ) &&
|
2007-05-22 17:00:06 +00:00
|
|
|
aScale.IncrementData.SubIncrements.getLength() > 0 &&
|
|
|
|
aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
aScale.IncrementData.SubIncrements[0].IntervalCount.clear();
|
|
|
|
bSetScale = true;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
// else SCHATTR_AXIS_STEP_MAIN must have some value
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_AXIS_STEP_HELP:
|
|
|
|
// only if auto if false
|
2007-07-25 07:42:13 +00:00
|
|
|
if( ! (static_cast< const SfxBoolItem & >(
|
2003-10-06 08:58:36 +00:00
|
|
|
rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_HELP )).GetValue() ) &&
|
2007-05-22 17:00:06 +00:00
|
|
|
aScale.IncrementData.SubIncrements.getLength() > 0 )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
rItemSet.Get( nWhichId ).QueryValue( aValue );
|
|
|
|
|
2007-05-22 17:00:06 +00:00
|
|
|
if( ! aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() ||
|
|
|
|
aScale.IncrementData.SubIncrements[0].IntervalCount != aValue )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
OSL_ASSERT( aValue.getValueTypeClass() == uno::TypeClass_LONG );
|
2007-05-22 17:00:06 +00:00
|
|
|
aScale.IncrementData.SubIncrements[0].IntervalCount = aValue;
|
|
|
|
bSetScale = true;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_AXIS_AUTO_ORIGIN:
|
|
|
|
{
|
2007-07-25 07:42:13 +00:00
|
|
|
if( (static_cast< const SfxBoolItem & >(
|
2007-05-22 17:00:06 +00:00
|
|
|
rItemSet.Get( nWhichId )).GetValue() ))
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
aScale.Origin.clear();
|
|
|
|
bSetScale = true;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_AXIS_ORIGIN:
|
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
// only if auto is false
|
2007-07-25 07:42:13 +00:00
|
|
|
if( ! (static_cast< const SfxBoolItem & >(
|
2003-10-06 08:58:36 +00:00
|
|
|
rItemSet.Get( SCHATTR_AXIS_AUTO_ORIGIN )).GetValue() ))
|
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
rItemSet.Get( nWhichId ).QueryValue( aValue );
|
|
|
|
|
|
|
|
if( aScale.Origin != aValue )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
aScale.Origin = aValue;
|
|
|
|
bSetScale = true;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_TEXT_DEGREES:
|
|
|
|
{
|
|
|
|
// convert int to double (divided by 100)
|
|
|
|
double fVal = static_cast< double >(
|
2007-07-25 07:42:13 +00:00
|
|
|
static_cast< const SfxInt32Item & >(
|
2003-10-06 08:58:36 +00:00
|
|
|
rItemSet.Get( nWhichId )).GetValue()) / 100.0;
|
|
|
|
double fOldVal = 0.0;
|
|
|
|
bool bPropExisted =
|
|
|
|
( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fOldVal );
|
|
|
|
|
|
|
|
if( ! bPropExisted ||
|
|
|
|
( bPropExisted && fOldVal != fVal ))
|
|
|
|
{
|
|
|
|
GetPropertySet()->setPropertyValue( C2U( "TextRotation" ), uno::makeAny( fVal ));
|
|
|
|
bChangedOtherwise = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_ATTR_NUMBERFORMAT_VALUE:
|
|
|
|
// case SCHATTR_AXIS_NUMFMT:
|
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
if( m_pExplicitScale )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
bool bUseSourceFormat =
|
2007-07-25 07:42:13 +00:00
|
|
|
(static_cast< const SfxBoolItem & >(
|
2007-05-22 17:00:06 +00:00
|
|
|
rItemSet.Get( SID_ATTR_NUMBERFORMAT_SOURCE )).GetValue() );
|
2003-10-06 08:58:36 +00:00
|
|
|
|
2007-05-22 17:00:06 +00:00
|
|
|
if( ! bUseSourceFormat )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
sal_Int32 nFmt = static_cast< sal_Int32 >(
|
2007-07-25 07:42:13 +00:00
|
|
|
static_cast< const SfxUInt32Item & >(
|
2007-05-22 17:00:06 +00:00
|
|
|
rItemSet.Get( nWhichId )).GetValue());
|
|
|
|
|
|
|
|
aValue = uno::makeAny(nFmt);
|
|
|
|
if( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) != aValue )
|
|
|
|
{
|
|
|
|
GetPropertySet()->setPropertyValue( C2U( "NumberFormat" ), aValue );
|
|
|
|
bChangedOtherwise = true;
|
|
|
|
}
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
}
|
2007-05-22 17:00:06 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_ATTR_NUMBERFORMAT_SOURCE:
|
|
|
|
{
|
|
|
|
bool bUseSourceFormat =
|
2007-07-25 07:42:13 +00:00
|
|
|
(static_cast< const SfxBoolItem & >(
|
2007-05-22 17:00:06 +00:00
|
|
|
rItemSet.Get( nWhichId )).GetValue() );
|
|
|
|
bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )).hasValue());
|
|
|
|
|
|
|
|
bChangedOtherwise = (bUseSourceFormat == bNumberFormatIsSet);
|
|
|
|
if( bChangedOtherwise )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2007-05-22 17:00:06 +00:00
|
|
|
if( ! bUseSourceFormat )
|
|
|
|
{
|
|
|
|
SfxItemState aState = rItemSet.GetItemState( SID_ATTR_NUMBERFORMAT_VALUE );
|
|
|
|
if( aState == SFX_ITEM_SET )
|
|
|
|
{
|
|
|
|
sal_Int32 nFormatKey = static_cast< sal_Int32 >(
|
2007-07-25 07:42:13 +00:00
|
|
|
static_cast< const SfxUInt32Item & >(
|
2007-05-22 17:00:06 +00:00
|
|
|
rItemSet.Get( SID_ATTR_NUMBERFORMAT_VALUE )).GetValue());
|
|
|
|
aValue <<= nFormatKey;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Reference< chart2::XCoordinateSystem > xCooSys(
|
|
|
|
AxisHelper::getCoordinateSystemOfAxis(
|
|
|
|
m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
|
|
|
|
|
|
|
|
sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
|
|
|
|
m_xAxis, xCooSys, Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ) );
|
|
|
|
|
|
|
|
aValue <<= nFormatKey;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// else set a void Any
|
|
|
|
GetPropertySet()->setPropertyValue( C2U( "NumberFormat" ), aValue );
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2007-10-22 15:50:54 +00:00
|
|
|
|
|
|
|
case SCHATTR_AXISTYPE:
|
|
|
|
//don't allow to change the axis type so far
|
|
|
|
break;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
2007-05-22 17:00:06 +00:00
|
|
|
if( bSetScale )
|
|
|
|
m_xAxis->setScaleData( aScale );
|
|
|
|
|
|
|
|
return (bSetScale || bChangedOtherwise);
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace wrapper
|
|
|
|
} // namespace chart
|