Avoid potential negative array index access to cached text.
[LibreOffice.git] / xmloff / source / chart / SchXMLEnumConverter.cxx
blob7bb888ee038093d7a5d705a68bee97faa7fce434
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <com/sun/star/chart/ChartLegendPosition.hpp>
21 #include <com/sun/star/chart/ChartLegendExpansion.hpp>
22 #include "SchXMLEnumConverter.hxx"
23 #include <xmloff/xmlement.hxx>
25 using namespace ::xmloff::token;
26 using namespace ::com::sun::star;
28 namespace
31 const SvXMLEnumMapEntry<chart::ChartLegendPosition> aXMLLegendPositionEnumMap[] =
33 { XML_START, chart::ChartLegendPosition_LEFT },
34 { XML_TOP, chart::ChartLegendPosition_TOP },
35 { XML_END, chart::ChartLegendPosition_RIGHT },
36 { XML_BOTTOM, chart::ChartLegendPosition_BOTTOM },
37 { XML_TOKEN_INVALID, chart::ChartLegendPosition(0) }
40 class XMLLegendPositionPropertyHdl : public XMLEnumPropertyHdl
42 public:
43 XMLLegendPositionPropertyHdl()
44 : XMLEnumPropertyHdl( aXMLLegendPositionEnumMap) {}
47 const SvXMLEnumMapEntry<chart::ChartLegendExpansion> aXMLLegendExpansionEnumMap[] =
49 { XML_WIDE, chart::ChartLegendExpansion_WIDE },
50 { XML_HIGH, chart::ChartLegendExpansion_HIGH },
51 { XML_BALANCED, chart::ChartLegendExpansion_BALANCED },
52 { XML_CUSTOM, chart::ChartLegendExpansion_CUSTOM },
53 { XML_TOKEN_INVALID, chart::ChartLegendExpansion(0) }
56 class XMLLegendExpansionPropertyHdl : public XMLEnumPropertyHdl
58 public:
59 XMLLegendExpansionPropertyHdl()
60 : XMLEnumPropertyHdl( aXMLLegendExpansionEnumMap) {}
63 }//end anonymous namespace
65 XMLEnumPropertyHdl& SchXMLEnumConverter::getLegendPositionConverter()
67 static XMLLegendPositionPropertyHdl SINGLETON;
68 return SINGLETON;
70 XMLEnumPropertyHdl& SchXMLEnumConverter::getLegendExpansionConverter()
72 static XMLLegendExpansionPropertyHdl SINGLETON;
73 return SINGLETON;
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */