summaryrefslogtreecommitdiffstats
path: root/chart2/source/inc/DataSourceHelper.hxx
blob: 7b08cafc22a7569dcd0b0d37b9c698da84f35052 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#pragma once

#include <config_options.h>
#include "charttoolsdllapi.hxx"
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
#include <rtl/ref.hxx>

namespace chart { class ChartModel; }
namespace com::sun::star::beans { struct PropertyValue; }
namespace com::sun::star::chart2 { class XChartDocument; }
namespace com::sun::star::chart2 { class XDiagram; }
namespace com::sun::star::chart2::data { class XDataSequence; }
namespace com::sun::star::chart2::data { class XDataSource; }
namespace com::sun::star::chart2::data { class XLabeledDataSequence; }
namespace com::sun::star::frame { class XModel; }

namespace chart
{
class DataSource;
class Diagram;
class LabeledDataSequence;

class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) DataSourceHelper
{
public:
        static css::uno::Reference< css::chart2::data::XDataSequence >
            createCachedDataSequence();

        static css::uno::Reference< css::chart2::data::XDataSequence >
            createCachedDataSequence( const OUString & rSingleText );

        static rtl::Reference< LabeledDataSequence >
            createLabeledDataSequence(
                const css::uno::Reference< css::chart2::data::XDataSequence >& xValues ,
                const css::uno::Reference< css::chart2::data::XDataSequence >& xLabels );

        static rtl::Reference< LabeledDataSequence >
            createLabeledDataSequence(
                const css::uno::Reference< css::chart2::data::XDataSequence >& xValues );

        static rtl::Reference< LabeledDataSequence >
            createLabeledDataSequence();

        static css::uno::Sequence< css::beans::PropertyValue >
            createArguments(
                   bool bUseColumns, bool bFirstCellAsLabel, bool bHasCategories );

        static css::uno::Sequence<
               css::beans::PropertyValue > createArguments(
                   const OUString & rRangeRepresentation,
                   const css::uno::Sequence< sal_Int32 >& rSequenceMapping,
                   bool bUseColumns, bool bFirstCellAsLabel, bool bHasCategories );

        SAL_DLLPRIVATE static void readArguments( const css::uno::Sequence< css::beans::PropertyValue >& rArguments
            , OUString & rRangeRepresentation, css::uno::Sequence< sal_Int32 >& rSequenceMapping
            , bool& bUseColumns, bool& bFirstCellAsLabel, bool& bHasCategories );

        static rtl::Reference< ::chart::DataSource >
            pressUsedDataIntoRectangularFormat( const rtl::Reference< ::chart::ChartModel >& xChartDoc );

        SAL_DLLPRIVATE static css::uno::Sequence< OUString > getUsedDataRanges(
            const rtl::Reference< ::chart::Diagram > & xDiagram );

        static css::uno::Sequence< OUString > getUsedDataRanges(
            const rtl::Reference<::chart::ChartModel> & xChartModel );

        static rtl::Reference< ::chart::DataSource > getUsedData(
                ChartModel& rModel );

        static bool detectRangeSegmentation(
            const rtl::Reference<::chart::ChartModel>& xChartModel
            , OUString& rOutRangeString
            , css::uno::Sequence< sal_Int32 >& rSequenceMapping
            , bool& rOutUseColumns
            , bool& rOutFirstCellAsLabel
            , bool& rOutHasCategories );

        static void setRangeSegmentation(
            const rtl::Reference<::chart::ChartModel>& xChartModel
            , const css::uno::Sequence< sal_Int32 >& rSequenceMapping
            , bool bUseColumns
            , bool bFirstCellAsLabel
            , bool bUseCategories );

        /** Returns true, if all arguments necessary for getting all data by a
            rectangular region are returned by detectArguments at the given
            document's data provider.

            Currently, this is: CellRangeRepresentation, DataRowSource,
            HasCategories and FirstCellAsLabel.
         */
        static bool allArgumentsForRectRangeDetected(
            const rtl::Reference<::chart::ChartModel>& xChartDocument );

        SAL_DLLPRIVATE static css::uno::Sequence< OUString > getRangesFromLabeledDataSequence(
            const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xLSeq );

        SAL_DLLPRIVATE static OUString getRangeFromValues(
            const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xLSeq );

        SAL_DLLPRIVATE static css::uno::Sequence< OUString > getRangesFromDataSource(
            const css::uno::Reference< css::chart2::data::XDataSource > & xSource );
};

} //namespace chart

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */