summaryrefslogtreecommitdiffstats
path: root/chart2/source/controller/main/ObjectHierarchy.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/controller/main/ObjectHierarchy.cxx')
-rw-r--r--chart2/source/controller/main/ObjectHierarchy.cxx210
1 files changed, 101 insertions, 109 deletions
diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx
index 1fb449026f3a..3a215ac99522 100644
--- a/chart2/source/controller/main/ObjectHierarchy.cxx
+++ b/chart2/source/controller/main/ObjectHierarchy.cxx
@@ -19,38 +19,35 @@
#include <ObjectHierarchy.hxx>
#include <ObjectIdentifier.hxx>
-#include <ChartModelHelper.hxx>
-#include <DiagramHelper.hxx>
#include <Diagram.hxx>
#include <RegressionCurveHelper.hxx>
+#include <RegressionCurveModel.hxx>
+#include <Axis.hxx>
#include <AxisHelper.hxx>
#include <chartview/ExplicitValueProvider.hxx>
+#include <ChartType.hxx>
#include <ChartTypeHelper.hxx>
#include <ChartModel.hxx>
+#include <DataSeries.hxx>
#include <DataSeriesHelper.hxx>
+#include <GridProperties.hxx>
#include <LegendHelper.hxx>
#include <chartview/DrawModelWrapper.hxx>
#include <unonames.hxx>
+#include <BaseCoordinateSystem.hxx>
#include <map>
#include <algorithm>
-#include <iterator>
+#include <cstddef>
#include <com/sun/star/drawing/XShapes.hpp>
-#include <com/sun/star/chart2/XTitled.hpp>
-#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
-#include <com/sun/star/chart2/XChartDocument.hpp>
-#include <com/sun/star/chart2/XChartTypeContainer.hpp>
-#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
-#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/awt/Key.hpp>
-#include <com/sun/star/awt/KeyEvent.hpp>
#include <com/sun/star/awt/KeyModifier.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <tools/diagnose_ex.h>
+#include <utility>
+#include <comphelper/diagnose_ex.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
@@ -91,12 +88,11 @@ void lcl_getChildOIDs(
}
}
-void lcl_addAxisTitle( const Reference< XAxis >& xAxis, ::chart::ObjectHierarchy::tChildContainer& rContainer, const rtl::Reference<::chart::ChartModel>& xChartModel )
+void lcl_addAxisTitle( const rtl::Reference< ::chart::Axis >& xAxis, ::chart::ObjectHierarchy::tChildContainer& rContainer, const rtl::Reference<::chart::ChartModel>& xChartModel )
{
- Reference< XTitled > xAxisTitled( xAxis, uno::UNO_QUERY );
- if( xAxisTitled.is())
+ if( xAxis.is())
{
- Reference< XTitle > xAxisTitle( xAxisTitled->getTitleObject());
+ Reference< XTitle > xAxisTitle( xAxis->getTitleObject());
if( xAxisTitle.is())
rContainer.emplace_back( ::chart::ObjectIdentifier::createClassifiedIdentifierForObject( xAxisTitle, xChartModel ) );
}
@@ -109,17 +105,17 @@ namespace chart
void ObjectHierarchy::createTree( const rtl::Reference<::chart::ChartModel>& xChartDocument )
{
- m_aChildMap = tChildMap();//clear tree
+ m_aChildMap.clear();
if( !xChartDocument.is() )
return;
//@todo: change ObjectIdentifier to take an XChartDocument rather than XModel
- rtl::Reference< Diagram > xDiagram = ChartModelHelper::findDiagram( xChartDocument );
+ rtl::Reference< Diagram > xDiagram = xChartDocument->getFirstChartDiagram();
ObjectIdentifier aDiaOID;
if( xDiagram.is() )
aDiaOID = ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForObject( static_cast<cppu::OWeakObject*>(xDiagram.get()), xChartDocument ) );
- ObjectHierarchy::tChildContainer aTopLevelContainer;
+ tChildContainer aTopLevelContainer;
// First Level
@@ -150,8 +146,8 @@ void ObjectHierarchy::createTree( const rtl::Reference<::chart::ChartModel>& xCh
if( !m_bOrderingForElementSelector )
{
// Axis Titles. Note: These are interpreted of being top level
- const Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) );
- for( Reference< XAxis > const & axis : aAxes )
+ const std::vector< rtl::Reference< Axis > > aAxes = AxisHelper::getAllAxesOfDiagram( xDiagram );
+ for( rtl::Reference< Axis > const & axis : aAxes )
lcl_addAxisTitle( axis, aTopLevelContainer, xChartDocument );
// Diagram
@@ -162,7 +158,7 @@ void ObjectHierarchy::createTree( const rtl::Reference<::chart::ChartModel>& xCh
createDiagramTree( aTopLevelContainer, xChartDocument, xDiagram );
else
{
- ObjectHierarchy::tChildContainer aSubContainer;
+ tChildContainer aSubContainer;
createDiagramTree( aSubContainer, xChartDocument, xDiagram );
if( !aSubContainer.empty() )
m_aChildMap[ aDiaOID ] = aSubContainer;
@@ -183,13 +179,13 @@ void ObjectHierarchy::createTree( const rtl::Reference<::chart::ChartModel>& xCh
aTopLevelContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, u"" ) );
if( ! aTopLevelContainer.empty())
- m_aChildMap[ ObjectHierarchy::getRootNodeOID() ] = aTopLevelContainer;
+ m_aChildMap[ObjectHierarchy::getRootNodeOID()] = aTopLevelContainer;
}
void ObjectHierarchy::createLegendTree(
- ObjectHierarchy::tChildContainer & rContainer,
+ tChildContainer & rContainer,
const rtl::Reference<::chart::ChartModel> & xChartDoc,
- const Reference< XDiagram > & xDiagram )
+ const rtl::Reference< Diagram > & xDiagram )
{
if( !(xDiagram.is() && LegendHelper::hasLegend( xDiagram )) )
return;
@@ -200,9 +196,10 @@ void ObjectHierarchy::createLegendTree(
// iterate over child shapes of legend and search for matching CIDs
if( m_pExplicitValueProvider )
{
- Reference< container::XIndexAccess > xLegendShapeContainer(
- m_pExplicitValueProvider->getShapeForCID( aLegendOID.getObjectCID() ), uno::UNO_QUERY );
- ObjectHierarchy::tChildContainer aLegendEntryOIDs;
+ rtl::Reference< SvxShapeGroupAnyD > xLegendShapeContainer =
+ dynamic_cast<SvxShapeGroupAnyD*>(
+ m_pExplicitValueProvider->getShapeForCID( aLegendOID.getObjectCID() ).get() );
+ tChildContainer aLegendEntryOIDs;
lcl_getChildOIDs( aLegendEntryOIDs, xLegendShapeContainer );
m_aChildMap[ aLegendOID ] = aLegendEntryOIDs;
@@ -210,28 +207,35 @@ void ObjectHierarchy::createLegendTree(
}
void ObjectHierarchy::createAxesTree(
- ObjectHierarchy::tChildContainer & rContainer,
+ tChildContainer & rContainer,
const rtl::Reference<::chart::ChartModel> & xChartDoc,
- const Reference< XDiagram > & xDiagram )
+ const rtl::Reference< Diagram > & xDiagram )
{
- Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
- uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
+ sal_Int32 nDimensionCount = xDiagram->getDimension();
+ rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeByIndex( 0 ) );
bool bSupportsAxesGrids = ChartTypeHelper::isSupportingMainAxis( xChartType, nDimensionCount, 0 );
if( !bSupportsAxesGrids )
return;
- Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram, /* bOnlyVisible = */ true ) );
+ // Data Table
+ uno::Reference<chart2::XDataTable> xDataTable = xDiagram->getDataTable();
+ if (xDataTable.is())
+ {
+ rContainer.push_back(ObjectIdentifier::createClassifiedIdentifierForObject(xDataTable, xChartDoc));
+ }
+
+ // Axes
+ std::vector< rtl::Reference< Axis > > aAxes = AxisHelper::getAllAxesOfDiagram( xDiagram, /* bOnlyVisible = */ true );
if( !m_bOrderingForElementSelector )
{
- for (const auto & rAxis : std::as_const(aAxes))
+ for (const auto& rAxis : aAxes)
rContainer.push_back( ObjectIdentifier::createClassifiedIdentifierForObject( rAxis, xChartDoc ) );
}
// get all axes, also invisible ones
aAxes = AxisHelper::getAllAxesOfDiagram( xDiagram );
// Grids
- for( Reference< XAxis > const & xAxis : std::as_const(aAxes) )
+ for( rtl::Reference< Axis > const & xAxis : aAxes )
{
if(!xAxis.is())
continue;
@@ -253,19 +257,17 @@ void ObjectHierarchy::createAxesTree(
lcl_addAxisTitle( xAxis, rContainer, xChartDoc );
}
- Reference< beans::XPropertySet > xGridProperties( xAxis->getGridProperties() );
+ rtl::Reference< ::chart::GridProperties > xGridProperties( xAxis->getGridProperties2() );
if( AxisHelper::isGridVisible( xGridProperties ) )
{
//main grid
rContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartDoc ) );
}
- Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() );
- sal_Int32 nSubGrid = 0;
- for( nSubGrid = 0; nSubGrid < aSubGrids.getLength(); ++nSubGrid )
+ std::vector< rtl::Reference< ::chart::GridProperties > > aSubGrids( xAxis->getSubGridProperties2() );
+ for( size_t nSubGrid = 0; nSubGrid < aSubGrids.size(); ++nSubGrid )
{
- Reference< beans::XPropertySet > xSubGridProperties( aSubGrids[nSubGrid] );
- if( AxisHelper::isGridVisible( xSubGridProperties ) )
+ if( AxisHelper::isGridVisible( aSubGrids[nSubGrid] ) )
{
//sub grid
rContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierForGrid( xAxis, xChartDoc, nSubGrid ) );
@@ -275,12 +277,12 @@ void ObjectHierarchy::createAxesTree(
}
void ObjectHierarchy::createWallAndFloor(
- ObjectHierarchy::tChildContainer & rContainer,
- const Reference< XDiagram > & xDiagram )
+ tChildContainer & rContainer,
+ const rtl::Reference< Diagram > & xDiagram )
{
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+ sal_Int32 nDimensionCount = xDiagram->getDimension();
bool bIsThreeD = ( nDimensionCount == 3 );
- bool bHasWall = DiagramHelper::isSupportingFloorAndWall( xDiagram );
+ bool bHasWall = xDiagram->isSupportingFloorAndWall();
if( bHasWall && bIsThreeD )
{
rContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, u"" ) );
@@ -293,9 +295,9 @@ void ObjectHierarchy::createWallAndFloor(
}
void ObjectHierarchy::createDiagramTree(
- ObjectHierarchy::tChildContainer & rContainer,
+ tChildContainer & rContainer,
const rtl::Reference<::chart::ChartModel> & xChartDoc,
- const Reference< XDiagram > & xDiagram )
+ const rtl::Reference< Diagram > & xDiagram )
{
if( !m_bOrderingForElementSelector )
{
@@ -311,27 +313,23 @@ void ObjectHierarchy::createDiagramTree(
}
void ObjectHierarchy::createDataSeriesTree(
- ObjectHierarchy::tChildContainer & rOutDiagramSubContainer,
- const Reference< XDiagram > & xDiagram )
+ tChildContainer & rOutDiagramSubContainer,
+ const rtl::Reference< Diagram > & xDiagram )
{
- Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
-
try
{
- sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
- Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
- xCooSysCnt->getCoordinateSystems());
- for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx )
+ sal_Int32 nDimensionCount = xDiagram->getDimension();
+ std::vector< rtl::Reference< BaseCoordinateSystem > > aCooSysSeq(
+ xDiagram->getBaseCoordinateSystems());
+ for( std::size_t nCooSysIdx=0; nCooSysIdx<aCooSysSeq.size(); ++nCooSysIdx )
{
- Reference< XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW );
- Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes());
- for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypeSeq.getLength(); ++nCTIdx )
+ std::vector< rtl::Reference< ChartType > > aChartTypeSeq( aCooSysSeq[nCooSysIdx]->getChartTypes2());
+ for( std::size_t nCTIdx=0; nCTIdx<aChartTypeSeq.size(); ++nCTIdx )
{
- Reference< XChartType > xChartType( aChartTypeSeq[nCTIdx] );
- Reference< XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY_THROW );
- Sequence< Reference< XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries() );
+ rtl::Reference< ChartType > xChartType( aChartTypeSeq[nCTIdx] );
+ std::vector< rtl::Reference< DataSeries > > aSeriesSeq( xChartType->getDataSeries2() );
const sal_Int32 nNumberOfSeries =
- ChartTypeHelper::getNumberOfDisplayedSeries( xChartType, aSeriesSeq.getLength());
+ ChartTypeHelper::getNumberOfDisplayedSeries( xChartType, aSeriesSeq.size());
for( sal_Int32 nSeriesIdx=0; nSeriesIdx<nNumberOfSeries; ++nSeriesIdx )
{
@@ -342,9 +340,9 @@ void ObjectHierarchy::createDataSeriesTree(
ObjectIdentifier( ObjectIdentifier::createClassifiedIdentifierForParticle( aSeriesParticle ) ) );
rOutDiagramSubContainer.push_back( aSeriesOID );
- ObjectHierarchy::tChildContainer aSeriesSubContainer;
+ tChildContainer aSeriesSubContainer;
- Reference< chart2::XDataSeries > const & xSeries = aSeriesSeq[nSeriesIdx];
+ rtl::Reference< DataSeries > const & xSeries = aSeriesSeq[nSeriesIdx];
// data labels
if( DataSeriesHelper::hasDataLabelsAtSeries( xSeries ) )
@@ -356,45 +354,38 @@ void ObjectHierarchy::createDataSeriesTree(
// Statistics
if( ChartTypeHelper::isSupportingStatisticProperties( xChartType, nDimensionCount ) )
{
- Reference< chart2::XRegressionCurveContainer > xCurveCnt( xSeries, uno::UNO_QUERY );
- if( xCurveCnt.is())
+ const std::vector< rtl::Reference< RegressionCurveModel > > & rCurves( xSeries->getRegressionCurves2());
+ for( size_t nCurveIdx=0; nCurveIdx<rCurves.size(); ++nCurveIdx )
{
- Sequence< Reference< chart2::XRegressionCurve > > aCurves( xCurveCnt->getRegressionCurves());
- for( sal_Int32 nCurveIdx=0; nCurveIdx<aCurves.getLength(); ++nCurveIdx )
+ bool bIsAverageLine = RegressionCurveHelper::isMeanValueLine( rCurves[nCurveIdx] );
+ aSeriesSubContainer.emplace_back( ObjectIdentifier::createDataCurveCID( aSeriesParticle, nCurveIdx, bIsAverageLine ) );
+ if( RegressionCurveHelper::hasEquation( rCurves[nCurveIdx] ) )
{
- bool bIsAverageLine = RegressionCurveHelper::isMeanValueLine( aCurves[nCurveIdx] );
- aSeriesSubContainer.emplace_back( ObjectIdentifier::createDataCurveCID( aSeriesParticle, nCurveIdx, bIsAverageLine ) );
- if( RegressionCurveHelper::hasEquation( aCurves[nCurveIdx] ) )
- {
- aSeriesSubContainer.emplace_back( ObjectIdentifier::createDataCurveEquationCID( aSeriesParticle, nCurveIdx ) );
- }
+ aSeriesSubContainer.emplace_back( ObjectIdentifier::createDataCurveEquationCID( aSeriesParticle, nCurveIdx ) );
}
- Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
- Reference< beans::XPropertySet > xErrorBarProp;
- if( xSeriesProp.is() &&
- (xSeriesProp->getPropertyValue( CHART_UNONAME_ERRORBAR_Y) >>= xErrorBarProp) &&
- xErrorBarProp.is())
+ }
+ Reference< beans::XPropertySet > xErrorBarProp;
+ if( (xSeries->getPropertyValue( CHART_UNONAME_ERRORBAR_Y) >>= xErrorBarProp) &&
+ xErrorBarProp.is())
+ {
+ sal_Int32 nStyle = css::chart::ErrorBarStyle::NONE;
+ if( ( xErrorBarProp->getPropertyValue( "ErrorBarStyle") >>= nStyle ) &&
+ ( nStyle != css::chart::ErrorBarStyle::NONE ) )
{
- sal_Int32 nStyle = css::chart::ErrorBarStyle::NONE;
- if( ( xErrorBarProp->getPropertyValue( "ErrorBarStyle") >>= nStyle ) &&
- ( nStyle != css::chart::ErrorBarStyle::NONE ) )
- {
- aSeriesSubContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierWithParent(
- OBJECTTYPE_DATA_ERRORS_Y, u"", aSeriesParticle ) );
- }
+ aSeriesSubContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierWithParent(
+ OBJECTTYPE_DATA_ERRORS_Y, u"", aSeriesParticle ) );
}
+ }
- if( xSeriesProp.is() &&
- (xSeriesProp->getPropertyValue(CHART_UNONAME_ERRORBAR_X) >>= xErrorBarProp) &&
- xErrorBarProp.is())
+ if( (xSeries->getPropertyValue(CHART_UNONAME_ERRORBAR_X) >>= xErrorBarProp) &&
+ xErrorBarProp.is())
+ {
+ sal_Int32 nStyle = css::chart::ErrorBarStyle::NONE;
+ if( ( xErrorBarProp->getPropertyValue( "ErrorBarStyle") >>= nStyle ) &&
+ ( nStyle != css::chart::ErrorBarStyle::NONE ) )
{
- sal_Int32 nStyle = css::chart::ErrorBarStyle::NONE;
- if( ( xErrorBarProp->getPropertyValue( "ErrorBarStyle") >>= nStyle ) &&
- ( nStyle != css::chart::ErrorBarStyle::NONE ) )
- {
- aSeriesSubContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierWithParent(
- OBJECTTYPE_DATA_ERRORS_X, u"", aSeriesParticle ) );
- }
+ aSeriesSubContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierWithParent(
+ OBJECTTYPE_DATA_ERRORS_X, u"", aSeriesParticle ) );
}
}
}
@@ -403,8 +394,9 @@ void ObjectHierarchy::createDataSeriesTree(
// iterate over child shapes of legend and search for matching CIDs
if( m_pExplicitValueProvider )
{
- Reference< container::XIndexAccess > xSeriesShapeContainer(
- m_pExplicitValueProvider->getShapeForCID( aSeriesOID.getObjectCID() ), uno::UNO_QUERY );
+ rtl::Reference< SvxShapeGroupAnyD > xSeriesShapeContainer =
+ dynamic_cast<SvxShapeGroupAnyD*>(
+ m_pExplicitValueProvider->getShapeForCID( aSeriesOID.getObjectCID() ).get() );
lcl_getChildOIDs( aSeriesSubContainer, xSeriesShapeContainer );
}
@@ -420,7 +412,7 @@ void ObjectHierarchy::createDataSeriesTree(
}
}
-void ObjectHierarchy::createAdditionalShapesTree( ObjectHierarchy::tChildContainer& rContainer )
+void ObjectHierarchy::createAdditionalShapesTree(tChildContainer& rContainer)
{
try
{
@@ -467,7 +459,7 @@ const ObjectHierarchy::tChildContainer & ObjectHierarchy::getChildren( const Obj
if( aIt != m_aChildMap.end())
return aIt->second;
}
- static const ObjectHierarchy::tChildContainer EMPTY;
+ static const tChildContainer EMPTY;
return EMPTY;
}
@@ -477,13 +469,13 @@ const ObjectHierarchy::tChildContainer & ObjectHierarchy::getSiblings( const Obj
{
for (auto const& child : m_aChildMap)
{
- ObjectHierarchy::tChildContainer::const_iterator aElemIt(
+ tChildContainer::const_iterator aElemIt(
std::find( child.second.begin(), child.second.end(), rNode ));
if( aElemIt != child.second.end())
return child.second;
}
}
- static const ObjectHierarchy::tChildContainer EMPTY;
+ static const tChildContainer EMPTY;
return EMPTY;
}
@@ -492,8 +484,8 @@ ObjectIdentifier ObjectHierarchy::getParentImpl(
const ObjectIdentifier & rOID ) const
{
// search children
- ObjectHierarchy::tChildContainer aChildren( getChildren( rParentOID ));
- ObjectHierarchy::tChildContainer::const_iterator aIt(
+ tChildContainer aChildren( getChildren( rParentOID ));
+ tChildContainer::const_iterator aIt(
std::find( aChildren.begin(), aChildren.end(), rOID ));
// recursion end
if( aIt != aChildren.end())
@@ -568,11 +560,11 @@ sal_Int32 ObjectHierarchy::getIndexInParent(
}
ObjectKeyNavigation::ObjectKeyNavigation(
- const ObjectIdentifier & rCurrentOID,
- const rtl::Reference<::chart::ChartModel> & xChartDocument,
+ ObjectIdentifier aCurrentOID,
+ rtl::Reference<::chart::ChartModel> xChartDocument,
ExplicitValueProvider * pExplicitValueProvider /* = 0 */ ) :
- m_aCurrentOID( rCurrentOID ),
- m_xChartDocument( xChartDocument ),
+ m_aCurrentOID(std::move( aCurrentOID )),
+ m_xChartDocument(std::move( xChartDocument )),
m_pExplicitValueProvider( pExplicitValueProvider )
{
if ( !m_aCurrentOID.isValid() )