1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #include "charttoolsdllapi.hxx"
22 #include <unotools/weakref.hxx>
23 #include <com/sun/star/uno/Reference.h>
24 #include <com/sun/star/uno/Sequence.h>
29 namespace chart
{ class ChartModel
; }
30 namespace com::sun::star::chart2
{ class XCoordinateSystem
; }
31 namespace com::sun::star::chart2::data
{ class XDataSequence
; }
32 namespace com::sun::star::chart2::data
{ class XLabeledDataSequence
; }
33 namespace com::sun::star::uno
{ class Any
; }
37 class BaseCoordinateSystem
;
38 class LabeledDataSequence
;
40 struct OOO_DLLPUBLIC_CHARTTOOLS ComplexCategory
45 ComplexCategory( OUString aText
, sal_Int32 nCount
) : Text(std::move( aText
)), Count (nCount
)
49 class SplitCategoriesProvider
52 virtual ~SplitCategoriesProvider();
54 virtual sal_Int32
getLevelCount() const = 0;
55 virtual css::uno::Sequence
< OUString
> getStringsForLevel( sal_Int32 nIndex
) const = 0;
58 class OOO_DLLPUBLIC_CHARTTOOLS ExplicitCategoriesProvider final
61 ExplicitCategoriesProvider( const rtl::Reference
< ::chart::BaseCoordinateSystem
>& xCooSysModel
62 , ChartModel
& rChartModel
64 ~ExplicitCategoriesProvider();
68 css::uno::Reference
< css::chart2::data::XDataSequence
> getOriginalCategories();
70 css::uno::Sequence
< OUString
> const & getSimpleCategories();
71 const std::vector
<ComplexCategory
>* getCategoriesByLevel( sal_Int32 nLevel
);
73 static OUString
getCategoryByIndex(
74 const rtl::Reference
< ::chart::BaseCoordinateSystem
>& xCooSysModel
78 static css::uno::Sequence
< OUString
> getExplicitSimpleCategories(
79 const SplitCategoriesProvider
& rSplitCategoriesProvider
);
81 static void convertCategoryAnysToText( css::uno::Sequence
< OUString
>& rOutTexts
82 , const css::uno::Sequence
< css::uno::Any
>& rInAnys
83 , ChartModel
& rModel
);
85 bool hasComplexCategories() const;
86 sal_Int32
getCategoryLevelCount() const;
88 const std::vector
< css::uno::Reference
< css::chart2::data::XLabeledDataSequence
> >&
89 getSplitCategoriesList() const { return m_aSplitCategoriesList
;}
92 const std::vector
< double >& getDateCategories();
95 ExplicitCategoriesProvider(ExplicitCategoriesProvider
const &) = delete;
96 ExplicitCategoriesProvider
& operator =(ExplicitCategoriesProvider
const &) = delete;
98 bool volatile m_bDirty
;
99 unotools::WeakReference
< ::chart::BaseCoordinateSystem
> m_xCooSysModel
;
101 css::uno::Reference
< css::chart2::data::XLabeledDataSequence
> m_xOriginalCategories
;
103 bool m_bIsExplicitCategoriesInited
;
104 css::uno::Sequence
< OUString
> m_aExplicitCategories
;
105 std::vector
< std::vector
< ComplexCategory
> > m_aComplexCats
;
106 std::vector
< css::uno::Reference
< css::chart2::data::XLabeledDataSequence
> > m_aSplitCategoriesList
;
110 std::vector
< double > m_aDateCategories
;
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */