summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-01-24 15:58:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-01-24 17:43:25 +0100
commit4fbec819fc041cddcd64621acdd29bd35f4dd493 (patch)
tree5919cf487519d55231f5f002d6ec7e5cff583b2e /chart2/source
parent54930a004e42f76f310c7ae15f61d07fbb7c7bdb (diff)
use more concrete types in chart2, ChartModel
Change-Id: I86b7fa98a6d4a269637ac042a9bb99b41ab90b0c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128870 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx6
-rw-r--r--chart2/source/inc/ChartModelHelper.hxx30
-rw-r--r--chart2/source/inc/DataSourceHelper.hxx14
-rw-r--r--chart2/source/inc/DiagramHelper.hxx8
-rw-r--r--chart2/source/inc/ObjectIdentifier.hxx32
-rw-r--r--chart2/source/inc/TitleHelper.hxx1
-rw-r--r--chart2/source/inc/chartview/ExplicitValueProvider.hxx6
-rw-r--r--chart2/source/model/main/ChartModel.cxx6
-rw-r--r--chart2/source/tools/AxisHelper.cxx2
-rw-r--r--chart2/source/tools/ChartModelHelper.cxx94
-rw-r--r--chart2/source/tools/DataSourceHelper.cxx65
-rw-r--r--chart2/source/tools/DiagramHelper.cxx22
-rw-r--r--chart2/source/tools/ExplicitCategoriesProvider.cxx6
-rw-r--r--chart2/source/tools/InternalDataProvider.cxx11
-rw-r--r--chart2/source/tools/ObjectIdentifier.cxx161
-rw-r--r--chart2/source/tools/RangeHighlighter.cxx1
-rw-r--r--chart2/source/tools/TitleHelper.cxx10
-rw-r--r--chart2/source/view/main/ChartView.cxx11
18 files changed, 101 insertions, 385 deletions
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
index fa12304263f6..ea2b0413afd4 100644
--- a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
@@ -230,7 +230,7 @@ awt::Size Chart2ModelContact::GetLegendSize() const
if( pProvider )
{
uno::Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( *m_xChartModel.get() ) );
- OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, m_xChartModel.get() ) );
+ OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, m_xChartModel ) );
aSize = ToSize( pProvider->getRectangleOfObject( aCID ) );
}
return aSize;
@@ -243,7 +243,7 @@ awt::Point Chart2ModelContact::GetLegendPosition() const
if( pProvider )
{
uno::Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( *m_xChartModel.get() ) );
- OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, m_xChartModel.get() ) );
+ OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, m_xChartModel ) );
aPoint = ToPoint( pProvider->getRectangleOfObject( aCID ) );
}
return aPoint;
@@ -255,7 +255,7 @@ awt::Size Chart2ModelContact::GetTitleSize( const uno::Reference< css::chart2::X
ExplicitValueProvider* pProvider( getExplicitValueProvider() );
if( pProvider && xTitle.is() )
{
- OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, m_xChartModel.get() ) );
+ OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, m_xChartModel ) );
aSize = ToSize( pProvider->getRectangleOfObject( aCID ) );
}
return aSize;
diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx
index 4cacdc0234e0..e83fe0365a88 100644
--- a/chart2/source/inc/ChartModelHelper.hxx
+++ b/chart2/source/inc/ChartModelHelper.hxx
@@ -49,45 +49,29 @@ public:
const rtl::Reference< ::chart::ChartModel >& xSelectionSupplier );
static rtl::Reference< InternalDataProvider > createInternalDataProvider(
- const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc, bool bConnectToModel );
+ const rtl::Reference<::chart::ChartModel>& xChartDoc, bool bConnectToModel );
static rtl::Reference< Diagram >
- findDiagram( const css::uno::Reference< css::frame::XModel >& xModel );
-
- static rtl::Reference< Diagram >
- findDiagram( const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc );
-
- static rtl::Reference< Diagram >
- findDiagram( const rtl::Reference<::chart::ChartModel>& xChartDoc );
+ findDiagram( const rtl::Reference< ::chart::ChartModel >& xModel );
static rtl::Reference< ::chart::BaseCoordinateSystem >
- getFirstCoordinateSystem( ChartModel& rModel );
+ getFirstCoordinateSystem( const rtl::Reference<::chart::ChartModel>& xModel );
- static rtl::Reference< ::chart::BaseCoordinateSystem >
- getFirstCoordinateSystem( const css::uno::Reference< css::frame::XModel >& xModel );
-
- SAL_DLLPRIVATE static std::vector< css::uno::Reference< css::chart2::XDataSeries > >
- getDataSeries( ChartModel& rModel );
-
- SAL_DLLPRIVATE static std::vector< css::uno::Reference< css::chart2::XDataSeries > >
- getDataSeries( const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc );
- static std::vector< css::uno::Reference< css::chart2::XDataSeries > >
- getDataSeries( const css::uno::Reference< css::frame::XModel > & xModel );
static std::vector< css::uno::Reference< css::chart2::XDataSeries > >
getDataSeries( const rtl::Reference< ::chart::ChartModel > & xModel );
static rtl::Reference< ChartType >
getChartTypeOfSeries(
- const css::uno::Reference< css::frame::XModel >& xModel
+ const rtl::Reference<::chart::ChartModel>& xModel
, const css::uno::Reference< css::chart2::XDataSeries >& xGivenDataSeries );
static css::awt::Size getDefaultPageSize();
- static css::awt::Size getPageSize( const css::uno::Reference< css::frame::XModel >& xModel );
+ static css::awt::Size getPageSize( const rtl::Reference<::chart::ChartModel>& xModel );
- static void triggerRangeHighlighting( const css::uno::Reference< css::frame::XModel >& xModel );
+ static void triggerRangeHighlighting( const rtl::Reference<::chart::ChartModel>& xModel );
- static bool isIncludeHiddenCells( const css::uno::Reference< css::frame::XModel >& xChartModel );
+ static bool isIncludeHiddenCells( const rtl::Reference<::chart::ChartModel>& xChartModel );
static bool setIncludeHiddenCells( bool bIncludeHiddenCells, ChartModel& rModel);
diff --git a/chart2/source/inc/DataSourceHelper.hxx b/chart2/source/inc/DataSourceHelper.hxx
index 2c866091b21a..950f66e54927 100644
--- a/chart2/source/inc/DataSourceHelper.hxx
+++ b/chart2/source/inc/DataSourceHelper.hxx
@@ -22,6 +22,7 @@
#include "charttoolsdllapi.hxx"
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
+#include <rtl/ref.hxx>
namespace chart { class ChartModel; }
namespace com::sun::star::beans { struct PropertyValue; }
@@ -81,19 +82,16 @@ public:
const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
static css::uno::Sequence< OUString > getUsedDataRanges(
- const css::uno::Reference< css::frame::XModel > & xChartModel );
+ const rtl::Reference<::chart::ChartModel> & xChartModel );
static css::uno::Reference< css::chart2::data::XDataSource > getUsedData(
ChartModel& rModel );
static css::uno::Reference< css::chart2::data::XDataSource > getUsedData(
- const css::uno::Reference< css::frame::XModel >& xChartModel );
-
- static css::uno::Reference< css::chart2::data::XDataSource > getUsedData(
- const css::uno::Reference<css::chart2::XChartDocument >& xChartDoc );
+ const rtl::Reference<::chart::ChartModel>& xChartModel );
static bool detectRangeSegmentation(
- const css::uno::Reference< css::frame::XModel >& xChartModel
+ const rtl::Reference<::chart::ChartModel>& xChartModel
, OUString& rOutRangeString
, css::uno::Sequence< sal_Int32 >& rSequenceMapping
, bool& rOutUseColumns
@@ -101,7 +99,7 @@ public:
, bool& rOutHasCategories );
static void setRangeSegmentation(
- const css::uno::Reference< css::frame::XModel >& xChartModel
+ const rtl::Reference<::chart::ChartModel>& xChartModel
, const css::uno::Sequence< sal_Int32 >& rSequenceMapping
, bool bUseColumns
, bool bFirstCellAsLabel
@@ -115,7 +113,7 @@ public:
HasCategories and FirstCellAsLabel.
*/
static bool allArgumentsForRectRangeDetected(
- const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument );
+ const rtl::Reference<::chart::ChartModel>& xChartDocument );
SAL_DLLPRIVATE static css::uno::Sequence< OUString > getRangesFromLabeledDataSequence(
const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xLSeq );
diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx
index 0877668da13c..3d0931d17f87 100644
--- a/chart2/source/inc/DiagramHelper.hxx
+++ b/chart2/source/inc/DiagramHelper.hxx
@@ -197,10 +197,10 @@ public:
const css::uno::Reference< css::chart2::XCoordinateSystem > & xCooSys );
static void switchToDateCategories(
- const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc );
+ const rtl::Reference<::chart::ChartModel> & xChartDoc );
static void switchToTextCategories(
- const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc );
+ const rtl::Reference<::chart::ChartModel> & xChartDoc );
static bool isSupportingDateAxis( const css::uno::Reference< css::chart2::XDiagram >& xDiagram );
static bool isDateNumberFormat( sal_Int32 nNumberFormat, const css::uno::Reference< css::util::XNumberFormats >& xNumberFormats );
@@ -280,10 +280,10 @@ public:
static DiagramPositioningMode getDiagramPositioningMode( const css::uno::Reference< css::chart2::XDiagram > & xDiagram );
- static bool setDiagramPositioning( const css::uno::Reference< css::frame::XModel >& xChartModel,
+ static bool setDiagramPositioning( const rtl::Reference<::chart::ChartModel>& xChartModel,
const css::awt::Rectangle& rPosRect /*100th mm*/ );
- static css::awt::Rectangle getDiagramRectangleFromModel( const css::uno::Reference< css::frame::XModel >& xChartModel );
+ static css::awt::Rectangle getDiagramRectangleFromModel( const rtl::Reference<::chart::ChartModel>& xChartModel );
static bool switchDiagramPositioningToExcludingPositioning( ChartModel& rModel
, bool bResetModifiedState //set model back to unchanged if it was unchanged before
diff --git a/chart2/source/inc/ObjectIdentifier.hxx b/chart2/source/inc/ObjectIdentifier.hxx
index e429e3eb2105..f4ba59a2191c 100644
--- a/chart2/source/inc/ObjectIdentifier.hxx
+++ b/chart2/source/inc/ObjectIdentifier.hxx
@@ -105,11 +105,7 @@ public:
static OUString createClassifiedIdentifierForObject(
const css::uno::Reference< css::uno::XInterface >& xObject
- , ChartModel& rModel);
-
- static OUString createClassifiedIdentifierForObject(
- const css::uno::Reference< css::uno::XInterface >& xObject
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
static OUString createClassifiedIdentifierForParticle(
const OUString& rParticle );
@@ -122,18 +118,14 @@ public:
static OUString createClassifiedIdentifierForGrid(
const css::uno::Reference< css::chart2::XAxis >& xAxis
- , const css::uno::Reference< css::frame::XModel >& xChartModel
+ , const rtl::Reference<::chart::ChartModel>& xChartModel
, sal_Int32 nSubIndex = -1 );//-1: main grid, 0: first subgrid etc
SAL_DLLPRIVATE static OUString createParticleForDiagram();
static OUString createParticleForCoordinateSystem(
const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
- , ChartModel& rModel );
-
- static OUString createParticleForCoordinateSystem(
- const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
static OUString createParticleForAxis(
sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
@@ -144,10 +136,8 @@ public:
static OUString createParticleForSeries( sal_Int32 nDiagramIndex, sal_Int32 nCooSysIndex
, sal_Int32 nChartTypeIndex, sal_Int32 nSeriesIndex );
- static OUString createParticleForLegend( ChartModel& rModel );
-
static OUString createParticleForLegend(
- const css::uno::Reference< css::frame::XModel >& xChartModel );
+ const rtl::Reference<::chart::ChartModel>& xChartModel );
static OUString addChildParticle( std::u16string_view rParticle, std::u16string_view rChildParticle );
static OUString createChildParticleWithIndex( ObjectType eObjectType, sal_Int32 nIndex );
@@ -199,32 +189,24 @@ public:
static css::uno::Reference< css::beans::XPropertySet >
getObjectPropertySet(
const OUString& rObjectCID
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
- static css::uno::Reference< css::beans::XPropertySet >
- getObjectPropertySet(
- const OUString& rObjectCID
- , const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument );
- static css::uno::Reference< css::beans::XPropertySet >
- getObjectPropertySet(
- const OUString& rObjectCID
, const rtl::Reference< ::chart::ChartModel >& xChartDocument );
//return the axis object that belongs to rObjectCID if any
static css::uno::Reference< css::chart2::XAxis >
getAxisForCID(
const OUString& rObjectCID
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
//return the series object that belongs to rObjectCID if any
static css::uno::Reference< css::chart2::XDataSeries >
getDataSeriesForCID(
const OUString& rObjectCID
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
static rtl::Reference< ::chart::Diagram >
getDiagramForCID(
const OUString& rObjectCID
- , const css::uno::Reference< css::frame::XModel >& xChartModel );
+ , const rtl::Reference<::chart::ChartModel>& xChartModel );
static const OUString& getPieSegmentDragMethodServiceName();
static OUString createPieSegmentDragParameterString(
diff --git a/chart2/source/inc/TitleHelper.hxx b/chart2/source/inc/TitleHelper.hxx
index f6978674be0a..59696bfce54d 100644
--- a/chart2/source/inc/TitleHelper.hxx
+++ b/chart2/source/inc/TitleHelper.hxx
@@ -22,6 +22,7 @@
#include <rtl/ref.hxx>
#include <rtl/ustring.hxx>
#include "charttoolsdllapi.hxx"
+#include <rtl/ref.hxx>
namespace chart { class ChartModel; }
namespace chart { class ReferenceSizeProvider; }
diff --git a/chart2/source/inc/chartview/ExplicitValueProvider.hxx b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
index a84b2e30813b..174f060161ba 100644
--- a/chart2/source/inc/chartview/ExplicitValueProvider.hxx
+++ b/chart2/source/inc/chartview/ExplicitValueProvider.hxx
@@ -79,11 +79,7 @@ public:
static sal_Int32 getExplicitNumberFormatKeyForAxis(
const css::uno::Reference< css::chart2::XAxis >& xAxis
, const css::uno::Reference< css::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
- , const css::uno::Reference< css::chart2::XChartDocument>& xChartDoc);
- static sal_Int32 getExplicitNumberFormatKeyForAxis(
- const css::uno::Reference< css::chart2::XAxis >& xAxis
- , const css::uno::Reference< css::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
- , const rtl::Reference< ::chart::ChartModel>& xChartDoc);
+ , const rtl::Reference<::chart::ChartModel>& xChartDoc);
static sal_Int32 getExplicitNumberFormatKeyForDataLabel(
const css::uno::Reference< css::beans::XPropertySet >& xSeriesOrPointProp );
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index afc61decaa78..d017bac24398 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -502,7 +502,7 @@ uno::Reference< uno::XInterface > SAL_CALL ChartModel::getCurrentSelection()
uno::Any aSel = xSelectionSupl->getSelection();
OUString aObjectCID;
if( aSel >>= aObjectCID )
- xReturn.set( ObjectIdentifier::getObjectPropertySet( aObjectCID, Reference< XChartDocument >(this)));
+ xReturn.set( ObjectIdentifier::getObjectPropertySet( aObjectCID, this));
}
}
return xReturn;
@@ -723,7 +723,7 @@ void SAL_CALL ChartModel::createInternalDataProvider( sal_Bool bCloneExistingDat
if( bCloneExistingData )
m_xInternalDataProvider = ChartModelHelper::createInternalDataProvider( this, true );
else
- m_xInternalDataProvider = ChartModelHelper::createInternalDataProvider( Reference<XChartDocument>(), true );
+ m_xInternalDataProvider = ChartModelHelper::createInternalDataProvider( nullptr, true );
m_xDataProvider.set( m_xInternalDataProvider );
}
setModified( true );
@@ -772,7 +772,7 @@ void SAL_CALL ChartModel::attachDataProvider( const uno::Reference< chart2::data
{
try
{
- bool bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( Reference< frame::XModel >(this) );
+ bool bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( this );
xProp->setPropertyValue("IncludeHiddenCells", uno::Any(bIncludeHiddenCells));
}
catch (const beans::UnknownPropertyException&)
diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx
index 3dbbffbe1544..49cdeec144dd 100644
--- a/chart2/source/tools/AxisHelper.cxx
+++ b/chart2/source/tools/AxisHelper.cxx
@@ -101,7 +101,7 @@ bool AxisHelper::isLogarithmic( const Reference< XScaling >& xScaling )
chart2::ScaleData AxisHelper::getDateCheckedScale( const Reference< chart2::XAxis >& xAxis, ChartModel& rModel )
{
ScaleData aScale = xAxis->getScaleData();
- Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( rModel ) );
+ Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( &rModel ) );
if( aScale.AutoDateAxis && aScale.AxisType == AxisType::CATEGORY )
{
sal_Int32 nDimensionIndex=0; sal_Int32 nAxisIndex=0;
diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx
index 4f9e457d56d2..697c99744a0d 100644
--- a/chart2/source/tools/ChartModelHelper.cxx
+++ b/chart2/source/tools/ChartModelHelper.cxx
@@ -50,7 +50,7 @@ uno::Reference< chart2::data::XRangeHighlighter > ChartModelHelper::createRangeH
}
rtl::Reference< InternalDataProvider > ChartModelHelper::createInternalDataProvider(
- const uno::Reference< css::chart2::XChartDocument >& xChartDoc, bool bConnectToModel )
+ const rtl::Reference<::chart::ChartModel>& xChartDoc, bool bConnectToModel )
{
bool bDefaultDataInColumns(true);
@@ -58,7 +58,8 @@ rtl::Reference< InternalDataProvider > ChartModelHelper::createInternalDataProvi
// chart data and use it as default for creating a new InternalDataProvider
if(xChartDoc.is())
{
- css::uno::Reference< css::chart::XChartDocument > xDoc(xChartDoc, uno::UNO_QUERY);
+ // old XChartDocument interface
+ css::uno::Reference< css::chart::XChartDocument > xDoc(static_cast<cppu::OWeakObject*>(xChartDoc.get()), uno::UNO_QUERY);
if(xDoc.is())
{
@@ -83,24 +84,13 @@ rtl::Reference< InternalDataProvider > ChartModelHelper::createInternalDataProvi
return new InternalDataProvider( xChartDoc, bConnectToModel, bDefaultDataInColumns );
}
-rtl::Reference< Diagram > ChartModelHelper::findDiagram( const uno::Reference< frame::XModel >& xModel )
-{
- uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
- if( xChartDoc.is())
- return ChartModelHelper::findDiagram( xChartDoc );
- return nullptr;
-}
-
-rtl::Reference< Diagram > ChartModelHelper::findDiagram( const uno::Reference< chart2::XChartDocument >& xChartDoc )
+rtl::Reference< Diagram > ChartModelHelper::findDiagram( const rtl::Reference<::chart::ChartModel>& xChartDoc )
{
try
{
if( !xChartDoc )
return nullptr;
- uno::Reference<chart2::XDiagram> xDiagram = xChartDoc->getFirstDiagram();
- ::chart::Diagram* pDiagram = dynamic_cast<::chart::Diagram*>(xDiagram.get());
- assert(!xDiagram || pDiagram);
- return pDiagram;
+ return xChartDoc->getFirstChartDiagram();
}
catch( const uno::Exception & )
{
@@ -109,27 +99,7 @@ rtl::Reference< Diagram > ChartModelHelper::findDiagram( const uno::Reference< c
return nullptr;
}
-rtl::Reference< Diagram > ChartModelHelper::findDiagram( const rtl::Reference< ::chart::ChartModel >& xChartDoc )
-{
- if( !xChartDoc )
- return nullptr;
- rtl::Reference<::chart::Diagram> xDiagram = xChartDoc->getFirstChartDiagram();
- return xDiagram;
-}
-
-rtl::Reference< BaseCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( ChartModel& rModel )
-{
- rtl::Reference< Diagram > xDiagram = rModel.getFirstChartDiagram();
- if( xDiagram.is() )
- {
- auto& rCooSysSeq( xDiagram->getBaseCoordinateSystems() );
- if( !rCooSysSeq.empty() )
- return rCooSysSeq[0];
- }
- return nullptr;
-}
-
-rtl::Reference< BaseCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( const uno::Reference< frame::XModel >& xModel )
+rtl::Reference< BaseCoordinateSystem > ChartModelHelper::getFirstCoordinateSystem( const rtl::Reference<::chart::ChartModel>& xModel )
{
rtl::Reference< Diagram > xDiagram = ChartModelHelper::findDiagram( xModel );
if( xDiagram.is() )
@@ -142,19 +112,7 @@ rtl::Reference< BaseCoordinateSystem > ChartModelHelper::getFirstCoordinateSyste
}
std::vector< uno::Reference< XDataSeries > > ChartModelHelper::getDataSeries(
- ChartModel& rModel )
-{
- std::vector< uno::Reference< XDataSeries > > aResult;
-
- uno::Reference< XDiagram > xDiagram = rModel.getFirstDiagram();
- if( xDiagram.is())
- aResult = DiagramHelper::getDataSeriesFromDiagram( xDiagram );
-
- return aResult;
-}
-
-std::vector< uno::Reference< XDataSeries > > ChartModelHelper::getDataSeries(
- const uno::Reference< XChartDocument > & xChartDoc )
+ const rtl::Reference<::chart::ChartModel> & xChartDoc )
{
std::vector< uno::Reference< XDataSeries > > aResult;
@@ -165,26 +123,8 @@ std::vector< uno::Reference< XDataSeries > > ChartModelHelper::getDataSeries(
return aResult;
}
-std::vector< uno::Reference< XDataSeries > > ChartModelHelper::getDataSeries(
- const rtl::Reference< ::chart::ChartModel > & xChartDoc )
-{
- std::vector< uno::Reference< XDataSeries > > aResult;
-
- rtl::Reference< Diagram > xDiagram = ChartModelHelper::findDiagram( xChartDoc );
- if( xDiagram.is())
- aResult = DiagramHelper::getDataSeriesFromDiagram( xDiagram );
-
- return aResult;
-}
-
-std::vector< uno::Reference< XDataSeries > > ChartModelHelper::getDataSeries(
- const uno::Reference< frame::XModel > & xModel )
-{
- return getDataSeries( uno::Reference< chart2::XChartDocument >( xModel, uno::UNO_QUERY ));
-}
-
rtl::Reference< ChartType > ChartModelHelper::getChartTypeOfSeries(
- const uno::Reference< frame::XModel >& xModel
+ const rtl::Reference<::chart::ChartModel>& xModel
, const uno::Reference< XDataSeries >& xGivenDataSeries )
{
return DiagramHelper::getChartTypeOfSeries( ChartModelHelper::findDiagram( xModel ), xGivenDataSeries );
@@ -195,22 +135,20 @@ awt::Size ChartModelHelper::getDefaultPageSize()
return awt::Size( 16000, 9000 );
}
-awt::Size ChartModelHelper::getPageSize( const uno::Reference< frame::XModel >& xModel )
+awt::Size ChartModelHelper::getPageSize( const rtl::Reference<::chart::ChartModel>& xModel )
{
awt::Size aPageSize( ChartModelHelper::getDefaultPageSize() );
- uno::Reference< embed::XVisualObject > xVisualObject(xModel,uno::UNO_QUERY);
- OSL_ENSURE(xVisualObject.is(),"need xVisualObject for page size");
- if( xVisualObject.is() )
- aPageSize = xVisualObject->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
+ OSL_ENSURE(xModel.is(),"need xVisualObject for page size");
+ if( xModel.is() )
+ aPageSize = xModel->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
return aPageSize;
}
-void ChartModelHelper::triggerRangeHighlighting( const uno::Reference< frame::XModel >& xModel )
+void ChartModelHelper::triggerRangeHighlighting( const rtl::Reference<::chart::ChartModel>& xModel )
{
- uno::Reference< chart2::data::XDataReceiver > xDataReceiver( xModel, uno::UNO_QUERY );
- if( xDataReceiver.is() )
+ if( xModel.is() )
{
- uno::Reference< view::XSelectionChangeListener > xSelectionChangeListener( xDataReceiver->getRangeHighlighter(), uno::UNO_QUERY );
+ uno::Reference< view::XSelectionChangeListener > xSelectionChangeListener( xModel->getRangeHighlighter(), uno::UNO_QUERY );
//trigger selection of cell range
if( xSelectionChangeListener.is() )
{
@@ -220,7 +158,7 @@ void ChartModelHelper::triggerRangeHighlighting( const uno::Reference< frame::XM
}
}
-bool ChartModelHelper::isIncludeHiddenCells( const uno::Reference< frame::XModel >& xChartModel )
+bool ChartModelHelper::isIncludeHiddenCells( const rtl::Reference<::chart::ChartModel>& xChartModel )
{
bool bIncluded = true; // hidden cells are included by default.
diff --git a/chart2/source/tools/DataSourceHelper.cxx b/chart2/source/tools/DataSourceHelper.cxx
index 851204c70a75..b21ccd11b254 100644
--- a/chart2/source/tools/DataSourceHelper.cxx
+++ b/chart2/source/tools/DataSourceHelper.cxx
@@ -20,6 +20,7 @@
#include <DataSourceHelper.hxx>
#include <ChartModel.hxx>
#include <ChartModelHelper.hxx>
+#include <ChartTypeManager.hxx>
#include <DiagramHelper.hxx>
#include <Diagram.hxx>
#include <DataSeriesHelper.hxx>
@@ -275,53 +276,29 @@ uno::Sequence< OUString > DataSourceHelper::getUsedDataRanges(
return comphelper::containerToSequence( aResult );
}
-uno::Sequence< OUString > DataSourceHelper::getUsedDataRanges( const uno::Reference< frame::XModel > & xChartModel )
+uno::Sequence< OUString > DataSourceHelper::getUsedDataRanges( const rtl::Reference<::chart::ChartModel> & xChartModel )
{
rtl::Reference< Diagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
return getUsedDataRanges( xDiagram );
}
uno::Reference< chart2::data::XDataSource > DataSourceHelper::getUsedData(
- const uno::Reference< chart2::XChartDocument >& xChartDoc )
+ const rtl::Reference<::chart::ChartModel>& xChartDoc )
{
return pressUsedDataIntoRectangularFormat( xChartDoc );
}
uno::Reference< chart2::data::XDataSource > DataSourceHelper::getUsedData(
- const uno::Reference< frame::XModel >& xChartModel )
-{
- std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aResult;
-
- rtl::Reference< Diagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
- uno::Reference< data::XLabeledDataSequence > xCategories( DiagramHelper::getCategoriesFromDiagram( xDiagram ) );
- if( xCategories.is() )
- aResult.push_back( xCategories );
-
- std::vector< uno::Reference< XDataSeries > > aSeriesVector( ChartModelHelper::getDataSeries( xChartModel ) );
- for (auto const& series : aSeriesVector)
- {
- uno::Reference< data::XDataSource > xDataSource(series, uno::UNO_QUERY);
- if( !xDataSource.is() )
- continue;
- const uno::Sequence< uno::Reference< data::XLabeledDataSequence > > aDataSequences( xDataSource->getDataSequences() );
- aResult.insert( aResult.end(), aDataSequences.begin(), aDataSequences.end() );
- }
-
- return uno::Reference< chart2::data::XDataSource >(
- new DataSource( comphelper::containerToSequence( aResult )));
-}
-
-uno::Reference< chart2::data::XDataSource > DataSourceHelper::getUsedData(
ChartModel& rModel )
{
std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aResult;
- uno::Reference< XDiagram > xDiagram( rModel.getFirstDiagram() );
+ rtl::Reference< Diagram > xDiagram = rModel.getFirstChartDiagram();
uno::Reference< data::XLabeledDataSequence > xCategories( DiagramHelper::getCategoriesFromDiagram( xDiagram ) );
if( xCategories.is() )
aResult.push_back( xCategories );
- std::vector< uno::Reference< XDataSeries > > aSeriesVector( ChartModelHelper::getDataSeries( rModel ) );
+ std::vector< uno::Reference< XDataSeries > > aSeriesVector( ChartModelHelper::getDataSeries( &rModel ) );
for (auto const& series : aSeriesVector)
{
uno::Reference< data::XDataSource > xDataSource(series, uno::UNO_QUERY);
@@ -336,8 +313,7 @@ uno::Reference< chart2::data::XDataSource > DataSourceHelper::getUsedData(
}
bool DataSourceHelper::detectRangeSegmentation(
- const uno::Reference<
- frame::XModel >& xChartModel
+ const rtl::Reference<::chart::ChartModel>& xChartModel
, OUString& rOutRangeString
, css::uno::Sequence< sal_Int32 >& rSequenceMapping
, bool& rOutUseColumns
@@ -346,22 +322,21 @@ bool DataSourceHelper::detectRangeSegmentation(
{
bool bSomethingDetected = false;
- uno::Reference< XChartDocument > xChartDocument( xChartModel, uno::UNO_QUERY );
- if( !xChartDocument.is() )
+ if( !xChartModel.is() )
return bSomethingDetected;
- uno::Reference< data::XDataProvider > xDataProvider( xChartDocument->getDataProvider() );
+ uno::Reference< data::XDataProvider > xDataProvider( xChartModel->getDataProvider() );
if( !xDataProvider.is() )
return bSomethingDetected;
try
{
DataSourceHelper::readArguments(
- xDataProvider->detectArguments( pressUsedDataIntoRectangularFormat( xChartDocument ) ),
+ xDataProvider->detectArguments( pressUsedDataIntoRectangularFormat( xChartModel ) ),
rOutRangeString, rSequenceMapping, rOutUseColumns, rOutFirstCellAsLabel, rOutHasCategories );
bSomethingDetected = !rOutRangeString.isEmpty();
uno::Reference< chart2::data::XLabeledDataSequence > xCategories(
- DiagramHelper::getCategoriesFromDiagram( xChartDocument->getFirstDiagram() ));
+ DiagramHelper::getCategoriesFromDiagram( xChartModel->getFirstDiagram() ));
rOutHasCategories = xCategories.is();
}
catch( uno::Exception & )
@@ -372,7 +347,7 @@ bool DataSourceHelper::detectRangeSegmentation(
}
bool DataSourceHelper::allArgumentsForRectRangeDetected(
- const uno::Reference< chart2::XChartDocument >& xChartDocument )
+ const rtl::Reference<::chart::ChartModel>& xChartDocument )
{
bool bHasDataRowSource = false;
bool bHasFirstCellAsLabel = false;
@@ -416,30 +391,24 @@ bool DataSourceHelper::allArgumentsForRectRangeDetected(
}
void DataSourceHelper::setRangeSegmentation(
- const uno::Reference< frame::XModel >& xChartModel
+ const rtl::Reference<::chart::ChartModel>& xChartModel
, const css::uno::Sequence< sal_Int32 >& rSequenceMapping
, bool bUseColumns , bool bFirstCellAsLabel, bool bUseCategories )
{
- uno::Reference< XChartDocument > xChartDocument( xChartModel, uno::UNO_QUERY );
- if( !xChartDocument.is() )
- return;
- uno::Reference< data::XDataProvider > xDataProvider( xChartDocument->getDataProvider() );
+ uno::Reference< data::XDataProvider > xDataProvider( xChartModel->getDataProvider() );
if( !xDataProvider.is() )
return;
rtl::Reference< Diagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
if( !xDiagram.is() )
return;
- uno::Reference< chart2::XChartTypeManager > xChartTypeManager( xChartDocument->getChartTypeManager() );
+ rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartModel->getTypeManager();
if( !xChartTypeManager.is() )
return;
- uno::Reference< lang::XMultiServiceFactory > xTemplateFactory( xChartTypeManager, uno::UNO_QUERY );
- if( !xTemplateFactory.is() )
- return;
OUString aRangeString;
bool bDummy;
uno::Sequence< sal_Int32 > aDummy;
- readArguments( xDataProvider->detectArguments( pressUsedDataIntoRectangularFormat( xChartDocument )),
+ readArguments( xDataProvider->detectArguments( pressUsedDataIntoRectangularFormat( xChartModel )),
aRangeString, aDummy, bDummy, bDummy, bDummy );
uno::Sequence< beans::PropertyValue > aArguments(
@@ -450,9 +419,7 @@ void DataSourceHelper::setRangeSegmentation(
if( !xDataSource.is() )
return;
- auto pModel = dynamic_cast<ChartModel*>(xChartModel.get());
- assert(pModel);
- ControllerLockGuardUNO aCtrlLockGuard( pModel );
+ ControllerLockGuardUNO aCtrlLockGuard( xChartModel );
xDiagram->setDiagramData( xDataSource, aArguments );
}
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index d55ce0873967..ebbe3b528954 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -920,7 +920,7 @@ Sequence< OUString > DiagramHelper::generateAutomaticCategoriesFromCooSys( const
Sequence< OUString > DiagramHelper::getExplicitSimpleCategories(
ChartModel& rModel )
{
- rtl::Reference< BaseCoordinateSystem > xCooSys = ChartModelHelper::getFirstCoordinateSystem( rModel );
+ rtl::Reference< BaseCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( &rModel ) );
ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, rModel );
return aExplicitCategoriesProvider.getSimpleCategories();
}
@@ -1020,13 +1020,11 @@ void lcl_switchToTextCategories( const Reference< XChartDocument >& xChartDoc, c
}
-void DiagramHelper::switchToDateCategories( const Reference< XChartDocument >& xChartDoc )
+void DiagramHelper::switchToDateCategories( const rtl::Reference<::chart::ChartModel>& xChartDoc )
{
if(xChartDoc.is())
{
- auto pModel = dynamic_cast<ChartModel*>(xChartDoc.get());
- assert(pModel);
- ControllerLockGuardUNO aCtrlLockGuard( pModel );
+ ControllerLockGuardUNO aCtrlLockGuard( xChartDoc );
Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( xChartDoc ) );
if( xCooSys.is() )
@@ -1037,13 +1035,11 @@ void DiagramHelper::switchToDateCategories( const Reference< XChartDocument >& x
}
}
-void DiagramHelper::switchToTextCategories( const Reference< XChartDocument >& xChartDoc )
+void DiagramHelper::switchToTextCategories( const rtl::Reference<::chart::ChartModel>& xChartDoc )
{
if(xChartDoc.is())
{
- auto pModel = dynamic_cast<ChartModel*>(xChartDoc.get());
- assert(pModel);
- ControllerLockGuardUNO aCtrlLockGuard( pModel );
+ ControllerLockGuardUNO aCtrlLockGuard( xChartDoc );
Reference< chart2::XCoordinateSystem > xCooSys( ChartModelHelper::getFirstCoordinateSystem( xChartDoc ) );
if( xCooSys.is() )
@@ -1547,12 +1543,10 @@ static void lcl_ensureRange0to1( double& rValue )
rValue=1.0;
}
-bool DiagramHelper::setDiagramPositioning( const uno::Reference< frame::XModel >& xChartModel,
+bool DiagramHelper::setDiagramPositioning( const rtl::Reference<::chart::ChartModel>& xChartModel,
const awt::Rectangle& rPosRect /*100th mm*/ )
{
- auto pModel = dynamic_cast<ChartModel*>(xChartModel.get());
- assert(pModel);
- ControllerLockGuardUNO aCtrlLockGuard( pModel );
+ ControllerLockGuardUNO aCtrlLockGuard( xChartModel );
bool bChanged = false;
awt::Size aPageSize( ChartModelHelper::getPageSize(xChartModel) );
@@ -1594,7 +1588,7 @@ bool DiagramHelper::setDiagramPositioning( const uno::Reference< frame::XModel >
return bChanged;
}
-awt::Rectangle DiagramHelper::getDiagramRectangleFromModel( const uno::Reference< frame::XModel >& xChartModel )
+awt::Rectangle DiagramHelper::getDiagramRectangleFromModel( const rtl::Reference<::chart::ChartModel>& xChartModel )
{
awt::Rectangle aRet(-1,-1,-1,-1);
diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx
index 936419759301..7c294acc2778 100644
--- a/chart2/source/tools/ExplicitCategoriesProvider.cxx
+++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx
@@ -102,7 +102,7 @@ ExplicitCategoriesProvider::ExplicitCategoriesProvider( const Reference< chart2:
//->split them in the direction of the first series
//detect whether the first series is a row or a column
bool bSeriesUsesColumns = true;
- std::vector< Reference< XDataSeries > > aSeries( ChartModelHelper::getDataSeries( mrModel ) );
+ std::vector< Reference< XDataSeries > > aSeries( ChartModelHelper::getDataSeries( &mrModel ) );
if( !aSeries.empty() )
{
uno::Reference< data::XDataSource > xSeriesSource( aSeries.front(), uno::UNO_QUERY );
@@ -176,7 +176,7 @@ void ExplicitCategoriesProvider::convertCategoryAnysToText( uno::Sequence< OUStr
auto pOutTexts = rOutTexts.getArray();
sal_Int32 nAxisNumberFormat = 0;
- rtl::Reference< BaseCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( rModel ) );
+ rtl::Reference< BaseCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( &rModel ) );
if( xCooSysModel.is() )
{
Reference< chart2::XAxis > xAxis( xCooSysModel->getAxisByDimension(0,0) );
@@ -407,7 +407,7 @@ static bool lcl_fillDateCategories( const uno::Reference< data::XDataSequence >&
bool bOwnData = false;
bool bOwnDataAnddAxisHasAnyFormat = false;
bool bOwnDataAnddAxisHasDateFormat = false;
- Reference< XCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( rModel ) );
+ Reference< XCoordinateSystem > xCooSysModel( ChartModelHelper::getFirstCoordinateSystem( &rModel ) );
if( xCooSysModel.is() )
{
if( rModel.hasInternalDataProvider() )
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
index d39addeaf8ce..e2ecab399685 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -316,7 +316,9 @@ InternalDataProvider::InternalDataProvider(
{
try
{
- rtl::Reference< Diagram > xDiagram( ChartModelHelper::findDiagram( xChartDoc ) );
+ auto pModel = dynamic_cast<ChartModel*>(xChartDoc.get());
+ assert(!xChartDoc || pModel);
+ rtl::Reference< Diagram > xDiagram( ChartModelHelper::findDiagram( pModel ) );
if( xDiagram.is())
{
Reference< frame::XModel > xChartModel = xChartDoc;
@@ -329,7 +331,7 @@ InternalDataProvider::InternalDataProvider(
uno::Sequence< sal_Int32 > aSequenceMapping;
const bool bSomethingDetected(
DataSourceHelper::detectRangeSegmentation(
- xChartModel, aRangeString, aSequenceMapping, m_bDataInColumns, bFirstCellAsLabel, bHasCategories ));
+ pModel, aRangeString, aSequenceMapping, m_bDataInColumns, bFirstCellAsLabel, bHasCategories ));
// #i120559# if no data was available, restore default
if(!bSomethingDetected && m_bDataInColumns != bDefaultDataInColumns)
@@ -342,8 +344,7 @@ InternalDataProvider::InternalDataProvider(
{
vector< vector< uno::Any > > aNewCategories;//inner count is level
{
- ChartModel& rModel = dynamic_cast<ChartModel&>(*xChartModel);
- ExplicitCategoriesProvider aExplicitCategoriesProvider(ChartModelHelper::getFirstCoordinateSystem(xChartModel), rModel);
+ ExplicitCategoriesProvider aExplicitCategoriesProvider(ChartModelHelper::getFirstCoordinateSystem(pModel), *pModel);
const Sequence< Reference< chart2::data::XLabeledDataSequence> >& rSplitCategoriesList( aExplicitCategoriesProvider.getSplitCategoriesList() );
sal_Int32 nLevelCount = rSplitCategoriesList.getLength();
@@ -387,7 +388,7 @@ InternalDataProvider::InternalDataProvider(
}
// data series
- std::vector< Reference< chart2::XDataSeries > > aSeriesVector( ChartModelHelper::getDataSeries( xChartDoc ));
+ std::vector< Reference< chart2::XDataSeries > > aSeriesVector( ChartModelHelper::getDataSeries( pModel ));
lcl_internalizeSeries ftor( m_aInternalData, *this, bConnectToModel, m_bDataInColumns );
for( const auto& rxScreen : aSeriesVector )
ftor( rxScreen );
diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx
index a9bdb598e693..5d17de7ac5aa 100644
--- a/chart2/source/tools/ObjectIdentifier.cxx
+++ b/chart2/source/tools/ObjectIdentifier.cxx
@@ -129,7 +129,7 @@ OUString lcl_getTitleParentParticle( TitleHelper::eTitleType aTitleType )
return aRet;
}
-Reference<XChartType> lcl_getFirstStockChartType( const Reference< frame::XModel >& xChartModel )
+Reference<XChartType> lcl_getFirstStockChartType( const rtl::Reference<::chart::ChartModel>& xChartModel )
{
rtl::Reference< Diagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
if(!xDiagram.is())
@@ -212,7 +212,7 @@ void lcl_parseSeriesIndices( sal_Int32& rnChartTypeIndex, sal_Int32& rnSeriesInd
}
void lcl_getDiagramAndCooSys( const OUString& rObjectCID
- , const Reference< frame::XModel >& xChartModel
+ , const rtl::Reference<::chart::ChartModel>& xChartModel
, rtl::Reference< Diagram >& xDiagram
, rtl::Reference< BaseCoordinateSystem >& xCooSys )
{
@@ -295,7 +295,7 @@ bool ObjectIdentifier::operator<( const ObjectIdentifier& rOID ) const
OUString ObjectIdentifier::createClassifiedIdentifierForObject(
const Reference< uno::XInterface >& xObject
- , ChartModel& rModel)
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
OUString aRet;
@@ -312,91 +312,7 @@ OUString ObjectIdentifier::createClassifiedIdentifierForObject(
if( xTitle.is() )
{
TitleHelper::eTitleType aTitleType;
- if( TitleHelper::getTitleType( aTitleType, xTitle, rModel ) )
- {
- eObjectType = OBJECTTYPE_TITLE;
- aParentParticle = lcl_getTitleParentParticle( aTitleType );
- aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
- eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
- }
- return aRet;
-
- }
-
- //axis
- Reference< XAxis > xAxis( xObject, uno::UNO_QUERY );
- if( xAxis.is() )
- {
- rtl::Reference< BaseCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, rModel.getFirstDiagram() ) );
- OUString aCooSysParticle( createParticleForCoordinateSystem( xCooSys, rModel ) );
- sal_Int32 nDimensionIndex=-1;
- sal_Int32 nAxisIndex=-1;
- AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex );
- OUString aAxisParticle( createParticleForAxis( nDimensionIndex, nAxisIndex ) );
- return createClassifiedIdentifierForParticles( aCooSysParticle, aAxisParticle );
- }
-
- //legend
- Reference< XLegend > xLegend( xObject, uno::UNO_QUERY );
- if( xLegend.is() )
- {
- return createClassifiedIdentifierForParticle( createParticleForLegend( rModel ) );
- }
-
- //diagram
- Reference< XDiagram > xDiagram( xObject, uno::UNO_QUERY );
- if( xDiagram.is() )
- {
- return createClassifiedIdentifierForParticle( createParticleForDiagram() );
- }
-
- //todo
- //XDataSeries
- //CooSys
- //charttype
- //datapoint?
- //Gridproperties
- }
- catch(const uno::Exception&)
- {
- DBG_UNHANDLED_EXCEPTION("chart2");
- }
-
- if( eObjectType != OBJECTTYPE_UNKNOWN )
- {
- aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
- eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
- }
- else
- {
- OSL_FAIL("give object could not be identified in createClassifiedIdentifierForObject");
- }
-
- return aRet;
-}
-
-OUString ObjectIdentifier::createClassifiedIdentifierForObject(
- const Reference< uno::XInterface >& xObject
- , const Reference< frame::XModel >& xChartModel )
-{
- OUString aRet;
-
- enum ObjectType eObjectType = OBJECTTYPE_UNKNOWN;
- const OUString aObjectID;
- OUString aParentParticle;
- const OUString aDragMethodServiceName;
- const OUString aDragParameterString;
- auto pModel = dynamic_cast<ChartModel*>(xChartModel.get());
- assert(!xChartModel || pModel);
-
- try
- {
- //title
- Reference< XTitle > xTitle( xObject, uno::UNO_QUERY );
- if( xTitle.is() )
- {
- TitleHelper::eTitleType aTitleType;
- if( TitleHelper::getTitleType( aTitleType, xTitle, pModel ) )
+ if( TitleHelper::getTitleType( aTitleType, xTitle, xChartModel ) )
{
eObjectType = OBJECTTYPE_TITLE;
aParentParticle = lcl_getTitleParentParticle( aTitleType );
@@ -499,32 +415,7 @@ OUString ObjectIdentifier::createParticleForDiagram()
OUString ObjectIdentifier::createParticleForCoordinateSystem(
const Reference< XCoordinateSystem >& xCooSys
- , ChartModel& rModel )
-{
- OUString aRet;
-
- rtl::Reference< Diagram > xDiagram( rModel.getFirstChartDiagram() );
- if( xDiagram.is() )
- {
- sal_Int32 nCooSysIndex = 0;
- uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xDiagram->getCoordinateSystems() );
- for( ; nCooSysIndex < aCooSysList.getLength(); ++nCooSysIndex )
- {
- Reference< XCoordinateSystem > xCurrentCooSys( aCooSysList[nCooSysIndex] );
- if( xCooSys == xCurrentCooSys )
- {
- aRet = ObjectIdentifier::createParticleForDiagram() + ":CS=" + OUString::number( nCooSysIndex );
- break;
- }
- }
- }
-
- return aRet;
-}
-
-OUString ObjectIdentifier::createParticleForCoordinateSystem(
- const Reference< XCoordinateSystem >& xCooSys
- , const Reference< frame::XModel >& xChartModel )
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
OUString aRet;
@@ -569,7 +460,7 @@ OUString ObjectIdentifier::createParticleForGrid(
OUString ObjectIdentifier::createClassifiedIdentifierForGrid(
const Reference< XAxis >& xAxis
- , const Reference< frame::XModel >& xChartModel
+ , const rtl::Reference<::chart::ChartModel>& xChartModel
, sal_Int32 nSubGridIndex )
{
//-1: main grid, 0: first subgrid etc
@@ -597,15 +488,9 @@ OUString ObjectIdentifier::createParticleForSeries(
OUString::number( nSeriesIndex );
}
-OUString ObjectIdentifier::createParticleForLegend( ChartModel& )
-{
- //todo: if more than one diagram is implemented, find the correct diagram which is owner of the given legend
-
- return ObjectIdentifier::createParticleForDiagram() + ":" + getStringForType( OBJECTTYPE_LEGEND ) + "=";
-}
OUString ObjectIdentifier::createParticleForLegend(
- const Reference< frame::XModel >& )
+ const rtl::Reference<::chart::ChartModel>& )
{
//todo: if more than one diagram is implemented, find the correct diagram which is owner of the given legend
@@ -1140,32 +1025,14 @@ bool ObjectIdentifier::isCID( const OUString& rName )
}
Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
- const OUString& rObjectCID,
- const Reference< chart2::XChartDocument >& xChartDocument )
-{
- return ObjectIdentifier::getObjectPropertySet(
- rObjectCID, Reference< frame::XModel >( xChartDocument ));
-}
-
-Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
- const OUString& rObjectCID
- , const rtl::Reference< ::chart::ChartModel >& xChartModel )
-{
- return ObjectIdentifier::getObjectPropertySet(
- rObjectCID, Reference< frame::XModel >( xChartModel ));
-}
-
-Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
const OUString& rObjectCID
- , const Reference< frame::XModel >& xChartModel )
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
//return the model object that is indicated by rObjectCID
if(rObjectCID.isEmpty())
return nullptr;
if(!xChartModel.is())
return nullptr;
- auto pModel = dynamic_cast<ChartModel*>(xChartModel.get());
- assert(pModel);
Reference< beans::XPropertySet > xObjectProperties;
try
@@ -1175,19 +1042,19 @@ Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
rtl::Reference< Diagram > xDiagram;
rtl::Reference< BaseCoordinateSystem > xCooSys;
- lcl_getDiagramAndCooSys( rObjectCID, pModel, xDiagram, xCooSys );
+ lcl_getDiagramAndCooSys( rObjectCID, xChartModel, xDiagram, xCooSys );
switch(eObjectType)
{
case OBJECTTYPE_PAGE:
{
- xObjectProperties.set( pModel->getPageBackground() );
+ xObjectProperties.set( xChartModel->getPageBackground() );
}
break;
case OBJECTTYPE_TITLE:
{
TitleHelper::eTitleType aTitleType = getTitleTypeForCID( rObjectCID );
- Reference< XTitle > xTitle( TitleHelper::getTitle( aTitleType, pModel ) );
+ Reference< XTitle > xTitle( TitleHelper::getTitle( aTitleType, xChartModel ) );
xObjectProperties.set( xTitle, uno::UNO_QUERY );
}
break;
@@ -1344,7 +1211,7 @@ Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
Reference< XAxis > ObjectIdentifier::getAxisForCID(
const OUString& rObjectCID
- , const Reference< frame::XModel >& xChartModel )
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
rtl::Reference< Diagram > xDiagram;
rtl::Reference< BaseCoordinateSystem > xCooSys;
@@ -1359,7 +1226,7 @@ Reference< XAxis > ObjectIdentifier::getAxisForCID(
Reference< XDataSeries > ObjectIdentifier::getDataSeriesForCID(
const OUString& rObjectCID
- , const Reference< frame::XModel >& xChartModel )
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
Reference< XDataSeries > xSeries;
@@ -1385,7 +1252,7 @@ Reference< XDataSeries > ObjectIdentifier::getDataSeriesForCID(
rtl::Reference< Diagram > ObjectIdentifier::getDiagramForCID(
const OUString& rObjectCID
- , const uno::Reference< frame::XModel >& xChartModel )
+ , const rtl::Reference<::chart::ChartModel>& xChartModel )
{
rtl::Reference< Diagram > xDiagram;
rtl::Reference< BaseCoordinateSystem > xCooSys;
diff --git a/chart2/source/tools/RangeHighlighter.cxx b/chart2/source/tools/RangeHighlighter.cxx
index 5e89b097f2f9..12d20e142466 100644
--- a/chart2/source/tools/RangeHighlighter.cxx
+++ b/chart2/source/tools/RangeHighlighter.cxx
@@ -25,6 +25,7 @@
#include <ObjectIdentifier.hxx>
#include <DataSeriesHelper.hxx>
#include <Diagram.hxx>
+#include <ChartModel.hxx>
#include <com/sun/star/chart2/ScaleData.hpp>
#include <com/sun/star/chart2/XAxis.hpp>
diff --git a/chart2/source/tools/TitleHelper.cxx b/chart2/source/tools/TitleHelper.cxx
index 2a66c72171f2..51f6ccf2a6b7 100644
--- a/chart2/source/tools/TitleHelper.cxx
+++ b/chart2/source/tools/TitleHelper.cxx
@@ -121,19 +121,17 @@ uno::Reference< XTitled > lcl_getTitleParent( TitleHelper::eTitleType nTitleInde
}
uno::Reference< XTitled > lcl_getTitleParent( TitleHelper::eTitleType nTitleIndex
- , const uno::Reference< frame::XModel >& xModel )
+ , const rtl::Reference<::chart::ChartModel>& xModel )
{
if(nTitleIndex == TitleHelper::MAIN_TITLE)
{
- uno::Reference< XTitled > xTitled( xModel, uno::UNO_QUERY );
- return xTitled;
+ return xModel;
}
- uno::Reference< XChartDocument > xChartDoc( xModel, uno::UNO_QUERY );
uno::Reference< XDiagram > xDiagram;
- if( xChartDoc.is())
- xDiagram.set( xChartDoc->getFirstDiagram());
+ if( xModel.is())
+ xDiagram.set( xModel->getFirstDiagram());
return lcl_getTitleParent( nTitleIndex, xDiagram );
}
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 5084994752f5..792ebd6fa3cd 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1817,17 +1817,6 @@ bool lcl_getPropertySwapXAndYAxis( const rtl::Reference< Diagram >& xDiagram )
sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
const Reference< chart2::XAxis >& xAxis
, const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
- , const css::uno::Reference< css::chart2::XChartDocument>& xChartDoc)
-{
- auto pChartModel = dynamic_cast<ChartModel*>(xChartDoc.get());
- assert(!xChartDoc || pChartModel);
- return AxisHelper::getExplicitNumberFormatKeyForAxis( xAxis, xCorrespondingCoordinateSystem, pChartModel
- , true /*bSearchForParallelAxisIfNothingIsFound*/ );
-}
-
-sal_Int32 ExplicitValueProvider::getExplicitNumberFormatKeyForAxis(
- const Reference< chart2::XAxis >& xAxis
- , const Reference< chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem
, const rtl::Reference<::chart::ChartModel>& xChartDoc)
{
return AxisHelper::getExplicitNumberFormatKeyForAxis( xAxis, xCorrespondingCoordinateSystem, xChartDoc