Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / chart2 / source / inc / ExplicitCategoriesProvider.hxx
blob9e6cfa35a430683bd3bae774ba5c311e99668100
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_INC_EXPLICITCATEGORIESPROVIDER_HXX
20 #define INCLUDED_CHART2_SOURCE_INC_EXPLICITCATEGORIESPROVIDER_HXX
22 #include "charttoolsdllapi.hxx"
23 #include <cppuhelper/weakref.hxx>
24 #include <com/sun/star/uno/Reference.h>
25 #include <com/sun/star/uno/Sequence.h>
27 #include <vector>
29 namespace chart { class ChartModel; }
30 namespace com { namespace sun { namespace star { namespace chart2 { class XCoordinateSystem; } } } }
31 namespace com { namespace sun { namespace star { namespace chart2 { namespace data { class XDataSequence; } } } } }
32 namespace com { namespace sun { namespace star { namespace chart2 { namespace data { class XLabeledDataSequence; } } } } }
33 namespace com { namespace sun { namespace star { namespace uno { class Any; } } } }
35 namespace chart
38 struct OOO_DLLPUBLIC_CHARTTOOLS ComplexCategory
40 OUString Text;
41 sal_Int32 Count;
43 ComplexCategory( const OUString& rText, sal_Int32 nCount ) : Text( rText ), Count (nCount)
47 class OOO_DLLPUBLIC_CHARTTOOLS SplitCategoriesProvider
49 public:
50 virtual ~SplitCategoriesProvider();
52 virtual sal_Int32 getLevelCount() const = 0;
53 virtual css::uno::Sequence< OUString > getStringsForLevel( sal_Int32 nIndex ) const = 0;
56 class OOO_DLLPUBLIC_CHARTTOOLS ExplicitCategoriesProvider final
58 public:
59 ExplicitCategoriesProvider( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSysModel
60 , ChartModel& rChartModel
62 ~ExplicitCategoriesProvider();
64 void init();
66 css::uno::Reference< css::chart2::data::XDataSequence > getOriginalCategories();
68 css::uno::Sequence< OUString > const & getSimpleCategories();
69 const std::vector<ComplexCategory>* getCategoriesByLevel( sal_Int32 nLevel );
71 static OUString getCategoryByIndex(
72 const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSysModel
73 , ChartModel& rModel
74 , sal_Int32 nIndex );
76 static css::uno::Sequence< OUString > getExplicitSimpleCategories(
77 const SplitCategoriesProvider& rSplitCategoriesProvider );
79 static void convertCategoryAnysToText( css::uno::Sequence< OUString >& rOutTexts
80 , const css::uno::Sequence< css::uno::Any >& rInAnys
81 , ChartModel& rModel );
83 bool hasComplexCategories() const;
84 sal_Int32 getCategoryLevelCount() const;
86 const css::uno::Sequence< css::uno::Reference<
87 css::chart2::data::XLabeledDataSequence> >& getSplitCategoriesList() const { return m_aSplitCategoriesList;}
89 bool isDateAxis();
90 const std::vector< double >& getDateCategories();
92 private:
93 ExplicitCategoriesProvider(ExplicitCategoriesProvider const &) = delete;
94 ExplicitCategoriesProvider& operator =(ExplicitCategoriesProvider const &) = delete;
96 bool volatile m_bDirty;
97 css::uno::WeakReference< css::chart2::XCoordinateSystem > m_xCooSysModel;
98 ChartModel& mrModel;
99 css::uno::Reference< css::chart2::data::XLabeledDataSequence> m_xOriginalCategories;
101 bool m_bIsExplicitCategoriesInited;
102 css::uno::Sequence< OUString > m_aExplicitCategories;
103 std::vector< std::vector< ComplexCategory > > m_aComplexCats;
104 css::uno::Sequence< css::uno::Reference<
105 css::chart2::data::XLabeledDataSequence> > m_aSplitCategoriesList;
107 bool m_bIsDateAxis;
108 bool m_bIsAutoDate;
109 std::vector< double > m_aDateCategories;
112 } // namespace chart
114 // INCLUDED_CHART2_SOURCE_INC_EXPLICITCATEGORIESPROVIDER_HXX
115 #endif
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */