Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / chart2 / source / controller / inc / ObjectHierarchy.hxx
blob10b95b95194902c33233e62db96153741aea231b
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 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_OBJECTHIERARCHY_HXX
20 #define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_OBJECTHIERARCHY_HXX
22 #include <ObjectIdentifier.hxx>
24 namespace com { namespace sun { namespace star { namespace awt { struct KeyEvent; } } } }
25 namespace com { namespace sun { namespace star { namespace chart2 { class XChartDocument; } } } }
27 #include <memory>
28 #include <vector>
30 namespace chart
33 class ExplicitValueProvider;
35 namespace impl
37 class ImplObjectHierarchy;
40 class ObjectHierarchy
42 public:
43 typedef std::vector< ObjectIdentifier > tChildContainer;
45 /** @param bFlattenDiagram
46 If <TRUE/>, the content of the diagram (data series, wall, floor,
47 etc.) is treated as being at the same level as the diagram. (This is
48 used for keyboard navigation).
50 explicit ObjectHierarchy(
51 const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument,
52 ExplicitValueProvider * pExplicitValueProvider,
53 bool bFlattenDiagram = false,
54 bool bOrderingForElementSelector = false );
55 ~ObjectHierarchy();
57 static ObjectIdentifier getRootNodeOID();
58 static bool isRootNode( const ObjectIdentifier& rOID );
60 /// equal to getChildren( getRootNodeOID())
61 tChildContainer getTopLevelChildren() const;
62 bool hasChildren( const ObjectIdentifier& rParent ) const;
63 tChildContainer getChildren( const ObjectIdentifier& rParent ) const;
65 tChildContainer getSiblings( const ObjectIdentifier& rNode ) const;
67 /// The result is empty, if the node cannot be found in the tree
68 ObjectIdentifier getParent( const ObjectIdentifier& rNode ) const;
69 /// @returns -1, if no parent can be determined
70 sal_Int32 getIndexInParent( const ObjectIdentifier& rNode ) const;
72 private:
74 std::unique_ptr< impl::ImplObjectHierarchy > m_apImpl;
77 class ObjectKeyNavigation
79 public:
80 explicit ObjectKeyNavigation( const ObjectIdentifier & rCurrentOID,
81 const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument,
82 ExplicitValueProvider * pExplicitValueProvider );
84 bool handleKeyEvent( const css::awt::KeyEvent & rEvent );
85 const ObjectIdentifier& getCurrentSelection() const { return m_aCurrentOID;}
87 private:
88 void setCurrentSelection( const ObjectIdentifier& rOID );
89 bool first();
90 bool last();
91 bool next();
92 bool previous();
93 bool up();
94 bool down();
95 bool veryFirst();
96 bool veryLast();
98 ObjectIdentifier m_aCurrentOID;
99 css::uno::Reference< css::chart2::XChartDocument > m_xChartDocument;
100 ExplicitValueProvider * m_pExplicitValueProvider;
103 } // namespace chart
105 // INCLUDED_CHART2_SOURCE_CONTROLLER_INC_OBJECTHIERARCHY_HXX
106 #endif
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */