merge the formfield patch from ooo-build
[ooovba.git] / slideshow / source / engine / attributemap.cxx
blob5ab10b634d12d154ccddca0d3be08946c51b0ace
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: attributemap.cxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_slideshow.hxx"
34 // must be first
35 #include <canvas/debug.hxx>
36 #include <canvas/canvastools.hxx>
38 #include "attributemap.hxx"
39 #include "tools.hxx"
42 namespace slideshow
44 namespace internal
46 typedef ::canvas::tools::ValueMap< AttributeType > AnimateAttributeMap;
48 AttributeType mapAttributeName( const ::rtl::OUString& rAttrName )
50 /** Maps attribute name to AttributeType enum.
52 String entries are all case-insensitive and MUST
53 BE STORED lowercase.
55 String entries MUST BE SORTED in ascending order!
57 static AnimateAttributeMap::MapEntry lcl_attributeMap[] =
59 { "charcolor", ATTRIBUTE_CHAR_COLOR },
61 { "charfontname", ATTRIBUTE_CHAR_FONT_NAME },
63 { "charheight", ATTRIBUTE_CHAR_HEIGHT },
65 { "charposture", ATTRIBUTE_CHAR_POSTURE },
67 // TODO(Q1): This should prolly be changed in PPT import
68 // { "charrotation", ATTRIBUTE_CHAR_ROTATION },
69 { "charrotation", ATTRIBUTE_ROTATE },
71 { "charunderline", ATTRIBUTE_CHAR_UNDERLINE },
73 { "charweight", ATTRIBUTE_CHAR_WEIGHT },
75 { "color", ATTRIBUTE_COLOR },
77 { "dimcolor", ATTRIBUTE_DIMCOLOR },
79 { "fillcolor", ATTRIBUTE_FILL_COLOR },
81 { "fillstyle", ATTRIBUTE_FILL_STYLE },
83 { "height", ATTRIBUTE_HEIGHT },
85 { "linecolor", ATTRIBUTE_LINE_COLOR },
87 { "linestyle", ATTRIBUTE_LINE_STYLE },
89 { "opacity", ATTRIBUTE_OPACITY },
91 { "rotate", ATTRIBUTE_ROTATE },
93 { "skewx", ATTRIBUTE_SKEW_X },
95 { "skewy", ATTRIBUTE_SKEW_Y },
97 { "visibility", ATTRIBUTE_VISIBILITY },
99 { "width", ATTRIBUTE_WIDTH },
101 { "x", ATTRIBUTE_POS_X },
103 { "y", ATTRIBUTE_POS_Y }
106 static AnimateAttributeMap aMap( lcl_attributeMap,
107 sizeof(lcl_attributeMap)/sizeof(*lcl_attributeMap),
108 false );
110 AttributeType eAttributeType = ATTRIBUTE_INVALID;
112 // determine the type from the attribute name
113 if( !aMap.lookup( rAttrName,
114 eAttributeType ) )
116 OSL_TRACE( "mapAttributeName(): attribute name %s not found in map.",
117 ::rtl::OUStringToOString( rAttrName,
118 RTL_TEXTENCODING_ASCII_US ).getStr() );
119 return ATTRIBUTE_INVALID;
122 return eAttributeType;