xref: /AOO41X/main/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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 #include "AxisItemConverter.hxx"
31*cdf0e10cSrcweir #include "ItemPropertyMap.hxx"
32*cdf0e10cSrcweir #include "CharacterPropertyItemConverter.hxx"
33*cdf0e10cSrcweir #include "GraphicPropertyItemConverter.hxx"
34*cdf0e10cSrcweir #include "chartview/ChartSfxItemIds.hxx"
35*cdf0e10cSrcweir #include "chartview/ExplicitValueProvider.hxx"
36*cdf0e10cSrcweir #include "SchWhichPairs.hxx"
37*cdf0e10cSrcweir #include "macros.hxx"
38*cdf0e10cSrcweir #include "ChartModelHelper.hxx"
39*cdf0e10cSrcweir #include "AxisHelper.hxx"
40*cdf0e10cSrcweir #include "CommonConverters.hxx"
41*cdf0e10cSrcweir #include "ChartTypeHelper.hxx"
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir #include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
45*cdf0e10cSrcweir #include <com/sun/star/chart/ChartAxisPosition.hpp>
46*cdf0e10cSrcweir #include <com/sun/star/chart2/XAxis.hpp>
47*cdf0e10cSrcweir #include <com/sun/star/chart2/AxisOrientation.hpp>
48*cdf0e10cSrcweir #include <com/sun/star/chart2/AxisType.hpp>
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir // for SfxBoolItem
51*cdf0e10cSrcweir #include <svl/eitem.hxx>
52*cdf0e10cSrcweir // for SvxDoubleItem
53*cdf0e10cSrcweir #include <svx/chrtitem.hxx>
54*cdf0e10cSrcweir // for SfxInt32Item
55*cdf0e10cSrcweir #include <svl/intitem.hxx>
56*cdf0e10cSrcweir #include <rtl/math.hxx>
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir #include <algorithm>
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir using namespace ::com::sun::star;
61*cdf0e10cSrcweir using namespace ::com::sun::star::chart2;
62*cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
63*cdf0e10cSrcweir using ::com::sun::star::chart::TimeInterval;
64*cdf0e10cSrcweir using ::com::sun::star::chart::TimeIncrement;
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir namespace
67*cdf0e10cSrcweir {
68*cdf0e10cSrcweir ::comphelper::ItemPropertyMapType & lcl_GetAxisPropertyMap()
69*cdf0e10cSrcweir {
70*cdf0e10cSrcweir     static ::comphelper::ItemPropertyMapType aAxisPropertyMap(
71*cdf0e10cSrcweir         ::comphelper::MakeItemPropertyMap
72*cdf0e10cSrcweir         IPM_MAP_ENTRY( SCHATTR_AXIS_SHOWDESCR,     "DisplayLabels",    0 )
73*cdf0e10cSrcweir         IPM_MAP_ENTRY( SCHATTR_AXIS_TICKS,         "MajorTickmarks",   0 )
74*cdf0e10cSrcweir         IPM_MAP_ENTRY( SCHATTR_AXIS_HELPTICKS,     "MinorTickmarks",   0 )
75*cdf0e10cSrcweir         IPM_MAP_ENTRY( SCHATTR_AXIS_LABEL_ORDER,   "ArrangeOrder",     0 )
76*cdf0e10cSrcweir         IPM_MAP_ENTRY( SCHATTR_TEXT_STACKED,       "StackCharacters",  0 )
77*cdf0e10cSrcweir         IPM_MAP_ENTRY( SCHATTR_AXIS_LABEL_BREAK,   "TextBreak",        0 )
78*cdf0e10cSrcweir         IPM_MAP_ENTRY( SCHATTR_AXIS_LABEL_OVERLAP, "TextOverlap",      0 )
79*cdf0e10cSrcweir         );
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir     return aAxisPropertyMap;
82*cdf0e10cSrcweir };
83*cdf0e10cSrcweir } // anonymous namespace
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir namespace chart
86*cdf0e10cSrcweir {
87*cdf0e10cSrcweir namespace wrapper
88*cdf0e10cSrcweir {
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir AxisItemConverter::AxisItemConverter(
91*cdf0e10cSrcweir     const Reference< beans::XPropertySet > & rPropertySet,
92*cdf0e10cSrcweir     SfxItemPool& rItemPool,
93*cdf0e10cSrcweir     SdrModel& rDrawModel,
94*cdf0e10cSrcweir     const Reference< chart2::XChartDocument > & xChartDoc,
95*cdf0e10cSrcweir     ::chart::ExplicitScaleData * pScale /* = NULL */,
96*cdf0e10cSrcweir     ::chart::ExplicitIncrementData * pIncrement /* = NULL */,
97*cdf0e10cSrcweir     ::std::auto_ptr< awt::Size > pRefSize /* = NULL */ ) :
98*cdf0e10cSrcweir         ItemConverter( rPropertySet, rItemPool ),
99*cdf0e10cSrcweir         m_xChartDoc( xChartDoc ),
100*cdf0e10cSrcweir         m_pExplicitScale( NULL ),
101*cdf0e10cSrcweir         m_pExplicitIncrement( NULL )
102*cdf0e10cSrcweir {
103*cdf0e10cSrcweir     Reference< lang::XMultiServiceFactory > xNamedPropertyContainerFactory( xChartDoc, uno::UNO_QUERY );
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir     if( pScale )
106*cdf0e10cSrcweir         m_pExplicitScale = new ::chart::ExplicitScaleData( *pScale );
107*cdf0e10cSrcweir     if( pIncrement )
108*cdf0e10cSrcweir         m_pExplicitIncrement = new ::chart::ExplicitIncrementData( *pIncrement );
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir     m_aConverters.push_back( new GraphicPropertyItemConverter(
111*cdf0e10cSrcweir                                  rPropertySet, rItemPool, rDrawModel,
112*cdf0e10cSrcweir                                  xNamedPropertyContainerFactory,
113*cdf0e10cSrcweir                                  GraphicPropertyItemConverter::LINE_PROPERTIES ));
114*cdf0e10cSrcweir     m_aConverters.push_back( new CharacterPropertyItemConverter( rPropertySet, rItemPool, pRefSize,
115*cdf0e10cSrcweir                                                                  C2U( "ReferencePageSize" ) ));
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir     m_xAxis.set( Reference< chart2::XAxis >( rPropertySet, uno::UNO_QUERY ) );
118*cdf0e10cSrcweir     OSL_ASSERT( m_xAxis.is());
119*cdf0e10cSrcweir }
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir AxisItemConverter::~AxisItemConverter()
122*cdf0e10cSrcweir {
123*cdf0e10cSrcweir     delete m_pExplicitScale;
124*cdf0e10cSrcweir     delete m_pExplicitIncrement;
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir     ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
127*cdf0e10cSrcweir                      ::comphelper::DeleteItemConverterPtr() );
128*cdf0e10cSrcweir }
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir void AxisItemConverter::FillItemSet( SfxItemSet & rOutItemSet ) const
131*cdf0e10cSrcweir {
132*cdf0e10cSrcweir     ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
133*cdf0e10cSrcweir                      ::comphelper::FillItemSetFunc( rOutItemSet ));
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir     // own items
136*cdf0e10cSrcweir     ItemConverter::FillItemSet( rOutItemSet );
137*cdf0e10cSrcweir }
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir bool AxisItemConverter::ApplyItemSet( const SfxItemSet & rItemSet )
140*cdf0e10cSrcweir {
141*cdf0e10cSrcweir     bool bResult = false;
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir     ::std::for_each( m_aConverters.begin(), m_aConverters.end(),
144*cdf0e10cSrcweir                      ::comphelper::ApplyItemSetFunc( rItemSet, bResult ));
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir     // own items
147*cdf0e10cSrcweir     return ItemConverter::ApplyItemSet( rItemSet ) || bResult;
148*cdf0e10cSrcweir }
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir const sal_uInt16 * AxisItemConverter::GetWhichPairs() const
151*cdf0e10cSrcweir {
152*cdf0e10cSrcweir     // must span all used items!
153*cdf0e10cSrcweir     return nAxisWhichPairs;
154*cdf0e10cSrcweir }
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir bool AxisItemConverter::GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const
157*cdf0e10cSrcweir {
158*cdf0e10cSrcweir     ::comphelper::ItemPropertyMapType & rMap( lcl_GetAxisPropertyMap());
159*cdf0e10cSrcweir     ::comphelper::ItemPropertyMapType::const_iterator aIt( rMap.find( nWhichId ));
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir     if( aIt == rMap.end())
162*cdf0e10cSrcweir         return false;
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir     rOutProperty =(*aIt).second;
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir     return true;
167*cdf0e10cSrcweir }
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir bool lcl_hasTimeIntervalValue( const uno::Any& rAny )
170*cdf0e10cSrcweir {
171*cdf0e10cSrcweir     bool bRet = false;
172*cdf0e10cSrcweir     TimeInterval aValue;
173*cdf0e10cSrcweir     if( rAny >>= aValue )
174*cdf0e10cSrcweir         bRet = true;
175*cdf0e10cSrcweir     return bRet;
176*cdf0e10cSrcweir }
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
179*cdf0e10cSrcweir     throw( uno::Exception )
180*cdf0e10cSrcweir {
181*cdf0e10cSrcweir     if( !m_xAxis.is() )
182*cdf0e10cSrcweir         return;
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir     const chart2::ScaleData&     rScale( m_xAxis->getScaleData() );
185*cdf0e10cSrcweir     const chart2::IncrementData& rIncrement( rScale.IncrementData );
186*cdf0e10cSrcweir     const uno::Sequence< chart2::SubIncrement >& rSubIncrements( rScale.IncrementData.SubIncrements );
187*cdf0e10cSrcweir     const TimeIncrement& rTimeIncrement( rScale.TimeIncrement );
188*cdf0e10cSrcweir     bool bDateAxis = (chart2::AxisType::DATE == rScale.AxisType);
189*cdf0e10cSrcweir     if( m_pExplicitScale )
190*cdf0e10cSrcweir         bDateAxis = (chart2::AxisType::DATE == m_pExplicitScale->AxisType);
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir     switch( nWhichId )
193*cdf0e10cSrcweir     {
194*cdf0e10cSrcweir         case SCHATTR_AXIS_AUTO_MAX:
195*cdf0e10cSrcweir                 rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(rScale.Maximum) ) );
196*cdf0e10cSrcweir             break;
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir         case SCHATTR_AXIS_MAX:
199*cdf0e10cSrcweir             {
200*cdf0e10cSrcweir                 double fMax = 10.0;
201*cdf0e10cSrcweir                 if( rScale.Maximum >>= fMax )
202*cdf0e10cSrcweir                     rOutItemSet.Put( SvxDoubleItem( fMax, nWhichId ) );
203*cdf0e10cSrcweir                 else
204*cdf0e10cSrcweir                 {
205*cdf0e10cSrcweir                     if( m_pExplicitScale )
206*cdf0e10cSrcweir                         fMax = m_pExplicitScale->Maximum;
207*cdf0e10cSrcweir                     rOutItemSet.Put( SvxDoubleItem( fMax, nWhichId ) );
208*cdf0e10cSrcweir                 }
209*cdf0e10cSrcweir             }
210*cdf0e10cSrcweir             break;
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir         case SCHATTR_AXIS_AUTO_MIN:
213*cdf0e10cSrcweir                 rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(rScale.Minimum) ) );
214*cdf0e10cSrcweir             break;
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir         case SCHATTR_AXIS_MIN:
217*cdf0e10cSrcweir             {
218*cdf0e10cSrcweir                 double fMin = 0.0;
219*cdf0e10cSrcweir                 if( rScale.Minimum >>= fMin )
220*cdf0e10cSrcweir                     rOutItemSet.Put( SvxDoubleItem( fMin, nWhichId ) );
221*cdf0e10cSrcweir                 else if( m_pExplicitScale )
222*cdf0e10cSrcweir                     rOutItemSet.Put( SvxDoubleItem( m_pExplicitScale->Minimum, nWhichId ));
223*cdf0e10cSrcweir             }
224*cdf0e10cSrcweir             break;
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir         case SCHATTR_AXIS_LOGARITHM:
227*cdf0e10cSrcweir             {
228*cdf0e10cSrcweir                 sal_Bool bValue = AxisHelper::isLogarithmic( rScale.Scaling );
229*cdf0e10cSrcweir                 rOutItemSet.Put( SfxBoolItem( nWhichId, bValue ));
230*cdf0e10cSrcweir             }
231*cdf0e10cSrcweir             break;
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir         case SCHATTR_AXIS_REVERSE:
234*cdf0e10cSrcweir                 rOutItemSet.Put( SfxBoolItem( nWhichId, (AxisOrientation_REVERSE == rScale.Orientation) ));
235*cdf0e10cSrcweir             break;
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir         // Increment
238*cdf0e10cSrcweir         case SCHATTR_AXIS_AUTO_STEP_MAIN:
239*cdf0e10cSrcweir             if( bDateAxis )
240*cdf0e10cSrcweir                 rOutItemSet.Put( SfxBoolItem( nWhichId, !lcl_hasTimeIntervalValue(rTimeIncrement.MajorTimeInterval) ) );
241*cdf0e10cSrcweir             else
242*cdf0e10cSrcweir                 rOutItemSet.Put( SfxBoolItem( nWhichId, !hasDoubleValue(rIncrement.Distance) ) );
243*cdf0e10cSrcweir             break;
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir         case SCHATTR_AXIS_MAIN_TIME_UNIT:
246*cdf0e10cSrcweir             {
247*cdf0e10cSrcweir                 TimeInterval aTimeInterval;
248*cdf0e10cSrcweir                 if( rTimeIncrement.MajorTimeInterval >>= aTimeInterval )
249*cdf0e10cSrcweir                     rOutItemSet.Put( SfxInt32Item( nWhichId, aTimeInterval.TimeUnit ) );
250*cdf0e10cSrcweir                 else if( m_pExplicitIncrement )
251*cdf0e10cSrcweir                     rOutItemSet.Put( SfxInt32Item( nWhichId, m_pExplicitIncrement->MajorTimeInterval.TimeUnit ) );
252*cdf0e10cSrcweir             }
253*cdf0e10cSrcweir             break;
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir         case SCHATTR_AXIS_STEP_MAIN:
256*cdf0e10cSrcweir             if( bDateAxis )
257*cdf0e10cSrcweir             {
258*cdf0e10cSrcweir                 TimeInterval aTimeInterval;
259*cdf0e10cSrcweir                 if( rTimeIncrement.MajorTimeInterval >>= aTimeInterval )
260*cdf0e10cSrcweir                     rOutItemSet.Put( SvxDoubleItem(aTimeInterval.Number, nWhichId ));
261*cdf0e10cSrcweir                 else if( m_pExplicitIncrement )
262*cdf0e10cSrcweir                     rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->MajorTimeInterval.Number, nWhichId ));
263*cdf0e10cSrcweir             }
264*cdf0e10cSrcweir             else
265*cdf0e10cSrcweir             {
266*cdf0e10cSrcweir                 double fDistance = 1.0;
267*cdf0e10cSrcweir                 if( rIncrement.Distance >>= fDistance )
268*cdf0e10cSrcweir                     rOutItemSet.Put( SvxDoubleItem(fDistance, nWhichId ));
269*cdf0e10cSrcweir                 else if( m_pExplicitIncrement )
270*cdf0e10cSrcweir                     rOutItemSet.Put( SvxDoubleItem( m_pExplicitIncrement->Distance, nWhichId ));
271*cdf0e10cSrcweir             }
272*cdf0e10cSrcweir             break;
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir         // SubIncrement
275*cdf0e10cSrcweir         case SCHATTR_AXIS_AUTO_STEP_HELP:
276*cdf0e10cSrcweir             if( bDateAxis )
277*cdf0e10cSrcweir                 rOutItemSet.Put( SfxBoolItem( nWhichId, !lcl_hasTimeIntervalValue(rTimeIncrement.MinorTimeInterval) ) );
278*cdf0e10cSrcweir             else
279*cdf0e10cSrcweir                 rOutItemSet.Put( SfxBoolItem( nWhichId,
280*cdf0e10cSrcweir                     ! ( rSubIncrements.getLength() > 0 && rSubIncrements[0].IntervalCount.hasValue() )));
281*cdf0e10cSrcweir             break;
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir         case SCHATTR_AXIS_HELP_TIME_UNIT:
284*cdf0e10cSrcweir             {
285*cdf0e10cSrcweir                 TimeInterval aTimeInterval;
286*cdf0e10cSrcweir                 if( rTimeIncrement.MinorTimeInterval >>= aTimeInterval )
287*cdf0e10cSrcweir                     rOutItemSet.Put( SfxInt32Item( nWhichId, aTimeInterval.TimeUnit ) );
288*cdf0e10cSrcweir                 else if( m_pExplicitIncrement )
289*cdf0e10cSrcweir                     rOutItemSet.Put( SfxInt32Item( nWhichId, m_pExplicitIncrement->MinorTimeInterval.TimeUnit ) );
290*cdf0e10cSrcweir             }
291*cdf0e10cSrcweir             break;
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir         case SCHATTR_AXIS_STEP_HELP:
294*cdf0e10cSrcweir             if( bDateAxis )
295*cdf0e10cSrcweir             {
296*cdf0e10cSrcweir                 TimeInterval aTimeInterval;
297*cdf0e10cSrcweir                 if( rTimeIncrement.MinorTimeInterval >>= aTimeInterval )
298*cdf0e10cSrcweir                     rOutItemSet.Put( SfxInt32Item( nWhichId, aTimeInterval.Number ));
299*cdf0e10cSrcweir                 else if( m_pExplicitIncrement )
300*cdf0e10cSrcweir                     rOutItemSet.Put( SfxInt32Item( nWhichId, m_pExplicitIncrement->MinorTimeInterval.Number ));
301*cdf0e10cSrcweir             }
302*cdf0e10cSrcweir             else
303*cdf0e10cSrcweir             {
304*cdf0e10cSrcweir                 if( rSubIncrements.getLength() > 0 && rSubIncrements[0].IntervalCount.hasValue())
305*cdf0e10cSrcweir                 {
306*cdf0e10cSrcweir                     OSL_ASSERT( rSubIncrements[0].IntervalCount.getValueTypeClass() == uno::TypeClass_LONG );
307*cdf0e10cSrcweir                     rOutItemSet.Put( SfxInt32Item( nWhichId,
308*cdf0e10cSrcweir                             *reinterpret_cast< const sal_Int32 * >(
309*cdf0e10cSrcweir                                 rSubIncrements[0].IntervalCount.getValue()) ));
310*cdf0e10cSrcweir                 }
311*cdf0e10cSrcweir                 else
312*cdf0e10cSrcweir                 {
313*cdf0e10cSrcweir                     if( m_pExplicitIncrement && !m_pExplicitIncrement->SubIncrements.empty() )
314*cdf0e10cSrcweir                     {
315*cdf0e10cSrcweir                         rOutItemSet.Put( SfxInt32Item( nWhichId,
316*cdf0e10cSrcweir                                 m_pExplicitIncrement->SubIncrements[0].IntervalCount ));
317*cdf0e10cSrcweir                     }
318*cdf0e10cSrcweir                 }
319*cdf0e10cSrcweir             }
320*cdf0e10cSrcweir             break;
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir         case SCHATTR_AXIS_AUTO_TIME_RESOLUTION:
323*cdf0e10cSrcweir             {
324*cdf0e10cSrcweir                 rOutItemSet.Put( SfxBoolItem( nWhichId,
325*cdf0e10cSrcweir                         !rTimeIncrement.TimeResolution.hasValue() ));
326*cdf0e10cSrcweir             }
327*cdf0e10cSrcweir             break;
328*cdf0e10cSrcweir         case SCHATTR_AXIS_TIME_RESOLUTION:
329*cdf0e10cSrcweir             {
330*cdf0e10cSrcweir                 long nTimeResolution=0;
331*cdf0e10cSrcweir                 if( rTimeIncrement.TimeResolution >>= nTimeResolution )
332*cdf0e10cSrcweir                     rOutItemSet.Put( SfxInt32Item( nWhichId, nTimeResolution ) );
333*cdf0e10cSrcweir                 else if( m_pExplicitScale )
334*cdf0e10cSrcweir                     rOutItemSet.Put( SfxInt32Item( nWhichId, m_pExplicitScale->TimeResolution ) );
335*cdf0e10cSrcweir             }
336*cdf0e10cSrcweir             break;
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir         case SCHATTR_AXIS_AUTO_ORIGIN:
339*cdf0e10cSrcweir         {
340*cdf0e10cSrcweir             rOutItemSet.Put( SfxBoolItem( nWhichId, ( !hasDoubleValue(rScale.Origin) )));
341*cdf0e10cSrcweir         }
342*cdf0e10cSrcweir         break;
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir         case SCHATTR_AXIS_ORIGIN:
345*cdf0e10cSrcweir         {
346*cdf0e10cSrcweir             double fOrigin = 0.0;
347*cdf0e10cSrcweir             if( !(rScale.Origin >>= fOrigin) )
348*cdf0e10cSrcweir             {
349*cdf0e10cSrcweir                 if( m_pExplicitScale )
350*cdf0e10cSrcweir                     fOrigin = m_pExplicitScale->Origin;
351*cdf0e10cSrcweir             }
352*cdf0e10cSrcweir             rOutItemSet.Put( SvxDoubleItem( fOrigin, nWhichId ));
353*cdf0e10cSrcweir         }
354*cdf0e10cSrcweir         break;
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir         case SCHATTR_AXIS_POSITION:
357*cdf0e10cSrcweir         {
358*cdf0e10cSrcweir             ::com::sun::star::chart::ChartAxisPosition eAxisPos( ::com::sun::star::chart::ChartAxisPosition_ZERO );
359*cdf0e10cSrcweir             GetPropertySet()->getPropertyValue(C2U( "CrossoverPosition" )) >>= eAxisPos;
360*cdf0e10cSrcweir             rOutItemSet.Put( SfxInt32Item( nWhichId, eAxisPos ) );
361*cdf0e10cSrcweir         }
362*cdf0e10cSrcweir         break;
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir         case SCHATTR_AXIS_POSITION_VALUE:
365*cdf0e10cSrcweir         {
366*cdf0e10cSrcweir             double fValue = 0.0;
367*cdf0e10cSrcweir             if( GetPropertySet()->getPropertyValue(C2U( "CrossoverValue" )) >>= fValue )
368*cdf0e10cSrcweir                 rOutItemSet.Put( SvxDoubleItem( fValue, nWhichId ) );
369*cdf0e10cSrcweir         }
370*cdf0e10cSrcweir         break;
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir         case SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT:
373*cdf0e10cSrcweir         {
374*cdf0e10cSrcweir             //read only item
375*cdf0e10cSrcweir             //necessary tp display the crossing value with an appropriate format
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir             Reference< chart2::XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(
378*cdf0e10cSrcweir                 m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir             Reference< chart2::XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ) );
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir             sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
383*cdf0e10cSrcweir                 xCrossingMainAxis, xCooSys, Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ) );
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir             rOutItemSet.Put( SfxUInt32Item( nWhichId, nFormatKey ));
386*cdf0e10cSrcweir         }
387*cdf0e10cSrcweir         break;
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir         case SCHATTR_AXIS_LABEL_POSITION:
390*cdf0e10cSrcweir         {
391*cdf0e10cSrcweir             ::com::sun::star::chart::ChartAxisLabelPosition ePos( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS );
392*cdf0e10cSrcweir             GetPropertySet()->getPropertyValue(C2U( "LabelPosition" )) >>= ePos;
393*cdf0e10cSrcweir             rOutItemSet.Put( SfxInt32Item( nWhichId, ePos ) );
394*cdf0e10cSrcweir         }
395*cdf0e10cSrcweir         break;
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir         case SCHATTR_AXIS_MARK_POSITION:
398*cdf0e10cSrcweir         {
399*cdf0e10cSrcweir             ::com::sun::star::chart::ChartAxisMarkPosition ePos( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS );
400*cdf0e10cSrcweir             GetPropertySet()->getPropertyValue(C2U( "MarkPosition" )) >>= ePos;
401*cdf0e10cSrcweir             rOutItemSet.Put( SfxInt32Item( nWhichId, ePos ) );
402*cdf0e10cSrcweir         }
403*cdf0e10cSrcweir         break;
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir         case SCHATTR_TEXT_DEGREES:
406*cdf0e10cSrcweir         {
407*cdf0e10cSrcweir             // convert double to int (times 100)
408*cdf0e10cSrcweir             double fVal = 0;
409*cdf0e10cSrcweir 
410*cdf0e10cSrcweir             if( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fVal )
411*cdf0e10cSrcweir             {
412*cdf0e10cSrcweir                 rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >(
413*cdf0e10cSrcweir                                                    ::rtl::math::round( fVal * 100.0 ) ) ));
414*cdf0e10cSrcweir             }
415*cdf0e10cSrcweir         }
416*cdf0e10cSrcweir         break;
417*cdf0e10cSrcweir 
418*cdf0e10cSrcweir         case SID_ATTR_NUMBERFORMAT_VALUE:
419*cdf0e10cSrcweir         {
420*cdf0e10cSrcweir             if( m_pExplicitScale )
421*cdf0e10cSrcweir             {
422*cdf0e10cSrcweir                 Reference< chart2::XCoordinateSystem > xCooSys(
423*cdf0e10cSrcweir                         AxisHelper::getCoordinateSystemOfAxis(
424*cdf0e10cSrcweir                               m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir                 sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
427*cdf0e10cSrcweir                     m_xAxis, xCooSys, Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ) );
428*cdf0e10cSrcweir 
429*cdf0e10cSrcweir                 rOutItemSet.Put( SfxUInt32Item( nWhichId, nFormatKey ));
430*cdf0e10cSrcweir             }
431*cdf0e10cSrcweir         }
432*cdf0e10cSrcweir         break;
433*cdf0e10cSrcweir 
434*cdf0e10cSrcweir         case SID_ATTR_NUMBERFORMAT_SOURCE:
435*cdf0e10cSrcweir         {
436*cdf0e10cSrcweir             bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )).hasValue());
437*cdf0e10cSrcweir             rOutItemSet.Put( SfxBoolItem( nWhichId, ! bNumberFormatIsSet ));
438*cdf0e10cSrcweir         }
439*cdf0e10cSrcweir         break;
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir         case SCHATTR_AXISTYPE:
442*cdf0e10cSrcweir             rOutItemSet.Put( SfxInt32Item( nWhichId, rScale.AxisType ));
443*cdf0e10cSrcweir         break;
444*cdf0e10cSrcweir 
445*cdf0e10cSrcweir         case SCHATTR_AXIS_AUTO_DATEAXIS:
446*cdf0e10cSrcweir             rOutItemSet.Put( SfxBoolItem( nWhichId, rScale.AutoDateAxis ));
447*cdf0e10cSrcweir         break;
448*cdf0e10cSrcweir 
449*cdf0e10cSrcweir         case SCHATTR_AXIS_ALLOW_DATEAXIS:
450*cdf0e10cSrcweir         {
451*cdf0e10cSrcweir             Reference< chart2::XCoordinateSystem > xCooSys(
452*cdf0e10cSrcweir                 AxisHelper::getCoordinateSystemOfAxis( m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
453*cdf0e10cSrcweir             sal_Int32 nDimensionIndex=0; sal_Int32 nAxisIndex=0;
454*cdf0e10cSrcweir             AxisHelper::getIndicesForAxis(m_xAxis, xCooSys, nDimensionIndex, nAxisIndex );
455*cdf0e10cSrcweir             bool bChartTypeAllowsDateAxis = ChartTypeHelper::isSupportingDateAxis( AxisHelper::getChartTypeByIndex( xCooSys, 0 ), 2, nDimensionIndex );
456*cdf0e10cSrcweir             rOutItemSet.Put( SfxBoolItem( nWhichId, bChartTypeAllowsDateAxis ));
457*cdf0e10cSrcweir         }
458*cdf0e10cSrcweir         break;
459*cdf0e10cSrcweir     }
460*cdf0e10cSrcweir }
461*cdf0e10cSrcweir 
462*cdf0e10cSrcweir bool lcl_isDateAxis( const SfxItemSet & rItemSet )
463*cdf0e10cSrcweir {
464*cdf0e10cSrcweir     sal_Int32 nAxisType = static_cast< const SfxInt32Item & >( rItemSet.Get( SCHATTR_AXISTYPE )).GetValue();//::com::sun::star::chart2::AxisType
465*cdf0e10cSrcweir     return (chart2::AxisType::DATE == nAxisType);
466*cdf0e10cSrcweir }
467*cdf0e10cSrcweir 
468*cdf0e10cSrcweir bool lcl_isAutoMajor( const SfxItemSet & rItemSet )
469*cdf0e10cSrcweir {
470*cdf0e10cSrcweir     bool bRet = static_cast< const SfxBoolItem & >( rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_MAIN )).GetValue();
471*cdf0e10cSrcweir     return bRet;
472*cdf0e10cSrcweir }
473*cdf0e10cSrcweir 
474*cdf0e10cSrcweir bool lcl_isAutoMinor( const SfxItemSet & rItemSet )
475*cdf0e10cSrcweir {
476*cdf0e10cSrcweir     bool bRet = static_cast< const SfxBoolItem & >( rItemSet.Get( SCHATTR_AXIS_AUTO_STEP_HELP )).GetValue();
477*cdf0e10cSrcweir     return bRet;
478*cdf0e10cSrcweir }
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
481*cdf0e10cSrcweir     throw( uno::Exception )
482*cdf0e10cSrcweir {
483*cdf0e10cSrcweir     if( !m_xAxis.is() )
484*cdf0e10cSrcweir         return false;
485*cdf0e10cSrcweir 
486*cdf0e10cSrcweir     chart2::ScaleData     aScale( m_xAxis->getScaleData() );
487*cdf0e10cSrcweir 
488*cdf0e10cSrcweir     bool bSetScale    = false;
489*cdf0e10cSrcweir     bool bChangedOtherwise = false;
490*cdf0e10cSrcweir 
491*cdf0e10cSrcweir     uno::Any aValue;
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir     switch( nWhichId )
494*cdf0e10cSrcweir     {
495*cdf0e10cSrcweir         case SCHATTR_AXIS_AUTO_MAX:
496*cdf0e10cSrcweir             if( (static_cast< const SfxBoolItem & >(
497*cdf0e10cSrcweir                      rItemSet.Get( nWhichId )).GetValue() ))
498*cdf0e10cSrcweir             {
499*cdf0e10cSrcweir                 aScale.Maximum.clear();
500*cdf0e10cSrcweir                 bSetScale = true;
501*cdf0e10cSrcweir             }
502*cdf0e10cSrcweir             // else SCHATTR_AXIS_MAX must have some value
503*cdf0e10cSrcweir             break;
504*cdf0e10cSrcweir 
505*cdf0e10cSrcweir         case SCHATTR_AXIS_MAX:
506*cdf0e10cSrcweir             // only if auto if false
507*cdf0e10cSrcweir             if( ! (static_cast< const SfxBoolItem & >(
508*cdf0e10cSrcweir                        rItemSet.Get( SCHATTR_AXIS_AUTO_MAX )).GetValue() ))
509*cdf0e10cSrcweir             {
510*cdf0e10cSrcweir                 rItemSet.Get( nWhichId ).QueryValue( aValue );
511*cdf0e10cSrcweir 
512*cdf0e10cSrcweir                 if( aScale.Maximum != aValue )
513*cdf0e10cSrcweir                 {
514*cdf0e10cSrcweir                     aScale.Maximum = aValue;
515*cdf0e10cSrcweir                     bSetScale = true;
516*cdf0e10cSrcweir                 }
517*cdf0e10cSrcweir             }
518*cdf0e10cSrcweir             break;
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir         case SCHATTR_AXIS_AUTO_MIN:
521*cdf0e10cSrcweir             if( (static_cast< const SfxBoolItem & >(
522*cdf0e10cSrcweir                      rItemSet.Get( nWhichId )).GetValue() ))
523*cdf0e10cSrcweir             {
524*cdf0e10cSrcweir                 aScale.Minimum.clear();
525*cdf0e10cSrcweir                 bSetScale = true;
526*cdf0e10cSrcweir             }
527*cdf0e10cSrcweir             // else SCHATTR_AXIS_MIN must have some value
528*cdf0e10cSrcweir             break;
529*cdf0e10cSrcweir 
530*cdf0e10cSrcweir         case SCHATTR_AXIS_MIN:
531*cdf0e10cSrcweir             // only if auto if false
532*cdf0e10cSrcweir             if( ! (static_cast< const SfxBoolItem & >(
533*cdf0e10cSrcweir                        rItemSet.Get( SCHATTR_AXIS_AUTO_MIN )).GetValue() ))
534*cdf0e10cSrcweir             {
535*cdf0e10cSrcweir                 rItemSet.Get( nWhichId ).QueryValue( aValue );
536*cdf0e10cSrcweir 
537*cdf0e10cSrcweir                 if( aScale.Minimum != aValue )
538*cdf0e10cSrcweir                 {
539*cdf0e10cSrcweir                     aScale.Minimum = aValue;
540*cdf0e10cSrcweir                     bSetScale = true;
541*cdf0e10cSrcweir                 }
542*cdf0e10cSrcweir             }
543*cdf0e10cSrcweir             break;
544*cdf0e10cSrcweir 
545*cdf0e10cSrcweir         case SCHATTR_AXIS_LOGARITHM:
546*cdf0e10cSrcweir         {
547*cdf0e10cSrcweir             bool bWasLogarithm = AxisHelper::isLogarithmic( aScale.Scaling );
548*cdf0e10cSrcweir 
549*cdf0e10cSrcweir             if( (static_cast< const SfxBoolItem & >(
550*cdf0e10cSrcweir                      rItemSet.Get( nWhichId )).GetValue() ))
551*cdf0e10cSrcweir             {
552*cdf0e10cSrcweir                 // logarithm is true
553*cdf0e10cSrcweir                 if( ! bWasLogarithm )
554*cdf0e10cSrcweir                 {
555*cdf0e10cSrcweir                     aScale.Scaling = AxisHelper::createLogarithmicScaling( 10.0 );
556*cdf0e10cSrcweir                     bSetScale = true;
557*cdf0e10cSrcweir                 }
558*cdf0e10cSrcweir             }
559*cdf0e10cSrcweir             else
560*cdf0e10cSrcweir             {
561*cdf0e10cSrcweir                 // logarithm is false => linear scaling
562*cdf0e10cSrcweir                 if( bWasLogarithm )
563*cdf0e10cSrcweir                 {
564*cdf0e10cSrcweir                     aScale.Scaling = AxisHelper::createLinearScaling();
565*cdf0e10cSrcweir                     bSetScale = true;
566*cdf0e10cSrcweir                 }
567*cdf0e10cSrcweir             }
568*cdf0e10cSrcweir         }
569*cdf0e10cSrcweir         break;
570*cdf0e10cSrcweir 
571*cdf0e10cSrcweir         case SCHATTR_AXIS_REVERSE:
572*cdf0e10cSrcweir         {
573*cdf0e10cSrcweir             bool bWasReverse = ( AxisOrientation_REVERSE == aScale.Orientation );
574*cdf0e10cSrcweir             bool bNewReverse = (static_cast< const SfxBoolItem & >(
575*cdf0e10cSrcweir                      rItemSet.Get( nWhichId )).GetValue() );
576*cdf0e10cSrcweir             if( bWasReverse != bNewReverse )
577*cdf0e10cSrcweir             {
578*cdf0e10cSrcweir                 aScale.Orientation = bNewReverse ? AxisOrientation_REVERSE : AxisOrientation_MATHEMATICAL;
579*cdf0e10cSrcweir                 bSetScale = true;
580*cdf0e10cSrcweir             }
581*cdf0e10cSrcweir         }
582*cdf0e10cSrcweir         break;
583*cdf0e10cSrcweir 
584*cdf0e10cSrcweir         // Increment
585*cdf0e10cSrcweir         case SCHATTR_AXIS_AUTO_STEP_MAIN:
586*cdf0e10cSrcweir             if( lcl_isAutoMajor(rItemSet) )
587*cdf0e10cSrcweir             {
588*cdf0e10cSrcweir                 aScale.IncrementData.Distance.clear();
589*cdf0e10cSrcweir                 aScale.TimeIncrement.MajorTimeInterval.clear();
590*cdf0e10cSrcweir                 bSetScale = true;
591*cdf0e10cSrcweir             }
592*cdf0e10cSrcweir             // else SCHATTR_AXIS_STEP_MAIN must have some value
593*cdf0e10cSrcweir             break;
594*cdf0e10cSrcweir 
595*cdf0e10cSrcweir         case SCHATTR_AXIS_MAIN_TIME_UNIT:
596*cdf0e10cSrcweir             if( !lcl_isAutoMajor(rItemSet) )
597*cdf0e10cSrcweir             {
598*cdf0e10cSrcweir                 if( rItemSet.Get( nWhichId ).QueryValue( aValue ) )
599*cdf0e10cSrcweir                 {
600*cdf0e10cSrcweir                     TimeInterval aTimeInterval;
601*cdf0e10cSrcweir                     aScale.TimeIncrement.MajorTimeInterval >>= aTimeInterval;
602*cdf0e10cSrcweir                     aValue >>= aTimeInterval.TimeUnit;
603*cdf0e10cSrcweir                     aScale.TimeIncrement.MajorTimeInterval = uno::makeAny( aTimeInterval );
604*cdf0e10cSrcweir                     bSetScale = true;
605*cdf0e10cSrcweir                 }
606*cdf0e10cSrcweir             }
607*cdf0e10cSrcweir             break;
608*cdf0e10cSrcweir 
609*cdf0e10cSrcweir         case SCHATTR_AXIS_STEP_MAIN:
610*cdf0e10cSrcweir             // only if auto if false
611*cdf0e10cSrcweir             if( !lcl_isAutoMajor(rItemSet) )
612*cdf0e10cSrcweir             {
613*cdf0e10cSrcweir                 rItemSet.Get( nWhichId ).QueryValue( aValue );
614*cdf0e10cSrcweir                 if( lcl_isDateAxis(rItemSet) )
615*cdf0e10cSrcweir                 {
616*cdf0e10cSrcweir                     double fValue = 1.0;
617*cdf0e10cSrcweir                     if( aValue >>= fValue )
618*cdf0e10cSrcweir                     {
619*cdf0e10cSrcweir                         TimeInterval aTimeInterval;
620*cdf0e10cSrcweir                         aScale.TimeIncrement.MajorTimeInterval >>= aTimeInterval;
621*cdf0e10cSrcweir                         aTimeInterval.Number = static_cast<sal_Int32>(fValue);
622*cdf0e10cSrcweir                         aScale.TimeIncrement.MajorTimeInterval = uno::makeAny( aTimeInterval );
623*cdf0e10cSrcweir                         bSetScale = true;
624*cdf0e10cSrcweir                     }
625*cdf0e10cSrcweir                 }
626*cdf0e10cSrcweir                 else if( aScale.IncrementData.Distance != aValue )
627*cdf0e10cSrcweir                 {
628*cdf0e10cSrcweir                     aScale.IncrementData.Distance = aValue;
629*cdf0e10cSrcweir                     bSetScale = true;
630*cdf0e10cSrcweir                 }
631*cdf0e10cSrcweir             }
632*cdf0e10cSrcweir             break;
633*cdf0e10cSrcweir 
634*cdf0e10cSrcweir         // SubIncrement
635*cdf0e10cSrcweir         case SCHATTR_AXIS_AUTO_STEP_HELP:
636*cdf0e10cSrcweir             if( lcl_isAutoMinor(rItemSet) )
637*cdf0e10cSrcweir             {
638*cdf0e10cSrcweir                 if( aScale.IncrementData.SubIncrements.getLength() > 0 &&
639*cdf0e10cSrcweir                     aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() )
640*cdf0e10cSrcweir                 {
641*cdf0e10cSrcweir                         aScale.IncrementData.SubIncrements[0].IntervalCount.clear();
642*cdf0e10cSrcweir                         bSetScale = true;
643*cdf0e10cSrcweir                 }
644*cdf0e10cSrcweir                 if( aScale.TimeIncrement.MinorTimeInterval.hasValue() )
645*cdf0e10cSrcweir                 {
646*cdf0e10cSrcweir                     aScale.TimeIncrement.MinorTimeInterval.clear();
647*cdf0e10cSrcweir                     bSetScale = true;
648*cdf0e10cSrcweir                 }
649*cdf0e10cSrcweir             }
650*cdf0e10cSrcweir             // else SCHATTR_AXIS_STEP_MAIN must have some value
651*cdf0e10cSrcweir             break;
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir         case SCHATTR_AXIS_HELP_TIME_UNIT:
654*cdf0e10cSrcweir             if( !lcl_isAutoMinor(rItemSet) )
655*cdf0e10cSrcweir             {
656*cdf0e10cSrcweir                 if( rItemSet.Get( nWhichId ).QueryValue( aValue ) )
657*cdf0e10cSrcweir                 {
658*cdf0e10cSrcweir                     TimeInterval aTimeInterval;
659*cdf0e10cSrcweir                     aScale.TimeIncrement.MinorTimeInterval >>= aTimeInterval;
660*cdf0e10cSrcweir                     aValue >>= aTimeInterval.TimeUnit;
661*cdf0e10cSrcweir                     aScale.TimeIncrement.MinorTimeInterval = uno::makeAny( aTimeInterval );
662*cdf0e10cSrcweir                     bSetScale = true;
663*cdf0e10cSrcweir                 }
664*cdf0e10cSrcweir             }
665*cdf0e10cSrcweir             break;
666*cdf0e10cSrcweir 
667*cdf0e10cSrcweir         case SCHATTR_AXIS_STEP_HELP:
668*cdf0e10cSrcweir             // only if auto is false
669*cdf0e10cSrcweir             if( !lcl_isAutoMinor(rItemSet) )
670*cdf0e10cSrcweir             {
671*cdf0e10cSrcweir                 rItemSet.Get( nWhichId ).QueryValue( aValue );
672*cdf0e10cSrcweir                 if( lcl_isDateAxis(rItemSet) )
673*cdf0e10cSrcweir                 {
674*cdf0e10cSrcweir                     TimeInterval aTimeInterval;
675*cdf0e10cSrcweir                     aScale.TimeIncrement.MinorTimeInterval >>= aTimeInterval;
676*cdf0e10cSrcweir                     aValue >>= aTimeInterval.Number;
677*cdf0e10cSrcweir                     aScale.TimeIncrement.MinorTimeInterval = uno::makeAny(aTimeInterval);
678*cdf0e10cSrcweir                     bSetScale = true;
679*cdf0e10cSrcweir                 }
680*cdf0e10cSrcweir                 else if( aScale.IncrementData.SubIncrements.getLength() > 0 )
681*cdf0e10cSrcweir                 {
682*cdf0e10cSrcweir                     if( ! aScale.IncrementData.SubIncrements[0].IntervalCount.hasValue() ||
683*cdf0e10cSrcweir                         aScale.IncrementData.SubIncrements[0].IntervalCount != aValue )
684*cdf0e10cSrcweir                     {
685*cdf0e10cSrcweir                         OSL_ASSERT( aValue.getValueTypeClass() == uno::TypeClass_LONG );
686*cdf0e10cSrcweir                         aScale.IncrementData.SubIncrements[0].IntervalCount = aValue;
687*cdf0e10cSrcweir                         bSetScale = true;
688*cdf0e10cSrcweir                     }
689*cdf0e10cSrcweir                 }
690*cdf0e10cSrcweir             }
691*cdf0e10cSrcweir             break;
692*cdf0e10cSrcweir 
693*cdf0e10cSrcweir         case SCHATTR_AXIS_AUTO_TIME_RESOLUTION:
694*cdf0e10cSrcweir             if( (static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue() ))
695*cdf0e10cSrcweir             {
696*cdf0e10cSrcweir                 aScale.TimeIncrement.TimeResolution.clear();
697*cdf0e10cSrcweir                 bSetScale = true;
698*cdf0e10cSrcweir             }
699*cdf0e10cSrcweir             break;
700*cdf0e10cSrcweir         case SCHATTR_AXIS_TIME_RESOLUTION:
701*cdf0e10cSrcweir             // only if auto is false
702*cdf0e10cSrcweir             if( ! (static_cast< const SfxBoolItem & >( rItemSet.Get( SCHATTR_AXIS_AUTO_TIME_RESOLUTION )).GetValue() ))
703*cdf0e10cSrcweir             {
704*cdf0e10cSrcweir                 rItemSet.Get( nWhichId ).QueryValue( aValue );
705*cdf0e10cSrcweir 
706*cdf0e10cSrcweir                 if( aScale.TimeIncrement.TimeResolution != aValue )
707*cdf0e10cSrcweir                 {
708*cdf0e10cSrcweir                     aScale.TimeIncrement.TimeResolution = aValue;
709*cdf0e10cSrcweir                     bSetScale = true;
710*cdf0e10cSrcweir                 }
711*cdf0e10cSrcweir             }
712*cdf0e10cSrcweir             break;
713*cdf0e10cSrcweir 
714*cdf0e10cSrcweir 
715*cdf0e10cSrcweir         case SCHATTR_AXIS_AUTO_ORIGIN:
716*cdf0e10cSrcweir         {
717*cdf0e10cSrcweir             if( (static_cast< const SfxBoolItem & >(
718*cdf0e10cSrcweir                      rItemSet.Get( nWhichId )).GetValue() ))
719*cdf0e10cSrcweir             {
720*cdf0e10cSrcweir                 aScale.Origin.clear();
721*cdf0e10cSrcweir                 bSetScale = true;
722*cdf0e10cSrcweir             }
723*cdf0e10cSrcweir         }
724*cdf0e10cSrcweir         break;
725*cdf0e10cSrcweir 
726*cdf0e10cSrcweir         case SCHATTR_AXIS_ORIGIN:
727*cdf0e10cSrcweir         {
728*cdf0e10cSrcweir             // only if auto is false
729*cdf0e10cSrcweir             if( ! (static_cast< const SfxBoolItem & >(
730*cdf0e10cSrcweir                        rItemSet.Get( SCHATTR_AXIS_AUTO_ORIGIN )).GetValue() ))
731*cdf0e10cSrcweir             {
732*cdf0e10cSrcweir                 rItemSet.Get( nWhichId ).QueryValue( aValue );
733*cdf0e10cSrcweir 
734*cdf0e10cSrcweir                 if( aScale.Origin != aValue )
735*cdf0e10cSrcweir                 {
736*cdf0e10cSrcweir                     aScale.Origin = aValue;
737*cdf0e10cSrcweir                     bSetScale = true;
738*cdf0e10cSrcweir 
739*cdf0e10cSrcweir                     if( !AxisHelper::isAxisPositioningEnabled() )
740*cdf0e10cSrcweir                     {
741*cdf0e10cSrcweir                         //keep old and new settings for axis positioning in sync somehow
742*cdf0e10cSrcweir                         Reference< chart2::XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(
743*cdf0e10cSrcweir                             m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
744*cdf0e10cSrcweir 
745*cdf0e10cSrcweir                         sal_Int32 nDimensionIndex=0;
746*cdf0e10cSrcweir                         sal_Int32 nAxisIndex=0;
747*cdf0e10cSrcweir                         if( AxisHelper::getIndicesForAxis( m_xAxis, xCooSys, nDimensionIndex, nAxisIndex ) && nAxisIndex==0 )
748*cdf0e10cSrcweir                         {
749*cdf0e10cSrcweir                             Reference< beans::XPropertySet > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ), uno::UNO_QUERY );
750*cdf0e10cSrcweir                             if( xCrossingMainAxis.is() )
751*cdf0e10cSrcweir                             {
752*cdf0e10cSrcweir                                 double fValue = 0.0;
753*cdf0e10cSrcweir                                 if( aValue >>= fValue )
754*cdf0e10cSrcweir                                 {
755*cdf0e10cSrcweir                                     xCrossingMainAxis->setPropertyValue( C2U( "CrossoverPosition" ), uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_VALUE ));
756*cdf0e10cSrcweir                                     xCrossingMainAxis->setPropertyValue( C2U( "CrossoverValue" ), uno::makeAny( fValue ));
757*cdf0e10cSrcweir                                 }
758*cdf0e10cSrcweir                                 else
759*cdf0e10cSrcweir                                     xCrossingMainAxis->setPropertyValue( C2U( "CrossoverPosition" ), uno::makeAny( ::com::sun::star::chart::ChartAxisPosition_START ));
760*cdf0e10cSrcweir                             }
761*cdf0e10cSrcweir                         }
762*cdf0e10cSrcweir                     }
763*cdf0e10cSrcweir                 }
764*cdf0e10cSrcweir             }
765*cdf0e10cSrcweir         }
766*cdf0e10cSrcweir         break;
767*cdf0e10cSrcweir 
768*cdf0e10cSrcweir         case SCHATTR_AXIS_POSITION:
769*cdf0e10cSrcweir         {
770*cdf0e10cSrcweir             ::com::sun::star::chart::ChartAxisPosition eAxisPos =
771*cdf0e10cSrcweir                 (::com::sun::star::chart::ChartAxisPosition)
772*cdf0e10cSrcweir                 static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();
773*cdf0e10cSrcweir 
774*cdf0e10cSrcweir             ::com::sun::star::chart::ChartAxisPosition eOldAxisPos( ::com::sun::star::chart::ChartAxisPosition_ZERO );
775*cdf0e10cSrcweir             bool bPropExisted = ( GetPropertySet()->getPropertyValue(C2U( "CrossoverPosition" )) >>= eOldAxisPos );
776*cdf0e10cSrcweir 
777*cdf0e10cSrcweir             if( !bPropExisted || ( eOldAxisPos != eAxisPos ))
778*cdf0e10cSrcweir             {
779*cdf0e10cSrcweir                 GetPropertySet()->setPropertyValue( C2U( "CrossoverPosition" ), uno::makeAny( eAxisPos ));
780*cdf0e10cSrcweir                 bChangedOtherwise = true;
781*cdf0e10cSrcweir 
782*cdf0e10cSrcweir                 //move the parallel axes to the other side if necessary
783*cdf0e10cSrcweir                 if( eAxisPos==::com::sun::star::chart::ChartAxisPosition_START || eAxisPos==::com::sun::star::chart::ChartAxisPosition_END )
784*cdf0e10cSrcweir                 {
785*cdf0e10cSrcweir                     Reference< beans::XPropertySet > xParallelAxis( AxisHelper::getParallelAxis( m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ), uno::UNO_QUERY );
786*cdf0e10cSrcweir                     if( xParallelAxis.is() )
787*cdf0e10cSrcweir                     {
788*cdf0e10cSrcweir                         ::com::sun::star::chart::ChartAxisPosition eOtherPos;
789*cdf0e10cSrcweir                         if( xParallelAxis->getPropertyValue( C2U( "CrossoverPosition" ) ) >>= eOtherPos )
790*cdf0e10cSrcweir                         {
791*cdf0e10cSrcweir                             if( eOtherPos == eAxisPos )
792*cdf0e10cSrcweir                             {
793*cdf0e10cSrcweir                                 ::com::sun::star::chart::ChartAxisPosition eOppositePos =
794*cdf0e10cSrcweir                                     (eAxisPos==::com::sun::star::chart::ChartAxisPosition_START)
795*cdf0e10cSrcweir                                     ? ::com::sun::star::chart::ChartAxisPosition_END
796*cdf0e10cSrcweir                                     : ::com::sun::star::chart::ChartAxisPosition_START;
797*cdf0e10cSrcweir                                 xParallelAxis->setPropertyValue( C2U( "CrossoverPosition" ), uno::makeAny( eOppositePos ));
798*cdf0e10cSrcweir                             }
799*cdf0e10cSrcweir                         }
800*cdf0e10cSrcweir                     }
801*cdf0e10cSrcweir                 }
802*cdf0e10cSrcweir             }
803*cdf0e10cSrcweir         }
804*cdf0e10cSrcweir         break;
805*cdf0e10cSrcweir 
806*cdf0e10cSrcweir         case SCHATTR_AXIS_POSITION_VALUE:
807*cdf0e10cSrcweir         {
808*cdf0e10cSrcweir             double fValue = static_cast< const SvxDoubleItem & >( rItemSet.Get( nWhichId )).GetValue();
809*cdf0e10cSrcweir 
810*cdf0e10cSrcweir             double fOldValue = 0.0;
811*cdf0e10cSrcweir             bool bPropExisted = ( GetPropertySet()->getPropertyValue(C2U( "CrossoverValue" )) >>= fOldValue );
812*cdf0e10cSrcweir 
813*cdf0e10cSrcweir             if( !bPropExisted || ( fOldValue != fValue ))
814*cdf0e10cSrcweir             {
815*cdf0e10cSrcweir                 GetPropertySet()->setPropertyValue( C2U( "CrossoverValue" ), uno::makeAny( fValue ));
816*cdf0e10cSrcweir                 bChangedOtherwise = true;
817*cdf0e10cSrcweir 
818*cdf0e10cSrcweir                 //keep old and new settings for axis positioning in sync somehow
819*cdf0e10cSrcweir                 {
820*cdf0e10cSrcweir                     Reference< chart2::XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis(
821*cdf0e10cSrcweir                         m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
822*cdf0e10cSrcweir 
823*cdf0e10cSrcweir                     sal_Int32 nDimensionIndex=0;
824*cdf0e10cSrcweir                     sal_Int32 nAxisIndex=0;
825*cdf0e10cSrcweir                     if( AxisHelper::getIndicesForAxis( m_xAxis, xCooSys, nDimensionIndex, nAxisIndex ) && nAxisIndex==0 && nDimensionIndex==0 )
826*cdf0e10cSrcweir                     {
827*cdf0e10cSrcweir                         Reference< chart2::XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( m_xAxis, xCooSys ) );
828*cdf0e10cSrcweir                         if( xCrossingMainAxis.is() )
829*cdf0e10cSrcweir                         {
830*cdf0e10cSrcweir                             ScaleData aCrossingScale( xCrossingMainAxis->getScaleData() );
831*cdf0e10cSrcweir                             aCrossingScale.Origin = uno::makeAny(fValue);
832*cdf0e10cSrcweir                             xCrossingMainAxis->setScaleData(aCrossingScale);
833*cdf0e10cSrcweir                         }
834*cdf0e10cSrcweir                     }
835*cdf0e10cSrcweir                 }
836*cdf0e10cSrcweir             }
837*cdf0e10cSrcweir         }
838*cdf0e10cSrcweir         break;
839*cdf0e10cSrcweir 
840*cdf0e10cSrcweir         case SCHATTR_AXIS_LABEL_POSITION:
841*cdf0e10cSrcweir         {
842*cdf0e10cSrcweir             ::com::sun::star::chart::ChartAxisLabelPosition ePos =
843*cdf0e10cSrcweir                 (::com::sun::star::chart::ChartAxisLabelPosition)
844*cdf0e10cSrcweir                 static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();
845*cdf0e10cSrcweir 
846*cdf0e10cSrcweir             ::com::sun::star::chart::ChartAxisLabelPosition eOldPos( ::com::sun::star::chart::ChartAxisLabelPosition_NEAR_AXIS );
847*cdf0e10cSrcweir             bool bPropExisted = ( GetPropertySet()->getPropertyValue(C2U( "LabelPosition" )) >>= eOldPos );
848*cdf0e10cSrcweir 
849*cdf0e10cSrcweir             if( !bPropExisted || ( eOldPos != ePos ))
850*cdf0e10cSrcweir             {
851*cdf0e10cSrcweir                 GetPropertySet()->setPropertyValue( C2U( "LabelPosition" ), uno::makeAny( ePos ));
852*cdf0e10cSrcweir                 bChangedOtherwise = true;
853*cdf0e10cSrcweir 
854*cdf0e10cSrcweir                 //move the parallel axes to the other side if necessary
855*cdf0e10cSrcweir                 if( ePos==::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START || ePos==::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END )
856*cdf0e10cSrcweir                 {
857*cdf0e10cSrcweir                     Reference< beans::XPropertySet > xParallelAxis( AxisHelper::getParallelAxis( m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ), uno::UNO_QUERY );
858*cdf0e10cSrcweir                     if( xParallelAxis.is() )
859*cdf0e10cSrcweir                     {
860*cdf0e10cSrcweir                         ::com::sun::star::chart::ChartAxisLabelPosition eOtherPos;
861*cdf0e10cSrcweir                         if( xParallelAxis->getPropertyValue( C2U( "LabelPosition" ) ) >>= eOtherPos )
862*cdf0e10cSrcweir                         {
863*cdf0e10cSrcweir                             if( eOtherPos == ePos )
864*cdf0e10cSrcweir                             {
865*cdf0e10cSrcweir                                 ::com::sun::star::chart::ChartAxisLabelPosition eOppositePos =
866*cdf0e10cSrcweir                                     (ePos==::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START)
867*cdf0e10cSrcweir                                     ? ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_END
868*cdf0e10cSrcweir                                     : ::com::sun::star::chart::ChartAxisLabelPosition_OUTSIDE_START;
869*cdf0e10cSrcweir                                 xParallelAxis->setPropertyValue( C2U( "LabelPosition" ), uno::makeAny( eOppositePos ));
870*cdf0e10cSrcweir                             }
871*cdf0e10cSrcweir                         }
872*cdf0e10cSrcweir                     }
873*cdf0e10cSrcweir                 }
874*cdf0e10cSrcweir             }
875*cdf0e10cSrcweir         }
876*cdf0e10cSrcweir         break;
877*cdf0e10cSrcweir 
878*cdf0e10cSrcweir         case SCHATTR_AXIS_MARK_POSITION:
879*cdf0e10cSrcweir         {
880*cdf0e10cSrcweir             ::com::sun::star::chart::ChartAxisMarkPosition ePos =
881*cdf0e10cSrcweir                 (::com::sun::star::chart::ChartAxisMarkPosition)
882*cdf0e10cSrcweir                 static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();
883*cdf0e10cSrcweir 
884*cdf0e10cSrcweir             ::com::sun::star::chart::ChartAxisMarkPosition eOldPos( ::com::sun::star::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS );
885*cdf0e10cSrcweir             bool bPropExisted = ( GetPropertySet()->getPropertyValue(C2U( "MarkPosition" )) >>= eOldPos );
886*cdf0e10cSrcweir 
887*cdf0e10cSrcweir             if( !bPropExisted || ( eOldPos != ePos ))
888*cdf0e10cSrcweir             {
889*cdf0e10cSrcweir                 GetPropertySet()->setPropertyValue( C2U( "MarkPosition" ), uno::makeAny( ePos ));
890*cdf0e10cSrcweir                 bChangedOtherwise = true;
891*cdf0e10cSrcweir             }
892*cdf0e10cSrcweir         }
893*cdf0e10cSrcweir         break;
894*cdf0e10cSrcweir 
895*cdf0e10cSrcweir         case SCHATTR_TEXT_DEGREES:
896*cdf0e10cSrcweir         {
897*cdf0e10cSrcweir             // convert int to double (divided by 100)
898*cdf0e10cSrcweir             double fVal = static_cast< double >(
899*cdf0e10cSrcweir                 static_cast< const SfxInt32Item & >(
900*cdf0e10cSrcweir                     rItemSet.Get( nWhichId )).GetValue()) / 100.0;
901*cdf0e10cSrcweir             double fOldVal = 0.0;
902*cdf0e10cSrcweir             bool bPropExisted =
903*cdf0e10cSrcweir                 ( GetPropertySet()->getPropertyValue( C2U( "TextRotation" )) >>= fOldVal );
904*cdf0e10cSrcweir 
905*cdf0e10cSrcweir             if( ! bPropExisted ||
906*cdf0e10cSrcweir                 ( bPropExisted && fOldVal != fVal ))
907*cdf0e10cSrcweir             {
908*cdf0e10cSrcweir                 GetPropertySet()->setPropertyValue( C2U( "TextRotation" ), uno::makeAny( fVal ));
909*cdf0e10cSrcweir                 bChangedOtherwise = true;
910*cdf0e10cSrcweir             }
911*cdf0e10cSrcweir         }
912*cdf0e10cSrcweir         break;
913*cdf0e10cSrcweir 
914*cdf0e10cSrcweir         case SID_ATTR_NUMBERFORMAT_VALUE:
915*cdf0e10cSrcweir         {
916*cdf0e10cSrcweir             if( m_pExplicitScale )
917*cdf0e10cSrcweir             {
918*cdf0e10cSrcweir                 bool bUseSourceFormat =
919*cdf0e10cSrcweir                     (static_cast< const SfxBoolItem & >(
920*cdf0e10cSrcweir                         rItemSet.Get( SID_ATTR_NUMBERFORMAT_SOURCE )).GetValue() );
921*cdf0e10cSrcweir 
922*cdf0e10cSrcweir                 if( ! bUseSourceFormat )
923*cdf0e10cSrcweir                 {
924*cdf0e10cSrcweir                     sal_Int32 nFmt = static_cast< sal_Int32 >(
925*cdf0e10cSrcweir                         static_cast< const SfxUInt32Item & >(
926*cdf0e10cSrcweir                             rItemSet.Get( nWhichId )).GetValue());
927*cdf0e10cSrcweir 
928*cdf0e10cSrcweir                     aValue = uno::makeAny(nFmt);
929*cdf0e10cSrcweir                     if( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )) != aValue )
930*cdf0e10cSrcweir                     {
931*cdf0e10cSrcweir                         GetPropertySet()->setPropertyValue( C2U( "NumberFormat" ), aValue );
932*cdf0e10cSrcweir                         bChangedOtherwise = true;
933*cdf0e10cSrcweir                     }
934*cdf0e10cSrcweir                 }
935*cdf0e10cSrcweir             }
936*cdf0e10cSrcweir         }
937*cdf0e10cSrcweir         break;
938*cdf0e10cSrcweir 
939*cdf0e10cSrcweir         case SID_ATTR_NUMBERFORMAT_SOURCE:
940*cdf0e10cSrcweir         {
941*cdf0e10cSrcweir             bool bUseSourceFormat =
942*cdf0e10cSrcweir                 (static_cast< const SfxBoolItem & >(
943*cdf0e10cSrcweir                     rItemSet.Get( nWhichId )).GetValue() );
944*cdf0e10cSrcweir             bool bNumberFormatIsSet = ( GetPropertySet()->getPropertyValue( C2U( "NumberFormat" )).hasValue());
945*cdf0e10cSrcweir 
946*cdf0e10cSrcweir             bChangedOtherwise = (bUseSourceFormat == bNumberFormatIsSet);
947*cdf0e10cSrcweir             if( bChangedOtherwise )
948*cdf0e10cSrcweir             {
949*cdf0e10cSrcweir                 if( ! bUseSourceFormat )
950*cdf0e10cSrcweir                 {
951*cdf0e10cSrcweir                     SfxItemState aState = rItemSet.GetItemState( SID_ATTR_NUMBERFORMAT_VALUE );
952*cdf0e10cSrcweir                     if( aState == SFX_ITEM_SET )
953*cdf0e10cSrcweir                     {
954*cdf0e10cSrcweir                         sal_Int32 nFormatKey = static_cast< sal_Int32 >(
955*cdf0e10cSrcweir                         static_cast< const SfxUInt32Item & >(
956*cdf0e10cSrcweir                             rItemSet.Get( SID_ATTR_NUMBERFORMAT_VALUE )).GetValue());
957*cdf0e10cSrcweir                         aValue <<= nFormatKey;
958*cdf0e10cSrcweir                     }
959*cdf0e10cSrcweir                     else
960*cdf0e10cSrcweir                     {
961*cdf0e10cSrcweir                         Reference< chart2::XCoordinateSystem > xCooSys(
962*cdf0e10cSrcweir                         AxisHelper::getCoordinateSystemOfAxis(
963*cdf0e10cSrcweir                               m_xAxis, ChartModelHelper::findDiagram( m_xChartDoc ) ) );
964*cdf0e10cSrcweir 
965*cdf0e10cSrcweir                         sal_Int32 nFormatKey = ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
966*cdf0e10cSrcweir                             m_xAxis, xCooSys, Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY ) );
967*cdf0e10cSrcweir 
968*cdf0e10cSrcweir                         aValue <<= nFormatKey;
969*cdf0e10cSrcweir                     }
970*cdf0e10cSrcweir                 }
971*cdf0e10cSrcweir                 // else set a void Any
972*cdf0e10cSrcweir                 GetPropertySet()->setPropertyValue( C2U( "NumberFormat" ), aValue );
973*cdf0e10cSrcweir             }
974*cdf0e10cSrcweir         }
975*cdf0e10cSrcweir         break;
976*cdf0e10cSrcweir 
977*cdf0e10cSrcweir         case SCHATTR_AXISTYPE:
978*cdf0e10cSrcweir         {
979*cdf0e10cSrcweir             sal_Int32 nNewAxisType = static_cast< const SfxInt32Item & >( rItemSet.Get( nWhichId )).GetValue();//::com::sun::star::chart2::AxisType
980*cdf0e10cSrcweir             aScale.AxisType = nNewAxisType;
981*cdf0e10cSrcweir             bSetScale = true;
982*cdf0e10cSrcweir         }
983*cdf0e10cSrcweir         break;
984*cdf0e10cSrcweir 
985*cdf0e10cSrcweir         case SCHATTR_AXIS_AUTO_DATEAXIS:
986*cdf0e10cSrcweir         {
987*cdf0e10cSrcweir             bool bNewValue = static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue();
988*cdf0e10cSrcweir             bool bOldValue = aScale.AutoDateAxis;
989*cdf0e10cSrcweir             if( bOldValue != bNewValue )
990*cdf0e10cSrcweir             {
991*cdf0e10cSrcweir                 aScale.AutoDateAxis = bNewValue;
992*cdf0e10cSrcweir                 bSetScale = true;
993*cdf0e10cSrcweir             }
994*cdf0e10cSrcweir         }
995*cdf0e10cSrcweir         break;
996*cdf0e10cSrcweir     }
997*cdf0e10cSrcweir 
998*cdf0e10cSrcweir     if( bSetScale )
999*cdf0e10cSrcweir         m_xAxis->setScaleData( aScale );
1000*cdf0e10cSrcweir 
1001*cdf0e10cSrcweir     return (bSetScale || bChangedOtherwise);
1002*cdf0e10cSrcweir }
1003*cdf0e10cSrcweir 
1004*cdf0e10cSrcweir } //  namespace wrapper
1005*cdf0e10cSrcweir } //  namespace chart
1006