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 .
19 #ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DIALOGMODEL_HXX
20 #define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DIALOGMODEL_HXX
22 #include <TimerTriggeredControllerLock.hxx>
23 #include <rtl/ustring.hxx>
29 namespace chart
{ class ChartModel
; }
30 namespace com
{ namespace sun
{ namespace star
{ namespace beans
{ struct PropertyValue
; } } } }
31 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ class XChartDocument
; } } } }
32 namespace com
{ namespace sun
{ namespace star
{ namespace frame
{ class XModel
; } } } }
33 namespace com
{ namespace sun
{ namespace star
{ namespace uno
{ class XComponentContext
; } } } }
34 namespace com
{ namespace sun
{ namespace star
{ namespace uno
{ template <class E
> class Sequence
; } } } }
36 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{
37 class XDataSeriesContainer
;
40 class XChartTypeTemplate
;
41 struct InterpretedData
;
44 class XLabeledDataSequence
;
51 class RangeSelectionHelper
;
53 struct DialogModelTimeBasedInfo
55 DialogModelTimeBasedInfo();
66 const css::uno::Reference
< css::chart2::XChartDocument
> & xChartDocument
,
67 const css::uno::Reference
< css::uno::XComponentContext
> & xContext
);
72 std::pair
< css::uno::Reference
< css::chart2::XDataSeries
>,
73 css::uno::Reference
< css::chart2::XChartType
> > >
74 tSeriesWithChartTypeByName
;
76 typedef std::map
< OUString
, OUString
>
80 const css::uno::Reference
< css::chart2::XChartTypeTemplate
> & xTemplate
);
82 std::shared_ptr
< RangeSelectionHelper
> const &
83 getRangeSelectionHelper() const;
85 css::uno::Reference
< css::frame::XModel
>
86 getChartModel() const;
88 css::uno::Reference
< css::chart2::data::XDataProvider
>
89 getDataProvider() const;
91 std::vector
< css::uno::Reference
< css::chart2::XDataSeriesContainer
> >
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 css::uno::Reference
< css::chart2::XChartType
> & xChartType
);
102 enum class MoveDirection
107 void moveSeries( const css::uno::Reference
< css::chart2::XDataSeries
> & xSeries
,
108 MoveDirection eDirection
);
110 /// @return the newly inserted series
112 css::chart2::XDataSeries
> insertSeriesAfter(
113 const css::uno::Reference
< css::chart2::XDataSeries
> & xSeries
,
114 const css::uno::Reference
< css::chart2::XChartType
> & xChartType
,
115 bool bCreateDataCachedSequences
= false );
118 const css::uno::Reference
< css::chart2::XDataSeries
> & xSeries
,
119 const css::uno::Reference
< css::chart2::XChartType
> & 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 css::uno::Reference
< css::chart2::XChartDocument
>
157 css::uno::Reference
< css::chart2::XChartTypeTemplate
>
160 css::uno::Reference
< css::uno::XComponentContext
>
163 mutable std::shared_ptr
< RangeSelectionHelper
>
164 m_spRangeSelectionHelper
;
166 TimerTriggeredControllerLock m_aTimerTriggeredControllerLock
;
169 void applyInterpretedData(
170 const css::chart2::InterpretedData
& rNewData
,
171 const std::vector
< css::uno::Reference
< css::chart2::XDataSeries
> > & rSeriesToReUse
);
173 sal_Int32
countSeries() const;
175 mutable DialogModelTimeBasedInfo maTimeBasedInfo
;
180 // INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_DIALOGMODEL_HXX
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */