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 _CHART2_TOOLS_LEGENDHELPER_HXX
24 #define _CHART2_TOOLS_LEGENDHELPER_HXX
25 
26 // header for class OUString
27 #include <rtl/ustring.hxx>
28 #include <com/sun/star/chart2/XLegend.hpp>
29 #include <com/sun/star/chart2/XDiagram.hpp>
30 #include <com/sun/star/frame/XModel.hpp>
31 #include <com/sun/star/uno/XComponentContext.hpp>
32 #include "charttoolsdllapi.hxx"
33 
34 //.............................................................................
35 namespace chart
36 {
37 //.............................................................................
38 
39 //-----------------------------------------------------------------------------
40 /**
41 */
42 
43 class OOO_DLLPUBLIC_CHARTTOOLS LegendHelper
44 {
45 public:
46     static ::com::sun::star::uno::Reference<
47             ::com::sun::star::chart2::XLegend >
48         showLegend( const ::com::sun::star::uno::Reference<
49                        ::com::sun::star::frame::XModel >& xModel
50                   , const ::com::sun::star::uno::Reference<
51                        ::com::sun::star::uno::XComponentContext >& xContext );
52 
53     static  void hideLegend( const ::com::sun::star::uno::Reference<
54                        ::com::sun::star::frame::XModel >& xModel );
55 
56     static ::com::sun::star::uno::Reference<
57             ::com::sun::star::chart2::XLegend >
58         getLegend( const ::com::sun::star::uno::Reference<
59                        ::com::sun::star::frame::XModel >& xModel
60                  , const ::com::sun::star::uno::Reference<
61                        ::com::sun::star::uno::XComponentContext >& xContext = 0
62                  , bool bCreate = false );
63 
64     /** returns <FALSE/>, if either there is no legend at the diagram, or there
65         is a legend which has a "Show" property of value <FALSE/>. Otherwise,
66         <TRUE/> is returned.
67      */
68     static bool hasLegend( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > & xDiagram );
69 };
70 
71 //.............................................................................
72 } //namespace chart
73 //.............................................................................
74 #endif
75