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 | 11 chart2/source/inc/NumberFormatterWrapper.hxx | 17 - chart2/source/model/main/ChartModel.cxx | 33 +- chart2/source/tools/AxisHelper.cxx | 8 chart2/source/tools/DiagramHelper.cxx | 123 +++++++--- chart2/source/tools/ExplicitCategoriesProvider.cxx | 6 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 32 files changed, 208 insertions(+), 142 deletions(-)
New commits: commit 796f8ff3327c82233e495eb4fcad4314d706a3b0 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Apr 22 13:56:13 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Apr 22 15:45:50 2025 +0200 Revert "use more concrete UNO in chart2" This reverts commit 1886ecf7ee10cc51ca90fe1365e4a8ef2a1b6f27. because reportdesign will pass in a OReportDefinition* and not a SvNumberFormatsSupplierObj* Change-Id: Ic0068d18a10ce24ed74bb86cfef4cb9f34e9eeb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184437 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 f6186d8b575b..7c00f390c569 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -162,7 +162,8 @@ private: rtl::Reference< InternalDataProvider > m_xInternalDataProvider; rtl::Reference< SvNumberFormatsSupplierObj > m_xOwnNumberFormatsSupplier; - rtl::Reference< SvNumberFormatsSupplierObj > m_xNumberFormatsSupplier; + css::uno::Reference< css::util::XNumberFormatsSupplier > + m_xNumberFormatsSupplier; std::unique_ptr< SvNumberFormatter > m_apSvNumberFormatter; // #i113784# avoid memory leak rtl::Reference< ::chart::ChartTypeManager > @@ -459,7 +460,7 @@ public: virtual OUString SAL_CALL dump(OUString const & kind) override; // normal methods - rtl::Reference< SvNumberFormatsSupplierObj > const & + css::uno::Reference< css::util::XNumberFormatsSupplier > const & getNumberFormatsSupplier(); ChartView* getChartView() const; diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx index 95abb7d0fd9a..ba00d741cb6a 100644 --- a/chart2/inc/ChartView.hxx +++ b/chart2/inc/ChartView.hxx @@ -51,7 +51,6 @@ namespace com::sun::star::util { class XUpdatable2; } namespace com::sun::star::util { class XNumberFormatsSupplier; } class SdrPage; -class SvNumberFormatsSupplierObj; namespace chart { @@ -205,7 +204,7 @@ public: static sal_Int32 getExplicitPercentageNumberFormatKeyForDataLabel( const css::uno::Reference< css::beans::XPropertySet >& xSeriesOrPointProp - , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier ); + , const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); private: //methods void createShapes(); diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index a06c82f69061..4238396c4d19 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->getNumberFormatsSupplier(), fDouble ); + m_xChartDoc, 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->getNumberFormatsSupplier()); + std::make_shared<NumberFormatterWrapper>(m_xChartDoc); 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 6ddddfffad23..ef9893ca7ddb 100644 --- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx +++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx @@ -99,7 +99,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 rtl::Reference<::chart::ChartModel>& xChartModel ) + const Reference< frame::XModel >& xChartModel ) { OUString aRet; @@ -112,7 +112,8 @@ OUString lcl_getDataPointValueText( const rtl::Reference< DataSeries >& xSeries, OUString aX, aY, aY_Min, aY_Max, aY_First, aY_Last, a_Size; double fValue = 0; - NumberFormatterWrapper aNumberFormatterWrapper( xChartModel->getNumberFormatsSupplier() ); + uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( xChartModel, uno::UNO_QUERY ); + NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier ); Color nLabelColor;//dummy bool bColorChanged;//dummy @@ -191,7 +192,8 @@ OUString lcl_getDataPointValueText( const rtl::Reference< DataSeries >& xSeries, if( aX.isEmpty() ) { - aRet = ExplicitCategoriesProvider::getCategoryByIndex( xCooSys, *xChartModel, nPointIndex ); + ChartModel& rModel = dynamic_cast<ChartModel&>(*xChartModel); + aRet = ExplicitCategoriesProvider::getCategoryByIndex( xCooSys, rModel, nPointIndex ); } else { diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index f678b051bc02..fabe013ff27d 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -329,7 +329,7 @@ SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent, const SfxItemSet* pAttr, const ObjectPropertiesDialogParameter* pDialogParameter, const ViewElementListProvider* pViewElementListProvider, - const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier) + const uno::Reference< util::XNumberFormatsSupplier >& 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 66bdf1cab8db..f16aee1e611b 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 rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier ); + const css::uno::Reference< css::util::XNumberFormatsSupplier >& 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 b5688f9d40b5..22ba346aaf14 100644 --- a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx +++ b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx @@ -112,7 +112,7 @@ AllDataLabelItemConverter::AllDataLabelItemConverter( sal_Int32 nNumberFormat = series->getExplicitNumberFormatKeyForDataLabel(); sal_Int32 nPercentNumberFormat=ChartView::getExplicitPercentageNumberFormatKeyForDataLabel( - series, xChartModel->getNumberFormatsSupplier()); + series,xChartModel); 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 22da867ff371..7d12aa9097b9 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()->getNumberFormatsSupplier() ); + NumberFormatterWrapper aNumberFormatterWrapper( getChartModel() ); 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()->getNumberFormatsSupplier()); + &aViewElementListProvider, getChartModel()); // 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()->getNumberFormatsSupplier() ); + getChartModel() ); 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 1d3b930fd624..2225dcdbcbb6 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -177,7 +177,7 @@ wrapper::ItemConverter* createItemConverter( sal_Int32 nNumberFormat = xSeries->getExplicitNumberFormatKeyForDataLabel(); sal_Int32 nPercentNumberFormat = ChartView::getExplicitPercentageNumberFormatKeyForDataLabel( - xObjectProperties, xChartModel->getNumberFormatsSupplier()); + xObjectProperties, xChartModel); pItemConverter = new wrapper::TextLabelItemConverter( xChartModel, xObjectProperties, xSeries, @@ -230,7 +230,7 @@ wrapper::ItemConverter* createItemConverter( } sal_Int32 nNumberFormat=xSeries->getExplicitNumberFormatKeyForDataLabel(); sal_Int32 nPercentNumberFormat=ChartView::getExplicitPercentageNumberFormatKeyForDataLabel( - xObjectProperties, xChartModel->getNumberFormatsSupplier()); + xObjectProperties, xChartModel); pItemConverter = new wrapper::DataPointItemConverter( xChartModel, xContext, xObjectProperties, xSeries, rDrawModel.GetItemPool(), rDrawModel, @@ -750,7 +750,7 @@ void ChartController::executeDlg_ObjectProperties_withUndoGuard( std::shared_ptr<SchAttribTabDlg> aDlgPtr = std::make_shared<SchAttribTabDlg>( GetChartFrame(), &aItemSet, &aDialogParameter, &aViewElementListProvider, - xChartDoc->getNumberFormatsSupplier()); + xChartDoc); if(aDialogParameter.HasSymbolProperties()) { diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx index 1a7585dce8bf..10c9e6de5b2e 100644 --- a/chart2/source/inc/DiagramHelper.hxx +++ b/chart2/source/inc/DiagramHelper.hxx @@ -26,7 +26,6 @@ namespace chart { class ChartModel; } namespace com::sun::star::util { class XNumberFormats; } namespace com::sun::star::util { class XNumberFormatsSupplier; } -class SvNumberFormatsSupplierObj; namespace chart { @@ -66,12 +65,12 @@ public: static void switchToTextCategories( const rtl::Reference<::chart::ChartModel> & xChartDoc ); - static bool isDateNumberFormat( sal_Int32 nNumberFormat, const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormats ); - static sal_Int32 getDateNumberFormat( const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier ); - static sal_Int32 getDateTimeInputNumberFormat( const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier, double fNumber ); + 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 getPercentNumberFormat( const rtl::Reference< - SvNumberFormatsSupplierObj >& xNumberFormatsSupplier ); + static sal_Int32 getPercentNumberFormat( const css::uno::Reference< + css::util::XNumberFormatsSupplier >& 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 5d90b5f30d07..a229beafcda2 100644 --- a/chart2/source/inc/NumberFormatterWrapper.hxx +++ b/chart2/source/inc/NumberFormatterWrapper.hxx @@ -20,13 +20,10 @@ #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 { @@ -34,26 +31,28 @@ namespace chart class NumberFormatterWrapper final { public: - NumberFormatterWrapper( const rtl::Reference< SvNumberFormatsSupplierObj >& xSupplier ); + NumberFormatterWrapper( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xSupplier ); ~NumberFormatterWrapper(); SvNumberFormatter* getSvNumberFormatter() const { return m_pNumberFormatter;} - const rtl::Reference< SvNumberFormatsSupplierObj >& + const css::uno::Reference< css::util::XNumberFormatsSupplier >& getNumberFormatsSupplier() const { return m_xNumberFormatsSupplier; }; OUString getFormattedString( sal_Int32 nNumberFormatKey, double fValue, Color& rLabelColor, bool& rbColorChanged ) const; Date getNullDate() const; -private: - rtl::Reference< SvNumberFormatsSupplierObj > m_xNumberFormatsSupplier; +private: //private member + css::uno::Reference< css::util::XNumberFormatsSupplier > + m_xNumberFormatsSupplier; + SvNumberFormatter* m_pNumberFormatter; - std::optional<Date> m_aNullDate; + css::uno::Any m_aNullDate; }; class FixedNumberFormatter final { public: - FixedNumberFormatter( const rtl::Reference< SvNumberFormatsSupplierObj >& xSupplier + FixedNumberFormatter( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xSupplier , sal_Int32 nNumberFormatKey ); ~FixedNumberFormatter(); diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index be2e8fb9fae5..500b382ab2eb 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -820,24 +820,18 @@ void SAL_CALL ChartModel::attachDataProvider( const uno::Reference< chart2::data void SAL_CALL ChartModel::attachNumberFormatsSupplier( const uno::Reference< util::XNumberFormatsSupplier >& xNewSupplier ) { { + // Mostly the supplier is SvNumberFormatsSupplierObj, but sometimes it is reportdesign::OReportDefinition MutexGuard aGuard( m_aModelMutex ); - if (xNewSupplier) + if( xNewSupplier == m_xNumberFormatsSupplier ) + return; + if( xNewSupplier == uno::Reference<XNumberFormatsSupplier>(m_xOwnNumberFormatsSupplier) ) + return; + if( m_xOwnNumberFormatsSupplier.is() && xNewSupplier.is() ) { - 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(); + //@todo + //merge missing numberformats from own to new formatter } - else + else if( !xNewSupplier.is() ) { if( m_xNumberFormatsSupplier.is() ) { @@ -845,9 +839,10 @@ 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 ); } @@ -1230,7 +1225,7 @@ Sequence< OUString > SAL_CALL ChartModel::getAvailableServiceNames() return aResult; } -rtl::Reference< SvNumberFormatsSupplierObj > const & ChartModel::getNumberFormatsSupplier() +Reference< util::XNumberFormatsSupplier > const & ChartModel::getNumberFormatsSupplier() { if( !m_xNumberFormatsSupplier.is() ) { @@ -1250,7 +1245,7 @@ rtl::Reference< SvNumberFormatsSupplierObj > const & ChartModel::getNumberFormat { if( comphelper::isUnoTunnelId<SvNumberFormatsSupplierObj>(aIdentifier) ) { - Reference< lang::XUnoTunnel > xTunnel( getNumberFormatsSupplier() ); + Reference< lang::XUnoTunnel > xTunnel( getNumberFormatsSupplier(), uno::UNO_QUERY ); if( xTunnel.is() ) return xTunnel->getSomething( aIdentifier ); } diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 4e550e9add2e..51336ebc5a49 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -158,7 +158,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( ScaleData aData = AxisHelper::getDateCheckedScale( xAxis, *xChartDoc ); if( aData.AxisType==AxisType::PERCENT ) { - sal_Int32 nPercentFormat = DiagramHelper::getPercentNumberFormat( xChartDoc->getNumberFormatsSupplier() ); + sal_Int32 nPercentFormat = DiagramHelper::getPercentNumberFormat( xChartDoc ); if( nPercentFormat != -1 ) { nNumberFormatKey = nPercentFormat; @@ -173,7 +173,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( if( xSeq.is() && !( xChartDoc.is() && xChartDoc->hasInternalDataProvider()) ) nNumberFormatKey = xSeq->getNumberFormatKeyByIndex( -1 ); else - nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc->getNumberFormatsSupplier() ); + nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc ); bFormatSet = true; } } @@ -182,7 +182,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( rtl::Reference< Diagram > xDiagram( xChartDoc->getFirstChartDiagram() ); if( xDiagram->isSupportingDateAxis() ) { - nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc->getNumberFormatsSupplier() ); + nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc ); } else { @@ -212,7 +212,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( } } if( bHasValidDoubles ) - nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc->getNumberFormatsSupplier() ); + nNumberFormatKey = DiagramHelper::getDateNumberFormat( xChartDoc ); } } } diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index 0efff69cbe6c..c6b8984a49a5 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -43,7 +43,6 @@ #include <unotools/saveopt.hxx> #include <svl/numformat.hxx> -#include <svl/numuno.hxx> #include <svl/zforlist.hxx> #include <svl/zformat.hxx> #include <vcl/svapp.hxx> @@ -237,20 +236,30 @@ void lcl_switchToDateCategories( const rtl::Reference< ChartModel >& xChartDoc, sal_Int32 nNumberFormat = -1; xAxisProps->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormat; - SvNumberFormatter* pNumberFormatter = xChartDoc->getNumberFormatsSupplier()->GetNumberFormatter(); - const SvNumberformat* pNumberFormat = pNumberFormatter->GetEntry( nNumberFormat ); - sal_Int32 nType = util::NumberFormat::UNDEFINED; - if( pNumberFormat ) - nType = static_cast<sal_Int16>(pNumberFormat->GetType()); - if( !( nType & util::NumberFormat::DATE ) ) + Reference< util::XNumberFormats > xNumberFormats( xChartDoc->getNumberFormats() ); + if( xNumberFormats.is() ) { - //set a date format to the axis - LanguageType eLang = Application::GetSettings().GetLanguageTag().getLanguageType(); - sal_uInt32 nIndex = 0; - SvNumberFormatTable& rTable = pNumberFormatter->ChangeCL( static_cast<SvNumFormatType>(util::NumberFormat::DATE), nIndex, eLang ); - if (!rTable.empty()) + Reference< beans::XPropertySet > xKeyProps; + try { - xAxisProps->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any(rTable.begin()->first)); + xKeyProps = xNumberFormats->getByKey( nNumberFormat ); + } + catch( const uno::Exception & ) + { + DBG_UNHANDLED_EXCEPTION("chart2"); + } + sal_Int32 nType = util::NumberFormat::UNDEFINED; + if( xKeyProps.is() ) + xKeyProps->getPropertyValue( u"Type"_ustr ) >>= nType; + if( !( nType & util::NumberFormat::DATE ) ) + { + //set a date format to the axis + const LocaleDataWrapper& rLocaleDataWrapper = Application::GetSettings().GetLocaleDataWrapper(); + Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::DATE, rLocaleDataWrapper.getLanguageTag().getLocale(), true/*bCreate*/ ); + if( aKeySeq.hasElements() ) + { + xAxisProps->setPropertyValue(CHART_UNONAME_NUMFMT, uno::Any(aKeySeq[0])); + } } } } @@ -308,48 +317,98 @@ void DiagramHelper::switchToTextCategories( const rtl::Reference<::chart::ChartM } } -bool DiagramHelper::isDateNumberFormat( sal_Int32 nNumberFormat, const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormats ) +bool DiagramHelper::isDateNumberFormat( sal_Int32 nNumberFormat, const css::uno::Reference< css::util::XNumberFormats >& xNumberFormats ) { bool bIsDate = false; - const SvNumberformat* pFormat = xNumberFormats->GetNumberFormatter()->GetEntry(nNumberFormat); - if( pFormat ) + if( !xNumberFormats.is() ) + return bIsDate; + + Reference< beans::XPropertySet > xKeyProps = xNumberFormats->getByKey( nNumberFormat ); + if( xKeyProps.is() ) { sal_Int32 nType = util::NumberFormat::UNDEFINED; - nType = static_cast<sal_Int16>(pFormat->GetType()); + xKeyProps->getPropertyValue( u"Type"_ustr ) >>= nType; bIsDate = nType & util::NumberFormat::DATE; } return bIsDate; } -sal_Int32 DiagramHelper::getDateNumberFormat( const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier ) +sal_Int32 DiagramHelper::getDateNumberFormat( const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier ) { + sal_Int32 nRet=-1; + //try to get a date format with full year display const LanguageTag& rLanguageTag = Application::GetSettings().GetLanguageTag(); - SvNumberFormatter* pNumFormatter = xNumberFormatsSupplier->GetNumberFormatter(); - if (!pNumFormatter) - return -1; - return pNumFormatter->GetFormatIndex( NF_DATE_SYS_DDMMYYYY, rLanguageTag.getLanguageType() ); + NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier ); + SvNumberFormatter* pNumFormatter = aNumberFormatterWrapper.getSvNumberFormatter(); + if( pNumFormatter ) + { + nRet = pNumFormatter->GetFormatIndex( NF_DATE_SYS_DDMMYYYY, rLanguageTag.getLanguageType() ); + } + else + { + Reference< util::XNumberFormats > xNumberFormats( xNumberFormatsSupplier->getNumberFormats() ); + if( xNumberFormats.is() ) + { + Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::DATE, + rLanguageTag.getLocale(), true/*bCreate */); + if( aKeySeq.hasElements() ) + { + nRet = aKeySeq[0]; + } + } + } + return nRet; } -sal_Int32 DiagramHelper::getDateTimeInputNumberFormat( const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier, double fNumber ) +sal_Int32 DiagramHelper::getDateTimeInputNumberFormat( const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier, double fNumber ) { sal_Int32 nRet = 0; // Get the most detailed date/time format according to fNumber. - SvNumberFormatter* pNumFormatter = xNumberFormatsSupplier->GetNumberFormatter(); - SvNumFormatType nType; - // Obtain best matching date, time or datetime format. - nRet = pNumFormatter->GuessDateTimeFormat( nType, fNumber, LANGUAGE_SYSTEM); - // Obtain the corresponding edit format. - nRet = pNumFormatter->GetEditFormat( fNumber, nRet, nType, nullptr); + NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier ); + SvNumberFormatter* pNumFormatter = aNumberFormatterWrapper.getSvNumberFormatter(); + if (!pNumFormatter) + SAL_WARN("chart2", "DiagramHelper::getDateTimeInputNumberFormat - no SvNumberFormatter"); + else + { + SvNumFormatType nType; + // Obtain best matching date, time or datetime format. + nRet = pNumFormatter->GuessDateTimeFormat( nType, fNumber, LANGUAGE_SYSTEM); + // Obtain the corresponding edit format. + nRet = pNumFormatter->GetEditFormat( fNumber, nRet, nType, nullptr); + } return nRet; } -sal_Int32 DiagramHelper::getPercentNumberFormat( const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier ) +sal_Int32 DiagramHelper::getPercentNumberFormat( const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier ) { + sal_Int32 nRet=-1; const LanguageTag& rLanguageTag = Application::GetSettings().GetLanguageTag(); - SvNumberFormatter* pNumFormatter = xNumberFormatsSupplier->GetNumberFormatter(); - return pNumFormatter->GetFormatIndex( NF_PERCENT_INT, rLanguageTag.getLanguageType() ); + NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier ); + SvNumberFormatter* pNumFormatter = aNumberFormatterWrapper.getSvNumberFormatter(); + if( pNumFormatter ) + { + nRet = pNumFormatter->GetFormatIndex( NF_PERCENT_INT, rLanguageTag.getLanguageType() ); + } + else + { + Reference< util::XNumberFormats > xNumberFormats( xNumberFormatsSupplier->getNumberFormats() ); + if( xNumberFormats.is() ) + { + Sequence<sal_Int32> aKeySeq = xNumberFormats->queryKeys( util::NumberFormat::PERCENT, + rLanguageTag.getLocale(), true/*bCreate*/ ); + if( aKeySeq.hasElements() ) + { + // This *assumes* the sequence is sorted as in + // NfIndexTableOffset and the first format is the integer 0% + // format by chance... which usually is the case, but... anyway, + // we usually also have a number formatter so don't reach here. + nRet = aKeySeq[0]; + } + } + } + return nRet; } bool DiagramHelper::areChartTypesCompatible( const rtl::Reference< ChartType >& xFirstType, diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index 9995ac23559a..df431908f3f3 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -418,7 +418,7 @@ static bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& uno::Sequence< uno::Any > aValues = xDataSequence->getData(); sal_Int32 nCount = aValues.getLength(); rDateCategories.reserve(nCount); - rtl::Reference< SvNumberFormatsSupplierObj > xNumberFormatsSupplier( rModel.getNumberFormatsSupplier() ); + Reference< util::XNumberFormats > xNumberFormats( rModel.getNumberFormats() ); bool bOwnData = false; bool bOwnDataAnddAxisHasAnyFormat = false; @@ -434,7 +434,7 @@ static bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& if (xAxisProps.is() && (xAxisProps->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nAxisNumberFormat)) { bOwnDataAnddAxisHasAnyFormat = true; - bOwnDataAnddAxisHasDateFormat = DiagramHelper::isDateNumberFormat( nAxisNumberFormat, xNumberFormatsSupplier ); + bOwnDataAnddAxisHasDateFormat = DiagramHelper::isDateNumberFormat( nAxisNumberFormat, xNumberFormats ); } } } @@ -447,7 +447,7 @@ static bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >& if( bOwnData ) bIsDate = !bOwnDataAnddAxisHasAnyFormat || bOwnDataAnddAxisHasDateFormat; else - bIsDate = DiagramHelper::isDateNumberFormat( xDataSequence->getNumberFormatKeyByIndex( nN ), xNumberFormatsSupplier ); + bIsDate = DiagramHelper::isDateNumberFormat( xDataSequence->getNumberFormatKeyByIndex( nN ), xNumberFormats ); } else bIsDate = true; diff --git a/chart2/source/tools/NumberFormatterWrapper.cxx b/chart2/source/tools/NumberFormatterWrapper.cxx index cab3e0945130..9687fd60e161 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 rtl::Reference< SvNumberFormatsSupplierObj >& xSupplier + const uno::Reference< util::XNumberFormatsSupplier >& xSupplier , sal_Int32 nNumberFormatKey ) : m_aNumberFormatterWrapper(xSupplier) , m_nNumberFormatKey( nNumberFormatKey ) @@ -47,15 +47,18 @@ OUString FixedNumberFormatter::getFormattedString( double fValue, Color& rLabelC m_nNumberFormatKey, fValue, rLabelColor, rbColorChanged ); } -NumberFormatterWrapper::NumberFormatterWrapper( const rtl::Reference< SvNumberFormatsSupplierObj >& xSupplier ) +NumberFormatterWrapper::NumberFormatterWrapper( const uno::Reference< util::XNumberFormatsSupplier >& xSupplier ) : m_xNumberFormatsSupplier(xSupplier) , m_pNumberFormatter(nullptr) { - if( m_xNumberFormatsSupplier ) - m_pNumberFormatter = m_xNumberFormatsSupplier->GetNumberFormatter(); - if( m_pNumberFormatter ) - m_aNullDate = m_pNumberFormatter->GetNullDate(); + 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(); SAL_WARN_IF(!m_pNumberFormatter,"chart2.tools","need a numberformatter"); } @@ -63,13 +66,33 @@ 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); - if (m_aNullDate) + util::Date aUtilDate; + if (m_aNullDate.hasValue() && getDate(m_aNullDate, aUtilDate)) { - return *m_aNullDate; + aRet = Date(aUtilDate.Day,aUtilDate.Month,aUtilDate.Year); } else if( m_pNumberFormatter ) { @@ -91,20 +114,21 @@ OUString NumberFormatterWrapper::getFormattedString( sal_Int32 nNumberFormatKey, // i99104 handle null date correctly sal_Int16 nYear = 1899; sal_uInt16 nDay = 30,nMonth = 12; - if ( m_aNullDate ) + if ( m_aNullDate.hasValue() ) { const Date& rDate = m_pNumberFormatter->GetNullDate(); nYear = rDate.GetYear(); nMonth = rDate.GetMonth(); nDay = rDate.GetDay(); - util::Date aNewNullDate = m_aNullDate->GetUNODate(); - m_pNumberFormatter->ChangeNullDate(aNewNullDate.Day,aNewNullDate.Month,aNewNullDate.Year); + util::Date aNewNullDate; + if (getDate(m_aNullDate, aNewNullDate)) + 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 ) + if ( m_aNullDate.hasValue() ) { m_pNumberFormatter->ChangeNullDate(nDay,nMonth,nYear); } diff --git a/chart2/source/view/axes/VAxisBase.cxx b/chart2/source/view/axes/VAxisBase.cxx index b97c99331755..6578a3d5d092 100644 --- a/chart2/source/view/axes/VAxisBase.cxx +++ b/chart2/source/view/axes/VAxisBase.cxx @@ -27,7 +27,6 @@ #include <com/sun/star/chart2/data/XTextualDataSequence.hpp> #include <osl/diagnose.h> -#include <svl/numuno.hxx> #include <memory> @@ -39,7 +38,7 @@ using ::com::sun::star::uno::Reference; VAxisBase::VAxisBase( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount , const AxisProperties& rAxisProperties - , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier ) + , const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier ) : VAxisOrGridBase( nDimensionIndex, nDimensionCount ) , m_xNumberFormatsSupplier( xNumberFormatsSupplier ) , m_aAxisProperties( rAxisProperties ) @@ -244,7 +243,7 @@ void VAxisBase::updateUnscaledValuesAtTicks( TickIter& rIter ) } void VAxisBase::createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& /*rSeriesPlotterList*/, - rtl::Reference<SvNumberFormatsSupplierObj> const& /*xNumberFormatsSupplier*/, + uno::Reference<util::XNumberFormatsSupplier> 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 be87a3c14dfd..4b1a8de92750 100644 --- a/chart2/source/view/axes/VAxisBase.hxx +++ b/chart2/source/view/axes/VAxisBase.hxx @@ -24,7 +24,6 @@ namespace com::sun::star::util { class XNumberFormatsSupplier; } namespace com::sun::star::uno { class XComponentContext; } -class SvNumberFormatsSupplierObj; namespace chart { @@ -39,7 +38,7 @@ class VAxisBase : public VAxisOrGridBase public: VAxisBase( sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount , const AxisProperties& rAxisProperties - , const rtl::Reference< SvNumberFormatsSupplierObj>& xNumberFormatsSupplier ); + , const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); virtual ~VAxisBase() override; /** @@ -67,7 +66,7 @@ public: void setExtraLinePositionAtOtherAxis( double fCrossingAt ); virtual void createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList, - rtl::Reference<SvNumberFormatsSupplierObj> const& xNumberFormatsSupplier, + css::uno::Reference<css::util::XNumberFormatsSupplier> const& xNumberFormatsSupplier, rtl::Reference<::chart::ChartModel> const& xChartDoc, css::uno::Reference<css::uno::XComponentContext> const& rComponentContext); @@ -85,7 +84,7 @@ protected: //methods bool isComplexCategoryAxis() const; protected: //member - rtl::Reference< SvNumberFormatsSupplierObj > m_xNumberFormatsSupplier; + css::uno::Reference< css::util::XNumberFormatsSupplier > 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 38180435e112..81fc3dbee032 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -33,7 +33,6 @@ #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> @@ -62,7 +61,7 @@ using ::basegfx::B2DPolyPolygon; namespace chart { VCartesianAxis::VCartesianAxis( const AxisProperties& rAxisProperties - , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier + , const Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount , PlottingPositionHelper* pPosHelper )//takes ownership : VAxisBase( nDimensionIndex, nDimensionCount, rAxisProperties, xNumberFormatsSupplier ) @@ -2018,7 +2017,7 @@ void VCartesianAxis::createShapes() } void VCartesianAxis::createDataTableView(std::vector<std::unique_ptr<VSeriesPlotter>>& rSeriesPlotterList, - rtl::Reference<SvNumberFormatsSupplierObj> const& xNumberFormatsSupplier, + Reference<util::XNumberFormatsSupplier> 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 327a86ea493c..210f36dd4802 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 rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier + , const css::uno::Reference< css::util::XNumberFormatsSupplier >& 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, - rtl::Reference<SvNumberFormatsSupplierObj> const& xNumberFormatsSupplier, + css::uno::Reference<css::util::XNumberFormatsSupplier> 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 5b714f1375d0..dbaeee1788ca 100644 --- a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx @@ -29,7 +29,6 @@ #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> @@ -111,7 +110,7 @@ void VCartesianCoordinateSystem::createVAxisList( { // note: using xChartDoc itself as XNumberFormatsSupplier would cause // a leak from VCartesianAxis due to cyclic reference - rtl::Reference<SvNumberFormatsSupplierObj> const xNumberFormatsSupplier( + uno::Reference<util::XNumberFormatsSupplier> const xNumberFormatsSupplier( xChartDoc->getNumberFormatsSupplier()); m_aAxisMap.clear(); diff --git a/chart2/source/view/axes/VPolarAngleAxis.cxx b/chart2/source/view/axes/VPolarAngleAxis.cxx index 3a97370acc2f..91fec413dbcc 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 rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier + , const uno::Reference< util::XNumberFormatsSupplier >& 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 cafc9aa532f8..0e0774e9ebc5 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 rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier + , const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier , sal_Int32 nDimensionCount ); virtual ~VPolarAngleAxis() override; diff --git a/chart2/source/view/axes/VPolarAxis.cxx b/chart2/source/view/axes/VPolarAxis.cxx index 9b83713a96a2..89f65fee3745 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 rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier + , const uno::Reference< util::XNumberFormatsSupplier >& 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 rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier + , const uno::Reference< util::XNumberFormatsSupplier >& 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 cf84ecb534e2..dc6233a71e02 100644 --- a/chart2/source/view/axes/VPolarAxis.hxx +++ b/chart2/source/view/axes/VPolarAxis.hxx @@ -22,8 +22,6 @@ #include <PlottingPositionHelper.hxx> #include <memory> -class SvNumberFormatsSupplierObj; - namespace chart { @@ -31,7 +29,7 @@ class VPolarAxis : public VAxisBase { public: static std::shared_ptr<VPolarAxis> createAxis( const AxisProperties& rAxisProperties - , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier + , const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier , sal_Int32 nDimensionIndex, sal_Int32 nDimensionCount ); void setIncrements( std::vector< ExplicitIncrementData >&& rIncrements ); @@ -42,7 +40,7 @@ public: protected: VPolarAxis( const AxisProperties& rAxisProperties - , const rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier + , const css::uno::Reference< css::util::XNumberFormatsSupplier >& 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 d45aeca7b762..99cb69430703 100644 --- a/chart2/source/view/axes/VPolarCoordinateSystem.cxx +++ b/chart2/source/view/axes/VPolarCoordinateSystem.cxx @@ -28,7 +28,6 @@ #include <DataTable.hxx> #include <ChartModel.hxx> #include <GridProperties.hxx> -#include <svl/numuno.hxx> namespace chart { @@ -78,7 +77,7 @@ void VPolarCoordinateSystem::createVAxisList( { // note: using xChartDoc itself as XNumberFormatsSupplier would cause // a leak from VPolarAxis due to cyclic reference - rtl::Reference<SvNumberFormatsSupplierObj> const xNumberFormatsSupplier( + uno::Reference<util::XNumberFormatsSupplier> const xNumberFormatsSupplier( xChartDoc->getNumberFormatsSupplier()); m_aAxisMap.clear(); diff --git a/chart2/source/view/axes/VPolarRadiusAxis.cxx b/chart2/source/view/axes/VPolarRadiusAxis.cxx index 87f682792632..f93315410e96 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 rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier + , const uno::Reference< util::XNumberFormatsSupplier >& 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 0f525f571e60..b2450e236268 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 rtl::Reference< SvNumberFormatsSupplierObj >& xNumberFormatsSupplier + , const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier , sal_Int32 nDimensionCount ); virtual ~VPolarRadiusAxis() override; diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 03084929844f..94d5a55bec32 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -86,7 +86,6 @@ #include <vcl/settings.hxx> #include <comphelper/diagnose_ex.hxx> #include <sal/log.hxx> -#include <svl/numuno.hxx> #include <functional> #include <map> @@ -1824,7 +1823,7 @@ sal_Int32 VSeriesPlotter::getPointCount() const } void VSeriesPlotter::setNumberFormatsSupplier( - const rtl::Reference< SvNumberFormatsSupplierObj > & xNumFmtSupplier ) + const uno::Reference< util::XNumberFormatsSupplier > & xNumFmtSupplier ) { m_apNumberFormatterWrapper.reset( new NumberFormatterWrapper( xNumFmtSupplier )); } diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx index 25c37f1c0426..57e5ee3db3f4 100644 --- a/chart2/source/view/inc/VSeriesPlotter.hxx +++ b/chart2/source/view/inc/VSeriesPlotter.hxx @@ -47,8 +47,6 @@ namespace com::sun::star { } } -class SvNumberFormatsSupplierObj; - namespace chart { class ChartType; @@ -240,7 +238,7 @@ public: // Methods for number formats and color schemes - void setNumberFormatsSupplier( const rtl::Reference< SvNumberFormatsSupplierObj > & xNumFmtSupplier ); + void setNumberFormatsSupplier( const css::uno::Reference< css::util::XNumberFormatsSupplier > & 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 c5c453b8cc75..60192c88fdef 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -76,7 +76,6 @@ #include <svx/unofill.hxx> #include <drawinglayer/XShapeDumper.hxx> #include <sfx2/objsh.hxx> -#include <svl/numuno.hxx> #include <time.h> @@ -517,7 +516,7 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D auto& rSeriesPlotterList = rParam.mpSeriesPlotterContainer->getSeriesPlotterList(); //create VAxis, so they can give necessary information for automatic scaling - rtl::Reference<SvNumberFormatsSupplierObj> const xNumberFormatsSupplier( + uno::Reference<util::XNumberFormatsSupplier> const xNumberFormatsSupplier( mrChartModel.getNumberFormatsSupplier()); for (auto& rpVCooSys : rVCooSysList) @@ -2118,7 +2117,7 @@ sal_Int32 ChartView::getExplicitNumberFormatKeyForAxis( sal_Int32 ChartView::getExplicitPercentageNumberFormatKeyForDataLabel( const uno::Reference<beans::XPropertySet>& xSeriesOrPointProp, - const rtl::Reference<SvNumberFormatsSupplierObj>& xNumberFormatsSupplier) + const uno::Reference<util::XNumberFormatsSupplier>& 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 36a7c2cbe985..a5f90e2d8fc0 100644 --- a/chart2/source/view/main/SeriesPlotterContainer.cxx +++ b/chart2/source/view/main/SeriesPlotterContainer.cxx @@ -45,7 +45,6 @@ #include <comphelper/classids.hxx> #include <servicenames_charttypes.hxx> #include <comphelper/diagnose_ex.hxx> -#include <svl/numuno.hxx> namespace chart { @@ -135,9 +134,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(rChartModel.getNumberFormatsSupplier()); + m_nDefaultDateNumberFormat = DiagramHelper::getDateNumberFormat(xNumberFormatsSupplier); sal_Int32 nDimensionCount = xDiagram->getDimension(); if (!nDimensionCount) @@ -254,7 +253,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart continue; m_aSeriesPlotterList.push_back(std::unique_ptr<VSeriesPlotter>(pPlotter)); - pPlotter->setNumberFormatsSupplier(rChartModel.getNumberFormatsSupplier()); + pPlotter->setNumberFormatsSupplier(xNumberFormatsSupplier); pPlotter->setColorScheme(xColorScheme); if (pVCooSys) pPlotter->setExplicitCategoriesProvider(