merge the formfield patch from ooo-build
[ooovba.git] / chart2 / source / controller / inc / ObjectHierarchy.hxx
blob4d8df3e497dee9b137b40356d037800895e78253
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ObjectHierarchy.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef CHART2_OBJECTHIERARCHY_HXX
31 #define CHART2_OBJECTHIERARCHY_HXX
33 #include <rtl/ustring.hxx>
34 #include <com/sun/star/chart2/XChartDocument.hpp>
35 #include <com/sun/star/awt/KeyEvent.hpp>
37 #include <memory>
38 #include <vector>
40 namespace chart
43 class ExplicitValueProvider;
45 namespace impl
47 class ImplObjectHierarchy;
50 class ObjectHierarchy
52 public:
53 typedef ::rtl::OUString tCID;
54 typedef ::std::vector< tCID > tChildContainer;
56 /** @param bFlattenDiagram
57 If <TRUE/>, the content of the diaram (data series, wall, floor,
58 etc.) is treated as being at the same level as the diagram. (This is
59 used for keyboard navigation).
61 explicit ObjectHierarchy(
62 const ::com::sun::star::uno::Reference<
63 ::com::sun::star::chart2::XChartDocument > & xChartDocument,
64 ExplicitValueProvider * pExplicitValueProvider = 0,
65 bool bFlattenDiagram = false,
66 bool bOrderingForElementSelector = false );
67 ~ObjectHierarchy();
69 static tCID getRootNodeCID();
70 static bool isRootNode( const tCID & rCID );
72 /// equal to getChildren( getRootNodeCID())
73 tChildContainer getTopLevelChildren() const;
74 bool hasChildren( const tCID & rParent ) const;
75 tChildContainer getChildren( const tCID & rParent ) const;
77 tChildContainer getSiblings( const tCID & rNode ) const;
79 /// The result is empty, if the node cannot be found in the tree
80 tCID getParent( const tCID & rNode ) const;
81 /// @returns -1, if no parent can be determined
82 sal_Int32 getIndexInParent( const tCID & rNode ) const;
84 private:
86 ::std::auto_ptr< impl::ImplObjectHierarchy > m_apImpl;
89 class ObjectKeyNavigation
91 public:
92 explicit ObjectKeyNavigation( const ObjectHierarchy::tCID & rCurrentCID,
93 const ::com::sun::star::uno::Reference<
94 ::com::sun::star::chart2::XChartDocument > & xChartDocument,
95 ExplicitValueProvider * pExplicitValueProvider = 0 );
97 bool handleKeyEvent( const ::com::sun::star::awt::KeyEvent & rEvent );
98 ObjectHierarchy::tCID getCurrentSelection() const;
100 private:
101 void setCurrentSelection( const ObjectHierarchy::tCID & rCID );
102 bool first();
103 bool last();
104 bool next();
105 bool previous();
106 bool up();
107 bool down();
108 bool veryFirst();
109 bool veryLast();
111 ObjectHierarchy::tCID m_aCurrentCID;
112 ::com::sun::star::uno::Reference<
113 ::com::sun::star::chart2::XChartDocument > m_xChartDocument;
114 ExplicitValueProvider * m_pExplicitValueProvider;
115 bool m_bStepDownInDiagram;
118 } // namespace chart
120 // CHART2_OBJECTHIERARCHY_HXX
121 #endif