1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_chart2.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "SeriesOptionsItemConverter.hxx" 32*cdf0e10cSrcweir #include "SchWhichPairs.hxx" 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #include "macros.hxx" 35*cdf0e10cSrcweir #include "ItemPropertyMap.hxx" 36*cdf0e10cSrcweir #include "GraphicPropertyItemConverter.hxx" 37*cdf0e10cSrcweir #include "MultipleItemConverter.hxx" 38*cdf0e10cSrcweir #include "ChartModelHelper.hxx" 39*cdf0e10cSrcweir #include "AxisHelper.hxx" 40*cdf0e10cSrcweir #include "DiagramHelper.hxx" 41*cdf0e10cSrcweir #include "ChartTypeHelper.hxx" 42*cdf0e10cSrcweir #include "DataSeriesHelper.hxx" 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir #include <com/sun/star/chart/MissingValueTreatment.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/chart2/XDataSeries.hpp> 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir // for SfxBoolItem 48*cdf0e10cSrcweir #include <svl/eitem.hxx> 49*cdf0e10cSrcweir #include <svl/intitem.hxx> 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir //SfxIntegerListItem 52*cdf0e10cSrcweir #include <svl/ilstitem.hxx> 53*cdf0e10cSrcweir #define _SVSTDARR_ULONGS 54*cdf0e10cSrcweir #include <svl/svstdarr.hxx> 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir #include <rtl/math.hxx> 57*cdf0e10cSrcweir #include <functional> 58*cdf0e10cSrcweir #include <algorithm> 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir using namespace ::com::sun::star; 61*cdf0e10cSrcweir using namespace ::com::sun::star::chart2; 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir namespace chart 64*cdf0e10cSrcweir { 65*cdf0e10cSrcweir namespace wrapper 66*cdf0e10cSrcweir { 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir // ======================================== 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir SeriesOptionsItemConverter::SeriesOptionsItemConverter( 71*cdf0e10cSrcweir const uno::Reference< frame::XModel >& xChartModel 72*cdf0e10cSrcweir , const uno::Reference< uno::XComponentContext > & xContext 73*cdf0e10cSrcweir , const uno::Reference< beans::XPropertySet >& xPropertySet 74*cdf0e10cSrcweir , SfxItemPool& rItemPool ) 75*cdf0e10cSrcweir : ItemConverter( xPropertySet, rItemPool ) 76*cdf0e10cSrcweir , m_xChartModel(xChartModel) 77*cdf0e10cSrcweir , m_xCC(xContext) 78*cdf0e10cSrcweir , m_bAttachToMainAxis(true) 79*cdf0e10cSrcweir , m_bSupportingOverlapAndGapWidthProperties(false) 80*cdf0e10cSrcweir , m_bSupportingBarConnectors(false) 81*cdf0e10cSrcweir , m_nBarOverlap(0) 82*cdf0e10cSrcweir , m_nGapWidth(100) 83*cdf0e10cSrcweir , m_bConnectBars(false) 84*cdf0e10cSrcweir , m_bSupportingAxisSideBySide(false) 85*cdf0e10cSrcweir , m_bGroupBarsPerAxis(true) 86*cdf0e10cSrcweir , m_bAllSeriesAttachedToSameAxis(true) 87*cdf0e10cSrcweir , m_nAllSeriesAxisIndex(-1) 88*cdf0e10cSrcweir , m_bSupportingStartingAngle(false) 89*cdf0e10cSrcweir , m_nStartingAngle(90) 90*cdf0e10cSrcweir , m_bClockwise(false) 91*cdf0e10cSrcweir , m_aSupportedMissingValueTreatments() 92*cdf0e10cSrcweir , m_nMissingValueTreatment(0) 93*cdf0e10cSrcweir , m_bSupportingPlottingOfHiddenCells(false) 94*cdf0e10cSrcweir , m_bIncludeHiddenCells(true) 95*cdf0e10cSrcweir { 96*cdf0e10cSrcweir try 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir uno::Reference< XDataSeries > xDataSeries( xPropertySet, uno::UNO_QUERY ); 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir m_bAttachToMainAxis = DiagramHelper::isSeriesAttachedToMainAxis( xDataSeries ); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) ); 103*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xDiagramProperties( xDiagram, uno::UNO_QUERY ); 104*cdf0e10cSrcweir uno::Reference< XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram , xDataSeries ) ); 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir m_xCooSys = DataSeriesHelper::getCoordinateSystemOfSeries( xDataSeries, xDiagram ); 107*cdf0e10cSrcweir if( m_xCooSys.is() ) 108*cdf0e10cSrcweir { 109*cdf0e10cSrcweir uno::Reference< chart2::XAxis > xAxis( AxisHelper::getAxis( 1, 0, m_xCooSys ) ); 110*cdf0e10cSrcweir chart2::ScaleData aScale( xAxis->getScaleData() ); 111*cdf0e10cSrcweir m_bClockwise = (aScale.Orientation == chart2::AxisOrientation_REVERSE); 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); 115*cdf0e10cSrcweir m_bSupportingOverlapAndGapWidthProperties = ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( xChartType, nDimensionCount ); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir if( m_bSupportingOverlapAndGapWidthProperties ) 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir sal_Int32 nAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries); 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir uno::Sequence< sal_Int32 > m_aBarPositionSequence; 123*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xChartTypeProps( xChartType, uno::UNO_QUERY ); 124*cdf0e10cSrcweir if( xChartTypeProps.is() ) 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir if( xChartTypeProps->getPropertyValue( C2U( "OverlapSequence" ) ) >>= m_aBarPositionSequence ) 127*cdf0e10cSrcweir { 128*cdf0e10cSrcweir if( nAxisIndex >= 0 && nAxisIndex < m_aBarPositionSequence.getLength() ) 129*cdf0e10cSrcweir m_nBarOverlap = m_aBarPositionSequence[nAxisIndex]; 130*cdf0e10cSrcweir } 131*cdf0e10cSrcweir if( xChartTypeProps->getPropertyValue( C2U( "GapwidthSequence" ) ) >>= m_aBarPositionSequence ) 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir if( nAxisIndex >= 0 && nAxisIndex < m_aBarPositionSequence.getLength() ) 134*cdf0e10cSrcweir m_nGapWidth = m_aBarPositionSequence[nAxisIndex]; 135*cdf0e10cSrcweir } 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir } 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir m_bSupportingBarConnectors = ChartTypeHelper::isSupportingBarConnectors( xChartType, nDimensionCount ); 140*cdf0e10cSrcweir if( m_bSupportingBarConnectors && xDiagramProperties.is() ) 141*cdf0e10cSrcweir { 142*cdf0e10cSrcweir xDiagramProperties->getPropertyValue( C2U("ConnectBars")) >>= m_bConnectBars; 143*cdf0e10cSrcweir } 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir m_bSupportingAxisSideBySide = ChartTypeHelper::isSupportingAxisSideBySide( xChartType, nDimensionCount ); 146*cdf0e10cSrcweir if( m_bSupportingAxisSideBySide && xDiagramProperties.is() ) 147*cdf0e10cSrcweir { 148*cdf0e10cSrcweir xDiagramProperties->getPropertyValue( C2U("GroupBarsPerAxis")) >>= m_bGroupBarsPerAxis; 149*cdf0e10cSrcweir m_bAllSeriesAttachedToSameAxis = DataSeriesHelper::areAllSeriesAttachedToSameAxis( xChartType, m_nAllSeriesAxisIndex ); 150*cdf0e10cSrcweir } 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir m_bSupportingStartingAngle = ChartTypeHelper::isSupportingStartingAngle( xChartType ); 153*cdf0e10cSrcweir if( m_bSupportingStartingAngle ) 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir xDiagramProperties->getPropertyValue( C2U( "StartingAngle" ) ) >>= m_nStartingAngle; 156*cdf0e10cSrcweir } 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir m_aSupportedMissingValueTreatments = ChartTypeHelper::getSupportedMissingValueTreatments( xChartType ); 159*cdf0e10cSrcweir m_nMissingValueTreatment = DiagramHelper::getCorrectedMissingValueTreatment( 160*cdf0e10cSrcweir ChartModelHelper::findDiagram(m_xChartModel), xChartType ); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir uno::Reference< XChartDocument > xChartDoc( m_xChartModel, uno::UNO_QUERY ); 163*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProp( xChartDoc->getDataProvider(), uno::UNO_QUERY ); 164*cdf0e10cSrcweir if( xProp.is() ) 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir try 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir //test whether the data provider offers this property 169*cdf0e10cSrcweir xProp->getPropertyValue(C2U("IncludeHiddenCells")); 170*cdf0e10cSrcweir //if not exception is thrown the property is offered 171*cdf0e10cSrcweir m_bSupportingPlottingOfHiddenCells = true; 172*cdf0e10cSrcweir xDiagramProperties->getPropertyValue( C2U("IncludeHiddenCells") ) >>= m_bIncludeHiddenCells; 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir catch( const beans::UnknownPropertyException& ) 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir } 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir catch( uno::Exception ex ) 180*cdf0e10cSrcweir { 181*cdf0e10cSrcweir ASSERT_EXCEPTION( ex ); 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir } 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir SeriesOptionsItemConverter::~SeriesOptionsItemConverter() 186*cdf0e10cSrcweir { 187*cdf0e10cSrcweir } 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir const sal_uInt16 * SeriesOptionsItemConverter::GetWhichPairs() const 190*cdf0e10cSrcweir { 191*cdf0e10cSrcweir // must span all used items! 192*cdf0e10cSrcweir return nSeriesOptionsWhichPairs; 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir bool SeriesOptionsItemConverter::GetItemProperty( tWhichIdType /*nWhichId*/, tPropertyNameWithMemberId & /*rOutProperty*/ ) const 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir return false; 198*cdf0e10cSrcweir } 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) 201*cdf0e10cSrcweir throw( uno::Exception ) 202*cdf0e10cSrcweir { 203*cdf0e10cSrcweir bool bChanged = false; 204*cdf0e10cSrcweir switch( nWhichId ) 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir case SCHATTR_AXIS: 207*cdf0e10cSrcweir { 208*cdf0e10cSrcweir sal_Int32 nItemValue = static_cast< const SfxInt32Item & >( 209*cdf0e10cSrcweir rItemSet.Get( nWhichId )).GetValue(); 210*cdf0e10cSrcweir bool bAttachToMainAxis = nItemValue == CHART_AXIS_PRIMARY_Y; 211*cdf0e10cSrcweir if( bAttachToMainAxis != m_bAttachToMainAxis ) 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir //change model: 214*cdf0e10cSrcweir bChanged = DiagramHelper::attachSeriesToAxis( bAttachToMainAxis, uno::Reference< XDataSeries >::query( GetPropertySet() ) 215*cdf0e10cSrcweir , ChartModelHelper::findDiagram(m_xChartModel), m_xCC ); 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir if( bChanged ) 218*cdf0e10cSrcweir m_bAttachToMainAxis = bAttachToMainAxis; 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir break; 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir case SCHATTR_BAR_OVERLAP: 224*cdf0e10cSrcweir case SCHATTR_BAR_GAPWIDTH: 225*cdf0e10cSrcweir { 226*cdf0e10cSrcweir if( m_bSupportingOverlapAndGapWidthProperties ) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir sal_Int32& rBarPosition = ( SCHATTR_BAR_OVERLAP == nWhichId ) ? m_nBarOverlap : m_nGapWidth; 229*cdf0e10cSrcweir rBarPosition = static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue(); 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir rtl::OUString aPropName( C2U( "GapwidthSequence" ) ); 232*cdf0e10cSrcweir if( SCHATTR_BAR_OVERLAP == nWhichId ) 233*cdf0e10cSrcweir aPropName = C2U( "OverlapSequence" ); 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir uno::Reference< XDataSeries > xDataSeries( GetPropertySet(), uno::UNO_QUERY ); 236*cdf0e10cSrcweir uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram(m_xChartModel) ); 237*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xChartTypeProps( DiagramHelper::getChartTypeOfSeries( xDiagram , xDataSeries ), uno::UNO_QUERY ); 238*cdf0e10cSrcweir if( xChartTypeProps.is() ) 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir sal_Int32 nAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries); 241*cdf0e10cSrcweir uno::Sequence< sal_Int32 > m_aBarPositionSequence; 242*cdf0e10cSrcweir if( xChartTypeProps.is() ) 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir if( xChartTypeProps->getPropertyValue( aPropName ) >>= m_aBarPositionSequence ) 245*cdf0e10cSrcweir { 246*cdf0e10cSrcweir bool bGroupBarsPerAxis = static_cast< const SfxBoolItem & >(rItemSet.Get( SCHATTR_GROUP_BARS_PER_AXIS )).GetValue(); 247*cdf0e10cSrcweir if(!bGroupBarsPerAxis) 248*cdf0e10cSrcweir { 249*cdf0e10cSrcweir //set the same value for all axes 250*cdf0e10cSrcweir for( sal_Int32 nN = 0; nN < m_aBarPositionSequence.getLength(); nN++ ) 251*cdf0e10cSrcweir m_aBarPositionSequence[nN] = rBarPosition; 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir else if( nAxisIndex >= 0 && nAxisIndex < m_aBarPositionSequence.getLength() ) 254*cdf0e10cSrcweir m_aBarPositionSequence[nAxisIndex] = rBarPosition; 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir xChartTypeProps->setPropertyValue( aPropName, uno::makeAny(m_aBarPositionSequence) ); 257*cdf0e10cSrcweir bChanged = true; 258*cdf0e10cSrcweir } 259*cdf0e10cSrcweir } 260*cdf0e10cSrcweir } 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir break; 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir case SCHATTR_BAR_CONNECT: 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir sal_Bool bOldConnectBars = sal_False; 268*cdf0e10cSrcweir m_bConnectBars = static_cast< const SfxBoolItem & >( 269*cdf0e10cSrcweir rItemSet.Get( nWhichId )).GetValue(); 270*cdf0e10cSrcweir if( m_bSupportingBarConnectors ) 271*cdf0e10cSrcweir { 272*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY ); 273*cdf0e10cSrcweir if( xDiagramProperties.is() && 274*cdf0e10cSrcweir (xDiagramProperties->getPropertyValue( C2U("ConnectBars")) >>= bOldConnectBars) && 275*cdf0e10cSrcweir bOldConnectBars != m_bConnectBars ) 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir xDiagramProperties->setPropertyValue( C2U("ConnectBars"), uno::makeAny(m_bConnectBars) ); 278*cdf0e10cSrcweir bChanged = true; 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir } 282*cdf0e10cSrcweir break; 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir case SCHATTR_GROUP_BARS_PER_AXIS: 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir bool bOldGroupBarsPerAxis = true; 287*cdf0e10cSrcweir m_bGroupBarsPerAxis = static_cast< const SfxBoolItem & >( 288*cdf0e10cSrcweir rItemSet.Get( nWhichId )).GetValue(); 289*cdf0e10cSrcweir if( m_bSupportingAxisSideBySide ) 290*cdf0e10cSrcweir { 291*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY ); 292*cdf0e10cSrcweir if( xDiagramProperties.is() && 293*cdf0e10cSrcweir (xDiagramProperties->getPropertyValue( C2U("GroupBarsPerAxis")) >>= bOldGroupBarsPerAxis) && 294*cdf0e10cSrcweir bOldGroupBarsPerAxis != m_bGroupBarsPerAxis ) 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir xDiagramProperties->setPropertyValue( C2U("GroupBarsPerAxis"), uno::makeAny(m_bGroupBarsPerAxis) ); 297*cdf0e10cSrcweir bChanged = true; 298*cdf0e10cSrcweir } 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir } 301*cdf0e10cSrcweir break; 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir case SCHATTR_STARTING_ANGLE: 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir if( m_bSupportingStartingAngle ) 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir m_nStartingAngle = static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue(); 308*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY ); 309*cdf0e10cSrcweir if( xDiagramProperties.is() ) 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir xDiagramProperties->setPropertyValue( C2U("StartingAngle"), uno::makeAny(m_nStartingAngle) ); 312*cdf0e10cSrcweir bChanged = true; 313*cdf0e10cSrcweir } 314*cdf0e10cSrcweir } 315*cdf0e10cSrcweir } 316*cdf0e10cSrcweir break; 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir case SCHATTR_CLOCKWISE: 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir bool bClockwise = (static_cast< const SfxBoolItem & >( 321*cdf0e10cSrcweir rItemSet.Get( nWhichId )).GetValue() ); 322*cdf0e10cSrcweir if( m_xCooSys.is() ) 323*cdf0e10cSrcweir { 324*cdf0e10cSrcweir uno::Reference< chart2::XAxis > xAxis( AxisHelper::getAxis( 1, 0, m_xCooSys ) ); 325*cdf0e10cSrcweir if( xAxis.is() ) 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir chart2::ScaleData aScaleData( xAxis->getScaleData() ); 328*cdf0e10cSrcweir aScaleData.Orientation = bClockwise ? chart2::AxisOrientation_REVERSE : chart2::AxisOrientation_MATHEMATICAL; 329*cdf0e10cSrcweir xAxis->setScaleData( aScaleData ); 330*cdf0e10cSrcweir bChanged = true; 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir } 333*cdf0e10cSrcweir } 334*cdf0e10cSrcweir break; 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir case SCHATTR_MISSING_VALUE_TREATMENT: 337*cdf0e10cSrcweir { 338*cdf0e10cSrcweir if( m_aSupportedMissingValueTreatments.getLength() ) 339*cdf0e10cSrcweir { 340*cdf0e10cSrcweir sal_Int32 nNew = static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue(); 341*cdf0e10cSrcweir if( m_nMissingValueTreatment != nNew ) 342*cdf0e10cSrcweir { 343*cdf0e10cSrcweir try 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY ); 346*cdf0e10cSrcweir if( xDiagramProperties.is() ) 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir xDiagramProperties->setPropertyValue( C2U( "MissingValueTreatment" ), uno::makeAny( nNew )); 349*cdf0e10cSrcweir bChanged = true; 350*cdf0e10cSrcweir } 351*cdf0e10cSrcweir } 352*cdf0e10cSrcweir catch( uno::Exception& e ) 353*cdf0e10cSrcweir { 354*cdf0e10cSrcweir ASSERT_EXCEPTION( e ); 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir } 357*cdf0e10cSrcweir } 358*cdf0e10cSrcweir } 359*cdf0e10cSrcweir break; 360*cdf0e10cSrcweir case SCHATTR_INCLUDE_HIDDEN_CELLS: 361*cdf0e10cSrcweir { 362*cdf0e10cSrcweir if( m_bSupportingPlottingOfHiddenCells ) 363*cdf0e10cSrcweir { 364*cdf0e10cSrcweir bool bIncludeHiddenCells = static_cast<const SfxBoolItem &>(rItemSet.Get(nWhichId)).GetValue(); 365*cdf0e10cSrcweir if (bIncludeHiddenCells != m_bIncludeHiddenCells) 366*cdf0e10cSrcweir bChanged = ChartModelHelper::setIncludeHiddenCells( bIncludeHiddenCells, m_xChartModel ); 367*cdf0e10cSrcweir } 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir break; 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir return bChanged; 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir void SeriesOptionsItemConverter::FillSpecialItem( 375*cdf0e10cSrcweir sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const 376*cdf0e10cSrcweir throw( uno::Exception ) 377*cdf0e10cSrcweir { 378*cdf0e10cSrcweir switch( nWhichId ) 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir case SCHATTR_AXIS: 381*cdf0e10cSrcweir { 382*cdf0e10cSrcweir sal_Int32 nItemValue = m_bAttachToMainAxis ? CHART_AXIS_PRIMARY_Y : CHART_AXIS_SECONDARY_Y; 383*cdf0e10cSrcweir rOutItemSet.Put( SfxInt32Item(nWhichId,nItemValue ) ); 384*cdf0e10cSrcweir break; 385*cdf0e10cSrcweir } 386*cdf0e10cSrcweir case SCHATTR_BAR_OVERLAP: 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir if( m_bSupportingOverlapAndGapWidthProperties ) 389*cdf0e10cSrcweir rOutItemSet.Put( SfxInt32Item(nWhichId,m_nBarOverlap) ); 390*cdf0e10cSrcweir break; 391*cdf0e10cSrcweir } 392*cdf0e10cSrcweir case SCHATTR_BAR_GAPWIDTH: 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir if( m_bSupportingOverlapAndGapWidthProperties ) 395*cdf0e10cSrcweir rOutItemSet.Put( SfxInt32Item(nWhichId,m_nGapWidth) ); 396*cdf0e10cSrcweir break; 397*cdf0e10cSrcweir } 398*cdf0e10cSrcweir case SCHATTR_BAR_CONNECT: 399*cdf0e10cSrcweir { 400*cdf0e10cSrcweir if( m_bSupportingBarConnectors ) 401*cdf0e10cSrcweir rOutItemSet.Put( SfxBoolItem(nWhichId,m_bConnectBars)); 402*cdf0e10cSrcweir break; 403*cdf0e10cSrcweir } 404*cdf0e10cSrcweir case SCHATTR_GROUP_BARS_PER_AXIS: 405*cdf0e10cSrcweir { 406*cdf0e10cSrcweir if( m_bSupportingAxisSideBySide ) 407*cdf0e10cSrcweir rOutItemSet.Put( SfxBoolItem(nWhichId,m_bGroupBarsPerAxis) ); 408*cdf0e10cSrcweir break; 409*cdf0e10cSrcweir } 410*cdf0e10cSrcweir case SCHATTR_AXIS_FOR_ALL_SERIES: 411*cdf0e10cSrcweir { 412*cdf0e10cSrcweir if( m_nAllSeriesAxisIndex != - 1) 413*cdf0e10cSrcweir rOutItemSet.Put( SfxInt32Item(nWhichId, m_nAllSeriesAxisIndex)); 414*cdf0e10cSrcweir break; 415*cdf0e10cSrcweir } 416*cdf0e10cSrcweir case SCHATTR_STARTING_ANGLE: 417*cdf0e10cSrcweir { 418*cdf0e10cSrcweir if( m_bSupportingStartingAngle ) 419*cdf0e10cSrcweir rOutItemSet.Put( SfxInt32Item(nWhichId,m_nStartingAngle)); 420*cdf0e10cSrcweir break; 421*cdf0e10cSrcweir } 422*cdf0e10cSrcweir case SCHATTR_CLOCKWISE: 423*cdf0e10cSrcweir { 424*cdf0e10cSrcweir rOutItemSet.Put( SfxBoolItem(nWhichId,m_bClockwise) ); 425*cdf0e10cSrcweir break; 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir case SCHATTR_MISSING_VALUE_TREATMENT: 428*cdf0e10cSrcweir { 429*cdf0e10cSrcweir if( m_aSupportedMissingValueTreatments.getLength() ) 430*cdf0e10cSrcweir rOutItemSet.Put( SfxInt32Item( nWhichId, m_nMissingValueTreatment )); 431*cdf0e10cSrcweir break; 432*cdf0e10cSrcweir } 433*cdf0e10cSrcweir case SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS: 434*cdf0e10cSrcweir { 435*cdf0e10cSrcweir SvULongs aList; 436*cdf0e10cSrcweir for ( sal_Int32 nN=0; nN<m_aSupportedMissingValueTreatments.getLength(); nN++ ) 437*cdf0e10cSrcweir aList.Insert( m_aSupportedMissingValueTreatments[nN], sal::static_int_cast< sal_uInt16 >(nN) ); 438*cdf0e10cSrcweir rOutItemSet.Put( SfxIntegerListItem( nWhichId, aList ) ); 439*cdf0e10cSrcweir break; 440*cdf0e10cSrcweir } 441*cdf0e10cSrcweir case SCHATTR_INCLUDE_HIDDEN_CELLS: 442*cdf0e10cSrcweir { 443*cdf0e10cSrcweir if( m_bSupportingPlottingOfHiddenCells ) 444*cdf0e10cSrcweir rOutItemSet.Put( SfxBoolItem(nWhichId, m_bIncludeHiddenCells) ); 445*cdf0e10cSrcweir break; 446*cdf0e10cSrcweir } 447*cdf0e10cSrcweir default: 448*cdf0e10cSrcweir break; 449*cdf0e10cSrcweir } 450*cdf0e10cSrcweir } 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir } // namespace wrapper 453*cdf0e10cSrcweir } // namespace chart 454