use more concrete types in chart2
Change-Id: I70042284e4549b3eef67866a35741b06305d720f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149229 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -318,7 +318,7 @@ Any WrappedAttachedAxisProperty::getPropertyValue( const Reference< beans::XProp
|
||||
|
||||
void WrappedAttachedAxisProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
|
||||
{
|
||||
uno::Reference< chart2::XDataSeries > xDataSeries( xInnerPropertySet, uno::UNO_QUERY );
|
||||
rtl::Reference< ::chart::DataSeries > xDataSeries( dynamic_cast<::chart::DataSeries*>(xInnerPropertySet.get()) );
|
||||
|
||||
sal_Int32 nChartAxisAssign = css::chart::ChartAxisAssign::PRIMARY_Y;
|
||||
if( ! (rOuterValue >>= nChartAxisAssign) )
|
||||
|
||||
@@ -286,7 +286,7 @@ beans::PropertyState WrappedSymbolTypeProperty::getPropertyState( const Referenc
|
||||
m_spChart2ModelContact)
|
||||
{
|
||||
rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() );
|
||||
Reference< chart2::XDataSeries > xSeries( xInnerPropertyState, uno::UNO_QUERY );
|
||||
rtl::Reference< ::chart::DataSeries > xSeries( dynamic_cast<DataSeries*>(xInnerPropertyState.get()) );
|
||||
rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeOfSeries( xSeries ) );
|
||||
if( ChartTypeHelper::isSupportingSymbolProperties( xChartType, 2 ) )
|
||||
return beans::PropertyState_DIRECT_VALUE;
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace com::sun::star::frame { class XModel; }
|
||||
namespace com::sun::star::uno { class XComponentContext; }
|
||||
namespace chart { class ChartModel; }
|
||||
namespace chart { class BaseCoordinateSystem; }
|
||||
namespace chart { class DataSeries; }
|
||||
|
||||
namespace chart::wrapper
|
||||
{
|
||||
@@ -37,7 +38,7 @@ public:
|
||||
SeriesOptionsItemConverter(
|
||||
const rtl::Reference<::chart::ChartModel> & xChartModel,
|
||||
css::uno::Reference< css::uno::XComponentContext > xContext,
|
||||
const css::uno::Reference< css::beans::XPropertySet > & rPropertySet,
|
||||
const rtl::Reference<::chart::DataSeries> & rPropertySet,
|
||||
SfxItemPool& rItemPool );
|
||||
virtual ~SeriesOptionsItemConverter() override;
|
||||
|
||||
|
||||
@@ -234,8 +234,10 @@ DataPointItemConverter::DataPointItemConverter(
|
||||
m_aConverters.emplace_back( new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize"));
|
||||
if( bDataSeries )
|
||||
{
|
||||
assert(dynamic_cast<DataSeries*>(rPropertySet.get()));
|
||||
m_aConverters.emplace_back( new StatisticsItemConverter( xChartModel, rPropertySet, rItemPool ));
|
||||
m_aConverters.emplace_back( new SeriesOptionsItemConverter( xChartModel, xContext, rPropertySet, rItemPool ));
|
||||
m_aConverters.emplace_back( new SeriesOptionsItemConverter( xChartModel, xContext,
|
||||
dynamic_cast<DataSeries*>(rPropertySet.get()), rItemPool ));
|
||||
}
|
||||
|
||||
rtl::Reference< Diagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) );
|
||||
|
||||
@@ -49,9 +49,9 @@ namespace chart::wrapper
|
||||
SeriesOptionsItemConverter::SeriesOptionsItemConverter(
|
||||
const rtl::Reference<::chart::ChartModel>& xChartModel
|
||||
, uno::Reference< uno::XComponentContext > xContext
|
||||
, const uno::Reference< beans::XPropertySet >& xPropertySet
|
||||
, const rtl::Reference< ::chart::DataSeries >& xDataSeries
|
||||
, SfxItemPool& rItemPool )
|
||||
: ItemConverter( xPropertySet, rItemPool )
|
||||
: ItemConverter( xDataSeries, rItemPool )
|
||||
, m_xChartModel(xChartModel)
|
||||
, m_xCC(std::move(xContext))
|
||||
, m_bAttachToMainAxis(true)
|
||||
@@ -72,8 +72,6 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter(
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference< XDataSeries > xDataSeries( xPropertySet, uno::UNO_QUERY );
|
||||
|
||||
m_bAttachToMainAxis = DiagramHelper::isSeriesAttachedToMainAxis( xDataSeries );
|
||||
|
||||
rtl::Reference< Diagram > xDiagram( ChartModelHelper::findDiagram(xChartModel) );
|
||||
@@ -148,7 +146,7 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter(
|
||||
}
|
||||
}
|
||||
|
||||
m_bHideLegendEntry = !xPropertySet->getPropertyValue("ShowLegendEntry").get<bool>();
|
||||
m_bHideLegendEntry = !xDataSeries->getPropertyValue("ShowLegendEntry").get<bool>();
|
||||
}
|
||||
catch( const uno::Exception & )
|
||||
{
|
||||
@@ -184,7 +182,8 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
|
||||
if( bAttachToMainAxis != m_bAttachToMainAxis )
|
||||
{
|
||||
//change model:
|
||||
bChanged = ChartModelHelper::findDiagram(m_xChartModel)->attachSeriesToAxis( bAttachToMainAxis, uno::Reference< XDataSeries >::query( GetPropertySet() )
|
||||
rtl::Reference<DataSeries> xDataSeries = dynamic_cast<DataSeries*>( GetPropertySet().get() );
|
||||
bChanged = ChartModelHelper::findDiagram(m_xChartModel)->attachSeriesToAxis( bAttachToMainAxis, xDataSeries
|
||||
, m_xCC );
|
||||
|
||||
if( bChanged )
|
||||
@@ -205,7 +204,7 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
|
||||
if( nWhichId == SCHATTR_BAR_OVERLAP )
|
||||
aPropName = "OverlapSequence";
|
||||
|
||||
uno::Reference< XDataSeries > xDataSeries( GetPropertySet(), uno::UNO_QUERY );
|
||||
rtl::Reference< DataSeries > xDataSeries( dynamic_cast<DataSeries*>(GetPropertySet().get()) );
|
||||
rtl::Reference< Diagram > xDiagram( ChartModelHelper::findDiagram(m_xChartModel) );
|
||||
rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeOfSeries( xDataSeries ) );
|
||||
if( xChartType.is() )
|
||||
|
||||
@@ -61,11 +61,6 @@ public:
|
||||
static std::vector< rtl::Reference< ::chart::DataSeries > >
|
||||
getDataSeries( const rtl::Reference< ::chart::ChartModel > & xModel );
|
||||
|
||||
static rtl::Reference< ChartType >
|
||||
getChartTypeOfSeries(
|
||||
const rtl::Reference<::chart::ChartModel>& xModel
|
||||
, const css::uno::Reference< css::chart2::XDataSeries >& xGivenDataSeries );
|
||||
|
||||
static rtl::Reference< ChartType >
|
||||
getChartTypeOfSeries(
|
||||
const rtl::Reference<::chart::ChartModel>& xModel
|
||||
|
||||
@@ -254,19 +254,14 @@ public:
|
||||
std::vector< rtl::Reference< ::chart::DataSeries > >
|
||||
getDataSeries();
|
||||
|
||||
rtl::Reference< ChartType >
|
||||
getChartTypeOfSeries( const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
|
||||
rtl::Reference< ChartType >
|
||||
getChartTypeOfSeries( const rtl::Reference< DataSeries >& xSeries );
|
||||
|
||||
rtl::Reference< ::chart::Axis > getAttachedAxis(
|
||||
const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
|
||||
|
||||
rtl::Reference< ::chart::Axis > getAttachedAxis(
|
||||
const rtl::Reference< ::chart::DataSeries >& xSeries );
|
||||
|
||||
bool attachSeriesToAxis( bool bMainAxis,
|
||||
const css::uno::Reference< css::chart2::XDataSeries >& xSeries,
|
||||
const rtl::Reference< DataSeries >& xSeries,
|
||||
const css::uno::Reference< css::uno::XComponentContext > & xContext,
|
||||
bool bAdaptAxes=true );
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace chart::RegressionCurveHelper
|
||||
*/
|
||||
OOO_DLLPUBLIC_CHARTTOOLS void initializeCurveCalculator(
|
||||
const css::uno::Reference<css::chart2::XRegressionCurveCalculator>& xOutCurveCalculator,
|
||||
const css::uno::Reference<css::chart2::XDataSeries>& xSeries,
|
||||
const rtl::Reference<::chart::DataSeries>& xSeries,
|
||||
const rtl::Reference<::chart::ChartModel>& xModel );
|
||||
|
||||
OOO_DLLPUBLIC_CHARTTOOLS OUString getUINameForRegressionCurve(
|
||||
|
||||
@@ -1254,16 +1254,6 @@ std::vector< rtl::Reference< ::chart::DataSeries > >
|
||||
return aResult;
|
||||
}
|
||||
|
||||
rtl::Reference< ChartType > Diagram::getChartTypeOfSeries(
|
||||
const uno::Reference< chart2::XDataSeries >& xGivenDataSeries )
|
||||
{
|
||||
if( !xGivenDataSeries.is() )
|
||||
return nullptr;
|
||||
rtl::Reference pGivenDataSeries = dynamic_cast<DataSeries*>(xGivenDataSeries.get());
|
||||
assert(pGivenDataSeries);
|
||||
return getChartTypeOfSeries(pGivenDataSeries);
|
||||
}
|
||||
|
||||
rtl::Reference< ChartType > Diagram::getChartTypeOfSeries(
|
||||
const rtl::Reference< DataSeries >& xGivenDataSeries )
|
||||
{
|
||||
@@ -1292,12 +1282,6 @@ rtl::Reference< ChartType > Diagram::getChartTypeOfSeries(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rtl::Reference< Axis > Diagram::getAttachedAxis(
|
||||
const uno::Reference< css::chart2::XDataSeries >& xSeries )
|
||||
{
|
||||
return AxisHelper::getAxis( 1, DiagramHelper::isSeriesAttachedToMainAxis( xSeries ), this );
|
||||
}
|
||||
|
||||
rtl::Reference< Axis > Diagram::getAttachedAxis(
|
||||
const rtl::Reference< DataSeries >& xSeries )
|
||||
{
|
||||
@@ -1305,14 +1289,13 @@ rtl::Reference< Axis > Diagram::getAttachedAxis(
|
||||
}
|
||||
|
||||
bool Diagram::attachSeriesToAxis( bool bAttachToMainAxis
|
||||
, const uno::Reference< chart2::XDataSeries >& xDataSeries
|
||||
, const rtl::Reference< DataSeries >& xDataSeries
|
||||
, const uno::Reference< uno::XComponentContext > & xContext
|
||||
, bool bAdaptAxes )
|
||||
{
|
||||
bool bChanged = false;
|
||||
|
||||
//set property at axis
|
||||
Reference< beans::XPropertySet > xProp( xDataSeries, uno::UNO_QUERY_THROW );
|
||||
|
||||
sal_Int32 nNewAxisIndex = bAttachToMainAxis ? 0 : 1;
|
||||
sal_Int32 nOldAxisIndex = DataSeriesHelper::getAttachedAxisIndex(xDataSeries);
|
||||
@@ -1322,7 +1305,7 @@ bool Diagram::attachSeriesToAxis( bool bAttachToMainAxis
|
||||
{
|
||||
try
|
||||
{
|
||||
xProp->setPropertyValue( "AttachedAxisIndex", uno::Any( nNewAxisIndex ) );
|
||||
xDataSeries->setPropertyValue( "AttachedAxisIndex", uno::Any( nNewAxisIndex ) );
|
||||
bChanged = true;
|
||||
}
|
||||
catch( const uno::Exception & )
|
||||
|
||||
@@ -121,14 +121,6 @@ std::vector< rtl::Reference< DataSeries > > ChartModelHelper::getDataSeries(
|
||||
return aResult;
|
||||
}
|
||||
|
||||
rtl::Reference< ChartType > ChartModelHelper::getChartTypeOfSeries(
|
||||
const rtl::Reference<::chart::ChartModel>& xModel
|
||||
, const uno::Reference< XDataSeries >& xGivenDataSeries )
|
||||
{
|
||||
rtl::Reference<Diagram> xDiagram = ChartModelHelper::findDiagram( xModel );
|
||||
return xDiagram ? xDiagram->getChartTypeOfSeries( xGivenDataSeries ) : nullptr;
|
||||
}
|
||||
|
||||
rtl::Reference< ChartType > ChartModelHelper::getChartTypeOfSeries(
|
||||
const rtl::Reference<::chart::ChartModel>& xModel
|
||||
, const rtl::Reference< DataSeries >& xGivenDataSeries )
|
||||
|
||||
@@ -236,14 +236,14 @@ void RegressionCurveHelper::initializeCurveCalculator(
|
||||
|
||||
void RegressionCurveHelper::initializeCurveCalculator(
|
||||
const Reference< XRegressionCurveCalculator > & xOutCurveCalculator,
|
||||
const Reference< XDataSeries > & xSeries,
|
||||
const rtl::Reference< ::chart::DataSeries > & xSeries,
|
||||
const rtl::Reference<::chart::ChartModel> & xModel )
|
||||
{
|
||||
sal_Int32 nAxisType = ChartTypeHelper::getAxisType(
|
||||
ChartModelHelper::getChartTypeOfSeries( xModel, xSeries ), 0 ); // x-axis
|
||||
|
||||
initializeCurveCalculator( xOutCurveCalculator,
|
||||
uno::Reference< data::XDataSource >( xSeries, uno::UNO_QUERY ),
|
||||
xSeries,
|
||||
(nAxisType == AxisType::REALNUMBER) );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user