2003-10-06 08:58:36 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-07 23:29:00 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2005-09-07 23:29:00 +00:00
|
|
|
* $RCSfile: DataPointItemConverter.cxx,v $
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2007-05-22 17:00:32 +00:00
|
|
|
* $Revision: 1.14 $
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2007-05-22 17:00:32 +00:00
|
|
|
* last change: $Author: vg $ $Date: 2007-05-22 18:00:32 $
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2005-09-07 23:29:00 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-07 23:29:00 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2005-09-07 23:29:00 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2005-09-07 23:29:00 +00:00
|
|
|
* This library 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 for more details.
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
2005-09-07 23:29:00 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2003-10-06 08:58:36 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2006-09-17 12:02:33 +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 "DataPointItemConverter.hxx"
|
|
|
|
#include "SchWhichPairs.hxx"
|
|
|
|
#include "macros.hxx"
|
|
|
|
#include "ItemPropertyMap.hxx"
|
|
|
|
|
|
|
|
#include "GraphicPropertyItemConverter.hxx"
|
|
|
|
#include "CharacterPropertyItemConverter.hxx"
|
2003-12-09 15:31:19 +00:00
|
|
|
#include "StatisticsItemConverter.hxx"
|
2007-05-22 17:00:32 +00:00
|
|
|
#include "SeriesOptionsItemConverter.hxx"
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
#ifndef _SVX_CHRTITEM_HXX
|
|
|
|
#include <svx/chrtitem.hxx>
|
|
|
|
#endif
|
2004-01-26 08:13:31 +00:00
|
|
|
#ifndef _COM_SUN_STAR_CHART2_DATAPOINTLABEL_HPP_
|
|
|
|
#include <com/sun/star/chart2/DataPointLabel.hpp>
|
2003-10-06 08:58:36 +00:00
|
|
|
#endif
|
2004-01-26 08:13:31 +00:00
|
|
|
#ifndef _COM_SUN_STAR_CHART2_SYMBOL_HPP_
|
|
|
|
#include <com/sun/star/chart2/Symbol.hpp>
|
2003-12-10 17:08:46 +00:00
|
|
|
#endif
|
|
|
|
|
2007-05-22 17:00:32 +00:00
|
|
|
// header for class XFillColorItem
|
|
|
|
#ifndef _SVX_XFLCLIT_HXX
|
|
|
|
#include <svx/xflclit.hxx>
|
|
|
|
#endif
|
2003-10-06 08:58:36 +00:00
|
|
|
#ifndef _SFXINTITEM_HXX
|
|
|
|
#include <svtools/intitem.hxx>
|
|
|
|
#endif
|
2003-12-10 17:08:46 +00:00
|
|
|
#ifndef _SVX_SIZEITEM_HXX
|
|
|
|
#include <svx/sizeitem.hxx>
|
|
|
|
#endif
|
|
|
|
|
2007-05-22 17:00:32 +00:00
|
|
|
#ifndef _SVX_BRSHITEM_HXX
|
|
|
|
#include <svx/brshitem.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _SV_GRAPH_HXX
|
|
|
|
#include <vcl/graph.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_GRAPHIC_XGRAPHIC_HPP_
|
|
|
|
#include <com/sun/star/graphic/XGraphic.hpp>
|
|
|
|
#endif
|
|
|
|
|
2003-12-10 17:08:46 +00:00
|
|
|
// for SVX_SYMBOLTYPE_...
|
|
|
|
#ifndef _SVX_TAB_LINE_HXX
|
|
|
|
#include <svx/tabline.hxx>
|
|
|
|
#endif
|
2003-10-06 08:58:36 +00:00
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
2003-10-07 16:18:46 +00:00
|
|
|
::comphelper::ItemPropertyMapType & lcl_GetDataPointPropertyMap()
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2003-10-07 16:18:46 +00:00
|
|
|
static ::comphelper::ItemPropertyMapType aDataPointPropertyMap(
|
|
|
|
::comphelper::MakeItemPropertyMap
|
2007-05-22 17:00:32 +00:00
|
|
|
// IPM_MAP_ENTRY( CHATTR_PIE_SEGMENT_OFFSET, "Offset", 0 )
|
|
|
|
IPM_MAP_ENTRY( SCHATTR_STYLE_SHAPE, "Geometry3D", 0 )
|
2003-10-06 08:58:36 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return aDataPointPropertyMap;
|
|
|
|
};
|
2003-12-10 17:08:46 +00:00
|
|
|
|
|
|
|
sal_Int32 lcl_getSymbolStyleForSymbol( const chart2::Symbol & rSymbol )
|
|
|
|
{
|
|
|
|
sal_Int32 nStyle = SVX_SYMBOLTYPE_UNKNOWN;
|
2007-05-22 17:00:32 +00:00
|
|
|
switch( rSymbol.Style )
|
2003-12-10 17:08:46 +00:00
|
|
|
{
|
|
|
|
case chart2::SymbolStyle_NONE:
|
|
|
|
nStyle = SVX_SYMBOLTYPE_NONE;
|
|
|
|
break;
|
|
|
|
case chart2::SymbolStyle_AUTO:
|
|
|
|
nStyle = SVX_SYMBOLTYPE_AUTO;
|
|
|
|
break;
|
2007-05-22 17:00:32 +00:00
|
|
|
case chart2::SymbolStyle_GRAPHIC:
|
2003-12-10 17:08:46 +00:00
|
|
|
nStyle = SVX_SYMBOLTYPE_BRUSHITEM;
|
|
|
|
break;
|
|
|
|
case chart2::SymbolStyle_STANDARD:
|
2007-05-22 17:00:32 +00:00
|
|
|
nStyle = rSymbol.StandardSymbol;
|
2003-12-10 17:08:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case chart2::SymbolStyle_POLYGON:
|
|
|
|
// to avoid warning
|
|
|
|
case chart2::SymbolStyle_MAKE_FIXED_SIZE:
|
|
|
|
// nothing
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return nStyle;
|
|
|
|
}
|
2003-10-06 08:58:36 +00:00
|
|
|
} // anonymous namespace
|
|
|
|
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
namespace wrapper
|
|
|
|
{
|
|
|
|
|
|
|
|
DataPointItemConverter::DataPointItemConverter(
|
2003-12-17 15:43:22 +00:00
|
|
|
const uno::Reference< frame::XModel > & xChartModel,
|
2007-05-22 17:00:32 +00:00
|
|
|
const uno::Reference< uno::XComponentContext > & xContext,
|
2003-12-17 15:43:22 +00:00
|
|
|
const uno::Reference< beans::XPropertySet > & rPropertySet,
|
2003-10-06 08:58:36 +00:00
|
|
|
SfxItemPool& rItemPool,
|
|
|
|
SdrModel& rDrawModel,
|
|
|
|
NumberFormatterWrapper * pNumFormatter,
|
2007-05-22 17:00:32 +00:00
|
|
|
const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
|
2003-11-25 12:08:01 +00:00
|
|
|
GraphicPropertyItemConverter::eGraphicObjectType eMapTo /* = FILL_PROPERTIES */,
|
2003-12-09 15:31:19 +00:00
|
|
|
::std::auto_ptr< awt::Size > pRefSize /* = NULL */,
|
2007-05-22 17:00:32 +00:00
|
|
|
bool bDataSeries /* = false */,
|
|
|
|
bool bUseSpecialFillColor /* = false */,
|
|
|
|
sal_Int32 nSpecialFillColor /* =0 */
|
|
|
|
) :
|
2003-10-06 08:58:36 +00:00
|
|
|
ItemConverter( rPropertySet, rItemPool ),
|
2003-12-09 15:31:19 +00:00
|
|
|
m_pNumberFormatterWrapper( pNumFormatter ),
|
2007-05-22 17:00:32 +00:00
|
|
|
m_bDataSeries( bDataSeries ),
|
|
|
|
m_bUseSpecialFillColor(bUseSpecialFillColor),
|
|
|
|
m_nSpecialFillColor(nSpecialFillColor)
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2007-05-22 17:00:32 +00:00
|
|
|
m_aConverters.push_back( new GraphicPropertyItemConverter(
|
|
|
|
rPropertySet, rItemPool, rDrawModel, xNamedPropertyContainerFactory, eMapTo ));
|
2003-11-25 12:08:01 +00:00
|
|
|
m_aConverters.push_back( new CharacterPropertyItemConverter( rPropertySet, rItemPool, pRefSize,
|
|
|
|
C2U( "ReferenceDiagramSize" )));
|
2007-05-22 17:00:32 +00:00
|
|
|
if( bDataSeries )
|
|
|
|
{
|
2003-12-17 15:43:22 +00:00
|
|
|
m_aConverters.push_back( new StatisticsItemConverter( xChartModel, rPropertySet, rItemPool ));
|
2007-05-22 17:00:32 +00:00
|
|
|
m_aConverters.push_back( new SeriesOptionsItemConverter( xChartModel, xContext, rPropertySet, rItemPool ));
|
|
|
|
}
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DataPointItemConverter::~DataPointItemConverter()
|
|
|
|
{
|
|
|
|
::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 DataPointItemConverter::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 );
|
2007-05-22 17:00:32 +00:00
|
|
|
|
|
|
|
if( m_bUseSpecialFillColor )
|
|
|
|
{
|
|
|
|
Color aColor(m_nSpecialFillColor);
|
|
|
|
rOutItemSet.Put( XFillColorItem( String(), aColor ) );
|
|
|
|
}
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool DataPointItemConverter::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 * DataPointItemConverter::GetWhichPairs() const
|
|
|
|
{
|
|
|
|
// must span all used items!
|
2007-05-22 17:00:32 +00:00
|
|
|
if( m_bDataSeries )
|
2003-12-09 15:31:19 +00:00
|
|
|
return nRowWhichPairs;
|
|
|
|
return nDataPointWhichPairs;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
2007-05-22 17:00:32 +00:00
|
|
|
bool DataPointItemConverter::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_GetDataPointPropertyMap());
|
|
|
|
::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:32 +00:00
|
|
|
rOutProperty =(*aIt).second;
|
2003-10-06 08:58:36 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool DataPointItemConverter::ApplySpecialItem(
|
2003-11-04 11:37:45 +00:00
|
|
|
USHORT nWhichId, const SfxItemSet & rItemSet )
|
2003-10-17 13:30:15 +00:00
|
|
|
throw( uno::Exception )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
bool bChanged = false;
|
|
|
|
uno::Any aValue;
|
|
|
|
|
|
|
|
switch( nWhichId )
|
|
|
|
{
|
|
|
|
case SCHATTR_DATADESCR_DESCR:
|
|
|
|
{
|
|
|
|
const SvxChartDataDescrItem & rItem =
|
|
|
|
reinterpret_cast< const SvxChartDataDescrItem & >(
|
|
|
|
rItemSet.Get( nWhichId ));
|
|
|
|
|
2003-12-08 14:46:28 +00:00
|
|
|
chart2::DataPointLabel aLabel;
|
|
|
|
if( GetPropertySet()->getPropertyValue( C2U( "Label" )) >>= aLabel )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
switch( rItem.GetValue())
|
|
|
|
{
|
|
|
|
case CHDESCR_NONE:
|
2003-12-08 14:46:28 +00:00
|
|
|
aLabel.ShowNumber = sal_False;
|
2007-05-22 17:00:32 +00:00
|
|
|
aLabel.ShowNumberInPercent = sal_False;
|
2003-12-08 14:46:28 +00:00
|
|
|
aLabel.ShowCategoryName = sal_False;
|
2003-10-06 08:58:36 +00:00
|
|
|
break;
|
|
|
|
case CHDESCR_VALUE:
|
2003-12-08 14:46:28 +00:00
|
|
|
aLabel.ShowNumber = sal_True;
|
|
|
|
aLabel.ShowNumberInPercent = sal_False;
|
|
|
|
aLabel.ShowCategoryName = sal_False;
|
2003-10-06 08:58:36 +00:00
|
|
|
break;
|
|
|
|
case CHDESCR_PERCENT:
|
2007-05-22 17:00:32 +00:00
|
|
|
aLabel.ShowNumber = sal_False;
|
2003-12-08 14:46:28 +00:00
|
|
|
aLabel.ShowNumberInPercent = sal_True;
|
|
|
|
aLabel.ShowCategoryName = sal_False;
|
2003-10-06 08:58:36 +00:00
|
|
|
break;
|
|
|
|
case CHDESCR_TEXT:
|
2003-12-08 14:46:28 +00:00
|
|
|
aLabel.ShowNumber = sal_False;
|
2007-05-22 17:00:32 +00:00
|
|
|
aLabel.ShowNumberInPercent = sal_False;
|
2003-12-08 14:46:28 +00:00
|
|
|
aLabel.ShowCategoryName = sal_True;
|
2003-10-06 08:58:36 +00:00
|
|
|
break;
|
|
|
|
case CHDESCR_TEXTANDPERCENT:
|
2007-05-22 17:00:32 +00:00
|
|
|
aLabel.ShowNumber = sal_False;
|
2003-12-08 14:46:28 +00:00
|
|
|
aLabel.ShowNumberInPercent = sal_True;
|
|
|
|
aLabel.ShowCategoryName = sal_True;
|
2003-10-06 08:58:36 +00:00
|
|
|
break;
|
|
|
|
case CHDESCR_TEXTANDVALUE:
|
2003-12-08 14:46:28 +00:00
|
|
|
aLabel.ShowNumber = sal_True;
|
|
|
|
aLabel.ShowNumberInPercent = sal_False;
|
|
|
|
aLabel.ShowCategoryName = sal_True;
|
2003-10-06 08:58:36 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-12-08 14:46:28 +00:00
|
|
|
aValue <<= aLabel;
|
|
|
|
if( aValue != GetPropertySet()->getPropertyValue( C2U( "Label" ) ))
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2003-12-08 14:46:28 +00:00
|
|
|
GetPropertySet()->setPropertyValue( C2U( "Label" ), aValue );
|
2003-10-06 08:58:36 +00:00
|
|
|
bChanged = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_DATADESCR_SHOW_SYM:
|
|
|
|
{
|
|
|
|
const SvxChartDataDescrItem & rItem =
|
|
|
|
reinterpret_cast< const SvxChartDataDescrItem & >(
|
|
|
|
rItemSet.Get( nWhichId ));
|
|
|
|
|
2003-12-08 14:46:28 +00:00
|
|
|
chart2::DataPointLabel aLabel;
|
|
|
|
if( GetPropertySet()->getPropertyValue( C2U( "Label" )) >>= aLabel )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2003-12-08 14:46:28 +00:00
|
|
|
sal_Bool bOldValue = aLabel.ShowLegendSymbol;
|
|
|
|
aLabel.ShowLegendSymbol = static_cast< sal_Bool >( rItem.GetValue() );
|
|
|
|
if( bOldValue != aLabel.ShowLegendSymbol )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2003-12-08 14:46:28 +00:00
|
|
|
GetPropertySet()->setPropertyValue( C2U( "Label" ), uno::makeAny( aLabel ));
|
2003-10-06 08:58:36 +00:00
|
|
|
bChanged = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_ATTR_NUMBERFORMAT_VALUE:
|
|
|
|
{
|
|
|
|
if( m_pNumberFormatterWrapper )
|
|
|
|
{
|
|
|
|
sal_Int32 nFmt = static_cast< sal_Int32 >(
|
|
|
|
reinterpret_cast< const SfxUInt32Item & >(
|
|
|
|
rItemSet.Get( nWhichId )).GetValue());
|
|
|
|
|
2007-05-22 17:00:32 +00:00
|
|
|
aValue = uno::makeAny(nFmt);
|
2003-10-06 08:58:36 +00:00
|
|
|
if( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) != aValue )
|
|
|
|
{
|
|
|
|
GetPropertySet()->setPropertyValue( C2U( "NumberFormat" ), aValue );
|
|
|
|
bChanged = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OSL_ENSURE( false, "No NumberFormatterWrapper !" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2003-12-10 17:08:46 +00:00
|
|
|
|
|
|
|
case SCHATTR_STYLE_SYMBOL:
|
|
|
|
{
|
|
|
|
sal_Int32 nStyle =
|
|
|
|
reinterpret_cast< const SfxInt32Item & >(
|
|
|
|
rItemSet.Get( nWhichId )).GetValue();
|
|
|
|
chart2::Symbol aSymbol;
|
|
|
|
|
|
|
|
GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol;
|
|
|
|
sal_Int32 nOldStyle = lcl_getSymbolStyleForSymbol( aSymbol );
|
|
|
|
|
|
|
|
if( nStyle != nOldStyle )
|
|
|
|
{
|
|
|
|
bool bDeleteSymbol = false;
|
|
|
|
switch( nStyle )
|
|
|
|
{
|
|
|
|
case SVX_SYMBOLTYPE_NONE:
|
2007-05-22 17:00:32 +00:00
|
|
|
aSymbol.Style = chart2::SymbolStyle_NONE;
|
2003-12-10 17:08:46 +00:00
|
|
|
break;
|
|
|
|
case SVX_SYMBOLTYPE_AUTO:
|
2007-05-22 17:00:32 +00:00
|
|
|
aSymbol.Style = chart2::SymbolStyle_AUTO;
|
2003-12-10 17:08:46 +00:00
|
|
|
break;
|
|
|
|
case SVX_SYMBOLTYPE_BRUSHITEM:
|
2007-05-22 17:00:32 +00:00
|
|
|
aSymbol.Style = chart2::SymbolStyle_GRAPHIC;
|
2003-12-10 17:08:46 +00:00
|
|
|
break;
|
|
|
|
case SVX_SYMBOLTYPE_UNKNOWN:
|
|
|
|
bDeleteSymbol = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2007-05-22 17:00:32 +00:00
|
|
|
aSymbol.Style = chart2::SymbolStyle_STANDARD;
|
|
|
|
aSymbol.StandardSymbol = nStyle;
|
2003-12-10 17:08:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( bDeleteSymbol )
|
|
|
|
GetPropertySet()->setPropertyValue( C2U( "Symbol" ), uno::Any());
|
|
|
|
else
|
|
|
|
GetPropertySet()->setPropertyValue( C2U( "Symbol" ),
|
|
|
|
uno::makeAny( aSymbol ));
|
|
|
|
bChanged = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_SYMBOL_SIZE:
|
|
|
|
{
|
|
|
|
Size aSize = reinterpret_cast< const SvxSizeItem & >(
|
|
|
|
rItemSet.Get( nWhichId )).GetSize();
|
|
|
|
chart2::Symbol aSymbol;
|
|
|
|
|
|
|
|
GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol;
|
2007-05-22 17:00:32 +00:00
|
|
|
if( aSize.getWidth() != aSymbol.Size.Width ||
|
|
|
|
aSize.getHeight() != aSymbol.Size.Height )
|
2003-12-10 17:08:46 +00:00
|
|
|
{
|
2007-05-22 17:00:32 +00:00
|
|
|
aSymbol.Size.Width = aSize.getWidth();
|
|
|
|
aSymbol.Size.Height = aSize.getHeight();
|
2003-12-10 17:08:46 +00:00
|
|
|
|
|
|
|
GetPropertySet()->setPropertyValue( C2U( "Symbol" ), uno::makeAny( aSymbol ));
|
|
|
|
bChanged = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2007-05-22 17:00:32 +00:00
|
|
|
|
|
|
|
case SCHATTR_SYMBOL_BRUSH:
|
|
|
|
{
|
|
|
|
const SvxBrushItem & rBrshItem( reinterpret_cast< const SvxBrushItem & >(
|
|
|
|
rItemSet.Get( nWhichId )));
|
|
|
|
uno::Any aXGraphicAny;
|
|
|
|
const Graphic *pGraphic( rBrshItem.GetGraphic());
|
|
|
|
if( pGraphic )
|
|
|
|
{
|
|
|
|
uno::Reference< graphic::XGraphic > xGraphic( pGraphic->GetXGraphic());
|
|
|
|
if( xGraphic.is())
|
|
|
|
{
|
|
|
|
aXGraphicAny <<= xGraphic;
|
|
|
|
chart2::Symbol aSymbol;
|
|
|
|
GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol;
|
|
|
|
if( aSymbol.Graphic != xGraphic )
|
|
|
|
{
|
|
|
|
aSymbol.Graphic = xGraphic;
|
|
|
|
GetPropertySet()->setPropertyValue( C2U( "Symbol" ), uno::makeAny( aSymbol ));
|
|
|
|
bChanged = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return bChanged;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DataPointItemConverter::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
|
|
|
{
|
|
|
|
switch( nWhichId )
|
|
|
|
{
|
|
|
|
case SCHATTR_DATADESCR_DESCR:
|
|
|
|
case SCHATTR_DATADESCR_SHOW_SYM:
|
|
|
|
{
|
2003-12-08 14:46:28 +00:00
|
|
|
chart2::DataPointLabel aLabel;
|
|
|
|
if( GetPropertySet()->getPropertyValue( C2U( "Label" )) >>= aLabel )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
SvxChartDataDescr aDescr;
|
|
|
|
|
2003-12-08 14:46:28 +00:00
|
|
|
if( aLabel.ShowNumber )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
2007-05-22 17:00:32 +00:00
|
|
|
if( aLabel.ShowCategoryName )
|
|
|
|
aDescr = CHDESCR_TEXTANDVALUE;
|
2003-10-06 08:58:36 +00:00
|
|
|
else
|
2007-05-22 17:00:32 +00:00
|
|
|
aDescr = CHDESCR_VALUE;
|
|
|
|
}
|
|
|
|
else if( aLabel.ShowNumberInPercent )
|
|
|
|
{
|
|
|
|
if( aLabel.ShowCategoryName )
|
|
|
|
aDescr = CHDESCR_TEXTANDPERCENT;
|
|
|
|
else
|
|
|
|
aDescr = CHDESCR_PERCENT;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-12-08 14:46:28 +00:00
|
|
|
if( aLabel.ShowCategoryName )
|
2003-10-06 08:58:36 +00:00
|
|
|
aDescr = CHDESCR_TEXT;
|
|
|
|
else
|
|
|
|
aDescr = CHDESCR_NONE;
|
|
|
|
}
|
|
|
|
|
2007-05-22 17:00:32 +00:00
|
|
|
rOutItemSet.Put( SvxChartDataDescrItem( aDescr, SCHATTR_DATADESCR_DESCR ));
|
2003-12-08 14:46:28 +00:00
|
|
|
rOutItemSet.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYM, aLabel.ShowLegendSymbol ));
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_ATTR_NUMBERFORMAT_VALUE:
|
|
|
|
{
|
|
|
|
if( m_pNumberFormatterWrapper )
|
|
|
|
{
|
2007-05-22 17:00:32 +00:00
|
|
|
sal_Int32 nKey;
|
|
|
|
if( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) >>= nKey )
|
2003-10-06 08:58:36 +00:00
|
|
|
{
|
|
|
|
rOutItemSet.Put( SfxUInt32Item( nWhichId, nKey ));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OSL_ENSURE( false, "No NumberFormatterWrapper !" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2003-12-10 17:08:46 +00:00
|
|
|
|
|
|
|
case SCHATTR_STYLE_SYMBOL:
|
|
|
|
{
|
|
|
|
chart2::Symbol aSymbol;
|
|
|
|
if( GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol )
|
|
|
|
rOutItemSet.Put( SfxInt32Item( nWhichId, lcl_getSymbolStyleForSymbol( aSymbol ) ));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_SYMBOL_SIZE:
|
|
|
|
{
|
|
|
|
chart2::Symbol aSymbol;
|
|
|
|
if( GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol )
|
|
|
|
rOutItemSet.Put(
|
2007-05-22 17:00:32 +00:00
|
|
|
SvxSizeItem( nWhichId, Size( aSymbol.Size.Width, aSymbol.Size.Height ) ));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SCHATTR_SYMBOL_BRUSH:
|
|
|
|
{
|
|
|
|
chart2::Symbol aSymbol;
|
|
|
|
if(( GetPropertySet()->getPropertyValue( C2U( "Symbol" )) >>= aSymbol )
|
|
|
|
&& aSymbol.Graphic.is() )
|
|
|
|
{
|
|
|
|
rOutItemSet.Put( SvxBrushItem( Graphic( aSymbol.Graphic ), GPOS_MM, SCHATTR_SYMBOL_BRUSH ));
|
|
|
|
}
|
2003-12-10 17:08:46 +00:00
|
|
|
}
|
|
|
|
break;
|
2003-10-06 08:58:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace wrapper
|
|
|
|
} // namespace chart
|