tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / chart2 / source / controller / inc / ObjectHierarchy.hxx
blob1531866aaf2b3b7917bb559fe520d6888f4ceee0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #pragma once
21 #include <ChartModel.hxx>
22 #include <ObjectIdentifier.hxx>
23 #include <map>
24 #include <vector>
26 namespace com::sun::star::awt { struct KeyEvent; }
27 namespace com::sun::star::chart2 { class XChartDocument; }
29 namespace chart
32 class ExplicitValueProvider;
34 class ObjectHierarchy
36 public:
37 typedef std::vector< ObjectIdentifier > tChildContainer;
39 /** @param bFlattenDiagram
40 If <TRUE/>, the content of the diagram (data series, wall, floor,
41 etc.) is treated as being at the same level as the diagram. (This is
42 used for keyboard navigation).
44 explicit ObjectHierarchy(
45 const rtl::Reference<::chart::ChartModel> & xChartDocument,
46 ExplicitValueProvider * pExplicitValueProvider,
47 bool bFlattenDiagram = false,
48 bool bOrderingForElementSelector = false );
49 ~ObjectHierarchy();
51 static ObjectIdentifier getRootNodeOID();
52 static bool isRootNode( const ObjectIdentifier& rOID );
54 /// equal to getChildren( getRootNodeOID())
55 const tChildContainer& getTopLevelChildren() const;
56 bool hasChildren(const ObjectIdentifier& rParent) const;
57 const tChildContainer& getChildren(const ObjectIdentifier& rParent) const;
58 const tChildContainer& getSiblings(const ObjectIdentifier& rNode) const;
60 /// The result is empty, if the node cannot be found in the tree
61 ObjectIdentifier getParent( const ObjectIdentifier& rNode ) const;
62 /// @returns -1, if no parent can be determined
63 sal_Int32 getIndexInParent( const ObjectIdentifier& rNode ) const;
65 private:
66 void createTree( const rtl::Reference<::chart::ChartModel> & xChartDocument );
67 void createAxesTree(
68 tChildContainer & rContainer,
69 const rtl::Reference<::chart::ChartModel> & xChartDoc,
70 const rtl::Reference< ::chart::Diagram > & xDiagram );
71 void createDiagramTree(
72 tChildContainer& rContainer,
73 const rtl::Reference<::chart::ChartModel>& xChartDoc,
74 const rtl::Reference< ::chart::Diagram >& xDiagram );
75 void createDataSeriesTree(
76 tChildContainer & rOutDiagramSubContainer,
77 const rtl::Reference< ::chart::Diagram > & xDiagram );
78 static void createWallAndFloor(
79 tChildContainer & rContainer,
80 const rtl::Reference< ::chart::Diagram > & xDiagram );
81 void createLegendTree(
82 tChildContainer & rContainer,
83 const rtl::Reference<::chart::ChartModel> & xChartDoc,
84 const rtl::Reference< ::chart::Diagram > & xDiagram );
85 void createAdditionalShapesTree(tChildContainer& rContainer);
86 ObjectIdentifier getParentImpl(
87 const ObjectIdentifier& rParentOID,
88 const ObjectIdentifier& rOID ) const;
90 typedef std::map<ObjectIdentifier, tChildContainer> tChildMap;
91 tChildMap m_aChildMap;
92 ExplicitValueProvider* m_pExplicitValueProvider;
93 bool m_bFlattenDiagram;
94 bool m_bOrderingForElementSelector;
97 class ObjectKeyNavigation
99 public:
100 explicit ObjectKeyNavigation( ObjectIdentifier aCurrentOID,
101 rtl::Reference<::chart::ChartModel> xChartDocument,
102 ExplicitValueProvider * pExplicitValueProvider );
104 bool handleKeyEvent( const css::awt::KeyEvent & rEvent );
105 const ObjectIdentifier& getCurrentSelection() const { return m_aCurrentOID;}
107 private:
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();
118 ObjectIdentifier m_aCurrentOID;
119 rtl::Reference<::chart::ChartModel> m_xChartDocument;
120 ExplicitValueProvider * m_pExplicitValueProvider;
123 } // namespace chart
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */