diff options
Diffstat (limited to 'chart2/source/controller')
54 files changed, 228 insertions, 176 deletions
diff --git a/chart2/source/controller/accessibility/AccessibleChartElement.cxx b/chart2/source/controller/accessibility/AccessibleChartElement.cxx index efbb1f47924e..229cb2b86e2e 100644 --- a/chart2/source/controller/accessibility/AccessibleChartElement.cxx +++ b/chart2/source/controller/accessibility/AccessibleChartElement.cxx @@ -19,6 +19,7 @@ #include "AccessibleChartElement.hxx" #include <CharacterProperties.hxx> +#include <ChartModel.hxx> #include <ObjectIdentifier.hxx> #include <ObjectNameProvider.hxx> #include <servicenames.hxx> @@ -148,8 +149,12 @@ OUString SAL_CALL AccessibleChartElement::getImplementationName() // ________ AccessibleChartElement::XAccessibleContext (override) ________ OUString SAL_CALL AccessibleChartElement::getAccessibleName() { + uno::Reference<chart2::XChartDocument> xDoc = GetInfo().m_xChartDocument; + ChartModel* pChartModel = dynamic_cast<ChartModel*>(xDoc.get()); + assert(!xDoc || pChartModel); + return ObjectNameProvider::getNameForCID( - GetInfo().m_aOID.getObjectCID(), GetInfo().m_xChartDocument ); + GetInfo().m_aOID.getObjectCID(), pChartModel ); } // ________ AccessibleChartElement::XAccessibleContext (override) ________ @@ -188,8 +193,12 @@ OUString SAL_CALL AccessibleChartElement::getToolTipText() { CheckDisposeState(); + uno::Reference<chart2::XChartDocument> xDoc = GetInfo().m_xChartDocument; + ChartModel* pChartModel = dynamic_cast<ChartModel*>(xDoc.get()); + assert(!xDoc || pChartModel); + return ObjectNameProvider::getHelpText( - GetInfo().m_aOID.getObjectCID(), Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )); + GetInfo().m_aOID.getObjectCID(), pChartModel ); } // ________ XAccessibleComponent ________ diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx index e1261b1dd154..d8d8baccbd84 100644 --- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx +++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx @@ -30,6 +30,8 @@ #include <AxisHelper.hxx> #include <unonames.hxx> #include <BaseCoordinateSystem.hxx> +#include <ChartModel.hxx> +#include <ChartTypeManager.hxx> #include <com/sun/star/chart2/DataPointGeometry3D.hpp> #include <com/sun/star/chart2/XChartDocument.hpp> @@ -305,9 +307,9 @@ rtl::Reference< ChartTypeTemplate > ChartTypeDialogController::getCurrentTemplat } void ChartTypeDialogController::commitToModel( const ChartTypeParameter& rParameter - , const uno::Reference< XChartDocument >& xChartModel ) + , const rtl::Reference<::chart::ChartModel>& xChartModel ) { - rtl::Reference< ::chart::ChartTypeManager > xTemplateManager = dynamic_cast<::chart::ChartTypeManager*>( xChartModel->getChartTypeManager().get() ); + rtl::Reference< ::chart::ChartTypeManager > xTemplateManager = xChartModel->getTypeManager(); uno::Reference< XChartTypeTemplate > xTemplate( getCurrentTemplate( rParameter, xTemplateManager ) ); if(!xTemplate.is()) return; @@ -361,7 +363,7 @@ void ChartTypeDialogController::showExtraControls(weld::Builder* /*pBuilder*/) void ChartTypeDialogController::hideExtraControls() const { } -void ChartTypeDialogController::fillExtraControls( const uno::Reference< XChartDocument >& /*xChartModel*/ +void ChartTypeDialogController::fillExtraControls( const rtl::Reference<::chart::ChartModel>& /*xChartModel*/ , const uno::Reference< beans::XPropertySet >& /*xTemplateProps*/ ) const { } @@ -1149,7 +1151,7 @@ void CombiColumnLineChartDialogController::hideExtraControls() const } void CombiColumnLineChartDialogController::fillExtraControls( - const uno::Reference< XChartDocument >& xChartModel + const rtl::Reference<::chart::ChartModel>& xChartModel , const uno::Reference< beans::XPropertySet >& xTemplateProps ) const { if (!m_xMF_NumberOfLines) diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index 82fa296222da..ebe1941010ad 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -30,6 +30,7 @@ #include <ResId.hxx> #include <bitmaps.hlst> #include <helpids.h> +#include <ChartModel.hxx> #include <vcl/weld.hxx> #include <vcl/settings.hxx> @@ -719,7 +720,7 @@ OUString DataBrowser::GetCellText( sal_Int32 nRow, sal_uInt16 nColumnId ) const // getDateTimeInputNumberFormat() instead of doing the // guess work. sal_Int32 nNumberFormat = DiagramHelper::getDateTimeInputNumberFormat( - Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY), fDouble ); + m_xChartDoc, fDouble ); Color nLabelColor; bool bColorChanged = false; aResult = m_spNumberFormatterWrapper->getFormattedString( @@ -831,15 +832,14 @@ void DataBrowser::CellModified() } void DataBrowser::SetDataFromModel( - const Reference< chart2::XChartDocument > & xChartDoc, + const rtl::Reference<::chart::ChartModel> & xChartDoc, const Reference< uno::XComponentContext > & xContext ) { - m_xChartDoc.set( xChartDoc ); + m_xChartDoc = xChartDoc; m_apDataBrowserModel.reset( new DataBrowserModel( m_xChartDoc, xContext )); m_spNumberFormatterWrapper = - std::make_shared<NumberFormatterWrapper>( - Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY )); + std::make_shared<NumberFormatterWrapper>(m_xChartDoc); Formatter& rFormatter = m_aNumberEditField->get_formatter(); rFormatter.SetFormatter( m_spNumberFormatterWrapper->getSvNumberFormatter() ); diff --git a/chart2/source/controller/dialogs/DataBrowser.hxx b/chart2/source/controller/dialogs/DataBrowser.hxx index e0699a60d1b4..ec85160e4437 100644 --- a/chart2/source/controller/dialogs/DataBrowser.hxx +++ b/chart2/source/controller/dialogs/DataBrowser.hxx @@ -43,6 +43,7 @@ namespace chart class DataBrowserModel; class NumberFormatterWrapper; +class ChartModel; namespace impl { @@ -97,7 +98,7 @@ public: void SetReadOnly( bool bNewState ); bool IsReadOnly() const { return m_bIsReadOnly;} - void SetDataFromModel( const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc, + void SetDataFromModel( const rtl::Reference<::chart::ChartModel> & xChartDoc, const css::uno::Reference< css::uno::XComponentContext > & xContext ); // predicates to determine what actions are possible at the current cursor @@ -145,7 +146,7 @@ public: void RenewSeriesHeaders(); private: - css::uno::Reference< css::chart2::XChartDocument > m_xChartDoc; + rtl::Reference<::chart::ChartModel> m_xChartDoc; std::unique_ptr< DataBrowserModel > m_apDataBrowserModel; typedef std::vector< std::shared_ptr< impl::SeriesHeader > > tSeriesHeaderContainer; diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx index 733cd3cbfd8b..a61d957b5f72 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.cxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx @@ -20,6 +20,7 @@ #include "DataBrowserModel.hxx" #include "DialogModel.hxx" #include <ChartModelHelper.hxx> +#include <ChartTypeManager.hxx> #include <DiagramHelper.hxx> #include <Diagram.hxx> #include <DataSeriesHelper.hxx> @@ -250,7 +251,7 @@ struct DataBrowserModel::implColumnLess }; DataBrowserModel::DataBrowserModel( - const Reference< chart2::XChartDocument > & xChartDoc, + const rtl::Reference<::chart::ChartModel> & xChartDoc, const Reference< uno::XComponentContext > & xContext ) : m_xChartDocument( xChartDoc ), m_apDialogModel( new DialogModel( xChartDoc, xContext )) @@ -677,9 +678,8 @@ bool DataBrowserModel::setCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow, const m_apDialogModel->startControllerLockTimer(); //notify change directly to the model (this is necessary here as sequences for complex categories not known directly to the chart model so they do not notify their changes) (for complex categories see issue #i82971#) - Reference< util::XModifiable > xModifiable( m_xChartDocument, uno::UNO_QUERY ); - if( xModifiable.is() ) - xModifiable->setModified(true); + if( m_xChartDocument.is() ) + m_xChartDocument->setModified(true); } catch( const uno::Exception & ) { @@ -771,20 +771,16 @@ void DataBrowserModel::updateFromModel() return; // set template at DialogModel - rtl::Reference< ::chart::ChartTypeManager > xTemplateManager = dynamic_cast<::chart::ChartTypeManager*>( m_xChartDocument->getChartTypeManager().get() ); + rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = m_xChartDocument->getTypeManager(); DiagramHelper::tTemplateWithServiceName aTemplateAndService = - DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager ); + DiagramHelper::getTemplateForDiagram( xDiagram, xChartTypeManager ); if( aTemplateAndService.xChartTypeTemplate.is()) m_apDialogModel->setTemplate( aTemplateAndService.xChartTypeTemplate ); sal_Int32 nHeaderStart = 0; sal_Int32 nHeaderEnd = 0; { - Reference< frame::XModel > xChartModel = m_xChartDocument; - ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get()); - if (!pModel) - return; - ExplicitCategoriesProvider aExplicitCategoriesProvider( ChartModelHelper::getFirstCoordinateSystem(xChartModel), *pModel ); + ExplicitCategoriesProvider aExplicitCategoriesProvider( ChartModelHelper::getFirstCoordinateSystem(m_xChartDocument), *m_xChartDocument ); const Sequence< Reference< chart2::data::XLabeledDataSequence> >& rSplitCategoriesList( aExplicitCategoriesProvider.getSplitCategoriesList() ); sal_Int32 nLevelCount = rSplitCategoriesList.getLength(); diff --git a/chart2/source/controller/dialogs/DataBrowserModel.hxx b/chart2/source/controller/dialogs/DataBrowserModel.hxx index b538e01de271..d7c7be071f66 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.hxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.hxx @@ -19,6 +19,7 @@ #pragma once #include <com/sun/star/uno/Reference.hxx> +#include <rtl/ref.hxx> #include <memory> #include <vector> @@ -35,12 +36,13 @@ namespace chart { class DialogModel; +class ChartModel; class DataBrowserModel final { public: explicit DataBrowserModel( - const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc, + const rtl::Reference<::chart::ChartModel> & xChartDoc, const css::uno::Reference< css::uno::XComponentContext > & xContext ); ~DataBrowserModel(); @@ -146,7 +148,7 @@ private: sal_Int32 getCategoryColumnCount(); - css::uno::Reference< css::chart2::XChartDocument > m_xChartDocument; + rtl::Reference<::chart::ChartModel> m_xChartDocument; std::unique_ptr< DialogModel > m_apDialogModel; struct tDataColumn; diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index efb2244c98c9..9b270964ba6e 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -414,7 +414,7 @@ DialogModelTimeBasedInfo::DialogModelTimeBasedInfo(): } DialogModel::DialogModel( - const Reference< XChartDocument > & xChartDocument, + const rtl::Reference<::chart::ChartModel> & xChartDocument, const Reference< uno::XComponentContext > & xContext ) : m_xChartDocument( xChartDocument ), m_xContext( xContext ), @@ -446,7 +446,7 @@ std::shared_ptr< RangeSelectionHelper > const & return m_spRangeSelectionHelper; } -Reference< frame::XModel > DialogModel::getChartModel() const +const rtl::Reference<::chart::ChartModel> & DialogModel::getChartModel() const { return m_xChartDocument; } @@ -725,7 +725,7 @@ void DialogModel::detectArguments( if( m_xChartDocument.is()) { (void)DataSourceHelper::detectRangeSegmentation( - Reference< frame::XModel >( m_xChartDocument, uno::UNO_QUERY_THROW ), + m_xChartDocument, rOutRangeString, aSequenceMapping, rOutUseColumns, rOutFirstCellAsLabel, rOutHasCategories ); } } diff --git a/chart2/source/controller/dialogs/DialogModel.hxx b/chart2/source/controller/dialogs/DialogModel.hxx index be7f78a59e78..2bd8d55faf00 100644 --- a/chart2/source/controller/dialogs/DialogModel.hxx +++ b/chart2/source/controller/dialogs/DialogModel.hxx @@ -64,7 +64,7 @@ class DialogModel { public: explicit DialogModel( - const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument, + const rtl::Reference<::chart::ChartModel> & xChartDocument, const css::uno::Reference< css::uno::XComponentContext > & xContext ); ~DialogModel(); @@ -83,7 +83,7 @@ public: std::shared_ptr< RangeSelectionHelper > const & getRangeSelectionHelper() const; - css::uno::Reference< css::frame::XModel > + const rtl::Reference<::chart::ChartModel> & getChartModel() const; css::uno::Reference< css::chart2::data::XDataProvider > @@ -152,7 +152,7 @@ public: ChartModel& getModel() const; private: - css::uno::Reference< css::chart2::XChartDocument > + rtl::Reference<::chart::ChartModel> m_xChartDocument; css::uno::Reference< css::chart2::XChartTypeTemplate > diff --git a/chart2/source/controller/dialogs/ObjectNameProvider.cxx b/chart2/source/controller/dialogs/ObjectNameProvider.cxx index b2e101ee0ef4..201671e87bcf 100644 --- a/chart2/source/controller/dialogs/ObjectNameProvider.cxx +++ b/chart2/source/controller/dialogs/ObjectNameProvider.cxx @@ -58,7 +58,7 @@ using ::com::sun::star::uno::Any; namespace { -OUString lcl_getDataSeriesName( const OUString& rObjectCID, const Reference< frame::XModel >& xChartModel ) +OUString lcl_getDataSeriesName( const OUString& rObjectCID, const rtl::Reference<::chart::ChartModel>& xChartModel ) { OUString aRet; @@ -77,7 +77,7 @@ OUString lcl_getDataSeriesName( const OUString& rObjectCID, const Reference< fra return aRet; } -OUString lcl_getFullSeriesName( const OUString& rObjectCID, const Reference< frame::XModel >& xChartModel ) +OUString lcl_getFullSeriesName( const OUString& rObjectCID, const rtl::Reference<::chart::ChartModel>& xChartModel ) { OUString aRet(SchResId(STR_TIP_DATASERIES)); OUString aWildcard( "%SERIESNAME" ); @@ -319,7 +319,7 @@ OUString ObjectNameProvider::getName( ObjectType eObjectType, bool bPlural ) } OUString ObjectNameProvider::getAxisName( const OUString& rObjectCID - , const uno::Reference< frame::XModel >& xChartModel ) + , const rtl::Reference<::chart::ChartModel>& xChartModel ) { OUString aRet; @@ -395,7 +395,7 @@ OUString ObjectNameProvider::getTitleNameByType( TitleHelper::eTitleType eType ) } OUString ObjectNameProvider::getTitleName( const OUString& rObjectCID - , const Reference< frame::XModel >& xChartModel ) + , const rtl::Reference<::chart::ChartModel>& xChartModel ) { OUString aRet; @@ -414,7 +414,7 @@ OUString ObjectNameProvider::getTitleName( const OUString& rObjectCID } OUString ObjectNameProvider::getGridName( const OUString& rObjectCID - , const uno::Reference< frame::XModel >& xChartModel ) + , const rtl::Reference<::chart::ChartModel>& xChartModel ) { OUString aRet; @@ -466,12 +466,7 @@ OUString ObjectNameProvider::getGridName( const OUString& rObjectCID return aRet; } -OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Reference< chart2::XChartDocument >& xChartDocument ) -{ - return getHelpText( rObjectCID, Reference< frame::XModel >( xChartDocument ) ); -} - -OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Reference< frame::XModel >& xChartModel, bool bVerbose ) +OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const rtl::Reference<::chart::ChartModel>& xChartModel, bool bVerbose ) { OUString aRet; ObjectType eObjectType( ObjectIdentifier::getObjectType(rObjectCID) ); @@ -723,18 +718,17 @@ OUString ObjectNameProvider::getHelpText( const OUString& rObjectCID, const Refe return aRet; } -OUString ObjectNameProvider::getSelectedObjectText( const OUString & rObjectCID, const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument ) +OUString ObjectNameProvider::getSelectedObjectText( const OUString & rObjectCID, const rtl::Reference<::chart::ChartModel>& xChartDocument ) { OUString aRet; ObjectType eObjectType( ObjectIdentifier::getObjectType(rObjectCID) ); - Reference< frame::XModel > xChartModel = xChartDocument; if( eObjectType == OBJECTTYPE_DATA_POINT ) { aRet = SchResId( STR_STATUS_DATAPOINT_MARKED ); - rtl::Reference< Diagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) ); - Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartModel ); + rtl::Reference< Diagram > xDiagram( ChartModelHelper::findDiagram( xChartDocument ) ); + Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartDocument ); if( xDiagram.is() && xSeries.is() ) { sal_Int32 nPointIndex( ObjectIdentifier::getParticleID(rObjectCID).toInt32() ); @@ -757,14 +751,14 @@ OUString ObjectNameProvider::getSelectedObjectText( const OUString & rObjectCID, // replace point value replaceParamterInString( aRet, "%POINTVALUES", lcl_getDataPointValueText( - xSeries, nPointIndex, DataSeriesHelper::getCoordinateSystemOfSeries(xSeries, xDiagram), xChartModel ) ); + xSeries, nPointIndex, DataSeriesHelper::getCoordinateSystemOfSeries(xSeries, xDiagram), xChartDocument ) ); } } else { // use the verbose text including the formula for trend lines const bool bVerbose( eObjectType == OBJECTTYPE_DATA_CURVE || eObjectType == OBJECTTYPE_DATA_AVERAGE_LINE ); - const OUString aHelpText( getHelpText( rObjectCID, xChartModel, bVerbose )); + const OUString aHelpText( getHelpText( rObjectCID, xChartDocument, bVerbose )); if( !aHelpText.isEmpty()) { aRet = SchResId( STR_STATUS_OBJECT_MARKED ); @@ -777,22 +771,21 @@ OUString ObjectNameProvider::getSelectedObjectText( const OUString & rObjectCID, OUString ObjectNameProvider::getNameForCID( const OUString& rObjectCID, - const uno::Reference< chart2::XChartDocument >& xChartDocument ) + const rtl::Reference<::chart::ChartModel>& xChartDocument ) { ObjectType eType( ObjectIdentifier::getObjectType( rObjectCID )); - Reference< frame::XModel > xModel = xChartDocument; switch( eType ) { case OBJECTTYPE_AXIS: - return getAxisName( rObjectCID, xModel ); + return getAxisName( rObjectCID, xChartDocument ); case OBJECTTYPE_TITLE: - return getTitleName( rObjectCID, xModel ); + return getTitleName( rObjectCID, xChartDocument ); case OBJECTTYPE_GRID: case OBJECTTYPE_SUBGRID: - return getGridName( rObjectCID, xModel ); + return getGridName( rObjectCID, xChartDocument ); case OBJECTTYPE_DATA_SERIES: - return lcl_getFullSeriesName( rObjectCID, xModel ); + return lcl_getFullSeriesName( rObjectCID, xChartDocument ); case OBJECTTYPE_DATA_POINT: case OBJECTTYPE_DATA_LABELS: case OBJECTTYPE_DATA_LABEL: @@ -803,7 +796,7 @@ OUString ObjectNameProvider::getNameForCID( case OBJECTTYPE_DATA_CURVE: case OBJECTTYPE_DATA_CURVE_EQUATION: { - OUString aRet = lcl_getFullSeriesName( rObjectCID, xModel ) + " "; + OUString aRet = lcl_getFullSeriesName( rObjectCID, xChartDocument ) + " "; if( eType == OBJECTTYPE_DATA_POINT || eType == OBJECTTYPE_DATA_LABEL ) { aRet += getName( OBJECTTYPE_DATA_POINT ); @@ -816,7 +809,7 @@ OUString ObjectNameProvider::getNameForCID( } else if (eType == OBJECTTYPE_DATA_CURVE || eType == OBJECTTYPE_DATA_CURVE_EQUATION) { - Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xModel )); + Reference< chart2::XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID( rObjectCID , xChartDocument )); Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY ); aRet += " " + getName(eType); @@ -847,15 +840,14 @@ OUString ObjectNameProvider::getNameForCID( OUString ObjectNameProvider::getName_ObjectForSeries( ObjectType eObjectType, const OUString& rSeriesCID, - const uno::Reference< chart2::XChartDocument >& xChartDocument ) + const rtl::Reference<::chart::ChartModel>& xChartDocument ) { - uno::Reference< frame::XModel> xChartModel = xChartDocument; - Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rSeriesCID , xChartModel ); + Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( rSeriesCID , xChartDocument ); if( xSeries.is() ) { OUString aRet = SchResId(STR_OBJECT_FOR_SERIES); replaceParamterInString( aRet, "%OBJECTNAME", getName( eObjectType ) ); - replaceParamterInString( aRet, "%SERIESNAME", lcl_getDataSeriesName( rSeriesCID, xChartModel ) ); + replaceParamterInString( aRet, "%SERIESNAME", lcl_getDataSeriesName( rSeriesCID, xChartDocument ) ); return aRet; } else diff --git a/chart2/source/controller/dialogs/RangeSelectionHelper.cxx b/chart2/source/controller/dialogs/RangeSelectionHelper.cxx index 3a468845dc3f..5cbc07f76078 100644 --- a/chart2/source/controller/dialogs/RangeSelectionHelper.cxx +++ b/chart2/source/controller/dialogs/RangeSelectionHelper.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/chart2/XChartDocument.hpp> #include <com/sun/star/chart2/data/XDataProvider.hpp> #include <tools/diagnose_ex.h> +#include <ChartModel.hxx> using namespace ::com::sun::star; @@ -33,7 +34,7 @@ namespace chart { RangeSelectionHelper::RangeSelectionHelper( - const Reference< chart2::XChartDocument > & xChartDocument ) : + const rtl::Reference<::chart::ChartModel> & xChartDocument ) : m_xChartDocument( xChartDocument ) {} diff --git a/chart2/source/controller/dialogs/RangeSelectionListener.cxx b/chart2/source/controller/dialogs/RangeSelectionListener.cxx index ca0d9ae2cd48..473ad909f8f5 100644 --- a/chart2/source/controller/dialogs/RangeSelectionListener.cxx +++ b/chart2/source/controller/dialogs/RangeSelectionListener.cxx @@ -18,6 +18,7 @@ */ #include <RangeSelectionListener.hxx> +#include <ChartModel.hxx> using namespace ::com::sun::star; @@ -29,7 +30,7 @@ namespace chart RangeSelectionListener::RangeSelectionListener( RangeSelectionListenerParent & rParent, const OUString & rInitialRange, - const Reference< frame::XModel >& xModelToLockController ) : + const rtl::Reference<::chart::ChartModel>& xModelToLockController ) : m_rParent( rParent ), m_aRange( rInitialRange ), m_aControllerLockGuard( xModelToLockController ) diff --git a/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx b/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx index 554628317890..33fe0ff6955f 100644 --- a/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx +++ b/chart2/source/controller/dialogs/TimerTriggeredControllerLock.cxx @@ -20,13 +20,14 @@ #include <com/sun/star/frame/XModel.hpp> #include <TimerTriggeredControllerLock.hxx> #include <ControllerLockGuard.hxx> +#include <ChartModel.hxx> namespace chart { using namespace ::com::sun::star; TimerTriggeredControllerLock::TimerTriggeredControllerLock( - const uno::Reference<frame::XModel>& xModel) + const rtl::Reference<::chart::ChartModel>& xModel) : m_xModel(xModel) , m_aTimer("chart2 TimerTriggeredControllerLock") { diff --git a/chart2/source/controller/dialogs/TitleDialogData.cxx b/chart2/source/controller/dialogs/TitleDialogData.cxx index 63997be2e0c7..7f48d90a0b24 100644 --- a/chart2/source/controller/dialogs/TitleDialogData.cxx +++ b/chart2/source/controller/dialogs/TitleDialogData.cxx @@ -26,6 +26,7 @@ #include <ChartModelHelper.hxx> #include <Diagram.hxx> #include <AxisHelper.hxx> +#include <ChartModel.hxx> namespace chart { @@ -40,7 +41,7 @@ TitleDialogData::TitleDialogData( std::unique_ptr<ReferenceSizeProvider> pRefSiz { } -void TitleDialogData::readFromModel( const uno::Reference< frame::XModel>& xChartModel ) +void TitleDialogData::readFromModel( const rtl::Reference<::chart::ChartModel>& xChartModel ) { rtl::Reference< Diagram > xDiagram = ChartModelHelper::findDiagram(xChartModel); @@ -70,7 +71,7 @@ void TitleDialogData::readFromModel( const uno::Reference< frame::XModel>& xChar } bool TitleDialogData::writeDifferenceToModel( - const uno::Reference< frame::XModel >& xChartModel + const rtl::Reference<::chart::ChartModel>& xChartModel , const uno::Reference< uno::XComponentContext >& xContext , TitleDialogData* pOldState ) { diff --git a/chart2/source/controller/dialogs/dlg_ChartType.cxx b/chart2/source/controller/dialogs/dlg_ChartType.cxx index 324eb06c8373..59ca6be0c99a 100644 --- a/chart2/source/controller/dialogs/dlg_ChartType.cxx +++ b/chart2/source/controller/dialogs/dlg_ChartType.cxx @@ -20,6 +20,7 @@ #include <dlg_ChartType.hxx> #include "tp_ChartType.hxx" #include <com/sun/star/chart2/XChartDocument.hpp> +#include <ChartModel.hxx> namespace chart { @@ -27,14 +28,13 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; ChartTypeDialog::ChartTypeDialog(weld::Window* pParent, - const uno::Reference<frame::XModel>& xChartModel) + const rtl::Reference<::chart::ChartModel>& xChartModel) : GenericDialogController(pParent, "modules/schart/ui/charttypedialog.ui", "ChartTypeDialog") , m_xChartModel(xChartModel) , m_xContentArea(m_xDialog->weld_content_area()) { m_xChartTypeTabPage = std::make_unique<ChartTypeTabPage>( - m_xContentArea.get(), this, uno::Reference<XChartDocument>::query(m_xChartModel), - false /*don't show title description*/); + m_xContentArea.get(), this, m_xChartModel, false /*don't show title description*/); m_xChartTypeTabPage->initializePage(); } diff --git a/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx b/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx index 1a34d47b4f9c..873edbc48ada 100644 --- a/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx +++ b/chart2/source/controller/dialogs/dlg_ChartType_UNO.cxx @@ -19,6 +19,7 @@ #include <dlg_ChartType_UNO.hxx> #include <dlg_ChartType.hxx> +#include <ChartModel.hxx> #include <servicenames.hxx> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> @@ -64,7 +65,12 @@ void ChartTypeUnoDlg::implInitialize(const uno::Any& _rValue) if (_rValue >>= aProperty) { if (aProperty.Name == "ChartModel") - m_xChartModel.set(aProperty.Value,uno::UNO_QUERY); + { + uno::Reference<XInterface> xInt; + aProperty.Value >>= xInt; + assert(dynamic_cast<::chart::ChartModel*>(xInt.get())); + m_xChartModel = dynamic_cast<::chart::ChartModel*>(xInt.get()); + } else ChartTypeUnoDlg_BASE::implInitialize(_rValue); } @@ -74,7 +80,9 @@ void ChartTypeUnoDlg::implInitialize(const uno::Any& _rValue) std::unique_ptr<weld::DialogController> ChartTypeUnoDlg::createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) { - return std::make_unique<ChartTypeDialog>(Application::GetFrameWeld(rParent), m_xChartModel); + ChartModel* pChartModel = dynamic_cast<ChartModel*>(rParent.get()); + assert(pChartModel); + return std::make_unique<ChartTypeDialog>(Application::GetFrameWeld(rParent), pChartModel); } uno::Reference<beans::XPropertySetInfo> SAL_CALL ChartTypeUnoDlg::getPropertySetInfo() diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx index 66701c4b8ab6..56da19feacd6 100644 --- a/chart2/source/controller/dialogs/dlg_CreationWizard.cxx +++ b/chart2/source/controller/dialogs/dlg_CreationWizard.cxx @@ -45,7 +45,7 @@ namespace chart #define STATE_OBJECTS 3 #define STATE_LAST STATE_OBJECTS -CreationWizard::CreationWizard(weld::Window* pParent, const uno::Reference<frame::XModel>& xChartModel, +CreationWizard::CreationWizard(weld::Window* pParent, const rtl::Reference<::chart::ChartModel>& xChartModel, const uno::Reference<uno::XComponentContext>& xContext) : vcl::RoadmapWizardMachine(pParent) , m_xChartModel(xChartModel,uno::UNO_QUERY) diff --git a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx index 0b2a87cd67c0..973b8fa74027 100644 --- a/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx +++ b/chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx @@ -19,6 +19,7 @@ #include <dlg_CreationWizard_UNO.hxx> #include <dlg_CreationWizard.hxx> +#include <ChartModel.hxx> #include <servicenames.hxx> #include <TimerTriggeredControllerLock.hxx> #include <vcl/svapp.hxx> @@ -218,7 +219,10 @@ void SAL_CALL CreationWizardUnoDlg::initialize( const uno::Sequence< uno::Any >& } else if( aProperty.Name == "ChartModel" ) { - aProperty.Value >>= m_xChartModel; + uno::Reference<XInterface> xInt; + aProperty.Value >>= xInt; + m_xChartModel = dynamic_cast<::chart::ChartModel*>(xInt.get()); + assert(m_xChartModel); } } } diff --git a/chart2/source/controller/dialogs/dlg_DataEditor.cxx b/chart2/source/controller/dialogs/dlg_DataEditor.cxx index 3cb9598cb2e9..1e442a102f09 100644 --- a/chart2/source/controller/dialogs/dlg_DataEditor.cxx +++ b/chart2/source/controller/dialogs/dlg_DataEditor.cxx @@ -19,6 +19,7 @@ #include <dlg_DataEditor.hxx> #include "DataBrowser.hxx" +#include <ChartModel.hxx> #include <comphelper/stl_types.hxx> #include <com/sun/star/awt/XWindow.hpp> @@ -32,7 +33,7 @@ namespace chart { DataEditor::DataEditor(weld::Window* pParent, - const Reference< chart2::XChartDocument > & xChartDoc, + const rtl::Reference<::chart::ChartModel> & xChartDoc, const Reference< uno::XComponentContext > & xContext) : GenericDialogController(pParent, "modules/schart/ui/chartdatadialog.ui", "ChartDataDialog") , m_bReadOnly(false) @@ -61,9 +62,8 @@ DataEditor::DataEditor(weld::Window* pParent, m_xBrwData->GrabFocus(); bool bReadOnly = true; - Reference< frame::XStorable > xStor( m_xChartDoc, uno::UNO_QUERY ); - if( xStor.is()) - bReadOnly = xStor->isReadonly(); + if( m_xChartDoc.is()) + bReadOnly = m_xChartDoc->isReadonly(); SetReadOnly( bReadOnly ); } diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx index 2f375ae1be5b..5f239f926f12 100644 --- a/chart2/source/controller/dialogs/dlg_DataSource.cxx +++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx @@ -26,6 +26,8 @@ #include <ChartTypeTemplate.hxx> #include <DiagramHelper.hxx> #include "DialogModel.hxx" +#include <ChartModel.hxx> +#include <ChartTypeManager.hxx> #include "tp_RangeChooser.hxx" #include "tp_DataSource.hxx" @@ -45,7 +47,7 @@ class DocumentChartTypeTemplateProvider : public ChartTypeTemplateProvider { public: explicit DocumentChartTypeTemplateProvider( - const Reference< chart2::XChartDocument > & xDoc ); + const rtl::Reference<::chart::ChartModel> & xDoc ); // ____ ChartTypeTemplateProvider ____ virtual rtl::Reference< ::chart::ChartTypeTemplate > getCurrentTemplate() const override; @@ -57,7 +59,7 @@ private: } DocumentChartTypeTemplateProvider::DocumentChartTypeTemplateProvider( - const Reference< chart2::XChartDocument > & xDoc ) + const rtl::Reference<::chart::ChartModel> & xDoc ) { if( !xDoc.is()) return; @@ -68,7 +70,7 @@ DocumentChartTypeTemplateProvider::DocumentChartTypeTemplateProvider( DiagramHelper::tTemplateWithServiceName aResult( DiagramHelper::getTemplateForDiagram( xDia, - dynamic_cast<::chart::ChartTypeManager*>(xDoc->getChartTypeManager().get()) )); + xDoc->getTypeManager() )); m_xTemplate = aResult.xChartTypeTemplate; } } @@ -81,7 +83,7 @@ rtl::Reference< ::chart::ChartTypeTemplate > DocumentChartTypeTemplateProvider:: sal_uInt16 DataSourceDialog::m_nLastPageId = 0; DataSourceDialog::DataSourceDialog(weld::Window * pParent, - const Reference< XChartDocument > & xChartDocument, + const rtl::Reference<::chart::ChartModel> & xChartDocument, const Reference< uno::XComponentContext > & xContext) : GenericDialogController(pParent, "modules/schart/ui/datarangedialog.ui", "DataRangeDialog") diff --git a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx index 13cfa0cd36b6..ceec42d736e8 100644 --- a/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx +++ b/chart2/source/controller/dialogs/dlg_InsertErrorBars.cxx @@ -22,6 +22,7 @@ #include <chartview/ExplicitScaleValues.hxx> #include <chartview/ExplicitValueProvider.hxx> #include <ChartModelHelper.hxx> +#include <ChartModel.hxx> #include <ObjectIdentifier.hxx> #include <DiagramHelper.hxx> #include <Diagram.hxx> @@ -40,7 +41,7 @@ namespace chart InsertErrorBarsDialog::InsertErrorBarsDialog( weld::Window* pParent, const SfxItemSet& rMyAttrs, - const uno::Reference< chart2::XChartDocument > & xChartDocument, + const rtl::Reference<::chart::ChartModel> & xChartDocument, ErrorBarResources::tErrorBarType eType /* = ErrorBarResources::ERROR_BAR_Y */ ) : GenericDialogController(pParent, "modules/schart/ui/dlg_InsertErrorBars.ui", "dlg_InsertErrorBars") , m_apErrorBarResources( new ErrorBarResources( @@ -65,7 +66,7 @@ void InsertErrorBarsDialog::SetAxisMinorStepWidthForErrorBarDecimals( double fMi } double InsertErrorBarsDialog::getAxisMinorStepWidthForErrorBarDecimals( - const Reference< frame::XModel >& xChartModel, + const rtl::Reference<::chart::ChartModel>& xChartModel, const Reference< uno::XInterface >& xChartView, const OUString& rSelectedObjectCID ) { diff --git a/chart2/source/controller/dialogs/dlg_InsertLegend.cxx b/chart2/source/controller/dialogs/dlg_InsertLegend.cxx index f718366d7c8b..c55ecc3e88d6 100644 --- a/chart2/source/controller/dialogs/dlg_InsertLegend.cxx +++ b/chart2/source/controller/dialogs/dlg_InsertLegend.cxx @@ -30,12 +30,12 @@ SchLegendDlg::SchLegendDlg(weld::Window* pWindow, const uno::Reference<uno::XCom { } -void SchLegendDlg::init(const uno::Reference<frame::XModel>& xChartModel) +void SchLegendDlg::init(const rtl::Reference<::chart::ChartModel>& xChartModel) { m_xLegendPositionResources->writeToResources(xChartModel); } -void SchLegendDlg::writeToModel(const uno::Reference<frame::XModel>& xChartModel) const +void SchLegendDlg::writeToModel(const rtl::Reference<::chart::ChartModel>& xChartModel) const { m_xLegendPositionResources->writeToModel(xChartModel); } diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index a380357c12f9..84740d9bf708 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -110,10 +110,10 @@ ObjectPropertiesDialogParameter::~ObjectPropertiesDialogParameter() { } -void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel >& xChartModel ) +void ObjectPropertiesDialogParameter::init( const rtl::Reference<::chart::ChartModel>& xChartModel ) { - m_xChartDocument.set( xChartModel, uno::UNO_QUERY ); - rtl::Reference< Diagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) ); + m_xChartDocument = xChartModel; + rtl::Reference< Diagram > xDiagram = ChartModelHelper::findDiagram( xChartModel ); uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aObjectCID, xChartModel ); uno::Reference< XChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries ); sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); @@ -172,9 +172,8 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel m_bIsCrossingAxisIsCategoryAxis = ( aScale.AxisType == chart2::AxisType::CATEGORY ); if( m_bIsCrossingAxisIsCategoryAxis ) { - ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get()); - if (pModel) - m_aCategories = DiagramHelper::getExplicitSimpleCategories( *pModel ); + if (xChartModel) + m_aCategories = DiagramHelper::getExplicitSimpleCategories( *xChartModel ); } } @@ -193,10 +192,9 @@ void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel if ( nDimensionIndex == 0 && ( aData.AxisType == chart2::AxisType::CATEGORY || aData.AxisType == chart2::AxisType::DATE ) ) { - ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get()); - if (pModel) + if (xChartModel) { - ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, *pModel ); + ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, *xChartModel ); m_bComplexCategoriesAxis = aExplicitCategoriesProvider.hasComplexCategories(); } diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx index 857a630be26f..09fc4923bdd9 100644 --- a/chart2/source/controller/dialogs/dlg_View3D.cxx +++ b/chart2/source/controller/dialogs/dlg_View3D.cxx @@ -24,6 +24,7 @@ #include "tp_3D_SceneAppearance.hxx" #include "tp_3D_SceneIllumination.hxx" #include <ChartModelHelper.hxx> +#include <ChartModel.hxx> #include <Diagram.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/chart2/XDiagram.hpp> @@ -37,12 +38,12 @@ using namespace ::com::sun::star::chart2; sal_uInt16 View3DDialog::m_nLastPageId = 0; -View3DDialog::View3DDialog(weld::Window* pParent, const uno::Reference< frame::XModel > & xChartModel) +View3DDialog::View3DDialog(weld::Window* pParent, const rtl::Reference<::chart::ChartModel> & xChartModel) : GenericDialogController(pParent, "modules/schart/ui/3dviewdialog.ui", "3DViewDialog") , m_aControllerLocker(xChartModel) , m_xTabControl(m_xBuilder->weld_notebook("tabcontrol")) { - rtl::Reference< Diagram > xSceneProperties( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY ); + rtl::Reference< Diagram > xSceneProperties = ChartModelHelper::findDiagram( xChartModel ); m_xTabControl->append_page("geometry", SchResId(STR_PAGE_PERSPECTIVE)); m_xGeometry.reset(new ThreeD_SceneGeometry_TabPage(m_xTabControl->get_page("geometry"), xSceneProperties, m_aControllerLocker)); diff --git a/chart2/source/controller/dialogs/res_ErrorBar.cxx b/chart2/source/controller/dialogs/res_ErrorBar.cxx index 39ee44909e61..1e5078a301fc 100644 --- a/chart2/source/controller/dialogs/res_ErrorBar.cxx +++ b/chart2/source/controller/dialogs/res_ErrorBar.cxx @@ -24,6 +24,7 @@ #include <chartview/ChartSfxItemIds.hxx> #include <com/sun/star/chart2/XChartDocument.hpp> #include <vcl/weld.hxx> +#include <ChartModel.hxx> #include <rtl/math.hxx> #include <tools/diagnose_ex.h> @@ -165,12 +166,12 @@ void ErrorBarResources::SetErrorBarType( tErrorBarType eNewType ) } void ErrorBarResources::SetChartDocumentForRangeChoosing( - const uno::Reference< chart2::XChartDocument > & xChartDocument ) + const rtl::Reference<::chart::ChartModel> & xChartDocument ) { if( xChartDocument.is()) { m_bHasInternalDataProvider = xChartDocument->hasInternalDataProvider(); - uno::Reference< beans::XPropertySet > xProps( xChartDocument, uno::UNO_QUERY ); + uno::Reference< beans::XPropertySet > xProps( static_cast<cppu::OWeakObject*>(xChartDocument.get()), uno::UNO_QUERY ); if ( xProps.is() ) { try diff --git a/chart2/source/controller/dialogs/res_LegendPosition.cxx b/chart2/source/controller/dialogs/res_LegendPosition.cxx index a7104093fc9d..aac0a11368a1 100644 --- a/chart2/source/controller/dialogs/res_LegendPosition.cxx +++ b/chart2/source/controller/dialogs/res_LegendPosition.cxx @@ -73,7 +73,7 @@ LegendPositionResources::~LegendPositionResources() { } -void LegendPositionResources::writeToResources( const uno::Reference< frame::XModel >& xChartModel ) +void LegendPositionResources::writeToResources( const rtl::Reference<::chart::ChartModel>& xChartModel ) { try { @@ -115,12 +115,12 @@ void LegendPositionResources::writeToResources( const uno::Reference< frame::XMo } } -void LegendPositionResources::writeToModel( const css::uno::Reference< frame::XModel >& xChartModel ) const +void LegendPositionResources::writeToModel( const rtl::Reference<::chart::ChartModel>& xChartModel ) const { try { bool bShowLegend = m_xCbxShow && m_xCbxShow->get_active(); - ChartModel& rModel = dynamic_cast<ChartModel&>(*xChartModel); + ChartModel& rModel = *xChartModel; uno::Reference< beans::XPropertySet > xProp(LegendHelper::getLegend(rModel, m_xCC, bShowLegend), uno::UNO_QUERY); if( xProp.is() ) { diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx index 389d1b1fe89e..40dd7b9cd493 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx @@ -19,6 +19,7 @@ #include "tp_3D_SceneAppearance.hxx" #include <ChartModelHelper.hxx> +#include <ChartModel.hxx> #include <ThreeDHelper.hxx> #include <ControllerLockGuard.hxx> #include <Diagram.hxx> @@ -49,7 +50,7 @@ struct lcl_ModelProperties {} }; -lcl_ModelProperties lcl_getPropertiesFromModel( uno::Reference< frame::XModel > const & xModel ) +lcl_ModelProperties lcl_getPropertiesFromModel( rtl::Reference<::chart::ChartModel> const & xModel ) { lcl_ModelProperties aProps; try @@ -66,12 +67,11 @@ lcl_ModelProperties lcl_getPropertiesFromModel( uno::Reference< frame::XModel > return aProps; } -void lcl_setShadeModeAtModel( uno::Reference< frame::XModel > const & xModel, drawing::ShadeMode aShadeMode ) +void lcl_setShadeModeAtModel( rtl::Reference<::chart::ChartModel> const & xModel, drawing::ShadeMode aShadeMode ) { try { - rtl::Reference< ::chart::Diagram > xDiaProp = - ::chart::ChartModelHelper::findDiagram( xModel ); + rtl::Reference< ::chart::Diagram > xDiaProp = ::chart::ChartModelHelper::findDiagram( xModel ); xDiaProp->setPropertyValue( "D3DSceneShadeMode" , uno::Any( aShadeMode )); } catch( const uno::Exception & ) @@ -90,7 +90,7 @@ namespace chart #define POS_3DSCHEME_CUSTOM 2 ThreeD_SceneAppearance_TabPage::ThreeD_SceneAppearance_TabPage(weld::Container* pParent, - const uno::Reference<frame::XModel>& xChartModel, + const rtl::Reference<::chart::ChartModel>& xChartModel, ControllerLockHelper& rControllerLockHelper) : m_xChartModel(xChartModel) , m_bUpdateOtherControls(true) @@ -272,7 +272,7 @@ IMPL_LINK_NOARG(ThreeD_SceneAppearance_TabPage, SelectSchemeHdl, weld::ComboBox& // locked controllers ControllerLockHelperGuard aGuard( m_rControllerLockHelper ); - rtl::Reference< Diagram > xDiagram( ::chart::ChartModelHelper::findDiagram( m_xChartModel ) ); + rtl::Reference< Diagram > xDiagram = ::chart::ChartModelHelper::findDiagram( m_xChartModel ); if( m_xLB_Scheme->get_active() == POS_3DSCHEME_REALISTIC ) ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme::ThreeDLookScheme_Realistic ); diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx index 1f13240b0015..9d255c076e28 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx @@ -25,13 +25,14 @@ namespace com::sun::star::frame { class XModel; } namespace chart { +class ChartModel; class ThreeD_SceneAppearance_TabPage { public: ThreeD_SceneAppearance_TabPage( weld::Container* pParent, - const css::uno::Reference< css::frame::XModel > & xChartModel, + const rtl::Reference<::chart::ChartModel> & xChartModel, ControllerLockHelper & rControllerLockHelper ); void ActivatePage(); ~ThreeD_SceneAppearance_TabPage(); @@ -47,7 +48,7 @@ private: void updateScheme(); private: - css::uno::Reference<css::frame::XModel> m_xChartModel; + rtl::Reference<::chart::ChartModel> m_xChartModel; bool m_bUpdateOtherControls; bool m_bCommitToModel; diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx index 74c2de00b5b9..56d2d44f9ce6 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx @@ -20,6 +20,7 @@ #include "tp_3D_SceneIllumination.hxx" #include <CommonConverters.hxx> #include <ControllerLockGuard.hxx> +#include <ChartModel.hxx> #include <svx/colorbox.hxx> #include <svx/float3d.hxx> @@ -183,7 +184,7 @@ namespace ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage(weld::Container* pParent, weld::Window* pTopLevel, const uno::Reference< beans::XPropertySet > & xSceneProperties, - const uno::Reference< frame::XModel >& xChartModel) + const rtl::Reference<::chart::ChartModel>& xChartModel) : m_xSceneProperties( xSceneProperties ) , m_aTimerTriggeredControllerLock( xChartModel ) , m_bInCommitToModel( false ) diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx index 29cc518631ad..7ad91e225d37 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx @@ -34,6 +34,7 @@ class LightButton; namespace chart { struct LightSourceInfo; +class ChartModel; class ThreeD_SceneIllumination_TabPage { @@ -41,7 +42,7 @@ public: ThreeD_SceneIllumination_TabPage( weld::Container* pParent, weld::Window* pTopLevel, const css::uno::Reference<css::beans::XPropertySet>& xSceneProperties, - const css::uno::Reference<css::frame::XModel>& xChartModel); + const rtl::Reference<::chart::ChartModel>& xChartModel); ~ThreeD_SceneIllumination_TabPage(); private: @@ -68,7 +69,7 @@ private: bool m_bInCommitToModel; ModifyListenerCallBack m_aModelChangeListener; - css::uno::Reference<css::frame::XModel> m_xChartModel; + rtl::Reference<::chart::ChartModel> m_xChartModel; weld::Window* m_pTopLevel; std::unique_ptr<weld::Builder> m_xBuilder; diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx index bc381e4514bc..fa0cc7c29495 100644 --- a/chart2/source/controller/dialogs/tp_ChartType.cxx +++ b/chart2/source/controller/dialogs/tp_ChartType.cxx @@ -19,9 +19,11 @@ #include "tp_ChartType.hxx" #include <ChartResourceGroups.hxx> +#include <ChartTypeManager.hxx> #include <strings.hrc> #include <ResId.hxx> #include <ChartModelHelper.hxx> +#include <ChartModel.hxx> #include <ChartTypeManager.hxx> #include <ChartTypeTemplate.hxx> #include <DiagramHelper.hxx> @@ -41,7 +43,7 @@ namespace chart using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; -ChartTypeTabPage::ChartTypeTabPage(weld::Container* pPage, weld::DialogController* pController, const uno::Reference< XChartDocument >& xChartModel, +ChartTypeTabPage::ChartTypeTabPage(weld::Container* pPage, weld::DialogController* pController, const rtl::Reference<::chart::ChartModel>& xChartModel, bool bShowDescription) : OWizardPage(pPage, pController, "modules/schart/ui/tp_ChartType.ui", "tp_ChartType") , m_pDim3DLookResourceGroup( new Dim3DLookResourceGroup(m_xBuilder.get()) ) @@ -82,7 +84,7 @@ ChartTypeTabPage::ChartTypeTabPage(weld::Container* pPage, weld::DialogControlle m_xSubTypeList->SetLineCount(1); bool bEnableComplexChartTypes = true; - uno::Reference< beans::XPropertySet > xProps( m_xChartModel, uno::UNO_QUERY ); + uno::Reference< beans::XPropertySet > xProps( static_cast<cppu::OWeakObject*>(m_xChartModel.get()), uno::UNO_QUERY ); if ( xProps.is() ) { try @@ -303,10 +305,10 @@ void ChartTypeTabPage::initializePage() { if( !m_xChartModel.is() ) return; - rtl::Reference< ::chart::ChartTypeManager > xTemplateManager = dynamic_cast<::chart::ChartTypeManager*>( m_xChartModel->getChartTypeManager().get() ); - rtl::Reference< Diagram > xDiagram( ChartModelHelper::findDiagram( m_xChartModel ) ); + rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = m_xChartModel->getTypeManager(); + rtl::Reference< Diagram > xDiagram = ChartModelHelper::findDiagram( m_xChartModel ); DiagramHelper::tTemplateWithServiceName aTemplate = - DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager ); + DiagramHelper::getTemplateForDiagram( xDiagram, xChartTypeManager ); OUString aServiceName( aTemplate.sServiceName ); bool bFound = false; @@ -370,8 +372,8 @@ rtl::Reference< ChartTypeTemplate > ChartTypeTabPage::getCurrentTemplate() const { ChartTypeParameter aParameter( getCurrentParamter() ); m_pCurrentMainType->adjustParameterToSubType( aParameter ); - rtl::Reference< ChartTypeManager > xTemplateManager = dynamic_cast<ChartTypeManager*>(m_xChartModel->getChartTypeManager().get()); - return m_pCurrentMainType->getCurrentTemplate( aParameter, xTemplateManager ); + rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = m_xChartModel->getTypeManager(); + return m_pCurrentMainType->getCurrentTemplate( aParameter, xChartTypeManager ); } return nullptr; } diff --git a/chart2/source/controller/dialogs/tp_ChartType.hxx b/chart2/source/controller/dialogs/tp_ChartType.hxx index 7982a473f489..34ed8abf2327 100644 --- a/chart2/source/controller/dialogs/tp_ChartType.hxx +++ b/chart2/source/controller/dialogs/tp_ChartType.hxx @@ -45,7 +45,7 @@ class ChartTypeTabPage final : public ResourceChangeListener, public vcl::OWizar { public: ChartTypeTabPage( weld::Container* pPage, weld::DialogController* pController - , const css::uno::Reference< css::chart2::XChartDocument >& xChartModel + , const rtl::Reference<::chart::ChartModel>& xChartModel , bool bShowDescription = true ); virtual ~ChartTypeTabPage() override; @@ -74,7 +74,7 @@ private: std::unique_ptr<GeometryResourceGroup> m_pGeometryResourceGroup; std::unique_ptr<SortByXValuesResourceGroup> m_pSortByXValuesResourceGroup; - css::uno::Reference< css::chart2::XChartDocument > m_xChartModel; + rtl::Reference<::chart::ChartModel> m_xChartModel; std::vector< std::unique_ptr<ChartTypeDialogController> > m_aChartTypeDialogControllerList; ChartTypeDialogController* m_pCurrentMainType; diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx index c22e169d520d..45c00bfefb4c 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.cxx +++ b/chart2/source/controller/dialogs/tp_DataSource.cxx @@ -22,6 +22,7 @@ #include <ResId.hxx> #include <ChartTypeTemplateProvider.hxx> #include <ChartTypeTemplate.hxx> +#include <ChartModel.hxx> #include <RangeSelectionHelper.hxx> #include <DataSeriesHelper.hxx> #include <ControllerLockGuard.hxx> @@ -909,9 +910,8 @@ bool DataSourceTabPage::updateModelFromControl(const weld::Entry* pField) { try { - Reference< util::XModifiable > xModifiable( m_rDialogModel.getChartModel(), uno::UNO_QUERY ); - if( xModifiable.is() ) - xModifiable->setModified( true ); + if( m_rDialogModel.getChartModel() ) + m_rDialogModel.getChartModel()->setModified( true ); const DialogModelTimeBasedInfo& rInfo = m_rDialogModel.getTimeBasedInfo(); if(rInfo.bTimeBased) { diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.cxx b/chart2/source/controller/dialogs/tp_ErrorBars.cxx index 94a3d6c77173..927bf1130a43 100644 --- a/chart2/source/controller/dialogs/tp_ErrorBars.cxx +++ b/chart2/source/controller/dialogs/tp_ErrorBars.cxx @@ -57,7 +57,7 @@ void ErrorBarsTabPage::SetErrorBarType( ErrorBarResources::tErrorBarType eNewTyp } void ErrorBarsTabPage::SetChartDocumentForRangeChoosing( - const uno::Reference< chart2::XChartDocument > & xChartDocument ) + const rtl::Reference<::chart::ChartModel> & xChartDocument ) { m_aErrorBarResources.SetChartDocumentForRangeChoosing( xChartDocument ); } diff --git a/chart2/source/controller/dialogs/tp_ErrorBars.hxx b/chart2/source/controller/dialogs/tp_ErrorBars.hxx index 354006a26889..159de22b0d03 100644 --- a/chart2/source/controller/dialogs/tp_ErrorBars.hxx +++ b/chart2/source/controller/dialogs/tp_ErrorBars.hxx @@ -21,9 +21,11 @@ #include <res_ErrorBar.hxx> #include <sfx2/tabdlg.hxx> +#include <rtl/ref.hxx> namespace chart { +class ChartModel; class ErrorBarsTabPage : public SfxTabPage { @@ -33,7 +35,7 @@ public: void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ); void SetErrorBarType( ErrorBarResources::tErrorBarType eNewType ); void SetChartDocumentForRangeChoosing( - const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument ); + const rtl::Reference<::chart::ChartModel> & xChartDocument ); static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rInAttrs ); virtual bool FillItemSet( SfxItemSet* rOutAttrs ) override; diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx index 17a444f4b481..2719874fd66a 100644 --- a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx +++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.cxx @@ -21,6 +21,7 @@ #include <res_Titles.hxx> #include <res_LegendPosition.hxx> #include <ChartModelHelper.hxx> +#include <ChartModel.hxx> #include <Diagram.hxx> #include <AxisHelper.hxx> #include <ControllerLockGuard.hxx> @@ -33,7 +34,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; TitlesAndObjectsTabPage::TitlesAndObjectsTabPage(weld::Container* pPage, weld::DialogController* pController, - const uno::Reference< XChartDocument >& xChartModel, + const rtl::Reference<::chart::ChartModel>& xChartModel, const uno::Reference< uno::XComponentContext >& xContext ) : OWizardPage(pPage, pController, "modules/schart/ui/wizelementspage.ui", "WizElementsPage") , m_xTitleResources(new TitleResources(*m_xBuilder, false)) @@ -102,7 +103,7 @@ bool TitlesAndObjectsTabPage::commitPage( ::vcl::WizardTypes::CommitPageReason / void TitlesAndObjectsTabPage::commitToModel() { m_aTimerTriggeredControllerLock.startTimer(); - uno::Reference< frame::XModel > xModel = m_xChartModel; + rtl::Reference<::chart::ChartModel> xModel = m_xChartModel; ControllerLockGuardUNO aLockedControllers( xModel ); diff --git a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx index b31231633a21..f06a3e7ec589 100644 --- a/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx +++ b/chart2/source/controller/dialogs/tp_Wizard_TitlesAndObjects.hxx @@ -22,6 +22,7 @@ #include <TimerTriggeredControllerLock.hxx> #include <vcl/wizardmachine.hxx> +#include <rtl/ref.hxx> #include <memory> @@ -32,12 +33,13 @@ namespace com::sun::star::uno { class XComponentContext; } namespace chart { +class ChartModel; class TitlesAndObjectsTabPage final : public vcl::OWizardPage { public: TitlesAndObjectsTabPage(weld::Container* pPage, weld::DialogController* pController, - const css::uno::Reference< css::chart2::XChartDocument >& xChartModel, + const rtl::Reference<::chart::ChartModel>& xChartModel, const css::uno::Reference< css::uno::XComponentContext >& xContext); virtual ~TitlesAndObjectsTabPage() override; @@ -54,7 +56,7 @@ private: std::unique_ptr< TitleResources > m_xTitleResources; std::unique_ptr< LegendPositionResources > m_xLegendPositionResources; - css::uno::Reference< css::chart2::XChartDocument > m_xChartModel; + rtl::Reference<::chart::ChartModel> m_xChartModel; css::uno::Reference< css::uno::XComponentContext> m_xCC; bool m_bCommitToModel; diff --git a/chart2/source/controller/inc/ObjectNameProvider.hxx b/chart2/source/controller/inc/ObjectNameProvider.hxx index 07551aefa1d7..276e58977d35 100644 --- a/chart2/source/controller/inc/ObjectNameProvider.hxx +++ b/chart2/source/controller/inc/ObjectNameProvider.hxx @@ -36,33 +36,32 @@ class ObjectNameProvider public: static OUString getName( ObjectType eObjectType, bool bPlural=false ); static OUString getAxisName( const OUString& rObjectCID - , const css::uno::Reference< css::frame::XModel >& xChartModel ); + , const rtl::Reference<::chart::ChartModel>& xChartModel ); static OUString getGridName( const OUString& rObjectCID - , const css::uno::Reference< css::frame::XModel >& xChartModel ); + , const rtl::Reference<::chart::ChartModel>& xChartModel ); static OUString getTitleName( const OUString& rObjectCID - , const css::uno::Reference< css::frame::XModel >& xChartModel ); + , const rtl::Reference<::chart::ChartModel>& xChartModel ); static OUString getTitleNameByType( TitleHelper::eTitleType eType ); static OUString getNameForCID( const OUString& rObjectCID, - const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument ); + const rtl::Reference<::chart::ChartModel>& xChartDocument ); static OUString getName_ObjectForSeries( ObjectType eObjectType, const OUString& rSeriesCID, - const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument ); + const rtl::Reference<::chart::ChartModel>& xChartDocument ); static OUString getName_ObjectForAllSeries( ObjectType eObjectType ); /** Provides help texts for the various chart elements. The parameter rObjectCID has to be a ClassifiedIdentifier - see class ObjectIdentifier. */ - static OUString getHelpText( const OUString& rObjectCID, const css::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel, bool bVerbose=false ); - static OUString getHelpText( const OUString& rObjectCID, const css::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDocument ); + static OUString getHelpText( const OUString& rObjectCID, const rtl::Reference<::chart::ChartModel>& xChartModel, bool bVerbose=false ); /** This is used for showing the currently selected object in the status bar (command "Context") */ - static OUString getSelectedObjectText( const OUString & rObjectCID, const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument ); + static OUString getSelectedObjectText( const OUString & rObjectCID, const rtl::Reference<::chart::ChartModel>& xChartDocument ); }; } //namespace chart diff --git a/chart2/source/controller/inc/RangeSelectionHelper.hxx b/chart2/source/controller/inc/RangeSelectionHelper.hxx index f04d763e1636..02db335a1fc0 100644 --- a/chart2/source/controller/inc/RangeSelectionHelper.hxx +++ b/chart2/source/controller/inc/RangeSelectionHelper.hxx @@ -21,6 +21,7 @@ #include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Sequence.h> #include <rtl/ustring.hxx> +#include <rtl/ref.hxx> namespace com::sun::star::beans { struct PropertyValue; } namespace com::sun::star::chart2 { class XChartDocument; } @@ -34,14 +35,14 @@ namespace com::sun::star { namespace chart { - +class ChartModel; class RangeSelectionListenerParent; class RangeSelectionHelper { public: explicit RangeSelectionHelper( - const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument ); + const rtl::Reference<::chart::ChartModel> & xChartDocument ); ~RangeSelectionHelper(); bool hasRangeSelection(); @@ -59,8 +60,7 @@ private: css::uno::Reference< css::sheet::XRangeSelection > m_xRangeSelection; - css::uno::Reference< css::chart2::XChartDocument > - m_xChartDocument; + rtl::Reference<::chart::ChartModel> m_xChartDocument; css::uno::Reference< css::sheet::XRangeSelectionListener > m_xRangeSelectionListener; diff --git a/chart2/source/controller/inc/RangeSelectionListener.hxx b/chart2/source/controller/inc/RangeSelectionListener.hxx index c135f54feece..29bea261c820 100644 --- a/chart2/source/controller/inc/RangeSelectionListener.hxx +++ b/chart2/source/controller/inc/RangeSelectionListener.hxx @@ -21,6 +21,7 @@ #include <ControllerLockGuard.hxx> #include <cppuhelper/implbase.hxx> #include <com/sun/star/sheet/XRangeSelectionListener.hpp> +#include <rtl/ref.hxx> namespace com::sun::star::frame { @@ -29,6 +30,8 @@ class XModel; namespace chart { +class ChartModel; + class RangeSelectionListenerParent { public: @@ -45,7 +48,7 @@ class RangeSelectionListener final public: explicit RangeSelectionListener( RangeSelectionListenerParent& rParent, const OUString& rInitialRange, - const css::uno::Reference<css::frame::XModel>& xModelToLockController); + const rtl::Reference<::chart::ChartModel>& xModelToLockController); virtual ~RangeSelectionListener() override; protected: diff --git a/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx b/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx index f8e899df1d19..4952e112db88 100644 --- a/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx +++ b/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx @@ -21,6 +21,7 @@ #include <com/sun/star/uno/Reference.h> #include <vcl/timer.hxx> +#include <rtl/ref.hxx> #include <memory> @@ -35,16 +36,18 @@ class ControllerLockGuardUNO; namespace chart { +class ChartModel; + class TimerTriggeredControllerLock final { public: - TimerTriggeredControllerLock(const css::uno::Reference<css::frame::XModel>& xModel); + TimerTriggeredControllerLock(const rtl::Reference<::chart::ChartModel>& xModel); ~TimerTriggeredControllerLock(); void startTimer(); private: - css::uno::Reference<css::frame::XModel> m_xModel; + rtl::Reference<::chart::ChartModel> m_xModel; std::unique_ptr<ControllerLockGuardUNO> m_apControllerLockGuard; AutoTimer m_aTimer; diff --git a/chart2/source/controller/inc/TitleDialogData.hxx b/chart2/source/controller/inc/TitleDialogData.hxx index c69205169699..5f398f34a1f0 100644 --- a/chart2/source/controller/inc/TitleDialogData.hxx +++ b/chart2/source/controller/inc/TitleDialogData.hxx @@ -21,12 +21,14 @@ #include <ReferenceSizeProvider.hxx> #include <memory> #include <com/sun/star/uno/Sequence.hxx> +#include <rtl/ref.hxx> namespace com::sun::star::frame { class XModel; } namespace com::sun::star::uno { class XComponentContext; } namespace chart { +class ChartModel; struct TitleDialogData { @@ -37,11 +39,11 @@ struct TitleDialogData TitleDialogData(std::unique_ptr<ReferenceSizeProvider> pReferenzeSizeProvider = nullptr); - void readFromModel( const css::uno::Reference< css::frame::XModel >& xChartModel ); + void readFromModel( const rtl::Reference<::chart::ChartModel>& xChartModel ); /* return true if anything has changed; when pOldState is NULL then all data are written to the model */ - bool writeDifferenceToModel( const css::uno::Reference< css::frame::XModel >& xChartModel + bool writeDifferenceToModel( const rtl::Reference<::chart::ChartModel>& xChartModel , const css::uno::Reference< css::uno::XComponentContext >& xContext , TitleDialogData* pOldState=nullptr ); }; diff --git a/chart2/source/controller/inc/dlg_ChartType.hxx b/chart2/source/controller/inc/dlg_ChartType.hxx index e629bc84a3f3..7520869e86c4 100644 --- a/chart2/source/controller/inc/dlg_ChartType.hxx +++ b/chart2/source/controller/inc/dlg_ChartType.hxx @@ -19,6 +19,7 @@ #pragma once #include <vcl/weld.hxx> +#include <rtl/ref.hxx> namespace com::sun::star::frame { @@ -27,16 +28,17 @@ class XModel; namespace chart { +class ChartModel; class ChartTypeTabPage; + class ChartTypeDialog final : public weld::GenericDialogController { public: - ChartTypeDialog(weld::Window* pWindow, - const css::uno::Reference<css::frame::XModel>& xChartModel); + ChartTypeDialog(weld::Window* pWindow, const rtl::Reference<::chart::ChartModel>& xChartModel); virtual ~ChartTypeDialog() override; private: - css::uno::Reference<css::frame::XModel> m_xChartModel; + rtl::Reference<::chart::ChartModel> m_xChartModel; std::unique_ptr<weld::Container> m_xContentArea; std::unique_ptr<ChartTypeTabPage> m_xChartTypeTabPage; }; diff --git a/chart2/source/controller/inc/dlg_CreationWizard.hxx b/chart2/source/controller/inc/dlg_CreationWizard.hxx index 6a8a78177b26..a0fcc9dae6f9 100644 --- a/chart2/source/controller/inc/dlg_CreationWizard.hxx +++ b/chart2/source/controller/inc/dlg_CreationWizard.hxx @@ -22,6 +22,7 @@ #include "TimerTriggeredControllerLock.hxx" #include "TabPageNotifiable.hxx" +#include <rtl/ref.hxx> #include <vcl/roadmapwizard.hxx> #include <memory> @@ -40,14 +41,14 @@ using vcl::WizardTypes::CommitPageReason; namespace chart { -class DialogModel; +class ChartModel; class ChartTypeTemplateProvider; +class DialogModel; class CreationWizard final : public vcl::RoadmapWizardMachine, public TabPageNotifiable { public: - CreationWizard(weld::Window* pParent, - const css::uno::Reference<css::frame::XModel>& xChartModel, + CreationWizard(weld::Window* pParent, const rtl::Reference<::chart::ChartModel>& xChartModel, const css::uno::Reference<css::uno::XComponentContext>& xContext); CreationWizard() = delete; @@ -67,7 +68,7 @@ protected: private: virtual std::unique_ptr<BuilderPage> createPage(WizardState nState) override; - css::uno::Reference<css::chart2::XChartDocument> m_xChartModel; + rtl::Reference<::chart::ChartModel> m_xChartModel; css::uno::Reference<css::uno::XComponentContext> m_xComponentContext; ChartTypeTemplateProvider* m_pTemplateProvider; std::unique_ptr<DialogModel> m_pDialogModel; diff --git a/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx b/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx index f9a75cb19c85..7e1792f087f1 100644 --- a/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx +++ b/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx @@ -27,6 +27,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> +#include <rtl/ref.hxx> #include "dlg_CreationWizard.hxx" #include <tools/link.hxx> @@ -39,6 +40,7 @@ class VclWindowEvent; namespace chart { +class ChartModel; class CreationWizardUnoDlg final : public cppu::BaseMutex , public ::cppu::OComponentHelper @@ -101,7 +103,7 @@ private: DECL_STATIC_LINK(CreationWizardUnoDlg, InstallLOKNotifierHdl, void*, vcl::ILibreOfficeKitNotifier*); private: - css::uno::Reference< css::frame::XModel > m_xChartModel; + rtl::Reference< ::chart::ChartModel > m_xChartModel; css::uno::Reference< css::uno::XComponentContext> m_xCC; css::uno::Reference< css::awt::XWindow > m_xParentWindow; diff --git a/chart2/source/controller/inc/dlg_DataEditor.hxx b/chart2/source/controller/inc/dlg_DataEditor.hxx index 2843973be352..83070d886b60 100644 --- a/chart2/source/controller/inc/dlg_DataEditor.hxx +++ b/chart2/source/controller/inc/dlg_DataEditor.hxx @@ -20,6 +20,7 @@ #pragma once #include <vcl/weld.hxx> +#include <rtl/ref.hxx> namespace com::sun::star::uno { class XComponentContext; } namespace comphelper { template <class Tp, class Arg> class mem_fun1_t; } @@ -33,13 +34,14 @@ namespace com::sun::star { namespace chart { +class ChartModel; class DataBrowser; class DataEditor final : public weld::GenericDialogController { public: DataEditor(weld::Window* pParent, - const css::uno::Reference<css::chart2::XChartDocument> & xChartDoc, + const rtl::Reference<::chart::ChartModel> & xChartDoc, const css::uno::Reference<css::uno::XComponentContext> & xContext); virtual ~DataEditor() override; @@ -50,7 +52,7 @@ public: private: bool m_bReadOnly; - css::uno::Reference<css::chart2::XChartDocument> m_xChartDoc; + rtl::Reference<::chart::ChartModel> m_xChartDoc; css::uno::Reference<css::uno::XComponentContext> m_xContext; std::unique_ptr<weld::Toolbar> m_xTbxData; diff --git a/chart2/source/controller/inc/dlg_DataSource.hxx b/chart2/source/controller/inc/dlg_DataSource.hxx index b1607bc0ccd6..97eb659c7052 100644 --- a/chart2/source/controller/inc/dlg_DataSource.hxx +++ b/chart2/source/controller/inc/dlg_DataSource.hxx @@ -28,11 +28,11 @@ class BuilderPage; namespace chart { - -class RangeChooserTabPage; -class DataSourceTabPage; +class ChartModel; class ChartTypeTemplateProvider; +class DataSourceTabPage; class DialogModel; +class RangeChooserTabPage; class DataSourceDialog final : public weld::GenericDialogController, @@ -41,7 +41,7 @@ class DataSourceDialog final : public: explicit DataSourceDialog( weld::Window * pParent, - const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument, + const rtl::Reference<::chart::ChartModel> & xChartDocument, const css::uno::Reference< css::uno::XComponentContext > & xContext ); virtual ~DataSourceDialog() override; diff --git a/chart2/source/controller/inc/dlg_InsertErrorBars.hxx b/chart2/source/controller/inc/dlg_InsertErrorBars.hxx index c6c730bff8cd..e68036153c10 100644 --- a/chart2/source/controller/inc/dlg_InsertErrorBars.hxx +++ b/chart2/source/controller/inc/dlg_InsertErrorBars.hxx @@ -35,13 +35,13 @@ class InsertErrorBarsDialog final : public weld::GenericDialogController { public: InsertErrorBarsDialog(weld::Window* pParent, const SfxItemSet& rMyAttrs, - const css::uno::Reference<css::chart2::XChartDocument>& xChartDocument, + const rtl::Reference<::chart::ChartModel>& xChartDocument, ErrorBarResources::tErrorBarType eType); void SetAxisMinorStepWidthForErrorBarDecimals(double fMinorStepWidth); static double getAxisMinorStepWidthForErrorBarDecimals( - const css::uno::Reference<css::frame::XModel>& xChartModel, + const rtl::Reference<::chart::ChartModel>& xChartModel, const css::uno::Reference<css::uno::XInterface>& xChartView, const OUString& rSelectedObjectCID); diff --git a/chart2/source/controller/inc/dlg_InsertLegend.hxx b/chart2/source/controller/inc/dlg_InsertLegend.hxx index 41b2e7c8a689..0e2cccc3809a 100644 --- a/chart2/source/controller/inc/dlg_InsertLegend.hxx +++ b/chart2/source/controller/inc/dlg_InsertLegend.hxx @@ -19,6 +19,7 @@ #pragma once #include <vcl/weld.hxx> +#include <rtl/ref.hxx> #include <memory> @@ -29,6 +30,7 @@ namespace com::sun::star::uno { class XComponentContext; } namespace chart { +class ChartModel; class SchLegendDlg final : public weld::GenericDialogController { @@ -38,8 +40,8 @@ private: public: SchLegendDlg(weld::Window* pParent, const css::uno::Reference< css::uno::XComponentContext>& xCC); - void init( const css::uno::Reference< css::frame::XModel >& xChartModel ); - void writeToModel( const css::uno::Reference< css::frame::XModel >& xChartModel ) const; + void init( const rtl::Reference<::chart::ChartModel>& xChartModel ); + void writeToModel( const rtl::Reference<::chart::ChartModel>& xChartModel ) const; }; } //namespace chart diff --git a/chart2/source/controller/inc/dlg_ObjectProperties.hxx b/chart2/source/controller/inc/dlg_ObjectProperties.hxx index 33581fdce609..238ccc83b42f 100644 --- a/chart2/source/controller/inc/dlg_ObjectProperties.hxx +++ b/chart2/source/controller/inc/dlg_ObjectProperties.hxx @@ -33,7 +33,7 @@ public: ObjectPropertiesDialogParameter( const OUString& rObjectCID ); ~ObjectPropertiesDialogParameter(); - void init( const css::uno::Reference< css::frame::XModel >& xModel ); + void init( const rtl::Reference<::chart::ChartModel>& xModel ); ObjectType getObjectType() const { return m_eObjectType;} const OUString& getLocalizedName() const { return m_aLocalizedName;} @@ -57,7 +57,7 @@ public: bool IsSupportingCategoryPositioning() const { return m_bSupportingCategoryPositioning;} const css::uno::Sequence< OUString >& GetCategories() const { return m_aCategories;} - const css::uno::Reference< css::chart2::XChartDocument >& + const rtl::Reference<::chart::ChartModel>& getDocument() const { return m_xChartDocument;} bool IsComplexCategoriesAxis() const { return m_bComplexCategoriesAxis;} @@ -92,7 +92,7 @@ private: bool m_bSupportingCategoryPositioning; css::uno::Sequence< OUString > m_aCategories; - css::uno::Reference< css::chart2::XChartDocument > m_xChartDocument; + rtl::Reference<::chart::ChartModel> m_xChartDocument; bool m_bComplexCategoriesAxis; diff --git a/chart2/source/controller/inc/dlg_View3D.hxx b/chart2/source/controller/inc/dlg_View3D.hxx index cddfcf51b4ab..c165e828535e 100644 --- a/chart2/source/controller/inc/dlg_View3D.hxx +++ b/chart2/source/controller/inc/dlg_View3D.hxx @@ -35,7 +35,7 @@ class ThreeD_SceneIllumination_TabPage; class View3DDialog final : public weld::GenericDialogController { public: - View3DDialog(weld::Window* pWindow, const css::uno::Reference<css::frame::XModel>& xChartModel); + View3DDialog(weld::Window* pWindow, const rtl::Reference<::chart::ChartModel>& xChartModel); virtual ~View3DDialog() override; virtual short run() override; diff --git a/chart2/source/controller/inc/res_ErrorBar.hxx b/chart2/source/controller/inc/res_ErrorBar.hxx index de03ce18f131..c3521d5ba087 100644 --- a/chart2/source/controller/inc/res_ErrorBar.hxx +++ b/chart2/source/controller/inc/res_ErrorBar.hxx @@ -23,6 +23,7 @@ #include <svl/itemset.hxx> #include <svx/chrtitem.hxx> #include "RangeSelectionListener.hxx" +#include <rtl/ref.hxx> namespace com::sun::star::chart2 { class XChartDocument; } namespace weld { class Builder; } @@ -41,7 +42,7 @@ namespace weld { class Widget; } namespace chart { - +class ChartModel; class RangeSelectionHelper; class ErrorBarResources final : public RangeSelectionListenerParent @@ -60,7 +61,7 @@ public: void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ); void SetErrorBarType( tErrorBarType eNewType ); void SetChartDocumentForRangeChoosing( - const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument ); + const rtl::Reference<::chart::ChartModel> & xChartDocument ); void Reset(const SfxItemSet& rInAttrs); void FillItemSet(SfxItemSet& rOutAttrs) const; diff --git a/chart2/source/controller/inc/res_LegendPosition.hxx b/chart2/source/controller/inc/res_LegendPosition.hxx index 87b96ab558fc..d34c28cdd79c 100644 --- a/chart2/source/controller/inc/res_LegendPosition.hxx +++ b/chart2/source/controller/inc/res_LegendPosition.hxx @@ -20,6 +20,7 @@ #include <svl/itemset.hxx> #include <tools/link.hxx> +#include <rtl/ref.hxx> namespace com::sun::star::frame { class XModel; } namespace com::sun::star::uno { class XComponentContext; } @@ -30,6 +31,7 @@ namespace weld { class Toggleable; } namespace chart { +class ChartModel; class LegendPositionResources final { @@ -42,8 +44,8 @@ public: css::uno::XComponentContext>& xCC ); ~LegendPositionResources(); - void writeToResources( const css::uno::Reference< css::frame::XModel >& xChartModel ); - void writeToModel( const css::uno::Reference< css::frame::XModel >& xChartModel ) const; + void writeToResources( const rtl::Reference<::chart::ChartModel>& xChartModel ); + void writeToModel( const rtl::Reference<::chart::ChartModel>& xChartModel ) const; void initFromItemSet( const SfxItemSet& rInAttrs ); void writeToItemSet( SfxItemSet& rOutAttrs ) const; diff --git a/chart2/source/controller/sidebar/ChartTypePanel.cxx b/chart2/source/controller/sidebar/ChartTypePanel.cxx index 7309c17f5a21..18d5c4110e45 100644 --- a/chart2/source/controller/sidebar/ChartTypePanel.cxx +++ b/chart2/source/controller/sidebar/ChartTypePanel.cxx @@ -22,6 +22,7 @@ #include <ChartController.hxx> #include <ChartModelHelper.hxx> +#include <ChartModel.hxx> #include <ChartResourceGroups.hxx> #include <ChartTypeDialogController.hxx> #include <ChartTypeManager.hxx> @@ -53,7 +54,7 @@ ChartTypePanel::ChartTypePanel(weld::Widget* pParent, ::chart::ChartController* new SplineResourceGroup(m_xBuilder.get(), pController->GetChartFrame())) , m_pGeometryResourceGroup(new GeometryResourceGroup(m_xBuilder.get())) , m_pSortByXValuesResourceGroup(new SortByXValuesResourceGroup(m_xBuilder.get())) - , m_xChartModel(mxModel, css::uno::UNO_QUERY_THROW) + , m_xChartModel(dynamic_cast<ChartModel*>(mxModel.get())) , m_aChartTypeDialogControllerList(0) , m_pCurrentMainType(nullptr) , m_nChangingCalls(0) @@ -75,7 +76,8 @@ ChartTypePanel::ChartTypePanel(weld::Widget* pParent, ::chart::ChartController* m_xSubTypeList->SetLineCount(1); bool bEnableComplexChartTypes = true; - uno::Reference<beans::XPropertySet> xProps(m_xChartModel, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xProps(static_cast<cppu::OWeakObject*>(m_xChartModel.get()), + uno::UNO_QUERY); if (xProps.is()) { try diff --git a/chart2/source/controller/sidebar/ChartTypePanel.hxx b/chart2/source/controller/sidebar/ChartTypePanel.hxx index c5e1df11dab8..f3062fb2f50f 100644 --- a/chart2/source/controller/sidebar/ChartTypePanel.hxx +++ b/chart2/source/controller/sidebar/ChartTypePanel.hxx @@ -103,7 +103,7 @@ private: std::unique_ptr<GeometryResourceGroup> m_pGeometryResourceGroup; std::unique_ptr<SortByXValuesResourceGroup> m_pSortByXValuesResourceGroup; - css::uno::Reference<css::chart2::XChartDocument> m_xChartModel; + rtl::Reference<::chart::ChartModel> m_xChartModel; std::vector<std::unique_ptr<ChartTypeDialogController>> m_aChartTypeDialogControllerList; ChartTypeDialogController* m_pCurrentMainType; |