bump product version to 4.1.6.2
[LibreOffice.git] / chart2 / source / inc / ExplicitCategoriesProvider.hxx
bloba8feca5510327323ed732414fc3ca4fdc0004ed6
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 CHART2_VIEW_EXPLICITCATEGORIESPROVIDER_HXX
20 #define CHART2_VIEW_EXPLICITCATEGORIESPROVIDER_HXX
22 #include "ServiceMacros.hxx"
23 #include <cppuhelper/implbase1.hxx>
24 #include <cppuhelper/weakref.hxx>
25 #include <com/sun/star/chart2/XCoordinateSystem.hpp>
26 #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
27 #include <com/sun/star/frame/XModel.hpp>
28 #include "charttoolsdllapi.hxx"
30 #include <vector>
32 namespace chart
35 struct OOO_DLLPUBLIC_CHARTTOOLS ComplexCategory
37 OUString Text;
38 sal_Int32 Count;
40 ComplexCategory( const OUString& rText, sal_Int32 nCount ) : Text( rText ), Count (nCount)
44 class OOO_DLLPUBLIC_CHARTTOOLS SplitCategoriesProvider
46 public:
47 virtual ~SplitCategoriesProvider();
49 virtual sal_Int32 getLevelCount() const = 0;
50 virtual ::com::sun::star::uno::Sequence< OUString > getStringsForLevel( sal_Int32 nIndex ) const = 0;
53 struct DatePlusIndex
55 DatePlusIndex()
56 : fValue(1.0)
57 , nIndex( -1 )
61 DatePlusIndex( const double& _fValue, sal_Int32 _nIndex )
62 : fValue(_fValue)
63 , nIndex( _nIndex )
67 double fValue;
68 sal_Int32 nIndex;
71 class OOO_DLLPUBLIC_CHARTTOOLS ExplicitCategoriesProvider
73 public:
74 ExplicitCategoriesProvider( const ::com::sun::star::uno::Reference<
75 ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel
76 , const ::com::sun::star::uno::Reference<
77 ::com::sun::star::frame::XModel >& xChartModel
79 virtual ~ExplicitCategoriesProvider();
81 void init();
83 ::com::sun::star::uno::Reference<
84 ::com::sun::star::chart2::data::XDataSequence > getOriginalCategories();
86 ::com::sun::star::uno::Sequence< OUString > getSimpleCategories();
87 const std::vector<ComplexCategory>* getCategoriesByLevel( sal_Int32 nLevel );
89 static OUString getCategoryByIndex(
90 const ::com::sun::star::uno::Reference<
91 ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel
92 , const ::com::sun::star::uno::Reference<
93 ::com::sun::star::frame::XModel >& xChartModel
94 , sal_Int32 nIndex );
96 static ::com::sun::star::uno::Sequence< OUString > getExplicitSimpleCategories(
97 const SplitCategoriesProvider& rSplitCategoriesProvider );
99 static void convertCategoryAnysToText( ::com::sun::star::uno::Sequence< OUString >& rOutTexts
100 , const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rInAnys
101 , ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xChartModel );
103 bool hasComplexCategories() const;
104 sal_Int32 getCategoryLevelCount() const;
106 const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
107 ::com::sun::star::chart2::data::XLabeledDataSequence> >& getSplitCategoriesList();
109 bool isDateAxis();
110 const std::vector< DatePlusIndex >& getDateCategories();
112 private: //member
113 bool volatile m_bDirty;
114 ::com::sun::star::uno::WeakReference<
115 ::com::sun::star::chart2::XCoordinateSystem > m_xCooSysModel;
116 ::com::sun::star::uno::WeakReference<
117 ::com::sun::star::frame::XModel > m_xChartModel;
118 ::com::sun::star::uno::Reference<
119 ::com::sun::star::chart2::data::XLabeledDataSequence> m_xOriginalCategories;
121 bool m_bIsExplicitCategoriesInited;
122 ::com::sun::star::uno::Sequence< OUString > m_aExplicitCategories;
123 ::std::vector< ::std::vector< ComplexCategory > > m_aComplexCats;
124 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference<
125 ::com::sun::star::chart2::data::XLabeledDataSequence> > m_aSplitCategoriesList;
127 bool m_bIsDateAxis;
128 bool m_bIsAutoDate;
129 std::vector< DatePlusIndex > m_aDateCategories;
132 } // namespace chart
134 // CHART2_VIEW_EXPLICITCATEGORIESPROVIDER_HXX
135 #endif
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */