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