chart2/inc/ChartModel.hxx | 5 - chart2/inc/ChartView.hxx | 3 chart2/source/controller/dialogs/DataBrowser.cxx | 4 chart2/source/controller/dialogs/ObjectNameProvider.cxx | 8 - chart2/source/controller/dialogs/dlg_ObjectProperties.cxx | 2 chart2/source/controller/inc/dlg_ObjectProperties.hxx | 4 chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx | 2 chart2/source/controller/main/ChartController_Insert.cxx | 6 - chart2/source/controller/main/ChartController_Properties.cxx | 6 - chart2/source/inc/DiagramHelper.hxx | 9 + chart2/source/inc/NumberFormatterWrapper.hxx | 17 +-- chart2/source/model/main/ChartModel.cxx | 32 +++--- chart2/source/tools/AxisHelper.cxx | 8 - chart2/source/tools/DiagramHelper.cxx | 7 - chart2/source/tools/NumberFormatterWrapper.cxx | 48 ++-------- chart2/source/view/axes/VAxisBase.cxx | 5 - chart2/source/view/axes/VAxisBase.hxx | 7 - chart2/source/view/axes/VCartesianAxis.cxx | 5 - chart2/source/view/axes/VCartesianAxis.hxx | 4 chart2/source/view/axes/VCartesianCoordinateSystem.cxx | 3 chart2/source/view/axes/VPolarAngleAxis.cxx | 2 chart2/source/view/axes/VPolarAngleAxis.hxx | 2 chart2/source/view/axes/VPolarAxis.cxx | 4 chart2/source/view/axes/VPolarAxis.hxx | 6 - chart2/source/view/axes/VPolarCoordinateSystem.cxx | 3 chart2/source/view/axes/VPolarRadiusAxis.cxx | 2 chart2/source/view/axes/VPolarRadiusAxis.hxx | 2 chart2/source/view/charttypes/VSeriesPlotter.cxx | 3 chart2/source/view/inc/VSeriesPlotter.hxx | 4 chart2/source/view/main/ChartView.cxx | 5 - chart2/source/view/main/SeriesPlotterContainer.cxx | 7 - 31 files changed, 110 insertions(+), 115 deletions(-)
New commits: commit 1886ecf7ee10cc51ca90fe1365e4a8ef2a1b6f27 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Apr 4 12:19:22 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Apr 4 14:21:15 2025 +0200 use more concrete UNO in chart2 Change-Id: Id71c919abb85039d7fdfdb334e505f293e530255 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183706 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index 49012cd5e0a1..44e6c3c60a25 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -159,8 +159,7 @@ private: rtl::Reference< InternalDataProvider > m_xInternalDataProvider; rtl::Reference< SvNumberFormatsSupplierObj > m_xOwnNumberFormatsSupplier; - css::uno::Reference< css::util::XNumberFormatsSupplier > - m_xNumberFormatsSupplier; + rtl::Reference< SvNumberFormatsSupplierObj > m_xNumberFormatsSupplier; std::unique_ptr< SvNumberFormatter > m_apSvNumberFormatter; // #i113784# avoid memory leak rtl::Reference< ::chart::ChartTypeManager > @@ -457,7 +456,7 @@ public: virtual OUString SAL_CALL dump(OUString const & kind) override; // normal methods - css::uno::Reference< css::util::XNumberFormatsSupplier > const & + rtl::Reference< SvNumberFormatsSupplierObj > const & getNumberFormatsSupplier(); ChartView* getChartView() const; diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx index 05147f669d1f..f30db7613d1a 100644 --- a/chart2/inc/ChartView.hxx +++ b/chart2/inc/ChartView.hxx @@ -51,6 +51,7 @@ namespace com::sun::star::util { class XUpdatable2; } namespace com::sun::star::util { class XNumberFormatsSupplier; } class SdrPage; +class SvNumberFormatsSupplierObj; namespace chart { @@ -207,7 +208,7 @@ public: static sal_Int32 getExplicitPercentageNumberFormatKeyForDataLabel( const css::uno::Reference< css::beans::XPropertySet >& xSeriesOrPointProp - , const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); + , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier ); private: //methods void createShapes(); diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index 4238396c4d19..a06c82f69061 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -713,7 +713,7 @@ OUString DataBrowser::GetCellText( sal_Int32 nRow, sal_uInt16 nColumnId ) const // getDateTimeInputNumberFormat() instead of doing the // guess work. sal_Int32 nNumberFormat = DiagramHelper::getDateTimeInputNumberFormat( - m_xChartDoc, fDouble ); + m_xChartDoc->getNumberFormatsSupplier(), fDouble ); Color nLabelColor; bool bColorChanged = false; aResult = m_spNumberFormatterWrapper->getFormattedString( @@ -831,7 +831,7 @@ void DataBrowser::SetDataFromModel( m_apDataBrowserModel.reset( new DataBrowserModel( m_xChartDoc )); m_spNumberFormatterWrapper = - std::make_shared<NumberFormatterWrapper>(m_xChartDoc); + std::make_shared<NumberFormatterWrapper>(m_xChartDoc->getNumberFormatsSupplier()); Formatter& rFormatter = m_aNumberEditField->get_formatter(); rFormatter.SetFormatter( m_spNumberFormatterWrapper->getSvNumberFormatter() ); diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx index 172ef460a0a7..2f4e9ba1668d 100644 --- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx +++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx @@ -98,7 +98,7 @@ void lcl_addText( OUString& rOut, std::u16string_view rSeparator, std::u16string OUString lcl_getDataPointValueText( const rtl::Reference< DataSeries >& xSeries, sal_Int32 nPointIndex, const rtl::Reference< BaseCoordinateSystem >& xCooSys, - const Reference< frame::XModel >& xChartModel ) + const rtl::Reference<::chart::ChartModel>& xChartModel ) { OUString aRet; @@ -111,8 +111,7 @@ OUString lcl_getDataPointValueText( const rtl::Reference< DataSeries >& xSeries, OUString aX, aY, aY_Min, aY_Max, aY_First, aY_Last, a_Size; double fValue = 0; - uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( xChartModel, uno::UNO_QUERY ); - NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier ); + NumberFormatterWrapper aNumberFormatterWrapper( xChartModel->getNumberFormatsSupplier() ); Color nLabelColor;//dummy bool bColorChanged;//dummy @@ -191,8 +190,7 @@ OUString lcl_getDataPointValueText( const rtl::Reference< DataSeries >& xSeries, if( aX.isEmpty() ) { - ChartModel& rModel = dynamic_cast<ChartModel&>(*xChartModel); - aRet = ExplicitCategoriesProvider::getCategoryByIndex( xCooSys, rModel, nPointIndex ); + aRet = ExplicitCategoriesProvider::getCategoryByIndex( xCooSys, *xChartModel, nPointIndex ); } else { diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index 97d922b0f3ac..39fdc63e611b 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -330,7 +330,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent, const SfxItemSet* pAttr, const ObjectPropertiesDialogParameter* pDialogParameter, const ViewElementListProvider* pViewElementListProvider, - const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier) + const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier) : SfxTabDialogController(pParent, u"modules/schart/ui/attributedialog.ui"_ustr, u"AttributeDialog"_ustr, pAttr) , m_pParameter( pDialogParameter ) , m_pViewElementListProvider( pViewElementListProvider ) diff --git a/chart2/source/controller/inc/dlg_ObjectProperties.hxx b/chart2/source/controller/inc/dlg_ObjectProperties.hxx index f16aee1e611b..66bdf1cab8db 100644 --- a/chart2/source/controller/inc/dlg_ObjectProperties.hxx +++ b/chart2/source/controller/inc/dlg_ObjectProperties.hxx @@ -23,7 +23,7 @@ #include <vcl/graph.hxx> class SvNumberFormatter; - +class SvNumberFormatsSupplierObj; namespace com::sun::star::util { class XNumberFormatsSupplier; } namespace chart @@ -130,7 +130,7 @@ public: SchAttribTabDlg(weld::Window* pParent, const SfxItemSet* pAttr, const ObjectPropertiesDialogParameter* pDialogParameter, const ViewElementListProvider* pViewElementListProvider, - const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); + const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier ); virtual ~SchAttribTabDlg() override; //pSymbolShapeProperties: Properties to be set on the symbollist shapes diff --git a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx index fe6a3a07e5a4..3ea7be7c7c52 100644 --- a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx +++ b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx @@ -113,7 +113,7 @@ AllDataLabelItemConverter::AllDataLabelItemConverter( sal_Int32 nNumberFormat=ChartView::getExplicitNumberFormatKeyForDataLabel( series ); sal_Int32 nPercentNumberFormat=ChartView::getExplicitPercentageNumberFormatKeyForDataLabel( - series,xChartModel); + series, xChartModel->getNumberFormatsSupplier()); m_aConverters.emplace_back( new ::chart::wrapper::DataPointItemConverter( diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx index 707ca4b0e702..94c4ba6129b2 100644 --- a/chart2/source/controller/main/ChartController_Insert.cxx +++ b/chart2/source/controller/main/ChartController_Insert.cxx @@ -391,7 +391,7 @@ void ChartController::executeDispatch_InsertMenu_DataLabels() SolarMutexGuard aGuard; //get number formatter - NumberFormatterWrapper aNumberFormatterWrapper( getChartModel() ); + NumberFormatterWrapper aNumberFormatterWrapper( getChartModel()->getNumberFormatsSupplier() ); SvNumberFormatter* pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter(); DataLabelsDialog aDlg(GetChartFrame(), aItemSet, pNumberFormatter); @@ -499,7 +499,7 @@ void ChartController::executeDispatch_InsertTrendline() ViewElementListProvider aViewElementListProvider( m_pDrawModelWrapper.get()); SolarMutexGuard aGuard; auto aDialog = std::make_shared<SchAttribTabDlg>(GetChartFrame(), &aItemSet, &aDialogParameter, - &aViewElementListProvider, getChartModel()); + &aViewElementListProvider, getChartModel()->getNumberFormatsSupplier()); // note: when a user pressed "OK" but didn't change any settings in the // dialog, the SfxTabDialog returns "Cancel" @@ -559,7 +559,7 @@ void ChartController::executeDispatch_InsertErrorBars( bool bYError ) auto aDlg = std::make_shared<SchAttribTabDlg>( GetChartFrame(), &aItemSet, &aDialogParameter, &aViewElementListProvider, - getChartModel() ); + getChartModel()->getNumberFormatsSupplier() ); aDlg->SetAxisMinorStepWidthForErrorBarDecimals( InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( getChartModel(), m_xChartView, m_aSelection.getSelectedCID())); diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 8722da51ec51..0244f7efc28d 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -179,7 +179,7 @@ wrapper::ItemConverter* createItemConverter( sal_Int32 nNumberFormat = ChartView::getExplicitNumberFormatKeyForDataLabel( xObjectProperties ); sal_Int32 nPercentNumberFormat = ChartView::getExplicitPercentageNumberFormatKeyForDataLabel( - xObjectProperties, xChartModel); + xObjectProperties, xChartModel->getNumberFormatsSupplier()); pItemConverter = new wrapper::TextLabelItemConverter( xChartModel, xObjectProperties, xSeries, @@ -232,7 +232,7 @@ wrapper::ItemConverter* createItemConverter( } sal_Int32 nNumberFormat=ChartView::getExplicitNumberFormatKeyForDataLabel( xObjectProperties ); sal_Int32 nPercentNumberFormat=ChartView::getExplicitPercentageNumberFormatKeyForDataLabel( - xObjectProperties, xChartModel); + xObjectProperties, xChartModel->getNumberFormatsSupplier()); pItemConverter = new wrapper::DataPointItemConverter( xChartModel, xContext, xObjectProperties, xSeries, rDrawModel.GetItemPool(), rDrawModel, @@ -752,7 +752,7 @@ void ChartController::executeDlg_ObjectProperties_withUndoGuard( std::shared_ptr<SchAttribTabDlg> aDlgPtr = std::make_shared<SchAttribTabDlg>( GetChartFrame(), &aItemSet, &aDialogParameter, &aViewElementListProvider, - xChartDoc); + xChartDoc->getNumberFormatsSupplier()); if(aDialogParameter.HasSymbolProperties()) { diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx index 880f3e786a94..7b6079dae5b3 100644 --- a/chart2/source/inc/DiagramHelper.hxx +++ b/chart2/source/inc/DiagramHelper.hxx @@ -26,6 +26,7 @@ namespace chart { class ChartModel; } namespace com::sun::star::util { class XNumberFormats; } namespace com::sun::star::util { class XNumberFormatsSupplier; } +class SvNumberFormatsSupplierObj; namespace chart { @@ -69,11 +70,11 @@ public: const rtl::Reference<::chart::ChartModel> & xChartDoc ); static bool isDateNumberFormat( sal_Int32 nNumberFormat, const css::uno::Reference< css::util::XNumberFormats >& xNumberFormats ); - static sal_Int32 getDateNumberFormat( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); - static sal_Int32 getDateTimeInputNumberFormat( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier, double fNumber ); + static sal_Int32 getDateNumberFormat( const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier ); + static sal_Int32 getDateTimeInputNumberFormat( const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier, double fNumber ); - static sal_Int32 getPercentNumberFormat( const css::uno::Reference< - css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); + static sal_Int32 getPercentNumberFormat( const rtl::Reference< + SvNumberFormatsSupplierObj >& xNumberFormatsSupplier ); static bool areChartTypesCompatible( const rtl::Reference< ::chart::ChartType >& xFirstType, diff --git a/chart2/source/inc/NumberFormatterWrapper.hxx b/chart2/source/inc/NumberFormatterWrapper.hxx index a229beafcda2..5d90b5f30d07 100644 --- a/chart2/source/inc/NumberFormatterWrapper.hxx +++ b/chart2/source/inc/NumberFormatterWrapper.hxx @@ -20,10 +20,13 @@ #include <config_options.h> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include <rtl/ref.hxx> #include <tools/date.hxx> +#include <optional> class SvNumberFormatter; class Color; +class SvNumberFormatsSupplierObj; namespace chart { @@ -31,28 +34,26 @@ namespace chart class NumberFormatterWrapper final { public: - NumberFormatterWrapper( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xSupplier ); + NumberFormatterWrapper( const rtl::Reference< SvNumberFormatsSupplierObj >& xSupplier ); ~NumberFormatterWrapper(); SvNumberFormatter* getSvNumberFormatter() const { return m_pNumberFormatter;} - const css::uno::Reference< css::util::XNumberFormatsSupplier >& + const rtl::Reference< SvNumberFormatsSupplierObj >& getNumberFormatsSupplier() const { return m_xNumberFormatsSupplier; }; OUString getFormattedString( sal_Int32 nNumberFormatKey, double fValue, Color& rLabelColor, bool& rbColorChanged ) const; Date getNullDate() const; -private: //private member - css::uno::Reference< css::util::XNumberFormatsSupplier > - m_xNumberFormatsSupplier; - +private: + rtl::Reference< SvNumberFormatsSupplierObj > m_xNumberFormatsSupplier; SvNumberFormatter* m_pNumberFormatter; - css::uno::Any m_aNullDate; + std::optional<Date> m_aNullDate; }; class FixedNumberFormatter final { public: - FixedNumberFormatter( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xSupplier + FixedNumberFormatter( const rtl::Reference< SvNumberFormatsSupplierObj >& xSupplier , sal_Int32 nNumberFormatKey ); ~FixedNumberFormatter(); diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index bc718c89878d..e778a227f7d6 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -820,16 +820,23 @@ void SAL_CALL ChartModel::attachNumberFormatsSupplier( const uno::Reference< uti { { MutexGuard aGuard( m_aModelMutex ); - if( xNewSupplier == m_xNumberFormatsSupplier ) - return; - if( xNewSupplier == uno::Reference<XNumberFormatsSupplier>(m_xOwnNumberFormatsSupplier) ) - return; - if( m_xOwnNumberFormatsSupplier.is() && xNewSupplier.is() ) + if (xNewSupplier) { - //@todo - //merge missing numberformats from own to new formatter + SvNumberFormatsSupplierObj* pNew = dynamic_cast<SvNumberFormatsSupplierObj*>(xNewSupplier.get()); + assert(pNew); + if( pNew == m_xNumberFormatsSupplier.get() ) + return; + if( pNew == m_xOwnNumberFormatsSupplier.get() ) + return; + if( m_xOwnNumberFormatsSupplier.is() && xNewSupplier.is() ) + { + //@todo + //merge missing numberformats from own to new formatter + } + m_xNumberFormatsSupplier = pNew; + m_xOwnNumberFormatsSupplier.clear(); } - else if( !xNewSupplier.is() ) + else { if( m_xNumberFormatsSupplier.is() ) { @@ -837,10 +844,9 @@ void SAL_CALL ChartModel::attachNumberFormatsSupplier( const uno::Reference< uti //merge missing numberformats from old numberformatter to own numberformatter //create own numberformatter if necessary } + m_xNumberFormatsSupplier.clear(); + m_xOwnNumberFormatsSupplier.clear(); } - - m_xNumberFormatsSupplier.set( xNewSupplier ); - m_xOwnNumberFormatsSupplier.clear(); } setModified( true ); } @@ -1223,7 +1229,7 @@ Sequence< OUString > SAL_CALL ChartModel::getAvailableServiceNames() return aResult; } -Reference< util::XNumberFormatsSupplier > const & ChartModel::getNumberFormatsSupplier() +rtl::Reference< SvNumberFormatsSupplierObj > const & ChartModel::getNumberFormatsSupplier() { if( !m_xNumberFormatsSupplier.is() ) { @@ -1243,7 +1249,7 @@ Reference< util::XNumberFormatsSupplier > const & ChartModel::getNumberFormatsSu { if( comphelper::isUnoTunnelId<SvNumberFormatsSupplierObj>(aIdentifier) ) { - Reference< lang::XUnoTunnel > xTunnel( getNumberFormatsSupplier(), uno::UNO_QUERY ); + Reference< lang::XUnoTunnel > xTunnel( getNumberFormatsSupplier() ); if( xTunnel.is() ) return xTunnel->getSomething( aIdentifier ); } diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 90233baddfae..48da6b5a0e26 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -159,7 +159,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( ScaleData aData = AxisHelper::getDateCheckedScale( xAxis, *xChartDoc ); if( aData.AxisType==AxisType::PERCENT ) { - sal_Int32 nPercentFormat = DiagramHelper::getPercentNumberFormat( xChartDoc ); + sal_Int32 nPercentFormat = DiagramHelper::getPercentNumberFormat( xChartDoc->getNumberFormatsSupplier() ); if( nPercentFormat != -1 ) { nNumberFormatKey = nPercentFormat; @@ -174,7 +174,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( if( xSeq.is() && !( xChartDoc.is() && xChartDoc->hasInternalDataProvider()) ) nNumberFormatKey = xSeq->getNumberFormatKeyByIndex( -1 ); else - nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc ); + nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc->getNumberFormatsSupplier() ); bFormatSet = true; } } @@ -183,7 +183,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( rtl::Reference< Diagram > xDiagram( xChartDoc->getFirstChartDiagram() ); if( xDiagram->isSupportingDateAxis() ) { - nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc ); + nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc->getNumberFormatsSupplier() ); } else { @@ -213,7 +213,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( } } if( bHasValidDoubles ) - nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc ); + nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc->getNumberFormatsSupplier() ); } } } diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index fb2643743e1e..c887a5dc32af 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -44,6 +44,7 @@ #include <unotools/saveopt.hxx> #include <svl/numformat.hxx> +#include <svl/numuno.hxx> #include <svl/zforlist.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> @@ -340,7 +341,7 @@ bool DiagramHelper::isDateNumberFormat( sal_Int32 nNumberFormat, const Reference return bIsDate; } -sal_Int32 DiagramHelper::getDateNumberFormat( const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier ) +sal_Int32 DiagramHelper::getDateNumberFormat( const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier ) { sal_Int32 nRet=-1; @@ -368,7 +369,7 @@ sal_Int32 DiagramHelper::getDateNumberFormat( const Reference< util::XNumberForm return nRet; } -sal_Int32 DiagramHelper::getDateTimeInputNumberFormat( const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier, double fNumber ) +sal_Int32 DiagramHelper::getDateTimeInputNumberFormat( const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier, double fNumber ) { sal_Int32 nRet = 0; @@ -388,7 +389,7 @@ sal_Int32 DiagramHelper::getDateTimeInputNumberFormat( const Reference< util::XN return nRet; } -sal_Int32 DiagramHelper::getPercentNumberFormat( const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier ) +sal_Int32 DiagramHelper::getPercentNumberFormat( const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier ) { sal_Int32 nRet=-1; const LanguageTag& rLanguageTag = Application::GetSettings().GetLanguageTag(); diff --git a/chart2/source/tools/NumberFormatterWrapper.cxx b/chart2/source/tools/NumberFormatterWrapper.cxx index 9687fd60e161..cab3e0945130 100644 --- a/chart2/source/tools/NumberFormatterWrapper.cxx +++ b/chart2/source/tools/NumberFormatterWrapper.cxx @@ -30,7 +30,7 @@ namespace chart using namespace ::com::sun::star; FixedNumberFormatter::FixedNumberFormatter( - const uno::Reference< util::XNumberFormatsSupplier >& xSupplier + const rtl::Reference< SvNumberFormatsSupplierObj >& xSupplier , sal_Int32 nNumberFormatKey ) : m_aNumberFormatterWrapper(xSupplier) , m_nNumberFormatKey( nNumberFormatKey ) @@ -47,18 +47,15 @@ OUString FixedNumberFormatter::getFormattedString( double fValue, Color& rLabelC m_nNumberFormatKey, fValue, rLabelColor, rbColorChanged ); } -NumberFormatterWrapper::NumberFormatterWrapper( const uno::Reference< util::XNumberFormatsSupplier >& xSupplier ) +NumberFormatterWrapper::NumberFormatterWrapper( const rtl::Reference< SvNumberFormatsSupplierObj >& xSupplier ) : m_xNumberFormatsSupplier(xSupplier) , m_pNumberFormatter(nullptr) { - uno::Reference<beans::XPropertySet> xProp(m_xNumberFormatsSupplier,uno::UNO_QUERY); - OUString sNullDate( u"NullDate"_ustr ); - if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName(sNullDate) ) - m_aNullDate = xProp->getPropertyValue(sNullDate); - SvNumberFormatsSupplierObj* pSupplierObj = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>( xSupplier ); - if( pSupplierObj ) - m_pNumberFormatter = pSupplierObj->GetNumberFormatter(); + if( m_xNumberFormatsSupplier ) + m_pNumberFormatter = m_xNumberFormatsSupplier->GetNumberFormatter(); + if( m_pNumberFormatter ) + m_aNullDate = m_pNumberFormatter->GetNullDate(); SAL_WARN_IF(!m_pNumberFormatter,"chart2.tools","need a numberformatter"); } @@ -66,33 +63,13 @@ NumberFormatterWrapper::~NumberFormatterWrapper() { } -namespace -{ - bool getDate(const css::uno::Any& rAny, util::Date& rDate) - { - if (rAny >>= rDate) - return true; - util::DateTime aUtilDateTime; - if (rAny >>= aUtilDateTime) - { - rDate.Day = aUtilDateTime.Day; - rDate.Month = aUtilDateTime.Month; - rDate.Year = aUtilDateTime.Year; - return true; - } - SAL_WARN("chart2.tools", "neither a util::Date nor a util::DateTime"); - return false; - } -} - Date NumberFormatterWrapper::getNullDate() const { Date aRet(30,12,1899); - util::Date aUtilDate; - if (m_aNullDate.hasValue() && getDate(m_aNullDate, aUtilDate)) + if (m_aNullDate) { - aRet = Date(aUtilDate.Day,aUtilDate.Month,aUtilDate.Year); + return *m_aNullDate; } else if( m_pNumberFormatter ) { @@ -114,21 +91,20 @@ OUString NumberFormatterWrapper::getFormattedString( sal_Int32 nNumberFormatKey, // i99104 handle null date correctly sal_Int16 nYear = 1899; sal_uInt16 nDay = 30,nMonth = 12; - if ( m_aNullDate.hasValue() ) + if ( m_aNullDate ) { const Date& rDate = m_pNumberFormatter->GetNullDate(); nYear = rDate.GetYear(); nMonth = rDate.GetMonth(); nDay = rDate.GetDay(); - util::Date aNewNullDate; - if (getDate(m_aNullDate, aNewNullDate)) - m_pNumberFormatter->ChangeNullDate(aNewNullDate.Day,aNewNullDate.Month,aNewNullDate.Year); + util::Date aNewNullDate = m_aNullDate->GetUNODate(); + m_pNumberFormatter->ChangeNullDate(aNewNullDate.Day,aNewNullDate.Month,aNewNullDate.Year); } // tdf#130969: use UNLIMITED_PRECISION in case of GENERAL Number Format if( m_pNumberFormatter->GetStandardPrec() != SvNumberFormatter::UNLIMITED_PRECISION ) m_pNumberFormatter->ChangeStandardPrec(SvNumberFormatter::UNLIMITED_PRECISION); m_pNumberFormatter->GetOutputString(fValue, nNumberFormatKey, aText, &pTextColor); - if ( m_aNullDate.hasValue() ) + if ( m_aNullDate ) { m_pNumberFormatter->ChangeNullDate(nDay,nMonth,nYear); } diff --git a/chart2/source/view/axes/VAxisBase.cxx b/chart2/source/view/axes/VAxisBase.cxx index 6578a3d5d092..b97c99331755 100644 --- a/chart2/source/view/axes/VAxisBase.cxx +++ b/chart2/source/view/axes/VAxisBase.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/chart2/data/XTextualDataSequence.hpp> #include <osl/diagnose.h> +#include <svl/numuno.hxx> #include <memory> @@ -38,7 +39,7 @@ using ::com::sun::star::uno::Reference; VAxisBase::VAxisBase( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount , const AxisProperties& rAxisProperties - , const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier ) + , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier ) : VAxisOrGridBase( nDimensionIndex, nDimensionCount ) , m_xNumberFormatsSupplier( xNumberFormatsSupplier ) , m_aAxisProperties( rAxisProperties ) @@ -243,7 +244,7 @@ void VAxisBase::updateUnscaledValuesAtTicks( TickIter& rIter ) } void VAxisBase::createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& /*rSeriesPlotterList*/, - uno::Reference<util::XNumberFormatsSupplier> const& /*xNumberFormatsSupplier*/, + rtl::Reference<SvNumberFormatsSupplierObj> const& /*xNumberFormatsSupplier*/, rtl::Reference<::chart::ChartModel> const& /*xChartDoc*/, css::uno::Reference<css::uno::XComponentContext> const& /*rComponentContext*/) { diff --git a/chart2/source/view/axes/VAxisBase.hxx b/chart2/source/view/axes/VAxisBase.hxx index 4b1a8de92750..be87a3c14dfd 100644 --- a/chart2/source/view/axes/VAxisBase.hxx +++ b/chart2/source/view/axes/VAxisBase.hxx @@ -24,6 +24,7 @@ namespace com::sun::star::util { class XNumberFormatsSupplier; } namespace com::sun::star::uno { class XComponentContext; } +class SvNumberFormatsSupplierObj; namespace chart { @@ -38,7 +39,7 @@ class VAxisBase : public VAxisOrGridBase public: VAxisBase( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount , const AxisProperties& rAxisProperties - , const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); + , const rtl::Reference< SvNumberFormatsSupplierObj>& xNumberFormatsSupplier ); virtual ~VAxisBase() override; /** @@ -66,7 +67,7 @@ public: void setExtraLinePositionAtOtherAxis( double fCrossingAt ); virtual void createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList, - css::uno::Reference<css::util::XNumberFormatsSupplier> const& xNumberFormatsSupplier, + rtl::Reference<SvNumberFormatsSupplierObj> const& xNumberFormatsSupplier, rtl::Reference<::chart::ChartModel> const& xChartDoc, css::uno::Reference<css::uno::XComponentContext> const& rComponentContext); @@ -84,7 +85,7 @@ protected: //methods bool isComplexCategoryAxis() const; protected: //member - css::uno::Reference< css::util::XNumberFormatsSupplier > m_xNumberFormatsSupplier; + rtl::Reference< SvNumberFormatsSupplierObj > m_xNumberFormatsSupplier; AxisProperties m_aAxisProperties; AxisLabelProperties m_aAxisLabelProperties; css::uno::Sequence< OUString > m_aTextLabels; diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index 81fc3dbee032..38180435e112 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -33,6 +33,7 @@ #include <rtl/math.hxx> #include <comphelper/diagnose_ex.hxx> #include <tools/color.hxx> +#include <svl/numuno.hxx> #include <svx/unoshape.hxx> #include <svx/unoshtxt.hxx> #include <VSeriesPlotter.hxx> @@ -61,7 +62,7 @@ using ::basegfx::B2DPolyPolygon; namespace chart { VCartesianAxis::VCartesianAxis( const AxisProperties& rAxisProperties - , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier + , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount , PlottingPositionHelper* pPosHelper )//takes ownership : VAxisBase( nDimensionIndex, nDimensionCount, rAxisProperties, xNumberFormatsSupplier ) @@ -2017,7 +2018,7 @@ void VCartesianAxis::createShapes() } void VCartesianAxis::createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList, - Reference<util::XNumberFormatsSupplier> const& xNumberFormatsSupplier, + rtl::Reference<SvNumberFormatsSupplierObj> const& xNumberFormatsSupplier, rtl::Reference<::chart::ChartModel> const& xChartDoc, css::uno::Reference<css::uno::XComponentContext> const& rComponentContext) { diff --git a/chart2/source/view/axes/VCartesianAxis.hxx b/chart2/source/view/axes/VCartesianAxis.hxx index 210f36dd4802..327a86ea493c 100644 --- a/chart2/source/view/axes/VCartesianAxis.hxx +++ b/chart2/source/view/axes/VCartesianAxis.hxx @@ -28,7 +28,7 @@ class VCartesianAxis : public VAxisBase // public methods public: VCartesianAxis( const AxisProperties& rAxisProperties - , const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier + , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount , PlottingPositionHelper* pPosHelper = nullptr //takes ownership ); @@ -99,7 +99,7 @@ public: }; void createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList, - css::uno::Reference<css::util::XNumberFormatsSupplier> const& xNumberFormatsSupplier, + rtl::Reference<SvNumberFormatsSupplierObj> const& xNumberFormatsSupplier, rtl::Reference<::chart::ChartModel> const& xChartDoc, css::uno::Reference<css::uno::XComponentContext> const& rComponentContext) override; private: //methods diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx index 81fa369c2f60..033aeaecd23a 100644 --- a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx @@ -29,6 +29,7 @@ #include <cppuhelper/implbase.hxx> #include <ChartModel.hxx> #include <GridProperties.hxx> +#include <svl/numuno.hxx> #include <com/sun/star/chart2/data/XTextualDataSequence.hpp> #include <com/sun/star/chart2/AxisType.hpp> @@ -110,7 +111,7 @@ void VCartesianCoordinateSystem::createVAxisList( { // note: using xChartDoc itself as XNumberFormatsSupplier would cause // a leak from VCartesianAxis due to cyclic reference - uno::Reference<util::XNumberFormatsSupplier> const xNumberFormatsSupplier( + rtl::Reference<SvNumberFormatsSupplierObj> const xNumberFormatsSupplier( xChartDoc->getNumberFormatsSupplier()); m_aAxisMap.clear(); diff --git a/chart2/source/view/axes/VPolarAngleAxis.cxx b/chart2/source/view/axes/VPolarAngleAxis.cxx index 91fec413dbcc..3a97370acc2f 100644 --- a/chart2/source/view/axes/VPolarAngleAxis.cxx +++ b/chart2/source/view/axes/VPolarAngleAxis.cxx @@ -35,7 +35,7 @@ namespace chart using namespace ::com::sun::star; VPolarAngleAxis::VPolarAngleAxis( const AxisProperties& rAxisProperties - , const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier + , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier , sal_Int32 nDimensionCount ) : VPolarAxis( rAxisProperties, xNumberFormatsSupplier, 0/*nDimensionIndex*/, nDimensionCount ) { diff --git a/chart2/source/view/axes/VPolarAngleAxis.hxx b/chart2/source/view/axes/VPolarAngleAxis.hxx index 0e0774e9ebc5..cafc9aa532f8 100644 --- a/chart2/source/view/axes/VPolarAngleAxis.hxx +++ b/chart2/source/view/axes/VPolarAngleAxis.hxx @@ -28,7 +28,7 @@ class VPolarAngleAxis : public VPolarAxis { public: VPolarAngleAxis( const AxisProperties& rAxisProperties - , const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier + , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier , sal_Int32 nDimensionCount ); virtual ~VPolarAngleAxis() override; diff --git a/chart2/source/view/axes/VPolarAxis.cxx b/chart2/source/view/axes/VPolarAxis.cxx index 89f65fee3745..9b83713a96a2 100644 --- a/chart2/source/view/axes/VPolarAxis.cxx +++ b/chart2/source/view/axes/VPolarAxis.cxx @@ -27,7 +27,7 @@ namespace chart using namespace ::com::sun::star; std::shared_ptr<VPolarAxis> VPolarAxis::createAxis( const AxisProperties& rAxisProperties - , const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier + , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount ) { if( nDimensionIndex==0 ) @@ -36,7 +36,7 @@ std::shared_ptr<VPolarAxis> VPolarAxis::createAxis( const AxisProperties& rAxisP } VPolarAxis::VPolarAxis( const AxisProperties& rAxisProperties - , const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier + , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount ) : VAxisBase( nDimensionIndex, nDimensionCount, rAxisProperties, xNumberFormatsSupplier ) { diff --git a/chart2/source/view/axes/VPolarAxis.hxx b/chart2/source/view/axes/VPolarAxis.hxx index dc6233a71e02..cf84ecb534e2 100644 --- a/chart2/source/view/axes/VPolarAxis.hxx +++ b/chart2/source/view/axes/VPolarAxis.hxx @@ -22,6 +22,8 @@ #include <PlottingPositionHelper.hxx> #include <memory> +class SvNumberFormatsSupplierObj; + namespace chart { @@ -29,7 +31,7 @@ class VPolarAxis : public VAxisBase { public: static std::shared_ptr<VPolarAxis> createAxis( const AxisProperties& rAxisProperties - , const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier + , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount ); void setIncrements( std::vector< ExplicitIncrementData >&& rIncrements ); @@ -40,7 +42,7 @@ public: protected: VPolarAxis( const AxisProperties& rAxisProperties - , const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier + , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount ); protected: //member diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.cxx b/chart2/source/view/axes/VPolarCoordinateSystem.cxx index ab7e603009ba..36f0f3e35ba5 100644 --- a/chart2/source/view/axes/VPolarCoordinateSystem.cxx +++ b/chart2/source/view/axes/VPolarCoordinateSystem.cxx @@ -28,6 +28,7 @@ #include <DataTable.hxx> #include <ChartModel.hxx> #include <GridProperties.hxx> +#include <svl/numuno.hxx> namespace chart { @@ -77,7 +78,7 @@ void VPolarCoordinateSystem::createVAxisList( { // note: using xChartDoc itself as XNumberFormatsSupplier would cause // a leak from VPolarAxis due to cyclic reference - uno::Reference<util::XNumberFormatsSupplier> const xNumberFormatsSupplier( + rtl::Reference<SvNumberFormatsSupplierObj> const xNumberFormatsSupplier( xChartDoc->getNumberFormatsSupplier()); m_aAxisMap.clear(); diff --git a/chart2/source/view/axes/VPolarRadiusAxis.cxx b/chart2/source/view/axes/VPolarRadiusAxis.cxx index f93315410e96..87f682792632 100644 --- a/chart2/source/view/axes/VPolarRadiusAxis.cxx +++ b/chart2/source/view/axes/VPolarRadiusAxis.cxx @@ -30,7 +30,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; VPolarRadiusAxis::VPolarRadiusAxis( const AxisProperties& rAxisProperties - , const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier + , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier , sal_Int32 nDimensionCount ) : VPolarAxis( rAxisProperties, xNumberFormatsSupplier, 1/*nDimensionIndex*/, nDimensionCount ) { diff --git a/chart2/source/view/axes/VPolarRadiusAxis.hxx b/chart2/source/view/axes/VPolarRadiusAxis.hxx index b2450e236268..0f525f571e60 100644 --- a/chart2/source/view/axes/VPolarRadiusAxis.hxx +++ b/chart2/source/view/axes/VPolarRadiusAxis.hxx @@ -30,7 +30,7 @@ class VPolarRadiusAxis : public VPolarAxis { public: VPolarRadiusAxis( const AxisProperties& rAxisProperties - , const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier + , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier , sal_Int32 nDimensionCount ); virtual ~VPolarRadiusAxis() override; diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index e86d248fcf7a..952dd9c7f050 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -86,6 +86,7 @@ #include <vcl/settings.hxx> #include <comphelper/diagnose_ex.hxx> #include <sal/log.hxx> +#include <svl/numuno.hxx> #include <functional> #include <map> @@ -1853,7 +1854,7 @@ sal_Int32 VSeriesPlotter::getPointCount() const } void VSeriesPlotter::setNumberFormatsSupplier( - const uno::Reference< util::XNumberFormatsSupplier > & xNumFmtSupplier ) + const rtl::Reference< SvNumberFormatsSupplierObj > & xNumFmtSupplier ) { m_apNumberFormatterWrapper.reset( new NumberFormatterWrapper( xNumFmtSupplier )); } diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index 45676830b538..eaafaef8bfd4 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -47,6 +47,8 @@ namespace com::sun::star { } } +class SvNumberFormatsSupplierObj; + namespace chart { class ChartType; @@ -239,7 +241,7 @@ public: // Methods for number formats and color schemes - void setNumberFormatsSupplier( const css::uno::Reference< css::util::XNumberFormatsSupplier > & xNumFmtSupplier ); + void setNumberFormatsSupplier( const rtl::Reference< SvNumberFormatsSupplierObj > & xNumFmtSupplier ); void setColorScheme( const css::uno::Reference< css::chart2::XColorScheme >& xColorScheme ); diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index ebd04fecbebb..7fc3ec03a6f7 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -76,6 +76,7 @@ #include <svx/unofill.hxx> #include <drawinglayer/XShapeDumper.hxx> #include <sfx2/objsh.hxx> +#include <svl/numuno.hxx> #include <time.h> @@ -516,7 +517,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D auto& rSeriesPlotterList = rParam.mpSeriesPlotterContainer->getSeriesPlotterList(); //create VAxis, so they can give necessary information for automatic scaling - uno::Reference<util::XNumberFormatsSupplier> const xNumberFormatsSupplier( + rtl::Reference<SvNumberFormatsSupplierObj> const xNumberFormatsSupplier( mrChartModel.getNumberFormatsSupplier()); for (auto& rpVCooSys : rVCooSysList) @@ -2123,7 +2124,7 @@ sal_Int32 ChartView::getExplicitNumberFormatKeyForDataLabel( sal_Int32 ChartView::getExplicitPercentageNumberFormatKeyForDataLabel( const uno::Reference<beans::XPropertySet>& xSeriesOrPointProp, - const uno::Reference<util::XNumberFormatsSupplier>& xNumberFormatsSupplier) + const rtl::Reference<SvNumberFormatsSupplierObj>& xNumberFormatsSupplier) { sal_Int32 nFormat = 0; if (!xSeriesOrPointProp.is()) diff --git a/chart2/source/view/main/SeriesPlotterContainer.cxx b/chart2/source/view/main/SeriesPlotterContainer.cxx index a26af212dd42..3f054b6ea5e0 100644 --- a/chart2/source/view/main/SeriesPlotterContainer.cxx +++ b/chart2/source/view/main/SeriesPlotterContainer.cxx @@ -45,6 +45,7 @@ #include <comphelper/classids.hxx> #include <servicenames_charttypes.hxx> #include <comphelper/diagnose_ex.hxx> +#include <svl/numuno.hxx> namespace chart { @@ -135,9 +136,9 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart if (!xDiagram.is()) return; - uno::Reference<util::XNumberFormatsSupplier> xNumberFormatsSupplier(&rChartModel); if (rChartModel.hasInternalDataProvider() && xDiagram->isSupportingDateAxis()) - m_nDefaultDateNumberFormat = DiagramHelper::getDateNumberFormat(xNumberFormatsSupplier); + m_nDefaultDateNumberFormat + = DiagramHelper::getDateNumberFormat(rChartModel.getNumberFormatsSupplier()); sal_Int32 nDimensionCount = xDiagram->getDimension(); if (!nDimensionCount) @@ -254,7 +255,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart continue; m_aSeriesPlotterList.push_back(std::unique_ptr<VSeriesPlotter>(pPlotter)); - pPlotter->setNumberFormatsSupplier(xNumberFormatsSupplier); + pPlotter->setNumberFormatsSupplier(rChartModel.getNumberFormatsSupplier()); pPlotter->setColorScheme(xColorScheme); if (pVCooSys) pPlotter->setExplicitCategoriesProvider(pVCooSys->getExplicitCategoriesProvider());