Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_CHART2_SOURCE_INC_REFERENCESIZEPROVIDER_HXX
20 : #define INCLUDED_CHART2_SOURCE_INC_REFERENCESIZEPROVIDER_HXX
21 :
22 : #include <com/sun/star/uno/Reference.hxx>
23 : #include <com/sun/star/chart2/XChartDocument.hpp>
24 : #include <com/sun/star/awt/Size.hpp>
25 : #include "charttoolsdllapi.hxx"
26 :
27 : namespace com { namespace sun { namespace star {
28 : namespace chart2 {
29 : class XTitle;
30 : class XTitled;
31 : }
32 : }}}
33 :
34 : namespace chart
35 : {
36 :
37 0 : class OOO_DLLPUBLIC_CHARTTOOLS ReferenceSizeProvider
38 : {
39 : public:
40 :
41 : enum AutoResizeState
42 : {
43 : AUTO_RESIZE_YES,
44 : AUTO_RESIZE_NO,
45 : AUTO_RESIZE_AMBIGUOUS,
46 : AUTO_RESIZE_UNKNOWN
47 : };
48 :
49 : ReferenceSizeProvider(
50 : ::com::sun::star::awt::Size aPageSize,
51 : const ::com::sun::star::uno::Reference<
52 : ::com::sun::star::chart2::XChartDocument > & xChartDoc );
53 :
54 : ::com::sun::star::awt::Size getPageSize() const;
55 :
56 : /** Retrieves the state auto-resize from all objects that support this
57 : feature. If all objects return the same state, AUTO_RESIZE_YES or
58 : AUTO_RESIZE_NO is returned.
59 :
60 : If no object supporting the feature is found, AUTO_RESIZE_UNKNOWN is
61 : returned. If there are multiple objects, some with state YES and some
62 : with state NO, AUTO_RESIZE_AMBIGUOUS is returned.
63 : */
64 : static AutoResizeState getAutoResizeState(
65 : const ::com::sun::star::uno::Reference<
66 : ::com::sun::star::chart2::XChartDocument > & xChartDoc );
67 :
68 : /** sets or resets the auto-resize at all objects that support this feature
69 : for text to the opposite of the current setting. If the current state
70 : is ambiguous, it is turned on. If the current state is unknown it stays
71 : unknown.
72 : */
73 : void toggleAutoResizeState();
74 :
75 : /** Sets the ReferencePageSize according to the internal settings of this
76 : class at the XPropertySet, and the adapted font sizes if bAdaptFontSizes
77 : is </sal_True>.
78 : */
79 : SAL_DLLPRIVATE void setValuesAtPropertySet(
80 : const ::com::sun::star::uno::Reference<
81 : ::com::sun::star::beans::XPropertySet > & xProp,
82 : bool bAdaptFontSizes = true );
83 :
84 : /** Sets the ReferencePageSize according to the internal settings of this
85 : class at the XTitle, and the adapted font sizes at the contained
86 : XFormattedStrings
87 : */
88 : SAL_DLLPRIVATE void setValuesAtTitle(
89 : const ::com::sun::star::uno::Reference<
90 : ::com::sun::star::chart2::XTitle > & xTitle );
91 :
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.
95 : */
96 : void setValuesAtAllDataSeries();
97 :
98 : private:
99 : SAL_DLLPRIVATE bool useAutoScale() const;
100 :
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
103 : */
104 : SAL_DLLPRIVATE void setAutoResizeState( AutoResizeState eNewState );
105 :
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.
112 : */
113 : SAL_DLLPRIVATE static void getAutoResizeFromPropSet(
114 : const ::com::sun::star::uno::Reference<
115 : ::com::sun::star::beans::XPropertySet > & xProp,
116 : AutoResizeState & rInOutState );
117 :
118 : SAL_DLLPRIVATE void impl_setValuesAtTitled(
119 : const ::com::sun::star::uno::Reference<
120 : ::com::sun::star::chart2::XTitled > & xTitled );
121 : SAL_DLLPRIVATE static void impl_getAutoResizeFromTitled(
122 : const ::com::sun::star::uno::Reference<
123 : ::com::sun::star::chart2::XTitled > & xTitled,
124 : AutoResizeState & rInOutState );
125 :
126 : ::com::sun::star::awt::Size m_aPageSize;
127 : ::com::sun::star::uno::Reference<
128 : ::com::sun::star::chart2::XChartDocument > m_xChartDoc;
129 : bool m_bUseAutoScale;
130 : };
131 :
132 : } // namespace chart
133 :
134 : // INCLUDED_CHART2_SOURCE_INC_REFERENCESIZEPROVIDER_HXX
135 : #endif
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|