1*de7b3f82SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*de7b3f82SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*de7b3f82SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*de7b3f82SAndrew Rist * distributed with this work for additional information 6*de7b3f82SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*de7b3f82SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*de7b3f82SAndrew Rist * "License"); you may not use this file except in compliance 9*de7b3f82SAndrew Rist * with the License. You may obtain a copy of the License at 10*de7b3f82SAndrew Rist * 11*de7b3f82SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*de7b3f82SAndrew Rist * 13*de7b3f82SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*de7b3f82SAndrew Rist * software distributed under the License is distributed on an 15*de7b3f82SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*de7b3f82SAndrew Rist * KIND, either express or implied. See the License for the 17*de7b3f82SAndrew Rist * specific language governing permissions and limitations 18*de7b3f82SAndrew Rist * under the License. 19*de7b3f82SAndrew Rist * 20*de7b3f82SAndrew Rist *************************************************************/ 21*de7b3f82SAndrew Rist 22*de7b3f82SAndrew Rist 23cdf0e10cSrcweir #ifndef CHART2_REFERENCESIZEPROVIDER_HXX 24cdf0e10cSrcweir #define CHART2_REFERENCESIZEPROVIDER_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <com/sun/star/uno/Reference.hxx> 27cdf0e10cSrcweir #include <com/sun/star/chart2/XChartDocument.hpp> 28cdf0e10cSrcweir #include <com/sun/star/awt/Size.hpp> 29cdf0e10cSrcweir #include "charttoolsdllapi.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir namespace com { namespace sun { namespace star { 32cdf0e10cSrcweir namespace chart2 { 33cdf0e10cSrcweir class XTitle; 34cdf0e10cSrcweir class XTitled; 35cdf0e10cSrcweir } 36cdf0e10cSrcweir }}} 37cdf0e10cSrcweir 38cdf0e10cSrcweir // ---------------------------------------- 39cdf0e10cSrcweir namespace chart 40cdf0e10cSrcweir { 41cdf0e10cSrcweir 42cdf0e10cSrcweir class OOO_DLLPUBLIC_CHARTTOOLS ReferenceSizeProvider 43cdf0e10cSrcweir { 44cdf0e10cSrcweir public: 45cdf0e10cSrcweir 46cdf0e10cSrcweir enum AutoResizeState 47cdf0e10cSrcweir { 48cdf0e10cSrcweir AUTO_RESIZE_YES, 49cdf0e10cSrcweir AUTO_RESIZE_NO, 50cdf0e10cSrcweir AUTO_RESIZE_AMBIGUOUS, 51cdf0e10cSrcweir AUTO_RESIZE_UNKNOWN 52cdf0e10cSrcweir }; 53cdf0e10cSrcweir 54cdf0e10cSrcweir ReferenceSizeProvider( 55cdf0e10cSrcweir ::com::sun::star::awt::Size aPageSize, 56cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 57cdf0e10cSrcweir ::com::sun::star::chart2::XChartDocument > & xChartDoc ); 58cdf0e10cSrcweir 59cdf0e10cSrcweir ::com::sun::star::awt::Size getPageSize() const; 60cdf0e10cSrcweir 61cdf0e10cSrcweir /** Retrieves the state auto-resize from all objects that support this 62cdf0e10cSrcweir feature. If all objects return the same state, AUTO_RESIZE_YES or 63cdf0e10cSrcweir AUTO_RESIZE_NO is returned. 64cdf0e10cSrcweir 65cdf0e10cSrcweir If no object supporting the feature is found, AUTO_RESIZE_UNKNOWN is 66cdf0e10cSrcweir returned. If there are multiple objects, some with state YES and some 67cdf0e10cSrcweir with state NO, AUTO_RESIZE_AMBIGUOUS is returned. 68cdf0e10cSrcweir */ 69cdf0e10cSrcweir static AutoResizeState getAutoResizeState( 70cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 71cdf0e10cSrcweir ::com::sun::star::chart2::XChartDocument > & xChartDoc ); 72cdf0e10cSrcweir 73cdf0e10cSrcweir /** sets or resets the auto-resize at all objects that support this feature 74cdf0e10cSrcweir for text to the opposite of the current setting. If the current state 75cdf0e10cSrcweir is ambiguous, it is turned on. If the current state is unknown it stays 76cdf0e10cSrcweir unknown. 77cdf0e10cSrcweir */ 78cdf0e10cSrcweir void toggleAutoResizeState(); 79cdf0e10cSrcweir 80cdf0e10cSrcweir 81cdf0e10cSrcweir /** Sets the ReferencePageSize according to the internal settings of this 82cdf0e10cSrcweir class at the XPropertySet, and the adapted font sizes if bAdaptFontSizes 83cdf0e10cSrcweir is </sal_True>. 84cdf0e10cSrcweir */ 85cdf0e10cSrcweir SAL_DLLPRIVATE void setValuesAtPropertySet( 86cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 87cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet > & xProp, 88cdf0e10cSrcweir bool bAdaptFontSizes = true ); 89cdf0e10cSrcweir 90cdf0e10cSrcweir /** Sets the ReferencePageSize according to the internal settings of this 91cdf0e10cSrcweir class at the XTitle, and the adapted font sizes at the contained 92cdf0e10cSrcweir XFormattedStrings 93cdf0e10cSrcweir */ 94cdf0e10cSrcweir SAL_DLLPRIVATE void setValuesAtTitle( 95cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 96cdf0e10cSrcweir ::com::sun::star::chart2::XTitle > & xTitle ); 97cdf0e10cSrcweir 98cdf0e10cSrcweir /** Sets the internal value at all data series in the currently set model. 99cdf0e10cSrcweir This is useful, if you have changed a chart-type and thus probably added 100cdf0e10cSrcweir some new data series via model functionality. 101cdf0e10cSrcweir */ 102cdf0e10cSrcweir void setValuesAtAllDataSeries(); 103cdf0e10cSrcweir 104cdf0e10cSrcweir private: 105cdf0e10cSrcweir SAL_DLLPRIVATE bool useAutoScale() const; 106cdf0e10cSrcweir 107cdf0e10cSrcweir /** sets the auto-resize at all objects that support this feature for text. 108cdf0e10cSrcweir eNewState must be either AUTO_RESIZE_YES or AUTO_RESIZE_NO 109cdf0e10cSrcweir */ 110cdf0e10cSrcweir SAL_DLLPRIVATE void setAutoResizeState( AutoResizeState eNewState ); 111cdf0e10cSrcweir 112cdf0e10cSrcweir /** Retrieves the auto-resize state from the given propertyset. The result 113cdf0e10cSrcweir will be put into eInOutState. If you initialize eInOutState with 114cdf0e10cSrcweir AUTO_RESIZE_UNKNOWN, you will get the actual state. If you pass any 115cdf0e10cSrcweir other state, the result will be the accumulated state, 116cdf0e10cSrcweir esp. AUTO_RESIZE_AMBIGUOUS, if the value was NO before, and is YES for 117cdf0e10cSrcweir the current property set, or the other way round. 118cdf0e10cSrcweir */ 119cdf0e10cSrcweir SAL_DLLPRIVATE static void getAutoResizeFromPropSet( 120cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 121cdf0e10cSrcweir ::com::sun::star::beans::XPropertySet > & xProp, 122cdf0e10cSrcweir AutoResizeState & rInOutState ); 123cdf0e10cSrcweir 124cdf0e10cSrcweir SAL_DLLPRIVATE void impl_setValuesAtTitled( 125cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 126cdf0e10cSrcweir ::com::sun::star::chart2::XTitled > & xTitled ); 127cdf0e10cSrcweir SAL_DLLPRIVATE static void impl_getAutoResizeFromTitled( 128cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 129cdf0e10cSrcweir ::com::sun::star::chart2::XTitled > & xTitled, 130cdf0e10cSrcweir AutoResizeState & rInOutState ); 131cdf0e10cSrcweir 132cdf0e10cSrcweir ::com::sun::star::awt::Size m_aPageSize; 133cdf0e10cSrcweir ::com::sun::star::uno::Reference< 134cdf0e10cSrcweir ::com::sun::star::chart2::XChartDocument > m_xChartDoc; 135cdf0e10cSrcweir bool m_bUseAutoScale; 136cdf0e10cSrcweir }; 137cdf0e10cSrcweir 138cdf0e10cSrcweir } // namespace chart 139cdf0e10cSrcweir 140cdf0e10cSrcweir // CHART2_REFERENCESIZEPROVIDER_HXX 141cdf0e10cSrcweir #endif 142