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 CHART2_REFERENCESIZEPROVIDER_HXX
20 : #define CHART2_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 : // ----------------------------------------
35 : namespace chart
36 : {
37 :
38 0 : class OOO_DLLPUBLIC_CHARTTOOLS ReferenceSizeProvider
39 : {
40 : public:
41 :
42 : enum AutoResizeState
43 : {
44 : AUTO_RESIZE_YES,
45 : AUTO_RESIZE_NO,
46 : AUTO_RESIZE_AMBIGUOUS,
47 : AUTO_RESIZE_UNKNOWN
48 : };
49 :
50 : ReferenceSizeProvider(
51 : ::com::sun::star::awt::Size aPageSize,
52 : const ::com::sun::star::uno::Reference<
53 : ::com::sun::star::chart2::XChartDocument > & xChartDoc );
54 :
55 : ::com::sun::star::awt::Size getPageSize() const;
56 :
57 : /** Retrieves the state auto-resize from all objects that support this
58 : feature. If all objects return the same state, AUTO_RESIZE_YES or
59 : AUTO_RESIZE_NO is returned.
60 :
61 : If no object supporting the feature is found, AUTO_RESIZE_UNKNOWN is
62 : returned. If there are multiple objects, some with state YES and some
63 : with state NO, AUTO_RESIZE_AMBIGUOUS is returned.
64 : */
65 : static AutoResizeState getAutoResizeState(
66 : const ::com::sun::star::uno::Reference<
67 : ::com::sun::star::chart2::XChartDocument > & xChartDoc );
68 :
69 : /** sets or resets the auto-resize at all objects that support this feature
70 : for text to the opposite of the current setting. If the current state
71 : is ambiguous, it is turned on. If the current state is unknown it stays
72 : unknown.
73 : */
74 : void toggleAutoResizeState();
75 :
76 :
77 : /** Sets the ReferencePageSize according to the internal settings of this
78 : class at the XPropertySet, and the adapted font sizes if bAdaptFontSizes
79 : is </sal_True>.
80 : */
81 : SAL_DLLPRIVATE void setValuesAtPropertySet(
82 : const ::com::sun::star::uno::Reference<
83 : ::com::sun::star::beans::XPropertySet > & xProp,
84 : bool bAdaptFontSizes = true );
85 :
86 : /** Sets the ReferencePageSize according to the internal settings of this
87 : class at the XTitle, and the adapted font sizes at the contained
88 : XFormattedStrings
89 : */
90 : SAL_DLLPRIVATE void setValuesAtTitle(
91 : const ::com::sun::star::uno::Reference<
92 : ::com::sun::star::chart2::XTitle > & xTitle );
93 :
94 : /** Sets the internal value at all data series in the currently set model.
95 : This is useful, if you have changed a chart-type and thus probably added
96 : some new data series via model functionality.
97 : */
98 : void setValuesAtAllDataSeries();
99 :
100 : private:
101 : SAL_DLLPRIVATE bool useAutoScale() const;
102 :
103 : /** sets the auto-resize at all objects that support this feature for text.
104 : eNewState must be either AUTO_RESIZE_YES or AUTO_RESIZE_NO
105 : */
106 : SAL_DLLPRIVATE void setAutoResizeState( AutoResizeState eNewState );
107 :
108 : /** Retrieves the auto-resize state from the given propertyset. The result
109 : will be put into eInOutState. If you initialize eInOutState with
110 : AUTO_RESIZE_UNKNOWN, you will get the actual state. If you pass any
111 : other state, the result will be the accumulated state,
112 : esp. AUTO_RESIZE_AMBIGUOUS, if the value was NO before, and is YES for
113 : the current property set, or the other way round.
114 : */
115 : SAL_DLLPRIVATE static void getAutoResizeFromPropSet(
116 : const ::com::sun::star::uno::Reference<
117 : ::com::sun::star::beans::XPropertySet > & xProp,
118 : AutoResizeState & rInOutState );
119 :
120 : SAL_DLLPRIVATE void impl_setValuesAtTitled(
121 : const ::com::sun::star::uno::Reference<
122 : ::com::sun::star::chart2::XTitled > & xTitled );
123 : SAL_DLLPRIVATE static void impl_getAutoResizeFromTitled(
124 : const ::com::sun::star::uno::Reference<
125 : ::com::sun::star::chart2::XTitled > & xTitled,
126 : AutoResizeState & rInOutState );
127 :
128 : ::com::sun::star::awt::Size m_aPageSize;
129 : ::com::sun::star::uno::Reference<
130 : ::com::sun::star::chart2::XChartDocument > m_xChartDoc;
131 : bool m_bUseAutoScale;
132 : };
133 :
134 : } // namespace chart
135 :
136 : // CHART2_REFERENCESIZEPROVIDER_HXX
137 : #endif
138 :
139 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|