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 .
22 #include <config_options.h>
23 #include "charttoolsdllapi.hxx"
24 #include <com/sun/star/uno/Reference.h>
25 #include <com/sun/star/uno/Sequence.h>
26 #include <rtl/ref.hxx>
28 namespace chart
{ class ChartModel
; }
29 namespace com::sun::star::beans
{ struct PropertyValue
; }
30 namespace com::sun::star::chart2
{ class XChartDocument
; }
31 namespace com::sun::star::chart2
{ class XDiagram
; }
32 namespace com::sun::star::chart2::data
{ class XDataSequence
; }
33 namespace com::sun::star::chart2::data
{ class XDataSource
; }
34 namespace com::sun::star::chart2::data
{ class XLabeledDataSequence
; }
35 namespace com::sun::star::frame
{ class XModel
; }
41 class LabeledDataSequence
;
43 class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS
) DataSourceHelper
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 rtl::Reference
< LabeledDataSequence
>
53 createLabeledDataSequence(
54 const css::uno::Reference
< css::chart2::data::XDataSequence
>& xValues
,
55 const css::uno::Reference
< css::chart2::data::XDataSequence
>& xLabels
);
57 static rtl::Reference
< LabeledDataSequence
>
58 createLabeledDataSequence(
59 const css::uno::Reference
< css::chart2::data::XDataSequence
>& xValues
);
61 static rtl::Reference
< LabeledDataSequence
>
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 rtl::Reference
< ::chart::DataSource
>
79 pressUsedDataIntoRectangularFormat( const rtl::Reference
< ::chart::ChartModel
>& xChartDoc
);
81 SAL_DLLPRIVATE
static css::uno::Sequence
< OUString
> getUsedDataRanges(
82 const rtl::Reference
< ::chart::Diagram
> & xDiagram
);
84 static css::uno::Sequence
< OUString
> getUsedDataRanges(
85 const rtl::Reference
<::chart::ChartModel
> & xChartModel
);
87 static rtl::Reference
< ::chart::DataSource
> getUsedData(
90 static bool detectRangeSegmentation(
91 const rtl::Reference
<::chart::ChartModel
>& xChartModel
92 , OUString
& rOutRangeString
93 , css::uno::Sequence
< sal_Int32
>& rSequenceMapping
94 , bool& rOutUseColumns
95 , bool& rOutFirstCellAsLabel
96 , bool& rOutHasCategories
);
98 static void setRangeSegmentation(
99 const rtl::Reference
<::chart::ChartModel
>& xChartModel
100 , const css::uno::Sequence
< sal_Int32
>& rSequenceMapping
102 , bool bFirstCellAsLabel
103 , bool bUseCategories
);
105 /** Returns true, if all arguments necessary for getting all data by a
106 rectangular region are returned by detectArguments at the given
107 document's data provider.
109 Currently, this is: CellRangeRepresentation, DataRowSource,
110 HasCategories and FirstCellAsLabel.
112 static bool allArgumentsForRectRangeDetected(
113 const rtl::Reference
<::chart::ChartModel
>& xChartDocument
);
115 SAL_DLLPRIVATE
static css::uno::Sequence
< OUString
> getRangesFromLabeledDataSequence(
116 const css::uno::Reference
< css::chart2::data::XLabeledDataSequence
> & xLSeq
);
118 SAL_DLLPRIVATE
static OUString
getRangeFromValues(
119 const css::uno::Reference
< css::chart2::data::XLabeledDataSequence
> & xLSeq
);
121 SAL_DLLPRIVATE
static css::uno::Sequence
< OUString
> getRangesFromDataSource(
122 const css::uno::Reference
< css::chart2::data::XDataSource
> & xSource
);
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */