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