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 "charttoolsdllapi.hxx"
23 #include <com/sun/star/uno/Reference.h>
24 #include <com/sun/star/uno/Sequence.h>
26 namespace chart
{ class ChartModel
; }
27 namespace com::sun::star::beans
{ struct PropertyValue
; }
28 namespace com::sun::star::chart2
{ class XChartDocument
; }
29 namespace com::sun::star::chart2
{ class XDiagram
; }
30 namespace com::sun::star::chart2::data
{ class XDataSequence
; }
31 namespace com::sun::star::chart2::data
{ class XDataSource
; }
32 namespace com::sun::star::chart2::data
{ class XLabeledDataSequence
; }
33 namespace com::sun::star::frame
{ class XModel
; }
38 class OOO_DLLPUBLIC_CHARTTOOLS DataSourceHelper
41 static css::uno::Reference
< css::chart2::data::XDataSource
>
42 createDataSource( const css::uno::Sequence
<
43 css::uno::Reference
< css::chart2::data::XLabeledDataSequence
> > & rSequences
);
45 static css::uno::Reference
< css::chart2::data::XDataSequence
>
46 createCachedDataSequence();
48 static css::uno::Reference
< css::chart2::data::XDataSequence
>
49 createCachedDataSequence( const OUString
& rSingleText
);
51 static css::uno::Reference
< css::chart2::data::XLabeledDataSequence
>
52 createLabeledDataSequence(
53 const css::uno::Reference
< css::chart2::data::XDataSequence
>& xValues
,
54 const css::uno::Reference
< css::chart2::data::XDataSequence
>& xLabels
);
56 static css::uno::Reference
< css::chart2::data::XLabeledDataSequence
>
57 createLabeledDataSequence(
58 const css::uno::Reference
< css::chart2::data::XDataSequence
>& xValues
);
60 static css::uno::Reference
< css::chart2::data::XLabeledDataSequence
>
61 createLabeledDataSequence();
63 static css::uno::Sequence
< css::beans::PropertyValue
>
65 bool bUseColumns
, bool bFirstCellAsLabel
, bool bHasCategories
);
67 static css::uno::Sequence
<
68 css::beans::PropertyValue
> createArguments(
69 const OUString
& rRangeRepresentation
,
70 const css::uno::Sequence
< sal_Int32
>& rSequenceMapping
,
71 bool bUseColumns
, bool bFirstCellAsLabel
, bool bHasCategories
);
73 SAL_DLLPRIVATE
static void readArguments( const css::uno::Sequence
< css::beans::PropertyValue
>& rArguments
74 , OUString
& rRangeRepresentation
, css::uno::Sequence
< sal_Int32
>& rSequenceMapping
75 , bool& bUseColumns
, bool& bFirstCellAsLabel
, bool& bHasCategories
);
77 static css::uno::Reference
< css::chart2::data::XDataSource
>
78 pressUsedDataIntoRectangularFormat( const css::uno::Reference
< css::chart2::XChartDocument
>& xChartDoc
);
80 SAL_DLLPRIVATE
static css::uno::Sequence
< OUString
> getUsedDataRanges(
81 const css::uno::Reference
< css::chart2::XDiagram
> & xDiagram
);
83 static css::uno::Sequence
< OUString
> getUsedDataRanges(
84 const css::uno::Reference
< css::frame::XModel
> & xChartModel
);
86 static css::uno::Reference
< css::chart2::data::XDataSource
> getUsedData(
89 static css::uno::Reference
< css::chart2::data::XDataSource
> getUsedData(
90 const css::uno::Reference
< css::frame::XModel
>& xChartModel
);
92 static css::uno::Reference
< css::chart2::data::XDataSource
> getUsedData(
93 const css::uno::Reference
<css::chart2::XChartDocument
>& xChartDoc
);
95 static bool detectRangeSegmentation(
96 const css::uno::Reference
< css::frame::XModel
>& xChartModel
97 , OUString
& rOutRangeString
98 , css::uno::Sequence
< sal_Int32
>& rSequenceMapping
99 , bool& rOutUseColumns
100 , bool& rOutFirstCellAsLabel
101 , bool& rOutHasCategories
);
103 static void setRangeSegmentation(
104 const css::uno::Reference
< css::frame::XModel
>& xChartModel
105 , const css::uno::Sequence
< sal_Int32
>& rSequenceMapping
107 , bool bFirstCellAsLabel
108 , bool bUseCategories
);
110 /** Returns true, if all arguments necessary for getting all data by a
111 rectangular region are returned by detectArguments at the given
112 document's data provider.
114 Currently, this is: CellRangeRepresentation, DataRowSource,
115 HasCategories and FirstCellAsLabel.
117 static bool allArgumentsForRectRangeDetected(
118 const css::uno::Reference
< css::chart2::XChartDocument
>& xChartDocument
);
120 SAL_DLLPRIVATE
static css::uno::Sequence
< OUString
> getRangesFromLabeledDataSequence(
121 const css::uno::Reference
< css::chart2::data::XLabeledDataSequence
> & xLSeq
);
123 SAL_DLLPRIVATE
static OUString
getRangeFromValues(
124 const css::uno::Reference
< css::chart2::data::XLabeledDataSequence
> & xLSeq
);
126 SAL_DLLPRIVATE
static css::uno::Sequence
< OUString
> getRangesFromDataSource(
127 const css::uno::Reference
< css::chart2::data::XDataSource
> & xSource
);
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */