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 <TimerTriggeredControllerLock.hxx>
22 #include <rtl/ustring.hxx>
23 #include <rtl/ref.hxx>
29 namespace chart
{ class ChartModel
; }
30 namespace com::sun::star::beans
{ struct PropertyValue
; }
31 namespace com::sun::star::chart2
{ class XChartDocument
; }
32 namespace com::sun::star::frame
{ class XModel
; }
33 namespace com::sun::star::uno
{ class XComponentContext
; }
34 namespace com::sun::star::uno
{ template <class E
> class Sequence
; }
36 namespace com::sun::star::chart2
{
37 class XDataSeriesContainer
;
42 class XLabeledDataSequence
;
49 class ChartTypeTemplate
;
51 struct InterpretedData
;
52 class LabeledDataSequence
;
53 class RangeSelectionHelper
;
55 struct DialogModelTimeBasedInfo
57 DialogModelTimeBasedInfo();
67 explicit DialogModel( rtl::Reference
<::chart::ChartModel
> xChartDocument
);
72 std::pair
< rtl::Reference
< ::chart::DataSeries
>,
73 rtl::Reference
< ::chart::ChartType
> > >
74 tSeriesWithChartTypeByName
;
76 typedef std::map
< OUString
, OUString
>
80 const rtl::Reference
< ::chart::ChartTypeTemplate
> & xTemplate
);
82 std::shared_ptr
< RangeSelectionHelper
> const &
83 getRangeSelectionHelper() const;
85 const rtl::Reference
<::chart::ChartModel
> &
86 getChartModel() const;
88 css::uno::Reference
< css::chart2::data::XDataProvider
>
89 getDataProvider() const;
91 std::vector
< rtl::Reference
< ::chart::ChartType
> >
92 getAllDataSeriesContainers() const;
94 std::vector
< tSeriesWithChartTypeByName
>
95 getAllDataSeriesWithLabel() const;
97 static tRolesWithRanges
getRolesWithRanges(
98 const css::uno::Reference
< css::chart2::XDataSeries
> & xSeries
,
99 const OUString
& aRoleOfSequenceForLabel
,
100 const rtl::Reference
< ::chart::ChartType
> & xChartType
);
102 enum class MoveDirection
107 void moveSeries( const rtl::Reference
< DataSeries
> & xSeries
,
108 MoveDirection eDirection
);
110 /// @return the newly inserted series
112 ::chart::DataSeries
> insertSeriesAfter(
113 const css::uno::Reference
< css::chart2::XDataSeries
> & xSeries
,
114 const rtl::Reference
< ::chart::ChartType
> & xChartType
,
115 bool bCreateDataCachedSequences
= false );
118 const rtl::Reference
< ::chart::DataSeries
> & xSeries
,
119 const rtl::Reference
< ::chart::ChartType
> & xChartType
);
121 css::uno::Reference
< css::chart2::data::XLabeledDataSequence
>
122 getCategories() const;
124 void setCategories( const css::uno::Reference
< css::chart2::data::XLabeledDataSequence
> & xCategories
);
126 OUString
getCategoriesRange() const;
128 bool isCategoryDiagram() const;
130 void detectArguments(
131 OUString
& rOutRangeString
,
132 bool & rOutUseColumns
, bool & rOutFirstCellAsLabel
, bool & rOutHasCategories
) const;
134 bool allArgumentsForRectRangeDetected() const;
136 void setData( const css::uno::Sequence
< css::beans::PropertyValue
> & rArguments
);
138 void setTimeBasedRange( bool bTimeBased
, sal_Int32 nStart
, sal_Int32 nEnd
) const;
140 const DialogModelTimeBasedInfo
& getTimeBasedInfo() const { return maTimeBasedInfo
; }
142 void startControllerLockTimer();
144 static OUString
ConvertRoleFromInternalToUI( const OUString
& rRoleString
);
145 static OUString
GetRoleDataLabel();
147 // pass a role string (not translated) and get an index that serves for
148 // relative ordering, to get e.g. x-values and y-values in the right order
149 static sal_Int32
GetRoleIndexForSorting( const OUString
& rInternalRoleString
);
151 ChartModel
& getModel() const;
154 rtl::Reference
<::chart::ChartModel
>
157 rtl::Reference
< ::chart::ChartTypeTemplate
> m_xTemplate
;
159 mutable std::shared_ptr
< RangeSelectionHelper
>
160 m_spRangeSelectionHelper
;
162 TimerTriggeredControllerLock m_aTimerTriggeredControllerLock
;
165 void applyInterpretedData(
166 const InterpretedData
& rNewData
,
167 const std::vector
< rtl::Reference
< ::chart::DataSeries
> > & rSeriesToReUse
);
169 sal_Int32
countSeries() const;
171 mutable DialogModelTimeBasedInfo maTimeBasedInfo
;
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */