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 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_xmloff.hxx"
26 #include "SchXMLEnumConverter.hxx"
27 
28 #include <com/sun/star/chart/ChartLegendPosition.hpp>
29 #include <com/sun/star/chart/ChartLegendExpansion.hpp>
30 #include <com/sun/star/uno/Any.hxx>
31 
32 // header for rtl::Static
33 #include <rtl/instance.hxx>
34 
35 using ::rtl::OUString;
36 using namespace ::xmloff::token;
37 using namespace ::com::sun::star;
38 
39 namespace
40 {
41 //-----------------------------------------------------------------------
42 
43 SvXMLEnumMapEntry aXMLLegendPositionEnumMap[] =
44 {
45     { XML_START,    chart::ChartLegendPosition_LEFT     },
46     { XML_TOP,      chart::ChartLegendPosition_TOP      },
47     { XML_END,      chart::ChartLegendPosition_RIGHT    },
48     { XML_BOTTOM,   chart::ChartLegendPosition_BOTTOM   },
49     { XML_TOKEN_INVALID, 0 }
50 };
51 
52 class XMLLegendPositionPropertyHdl : public XMLEnumPropertyHdl
53 {
54 public:
XMLLegendPositionPropertyHdl()55 	XMLLegendPositionPropertyHdl()
56         : XMLEnumPropertyHdl( aXMLLegendPositionEnumMap, ::getCppuType((const chart::ChartLegendPosition*)0) ) {}
~XMLLegendPositionPropertyHdl()57     virtual ~XMLLegendPositionPropertyHdl() {};
58 };
59 
60 struct TheLegendPositionPropertyHdl : public rtl::Static< XMLLegendPositionPropertyHdl, TheLegendPositionPropertyHdl >
61 {
62 };
63 
64 //-----------------------------------------------------------------------
65 
66 SvXMLEnumMapEntry aXMLLegendExpansionEnumMap[] =
67 {
68     { XML_WIDE,        chart::ChartLegendExpansion_WIDE },
69     { XML_HIGH,        chart::ChartLegendExpansion_HIGH },
70     { XML_BALANCED,    chart::ChartLegendExpansion_BALANCED },
71     { XML_CUSTOM,      chart::ChartLegendExpansion_CUSTOM },
72     { XML_TOKEN_INVALID, 0 }
73 };
74 
75 class XMLLegendExpansionPropertyHdl : public XMLEnumPropertyHdl
76 {
77 public:
XMLLegendExpansionPropertyHdl()78 	XMLLegendExpansionPropertyHdl()
79         : XMLEnumPropertyHdl( aXMLLegendExpansionEnumMap, ::getCppuType((const chart::ChartLegendExpansion*)0) ) {}
~XMLLegendExpansionPropertyHdl()80     virtual ~XMLLegendExpansionPropertyHdl() {};
81 };
82 
83 struct TheLegendExpansionPropertyHdl : public rtl::Static< XMLLegendExpansionPropertyHdl, TheLegendExpansionPropertyHdl >
84 {
85 };
86 
87 //-----------------------------------------------------------------------
88 
89 }//end anonymous namespace
90 
91 //-----------------------------------------------------------------------
92 
getLegendPositionConverter()93 XMLEnumPropertyHdl& SchXMLEnumConverter::getLegendPositionConverter()
94 {
95     return TheLegendPositionPropertyHdl::get();
96 }
getLegendExpansionConverter()97 XMLEnumPropertyHdl& SchXMLEnumConverter::getLegendExpansionConverter()
98 {
99     return TheLegendExpansionPropertyHdl::get();
100 }
101