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 .
20 #ifndef INCLUDED_CHART2_SOURCE_INC_DATASOURCEHELPER_HXX
21 #define INCLUDED_CHART2_SOURCE_INC_DATASOURCEHELPER_HXX
23 #include "charttoolsdllapi.hxx"
24 #include <com/sun/star/uno/Reference.h>
25 #include <com/sun/star/uno/Sequence.h>
27 namespace chart
{ class ChartModel
; }
28 namespace com
{ namespace sun
{ namespace star
{ namespace beans
{ struct PropertyValue
; } } } }
29 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ class XChartDocument
; } } } }
30 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ class XDiagram
; } } } }
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 XDataSource
; } } } } }
33 namespace com
{ namespace sun
{ namespace star
{ namespace chart2
{ namespace data
{ class XLabeledDataSequence
; } } } } }
34 namespace com
{ namespace sun
{ namespace star
{ namespace frame
{ class XModel
; } } } }
39 class OOO_DLLPUBLIC_CHARTTOOLS DataSourceHelper
42 static css::uno::Reference
< css::chart2::data::XDataSource
>
43 createDataSource( const css::uno::Sequence
<
44 css::uno::Reference
< css::chart2::data::XLabeledDataSequence
> > & rSequences
);
46 static css::uno::Reference
< css::chart2::data::XDataSequence
>
47 createCachedDataSequence();
49 static css::uno::Reference
< css::chart2::data::XDataSequence
>
50 createCachedDataSequence( const OUString
& rSingleText
);
52 static css::uno::Reference
< css::chart2::data::XLabeledDataSequence
>
53 createLabeledDataSequence(
54 const css::uno::Reference
< css::chart2::data::XDataSequence
>& xValues
,
55 const css::uno::Reference
< css::chart2::data::XDataSequence
>& xLabels
);
57 static css::uno::Reference
< css::chart2::data::XLabeledDataSequence
>
58 createLabeledDataSequence(
59 const css::uno::Reference
< css::chart2::data::XDataSequence
>& xValues
);
61 static css::uno::Reference
< css::chart2::data::XLabeledDataSequence
>
62 createLabeledDataSequence();
64 static css::uno::Sequence
< css::beans::PropertyValue
>
66 bool bUseColumns
, bool bFirstCellAsLabel
, bool bHasCategories
);
68 static css::uno::Sequence
<
69 css::beans::PropertyValue
> createArguments(
70 const OUString
& rRangeRepresentation
,
71 const css::uno::Sequence
< sal_Int32
>& rSequenceMapping
,
72 bool bUseColumns
, bool bFirstCellAsLabel
, bool bHasCategories
);
74 SAL_DLLPRIVATE
static void readArguments( const css::uno::Sequence
< css::beans::PropertyValue
>& rArguments
75 , OUString
& rRangeRepresentation
, css::uno::Sequence
< sal_Int32
>& rSequenceMapping
76 , bool& bUseColumns
, bool& bFirstCellAsLabel
, bool& bHasCategories
);
78 static css::uno::Reference
< css::chart2::data::XDataSource
>
79 pressUsedDataIntoRectangularFormat( const css::uno::Reference
< css::chart2::XChartDocument
>& xChartDoc
);
81 SAL_DLLPRIVATE
static css::uno::Sequence
< OUString
> getUsedDataRanges(
82 const css::uno::Reference
< css::chart2::XDiagram
> & xDiagram
);
84 static css::uno::Sequence
< OUString
> getUsedDataRanges(
85 const css::uno::Reference
< css::frame::XModel
> & xChartModel
);
87 static css::uno::Reference
< css::chart2::data::XDataSource
> getUsedData(
90 static css::uno::Reference
< css::chart2::data::XDataSource
> getUsedData(
91 const css::uno::Reference
< css::frame::XModel
>& xChartModel
);
93 static css::uno::Reference
< css::chart2::data::XDataSource
> getUsedData(
94 const css::uno::Reference
<css::chart2::XChartDocument
>& xChartDoc
);
96 static bool detectRangeSegmentation(
97 const css::uno::Reference
< css::frame::XModel
>& xChartModel
98 , OUString
& rOutRangeString
99 , css::uno::Sequence
< sal_Int32
>& rSequenceMapping
100 , bool& rOutUseColumns
101 , bool& rOutFirstCellAsLabel
102 , bool& rOutHasCategories
);
104 static void setRangeSegmentation(
105 const css::uno::Reference
< css::frame::XModel
>& xChartModel
106 , const css::uno::Sequence
< sal_Int32
>& rSequenceMapping
108 , bool bFirstCellAsLabel
109 , bool bUseCategories
);
111 /** Returns true, if all arguments necessary for getting all data by a
112 rectangular region are returned by detectArguments at the given
113 document's data provider.
115 Currently, this is: CellRangeRepresentation, DataRowSource,
116 HasCategories and FirstCellAsLabel.
118 static bool allArgumentsForRectRangeDetected(
119 const css::uno::Reference
< css::chart2::XChartDocument
>& xChartDocument
);
121 SAL_DLLPRIVATE
static css::uno::Sequence
< OUString
> getRangesFromLabeledDataSequence(
122 const css::uno::Reference
< css::chart2::data::XLabeledDataSequence
> & xLSeq
);
124 SAL_DLLPRIVATE
static OUString
getRangeFromValues(
125 const css::uno::Reference
< css::chart2::data::XLabeledDataSequence
> & xLSeq
);
127 SAL_DLLPRIVATE
static css::uno::Sequence
< OUString
> getRangesFromDataSource(
128 const css::uno::Reference
< css::chart2::data::XDataSource
> & xSource
);
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */