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 _VLEGEND_HXX
20 : #define _VLEGEND_HXX
21 :
22 : #include <com/sun/star/chart2/XLegend.hpp>
23 : #include <com/sun/star/drawing/XShapes.hpp>
24 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
25 : #include <com/sun/star/uno/XComponentContext.hpp>
26 : #include <com/sun/star/awt/Rectangle.hpp>
27 : #include <com/sun/star/frame/XModel.hpp>
28 :
29 : #include <vector>
30 :
31 : //.............................................................................
32 : namespace chart
33 : {
34 : //.............................................................................
35 :
36 : class LegendEntryProvider;
37 :
38 : //-----------------------------------------------------------------------------
39 : /**
40 : */
41 :
42 41 : class VLegend
43 : {
44 : public:
45 : VLegend( const ::com::sun::star::uno::Reference<
46 : ::com::sun::star::chart2::XLegend > & xLegend,
47 : const ::com::sun::star::uno::Reference<
48 : ::com::sun::star::uno::XComponentContext > & xContext,
49 : const std::vector< LegendEntryProvider* >& rLegendEntryProviderList );
50 :
51 : void init( const ::com::sun::star::uno::Reference<
52 : ::com::sun::star::drawing::XShapes >& xTargetPage,
53 : const ::com::sun::star::uno::Reference<
54 : ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
55 : const ::com::sun::star::uno::Reference<
56 : ::com::sun::star::frame::XModel > & xModel );
57 :
58 : void setDefaultWritingMode( sal_Int16 nDefaultWritingMode );
59 :
60 : void createShapes( const ::com::sun::star::awt::Size & rAvailableSpace,
61 : const ::com::sun::star::awt::Size & rPageSize );
62 :
63 : /** Sets the position according to its internal anchor.
64 :
65 : @param rOutAvailableSpace
66 : is modified by the method, if the legend is in a standard position,
67 : such that the space allocated by the legend is removed from it.
68 :
69 : @param rReferenceSize
70 : is used to calculate the offset (default 2%) from the edge.
71 : */
72 : void changePosition(
73 : ::com::sun::star::awt::Rectangle & rOutAvailableSpace,
74 : const ::com::sun::star::awt::Size & rReferenceSize );
75 :
76 : static bool isVisible(
77 : const ::com::sun::star::uno::Reference<
78 : ::com::sun::star::chart2::XLegend > & xLegend );
79 :
80 : private:
81 : ::com::sun::star::uno::Reference<
82 : ::com::sun::star::drawing::XShapes > m_xTarget;
83 : ::com::sun::star::uno::Reference<
84 : ::com::sun::star::lang::XMultiServiceFactory> m_xShapeFactory;
85 : ::com::sun::star::uno::Reference<
86 : ::com::sun::star::chart2::XLegend > m_xLegend;
87 : ::com::sun::star::uno::Reference<
88 : ::com::sun::star::drawing::XShape > m_xShape;
89 : ::com::sun::star::uno::Reference<
90 : ::com::sun::star::frame::XModel > m_xModel;
91 : ::com::sun::star::uno::Reference<
92 : ::com::sun::star::uno::XComponentContext > m_xContext;
93 :
94 : std::vector< LegendEntryProvider* > m_aLegendEntryProviderList;
95 :
96 : sal_Int16 m_nDefaultWritingMode;//to be used when writing mode is set to page
97 : };
98 :
99 : //.............................................................................
100 : } //namespace chart
101 : //.............................................................................
102 : #endif
103 :
104 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|