Bump for 3.6-28
[LibreOffice.git] / chart2 / source / inc / ReferenceSizeProvider.hxx
blob3ef1426cd25287a5f24023e2ce67b8aba383e772
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
28 #ifndef CHART2_REFERENCESIZEPROVIDER_HXX
29 #define CHART2_REFERENCESIZEPROVIDER_HXX
31 #include <com/sun/star/uno/Reference.hxx>
32 #include <com/sun/star/chart2/XChartDocument.hpp>
33 #include <com/sun/star/awt/Size.hpp>
34 #include "charttoolsdllapi.hxx"
36 namespace com { namespace sun { namespace star {
37 namespace chart2 {
38 class XTitle;
39 class XTitled;
41 }}}
43 // ----------------------------------------
44 namespace chart
47 class OOO_DLLPUBLIC_CHARTTOOLS ReferenceSizeProvider
49 public:
51 enum AutoResizeState
53 AUTO_RESIZE_YES,
54 AUTO_RESIZE_NO,
55 AUTO_RESIZE_AMBIGUOUS,
56 AUTO_RESIZE_UNKNOWN
59 ReferenceSizeProvider(
60 ::com::sun::star::awt::Size aPageSize,
61 const ::com::sun::star::uno::Reference<
62 ::com::sun::star::chart2::XChartDocument > & xChartDoc );
64 ::com::sun::star::awt::Size getPageSize() const;
66 /** Retrieves the state auto-resize from all objects that support this
67 feature. If all objects return the same state, AUTO_RESIZE_YES or
68 AUTO_RESIZE_NO is returned.
70 If no object supporting the feature is found, AUTO_RESIZE_UNKNOWN is
71 returned. If there are multiple objects, some with state YES and some
72 with state NO, AUTO_RESIZE_AMBIGUOUS is returned.
74 static AutoResizeState getAutoResizeState(
75 const ::com::sun::star::uno::Reference<
76 ::com::sun::star::chart2::XChartDocument > & xChartDoc );
78 /** sets or resets the auto-resize at all objects that support this feature
79 for text to the opposite of the current setting. If the current state
80 is ambiguous, it is turned on. If the current state is unknown it stays
81 unknown.
83 void toggleAutoResizeState();
86 /** Sets the ReferencePageSize according to the internal settings of this
87 class at the XPropertySet, and the adapted font sizes if bAdaptFontSizes
88 is </sal_True>.
90 SAL_DLLPRIVATE void setValuesAtPropertySet(
91 const ::com::sun::star::uno::Reference<
92 ::com::sun::star::beans::XPropertySet > & xProp,
93 bool bAdaptFontSizes = true );
95 /** Sets the ReferencePageSize according to the internal settings of this
96 class at the XTitle, and the adapted font sizes at the contained
97 XFormattedStrings
99 SAL_DLLPRIVATE void setValuesAtTitle(
100 const ::com::sun::star::uno::Reference<
101 ::com::sun::star::chart2::XTitle > & xTitle );
103 /** Sets the internal value at all data series in the currently set model.
104 This is useful, if you have changed a chart-type and thus probably added
105 some new data series via model functionality.
107 void setValuesAtAllDataSeries();
109 private:
110 SAL_DLLPRIVATE bool useAutoScale() const;
112 /** sets the auto-resize at all objects that support this feature for text.
113 eNewState must be either AUTO_RESIZE_YES or AUTO_RESIZE_NO
115 SAL_DLLPRIVATE void setAutoResizeState( AutoResizeState eNewState );
117 /** Retrieves the auto-resize state from the given propertyset. The result
118 will be put into eInOutState. If you initialize eInOutState with
119 AUTO_RESIZE_UNKNOWN, you will get the actual state. If you pass any
120 other state, the result will be the accumulated state,
121 esp. AUTO_RESIZE_AMBIGUOUS, if the value was NO before, and is YES for
122 the current property set, or the other way round.
124 SAL_DLLPRIVATE static void getAutoResizeFromPropSet(
125 const ::com::sun::star::uno::Reference<
126 ::com::sun::star::beans::XPropertySet > & xProp,
127 AutoResizeState & rInOutState );
129 SAL_DLLPRIVATE void impl_setValuesAtTitled(
130 const ::com::sun::star::uno::Reference<
131 ::com::sun::star::chart2::XTitled > & xTitled );
132 SAL_DLLPRIVATE static void impl_getAutoResizeFromTitled(
133 const ::com::sun::star::uno::Reference<
134 ::com::sun::star::chart2::XTitled > & xTitled,
135 AutoResizeState & rInOutState );
137 ::com::sun::star::awt::Size m_aPageSize;
138 ::com::sun::star::uno::Reference<
139 ::com::sun::star::chart2::XChartDocument > m_xChartDoc;
140 bool m_bUseAutoScale;
143 } // namespace chart
145 // CHART2_REFERENCESIZEPROVIDER_HXX
146 #endif
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */