1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_xmloff.hxx" 30 #include "SchXMLEnumConverter.hxx" 31 32 #include <com/sun/star/chart/ChartLegendPosition.hpp> 33 #include <com/sun/star/chart/ChartLegendExpansion.hpp> 34 #include <com/sun/star/uno/Any.hxx> 35 36 // header for rtl::Static 37 #include <rtl/instance.hxx> 38 39 using ::rtl::OUString; 40 using namespace ::xmloff::token; 41 using namespace ::com::sun::star; 42 43 namespace 44 { 45 //----------------------------------------------------------------------- 46 47 SvXMLEnumMapEntry aXMLLegendPositionEnumMap[] = 48 { 49 { XML_START, chart::ChartLegendPosition_LEFT }, 50 { XML_TOP, chart::ChartLegendPosition_TOP }, 51 { XML_END, chart::ChartLegendPosition_RIGHT }, 52 { XML_BOTTOM, chart::ChartLegendPosition_BOTTOM }, 53 { XML_TOKEN_INVALID, 0 } 54 }; 55 56 class XMLLegendPositionPropertyHdl : public XMLEnumPropertyHdl 57 { 58 public: 59 XMLLegendPositionPropertyHdl() 60 : XMLEnumPropertyHdl( aXMLLegendPositionEnumMap, ::getCppuType((const chart::ChartLegendPosition*)0) ) {} 61 virtual ~XMLLegendPositionPropertyHdl() {}; 62 }; 63 64 struct TheLegendPositionPropertyHdl : public rtl::Static< XMLLegendPositionPropertyHdl, TheLegendPositionPropertyHdl > 65 { 66 }; 67 68 //----------------------------------------------------------------------- 69 70 SvXMLEnumMapEntry aXMLLegendExpansionEnumMap[] = 71 { 72 { XML_WIDE, chart::ChartLegendExpansion_WIDE }, 73 { XML_HIGH, chart::ChartLegendExpansion_HIGH }, 74 { XML_BALANCED, chart::ChartLegendExpansion_BALANCED }, 75 { XML_CUSTOM, chart::ChartLegendExpansion_CUSTOM }, 76 { XML_TOKEN_INVALID, 0 } 77 }; 78 79 class XMLLegendExpansionPropertyHdl : public XMLEnumPropertyHdl 80 { 81 public: 82 XMLLegendExpansionPropertyHdl() 83 : XMLEnumPropertyHdl( aXMLLegendExpansionEnumMap, ::getCppuType((const chart::ChartLegendExpansion*)0) ) {} 84 virtual ~XMLLegendExpansionPropertyHdl() {}; 85 }; 86 87 struct TheLegendExpansionPropertyHdl : public rtl::Static< XMLLegendExpansionPropertyHdl, TheLegendExpansionPropertyHdl > 88 { 89 }; 90 91 //----------------------------------------------------------------------- 92 93 }//end anonymous namespace 94 95 //----------------------------------------------------------------------- 96 97 XMLEnumPropertyHdl& SchXMLEnumConverter::getLegendPositionConverter() 98 { 99 return TheLegendPositionPropertyHdl::get(); 100 } 101 XMLEnumPropertyHdl& SchXMLEnumConverter::getLegendExpansionConverter() 102 { 103 return TheLegendExpansionPropertyHdl::get(); 104 } 105