LibreOffice Module chart2 (master) 1
ObjectHierarchy.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#pragma once
20
21#include <ChartModel.hxx>
22#include <ObjectIdentifier.hxx>
23#include <map>
24#include <vector>
25
26namespace com::sun::star::awt { struct KeyEvent; }
27namespace com::sun::star::chart2 { class XChartDocument; }
28
29namespace chart
30{
31
32class ExplicitValueProvider;
33
35{
36public:
37 typedef std::vector< ObjectIdentifier > tChildContainer;
38
44 explicit ObjectHierarchy(
45 const rtl::Reference<::chart::ChartModel> & xChartDocument,
46 ExplicitValueProvider * pExplicitValueProvider,
47 bool bFlattenDiagram = false,
48 bool bOrderingForElementSelector = false );
50
52 static bool isRootNode( const ObjectIdentifier& rOID );
53
56 bool hasChildren(const ObjectIdentifier& rParent) const;
57 const tChildContainer& getChildren(const ObjectIdentifier& rParent) const;
58 const tChildContainer& getSiblings(const ObjectIdentifier& rNode) const;
59
61 ObjectIdentifier getParent( const ObjectIdentifier& rNode ) const;
63 sal_Int32 getIndexInParent( const ObjectIdentifier& rNode ) const;
64
65private:
66 void createTree( const rtl::Reference<::chart::ChartModel> & xChartDocument );
67 void createAxesTree(
68 tChildContainer & rContainer,
70 const rtl::Reference< ::chart::Diagram > & xDiagram );
72 tChildContainer& rContainer,
74 const rtl::Reference< ::chart::Diagram >& xDiagram );
76 tChildContainer & rOutDiagramSubContainer,
77 const rtl::Reference< ::chart::Diagram > & xDiagram );
78 static void createWallAndFloor(
79 tChildContainer & rContainer,
80 const rtl::Reference< ::chart::Diagram > & xDiagram );
82 tChildContainer & rContainer,
84 const rtl::Reference< ::chart::Diagram > & xDiagram );
87 const ObjectIdentifier& rParentOID,
88 const ObjectIdentifier& rOID ) const;
89
90 typedef std::map<ObjectIdentifier, tChildContainer> tChildMap;
92 ExplicitValueProvider* m_pExplicitValueProvider;
95};
96
98{
99public:
100 explicit ObjectKeyNavigation( ObjectIdentifier aCurrentOID,
102 ExplicitValueProvider * pExplicitValueProvider );
103
104 bool handleKeyEvent( const css::awt::KeyEvent & rEvent );
106
107private:
108 void setCurrentSelection( const ObjectIdentifier& rOID );
109 bool first();
110 bool last();
111 bool next();
112 bool previous();
113 bool up();
114 bool down();
115 bool veryFirst();
116 bool veryLast();
117
120 ExplicitValueProvider * m_pExplicitValueProvider;
121};
122
123} // namespace chart
124
125/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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)
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
std::map< ObjectIdentifier, tChildContainer > tChildMap
static void createWallAndFloor(tChildContainer &rContainer, const rtl::Reference< ::chart::Diagram > &xDiagram)
const ObjectIdentifier & getCurrentSelection() const
ObjectKeyNavigation(ObjectIdentifier aCurrentOID, rtl::Reference<::chart::ChartModel > xChartDocument, ExplicitValueProvider *pExplicitValueProvider)
bool handleKeyEvent(const css::awt::KeyEvent &rEvent)
ExplicitValueProvider * m_pExplicitValueProvider
void setCurrentSelection(const ObjectIdentifier &rOID)
rtl::Reference<::chart::ChartModel > m_xChartDocument