1cde9e8dcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3cde9e8dcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4cde9e8dcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5cde9e8dcSAndrew Rist  * distributed with this work for additional information
6cde9e8dcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7cde9e8dcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8cde9e8dcSAndrew Rist  * "License"); you may not use this file except in compliance
9cde9e8dcSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cde9e8dcSAndrew Rist  *
11cde9e8dcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cde9e8dcSAndrew Rist  *
13cde9e8dcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14cde9e8dcSAndrew Rist  * software distributed under the License is distributed on an
15cde9e8dcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16cde9e8dcSAndrew Rist  * KIND, either express or implied.  See the License for the
17cde9e8dcSAndrew Rist  * specific language governing permissions and limitations
18cde9e8dcSAndrew Rist  * under the License.
19cde9e8dcSAndrew Rist  *
20cde9e8dcSAndrew Rist  *************************************************************/
21cde9e8dcSAndrew Rist 
22cde9e8dcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_chart2.hxx"
26cdf0e10cSrcweir #include "StatisticsItemConverter.hxx"
27cdf0e10cSrcweir #include "SchWhichPairs.hxx"
28cdf0e10cSrcweir #include "macros.hxx"
29cdf0e10cSrcweir #include "RegressionCurveHelper.hxx"
30cdf0e10cSrcweir #include "ItemPropertyMap.hxx"
31cdf0e10cSrcweir #include "ErrorBar.hxx"
32cdf0e10cSrcweir #include "PropertyHelper.hxx"
33cdf0e10cSrcweir #include "ChartModelHelper.hxx"
34cdf0e10cSrcweir #include "ChartTypeHelper.hxx"
35cdf0e10cSrcweir #include "StatisticsHelper.hxx"
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include "GraphicPropertyItemConverter.hxx"
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #include <svl/stritem.hxx>
40cdf0e10cSrcweir #include <svx/chrtitem.hxx>
41cdf0e10cSrcweir #include <svl/intitem.hxx>
42cdf0e10cSrcweir #include <rtl/math.hxx>
43cdf0e10cSrcweir 
44cdf0e10cSrcweir #include <com/sun/star/chart2/DataPointLabel.hpp>
45cdf0e10cSrcweir #include <com/sun/star/chart2/XInternalDataProvider.hpp>
46cdf0e10cSrcweir #include <com/sun/star/chart/ErrorBarStyle.hpp>
47cdf0e10cSrcweir #include <com/sun/star/lang/XServiceName.hpp>
48cdf0e10cSrcweir 
49cdf0e10cSrcweir #include <functional>
50cdf0e10cSrcweir #include <algorithm>
51cdf0e10cSrcweir #include <vector>
52cdf0e10cSrcweir 
53cdf0e10cSrcweir using namespace ::com::sun::star;
54cdf0e10cSrcweir 
55cdf0e10cSrcweir namespace
56cdf0e10cSrcweir {
57cdf0e10cSrcweir 
lcl_GetYErrorBar(const uno::Reference<beans::XPropertySet> & xProp)58cdf0e10cSrcweir uno::Reference< beans::XPropertySet > lcl_GetYErrorBar(
59cdf0e10cSrcweir     const uno::Reference< beans::XPropertySet > & xProp )
60cdf0e10cSrcweir {
61cdf0e10cSrcweir     uno::Reference< beans::XPropertySet > xResult;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir     if( xProp.is())
64cdf0e10cSrcweir         try
65cdf0e10cSrcweir         {
66cdf0e10cSrcweir             ( xProp->getPropertyValue( C2U( "ErrorBarY" )) >>= xResult );
67cdf0e10cSrcweir         }
68cdf0e10cSrcweir         catch( uno::Exception & ex )
69cdf0e10cSrcweir         {
70cdf0e10cSrcweir             ASSERT_EXCEPTION( ex );
71cdf0e10cSrcweir         }
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     return xResult;
74cdf0e10cSrcweir }
75cdf0e10cSrcweir 
lcl_convertRegressionType(SvxChartRegress eRegress)76cdf0e10cSrcweir ::chart::RegressionCurveHelper::tRegressionType lcl_convertRegressionType( SvxChartRegress eRegress )
77cdf0e10cSrcweir {
78cdf0e10cSrcweir     ::chart::RegressionCurveHelper::tRegressionType eType = ::chart::RegressionCurveHelper::REGRESSION_TYPE_NONE;
79cdf0e10cSrcweir     switch( eRegress )
80cdf0e10cSrcweir     {
81cdf0e10cSrcweir         case CHREGRESS_LINEAR:
82cdf0e10cSrcweir             eType = ::chart::RegressionCurveHelper::REGRESSION_TYPE_LINEAR;
83cdf0e10cSrcweir             break;
84cdf0e10cSrcweir         case CHREGRESS_LOG:
85cdf0e10cSrcweir             eType = ::chart::RegressionCurveHelper::REGRESSION_TYPE_LOG;
86cdf0e10cSrcweir             break;
87cdf0e10cSrcweir         case CHREGRESS_EXP:
88cdf0e10cSrcweir             eType = ::chart::RegressionCurveHelper::REGRESSION_TYPE_EXP;
89cdf0e10cSrcweir             break;
90cdf0e10cSrcweir         case CHREGRESS_POWER:
91cdf0e10cSrcweir             eType = ::chart::RegressionCurveHelper::REGRESSION_TYPE_POWER;
92cdf0e10cSrcweir             break;
93cdf0e10cSrcweir         case CHREGRESS_NONE:
94cdf0e10cSrcweir             break;
95cdf0e10cSrcweir     }
96cdf0e10cSrcweir     return eType;
97cdf0e10cSrcweir }
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 
lcl_GetDefaultErrorBar()100cdf0e10cSrcweir uno::Reference< beans::XPropertySet > lcl_GetDefaultErrorBar()
101cdf0e10cSrcweir {
102cdf0e10cSrcweir     // todo: use a valid context
103cdf0e10cSrcweir     return uno::Reference< beans::XPropertySet >(
104cdf0e10cSrcweir         ::chart::createErrorBar( uno::Reference< uno::XComponentContext >()));
105cdf0e10cSrcweir }
106cdf0e10cSrcweir 
lcl_getErrorValues(const uno::Reference<beans::XPropertySet> & xErrorBarProp,double & rOutPosError,double & rOutNegError)107cdf0e10cSrcweir void lcl_getErrorValues( const uno::Reference< beans::XPropertySet > & xErrorBarProp,
108cdf0e10cSrcweir                     double & rOutPosError, double & rOutNegError )
109cdf0e10cSrcweir {
110cdf0e10cSrcweir     if( ! xErrorBarProp.is())
111cdf0e10cSrcweir         return;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     try
114cdf0e10cSrcweir     {
115cdf0e10cSrcweir         xErrorBarProp->getPropertyValue( C2U( "PositiveError" )) >>= rOutPosError;
116cdf0e10cSrcweir         xErrorBarProp->getPropertyValue( C2U( "NegativeError" )) >>= rOutNegError;
117cdf0e10cSrcweir     }
118cdf0e10cSrcweir     catch( uno::Exception & ex )
119cdf0e10cSrcweir     {
120cdf0e10cSrcweir         ASSERT_EXCEPTION( ex );
121cdf0e10cSrcweir     }
122cdf0e10cSrcweir }
123cdf0e10cSrcweir 
lcl_getErrorIndicatorValues(const uno::Reference<beans::XPropertySet> & xErrorBarProp,bool & rOutShowPosError,bool & rOutShowNegError)124cdf0e10cSrcweir void lcl_getErrorIndicatorValues(
125cdf0e10cSrcweir     const uno::Reference< beans::XPropertySet > & xErrorBarProp,
126cdf0e10cSrcweir     bool & rOutShowPosError, bool & rOutShowNegError )
127cdf0e10cSrcweir {
128cdf0e10cSrcweir     if( ! xErrorBarProp.is())
129cdf0e10cSrcweir         return;
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     try
132cdf0e10cSrcweir     {
133cdf0e10cSrcweir         xErrorBarProp->getPropertyValue( C2U( "ShowPositiveError" )) >>= rOutShowPosError;
134cdf0e10cSrcweir         xErrorBarProp->getPropertyValue( C2U( "ShowNegativeError" )) >>= rOutShowNegError;
135cdf0e10cSrcweir     }
136cdf0e10cSrcweir     catch( uno::Exception & ex )
137cdf0e10cSrcweir     {
138cdf0e10cSrcweir         ASSERT_EXCEPTION( ex );
139cdf0e10cSrcweir     }
140cdf0e10cSrcweir }
141cdf0e10cSrcweir 
lcl_getEquationProperties(const uno::Reference<beans::XPropertySet> & xSeriesPropSet,const SfxItemSet * pItemSet)142cdf0e10cSrcweir uno::Reference< beans::XPropertySet > lcl_getEquationProperties(
143cdf0e10cSrcweir     const uno::Reference< beans::XPropertySet > & xSeriesPropSet, const SfxItemSet * pItemSet )
144cdf0e10cSrcweir {
145cdf0e10cSrcweir     bool bEquationExists = true;
146cdf0e10cSrcweir 
147cdf0e10cSrcweir     // ensure that a trendline is on
148cdf0e10cSrcweir     if( pItemSet )
149cdf0e10cSrcweir     {
150cdf0e10cSrcweir         SvxChartRegress eRegress = CHREGRESS_NONE;
151cdf0e10cSrcweir         const SfxPoolItem *pPoolItem = NULL;
152cdf0e10cSrcweir         if( pItemSet->GetItemState( SCHATTR_REGRESSION_TYPE, sal_True, &pPoolItem ) == SFX_ITEM_SET )
153cdf0e10cSrcweir         {
154cdf0e10cSrcweir             eRegress = static_cast< const SvxChartRegressItem * >( pPoolItem )->GetValue();
155cdf0e10cSrcweir             bEquationExists = ( eRegress != CHREGRESS_NONE );
156cdf0e10cSrcweir         }
157cdf0e10cSrcweir     }
158cdf0e10cSrcweir 
159cdf0e10cSrcweir     if( bEquationExists )
160cdf0e10cSrcweir     {
161cdf0e10cSrcweir         uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropSet, uno::UNO_QUERY );
162cdf0e10cSrcweir         uno::Reference< chart2::XRegressionCurve > xCurve(
163cdf0e10cSrcweir             ::chart::RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCnt ));
164cdf0e10cSrcweir         if( xCurve.is())
165cdf0e10cSrcweir         {
166cdf0e10cSrcweir             return xCurve->getEquationProperties();
167cdf0e10cSrcweir         }
168cdf0e10cSrcweir     }
169cdf0e10cSrcweir 
170cdf0e10cSrcweir     return uno::Reference< beans::XPropertySet >();
171cdf0e10cSrcweir }
172cdf0e10cSrcweir 
173cdf0e10cSrcweir } // anonymous namespace
174cdf0e10cSrcweir 
175cdf0e10cSrcweir namespace chart
176cdf0e10cSrcweir {
177cdf0e10cSrcweir namespace wrapper
178cdf0e10cSrcweir {
179cdf0e10cSrcweir 
StatisticsItemConverter(const uno::Reference<frame::XModel> & xModel,const uno::Reference<beans::XPropertySet> & rPropertySet,SfxItemPool & rItemPool)180cdf0e10cSrcweir StatisticsItemConverter::StatisticsItemConverter(
181cdf0e10cSrcweir     const uno::Reference< frame::XModel > & xModel,
182cdf0e10cSrcweir     const uno::Reference< beans::XPropertySet > & rPropertySet,
183cdf0e10cSrcweir     SfxItemPool& rItemPool ) :
184cdf0e10cSrcweir         ItemConverter( rPropertySet, rItemPool ),
185cdf0e10cSrcweir         m_xModel( xModel )
186cdf0e10cSrcweir {
187cdf0e10cSrcweir     OSL_ASSERT( static_cast< int >( RegressionCurveHelper::REGRESSION_TYPE_NONE ) ==
188cdf0e10cSrcweir                 static_cast< int >( CHREGRESS_NONE ));
189cdf0e10cSrcweir     OSL_ASSERT( static_cast< int >( RegressionCurveHelper::REGRESSION_TYPE_LINEAR ) ==
190cdf0e10cSrcweir                 static_cast< int >( CHREGRESS_LINEAR ));
191cdf0e10cSrcweir     OSL_ASSERT( static_cast< int >( RegressionCurveHelper::REGRESSION_TYPE_LOG ) ==
192cdf0e10cSrcweir                 static_cast< int >( CHREGRESS_LOG ));
193cdf0e10cSrcweir     OSL_ASSERT( static_cast< int >( RegressionCurveHelper::REGRESSION_TYPE_EXP ) ==
194cdf0e10cSrcweir                 static_cast< int >( CHREGRESS_EXP ));
195cdf0e10cSrcweir     OSL_ASSERT( static_cast< int >( RegressionCurveHelper::REGRESSION_TYPE_POWER ) ==
196cdf0e10cSrcweir                 static_cast< int >( CHREGRESS_POWER ));
197cdf0e10cSrcweir }
198cdf0e10cSrcweir 
~StatisticsItemConverter()199cdf0e10cSrcweir StatisticsItemConverter::~StatisticsItemConverter()
200cdf0e10cSrcweir {}
201cdf0e10cSrcweir 
GetWhichPairs() const202cdf0e10cSrcweir const sal_uInt16 * StatisticsItemConverter::GetWhichPairs() const
203cdf0e10cSrcweir {
204cdf0e10cSrcweir     // must span all used items!
205cdf0e10cSrcweir     return nStatWhichPairs;
206cdf0e10cSrcweir }
207cdf0e10cSrcweir 
GetItemProperty(tWhichIdType,tPropertyNameWithMemberId &) const208cdf0e10cSrcweir bool StatisticsItemConverter::GetItemProperty(
209cdf0e10cSrcweir     tWhichIdType /* nWhichId */,
210cdf0e10cSrcweir     tPropertyNameWithMemberId & /* rOutProperty */ ) const
211cdf0e10cSrcweir {
212cdf0e10cSrcweir     return false;
213cdf0e10cSrcweir }
214cdf0e10cSrcweir 
ApplySpecialItem(sal_uInt16 nWhichId,const SfxItemSet & rItemSet)215cdf0e10cSrcweir bool StatisticsItemConverter::ApplySpecialItem(
216cdf0e10cSrcweir     sal_uInt16 nWhichId, const SfxItemSet & rItemSet )
217cdf0e10cSrcweir     throw( uno::Exception )
218cdf0e10cSrcweir {
219cdf0e10cSrcweir     bool bChanged = false;
220cdf0e10cSrcweir     uno::Any aValue;
221cdf0e10cSrcweir 
222cdf0e10cSrcweir     switch( nWhichId )
223cdf0e10cSrcweir     {
224cdf0e10cSrcweir         case SCHATTR_STAT_AVERAGE:
225cdf0e10cSrcweir         {
226cdf0e10cSrcweir             uno::Reference< chart2::XRegressionCurveContainer > xRegCnt(
227cdf0e10cSrcweir                 GetPropertySet(), uno::UNO_QUERY );
228cdf0e10cSrcweir             bool bOldHasMeanValueLine = RegressionCurveHelper::hasMeanValueLine( xRegCnt );
229cdf0e10cSrcweir 
230cdf0e10cSrcweir             bool bNewHasMeanValueLine =
231cdf0e10cSrcweir                 static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue();
232cdf0e10cSrcweir 
233cdf0e10cSrcweir             if( bOldHasMeanValueLine != bNewHasMeanValueLine )
234cdf0e10cSrcweir             {
235cdf0e10cSrcweir                 if( ! bNewHasMeanValueLine )
236cdf0e10cSrcweir                     RegressionCurveHelper::removeMeanValueLine( xRegCnt );
237cdf0e10cSrcweir                 else
238cdf0e10cSrcweir                     RegressionCurveHelper::addMeanValueLine(
239cdf0e10cSrcweir                         xRegCnt, uno::Reference< uno::XComponentContext >(), GetPropertySet() );
240cdf0e10cSrcweir                 bChanged = true;
241cdf0e10cSrcweir             }
242cdf0e10cSrcweir         }
243cdf0e10cSrcweir         break;
244cdf0e10cSrcweir 
245cdf0e10cSrcweir         // Attention !!! This case must be passed before SCHATTR_STAT_PERCENT,
246cdf0e10cSrcweir         // SCHATTR_STAT_BIGERROR, SCHATTR_STAT_CONSTPLUS,
247cdf0e10cSrcweir         // SCHATTR_STAT_CONSTMINUS and SCHATTR_STAT_INDICATE
248cdf0e10cSrcweir         case SCHATTR_STAT_KIND_ERROR:
249cdf0e10cSrcweir         {
250cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xErrorBarProp(
251cdf0e10cSrcweir                 lcl_GetYErrorBar( GetPropertySet() ));
252cdf0e10cSrcweir 
253cdf0e10cSrcweir             SvxChartKindError eErrorKind =
254cdf0e10cSrcweir                 static_cast< const SvxChartKindErrorItem & >(
255cdf0e10cSrcweir                     rItemSet.Get( nWhichId )).GetValue();
256cdf0e10cSrcweir 
257cdf0e10cSrcweir             if( !xErrorBarProp.is() && eErrorKind == CHERROR_NONE)
258cdf0e10cSrcweir             {
259cdf0e10cSrcweir                 //nothing to do
260cdf0e10cSrcweir             }
261cdf0e10cSrcweir             else
262cdf0e10cSrcweir             {
263cdf0e10cSrcweir                 sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
264cdf0e10cSrcweir 
265cdf0e10cSrcweir                 switch( eErrorKind )
266cdf0e10cSrcweir                 {
267cdf0e10cSrcweir                     case CHERROR_NONE:
268cdf0e10cSrcweir                         nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE; break;
269cdf0e10cSrcweir                     case CHERROR_VARIANT:
270cdf0e10cSrcweir                         nStyle = ::com::sun::star::chart::ErrorBarStyle::VARIANCE; break;
271cdf0e10cSrcweir                     case CHERROR_SIGMA:
272cdf0e10cSrcweir                         nStyle = ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION; break;
273cdf0e10cSrcweir                     case CHERROR_PERCENT:
274cdf0e10cSrcweir                         nStyle = ::com::sun::star::chart::ErrorBarStyle::RELATIVE; break;
275cdf0e10cSrcweir                     case CHERROR_BIGERROR:
276cdf0e10cSrcweir                         nStyle = ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN; break;
277cdf0e10cSrcweir                     case CHERROR_CONST:
278cdf0e10cSrcweir                         nStyle = ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE; break;
279cdf0e10cSrcweir                     case CHERROR_STDERROR:
280cdf0e10cSrcweir                         nStyle = ::com::sun::star::chart::ErrorBarStyle::STANDARD_ERROR; break;
281cdf0e10cSrcweir                     case CHERROR_RANGE:
282cdf0e10cSrcweir                         nStyle = ::com::sun::star::chart::ErrorBarStyle::FROM_DATA; break;
283cdf0e10cSrcweir                 }
284cdf0e10cSrcweir 
285cdf0e10cSrcweir                 if( !xErrorBarProp.is() )
286cdf0e10cSrcweir                 {
287cdf0e10cSrcweir                     xErrorBarProp = lcl_GetDefaultErrorBar();
288cdf0e10cSrcweir                     GetPropertySet()->setPropertyValue(
289cdf0e10cSrcweir                         C2U( "ErrorBarY" ), uno::makeAny( xErrorBarProp ));
290cdf0e10cSrcweir                 }
291cdf0e10cSrcweir 
292cdf0e10cSrcweir                 xErrorBarProp->setPropertyValue( C2U( "ErrorBarStyle" ),
293cdf0e10cSrcweir                                                     uno::makeAny( nStyle ));
294cdf0e10cSrcweir                 bChanged = true;
295cdf0e10cSrcweir             }
296cdf0e10cSrcweir         }
297cdf0e10cSrcweir         break;
298cdf0e10cSrcweir 
299cdf0e10cSrcweir         case SCHATTR_STAT_PERCENT:
300cdf0e10cSrcweir         case SCHATTR_STAT_BIGERROR:
301cdf0e10cSrcweir         {
302cdf0e10cSrcweir             OSL_ENSURE( false, "Deprectaed item" );
303cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xErrorBarProp(
304cdf0e10cSrcweir                 lcl_GetYErrorBar( GetPropertySet()));
305cdf0e10cSrcweir             bool bOldHasErrorBar = xErrorBarProp.is();
306cdf0e10cSrcweir 
307cdf0e10cSrcweir             double fValue =
308cdf0e10cSrcweir                 static_cast< const SvxDoubleItem & >(
309cdf0e10cSrcweir                     rItemSet.Get( nWhichId )).GetValue();
310cdf0e10cSrcweir             double fPos, fNeg;
311cdf0e10cSrcweir             lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
312cdf0e10cSrcweir 
313cdf0e10cSrcweir             if( bOldHasErrorBar &&
314cdf0e10cSrcweir                 ! ( ::rtl::math::approxEqual( fPos, fValue ) &&
315cdf0e10cSrcweir                     ::rtl::math::approxEqual( fNeg, fValue )))
316cdf0e10cSrcweir             {
317cdf0e10cSrcweir                 xErrorBarProp->setPropertyValue( C2U( "PositiveError" ),
318cdf0e10cSrcweir                                                     uno::makeAny( fValue ));
319cdf0e10cSrcweir                 xErrorBarProp->setPropertyValue( C2U( "NegativeError" ),
320cdf0e10cSrcweir                                                     uno::makeAny( fValue ));
321cdf0e10cSrcweir                 bChanged = true;
322cdf0e10cSrcweir             }
323cdf0e10cSrcweir         }
324cdf0e10cSrcweir         break;
325cdf0e10cSrcweir 
326cdf0e10cSrcweir         case SCHATTR_STAT_CONSTPLUS:
327cdf0e10cSrcweir         {
328cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xErrorBarProp(
329cdf0e10cSrcweir                 lcl_GetYErrorBar( GetPropertySet()));
330cdf0e10cSrcweir             bool bOldHasErrorBar = xErrorBarProp.is();
331cdf0e10cSrcweir 
332cdf0e10cSrcweir             double fValue =
333cdf0e10cSrcweir                 static_cast< const SvxDoubleItem & >(
334cdf0e10cSrcweir                     rItemSet.Get( nWhichId )).GetValue();
335cdf0e10cSrcweir             double fPos, fNeg;
336cdf0e10cSrcweir             lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
337cdf0e10cSrcweir 
338cdf0e10cSrcweir             if( bOldHasErrorBar &&
339cdf0e10cSrcweir                 ! ::rtl::math::approxEqual( fPos, fValue ))
340cdf0e10cSrcweir             {
341cdf0e10cSrcweir                 xErrorBarProp->setPropertyValue( C2U( "PositiveError" ), uno::makeAny( fValue ));
342cdf0e10cSrcweir                 bChanged = true;
343cdf0e10cSrcweir             }
344cdf0e10cSrcweir         }
345cdf0e10cSrcweir         break;
346cdf0e10cSrcweir 
347cdf0e10cSrcweir         case SCHATTR_STAT_CONSTMINUS:
348cdf0e10cSrcweir         {
349cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xErrorBarProp(
350cdf0e10cSrcweir                 lcl_GetYErrorBar( GetPropertySet()));
351cdf0e10cSrcweir             bool bOldHasErrorBar = xErrorBarProp.is();
352cdf0e10cSrcweir 
353cdf0e10cSrcweir             double fValue =
354cdf0e10cSrcweir                 static_cast< const SvxDoubleItem & >(
355cdf0e10cSrcweir                     rItemSet.Get( nWhichId )).GetValue();
356cdf0e10cSrcweir             double fPos, fNeg;
357cdf0e10cSrcweir             lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
358cdf0e10cSrcweir 
359cdf0e10cSrcweir             if( bOldHasErrorBar &&
360cdf0e10cSrcweir                 ! ::rtl::math::approxEqual( fNeg, fValue ))
361cdf0e10cSrcweir             {
362cdf0e10cSrcweir                 xErrorBarProp->setPropertyValue( C2U( "NegativeError" ), uno::makeAny( fValue ));
363cdf0e10cSrcweir                 bChanged = true;
364cdf0e10cSrcweir             }
365cdf0e10cSrcweir         }
366cdf0e10cSrcweir         break;
367cdf0e10cSrcweir 
368cdf0e10cSrcweir         case SCHATTR_REGRESSION_TYPE:
369cdf0e10cSrcweir         {
370cdf0e10cSrcweir             SvxChartRegress eRegress =
371cdf0e10cSrcweir                 static_cast< const SvxChartRegressItem & >(
372cdf0e10cSrcweir                     rItemSet.Get( nWhichId )).GetValue();
373cdf0e10cSrcweir 
374cdf0e10cSrcweir             uno::Reference< chart2::XRegressionCurveContainer > xRegCnt(
375cdf0e10cSrcweir                 GetPropertySet(), uno::UNO_QUERY );
376cdf0e10cSrcweir 
377cdf0e10cSrcweir             if( eRegress == CHREGRESS_NONE )
378cdf0e10cSrcweir             {
379cdf0e10cSrcweir                 bChanged = RegressionCurveHelper::removeAllExceptMeanValueLine( xRegCnt );
380cdf0e10cSrcweir             }
381cdf0e10cSrcweir             else
382cdf0e10cSrcweir             {
383cdf0e10cSrcweir                 SvxChartRegress eOldRegress(
384cdf0e10cSrcweir                     static_cast< SvxChartRegress >(
385cdf0e10cSrcweir                         static_cast< sal_Int32 >(
386cdf0e10cSrcweir                             RegressionCurveHelper::getFirstRegressTypeNotMeanValueLine( xRegCnt ))));
387cdf0e10cSrcweir                 if( eOldRegress != eRegress )
388cdf0e10cSrcweir                 {
389cdf0e10cSrcweir                     RegressionCurveHelper::replaceOrAddCurveAndReduceToOne(
390cdf0e10cSrcweir                         lcl_convertRegressionType( eRegress ), xRegCnt,
391cdf0e10cSrcweir                         uno::Reference< uno::XComponentContext >());
392cdf0e10cSrcweir                     bChanged = true;
393cdf0e10cSrcweir                 }
394cdf0e10cSrcweir             }
395cdf0e10cSrcweir         }
396cdf0e10cSrcweir         break;
397cdf0e10cSrcweir 
398cdf0e10cSrcweir         case SCHATTR_REGRESSION_SHOW_EQUATION:
399cdf0e10cSrcweir         {
400cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xEqProp( lcl_getEquationProperties( GetPropertySet(), &rItemSet ));
401cdf0e10cSrcweir             if( xEqProp.is())
402cdf0e10cSrcweir             {
403cdf0e10cSrcweir                 bool bShowEq = false;
404cdf0e10cSrcweir                 xEqProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEq;
405cdf0e10cSrcweir                 bool bNewShowEq =
406cdf0e10cSrcweir                     static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue();
407cdf0e10cSrcweir                 if( bShowEq != bNewShowEq )
408cdf0e10cSrcweir                 {
409cdf0e10cSrcweir                     xEqProp->setPropertyValue( C2U("ShowEquation"), uno::makeAny( bNewShowEq ));
410cdf0e10cSrcweir                     bChanged = true;
411cdf0e10cSrcweir                 }
412cdf0e10cSrcweir             }
413cdf0e10cSrcweir         }
414cdf0e10cSrcweir         break;
415cdf0e10cSrcweir 
416cdf0e10cSrcweir         case SCHATTR_REGRESSION_SHOW_COEFF:
417cdf0e10cSrcweir         {
418cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xEqProp( lcl_getEquationProperties( GetPropertySet(), &rItemSet ));
419cdf0e10cSrcweir             if( xEqProp.is())
420cdf0e10cSrcweir             {
421cdf0e10cSrcweir                 bool bShowCoeff = false;
422cdf0e10cSrcweir                 xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCoeff;
423cdf0e10cSrcweir                 bool bNewShowCoeff =
424cdf0e10cSrcweir                     static_cast< const SfxBoolItem & >( rItemSet.Get( nWhichId )).GetValue();
425cdf0e10cSrcweir                 if( bShowCoeff != bNewShowCoeff )
426cdf0e10cSrcweir                 {
427cdf0e10cSrcweir                     xEqProp->setPropertyValue( C2U("ShowCorrelationCoefficient"), uno::makeAny( bNewShowCoeff ));
428cdf0e10cSrcweir                     bChanged = true;
429cdf0e10cSrcweir                 }
430cdf0e10cSrcweir             }
431cdf0e10cSrcweir         }
432cdf0e10cSrcweir         break;
433cdf0e10cSrcweir 
434cdf0e10cSrcweir         case SCHATTR_STAT_INDICATE:
435cdf0e10cSrcweir         {
436cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xErrorBarProp(
437cdf0e10cSrcweir                 lcl_GetYErrorBar( GetPropertySet()));
438cdf0e10cSrcweir             bool bOldHasErrorBar = xErrorBarProp.is();
439cdf0e10cSrcweir 
440cdf0e10cSrcweir             SvxChartIndicate eIndicate =
441cdf0e10cSrcweir                 static_cast< const SvxChartIndicateItem & >(
442cdf0e10cSrcweir                     rItemSet.Get( nWhichId )).GetValue();
443cdf0e10cSrcweir 
444cdf0e10cSrcweir             bool bNewIndPos = (eIndicate == CHINDICATE_BOTH || eIndicate == CHINDICATE_UP );
445cdf0e10cSrcweir             bool bNewIndNeg = (eIndicate == CHINDICATE_BOTH || eIndicate == CHINDICATE_DOWN );
446cdf0e10cSrcweir 
447cdf0e10cSrcweir             bool bShowPos, bShowNeg;
448cdf0e10cSrcweir             lcl_getErrorIndicatorValues( xErrorBarProp, bShowPos, bShowNeg );
449cdf0e10cSrcweir 
450cdf0e10cSrcweir             if( bOldHasErrorBar &&
451cdf0e10cSrcweir                 ( bShowPos != bNewIndPos ||
452cdf0e10cSrcweir                   bShowNeg != bNewIndNeg ))
453cdf0e10cSrcweir             {
454cdf0e10cSrcweir                 xErrorBarProp->setPropertyValue( C2U( "ShowPositiveError" ), uno::makeAny( bNewIndPos ));
455cdf0e10cSrcweir                 xErrorBarProp->setPropertyValue( C2U( "ShowNegativeError" ), uno::makeAny( bNewIndNeg ));
456cdf0e10cSrcweir                 bChanged = true;
457cdf0e10cSrcweir             }
458cdf0e10cSrcweir         }
459cdf0e10cSrcweir         break;
460cdf0e10cSrcweir 
461cdf0e10cSrcweir         case SCHATTR_STAT_RANGE_POS:
462cdf0e10cSrcweir         case SCHATTR_STAT_RANGE_NEG:
463cdf0e10cSrcweir         {
464cdf0e10cSrcweir             // @todo: also be able to deal with x-error bars
465cdf0e10cSrcweir             const bool bYError = true;
466cdf0e10cSrcweir             uno::Reference< chart2::data::XDataSource > xErrorBarSource( lcl_GetYErrorBar( GetPropertySet()), uno::UNO_QUERY );
467cdf0e10cSrcweir             uno::Reference< chart2::XChartDocument > xChartDoc( m_xModel, uno::UNO_QUERY );
468cdf0e10cSrcweir             uno::Reference< chart2::data::XDataProvider > xDataProvider;
469cdf0e10cSrcweir 
470cdf0e10cSrcweir             if( xChartDoc.is())
471cdf0e10cSrcweir                 xDataProvider.set( xChartDoc->getDataProvider());
472cdf0e10cSrcweir             if( xErrorBarSource.is() && xDataProvider.is())
473cdf0e10cSrcweir             {
474cdf0e10cSrcweir                 ::rtl::OUString aNewRange( static_cast< const SfxStringItem & >( rItemSet.Get( nWhichId )).GetValue());
475cdf0e10cSrcweir                 bool bApplyNewRange = false;
476cdf0e10cSrcweir 
477cdf0e10cSrcweir                 bool bIsPositiveValue( nWhichId == SCHATTR_STAT_RANGE_POS );
478cdf0e10cSrcweir                 if( xChartDoc->hasInternalDataProvider())
479cdf0e10cSrcweir                 {
480*9ec58d04SHerbert Dürr                     if( !aNewRange.isEmpty() )
481cdf0e10cSrcweir                     {
482cdf0e10cSrcweir                         uno::Reference< chart2::data::XDataSequence > xSeq(
483cdf0e10cSrcweir                             StatisticsHelper::getErrorDataSequenceFromDataSource(
484cdf0e10cSrcweir                                 xErrorBarSource, bIsPositiveValue, bYError ));
485cdf0e10cSrcweir                         if( ! xSeq.is())
486cdf0e10cSrcweir                         {
487cdf0e10cSrcweir                             // no data range for error bars yet => create
488cdf0e10cSrcweir                             uno::Reference< chart2::XInternalDataProvider > xIntDataProvider( xDataProvider, uno::UNO_QUERY );
489cdf0e10cSrcweir                             OSL_ASSERT( xIntDataProvider.is());
490cdf0e10cSrcweir                             if( xIntDataProvider.is())
491cdf0e10cSrcweir                             {
492cdf0e10cSrcweir                                 xIntDataProvider->appendSequence();
493cdf0e10cSrcweir                                 aNewRange = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("last"));
494cdf0e10cSrcweir                                 bApplyNewRange = true;
495cdf0e10cSrcweir                             }
496cdf0e10cSrcweir                         }
497cdf0e10cSrcweir                     }
498cdf0e10cSrcweir                 }
499cdf0e10cSrcweir                 else
500cdf0e10cSrcweir                 {
501cdf0e10cSrcweir                     uno::Reference< chart2::data::XDataSequence > xSeq(
502cdf0e10cSrcweir                         StatisticsHelper::getErrorDataSequenceFromDataSource(
503cdf0e10cSrcweir                             xErrorBarSource, bIsPositiveValue, bYError ));
504cdf0e10cSrcweir                     bApplyNewRange =
505cdf0e10cSrcweir                         ! ( xSeq.is() && aNewRange.equals( xSeq->getSourceRangeRepresentation()));
506cdf0e10cSrcweir                 }
507cdf0e10cSrcweir 
508cdf0e10cSrcweir                 if( bApplyNewRange )
509cdf0e10cSrcweir                     StatisticsHelper::setErrorDataSequence(
510cdf0e10cSrcweir                         xErrorBarSource, xDataProvider, aNewRange, bIsPositiveValue, bYError );
511cdf0e10cSrcweir             }
512cdf0e10cSrcweir         }
513cdf0e10cSrcweir         break;
514cdf0e10cSrcweir     }
515cdf0e10cSrcweir 
516cdf0e10cSrcweir     return bChanged;
517cdf0e10cSrcweir }
518cdf0e10cSrcweir 
FillSpecialItem(sal_uInt16 nWhichId,SfxItemSet & rOutItemSet) const519cdf0e10cSrcweir void StatisticsItemConverter::FillSpecialItem(
520cdf0e10cSrcweir     sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const
521cdf0e10cSrcweir     throw( uno::Exception )
522cdf0e10cSrcweir {
523cdf0e10cSrcweir     switch( nWhichId )
524cdf0e10cSrcweir     {
525cdf0e10cSrcweir         case SCHATTR_STAT_AVERAGE:
526cdf0e10cSrcweir             rOutItemSet.Put(
527cdf0e10cSrcweir                 SfxBoolItem( nWhichId,
528cdf0e10cSrcweir                              RegressionCurveHelper::hasMeanValueLine(
529cdf0e10cSrcweir                                  uno::Reference< chart2::XRegressionCurveContainer >(
530cdf0e10cSrcweir                                      GetPropertySet(), uno::UNO_QUERY ))));
531cdf0e10cSrcweir             break;
532cdf0e10cSrcweir 
533cdf0e10cSrcweir         case SCHATTR_STAT_KIND_ERROR:
534cdf0e10cSrcweir         {
535cdf0e10cSrcweir             SvxChartKindError eErrorKind = CHERROR_NONE;
536cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xErrorBarProp(
537cdf0e10cSrcweir                 lcl_GetYErrorBar( GetPropertySet()));
538cdf0e10cSrcweir             if( xErrorBarProp.is() )
539cdf0e10cSrcweir             {
540cdf0e10cSrcweir                 sal_Int32 nStyle = 0;
541cdf0e10cSrcweir                 if( xErrorBarProp->getPropertyValue( C2U( "ErrorBarStyle" )) >>= nStyle )
542cdf0e10cSrcweir                 {
543cdf0e10cSrcweir                     switch( nStyle )
544cdf0e10cSrcweir                     {
545cdf0e10cSrcweir                         case ::com::sun::star::chart::ErrorBarStyle::NONE:
546cdf0e10cSrcweir                             break;
547cdf0e10cSrcweir                         case ::com::sun::star::chart::ErrorBarStyle::VARIANCE:
548cdf0e10cSrcweir                             eErrorKind = CHERROR_VARIANT; break;
549cdf0e10cSrcweir                         case ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION:
550cdf0e10cSrcweir                             eErrorKind = CHERROR_SIGMA; break;
551cdf0e10cSrcweir                         case ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE:
552cdf0e10cSrcweir                             eErrorKind = CHERROR_CONST; break;
553cdf0e10cSrcweir                         case ::com::sun::star::chart::ErrorBarStyle::RELATIVE:
554cdf0e10cSrcweir                             eErrorKind = CHERROR_PERCENT; break;
555cdf0e10cSrcweir                         case ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN:
556cdf0e10cSrcweir                             eErrorKind = CHERROR_BIGERROR; break;
557cdf0e10cSrcweir                         case ::com::sun::star::chart::ErrorBarStyle::STANDARD_ERROR:
558cdf0e10cSrcweir                             eErrorKind = CHERROR_STDERROR; break;
559cdf0e10cSrcweir                         case ::com::sun::star::chart::ErrorBarStyle::FROM_DATA:
560cdf0e10cSrcweir                             eErrorKind = CHERROR_RANGE; break;
561cdf0e10cSrcweir                     }
562cdf0e10cSrcweir                 }
563cdf0e10cSrcweir             }
564cdf0e10cSrcweir             rOutItemSet.Put( SvxChartKindErrorItem( eErrorKind, SCHATTR_STAT_KIND_ERROR ));
565cdf0e10cSrcweir         }
566cdf0e10cSrcweir         break;
567cdf0e10cSrcweir 
568cdf0e10cSrcweir         case SCHATTR_STAT_PERCENT:
569cdf0e10cSrcweir         {
570cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xErrorBarProp( lcl_GetYErrorBar( GetPropertySet()));
571cdf0e10cSrcweir             if( xErrorBarProp.is())
572cdf0e10cSrcweir             {
573cdf0e10cSrcweir                 double fPos, fNeg;
574cdf0e10cSrcweir                 lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
575cdf0e10cSrcweir                 rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, nWhichId ));
576cdf0e10cSrcweir             }
577cdf0e10cSrcweir         }
578cdf0e10cSrcweir         break;
579cdf0e10cSrcweir 
580cdf0e10cSrcweir         case SCHATTR_STAT_BIGERROR:
581cdf0e10cSrcweir         {
582cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xErrorBarProp( lcl_GetYErrorBar( GetPropertySet()));
583cdf0e10cSrcweir             if( xErrorBarProp.is())
584cdf0e10cSrcweir             {
585cdf0e10cSrcweir                 double fPos, fNeg;
586cdf0e10cSrcweir                 lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
587cdf0e10cSrcweir                 rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, nWhichId ));
588cdf0e10cSrcweir             }
589cdf0e10cSrcweir         }
590cdf0e10cSrcweir         break;
591cdf0e10cSrcweir 
592cdf0e10cSrcweir         case SCHATTR_STAT_CONSTPLUS:
593cdf0e10cSrcweir         {
594cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xErrorBarProp( lcl_GetYErrorBar( GetPropertySet()));
595cdf0e10cSrcweir             if( xErrorBarProp.is())
596cdf0e10cSrcweir             {
597cdf0e10cSrcweir                 double fPos, fNeg;
598cdf0e10cSrcweir                 lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
599cdf0e10cSrcweir                 rOutItemSet.Put( SvxDoubleItem( fPos, nWhichId ));
600cdf0e10cSrcweir             }
601cdf0e10cSrcweir         }
602cdf0e10cSrcweir         break;
603cdf0e10cSrcweir 
604cdf0e10cSrcweir         case SCHATTR_STAT_CONSTMINUS:
605cdf0e10cSrcweir         {
606cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xErrorBarProp( lcl_GetYErrorBar( GetPropertySet()));
607cdf0e10cSrcweir             if( xErrorBarProp.is())
608cdf0e10cSrcweir             {
609cdf0e10cSrcweir                 double fPos, fNeg;
610cdf0e10cSrcweir                 lcl_getErrorValues( xErrorBarProp, fPos, fNeg );
611cdf0e10cSrcweir                 rOutItemSet.Put( SvxDoubleItem( fNeg, nWhichId ));
612cdf0e10cSrcweir             }
613cdf0e10cSrcweir         }
614cdf0e10cSrcweir         break;
615cdf0e10cSrcweir 
616cdf0e10cSrcweir         case SCHATTR_REGRESSION_TYPE:
617cdf0e10cSrcweir         {
618cdf0e10cSrcweir             SvxChartRegress eRegress = static_cast< SvxChartRegress >(
619cdf0e10cSrcweir                 static_cast< sal_Int32 >(
620cdf0e10cSrcweir                     RegressionCurveHelper::getFirstRegressTypeNotMeanValueLine(
621cdf0e10cSrcweir                         uno::Reference< chart2::XRegressionCurveContainer >(
622cdf0e10cSrcweir                             GetPropertySet(), uno::UNO_QUERY ) )));
623cdf0e10cSrcweir             rOutItemSet.Put( SvxChartRegressItem( eRegress, SCHATTR_REGRESSION_TYPE ));
624cdf0e10cSrcweir         }
625cdf0e10cSrcweir         break;
626cdf0e10cSrcweir 
627cdf0e10cSrcweir         case SCHATTR_REGRESSION_SHOW_EQUATION:
628cdf0e10cSrcweir         {
629cdf0e10cSrcweir             bool bShowEq = false;
630cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xEqProp( lcl_getEquationProperties( GetPropertySet(), 0 ));
631cdf0e10cSrcweir             if( xEqProp.is())
632cdf0e10cSrcweir                 xEqProp->getPropertyValue( C2U("ShowEquation")) >>= bShowEq;
633cdf0e10cSrcweir             rOutItemSet.Put( SfxBoolItem( nWhichId, bShowEq ));
634cdf0e10cSrcweir         }
635cdf0e10cSrcweir         break;
636cdf0e10cSrcweir 
637cdf0e10cSrcweir         case SCHATTR_REGRESSION_SHOW_COEFF:
638cdf0e10cSrcweir         {
639cdf0e10cSrcweir             bool bShowCoeff = false;
640cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xEqProp( lcl_getEquationProperties( GetPropertySet(), 0 ));
641cdf0e10cSrcweir             if( xEqProp.is())
642cdf0e10cSrcweir                 xEqProp->getPropertyValue( C2U("ShowCorrelationCoefficient")) >>= bShowCoeff;
643cdf0e10cSrcweir             rOutItemSet.Put( SfxBoolItem( nWhichId, bShowCoeff ));
644cdf0e10cSrcweir         }
645cdf0e10cSrcweir         break;
646cdf0e10cSrcweir 
647cdf0e10cSrcweir         case SCHATTR_STAT_INDICATE:
648cdf0e10cSrcweir         {
649cdf0e10cSrcweir             uno::Reference< beans::XPropertySet > xErrorBarProp( lcl_GetYErrorBar( GetPropertySet()));
650cdf0e10cSrcweir             SvxChartIndicate eIndicate = CHINDICATE_BOTH;
651cdf0e10cSrcweir             if( xErrorBarProp.is())
652cdf0e10cSrcweir             {
653cdf0e10cSrcweir                 bool bShowPos, bShowNeg;
654cdf0e10cSrcweir                 lcl_getErrorIndicatorValues( xErrorBarProp, bShowPos, bShowNeg );
655cdf0e10cSrcweir 
656cdf0e10cSrcweir                 if( bShowPos )
657cdf0e10cSrcweir                 {
658cdf0e10cSrcweir                     if( bShowNeg )
659cdf0e10cSrcweir                         eIndicate = CHINDICATE_BOTH;
660cdf0e10cSrcweir                     else
661cdf0e10cSrcweir                         eIndicate = CHINDICATE_UP;
662cdf0e10cSrcweir                 }
663cdf0e10cSrcweir                 else
664cdf0e10cSrcweir                 {
665cdf0e10cSrcweir                     if( bShowNeg )
666cdf0e10cSrcweir                         eIndicate = CHINDICATE_DOWN;
667cdf0e10cSrcweir                     else
668cdf0e10cSrcweir                         eIndicate = CHINDICATE_NONE;
669cdf0e10cSrcweir                 }
670cdf0e10cSrcweir             }
671cdf0e10cSrcweir             rOutItemSet.Put( SvxChartIndicateItem( eIndicate, SCHATTR_STAT_INDICATE ));
672cdf0e10cSrcweir         }
673cdf0e10cSrcweir         break;
674cdf0e10cSrcweir 
675cdf0e10cSrcweir         case SCHATTR_STAT_RANGE_POS:
676cdf0e10cSrcweir         case SCHATTR_STAT_RANGE_NEG:
677cdf0e10cSrcweir         {
678cdf0e10cSrcweir             uno::Reference< chart2::data::XDataSource > xErrorBarSource( lcl_GetYErrorBar( GetPropertySet()), uno::UNO_QUERY );
679cdf0e10cSrcweir             if( xErrorBarSource.is())
680cdf0e10cSrcweir             {
681cdf0e10cSrcweir                 uno::Reference< chart2::data::XDataSequence > xSeq(
682cdf0e10cSrcweir                     StatisticsHelper::getErrorDataSequenceFromDataSource(
683cdf0e10cSrcweir                         xErrorBarSource, (nWhichId == SCHATTR_STAT_RANGE_POS) /*, true */ /* y */ ));
684cdf0e10cSrcweir                 if( xSeq.is())
685cdf0e10cSrcweir                     rOutItemSet.Put( SfxStringItem( nWhichId, String( xSeq->getSourceRangeRepresentation())));
686cdf0e10cSrcweir             }
687cdf0e10cSrcweir         }
688cdf0e10cSrcweir         break;
689cdf0e10cSrcweir    }
690cdf0e10cSrcweir }
691cdf0e10cSrcweir 
692cdf0e10cSrcweir } //  namespace wrapper
693cdf0e10cSrcweir } //  namespace chart
694