summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/source/inc/ChartModelHelper.hxx2
-rw-r--r--chart2/source/inc/RangeHighlighter.hxx4
-rw-r--r--chart2/source/model/main/ChartModel.cxx6
-rw-r--r--chart2/source/tools/ChartModelHelper.cxx2
-rw-r--r--chart2/source/tools/RangeHighlighter.cxx26
5 files changed, 18 insertions, 22 deletions
diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx
index a3ca9532d865..4cacdc0234e0 100644
--- a/chart2/source/inc/ChartModelHelper.hxx
+++ b/chart2/source/inc/ChartModelHelper.hxx
@@ -46,7 +46,7 @@ class OOO_DLLPUBLIC_CHARTTOOLS ChartModelHelper
{
public:
static css::uno::Reference< css::chart2::data::XRangeHighlighter > createRangeHighlighter(
- const css::uno::Reference< css::view::XSelectionSupplier >& xSelectionSupplier );
+ const rtl::Reference< ::chart::ChartModel >& xSelectionSupplier );
static rtl::Reference< InternalDataProvider > createInternalDataProvider(
const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc, bool bConnectToModel );
diff --git a/chart2/source/inc/RangeHighlighter.hxx b/chart2/source/inc/RangeHighlighter.hxx
index 8642d66f7e88..67cb0484c121 100644
--- a/chart2/source/inc/RangeHighlighter.hxx
+++ b/chart2/source/inc/RangeHighlighter.hxx
@@ -36,6 +36,7 @@ namespace com::sun::star::view { class XSelectionSupplier; }
namespace chart
{
+class ChartModel;
class Diagram;
namespace impl
@@ -52,7 +53,7 @@ class RangeHighlighter final :
{
public:
explicit RangeHighlighter(
- const css::uno::Reference< css::view::XSelectionSupplier > & xSelectionSupplier );
+ const rtl::Reference< ::chart::ChartModel > & xSelectionSupplier );
virtual ~RangeHighlighter() override;
protected:
@@ -91,6 +92,7 @@ private:
css::uno::Reference< css::view::XSelectionSupplier >
m_xSelectionSupplier;
+ rtl::Reference< ::chart::ChartModel > m_xChartModel;
css::uno::Reference< css::view::XSelectionChangeListener >
m_xListener;
css::uno::Sequence< css::chart2::data::HighlightedRange >
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index c7189ff3189e..5105459f7a14 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -873,11 +873,7 @@ Reference< chart2::data::XDataSource > SAL_CALL ChartModel::getUsedData()
Reference< chart2::data::XRangeHighlighter > SAL_CALL ChartModel::getRangeHighlighter()
{
if( ! m_xRangeHighlighter.is())
- {
- uno::Reference< view::XSelectionSupplier > xSelSupp( getCurrentController(), uno::UNO_QUERY );
- if( xSelSupp.is() )
- m_xRangeHighlighter.set( ChartModelHelper::createRangeHighlighter( xSelSupp ));
- }
+ m_xRangeHighlighter.set( ChartModelHelper::createRangeHighlighter( this ));
return m_xRangeHighlighter;
}
diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx
index 829c3d9ffb47..4f9e457d56d2 100644
--- a/chart2/source/tools/ChartModelHelper.cxx
+++ b/chart2/source/tools/ChartModelHelper.cxx
@@ -44,7 +44,7 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
uno::Reference< chart2::data::XRangeHighlighter > ChartModelHelper::createRangeHighlighter(
- const uno::Reference< view::XSelectionSupplier > & xSelectionSupplier )
+ const rtl::Reference< ChartModel > & xSelectionSupplier )
{
return new RangeHighlighter( xSelectionSupplier );
}
diff --git a/chart2/source/tools/RangeHighlighter.cxx b/chart2/source/tools/RangeHighlighter.cxx
index 2ea659f7b708..5e89b097f2f9 100644
--- a/chart2/source/tools/RangeHighlighter.cxx
+++ b/chart2/source/tools/RangeHighlighter.cxx
@@ -19,6 +19,7 @@
#include <RangeHighlighter.hxx>
#include <WeakListenerAdapter.hxx>
+#include <ChartModel.hxx>
#include <ChartModelHelper.hxx>
#include <DataSourceHelper.hxx>
#include <ObjectIdentifier.hxx>
@@ -69,8 +70,9 @@ namespace chart
{
RangeHighlighter::RangeHighlighter(
- const Reference< view::XSelectionSupplier > & xSelectionSupplier ) :
- m_xSelectionSupplier( xSelectionSupplier ),
+ const rtl::Reference< ChartModel > & xChartModel ) :
+ m_xSelectionSupplier(xChartModel->getCurrentController(), uno::UNO_QUERY),
+ m_xChartModel( xChartModel ),
m_nAddedListenerCount( 0 ),
m_bIncludeHiddenCells(true)
{
@@ -88,17 +90,14 @@ Sequence< chart2::data::HighlightedRange > SAL_CALL RangeHighlighter::getSelecte
void RangeHighlighter::determineRanges()
{
m_aSelectedRanges.realloc( 0 );
+ if( !m_xChartModel.is())
+ return;
if( !m_xSelectionSupplier.is())
return;
try
{
- Reference< frame::XController > xController( m_xSelectionSupplier, uno::UNO_QUERY );
- Reference< frame::XModel > xChartModel;
- if( xController.is())
- xChartModel.set( xController->getModel());
-
- m_bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( xChartModel );
+ m_bIncludeHiddenCells = ChartModelHelper::isIncludeHiddenCells( m_xChartModel );
uno::Any aSelection( m_xSelectionSupplier->getSelection());
const uno::Type& rType = aSelection.getValueType();
@@ -113,7 +112,7 @@ void RangeHighlighter::determineRanges()
{
ObjectType eObjectType = ObjectIdentifier::getObjectType( aCID );
sal_Int32 nIndex = ObjectIdentifier::getIndexFromParticleOrCID( aCID );
- Reference< chart2::XDataSeries > xDataSeries( ObjectIdentifier::getDataSeriesForCID( aCID, xChartModel ) );
+ Reference< chart2::XDataSeries > xDataSeries( ObjectIdentifier::getDataSeriesForCID( aCID, m_xChartModel ) );
if( eObjectType == OBJECTTYPE_LEGEND_ENTRY )
{
OUString aParentParticel( ObjectIdentifier::getFullParentParticle( aCID ) );
@@ -135,7 +134,7 @@ void RangeHighlighter::determineRanges()
{
// select error bar ranges, or data series, if the style is
// not set to FROM_DATA
- fillRangesForErrorBars( ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ), xDataSeries );
+ fillRangesForErrorBars( ObjectIdentifier::getObjectPropertySet( aCID, m_xChartModel ), xDataSeries );
return;
}
else if( xDataSeries.is() )
@@ -147,7 +146,7 @@ void RangeHighlighter::determineRanges()
else if( eObjectType == OBJECTTYPE_AXIS )
{
// Axis (Categories)
- Reference< chart2::XAxis > xAxis( ObjectIdentifier::getObjectPropertySet( aCID, xChartModel ), uno::UNO_QUERY );
+ Reference< chart2::XAxis > xAxis( ObjectIdentifier::getObjectPropertySet( aCID, m_xChartModel ), uno::UNO_QUERY );
if( xAxis.is())
{
fillRangesForCategories( xAxis );
@@ -161,7 +160,7 @@ void RangeHighlighter::determineRanges()
)
{
// Diagram
- rtl::Reference< ::chart::Diagram > xDia( ObjectIdentifier::getDiagramForCID( aCID, xChartModel ) );
+ rtl::Reference< ::chart::Diagram > xDia( ObjectIdentifier::getDiagramForCID( aCID, m_xChartModel ) );
if( xDia.is())
{
fillRangesForDiagram( xDia );
@@ -183,8 +182,7 @@ void RangeHighlighter::determineRanges()
else
{
//if nothing is selected select all ranges
- Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY_THROW );
- fillRangesForDiagram( xChartDoc->getFirstDiagram() );
+ fillRangesForDiagram( m_xChartModel->getFirstChartDiagram() );
return;
}
}