Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / chart2 / source / inc / ReferenceSizeProvider.hxx
blob59b11ead29f508f93d4369e023e86ec69205389b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #ifndef INCLUDED_CHART2_SOURCE_INC_REFERENCESIZEPROVIDER_HXX
20 #define INCLUDED_CHART2_SOURCE_INC_REFERENCESIZEPROVIDER_HXX
22 #include <com/sun/star/uno/Reference.hxx>
23 #include <com/sun/star/awt/Size.hpp>
24 #include "charttoolsdllapi.hxx"
26 namespace com { namespace sun { namespace star {
27 namespace chart2 {
28 class XTitle;
29 class XTitled;
30 class XChartDocument;
32 namespace beans {
33 class XPropertySet;
35 }}}
37 namespace chart
40 class OOO_DLLPUBLIC_CHARTTOOLS ReferenceSizeProvider
42 public:
44 enum AutoResizeState
46 AUTO_RESIZE_YES,
47 AUTO_RESIZE_NO,
48 AUTO_RESIZE_AMBIGUOUS,
49 AUTO_RESIZE_UNKNOWN
52 ReferenceSizeProvider(
53 css::awt::Size aPageSize,
54 const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc );
56 const css::awt::Size& getPageSize() const { return m_aPageSize;}
58 /** Retrieves the state auto-resize from all objects that support this
59 feature. If all objects return the same state, AUTO_RESIZE_YES or
60 AUTO_RESIZE_NO is returned.
62 If no object supporting the feature is found, AUTO_RESIZE_UNKNOWN is
63 returned. If there are multiple objects, some with state YES and some
64 with state NO, AUTO_RESIZE_AMBIGUOUS is returned.
66 static AutoResizeState getAutoResizeState(
67 const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc );
69 /** sets or resets the auto-resize at all objects that support this feature
70 for text to the opposite of the current setting. If the current state
71 is ambiguous, it is turned on. If the current state is unknown it stays
72 unknown.
74 void toggleAutoResizeState();
76 /** Sets the ReferencePageSize according to the internal settings of this
77 class at the XPropertySet, and the adapted font sizes if bAdaptFontSizes
78 is </sal_True>.
80 SAL_DLLPRIVATE void setValuesAtPropertySet(
81 const css::uno::Reference< css::beans::XPropertySet > & xProp,
82 bool bAdaptFontSizes = true );
84 /** Sets the ReferencePageSize according to the internal settings of this
85 class at the XTitle, and the adapted font sizes at the contained
86 XFormattedStrings
88 SAL_DLLPRIVATE void setValuesAtTitle(
89 const css::uno::Reference< css::chart2::XTitle > & xTitle );
91 /** Sets the internal value at all data series in the currently set model.
92 This is useful, if you have changed a chart-type and thus probably added
93 some new data series via model functionality.
95 void setValuesAtAllDataSeries();
97 private:
98 SAL_DLLPRIVATE bool useAutoScale() const { return m_bUseAutoScale;}
100 /** sets the auto-resize at all objects that support this feature for text.
101 eNewState must be either AUTO_RESIZE_YES or AUTO_RESIZE_NO
103 SAL_DLLPRIVATE void setAutoResizeState( AutoResizeState eNewState );
105 /** Retrieves the auto-resize state from the given propertyset. The result
106 will be put into eInOutState. If you initialize eInOutState with
107 AUTO_RESIZE_UNKNOWN, you will get the actual state. If you pass any
108 other state, the result will be the accumulated state,
109 esp. AUTO_RESIZE_AMBIGUOUS, if the value was NO before, and is YES for
110 the current property set, or the other way round.
112 SAL_DLLPRIVATE static void getAutoResizeFromPropSet(
113 const css::uno::Reference< css::beans::XPropertySet > & xProp,
114 AutoResizeState & rInOutState );
116 SAL_DLLPRIVATE void impl_setValuesAtTitled(
117 const css::uno::Reference< css::chart2::XTitled > & xTitled );
118 SAL_DLLPRIVATE static void impl_getAutoResizeFromTitled(
119 const css::uno::Reference< css::chart2::XTitled > & xTitled,
120 AutoResizeState & rInOutState );
122 css::awt::Size m_aPageSize;
123 css::uno::Reference< css::chart2::XChartDocument > m_xChartDoc;
124 bool m_bUseAutoScale;
127 } // namespace chart
129 // INCLUDED_CHART2_SOURCE_INC_REFERENCESIZEPROVIDER_HXX
130 #endif
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */