cid#1606940 Check of thread-shared field evades lock acquisition
[LibreOffice.git] / chart2 / source / inc / ReferenceSizeProvider.hxx
blobf3626b03d1937c7bec94ab6b93005a17c617ebc1
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 #pragma once
21 #include <com/sun/star/uno/Reference.hxx>
22 #include <com/sun/star/awt/Size.hpp>
23 #include "charttoolsdllapi.hxx"
24 #include <rtl/ref.hxx>
25 #include <ChartModel.hxx>
27 namespace com::sun::star {
28 namespace chart2 {
29 class XTitle;
30 class XTitled;
31 class XChartDocument;
33 namespace beans {
34 class XPropertySet;
38 namespace chart
41 class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) ReferenceSizeProvider
43 public:
45 enum AutoResizeState
47 AUTO_RESIZE_YES,
48 AUTO_RESIZE_NO,
49 AUTO_RESIZE_AMBIGUOUS,
50 AUTO_RESIZE_UNKNOWN
53 ReferenceSizeProvider(
54 css::awt::Size aPageSize,
55 const rtl::Reference<::chart::ChartModel> & xChartDoc );
57 const css::awt::Size& getPageSize() const { return m_aPageSize;}
59 /** Retrieves the state auto-resize from all objects that support this
60 feature. If all objects return the same state, AUTO_RESIZE_YES or
61 AUTO_RESIZE_NO is returned.
63 If no object supporting the feature is found, AUTO_RESIZE_UNKNOWN is
64 returned. If there are multiple objects, some with state YES and some
65 with state NO, AUTO_RESIZE_AMBIGUOUS is returned.
67 static AutoResizeState getAutoResizeState(
68 const rtl::Reference<::chart::ChartModel> & xChartDoc );
70 /** sets or resets the auto-resize at all objects that support this feature
71 for text to the opposite of the current setting. If the current state
72 is ambiguous, it is turned on. If the current state is unknown it stays
73 unknown.
75 void toggleAutoResizeState();
77 /** Sets the ReferencePageSize according to the internal settings of this
78 class at the XPropertySet, and the adapted font sizes if bAdaptFontSizes
79 is </sal_True>.
81 SAL_DLLPRIVATE void setValuesAtPropertySet(
82 const css::uno::Reference< css::beans::XPropertySet > & xProp,
83 bool bAdaptFontSizes = true );
85 /** Sets the ReferencePageSize according to the internal settings of this
86 class at the XTitle, and the adapted font sizes at the contained
87 XFormattedStrings
89 SAL_DLLPRIVATE void setValuesAtTitle(
90 const css::uno::Reference< css::chart2::XTitle > & xTitle );
92 /** Sets the internal value at all data series in the currently set model.
93 This is useful, if you have changed a chart-type and thus probably added
94 some new data series via model functionality.
96 void setValuesAtAllDataSeries();
98 private:
99 SAL_DLLPRIVATE bool useAutoScale() const { return m_bUseAutoScale;}
101 /** sets the auto-resize at all objects that support this feature for text.
102 eNewState must be either AUTO_RESIZE_YES or AUTO_RESIZE_NO
104 SAL_DLLPRIVATE void setAutoResizeState( AutoResizeState eNewState );
106 /** Retrieves the auto-resize state from the given propertyset. The result
107 will be put into eInOutState. If you initialize eInOutState with
108 AUTO_RESIZE_UNKNOWN, you will get the actual state. If you pass any
109 other state, the result will be the accumulated state,
110 esp. AUTO_RESIZE_AMBIGUOUS, if the value was NO before, and is YES for
111 the current property set, or the other way round.
113 SAL_DLLPRIVATE static void getAutoResizeFromPropSet(
114 const css::uno::Reference< css::beans::XPropertySet > & xProp,
115 AutoResizeState & rInOutState );
117 SAL_DLLPRIVATE void impl_setValuesAtTitled(
118 const css::uno::Reference< css::chart2::XTitled > & xTitled );
119 SAL_DLLPRIVATE static void impl_getAutoResizeFromTitled(
120 const css::uno::Reference< css::chart2::XTitled > & xTitled,
121 AutoResizeState & rInOutState );
123 css::awt::Size m_aPageSize;
124 rtl::Reference<::chart::ChartModel> m_xChartDoc;
125 bool m_bUseAutoScale;
128 } // namespace chart
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */