xref: /aoo4110/main/chart2/source/view/main/VLegend.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _VLEGEND_HXX
24 #define _VLEGEND_HXX
25 
26 #include <com/sun/star/chart2/XLegend.hpp>
27 #include <com/sun/star/drawing/XShapes.hpp>
28 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <com/sun/star/awt/Rectangle.hpp>
31 #include <com/sun/star/frame/XModel.hpp>
32 
33 #include <vector>
34 
35 //.............................................................................
36 namespace chart
37 {
38 //.............................................................................
39 
40 class LegendEntryProvider;
41 
42 //-----------------------------------------------------------------------------
43 /**
44 */
45 
46 class VLegend
47 {
48 public:
49     VLegend( const ::com::sun::star::uno::Reference<
50                  ::com::sun::star::chart2::XLegend > & xLegend,
51              const ::com::sun::star::uno::Reference<
52                  ::com::sun::star::uno::XComponentContext > & xContext,
53              const std::vector< LegendEntryProvider* >& rLegendEntryProviderList );
54 
55     void init( const ::com::sun::star::uno::Reference<
56                             ::com::sun::star::drawing::XShapes >& xTargetPage,
57                         const ::com::sun::star::uno::Reference<
58                             ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
59                         const ::com::sun::star::uno::Reference<
60                             ::com::sun::star::frame::XModel > & xModel );
61 
62     void setDefaultWritingMode( sal_Int16 nDefaultWritingMode );
63 
64     void createShapes( const ::com::sun::star::awt::Size & rAvailableSpace,
65                        const ::com::sun::star::awt::Size & rPageSize );
66 
67     /** Sets the position according to its internal anchor.
68 
69         @param rOutAvailableSpace
70             is modified by the method, if the legend is in a standard position,
71             such that the space allocated by the legend is removed from it.
72 
73         @param rReferenceSize
74             is used to calculate the offset (default 2%) from the edge.
75      */
76     void changePosition(
77         ::com::sun::star::awt::Rectangle & rOutAvailableSpace,
78         const ::com::sun::star::awt::Size & rReferenceSize );
79 
80     static bool isVisible(
81         const ::com::sun::star::uno::Reference<
82             ::com::sun::star::chart2::XLegend > & xLegend );
83 
84 private:
85     ::com::sun::star::uno::Reference<
86                     ::com::sun::star::drawing::XShapes >            m_xTarget;
87     ::com::sun::star::uno::Reference<
88                     ::com::sun::star::lang::XMultiServiceFactory>	m_xShapeFactory;
89     ::com::sun::star::uno::Reference<
90                     ::com::sun::star::chart2::XLegend >             m_xLegend;
91     ::com::sun::star::uno::Reference<
92                     ::com::sun::star::drawing::XShape >             m_xShape;
93     ::com::sun::star::uno::Reference<
94                     ::com::sun::star::frame::XModel >               m_xModel;
95     ::com::sun::star::uno::Reference<
96                     ::com::sun::star::uno::XComponentContext >      m_xContext;
97 
98     std::vector< LegendEntryProvider* >         m_aLegendEntryProviderList;
99 
100     sal_Int16 m_nDefaultWritingMode;//to be used when writing mode is set to page
101 };
102 
103 //.............................................................................
104 } //namespace chart
105 //.............................................................................
106 #endif
107 
108