1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <canvas/debug.hxx>
23 #include <canvas/canvastools.hxx>
25 #include "attributemap.hxx"
33 typedef ::canvas::tools::ValueMap
< AttributeType
> AnimateAttributeMap
;
35 AttributeType
mapAttributeName( const OUString
& rAttrName
)
37 /** Maps attribute name to AttributeType enum.
39 String entries are all case-insensitive and MUST
42 String entries MUST BE SORTED in ascending order!
44 static const AnimateAttributeMap::MapEntry lcl_attributeMap
[] =
46 { "charcolor", ATTRIBUTE_CHAR_COLOR
},
47 { "charfontname", ATTRIBUTE_CHAR_FONT_NAME
},
48 { "charheight", ATTRIBUTE_CHAR_HEIGHT
},
49 { "charposture", ATTRIBUTE_CHAR_POSTURE
},
50 // TODO(Q1): This should prolly be changed in PPT import
51 // { "charrotation", ATTRIBUTE_CHAR_ROTATION },
52 { "charrotation", ATTRIBUTE_ROTATE
},
53 { "charunderline", ATTRIBUTE_CHAR_UNDERLINE
},
54 { "charweight", ATTRIBUTE_CHAR_WEIGHT
},
55 { "color", ATTRIBUTE_COLOR
},
56 { "dimcolor", ATTRIBUTE_DIMCOLOR
},
57 { "fillcolor", ATTRIBUTE_FILL_COLOR
},
58 { "fillstyle", ATTRIBUTE_FILL_STYLE
},
59 { "height", ATTRIBUTE_HEIGHT
},
60 { "linecolor", ATTRIBUTE_LINE_COLOR
},
61 { "linestyle", ATTRIBUTE_LINE_STYLE
},
62 { "opacity", ATTRIBUTE_OPACITY
},
63 { "rotate", ATTRIBUTE_ROTATE
},
64 { "skewx", ATTRIBUTE_SKEW_X
},
65 { "skewy", ATTRIBUTE_SKEW_Y
},
66 { "visibility", ATTRIBUTE_VISIBILITY
},
67 { "width", ATTRIBUTE_WIDTH
},
68 { "x", ATTRIBUTE_POS_X
},
69 { "y", ATTRIBUTE_POS_Y
}
72 static const AnimateAttributeMap
aMap( lcl_attributeMap
,
73 SAL_N_ELEMENTS(lcl_attributeMap
),
76 AttributeType eAttributeType
= ATTRIBUTE_INVALID
;
78 // determine the type from the attribute name
79 if( !aMap
.lookup( rAttrName
,
82 OSL_TRACE( "mapAttributeName(): attribute name %s not found in map.",
83 OUStringToOString( rAttrName
,
84 RTL_TEXTENCODING_ASCII_US
).getStr() );
85 return ATTRIBUTE_INVALID
;
88 return eAttributeType
;
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */