38#include <unonames.hxx>
45#include <com/sun/star/drawing/XShapes.hpp>
46#include <com/sun/star/chart/ErrorBarStyle.hpp>
48#include <com/sun/star/container/XIndexAccess.hpp>
49#include <com/sun/star/awt/Key.hpp>
50#include <com/sun/star/awt/KeyModifier.hpp>
57using ::com::sun::star::uno::Reference;
58using ::com::sun::star::uno::Sequence;
65 const Reference< container::XIndexAccess >& xShapes )
70 sal_Int32
nCount = xShapes->getCount();
73 Reference< beans::XPropertySet > xShapeProp( xShapes->getByIndex( i ), uno::UNO_QUERY );
76 Reference< beans::XPropertySetInfo > xInfo( xShapeProp->getPropertySetInfo());
79 xInfo->hasPropertyByName(
"Name") &&
80 (xShapeProp->getPropertyValue(
"Name") >>= aName ) &&
84 rOutChildren.emplace_back( aName );
86 Reference< container::XIndexAccess > xNewShapes( xShapeProp, uno::UNO_QUERY );
88 lcl_getChildOIDs( rOutChildren, xNewShapes );
97 Reference< XTitle > xAxisTitle( xAxis->getTitleObject());
112 if( !xChartDocument.is() )
130 aTopLevelContainer.push_back( aDiaOID );
153 lcl_addAxisTitle( axis, aTopLevelContainer, xChartDocument );
156 aTopLevelContainer.push_back( aDiaOID );
165 if( !aSubContainer.empty() )
183 if( ! aTopLevelContainer.empty())
196 rContainer.push_back( aLegendOID );
205 lcl_getChildOIDs( aLegendEntryOIDs, xLegendShapeContainer );
216 sal_Int32 nDimensionCount = xDiagram->getDimension();
219 if( !bSupportsAxesGrids )
233 for (
const auto & rAxis : std::as_const(aAxes))
245 sal_Int32 nCooSysIndex = 0;
246 sal_Int32 nDimensionIndex = 0;
247 sal_Int32 nAxisIndex = 0;
259 lcl_addAxisTitle( xAxis, rContainer, xChartDoc );
269 std::vector< rtl::Reference< ::chart::GridProperties > > aSubGrids( xAxis->getSubGridProperties2() );
270 for(
size_t nSubGrid = 0; nSubGrid < aSubGrids.size(); ++nSubGrid )
285 sal_Int32 nDimensionCount = xDiagram->getDimension();
286 bool bIsThreeD = ( nDimensionCount == 3 );
287 bool bHasWall = xDiagram->isSupportingFloorAndWall();
288 if( bHasWall && bIsThreeD )
323 sal_Int32 nDimensionCount = xDiagram->getDimension();
324 std::vector< rtl::Reference< BaseCoordinateSystem > > aCooSysSeq(
325 xDiagram->getBaseCoordinateSystems());
326 for( std::size_t nCooSysIdx=0; nCooSysIdx<aCooSysSeq.size(); ++nCooSysIdx )
328 std::vector< rtl::Reference< ChartType > > aChartTypeSeq( aCooSysSeq[nCooSysIdx]->getChartTypes2());
329 for( std::size_t nCTIdx=0; nCTIdx<aChartTypeSeq.size(); ++nCTIdx )
332 std::vector< rtl::Reference< DataSeries > > aSeriesSeq( xChartType->getDataSeries2() );
333 const sal_Int32 nNumberOfSeries =
336 for( sal_Int32 nSeriesIdx=0; nSeriesIdx<nNumberOfSeries; ++nSeriesIdx )
338 OUString aSeriesParticle(
340 0, nCooSysIdx, nCTIdx, nSeriesIdx ));
343 rOutDiagramSubContainer.push_back( aSeriesOID );
359 const std::vector< rtl::Reference< RegressionCurveModel > > & rCurves( xSeries->getRegressionCurves2());
360 for(
size_t nCurveIdx=0; nCurveIdx<rCurves.size(); ++nCurveIdx )
373 sal_Int32 nStyle = css::chart::ErrorBarStyle::NONE;
374 if( ( xErrorBarProp->getPropertyValue(
"ErrorBarStyle") >>= nStyle ) &&
375 ( nStyle != css::chart::ErrorBarStyle::NONE ) )
385 sal_Int32 nStyle = css::chart::ErrorBarStyle::NONE;
386 if( ( xErrorBarProp->getPropertyValue(
"ErrorBarStyle") >>= nStyle ) &&
387 ( nStyle != css::chart::ErrorBarStyle::NONE ) )
402 lcl_getChildOIDs( aSeriesSubContainer, xSeriesShapeContainer );
405 if( ! aSeriesSubContainer.empty())
411 catch(
const uno::Exception & )
425 sal_Int32
nCount = xDrawPage->getCount();
429 if ( xDrawPage->getByIndex(
i ) >>= xShape )
431 if ( xShape.is() && xShape != xChartRoot )
433 rContainer.emplace_back( xShape );
439 catch (
const uno::Exception& )
449 tChildMap::const_iterator aIt(
m_aChildMap.find( rParent ));
451 return ! (aIt->second.empty());
460 tChildMap::const_iterator aIt(
m_aChildMap.find( rParent ));
474 tChildContainer::const_iterator aElemIt(
475 std::find( child.second.begin(), child.second.end(), rNode ));
476 if( aElemIt != child.second.end())
490 tChildContainer::const_iterator aIt(
491 std::find( aChildren.begin(), aChildren.end(), rOID ));
493 if( aIt != aChildren.end())
496 for (
auto const& child : aChildren)
519 ExplicitValueProvider * pExplicitValueProvider ,
520 bool bFlattenDiagram ,
521 bool bOrderingForElementSelector ) :
522 m_pExplicitValueProvider( pExplicitValueProvider ),
523 m_bFlattenDiagram( bFlattenDiagram ),
524 m_bOrderingForElementSelector( bOrderingForElementSelector )
555 for (
auto const& child : aChildren)
557 if ( child == rNode )
567 ExplicitValueProvider * pExplicitValueProvider ) :
568 m_aCurrentOID(
std::move( aCurrentOID )),
569 m_xChartDocument(
std::move( xChartDocument )),
570 m_pExplicitValueProvider( pExplicitValueProvider )
579 const awt::KeyEvent & rEvent )
581 bool bResult =
false;
583 switch( rEvent.KeyCode )
586 if( rEvent.Modifiers & awt::KeyModifier::SHIFT )
598 if( rEvent.Modifiers & awt::KeyModifier::SHIFT )
603 case awt::Key::ESCAPE:
623 bool bResult = !aSiblings.empty();
635 bool bResult = !aSiblings.empty();
647 bool bResult = !aSiblings.empty();
650 ObjectHierarchy::tChildContainer::const_iterator aIt(
652 assert(aIt != aSiblings.end());
653 if( ++aIt == aSiblings.end())
654 aIt = aSiblings.begin();
667 bool bResult = !aSiblings.empty();
670 ObjectHierarchy::tChildContainer::const_iterator aIt(
672 OSL_ASSERT( aIt != aSiblings.end());
673 if( aIt == aSiblings.begin())
674 aIt = aSiblings.end();
699 OSL_ASSERT( !aChildren.empty());
709 bool bResult = !aChildren.empty();
719 bool bResult = !aChildren.empty();
static std::vector< rtl::Reference< ::chart::Axis > > getAllAxesOfDiagram(const rtl::Reference< ::chart::Diagram > &xDiagram, bool bOnlyVisible=false)
static bool isGridVisible(const rtl::Reference< ::chart::GridProperties > &xGridProperties)
static bool getIndicesForAxis(const rtl::Reference< ::chart::Axis > &xAxis, const rtl::Reference< ::chart::BaseCoordinateSystem > &xCooSys, sal_Int32 &rOutDimensionIndex, sal_Int32 &rOutAxisIndex)
static bool isAxisVisible(const rtl::Reference< ::chart::Axis > &xAxis)
static sal_Int32 getNumberOfDisplayedSeries(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nNumberOfSeries)
static bool isSupportingMainAxis(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex)
static bool isSupportingStatisticProperties(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount)
static bool isSupportingSecondaryAxis(const rtl::Reference< ::chart::ChartType > &xChartType, sal_Int32 nDimensionCount)
static rtl::Reference< SvxShapeGroupAnyD > getChartRootShape(const rtl::Reference< SvxDrawPage > &xPage)
static bool hasLegend(const rtl::Reference< ::chart::Diagram > &xDiagram)
returns <FALSE>, if either there is no legend at the diagram, or there is a legend which has a "Show"...
ObjectIdentifier getParentImpl(const ObjectIdentifier &rParentOID, const ObjectIdentifier &rOID) const
void createDiagramTree(tChildContainer &rContainer, const rtl::Reference<::chart::ChartModel > &xChartDoc, const rtl::Reference< ::chart::Diagram > &xDiagram)
bool m_bOrderingForElementSelector
static ObjectIdentifier getRootNodeOID()
const tChildContainer & getTopLevelChildren() const
equal to getChildren( getRootNodeOID())
std::vector< ObjectIdentifier > tChildContainer
ExplicitValueProvider * m_pExplicitValueProvider
void createAxesTree(tChildContainer &rContainer, const rtl::Reference<::chart::ChartModel > &xChartDoc, const rtl::Reference< ::chart::Diagram > &xDiagram)
ObjectIdentifier getParent(const ObjectIdentifier &rNode) const
The result is empty, if the node cannot be found in the tree.
sal_Int32 getIndexInParent(const ObjectIdentifier &rNode) const
static bool isRootNode(const ObjectIdentifier &rOID)
const tChildContainer & getChildren(const ObjectIdentifier &rParent) const
void createTree(const rtl::Reference<::chart::ChartModel > &xChartDocument)
void createDataSeriesTree(tChildContainer &rOutDiagramSubContainer, const rtl::Reference< ::chart::Diagram > &xDiagram)
bool hasChildren(const ObjectIdentifier &rParent) const
void createLegendTree(tChildContainer &rContainer, const rtl::Reference<::chart::ChartModel > &xChartDoc, const rtl::Reference< ::chart::Diagram > &xDiagram)
void createAdditionalShapesTree(tChildContainer &rContainer)
ObjectHierarchy(const rtl::Reference<::chart::ChartModel > &xChartDocument, ExplicitValueProvider *pExplicitValueProvider, bool bFlattenDiagram=false, bool bOrderingForElementSelector=false)
const tChildContainer & getSiblings(const ObjectIdentifier &rNode) const
static void createWallAndFloor(tChildContainer &rContainer, const rtl::Reference< ::chart::Diagram > &xDiagram)
static OUString createClassifiedIdentifierForParticle(std::u16string_view rParticle)
static OUString createDataCurveEquationCID(std::u16string_view rSeriesParticle, sal_Int32 nCurveIndex)
static bool isCID(std::u16string_view rName)
static OUString getStringForType(ObjectType eObjectType)
const OUString & getObjectCID() const
static OUString createDataCurveCID(std::u16string_view rSeriesParticle, sal_Int32 nCurveIndex, bool bAverageLine)
static OUString createClassifiedIdentifier(enum ObjectType eObjectType, std::u16string_view rParticleID)
static OUString createClassifiedIdentifierForParticles(std::u16string_view rParentParticle, std::u16string_view rChildParticle, std::u16string_view rDragMethodServiceName=std::u16string_view(), std::u16string_view rDragParameterString=std::u16string_view())
static OUString createClassifiedIdentifierWithParent(enum ObjectType, std::u16string_view rParticleID, std::u16string_view rParentPartical, std::u16string_view rDragMethodServiceName=std::u16string_view(), std::u16string_view rDragParameterString=std::u16string_view())
static OUString createParticleForSeries(sal_Int32 nDiagramIndex, sal_Int32 nCooSysIndex, sal_Int32 nChartTypeIndex, sal_Int32 nSeriesIndex)
static OUString createClassifiedIdentifierForGrid(const css::uno::Reference< css::chart2::XAxis > &xAxis, const rtl::Reference<::chart::ChartModel > &xChartModel, sal_Int32 nSubIndex=-1)
static OUString createClassifiedIdentifierForObject(const css::uno::Reference< css::uno::XInterface > &xObject, const rtl::Reference<::chart::ChartModel > &xChartModel)
const ObjectIdentifier & getCurrentSelection() const
ObjectKeyNavigation(ObjectIdentifier aCurrentOID, rtl::Reference<::chart::ChartModel > xChartDocument, ExplicitValueProvider *pExplicitValueProvider)
ObjectIdentifier m_aCurrentOID
bool handleKeyEvent(const css::awt::KeyEvent &rEvent)
ExplicitValueProvider * m_pExplicitValueProvider
void setCurrentSelection(const ObjectIdentifier &rOID)
rtl::Reference<::chart::ChartModel > m_xChartDocument
#define DBG_UNHANDLED_EXCEPTION(...)
OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtSeries(const rtl::Reference< ::chart::DataSeries > &xSeries)
OOO_DLLPUBLIC_CHARTTOOLS bool isMeanValueLine(const css::uno::Reference< css::chart2::XRegressionCurve > &xRegCurve)
OOO_DLLPUBLIC_CHARTTOOLS bool hasEquation(const css::uno::Reference< css::chart2::XRegressionCurve > &xCurve)
@ OBJECTTYPE_DATA_ERRORS_X
@ OBJECTTYPE_DIAGRAM_FLOOR
@ OBJECTTYPE_DATA_ERRORS_Y
@ OBJECTTYPE_DIAGRAM_WALL
constexpr OUStringLiteral EMPTY
constexpr OUStringLiteral CHART_UNONAME_ERRORBAR_Y
constexpr OUStringLiteral CHART_UNONAME_ERRORBAR_X