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 .
21 #include "StackMode.hxx"
22 #include "charttoolsdllapi.hxx"
23 #include "ChartTypeTemplate.hxx"
24 #include <com/sun/star/awt/Rectangle.hpp>
25 #include <rtl/ref.hxx>
27 namespace chart
{ class ChartModel
; }
28 namespace com::sun::star::chart2
{ class XAxis
; }
29 namespace com::sun::star::chart2
{ class XChartDocument
; }
30 namespace com::sun::star::chart2
{ class XChartType
; }
31 namespace com::sun::star::chart2
{ class XCoordinateSystem
; }
32 namespace com::sun::star::chart2
{ class XDiagram
; }
33 namespace com::sun::star::chart2
{ class XDataSeries
; }
34 namespace com::sun::star::chart2::data
{ class XLabeledDataSequence
; }
35 namespace com::sun::star::frame
{ class XModel
; }
36 namespace com::sun::star::lang
{ class XMultiServiceFactory
; }
37 namespace com::sun::star::uno
{ class XComponentContext
; }
38 namespace com::sun::star::util
{ class XNumberFormats
; }
39 namespace com::sun::star::util
{ class XNumberFormatsSupplier
; }
44 class BaseCoordinateSystem
;
46 class ChartTypeManager
;
47 class ChartTypeTemplate
;
50 class LabeledDataSequence
;
52 class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS
) DiagramHelper
56 /** Retrieves the stackmode of the first DataSeries or none. If the series have differing stack
57 modes, rbAmbiguous is set to true. If no series is there rbFound is set to false.
59 @param xCorrespondingCoordinateSystem
60 The coordinate system in which the given chart type xChartType is
61 located. (This is needed for determining percent stacking. If
62 omitted, the result will just indicate "not stacked", "stacked" or
65 static StackMode
getStackModeFromChartType(
66 const rtl::Reference
< ::chart::ChartType
> & xChartType
,
67 bool& rbFound
, bool& rbAmbiguous
,
68 const rtl::Reference
< ::chart::BaseCoordinateSystem
> & xCorrespondingCoordinateSystem
71 static bool isSeriesAttachedToMainAxis(
72 const rtl::Reference
< ::chart::DataSeries
>& xDataSeries
);
74 static css::uno::Sequence
< OUString
>
75 getExplicitSimpleCategories( ChartModel
& rModel
);
77 SAL_DLLPRIVATE
static css::uno::Sequence
< OUString
>
78 generateAutomaticCategoriesFromCooSys(
79 const rtl::Reference
< ::chart::BaseCoordinateSystem
> & xCooSys
);
81 static void switchToDateCategories(
82 const rtl::Reference
<::chart::ChartModel
> & xChartDoc
);
84 static void switchToTextCategories(
85 const rtl::Reference
<::chart::ChartModel
> & xChartDoc
);
87 static bool isDateNumberFormat( sal_Int32 nNumberFormat
, const css::uno::Reference
< css::util::XNumberFormats
>& xNumberFormats
);
88 static sal_Int32
getDateNumberFormat( const css::uno::Reference
< css::util::XNumberFormatsSupplier
>& xNumberFormatsSupplier
);
89 static sal_Int32
getDateTimeInputNumberFormat( const css::uno::Reference
< css::util::XNumberFormatsSupplier
>& xNumberFormatsSupplier
, double fNumber
);
91 static sal_Int32
getPercentNumberFormat( const css::uno::Reference
<
92 css::util::XNumberFormatsSupplier
>& xNumberFormatsSupplier
);
94 SAL_DLLPRIVATE
static bool areChartTypesCompatible(
95 const rtl::Reference
< ::chart::ChartType
>& xFirstType
,
96 const rtl::Reference
< ::chart::ChartType
>& xSecondType
);
98 static bool setDiagramPositioning( const rtl::Reference
<::chart::ChartModel
>& xChartModel
,
99 const css::awt::Rectangle
& rPosRect
/*100th mm*/ );
101 static css::awt::Rectangle
getDiagramRectangleFromModel( const rtl::Reference
<::chart::ChartModel
>& xChartModel
);
103 static bool switchDiagramPositioningToExcludingPositioning( ChartModel
& rModel
104 , bool bResetModifiedState
//set model back to unchanged if it was unchanged before
105 , bool bConvertAlsoFromAutoPositioning
);
108 DiagramHelper() = delete;
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */