summaryrefslogtreecommitdiff
path: root/chart2/source/controller/itemsetwrapper
diff options
context:
space:
mode:
authorBjörn Milcke <bm@openoffice.org>2003-10-06 08:58:36 +0000
committerBjörn Milcke <bm@openoffice.org>2003-10-06 08:58:36 +0000
commit668c6b0245b6076ac8fb3f5d734795117188675e (patch)
tree363512534f7fae13719bddccb3a365e48ef7a8d3 /chart2/source/controller/itemsetwrapper
parent2ccbe3d78ecfa9aa1527db50d304a277d3cdbe64 (diff)
initial import
Diffstat (limited to 'chart2/source/controller/itemsetwrapper')
-rw-r--r--chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx700
-rw-r--r--chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx398
-rw-r--r--chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx337
-rw-r--r--chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx710
-rw-r--r--chart2/source/controller/itemsetwrapper/ItemConverter.cxx296
-rw-r--r--chart2/source/controller/itemsetwrapper/MultipleItemConverter.cxx230
-rw-r--r--chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx273
-rw-r--r--chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx262
-rw-r--r--chart2/source/controller/itemsetwrapper/makefile.mk89
9 files changed, 3295 insertions, 0 deletions
diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
new file mode 100644
index 000000000000..9f1ef04c6926
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
@@ -0,0 +1,700 @@
+/*************************************************************************
+ *
+ * $RCSfile: AxisItemConverter.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:28 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "AxisItemConverter.hxx"
+#include "ItemPropertyMap.hxx"
+#include "CharacterPropertyItemConverter.hxx"
+#include "GraphicPropertyItemConverter.hxx"
+#include "SchSfxItemIds.hxx"
+#include "SchWhichPairs.hxx"
+#include "macros.hxx"
+#include "Scaling.hxx"
+
+#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
+#include <com/sun/star/lang/XServiceName.hpp>
+#endif
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XAXIS_HPP_
+#include <drafts/com/sun/star/chart2/XAxis.hpp>
+#endif
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XBOUNDEDCOORDINATESYSTEM_HPP_
+#include <drafts/com/sun/star/chart2/XBoundedCoordinateSystem.hpp>
+#endif
+
+// #ifndef _COMPHELPER_PROCESSFACTORY_HXX_
+// #include <comphelper/processfactory.hxx>
+// #endif
+// for SfxBoolItem
+#ifndef _SFXENUMITEM_HXX
+#include <svtools/eitem.hxx>
+#endif
+// for SvxDoubleItem
+#ifndef _SVX_CHRTITEM_HXX
+#define ITEMID_DOUBLE 0
+#include <svx/chrtitem.hxx>
+#endif
+// for SfxInt32Item
+#ifndef _SFXINTITEM_HXX
+#include <svtools/intitem.hxx>
+#endif
+#ifndef INCLUDED_RTL_MATH_HXX
+#include <rtl/math.hxx>
+#endif
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::drafts::com::sun::star;
+
+namespace
+{
+::chart::wrapper::ItemPropertyMapType & lcl_GetAxisPropertyMap()
+{
+ static ::chart::wrapper::ItemPropertyMapType aAxisPropertyMap(
+ ::chart::wrapper::MakeItemPropertyMap
+ ( SCHATTR_AXIS_SHOWDESCR, C2U( "DisplayLabels" ))
+ ( SCHATTR_AXIS_TICKS, C2U( "MajorTickmarks" ))
+ ( SCHATTR_AXIS_HELPTICKS, C2U( "MinorTickmarks" ))
+ ( SCHATTR_TEXT_ORDER, C2U( "ArrangeOrder" ))
+ ( SCHATTR_TEXT_STACKED, C2U( "StackCharacters" ))
+ ( SCHATTR_TEXTBREAK, C2U( "TextBreak" ))
+ ( SCHATTR_TEXT_OVERLAP, C2U( "TextOverlap" ))
+ );
+
+ return aAxisPropertyMap;
+};
+} // anonymous namespace
+
+namespace chart
+{
+namespace wrapper
+{
+
+AxisItemConverter::AxisItemConverter(
+ const uno::Reference< beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ NumberFormatterWrapper * pNumFormatter,
+ chart2::ExplicitScaleData * pScale /* = NULL */,
+ chart2::ExplicitIncrementData * pIncrement /* = NULL */,
+ double * pExplicitOrigin /* = NULL */ ) :
+ ItemConverter( rPropertySet, rItemPool ),
+ m_pNumberFormatterWrapper( pNumFormatter ),
+ m_pExplicitScale( NULL ),
+ m_pExplicitIncrement( NULL ),
+ m_pExplicitOrigin( NULL )
+{
+ if( pScale )
+ m_pExplicitScale = new chart2::ExplicitScaleData( *pScale );
+ if( pIncrement )
+ m_pExplicitIncrement = new chart2::ExplicitIncrementData( *pIncrement );
+ if( pExplicitOrigin )
+ m_pExplicitOrigin = new double( *pExplicitOrigin );
+
+ m_aConverters.push_back( new GraphicPropertyItemConverter(
+ rPropertySet, rItemPool, rDrawModel,
+ GraphicPropertyItemConverter::LINE_PROPERTIES ));
+ m_aConverters.push_back( new CharacterPropertyItemConverter( rPropertySet, rItemPool ));
+
+ uno::Reference< chart2::XAxis > xAxis( rPropertySet, uno::UNO_QUERY );
+ OSL_ASSERT( xAxis.is());
+ if( xAxis.is())
+ {
+ m_xAxis = xAxis;
+
+ m_xCoordinateSystem.set( xAxis->getCoordinateSystem());
+ if( m_xCoordinateSystem.is())
+ {
+ m_nDimension = xAxis->getRepresentedDimension();
+ }
+ else
+ {
+ OSL_ENSURE( false, "No coordinate system found at axis!" );
+ }
+ }
+}
+
+AxisItemConverter::~AxisItemConverter()
+{
+ delete m_pExplicitScale;
+ delete m_pExplicitIncrement;
+ delete m_pExplicitOrigin;
+
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ DeleteItemConverterPtr() );
+}
+
+void AxisItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
+{
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ FillItemSetFunc( rOutItemSet ));
+
+ // own items
+ ItemConverter::FillItemSet( rOutItemSet );
+}
+
+bool AxisItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
+{
+ bool bResult = false;
+
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ApplyItemSetFunc( rItemSet, bResult ));
+
+ // own items
+ return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
+}
+
+const USHORT * AxisItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nAxisWhichPairs;
+}
+
+bool AxisItemConverter::GetItemPropertyName( USHORT nWhichId, ::rtl::OUString & rOutName ) const
+{
+ ItemPropertyMapType & rMap( lcl_GetAxisPropertyMap());
+ ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
+
+// OSL_TRACE( "Which-Id: %d", nWhichId );
+
+ if( aIt == rMap.end())
+ return false;
+
+ rOutName =(*aIt).second;
+// OSL_TRACE( "Which-Id: %d, Entry found in map: %s.", nWhichId,
+// ::rtl::OUStringToOString( rOutName, RTL_TEXTENCODING_ASCII_US ).getStr());
+
+ return true;
+}
+
+void AxisItemConverter::FillSpecialItem( USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+{
+ if( ! m_xAxis.is() ||
+ ! m_xCoordinateSystem.is() )
+ return;
+
+ uno::Reference< chart2::XScale > xScale( m_xCoordinateSystem->getScaleByDimension( m_nDimension ));
+ OSL_ASSERT( xScale.is());
+ uno::Reference< chart2::XIncrement > xIncrement( m_xAxis->getIncrement() );
+ OSL_ASSERT( xIncrement.is());
+ if( ! xScale.is() ||
+ ! xIncrement.is() )
+ return;
+
+ const chart2::ScaleData aScale( xScale->getScaleData() );
+ const chart2::IncrementData aInc( xIncrement->getIncrementData() );
+ const uno::Sequence< chart2::SubIncrement > aSubIncs( xIncrement->getSubIncrements() );
+
+ 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:
+ {
+ uno::Reference< lang::XServiceName > xServiceName( aScale.Scaling, uno::UNO_QUERY );
+ BOOL bValue =
+ // if the following is true, we have logarithmic scaling,
+ // otherwise not (per definition)
+ ( xServiceName.is() &&
+ (xServiceName->getServiceName()).equals(
+ C2U( "com.sun.star.chart2.LogarithmicScaling" )) );
+
+ rOutItemSet.Put( SfxBoolItem( nWhichId, bValue ));
+ }
+ break;
+
+ // 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:
+ {
+ uno::Sequence< uno::Any > aCoord( m_xCoordinateSystem->getOrigin() );
+ OSL_ASSERT( m_nDimension <= aCoord.getLength());
+ rOutItemSet.Put(
+ SfxBoolItem(
+ nWhichId,
+ ! ( aCoord.getLength() > m_nDimension &&
+ aCoord[ m_nDimension ].hasValue() ) ));
+ }
+ break;
+
+ case SCHATTR_AXIS_ORIGIN:
+ {
+ bool bIsAuto = true;
+ uno::Sequence< uno::Any > aCoord( m_xCoordinateSystem->getOrigin() );
+ if( aCoord.getLength() > m_nDimension &&
+ aCoord[ m_nDimension ].hasValue() )
+ {
+ OSL_ASSERT( aCoord[ m_nDimension ].getValueTypeClass() == uno::TypeClass_DOUBLE );
+ rOutItemSet.Put(
+ SvxDoubleItem(
+ *reinterpret_cast< const double * >(aCoord[ m_nDimension ].getValue()),
+ nWhichId ));
+ bIsAuto = false;
+ }
+
+ if( bIsAuto && m_pExplicitOrigin )
+ rOutItemSet.Put( SvxDoubleItem( *m_pExplicitOrigin, nWhichId ));
+ }
+ break;
+
+ case SCHATTR_TEXT_DEGREES:
+ {
+ // convert double to int (times 100)
+ double fVal;
+
+ 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:
+ {
+ if( m_pNumberFormatterWrapper )
+ {
+ chart2::NumberFormat aNumFmt;
+ if( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) >>= aNumFmt )
+ {
+ sal_Int32 nKey = m_pNumberFormatterWrapper->getKeyForNumberFormat( aNumFmt );
+
+ OSL_TRACE( "NumberFormat: ""%s"", Locale: %s_%s@%s, Key: %d",
+ U2C( aNumFmt.aFormat ),
+ U2C( aNumFmt.aLocale.Language ),
+ U2C( aNumFmt.aLocale.Country ),
+ U2C( aNumFmt.aLocale.Variant ),
+ nKey );
+ rOutItemSet.Put( SfxUInt32Item( nWhichId, nKey ));
+ }
+ }
+ else
+ {
+ OSL_ENSURE( false, "No NumberFormatterWrapper !" );
+ }
+ }
+ break;
+
+// case SID_ATTR_NUMBERFORMAT_SOURCE:
+ }
+}
+
+bool AxisItemConverter::ApplySpecialItem( USHORT nWhichId, const SfxItemSet & rItemSet ) const
+{
+ if( ! ( m_xAxis.is() &&
+ m_xCoordinateSystem.is()))
+ return false;
+
+ uno::Reference< chart2::XScale > xScale( m_xCoordinateSystem->getScaleByDimension( m_nDimension ));
+ OSL_ASSERT( xScale.is());
+ uno::Reference< chart2::XIncrement > xIncrement( m_xAxis->getIncrement() );
+ OSL_ASSERT( xIncrement.is());
+ if( ! xScale.is() ||
+ ! xIncrement.is() )
+ return false;
+
+ chart2::ScaleData aScale( xScale->getScaleData() );
+ chart2::IncrementData aInc( xIncrement->getIncrementData() );
+ uno::Sequence< chart2::SubIncrement > aSubIncs( xIncrement->getSubIncrements() );
+ uno::Sequence< uno::Any > aOrigin( m_xCoordinateSystem->getOrigin());
+
+ bool bSetScale = false;
+ bool bSetIncrement = false;
+ bool bSetSubIncrement = false;
+ bool bSetOrigin = false;
+ bool bChangedOtherwise = false;
+
+ uno::Any aValue;
+
+ switch( nWhichId )
+ {
+ case SCHATTR_AXIS_AUTO_MAX:
+ if( (reinterpret_cast< const SfxBoolItem & >(
+ 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
+ if( ! (reinterpret_cast< const SfxBoolItem & >(
+ 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:
+ if( (reinterpret_cast< const SfxBoolItem & >(
+ 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
+ if( ! (reinterpret_cast< const SfxBoolItem & >(
+ 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:
+ {
+ uno::Reference< lang::XServiceName > xServiceName( aScale.Scaling, uno::UNO_QUERY );
+ bool bWasLogarithm =
+ // if the following is true, we have logarithmic scaling,
+ // otherwise not (per definition)
+ ( xServiceName.is() &&
+ (xServiceName->getServiceName()).equals(
+ C2U( "com.sun.star.chart2.LogarithmicScaling" )));
+
+ if( (reinterpret_cast< const SfxBoolItem & >(
+ 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;
+
+ // Increment
+ case SCHATTR_AXIS_AUTO_STEP_MAIN:
+ if( (reinterpret_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue() ))
+ {
+ aInc.Distance.clear();
+ bSetIncrement = true;
+ }
+ // else SCHATTR_AXIS_STEP_MAIN must have some value
+ break;
+
+ case SCHATTR_AXIS_STEP_MAIN:
+ // only if auto if false
+ if( ! (reinterpret_cast< const SfxBoolItem & >(
+ rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_MAIN )).GetValue() ))
+ {
+ rItemSet.Get( nWhichId ).QueryValue( aValue );
+
+ if( aInc.Distance != aValue )
+ {
+ aInc.Distance = aValue;
+ bSetIncrement = true;
+ }
+ }
+ break;
+
+ // SubIncrement
+ case SCHATTR_AXIS_AUTO_STEP_HELP:
+ if( (reinterpret_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue() ) &&
+ aSubIncs.getLength() > 0 &&
+ aSubIncs[0].IntervalCount.hasValue() )
+ {
+ aSubIncs[0].IntervalCount.clear();
+ bSetSubIncrement = true;
+ }
+ // else SCHATTR_AXIS_STEP_MAIN must have some value
+ break;
+
+ case SCHATTR_AXIS_STEP_HELP:
+ // only if auto if false
+ if( ! (reinterpret_cast< const SfxBoolItem & >(
+ rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_HELP )).GetValue() ) &&
+ aSubIncs.getLength() > 0 )
+ {
+ rItemSet.Get( nWhichId ).QueryValue( aValue );
+
+ if( ! aSubIncs[0].IntervalCount.hasValue() ||
+ aSubIncs[0].IntervalCount != aValue )
+ {
+ OSL_ASSERT( aValue.getValueTypeClass() == uno::TypeClass_LONG );
+ aSubIncs[0].IntervalCount = aValue;
+ bSetSubIncrement = true;
+ }
+ }
+ break;
+
+ case SCHATTR_AXIS_AUTO_ORIGIN:
+ {
+ if( (reinterpret_cast< const SfxBoolItem & >(
+ rItemSet.Get( nWhichId )).GetValue() ) &&
+ ( aOrigin.getLength() > m_nDimension &&
+ aOrigin[ m_nDimension ].hasValue() ))
+ {
+ aOrigin[ m_nDimension ].clear();
+ bSetOrigin = true;
+ }
+ }
+ break;
+
+ case SCHATTR_AXIS_ORIGIN:
+ {
+ if( ! (reinterpret_cast< const SfxBoolItem & >(
+ rItemSet.Get( SCHATTR_AXIS_AUTO_ORIGIN )).GetValue() ))
+ {
+ if( aOrigin.getLength() > m_nDimension )
+ {
+ rItemSet.Get( nWhichId ).QueryValue( aValue );
+ if( aValue != aOrigin[ m_nDimension ] )
+ {
+ aOrigin[ m_nDimension ] = aValue;
+ bSetOrigin = true;
+ }
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_TEXT_DEGREES:
+ {
+ // convert int to double (divided by 100)
+ double fVal = static_cast< double >(
+ reinterpret_cast< const SfxInt32Item & >(
+ 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:
+ {
+ if( m_pNumberFormatterWrapper )
+ {
+ sal_Int32 nFmt = static_cast< sal_Int32 >(
+ reinterpret_cast< const SfxUInt32Item & >(
+ rItemSet.Get( nWhichId )).GetValue());
+
+ aValue = uno::makeAny(
+ m_pNumberFormatterWrapper->getNumberFormatForKey( nFmt ));
+ if( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) != aValue )
+ {
+ GetPropertySet()->setPropertyValue( C2U( "NumberFormat" ), aValue );
+ bChangedOtherwise = true;
+ }
+ }
+ else
+ {
+ OSL_ENSURE( false, "No NumberFormatterWrapper !" );
+ }
+ }
+ break;
+
+// case SID_ATTR_NUMBERFORMAT_SOURCE:
+ }
+
+ if( bSetScale &&
+ xScale.is() )
+ xScale->setScaleData( aScale );
+ if( bSetIncrement &&
+ xIncrement.is() )
+ xIncrement->setIncrementData( aInc );
+ if( bSetSubIncrement &&
+ xIncrement.is() )
+ xIncrement->setSubIncrements( aSubIncs );
+ if( bSetOrigin )
+ m_xCoordinateSystem->setOrigin( aOrigin );
+
+ return (bSetScale || bSetIncrement || bSetSubIncrement ||
+ bSetOrigin || bChangedOtherwise);
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx
new file mode 100644
index 000000000000..2c4d4ac6bf3c
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/CharacterPropertyItemConverter.cxx
@@ -0,0 +1,398 @@
+/*************************************************************************
+ *
+ * $RCSfile: CharacterPropertyItemConverter.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:28 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "CharacterPropertyItemConverter.hxx"
+#include "SchWhichPairs.hxx"
+#include "macros.hxx"
+#include "ItemPropertyMap.hxx"
+
+#ifndef _EEITEM_HXX
+#include <svx/eeitem.hxx>
+#endif
+#ifndef _SVX_UDLNITEM_HXX
+#define ITEMID_UNDERLINE EE_CHAR_UNDERLINE
+#include <svx/udlnitem.hxx>
+#endif
+#ifndef _SVX_FONTITEM_HXX
+#define ITEMID_FONT EE_CHAR_FONTINFO
+#include <svx/fontitem.hxx>
+#endif
+#ifndef _SVX_CRSDITEM_HXX
+#define ITEMID_CROSSEDOUT EE_CHAR_STRIKEOUT
+#include <svx/crsditem.hxx>
+#endif
+#ifndef _SVX_POSTITEM_HXX
+#define ITEMID_POSTURE EE_CHAR_ITALIC
+#include <svx/postitem.hxx>
+#endif
+#ifndef _SVX_WGHTITEM_HXX
+#define ITEMID_WEIGHT EE_CHAR_WEIGHT
+#include <svx/wghtitem.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_
+#include <com/sun/star/beans/XPropertyState.hpp>
+#endif
+
+using namespace ::com::sun::star;
+
+namespace
+{
+::chart::wrapper::ItemPropertyMapType & lcl_GetCharacterPropertyPropertyMap()
+{
+ static ::chart::wrapper::ItemPropertyMapType aCharacterPropertyMap(
+ ::chart::wrapper::MakeItemPropertyMap
+ ( EE_CHAR_COLOR, C2U( "CharColor" ))
+ ( EE_CHAR_FONTHEIGHT, C2U( "CharHeight" ))
+// ( EE_CHAR_ITALIC, C2U( "CharPosture" ))
+// ( EE_CHAR_WEIGHT, C2U( "CharWeight" ))
+// ( EE_CHAR_STRIKEOUT, C2U( "CharStrikeout" ))
+ ( EE_CHAR_WLM, C2U( "CharWordMode" ))
+ ( EE_CHAR_SHADOW, C2U( "CharShadowed" ))
+ ( EE_CHAR_RELIEF, C2U( "CharRelief" ))
+ ( EE_CHAR_OUTLINE, C2U( "CharContoured" ))
+ ( EE_CHAR_EMPHASISMARK, C2U( "CharEmphasis" ))
+ );
+
+ return aCharacterPropertyMap;
+}
+} // anonymous namespace
+
+// ========================================
+
+namespace chart
+{
+namespace wrapper
+{
+
+CharacterPropertyItemConverter::CharacterPropertyItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool ) :
+ ItemConverter( rPropertySet, rItemPool )
+{}
+
+CharacterPropertyItemConverter::~CharacterPropertyItemConverter()
+{}
+
+const USHORT * CharacterPropertyItemConverter::GetWhichPairs() const
+{
+ return nCharacterPropertyWhichPairs;
+}
+
+bool CharacterPropertyItemConverter::GetItemPropertyName( USHORT nWhichId, ::rtl::OUString & rOutName ) const
+{
+ ItemPropertyMapType & rMap( lcl_GetCharacterPropertyPropertyMap());
+ ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
+
+ if( aIt == rMap.end())
+ return false;
+
+ rOutName =(*aIt).second;
+ return true;
+}
+
+void CharacterPropertyItemConverter::FillSpecialItem(
+ USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+{
+ switch( nWhichId )
+ {
+ case EE_CHAR_FONTINFO:
+ {
+ SvxFontItem aItem;
+
+ aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontName" )),
+ MID_FONT_FAMILY_NAME );
+ aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontFamily" )),
+ MID_FONT_FAMILY );
+ aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontStyleName" )),
+ MID_FONT_STYLE_NAME );
+ aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontCharSet" )),
+ MID_FONT_CHAR_SET );
+ aItem.PutValue( GetPropertySet()->getPropertyValue( C2U( "CharFontPitch" )),
+ MID_FONT_PITCH );
+
+ rOutItemSet.Put( aItem );
+ }
+ break;
+
+ case EE_CHAR_UNDERLINE:
+ {
+ SvxUnderlineItem aItem;
+ bool bModified = false;
+
+ uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharUnderline" )));
+ if( aValue.hasValue())
+ {
+ aItem.PutValue( aValue, MID_UNDERLINE );
+ bModified = true;
+ }
+
+ aValue = GetPropertySet()->getPropertyValue( C2U( "CharUnderlineHasColor" ));
+ if( aValue.hasValue() &&
+ ( *reinterpret_cast< const sal_Bool * >( aValue.getValue()) != sal_False ))
+ {
+ aItem.PutValue( aValue, MID_UL_HASCOLOR );
+ bModified = true;
+ }
+
+ aValue = GetPropertySet()->getPropertyValue( C2U( "CharUnderlineColor" ));
+ if( aValue.hasValue())
+ {
+ aItem.PutValue( aValue, MID_UL_COLOR );
+ bModified = true;
+ }
+
+ if( bModified )
+ rOutItemSet.Put( aItem );
+ }
+ break;
+
+ case EE_CHAR_STRIKEOUT:
+ {
+ SvxCrossedOutItem aItem;
+
+ uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharStrikeout" )));
+ if( aValue.hasValue())
+ {
+ // default member-id is MID_CROSSED_OUT (bool flag)
+ aItem.PutValue( aValue, MID_CROSS_OUT );
+ rOutItemSet.Put( aItem );
+ }
+ }
+ break;
+
+ case EE_CHAR_ITALIC:
+ {
+ SvxPostureItem aItem;
+
+ uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharPosture" )));
+ if( aValue.hasValue())
+ {
+ aItem.PutValue( aValue, MID_POSTURE );
+ rOutItemSet.Put( aItem );
+ }
+ }
+ break;
+
+ case EE_CHAR_WEIGHT:
+ {
+ SvxWeightItem aItem;
+
+ uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "CharWeight" )));
+ if( aValue.hasValue())
+ {
+ aItem.PutValue( aValue, MID_WEIGHT );
+ rOutItemSet.Put( aItem );
+ }
+ }
+ break;
+ }
+}
+
+bool CharacterPropertyItemConverter::ApplySpecialItem(
+ USHORT nWhichId, const SfxItemSet & rItemSet ) const
+{
+ bool bChanged = false;
+ uno::Any aValue;
+
+ switch( nWhichId )
+ {
+ case EE_CHAR_FONTINFO:
+ {
+ const SvxFontItem & rItem =
+ reinterpret_cast< const SvxFontItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue, MID_FONT_FAMILY_NAME ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontName" ) ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharFontName" ), aValue );
+ bChanged = true;
+ }
+ }
+ if( rItem.QueryValue( aValue, MID_FONT_FAMILY ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontFamily" ) ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharFontFamily" ), aValue );
+ bChanged = true;
+ }
+ }
+ if( rItem.QueryValue( aValue, MID_FONT_STYLE_NAME ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontStyleName" ) ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharFontStyleName" ), aValue );
+ bChanged = true;
+ }
+ }
+ if( rItem.QueryValue( aValue, MID_FONT_CHAR_SET ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontCharSet" ) ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharFontCharSet" ), aValue );
+ bChanged = true;
+ }
+ }
+ if( rItem.QueryValue( aValue, MID_FONT_PITCH ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharFontPitch" ) ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharFontPitch" ), aValue );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case EE_CHAR_UNDERLINE:
+ {
+ const SvxUnderlineItem & rItem =
+ reinterpret_cast< const SvxUnderlineItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue, MID_UNDERLINE ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharUnderline" ) ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharUnderline" ), aValue );
+ bChanged = true;
+ }
+ }
+
+ if( rItem.QueryValue( aValue, MID_UL_COLOR ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharUnderlineColor" ) ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharUnderlineColor" ), aValue );
+ bChanged = true;
+ }
+ }
+
+ if( rItem.QueryValue( aValue, MID_UL_HASCOLOR ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharUnderlineHasColor" ) ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharUnderlineHasColor" ), aValue );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case EE_CHAR_STRIKEOUT:
+ {
+ const SvxCrossedOutItem & rItem =
+ reinterpret_cast< const SvxCrossedOutItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue, MID_CROSS_OUT ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharStrikeout" ) ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharStrikeout" ), aValue );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case EE_CHAR_ITALIC:
+ {
+ const SvxPostureItem & rItem =
+ reinterpret_cast< const SvxPostureItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue, MID_POSTURE ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharPosture" ) ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharPosture" ), aValue );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case EE_CHAR_WEIGHT:
+ {
+ const SvxWeightItem & rItem =
+ reinterpret_cast< const SvxWeightItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue, MID_WEIGHT ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "CharWeight" ) ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "CharWeight" ), aValue );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+ }
+
+ return bChanged;
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
new file mode 100644
index 000000000000..80ff5e49f6d3
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -0,0 +1,337 @@
+/*************************************************************************
+ *
+ * $RCSfile: DataPointItemConverter.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:28 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "DataPointItemConverter.hxx"
+#include "SchWhichPairs.hxx"
+#include "macros.hxx"
+#include "ItemPropertyMap.hxx"
+
+#include "GraphicPropertyItemConverter.hxx"
+#include "CharacterPropertyItemConverter.hxx"
+
+#ifndef _SVX_CHRTITEM_HXX
+#define ITEMID_CHARTDATADESCR SCHATTR_DATADESCR_DESCR
+#include <svx/chrtitem.hxx>
+#endif
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_DATACAPTIONSTYLE_HPP__
+#include <drafts/com/sun/star/chart2/DataCaptionStyle.hpp>
+#endif
+#ifndef _SFXINTITEM_HXX
+#include <svtools/intitem.hxx>
+#endif
+
+#include <functional>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::drafts::com::sun::star;
+
+namespace
+{
+::chart::wrapper::ItemPropertyMapType & lcl_GetDataPointPropertyMap()
+{
+ static ::chart::wrapper::ItemPropertyMapType aDataPointPropertyMap(
+ ::chart::wrapper::MakeItemPropertyMap
+ ( CHATTR_PIE_SEGMENT_OFFSET, C2U( "Offset" ))
+ );
+
+ return aDataPointPropertyMap;
+};
+} // anonymous namespace
+
+namespace chart
+{
+namespace wrapper
+{
+
+DataPointItemConverter::DataPointItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ NumberFormatterWrapper * pNumFormatter,
+ GraphicPropertyItemConverter::eGraphicObjectType eMapTo /* = FILL_PROPERTIES */
+ ) :
+ ItemConverter( rPropertySet, rItemPool ),
+ m_pNumberFormatterWrapper( pNumFormatter )
+{
+ m_aConverters.push_back( new GraphicPropertyItemConverter( rPropertySet, rItemPool, rDrawModel, eMapTo ));
+ m_aConverters.push_back( new CharacterPropertyItemConverter( rPropertySet, rItemPool ));
+}
+
+DataPointItemConverter::~DataPointItemConverter()
+{
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ DeleteItemConverterPtr() );
+}
+
+void DataPointItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
+{
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ FillItemSetFunc( rOutItemSet ));
+
+ // own items
+ ItemConverter::FillItemSet( rOutItemSet );
+}
+
+bool DataPointItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
+{
+ bool bResult = false;
+
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ApplyItemSetFunc( rItemSet, bResult ));
+
+ // own items
+ return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
+}
+
+const USHORT * DataPointItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nRowWhichPairs;
+}
+
+bool DataPointItemConverter::GetItemPropertyName( USHORT nWhichId, ::rtl::OUString & rOutName ) const
+{
+ ItemPropertyMapType & rMap( lcl_GetDataPointPropertyMap());
+ ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
+
+ if( aIt == rMap.end())
+ return false;
+
+ rOutName =(*aIt).second;
+ return true;
+}
+
+
+bool DataPointItemConverter::ApplySpecialItem(
+ USHORT nWhichId, const SfxItemSet & rItemSet ) const
+{
+ bool bChanged = false;
+ uno::Any aValue;
+
+ switch( nWhichId )
+ {
+ case SCHATTR_DATADESCR_DESCR:
+ {
+ const SvxChartDataDescrItem & rItem =
+ reinterpret_cast< const SvxChartDataDescrItem & >(
+ rItemSet.Get( nWhichId ));
+
+ chart2::DataCaptionStyle aStyle;
+ if( GetPropertySet()->getPropertyValue( C2U( "DataCaption" )) >>= aStyle )
+ {
+ switch( rItem.GetValue())
+ {
+ case CHDESCR_NONE:
+ aStyle.ShowNumber = sal_False;
+ aStyle.ShowCategoryName = sal_False;
+ break;
+ case CHDESCR_VALUE:
+ aStyle.ShowNumber = sal_True;
+ aStyle.ShowNumberInPercent = sal_False;
+ aStyle.ShowCategoryName = sal_False;
+ break;
+ case CHDESCR_PERCENT:
+ aStyle.ShowNumber = sal_True;
+ aStyle.ShowNumberInPercent = sal_True;
+ aStyle.ShowCategoryName = sal_False;
+ break;
+ case CHDESCR_TEXT:
+ aStyle.ShowNumber = sal_False;
+ aStyle.ShowCategoryName = sal_True;
+ break;
+ case CHDESCR_TEXTANDPERCENT:
+ aStyle.ShowNumber = sal_True;
+ aStyle.ShowNumberInPercent = sal_True;
+ aStyle.ShowCategoryName = sal_True;
+ break;
+ case CHDESCR_TEXTANDVALUE:
+ aStyle.ShowNumber = sal_True;
+ aStyle.ShowNumberInPercent = sal_False;
+ aStyle.ShowCategoryName = sal_True;
+ break;
+ default:
+ break;
+ }
+
+ aValue <<= aStyle;
+ if( aValue != GetPropertySet()->getPropertyValue( C2U( "DataCaption" ) ))
+ {
+ GetPropertySet()->setPropertyValue( C2U( "DataCaption" ), aValue );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case SCHATTR_DATADESCR_SHOW_SYM:
+ {
+ const SvxChartDataDescrItem & rItem =
+ reinterpret_cast< const SvxChartDataDescrItem & >(
+ rItemSet.Get( nWhichId ));
+
+ chart2::DataCaptionStyle aStyle;
+ if( GetPropertySet()->getPropertyValue( C2U( "DataCaption" )) >>= aStyle )
+ {
+ sal_Bool bOldValue = aStyle.ShowLegendSymbol;
+ aStyle.ShowLegendSymbol = static_cast< sal_Bool >( rItem.GetValue() );
+ if( bOldValue != aStyle.ShowLegendSymbol )
+ {
+ GetPropertySet()->setPropertyValue( C2U( "DataCaption" ), uno::makeAny( aStyle ));
+ 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());
+
+ aValue = uno::makeAny(
+ m_pNumberFormatterWrapper->getNumberFormatForKey( nFmt ));
+ if( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) != aValue )
+ {
+ GetPropertySet()->setPropertyValue( C2U( "NumberFormat" ), aValue );
+ bChanged = true;
+ }
+ }
+ else
+ {
+ OSL_ENSURE( false, "No NumberFormatterWrapper !" );
+ }
+ }
+ break;
+ }
+
+ return bChanged;
+}
+
+void DataPointItemConverter::FillSpecialItem(
+ USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+{
+ switch( nWhichId )
+ {
+ case SCHATTR_DATADESCR_DESCR:
+ case SCHATTR_DATADESCR_SHOW_SYM:
+ {
+ chart2::DataCaptionStyle aStyle;
+ if( GetPropertySet()->getPropertyValue( C2U( "DataCaption" )) >>= aStyle )
+ {
+ SvxChartDataDescr aDescr;
+
+ if( aStyle.ShowNumber )
+ {
+ if( aStyle.ShowNumberInPercent )
+ {
+ if( aStyle.ShowCategoryName )
+ aDescr = CHDESCR_TEXTANDPERCENT;
+ else
+ aDescr = CHDESCR_PERCENT;
+ }
+ else
+ {
+ if( aStyle.ShowCategoryName )
+ aDescr = CHDESCR_TEXTANDVALUE;
+ else
+ aDescr = CHDESCR_VALUE;
+ }
+ }
+ else
+ {
+ if( aStyle.ShowCategoryName )
+ aDescr = CHDESCR_TEXT;
+ else
+ aDescr = CHDESCR_NONE;
+ }
+
+ rOutItemSet.Put( SvxChartDataDescrItem( aDescr ));
+ rOutItemSet.Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYM, aStyle.ShowLegendSymbol ));
+ }
+ }
+ break;
+
+ case SID_ATTR_NUMBERFORMAT_VALUE:
+ {
+ if( m_pNumberFormatterWrapper )
+ {
+ chart2::NumberFormat aNumFmt;
+ if( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) >>= aNumFmt );
+ {
+ sal_Int32 nKey = m_pNumberFormatterWrapper->getKeyForNumberFormat( aNumFmt );
+ rOutItemSet.Put( SfxUInt32Item( nWhichId, nKey ));
+ }
+ }
+ else
+ {
+ OSL_ENSURE( false, "No NumberFormatterWrapper !" );
+ }
+ }
+ break;
+ }
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
new file mode 100644
index 000000000000..af423d7f001b
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/GraphicPropertyItemConverter.cxx
@@ -0,0 +1,710 @@
+/*************************************************************************
+ *
+ * $RCSfile: GraphicPropertyItemConverter.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:28 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "GraphicPropertyItemConverter.hxx"
+#include "SchWhichPairs.hxx"
+#include "macros.hxx"
+#include "ItemPropertyMap.hxx"
+
+// #ifndef _SFXINTITEM_HXX
+// #include <svtools/intitem.hxx>
+// #endif
+#ifndef _SVX_XFLCLIT_HXX
+#include <svx/xflclit.hxx>
+#endif
+#ifndef _SVX_XLNCLIT_HXX
+#include <svx/xlnclit.hxx>
+#endif
+#ifndef _SVX_XFLBMTIT_HXX
+#include <svx/xflbmtit.hxx>
+#endif
+#ifndef _SVX_XFLBSTIT_HXX
+#include <svx/xflbstit.hxx>
+#endif
+#ifndef _SVX_XBTMPIT_HXX
+#include <svx/xbtmpit.hxx>
+#endif
+#ifndef _SVX_XFLFTRIT_HXX
+#include <svx/xflftrit.hxx>
+#endif
+#ifndef _SVX_XLNDSIT_HXX
+#include <svx/xlndsit.hxx>
+#endif
+#ifndef _SVX_XFLHTIT_HXX
+#include <svx/xflhtit.hxx>
+#endif
+#ifndef _SVX_XFLGRIT_HXX
+#include <svx/xflgrit.hxx>
+#endif
+#ifndef _EEITEM_HXX
+#include <svx/eeitem.hxx>
+#endif
+#ifndef _SVX_UDLNITEM_HXX
+#define ITEMID_UNDERLINE EE_CHAR_UNDERLINE
+#include <svx/udlnitem.hxx>
+#endif
+#ifndef _SVX_FONTITEM_HXX
+#define ITEMID_FONT EE_CHAR_FONTINFO
+#include <svx/fontitem.hxx>
+#endif
+// for SfxBoolItem
+#ifndef _SFXENUMITEM_HXX
+#include <svtools/eitem.hxx>
+#endif
+// for XFillGradientStepCountItem
+#ifndef _SVX_XGRSCIT_HXX
+#include <svx/xgrscit.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_
+#include <com/sun/star/beans/XPropertyState.hpp>
+#endif
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_FILLBITMAP_HPP_
+#include <drafts/com/sun/star/chart2/FillBitmap.hpp>
+#endif
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_TRANSPARENCYSTYLE_HPP_
+#include <drafts/com/sun/star/chart2/TransparencyStyle.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_GRADIENT_HPP_
+#include <com/sun/star/awt/Gradient.hpp>
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::drafts::com::sun::star;
+
+namespace
+{
+::chart::wrapper::ItemPropertyMapType & lcl_GetDataPointFilledPropertyMap()
+{
+ static ::chart::wrapper::ItemPropertyMapType aDataPointPropertyFilledMap(
+ ::chart::wrapper::MakeItemPropertyMap
+ ( XATTR_FILLSTYLE, C2U( "FillStyle" ))
+ ( XATTR_FILLCOLOR, C2U( "Color" ))
+ ( XATTR_FILLTRANSPARENCE, C2U( "Transparency" ))
+// ( XATTR_FILLGRADIENT, C2U( "Gradient" ))
+// ( XATTR_FILLHATCH, C2U( "Hatch" ))
+ ( XATTR_LINECOLOR, C2U( "BorderColor" ))
+ ( XATTR_LINESTYLE, C2U( "BorderStyle" ))
+ ( XATTR_LINEWIDTH, C2U( "BorderWidth" ))
+// ( XATTR_LINEDASH, C2U( "BorderDash" ))
+ ( XATTR_LINETRANSPARENCE, C2U( "BorderTransparency" ))
+ );
+
+ return aDataPointPropertyFilledMap;
+}
+::chart::wrapper::ItemPropertyMapType & lcl_GetDataPointLinePropertyMap()
+{
+ static ::chart::wrapper::ItemPropertyMapType aDataPointPropertyLineMap(
+ ::chart::wrapper::MakeItemPropertyMap
+ ( XATTR_LINECOLOR, C2U( "Color" ))
+ ( XATTR_LINETRANSPARENCE, C2U( "Transparency" ))
+ ( XATTR_LINESTYLE, C2U( "LineStyle" ))
+ ( XATTR_LINEWIDTH, C2U( "LineWidth" ))
+// ( XATTR_LINEDASH, C2U( "LineDash" ))
+ );
+
+ return aDataPointPropertyLineMap;
+}
+::chart::wrapper::ItemPropertyMapType & lcl_GetLinePropertyMap()
+{
+ static ::chart::wrapper::ItemPropertyMapType aLinePropertyMap(
+ ::chart::wrapper::MakeItemPropertyMap
+ ( XATTR_LINESTYLE, C2U( "LineStyle" ))
+ ( XATTR_LINEWIDTH, C2U( "LineWidth" ))
+// ( XATTR_LINEDASH, C2U( "LineDash" ))
+ ( XATTR_LINECOLOR, C2U( "LineColor" ))
+ ( XATTR_LINETRANSPARENCE, C2U( "LineTransparence" ))
+ ( XATTR_LINEJOINT, C2U( "LineJoint" ))
+ );
+
+ return aLinePropertyMap;
+}
+::chart::wrapper::ItemPropertyMapType & lcl_GetFillPropertyMap()
+{
+ static ::chart::wrapper::ItemPropertyMapType aFillPropertyMap(
+ ::chart::wrapper::MakeItemPropertyMap
+ ( XATTR_FILLSTYLE, C2U( "FillStyle" ))
+ ( XATTR_FILLCOLOR, C2U( "FillColor" ))
+ ( XATTR_FILLTRANSPARENCE, C2U( "FillTransparence" ))
+// ( XATTR_FILLGRADIENT, C2U( "FillGradient" ))
+// ( XATTR_FILLHATCH, C2U( "FillHatch" ))
+ );
+
+ return aFillPropertyMap;
+}
+} // anonymous namespace
+
+// ========================================
+
+namespace chart
+{
+namespace wrapper
+{
+
+GraphicPropertyItemConverter::GraphicPropertyItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel,
+ eGraphicObjectType eObjectType /* = FILL_PROPERTIES */ ) :
+ ItemConverter( rPropertySet, rItemPool ),
+ m_eGraphicObjectType( eObjectType ),
+ m_rDrawModel( rDrawModel )
+{}
+
+GraphicPropertyItemConverter::~GraphicPropertyItemConverter()
+{}
+
+const USHORT * GraphicPropertyItemConverter::GetWhichPairs() const
+{
+ const USHORT * pResult = NULL;
+
+ switch( m_eGraphicObjectType )
+ {
+ case LINE_DATA_POINT:
+ case FILLED_DATA_POINT:
+ pResult = nRowWhichPairs; break;
+ case LINE_PROPERTIES:
+ pResult = nLinePropertyWhichPairs; break;
+ case FILL_PROPERTIES:
+ pResult = nFillPropertyWhichPairs; break;
+ case LINE_AND_FILL_PROPERTIES:
+ pResult = nLineAndFillPropertyWhichPairs; break;
+ }
+
+ return pResult;
+}
+
+bool GraphicPropertyItemConverter::GetItemPropertyName( USHORT nWhichId, ::rtl::OUString & rOutName ) const
+{
+ ::chart::wrapper::ItemPropertyMapType::const_iterator aEndIt;
+ ::chart::wrapper::ItemPropertyMapType::const_iterator aIt;
+
+ switch( m_eGraphicObjectType )
+ {
+ case LINE_DATA_POINT:
+ aEndIt = lcl_GetDataPointLinePropertyMap().end();
+ aIt = lcl_GetDataPointLinePropertyMap().find( nWhichId );
+ break;
+ case FILLED_DATA_POINT:
+ aEndIt = lcl_GetDataPointFilledPropertyMap().end();
+ aIt = lcl_GetDataPointFilledPropertyMap().find( nWhichId );
+ break;
+ case LINE_PROPERTIES:
+ aEndIt = lcl_GetLinePropertyMap().end();
+ aIt = lcl_GetLinePropertyMap().find( nWhichId );
+ break;
+
+ case FILL_PROPERTIES:
+ aEndIt = lcl_GetFillPropertyMap().end();
+ aIt = lcl_GetFillPropertyMap().find( nWhichId );
+ break;
+
+ case LINE_AND_FILL_PROPERTIES:
+ // line
+ aEndIt = lcl_GetLinePropertyMap().end();
+ aIt = lcl_GetLinePropertyMap().find( nWhichId );
+
+ // not found => try fill
+ if( aIt == aEndIt )
+ {
+ aEndIt = lcl_GetFillPropertyMap().end();
+ aIt = lcl_GetFillPropertyMap().find( nWhichId );
+ }
+ break;
+ }
+
+ if( aIt == aEndIt )
+ return false;
+
+ rOutName =(*aIt).second;
+ return true;
+}
+
+void GraphicPropertyItemConverter::FillSpecialItem(
+ USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+{
+// if( m_eGraphicObjectType == LINE_DATA_POINT ||
+// m_eGraphicObjectType == LINE_PROPERTIES )
+// return;
+
+ switch( nWhichId )
+ {
+ // bitmap property
+ case XATTR_FILLBITMAP:
+ case XATTR_FILLBMP_TILE:
+ case XATTR_FILLBMP_POS:
+ case XATTR_FILLBMP_SIZEX:
+ case XATTR_FILLBMP_SIZEY:
+ case XATTR_FILLBMP_SIZELOG:
+ case XATTR_FILLBMP_TILEOFFSETX:
+ case XATTR_FILLBMP_TILEOFFSETY:
+ case XATTR_FILLBMP_STRETCH:
+ case XATTR_FILLBMP_POSOFFSETX:
+ case XATTR_FILLBMP_POSOFFSETY:
+ // avoid assertions while bitmap stuff is not working
+// try
+// {
+// FillBitmapItem( nWhichId, rOutItemSet );
+// }
+// catch( beans::UnknownPropertyException ex )
+// {
+// ASSERT_EXCEPTION( ex );
+// }
+ break;
+
+ case XATTR_FILLFLOATTRANSPARENCE:
+ {
+ try
+ {
+ chart2::TransparencyStyle aTranspStyle;
+ ( GetPropertySet()->getPropertyValue( C2U( "TransparencyStyle" )))
+ >>= aTranspStyle;
+
+ uno::Any aValue( GetPropertySet()->getPropertyValue( C2U( "TransparencyGradient" )));
+ if( aValue.hasValue())
+ {
+ XFillFloatTransparenceItem aItem;
+ aItem.PutValue( aValue );
+
+ // this is important to enable the item
+ aItem.SetEnabled( ( aTranspStyle == chart2::TransparencyStyle_GRADIENT ));
+ rOutItemSet.Put( aItem );
+ }
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ break;
+
+ case XATTR_GRADIENTSTEPCOUNT:
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "Gradient" )
+ : C2U( "FillGradient" );
+ try
+ {
+ awt::Gradient aGradient;
+ if( GetPropertySet()->getPropertyValue( aPropName ) >>= aGradient )
+ {
+ rOutItemSet.Put( XGradientStepCountItem( aGradient.StepCount ));
+ }
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ break;
+
+ case XATTR_LINEDASH:
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "BorderDash" )
+ : C2U( "LineDash" );
+
+ XLineDashItem aItem;
+ aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ) );
+
+ // find the name for the dialog table
+ XLineDashItem * pItemToPut = & aItem;
+ pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
+
+ rOutItemSet.Put( * pItemToPut );
+ }
+ break;
+
+ case XATTR_FILLGRADIENT:
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "Gradient" )
+ : C2U( "FillGradient" );
+
+ XFillGradientItem aItem;
+ aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ) );
+
+ // find the name for the dialog table
+ XFillGradientItem * pItemToPut = & aItem;
+ pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
+
+ rOutItemSet.Put( * pItemToPut );
+ }
+ break;
+
+ case XATTR_FILLHATCH:
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "Hatch" )
+ : C2U( "FillHatch" );
+
+ XFillHatchItem aItem;
+ aItem.PutValue( GetPropertySet()->getPropertyValue( aPropName ) );
+
+ // find the name for the dialog table
+ XFillHatchItem * pItemToPut = & aItem;
+ pItemToPut = aItem.checkForUniqueItem( & m_rDrawModel );
+
+ rOutItemSet.Put( * pItemToPut );
+ }
+ break;
+
+ }
+}
+
+bool GraphicPropertyItemConverter::ApplySpecialItem(
+ USHORT nWhichId, const SfxItemSet & rItemSet ) const
+{
+// if( m_eGraphicObjectType == LINE_DATA_POINT ||
+// m_eGraphicObjectType == LINE_PROPERTIES )
+// return false;
+
+ bool bChanged = false;
+ uno::Any aValue;
+
+ switch( nWhichId )
+ {
+ // bitmap property
+ case XATTR_FILLBITMAP:
+ case XATTR_FILLBMP_TILE:
+ case XATTR_FILLBMP_POS:
+ case XATTR_FILLBMP_SIZEX:
+ case XATTR_FILLBMP_SIZEY:
+ case XATTR_FILLBMP_SIZELOG:
+ case XATTR_FILLBMP_TILEOFFSETX:
+ case XATTR_FILLBMP_TILEOFFSETY:
+ case XATTR_FILLBMP_STRETCH:
+ case XATTR_FILLBMP_POSOFFSETX:
+ case XATTR_FILLBMP_POSOFFSETY:
+ // avoid assertions while bitmap stuff is not working
+// try
+// {
+// ApplyBitmapItem( nWhichId, rItemSet );
+// bChanged = true;
+// }
+// catch( beans::UnknownPropertyException ex )
+// {
+// ASSERT_EXCEPTION( ex );
+// }
+ break;
+
+ case XATTR_FILLFLOATTRANSPARENCE:
+ try
+ {
+ const XFillFloatTransparenceItem & rItem =
+ reinterpret_cast< const XFillFloatTransparenceItem & >(
+ rItemSet.Get( nWhichId ));
+ if( rItem.IsEnabled() )
+ {
+ rItem.QueryValue( aValue );
+ GetPropertySet()->setPropertyValue( C2U( "TransparencyGradient" ), aValue );
+ GetPropertySet()->setPropertyValue( C2U( "TransparencyStyle" ),
+ uno::makeAny( chart2::TransparencyStyle_GRADIENT ));
+ }
+ else
+ {
+ GetPropertySet()->setPropertyValue(
+ C2U( "TransparencyStyle" ),
+ uno::makeAny( chart2::TransparencyStyle_LINEAR ));
+ }
+ bChanged = true;
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ break;
+
+ case XATTR_GRADIENTSTEPCOUNT:
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "Gradient" )
+ : C2U( "FillGradient" );
+ try
+ {
+ sal_Int16 nStepCount =
+ ( reinterpret_cast< const XGradientStepCountItem & >(
+ rItemSet.Get( nWhichId ))).GetValue();
+
+ awt::Gradient aGradient;
+ if( GetPropertySet()->getPropertyValue( aPropName ) >>= aGradient )
+ {
+ if( aGradient.StepCount != nStepCount )
+ {
+ aGradient.StepCount = nStepCount;
+ GetPropertySet()->setPropertyValue(
+ aPropName,
+ uno::makeAny( aGradient ));
+ bChanged = true;
+ }
+ }
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ break;
+
+ case XATTR_LINEDASH:
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "BorderDash" )
+ : C2U( "LineDash" );
+
+ const XLineDashItem & rItem =
+ reinterpret_cast< const XLineDashItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
+ {
+ GetPropertySet()->setPropertyValue( aPropName, aValue );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case XATTR_FILLGRADIENT:
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "Gradient" )
+ : C2U( "FillGradient" );
+
+ const XFillGradientItem & rItem =
+ reinterpret_cast< const XFillGradientItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
+ {
+ GetPropertySet()->setPropertyValue( aPropName, aValue );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+
+ case XATTR_FILLHATCH:
+ {
+ ::rtl::OUString aPropName =
+ (m_eGraphicObjectType == FILLED_DATA_POINT)
+ ? C2U( "Hatch" )
+ : C2U( "FillHatch" );
+
+ const XFillHatchItem & rItem =
+ reinterpret_cast< const XFillHatchItem & >(
+ rItemSet.Get( nWhichId ));
+
+ if( rItem.QueryValue( aValue ))
+ {
+ if( aValue != GetPropertySet()->getPropertyValue( aPropName ))
+ {
+ GetPropertySet()->setPropertyValue( aPropName, aValue );
+ bChanged = true;
+ }
+ }
+ }
+ break;
+ }
+
+ return bChanged;
+}
+
+void GraphicPropertyItemConverter::FillBitmapItem(
+ USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+ throw( beans::UnknownPropertyException )
+{
+ uno::Reference< beans::XPropertySet > xProp( GetPropertySet() );
+ OSL_ASSERT( xProp.is());
+ chart2::FillBitmap aBitmap;
+ ( xProp->getPropertyValue( C2U( "Bitmap" ))) >>= aBitmap;
+
+ switch( nWhichId )
+ {
+ // bitmap property
+ case XATTR_FILLBITMAP:
+ {
+ XFillBitmapItem aBmpIt;
+ aBmpIt.PutValue( uno::makeAny( aBitmap.aURL ), MID_GRAFURL );
+ rOutItemSet.Put( aBmpIt );
+ }
+ break;
+
+ case XATTR_FILLBMP_TILE:
+ rOutItemSet.Put( XFillBmpTileItem(
+ aBitmap.aBitmapMode == drawing::BitmapMode_REPEAT ));
+ rOutItemSet.Put( XFillBmpStretchItem( FALSE ));
+ break;
+ case XATTR_FILLBMP_STRETCH:
+ rOutItemSet.Put( XFillBmpStretchItem(
+ aBitmap.aBitmapMode == drawing::BitmapMode_STRETCH ));
+ rOutItemSet.Put( XFillBmpTileItem( FALSE ));
+ break;
+ case XATTR_FILLBMP_POS:
+ break;
+ case XATTR_FILLBMP_SIZEX:
+ break;
+ case XATTR_FILLBMP_SIZEY:
+ break;
+ case XATTR_FILLBMP_SIZELOG:
+ break;
+ case XATTR_FILLBMP_TILEOFFSETX:
+ break;
+ case XATTR_FILLBMP_TILEOFFSETY:
+ break;
+ case XATTR_FILLBMP_POSOFFSETX:
+ break;
+ case XATTR_FILLBMP_POSOFFSETY:
+ break;
+ }
+}
+
+void GraphicPropertyItemConverter::ApplyBitmapItem(
+ USHORT nWhichId, const SfxItemSet & rItemSet ) const
+ throw( beans::UnknownPropertyException )
+{
+ static const ::rtl::OUString aBitmapPropName(
+ RTL_CONSTASCII_USTRINGPARAM( "Bitmap" ));
+ uno::Reference< beans::XPropertySet > xProp( GetPropertySet() );
+ OSL_ASSERT( xProp.is());
+ chart2::FillBitmap aBitmap;
+ uno::Any aValue;
+
+ try
+ {
+ ( xProp->getPropertyValue( aBitmapPropName )) >>= aBitmap;
+
+ switch( nWhichId )
+ {
+ // bitmap property
+ case XATTR_FILLBITMAP:
+ {
+ const XFillBitmapItem & rBitmapItem =
+ reinterpret_cast< const XFillBitmapItem & >(
+ rItemSet.Get( nWhichId ));
+ rBitmapItem.QueryValue( aValue, MID_GRAFURL );
+ aValue >>= aBitmap.aURL;
+
+ // must remember bitmap, so that URL stays valid
+ //ToDo: Never deleted yet !!!
+// GraphicObject * pTESTING_CACHE = new GraphicObject(
+// rBitmapItem.GetValue().GetGraphicObject() );
+ }
+ break;
+
+ case XATTR_FILLBMP_TILE:
+ case XATTR_FILLBMP_STRETCH:
+ {
+ const XFillBmpStretchItem & rStretchItem =
+ reinterpret_cast< const XFillBmpStretchItem & >(
+ rItemSet.Get( XATTR_FILLBMP_STRETCH ));
+ const XFillBmpTileItem & rTileItem =
+ reinterpret_cast< const XFillBmpTileItem & >(
+ rItemSet.Get( XATTR_FILLBMP_TILE ));
+
+ if( rTileItem.GetValue() != FALSE )
+ aBitmap.aBitmapMode = drawing::BitmapMode_REPEAT;
+ else if( rStretchItem.GetValue() != FALSE )
+ aBitmap.aBitmapMode = drawing::BitmapMode_STRETCH;
+ else
+ aBitmap.aBitmapMode = drawing::BitmapMode_NO_REPEAT;
+ }
+ break;
+
+ case XATTR_FILLBMP_POS:
+ break;
+ case XATTR_FILLBMP_SIZEX:
+ break;
+ case XATTR_FILLBMP_SIZEY:
+ break;
+ case XATTR_FILLBMP_SIZELOG:
+ break;
+ case XATTR_FILLBMP_TILEOFFSETX:
+ break;
+ case XATTR_FILLBMP_TILEOFFSETY:
+ break;
+ case XATTR_FILLBMP_POSOFFSETX:
+ break;
+ case XATTR_FILLBMP_POSOFFSETY:
+ break;
+ }
+
+ xProp->setPropertyValue( aBitmapPropName, uno::makeAny( aBitmap ));
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/ItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
new file mode 100644
index 000000000000..c8f844a18e4a
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/ItemConverter.cxx
@@ -0,0 +1,296 @@
+/*************************************************************************
+ *
+ * $RCSfile: ItemConverter.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:28 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "ItemConverter.hxx"
+#include "SchItemPool.hxx"
+
+// only used for OSL_ENSURE
+#if OSL_DEBUG_LEVEL > 0
+#include "macros.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+#ifndef _SFX_ITEMPROP_HXX
+#include <svtools/itemprop.hxx>
+#endif
+
+#ifndef _SFXITEMITER_HXX
+#include <svtools/itemiter.hxx>
+#endif
+// header for class SfxWhichIter
+#ifndef _SFX_WHITER_HXX
+#include <svtools/whiter.hxx>
+#endif
+
+using namespace ::com::sun::star;
+
+namespace chart
+{
+namespace wrapper
+{
+
+ItemConverter::ItemConverter(
+ const uno::Reference< beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool ) :
+ m_xPropertySet( rPropertySet ),
+ m_xPropertySetInfo( NULL ),
+ m_rItemPool( rItemPool ),
+ m_bIsValid( true )
+{
+ if( m_xPropertySet.is())
+ {
+ m_xPropertySetInfo = m_xPropertySet->getPropertySetInfo();
+
+ // Note: Do not add this as Reference in the CTOR !!!!
+// uno::Reference< lang::XComponent > xComp( m_xPropertySet, uno::UNO_QUERY );
+// if( xComp.is())
+// {
+// xComp->addEventListener( this );
+// }
+ }
+}
+
+ItemConverter::~ItemConverter()
+{}
+
+
+//static
+SfxItemPool* ItemConverter::CreateSchItemPool()
+{
+ return new SchItemPool();
+}
+
+SfxItemPool & ItemConverter::GetItemPool() const
+{
+ return m_rItemPool;
+}
+
+SfxItemSet ItemConverter::CreateEmptyItemSet() const
+{
+ return SfxItemSet( GetItemPool(), GetWhichPairs() );
+}
+
+uno::Reference< beans::XPropertySet > ItemConverter::GetPropertySet() const
+{
+ return m_xPropertySet;
+}
+
+void ItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
+{
+ const USHORT * pRanges = rOutItemSet.GetRanges();
+ ::rtl::OUString aPropName;
+ SfxItemPool & rPool = GetItemPool();
+
+ OSL_ASSERT( pRanges != NULL );
+ OSL_ASSERT( m_xPropertySetInfo.is());
+ OSL_ASSERT( m_xPropertySet.is());
+
+ while( (*pRanges) != 0)
+ {
+ USHORT nBeg = (*pRanges);
+ ++pRanges;
+ USHORT nEnd = (*pRanges);
+ ++pRanges;
+
+ OSL_ASSERT( nBeg <= nEnd );
+ for( USHORT nWhich = nBeg; nWhich <= nEnd; ++nWhich )
+ {
+ if( GetItemPropertyName( nWhich, aPropName ))
+ {
+#if OSL_DEBUG_LEVEL > 0
+ try
+ {
+ beans::Property aProp( m_xPropertySetInfo->getPropertyByName( aPropName ));
+ OSL_ASSERT( aProp.Name.equals( aPropName ));
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+#endif
+
+ // put the Property into the itemset
+ SfxPoolItem * pItem = rPool.GetDefaultItem( nWhich ).Clone();
+
+ if( pItem )
+ {
+ try
+ {
+ if( ! pItem->PutValue( m_xPropertySet->getPropertyValue( aPropName ),
+ 0 // nMemberId
+ ))
+ {
+ delete pItem;
+// throw lang::IllegalArgumentException();
+ }
+ else
+ {
+ rOutItemSet.Put( *pItem, nWhich );
+ delete pItem;
+ }
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ OSL_ENSURE( false, U2C( ex.Message + C2U( " - unknown Property: " ) + aPropName ) );
+ delete pItem;
+ }
+ }
+ }
+ else
+ {
+ FillSpecialItem( nWhich, rOutItemSet );
+ }
+ }
+ }
+}
+
+bool ItemConverter::GetItemPropertyName(
+ USHORT nWhichId, ::rtl::OUString & rOutName ) const
+{
+ return false;
+}
+
+void ItemConverter::FillSpecialItem(
+ USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+{
+ OSL_ENSURE( false, "ItemConverter: Unhandled special item found!" );
+}
+
+bool ItemConverter::ApplySpecialItem(
+ USHORT nWhichId, const SfxItemSet & rItemSet ) const
+{
+ OSL_ENSURE( false, "ItemConverter: Unhandled special item found!" );
+ return false;
+}
+
+bool ItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
+{
+ OSL_ASSERT( m_xPropertySet.is());
+
+ bool bItemsChanged = false;
+ SfxItemIter aIter( rItemSet );
+ const SfxPoolItem * pItem = aIter.FirstItem();
+ ::rtl::OUString aPropName;
+ uno::Any aValue;
+
+ while( pItem )
+ {
+ if( rItemSet.GetItemState( pItem->Which(), FALSE ) == SFX_ITEM_SET )
+ {
+ if( GetItemPropertyName( pItem->Which(), aPropName ))
+ {
+ pItem->QueryValue( aValue, 0 /* nMemberId */ );
+
+ try
+ {
+ if( aValue != m_xPropertySet->getPropertyValue( aPropName ))
+ {
+ m_xPropertySet->setPropertyValue( aPropName, aValue );
+ bItemsChanged = true;
+ }
+ }
+ catch( beans::UnknownPropertyException ex )
+ {
+ OSL_ENSURE( false, U2C( ex.Message + C2U( " - unknown Property: " ) + aPropName ) );
+ }
+ }
+ else
+ {
+ bItemsChanged = ApplySpecialItem( pItem->Which(), rItemSet ) || bItemsChanged;
+ }
+ }
+ pItem = aIter.NextItem();
+ }
+
+ return bItemsChanged;
+}
+
+// ____ XEventListener ____
+void SAL_CALL ItemConverter::disposing( const lang::EventObject& Source )
+ throw (uno::RuntimeException)
+{
+ if( Source.Source == m_xPropertySet )
+ {
+ m_bIsValid = false;
+ }
+}
+
+//static
+void ItemConverter::InvalidateUnequalItems( SfxItemSet &rDestSet, const SfxItemSet &rSourceSet )
+{
+ SfxWhichIter aIter (rSourceSet);
+ USHORT nWhich = aIter.FirstWhich ();
+ const SfxPoolItem *pPoolItem = NULL;
+
+ while (nWhich)
+ {
+ if ((rSourceSet.GetItemState(nWhich, TRUE, &pPoolItem) == SFX_ITEM_SET) &&
+ (rDestSet.GetItemState(nWhich, TRUE, &pPoolItem) == SFX_ITEM_SET))
+ if (rSourceSet.Get(nWhich) != rDestSet.Get(nWhich))
+ rDestSet.InvalidateItem(nWhich);
+
+ nWhich = aIter.NextWhich ();
+ }
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/MultipleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/MultipleItemConverter.cxx
new file mode 100644
index 000000000000..a543df2f48d6
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/MultipleItemConverter.cxx
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * $RCSfile: MultipleItemConverter.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:28 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "MultipleItemConverter.hxx"
+#include "ItemPropertyMap.hxx"
+#include "SchSfxItemIds.hxx"
+#include "SchWhichPairs.hxx"
+#include "AxisItemConverter.hxx"
+#include "GraphicPropertyItemConverter.hxx"
+#include "DataPointItemConverter.hxx"
+#include "ChartModelHelper.hxx"
+
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XAXISCONTAINER_HPP_
+#include <drafts/com/sun/star/chart2/XAxisContainer.hpp>
+#endif
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XGRIDCONTAINER_HPP_
+#include <drafts/com/sun/star/chart2/XGridContainer.hpp>
+#endif
+#ifndef _DRAFTS_COM_SUN_STAR_CHART2_XCHARTDOCUMENT_HPP_
+#include <drafts/com/sun/star/chart2/XChartDocument.hpp>
+#endif
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::drafts::com::sun::star;
+
+namespace chart
+{
+namespace wrapper
+{
+MultipleItemConverter::MultipleItemConverter( SfxItemPool& rItemPool )
+ : ItemConverter( NULL, rItemPool )
+{
+}
+MultipleItemConverter::~MultipleItemConverter()
+{
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ DeleteItemConverterPtr() );
+}
+
+void MultipleItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
+{
+ ::std::vector< ItemConverter* >::const_iterator aIter = m_aConverters.begin();
+ const ::std::vector< ItemConverter* >::const_iterator aEnd = m_aConverters.end();
+ if( aIter != aEnd )
+ {
+ (*aIter)->FillItemSet( rOutItemSet );
+ aIter++;
+ }
+ for( ; aIter != aEnd; aIter++ )
+ {
+ SfxItemSet aSet = this->CreateEmptyItemSet();
+ (*aIter)->FillItemSet( aSet );
+ InvalidateUnequalItems( rOutItemSet, aSet );
+ }
+ // no own items
+}
+
+bool MultipleItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
+{
+ bool bResult = false;
+
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ApplyItemSetFunc( rItemSet, bResult ));
+
+ // no own items
+ return bResult;
+}
+
+//-----------------------------------------------------------------------------
+
+AllAxisItemConverter::AllAxisItemConverter(
+ const uno::Reference< frame::XModel > & xChartModel,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel )
+ : MultipleItemConverter( rItemPool )
+{
+ uno::Reference< chart2::XChartDocument > xChartDocument( xChartModel, uno::UNO_QUERY );
+ if(!xChartDocument.is())
+ return;
+ uno::Reference< chart2::XDiagram > xDiagram = xChartDocument->getDiagram();
+ uno::Reference< chart2::XAxisContainer > xContainer( xDiagram, uno::UNO_QUERY );
+ if(!xContainer.is())
+ return;
+ uno::Sequence< uno::Reference< chart2::XAxis > > aElementList = xContainer->getAxes();
+ for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ )
+ {
+ uno::Reference< beans::XPropertySet > xObjectProperties(aElementList[nA], uno::UNO_QUERY);
+ m_aConverters.push_back( new wrapper::AxisItemConverter(
+ xObjectProperties, rItemPool, rDrawModel, 0, 0, 0, 0 ) );
+ }
+}
+
+AllAxisItemConverter::~AllAxisItemConverter()
+{
+}
+
+const USHORT * AllAxisItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nAllAxisWhichPairs;
+}
+
+//-----------------------------------------------------------------------------
+
+AllGridItemConverter::AllGridItemConverter(
+ const uno::Reference< frame::XModel > & xChartModel,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel )
+ : MultipleItemConverter( rItemPool )
+{
+ uno::Reference< chart2::XChartDocument > xChartDocument( xChartModel, uno::UNO_QUERY );
+ if(!xChartDocument.is())
+ return;
+ uno::Reference< chart2::XDiagram > xDiagram = xChartDocument->getDiagram();
+ uno::Reference< chart2::XGridContainer > xContainer( xDiagram, uno::UNO_QUERY );
+ if(!xContainer.is())
+ return;
+ uno::Sequence< uno::Reference< chart2::XGrid > > aElementList = xContainer->getGrids();
+ for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ )
+ {
+ uno::Reference< beans::XPropertySet > xObjectProperties(aElementList[nA], uno::UNO_QUERY);
+ m_aConverters.push_back( new wrapper::GraphicPropertyItemConverter(
+ xObjectProperties, rItemPool, rDrawModel,
+ wrapper::GraphicPropertyItemConverter::LINE_PROPERTIES ) );
+ }
+}
+
+AllGridItemConverter::~AllGridItemConverter()
+{
+}
+
+const USHORT * AllGridItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nGridWhichPairs;
+}
+
+//-----------------------------------------------------------------------------
+
+AllDataLabelItemConverter::AllDataLabelItemConverter(
+ const uno::Reference< frame::XModel > & xChartModel,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel )
+ : MultipleItemConverter( rItemPool )
+{
+ ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
+ ChartModelHelper::getDataSeries( xChartModel ));
+
+ ::std::vector< uno::Reference< chart2::XDataSeries > >::const_iterator aIt;
+ for( aIt = aSeriesList.begin(); aIt != aSeriesList.end(); ++aIt )
+ {
+ uno::Reference< beans::XPropertySet > xObjectProperties( *aIt, uno::UNO_QUERY);
+ m_aConverters.push_back( new wrapper::DataPointItemConverter(
+ xObjectProperties, rItemPool, rDrawModel, NULL ) );
+ }
+}
+
+AllDataLabelItemConverter::~AllDataLabelItemConverter()
+{
+}
+
+const USHORT * AllDataLabelItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nDataLabelWhichPairs;
+}
+
+//-----------------------------------------------------------------------------
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
new file mode 100644
index 000000000000..38e82aa2d1de
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/SchWhichPairs.hxx
@@ -0,0 +1,273 @@
+/*************************************************************************
+ *
+ * $RCSfile: SchWhichPairs.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:28 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef CHART_SCHWHICHPAIRS_HXX
+#define CHART_SCHWHICHPAIRS_HXX
+
+#ifndef _SVX_SVXIDS_HRC
+#include <svx/svxids.hrc>
+#endif
+
+#ifndef _XDEF_HXX
+#include <svx/xdef.hxx>
+#endif
+#ifndef _SVDDEF_HXX
+#include <svx/svddef.hxx>
+#endif
+#ifndef _EEITEM_HXX
+#include <svx/eeitem.hxx>
+#endif
+
+#include "SchSfxItemIds.hxx"
+#include "SchSlotIds.hxx"
+
+namespace
+{
+
+const USHORT nTitleWhichPairs[] =
+{
+// SCHATTR_TEXT_ORIENT, SCHATTR_TEXT_ORIENT, // 4 sch/schattr.hxx
+ SCHATTR_TEXT_STACKED, SCHATTR_TEXT_STACKED, // 4 sch/schattr.hxx
+ SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx
+ SCHATTR_USER_DEFINED_ATTR, SCHATTR_USER_DEFINED_ATTR, // 100 sch/schattr.hxx
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx
+ SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, // 1067 - 1078 svx/svddef.hxx
+ EE_ITEMS_START, EE_ITEMS_END, // 3994 - 4037 svx/eeitem.hxx
+ 0
+};
+
+const USHORT nAxisWhichPairs[] =
+{
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ EE_ITEMS_START, EE_ITEMS_END, // 3994 - 4037 svx/eeitem.hxx
+ SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_VALUE, // 10585 - 10585 svx/svxids.hrc
+ SID_ATTR_NUMBERFORMAT_SOURCE, SID_ATTR_NUMBERFORMAT_SOURCE, // 11432 svx/svxids.hrc
+ SCHATTR_AXISTYPE, SCHATTR_AXISTYPE, // 39 sch/schattr.hxx
+ SCHATTR_TEXT_START, SCHATTR_TEXT_END, // 4 - 6 sch/schattr.hxx
+ SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx
+ SCHATTR_TEXT_OVERLAP, SCHATTR_TEXT_OVERLAP, // 54 sch/schattr.hxx
+ SCHATTR_AXIS_START, SCHATTR_AXIS_END, // 70 - 95 sch/schattr.hxx
+ SCHATTR_USER_DEFINED_ATTR, SCHATTR_USER_DEFINED_ATTR, // 100 sch/schattr.hxx
+ // SID_TEXTBREAK, SID_TEXTBREAK, // 30587 sch/app.hrc
+ SCHATTR_TEXTBREAK, SCHATTR_TEXTBREAK, // 30587 sch/schattr.hxx
+ 0
+};
+
+const USHORT nAllAxisWhichPairs[] =
+{
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ EE_ITEMS_START, EE_ITEMS_END, // 3994 - 4037 svx/eeitem.hxx
+// SCHATTR_TEXT_ORIENT, SCHATTR_TEXT_ORIENT, // 4 sch/schattr.hxx
+ SCHATTR_TEXT_START, SCHATTR_TEXT_END, // 4 - 6 sch/schattr.hxx
+ SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx
+ SCHATTR_TEXT_OVERLAP, SCHATTR_TEXT_OVERLAP, // 54 sch/schattr.hxx
+ SCHATTR_AXIS_SHOWDESCR, SCHATTR_AXIS_SHOWDESCR, // 85 sch/schattr.hxx
+ // SID_TEXTBREAK, SID_TEXTBREAK, // 30587 sch/app.hrc
+ SCHATTR_TEXTBREAK, SCHATTR_TEXTBREAK, // 30587 sch/schattr.hxx
+ 0
+};
+
+const USHORT nGridWhichPairs[] =
+{
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ SCHATTR_USER_DEFINED_ATTR, SCHATTR_USER_DEFINED_ATTR, // 100 sch/schattr.hxx
+ 0
+};
+
+const USHORT nChartWhichPairs[] =
+{
+ SCHATTR_STYLE_START,SCHATTR_STYLE_END, // 59 - 68 sch/schattr.hxx
+ SCHATTR_USER_DEFINED_ATTR, SCHATTR_USER_DEFINED_ATTR, // 100 sch/schattr.hxx
+ 0
+};
+
+const USHORT nDiagramAreaWhichPairs[] =
+{
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx
+ SCHATTR_USER_DEFINED_ATTR, SCHATTR_USER_DEFINED_ATTR, // 100 sch/schattr.hxx
+ 0
+};
+
+const USHORT nAreaAndChartWhichPairs[] = // pairs for chart AND area
+{
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx
+ SCHATTR_STYLE_START,SCHATTR_STYLE_END, // 59 - 68 sch/schattr.hxx
+ SCHATTR_USER_DEFINED_ATTR, SCHATTR_USER_DEFINED_ATTR, // 100 sch/schattr.hxx
+ 0
+};
+
+const USHORT nLegendWhichPairs[] =
+{
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1018 - 1046 svx/xdef.hxx
+ SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, // 1067 - 1078 svx/svddef.hxx
+ EE_ITEMS_START, EE_ITEMS_END, // 3994 - 4037 svx/eeitem.hxx
+ SCHATTR_LEGEND_START, SCHATTR_LEGEND_END, // 3 - 3 sch/schattr.hxx
+ SCHATTR_USER_DEFINED_ATTR, SCHATTR_USER_DEFINED_ATTR, // 100 sch/schattr.hxx
+ 0
+};
+
+const USHORT nDataLabelWhichPairs[] =
+{
+ SCHATTR_DATADESCR_START, SCHATTR_DATADESCR_END,
+ 0
+};
+
+#define CHART_ROW_WHICHPAIRS \
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, /* 1000 - 1016 svx/xdef.hxx */ \
+ XATTR_FILL_FIRST, XATTR_FILL_LAST, /* 1018 - 1046 svx/xdef.hxx */ \
+ EE_ITEMS_START, EE_ITEMS_END, /* 3994 - 4037 svx/eeitem.hxx */ \
+ SCHATTR_DATADESCR_START, SCHATTR_DATADESCR_END, /* 1 - 2 sch/schattr.hxx*/ \
+ SCHATTR_DUMMY0, SCHATTR_DUMMY0, /* 40 sch/schattr.hxx*/ \
+ SCHATTR_DUMMY1, SCHATTR_DUMMY1, /* 41 sch/schattr.hxx*/ \
+ SCHATTR_STAT_START, SCHATTR_STAT_END, /* 45 - 52 sch/schattr.hxx*/ \
+ SCHATTR_STYLE_START,SCHATTR_STYLE_END, /* 59 - 68 sch/schattr.hxx*/ \
+ SCHATTR_AXIS,SCHATTR_AXIS, /* 69 sch/schattr.hxx*/ \
+ SCHATTR_SYMBOL_BRUSH,SCHATTR_SYMBOL_BRUSH, /* 96 sch/schattr.hxx*/ \
+ SCHATTR_SYMBOL_SIZE,SCHATTR_USER_DEFINED_ATTR, /* 99 - 100 sch/schattr.hxx*/ \
+ SDRATTR_3D_FIRST, SDRATTR_3D_LAST /* 1244 - 1334 svx/svddef.hxx */
+
+const USHORT nRowWhichPairs[] =
+{
+ CHART_ROW_WHICHPAIRS,
+ 0
+};
+
+const USHORT nAreaWhichPairs[] =
+{
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1000 - 1016 svx/xdef.hxx
+ SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, // 1067 - 1078 svx/svddef.hxx
+ SCHATTR_USER_DEFINED_ATTR, SCHATTR_USER_DEFINED_ATTR, // 100 sch/schattr.hxx
+ 0
+};
+
+const USHORT nTextWhichPairs[] =
+{
+ EE_ITEMS_START, EE_ITEMS_END, // 3994 - 4037 svx/eeitem.hxx
+// SCHATTR_TEXT_ORIENT, SCHATTR_TEXT_ORIENT, // 4 sch/schattr.hxx
+ SCHATTR_TEXT_STACKED, SCHATTR_TEXT_STACKED, // 4 sch/schattr.hxx
+ SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx
+ SCHATTR_USER_DEFINED_ATTR, SCHATTR_USER_DEFINED_ATTR, // 100 sch/schattr.hxx
+ 0
+};
+
+const USHORT nTextOrientWhichPairs[] =
+{
+ EE_ITEMS_START, EE_ITEMS_END, // 3994 - 4037 svx/eeitem.hxx
+// SCHATTR_TEXT_ORIENT, SCHATTR_TEXT_ORIENT, // 4 sch/schattr.hxx
+ SCHATTR_TEXT_STACKED, SCHATTR_TEXT_STACKED, // 4 sch/schattr.hxx
+ SCHATTR_TEXT_DEGREES,SCHATTR_TEXT_DEGREES, // 53 sch/schattr.hxx
+ 0
+};
+
+const USHORT nStatWhichPairs[]=
+{
+ SCHATTR_STAT_START, SCHATTR_STAT_END, // 45 - 52 sch/schattr.hxx
+ 0
+};
+
+// for CharacterProperties
+
+const USHORT nCharacterPropertyWhichPairs[] =
+{
+ EE_ITEMS_START, EE_ITEMS_END, // 3994 - 4037 svx/eeitem.hxx
+ 0
+};
+
+const USHORT nLinePropertyWhichPairs[] =
+{
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ 0
+};
+
+const USHORT nFillPropertyWhichPairs[] =
+{
+ XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1000 - 1016 svx/xdef.hxx
+ SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, // 1067 - 1078 svx/svddef.hxx
+ 0
+};
+
+const USHORT nLineAndFillPropertyWhichPairs[] =
+{
+ XATTR_LINE_FIRST, XATTR_LINE_LAST, // 1000 - 1016 svx/xdef.hxx
+ XATTR_FILL_FIRST, XATTR_FILL_LAST, // 1000 - 1016 svx/xdef.hxx
+ SDRATTR_SHADOW_FIRST, SDRATTR_SHADOW_LAST, // 1067 - 1078 svx/svddef.hxx
+ 0
+};
+
+const USHORT nChartStyleWhichPairs[] =
+{
+ SCHATTR_DIAGRAM_STYLE, SCHATTR_DIAGRAM_STYLE,
+ SCHATTR_STYLE_SHAPE, SCHATTR_STYLE_SHAPE,
+ SCHATTR_NUM_OF_LINES_FOR_BAR, SCHATTR_NUM_OF_LINES_FOR_BAR,
+ SCHATTR_SPLINE_ORDER, SCHATTR_SPLINE_ORDER,
+ SCHATTR_SPLINE_RESOLUTION, SCHATTR_SPLINE_RESOLUTION,
+ 0
+};
+
+
+} // anonymous namespace
+
+// CHART_SCHWHICHPAIRS_HXX
+#endif
diff --git a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx
new file mode 100644
index 000000000000..b8818f2b89ae
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx
@@ -0,0 +1,262 @@
+/*************************************************************************
+ *
+ * $RCSfile: TitleItemConverter.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: bm $ $Date: 2003-10-06 09:58:28 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2003 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include "TitleItemConverter.hxx"
+#include "SchWhichPairs.hxx"
+#include "macros.hxx"
+#include "ItemPropertyMap.hxx"
+#include "GraphicPropertyItemConverter.hxx"
+#include "CharacterPropertyItemConverter.hxx"
+#include "MultipleItemConverter.hxx"
+
+#ifndef _SFXINTITEM_HXX
+#include <svtools/intitem.hxx>
+#endif
+#ifndef INCLUDED_RTL_MATH_HXX
+#include <rtl/math.hxx>
+#endif
+
+#include <drafts/com/sun/star/chart2/XTitled.hpp>
+
+#include <functional>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::drafts::com::sun::star;
+
+namespace
+{
+::chart::wrapper::ItemPropertyMapType & lcl_GetTitlePropertyMap()
+{
+ static ::chart::wrapper::ItemPropertyMapType aTitlePropertyMap(
+ ::chart::wrapper::MakeItemPropertyMap
+ ( SCHATTR_TEXT_STACKED, C2U( "StackCharacters" ))
+ );
+
+ return aTitlePropertyMap;
+};
+} // anonymous namespace
+
+namespace chart
+{
+namespace wrapper
+{
+
+// ========================================
+
+class FormattedStringsConverter : public MultipleItemConverter
+{
+public:
+ FormattedStringsConverter(
+ const uno::Sequence< uno::Reference< chart2::XFormattedString > > & aStrings,
+ SfxItemPool & rItemPool );
+ virtual ~FormattedStringsConverter();
+
+protected:
+ virtual const USHORT * GetWhichPairs() const;
+};
+
+// ----------------------------------------
+
+FormattedStringsConverter::FormattedStringsConverter(
+ const uno::Sequence< uno::Reference< chart2::XFormattedString > > & aStrings,
+ SfxItemPool & rItemPool )
+ : MultipleItemConverter( rItemPool )
+{
+ for( sal_Int32 i = 0; i < aStrings.getLength(); ++i )
+ {
+ uno::Reference< beans::XPropertySet > xProp( aStrings[ i ], uno::UNO_QUERY );
+ if( xProp.is())
+ m_aConverters.push_back( new CharacterPropertyItemConverter( xProp, rItemPool ));
+ }
+}
+
+FormattedStringsConverter::~FormattedStringsConverter()
+{
+}
+
+const USHORT * FormattedStringsConverter::GetWhichPairs() const
+{
+ return nCharacterPropertyWhichPairs;
+}
+
+// ========================================
+
+TitleItemConverter::TitleItemConverter(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropertySet,
+ SfxItemPool& rItemPool,
+ SdrModel& rDrawModel ) :
+ ItemConverter( rPropertySet, rItemPool )
+{
+ m_aConverters.push_back( new GraphicPropertyItemConverter(
+ rPropertySet, rItemPool, rDrawModel,
+ GraphicPropertyItemConverter::LINE_AND_FILL_PROPERTIES ));
+
+ // CharacterProperties are not at the title but at its contained XFormattedString objects
+ // take the first formatted string in the sequence
+ uno::Reference< chart2::XTitle > xTitle( rPropertySet, uno::UNO_QUERY );
+ if( xTitle.is())
+ {
+ uno::Sequence< uno::Reference< chart2::XFormattedString > > aStringSeq( xTitle->getText());
+ if( aStringSeq.getLength() > 0 )
+ {
+ m_aConverters.push_back( new FormattedStringsConverter( aStringSeq, rItemPool ));
+ }
+ }
+}
+
+TitleItemConverter::~TitleItemConverter()
+{
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ DeleteItemConverterPtr() );
+}
+
+void TitleItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
+{
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ FillItemSetFunc( rOutItemSet ));
+
+ // own items
+ ItemConverter::FillItemSet( rOutItemSet );
+}
+
+bool TitleItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
+{
+ bool bResult = false;
+
+ ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
+ ApplyItemSetFunc( rItemSet, bResult ));
+
+ // own items
+ return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
+}
+
+const USHORT * TitleItemConverter::GetWhichPairs() const
+{
+ // must span all used items!
+ return nTitleWhichPairs;
+}
+
+bool TitleItemConverter::GetItemPropertyName( USHORT nWhichId, ::rtl::OUString & rOutName ) const
+{
+ ItemPropertyMapType & rMap( lcl_GetTitlePropertyMap());
+ ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
+
+ if( aIt == rMap.end())
+ return false;
+
+ rOutName =(*aIt).second;
+ return true;
+}
+
+
+bool TitleItemConverter::ApplySpecialItem(
+ USHORT nWhichId, const SfxItemSet & rItemSet ) const
+{
+ bool bChanged = false;
+
+ switch( nWhichId )
+ {
+ case SCHATTR_TEXT_DEGREES:
+ {
+ // convert int to double (divided by 100)
+ double fVal = static_cast< double >(
+ reinterpret_cast< const SfxInt32Item & >(
+ 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 ));
+ bChanged = true;
+ }
+ }
+ break;
+ }
+
+ return bChanged;
+}
+
+void TitleItemConverter::FillSpecialItem(
+ USHORT nWhichId, SfxItemSet & rOutItemSet ) const
+{
+ switch( nWhichId )
+ {
+ case SCHATTR_TEXT_DEGREES:
+ {
+ // convert double to int (times 100)
+ double fVal;
+
+ if( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fVal )
+ {
+ rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >(
+ ::rtl::math::round( fVal * 100.0 ) ) ));
+ }
+ }
+ break;
+ }
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/itemsetwrapper/makefile.mk b/chart2/source/controller/itemsetwrapper/makefile.mk
new file mode 100644
index 000000000000..d7b6e2cd1661
--- /dev/null
+++ b/chart2/source/controller/itemsetwrapper/makefile.mk
@@ -0,0 +1,89 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: bm $ $Date: 2003-10-06 09:58:28 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# 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.
+#
+# 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.
+#
+# 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
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (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.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+PRJ= ..$/..$/..
+PRJINC= $(PRJ)$/source
+PRJNAME= chart2
+TARGET= chcitemsetwrapper
+
+ENABLE_EXCEPTIONS= TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# --- export library -------------------------------------------------
+
+#object files to build and link together to lib $(SLB)$/$(TARGET).lib
+SLOFILES= $(SLO)$/SchItemPool.obj \
+ $(SLO)$/ItemConverter.obj \
+ $(SLO)$/AxisItemConverter.obj \
+ $(SLO)$/MultipleItemConverter.obj \
+ $(SLO)$/CharacterPropertyItemConverter.obj \
+ $(SLO)$/ChartTypeItemConverter.obj \
+ $(SLO)$/DataPointItemConverter.obj \
+ $(SLO)$/GraphicPropertyItemConverter.obj \
+ $(SLO)$/TitleItemConverter.obj
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
+