1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
27 #ifndef CHART2_REFERENCESIZEPROVIDER_HXX
28 #define CHART2_REFERENCESIZEPROVIDER_HXX
30 #include <com/sun/star/uno/Reference.hxx>
31 #include <com/sun/star/chart2/XChartDocument.hpp>
32 #include <com/sun/star/awt/Size.hpp>
33 #include "charttoolsdllapi.hxx"
35 namespace com
{ namespace sun
{ namespace star
{
42 // ----------------------------------------
46 class OOO_DLLPUBLIC_CHARTTOOLS ReferenceSizeProvider
54 AUTO_RESIZE_AMBIGUOUS
,
58 ReferenceSizeProvider(
59 ::com::sun::star::awt::Size aPageSize
,
60 const ::com::sun::star::uno::Reference
<
61 ::com::sun::star::chart2::XChartDocument
> & xChartDoc
);
63 ::com::sun::star::awt::Size
getPageSize() const;
65 /** Retrieves the state auto-resize from all objects that support this
66 feature. If all objects return the same state, AUTO_RESIZE_YES or
67 AUTO_RESIZE_NO is returned.
69 If no object supporting the feature is found, AUTO_RESIZE_UNKNOWN is
70 returned. If there are multiple objects, some with state YES and some
71 with state NO, AUTO_RESIZE_AMBIGUOUS is returned.
73 static AutoResizeState
getAutoResizeState(
74 const ::com::sun::star::uno::Reference
<
75 ::com::sun::star::chart2::XChartDocument
> & xChartDoc
);
77 /** sets or resets the auto-resize at all objects that support this feature
78 for text to the opposite of the current setting. If the current state
79 is ambiguous, it is turned on. If the current state is unknown it stays
82 void toggleAutoResizeState();
85 /** Sets the ReferencePageSize according to the internal settings of this
86 class at the XPropertySet, and the adapted font sizes if bAdaptFontSizes
89 SAL_DLLPRIVATE
void setValuesAtPropertySet(
90 const ::com::sun::star::uno::Reference
<
91 ::com::sun::star::beans::XPropertySet
> & xProp
,
92 bool bAdaptFontSizes
= true );
94 /** Sets the ReferencePageSize according to the internal settings of this
95 class at the XTitle, and the adapted font sizes at the contained
98 SAL_DLLPRIVATE
void setValuesAtTitle(
99 const ::com::sun::star::uno::Reference
<
100 ::com::sun::star::chart2::XTitle
> & xTitle
);
102 /** Sets the internal value at all data series in the currently set model.
103 This is useful, if you have changed a chart-type and thus probably added
104 some new data series via model functionality.
106 void setValuesAtAllDataSeries();
109 SAL_DLLPRIVATE
bool useAutoScale() const;
111 /** sets the auto-resize at all objects that support this feature for text.
112 eNewState must be either AUTO_RESIZE_YES or AUTO_RESIZE_NO
114 SAL_DLLPRIVATE
void setAutoResizeState( AutoResizeState eNewState
);
116 /** Retrieves the auto-resize state from the given propertyset. The result
117 will be put into eInOutState. If you initialize eInOutState with
118 AUTO_RESIZE_UNKNOWN, you will get the actual state. If you pass any
119 other state, the result will be the accumulated state,
120 esp. AUTO_RESIZE_AMBIGUOUS, if the value was NO before, and is YES for
121 the current property set, or the other way round.
123 SAL_DLLPRIVATE
static void getAutoResizeFromPropSet(
124 const ::com::sun::star::uno::Reference
<
125 ::com::sun::star::beans::XPropertySet
> & xProp
,
126 AutoResizeState
& rInOutState
);
128 SAL_DLLPRIVATE
void impl_setValuesAtTitled(
129 const ::com::sun::star::uno::Reference
<
130 ::com::sun::star::chart2::XTitled
> & xTitled
);
131 SAL_DLLPRIVATE
static void impl_getAutoResizeFromTitled(
132 const ::com::sun::star::uno::Reference
<
133 ::com::sun::star::chart2::XTitled
> & xTitled
,
134 AutoResizeState
& rInOutState
);
136 ::com::sun::star::awt::Size m_aPageSize
;
137 ::com::sun::star::uno::Reference
<
138 ::com::sun::star::chart2::XChartDocument
> m_xChartDoc
;
139 bool m_bUseAutoScale
;
144 // CHART2_REFERENCESIZEPROVIDER_HXX