diff options
Diffstat (limited to 'chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx')
-rw-r--r-- | chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx b/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx index 5a8114c215c9..f97ae631ee02 100644 --- a/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/ErrorBarItemConverter.cxx @@ -22,6 +22,7 @@ #include <StatisticsHelper.hxx> #include <GraphicPropertyItemConverter.hxx> +#include <ChartModel.hxx> #include <svl/stritem.hxx> #include <svx/chrtitem.hxx> @@ -30,7 +31,8 @@ #include <com/sun/star/chart2/XInternalDataProvider.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart/ErrorBarStyle.hpp> -#include <tools/diagnose_ex.h> +#include <utility> +#include <comphelper/diagnose_ex.hxx> using namespace ::com::sun::star; @@ -45,8 +47,8 @@ void lcl_getErrorValues( const uno::Reference< beans::XPropertySet > & xErrorBar try { - xErrorBarProp->getPropertyValue( "PositiveError" ) >>= rOutPosError; - xErrorBarProp->getPropertyValue( "NegativeError" ) >>= rOutNegError; + xErrorBarProp->getPropertyValue( u"PositiveError"_ustr ) >>= rOutPosError; + xErrorBarProp->getPropertyValue( u"NegativeError"_ustr ) >>= rOutNegError; } catch( const uno::Exception & ) { @@ -63,8 +65,8 @@ void lcl_getErrorIndicatorValues( try { - xErrorBarProp->getPropertyValue( "ShowPositiveError" ) >>= rOutShowPosError; - xErrorBarProp->getPropertyValue( "ShowNegativeError" ) >>= rOutShowNegError; + xErrorBarProp->getPropertyValue( u"ShowPositiveError"_ustr ) >>= rOutShowPosError; + xErrorBarProp->getPropertyValue( u"ShowNegativeError"_ustr ) >>= rOutShowNegError; } catch( const uno::Exception & ) { @@ -78,17 +80,16 @@ namespace chart::wrapper { ErrorBarItemConverter::ErrorBarItemConverter( - const uno::Reference< frame::XModel > & xModel, + const rtl::Reference< ChartModel > & xChartModel, const uno::Reference< beans::XPropertySet > & rPropertySet, SfxItemPool& rItemPool, - SdrModel& rDrawModel, - const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory ) : + SdrModel& rDrawModel ) : ItemConverter( rPropertySet, rItemPool ), m_spGraphicConverter( std::make_shared<GraphicPropertyItemConverter>( rPropertySet, rItemPool, rDrawModel, - xNamedPropertyContainerFactory, + xChartModel, GraphicObjectType::LineProperties )), - m_xModel( xModel ) + m_xModel(xChartModel) {} ErrorBarItemConverter::~ErrorBarItemConverter() @@ -110,7 +111,7 @@ bool ErrorBarItemConverter::ApplyItemSet( const SfxItemSet & rItemSet ) return ItemConverter::ApplyItemSet( rItemSet ) || bResult; } -const sal_uInt16 * ErrorBarItemConverter::GetWhichPairs() const +const WhichRangesContainer& ErrorBarItemConverter::GetWhichPairs() const { // must span all used items! return nErrorBarWhichPairs; @@ -169,7 +170,7 @@ bool ErrorBarItemConverter::ApplySpecialItem( nStyle = css::chart::ErrorBarStyle::FROM_DATA; break; } - xErrorBarProp->setPropertyValue( "ErrorBarStyle" , uno::Any( nStyle )); + xErrorBarProp->setPropertyValue( u"ErrorBarStyle"_ustr , uno::Any( nStyle )); bChanged = true; } } @@ -190,8 +191,8 @@ bool ErrorBarItemConverter::ApplySpecialItem( if( ! ( ::rtl::math::approxEqual( fPos, fValue ) && ::rtl::math::approxEqual( fNeg, fValue ))) { - xErrorBarProp->setPropertyValue( "PositiveError" , uno::Any( fValue )); - xErrorBarProp->setPropertyValue( "NegativeError" , uno::Any( fValue )); + xErrorBarProp->setPropertyValue( u"PositiveError"_ustr , uno::Any( fValue )); + xErrorBarProp->setPropertyValue( u"NegativeError"_ustr , uno::Any( fValue )); bChanged = true; } } @@ -207,7 +208,7 @@ bool ErrorBarItemConverter::ApplySpecialItem( if( ! ::rtl::math::approxEqual( fPos, fValue )) { - GetPropertySet()->setPropertyValue( "PositiveError" , uno::Any( fValue )); + GetPropertySet()->setPropertyValue( u"PositiveError"_ustr , uno::Any( fValue )); bChanged = true; } } @@ -225,7 +226,7 @@ bool ErrorBarItemConverter::ApplySpecialItem( if( ! ::rtl::math::approxEqual( fNeg, fValue )) { - xErrorBarProp->setPropertyValue( "NegativeError" , uno::Any( fValue )); + xErrorBarProp->setPropertyValue( u"NegativeError"_ustr , uno::Any( fValue )); bChanged = true; } } @@ -248,8 +249,8 @@ bool ErrorBarItemConverter::ApplySpecialItem( if( bShowPos != bNewIndPos || bShowNeg != bNewIndNeg ) { - xErrorBarProp->setPropertyValue( "ShowPositiveError" , uno::Any( bNewIndPos )); - xErrorBarProp->setPropertyValue( "ShowNegativeError" , uno::Any( bNewIndNeg )); + xErrorBarProp->setPropertyValue( u"ShowPositiveError"_ustr , uno::Any( bNewIndPos )); + xErrorBarProp->setPropertyValue( u"ShowNegativeError"_ustr , uno::Any( bNewIndNeg )); bChanged = true; } } @@ -326,7 +327,7 @@ void ErrorBarItemConverter::FillSpecialItem( uno::Reference< beans::XPropertySet > xErrorBarProp( GetPropertySet()); sal_Int32 nStyle = 0; - if( xErrorBarProp->getPropertyValue( "ErrorBarStyle" ) >>= nStyle ) + if( xErrorBarProp->getPropertyValue( u"ErrorBarStyle"_ustr ) >>= nStyle ) { switch( nStyle ) { @@ -346,6 +347,8 @@ void ErrorBarItemConverter::FillSpecialItem( eErrorKind = SvxChartKindError::StdError; break; case css::chart::ErrorBarStyle::FROM_DATA: eErrorKind = SvxChartKindError::Range; break; + default: + eErrorKind = SvxChartKindError::NONE; break; } } rOutItemSet.Put( SvxChartKindErrorItem( eErrorKind, SCHATTR_STAT_KIND_ERROR )); @@ -356,7 +359,7 @@ void ErrorBarItemConverter::FillSpecialItem( { double fPos(0.0), fNeg(0.0); lcl_getErrorValues( GetPropertySet(), fPos, fNeg ); - rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, nWhichId )); + rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, SCHATTR_STAT_PERCENT )); } break; @@ -364,7 +367,7 @@ void ErrorBarItemConverter::FillSpecialItem( { double fPos(0.0), fNeg(0.0); lcl_getErrorValues( GetPropertySet(), fPos, fNeg ); - rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, nWhichId )); + rOutItemSet.Put( SvxDoubleItem( ( fPos + fNeg ) / 2.0, SCHATTR_STAT_BIGERROR )); } break; @@ -372,7 +375,7 @@ void ErrorBarItemConverter::FillSpecialItem( { double fPos(0.0), fNeg(0.0); lcl_getErrorValues( GetPropertySet(), fPos, fNeg ); - rOutItemSet.Put( SvxDoubleItem( fPos, nWhichId )); + rOutItemSet.Put( SvxDoubleItem( fPos, SCHATTR_STAT_CONSTPLUS )); } break; @@ -380,7 +383,7 @@ void ErrorBarItemConverter::FillSpecialItem( { double fPos(0.0), fNeg(0.0); lcl_getErrorValues( GetPropertySet(), fPos, fNeg ); - rOutItemSet.Put( SvxDoubleItem( fNeg, nWhichId )); + rOutItemSet.Put( SvxDoubleItem( fNeg, SCHATTR_STAT_CONSTMINUS )); } break; |