Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : :
21 : : // must be first
22 : : #include <canvas/debug.hxx>
23 : : #include <canvas/canvastools.hxx>
24 : :
25 : : #include "attributemap.hxx"
26 : : #include "tools.hxx"
27 : :
28 : :
29 : : namespace slideshow
30 : : {
31 : : namespace internal
32 : : {
33 : : typedef ::canvas::tools::ValueMap< AttributeType > AnimateAttributeMap;
34 : :
35 : 0 : AttributeType mapAttributeName( const ::rtl::OUString& rAttrName )
36 : : {
37 : : /** Maps attribute name to AttributeType enum.
38 : :
39 : : String entries are all case-insensitive and MUST
40 : : BE STORED lowercase.
41 : :
42 : : String entries MUST BE SORTED in ascending order!
43 : : */
44 : : static AnimateAttributeMap::MapEntry lcl_attributeMap[] =
45 : : {
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 }
70 : : };
71 : :
72 : : static AnimateAttributeMap aMap( lcl_attributeMap,
73 : : SAL_N_ELEMENTS(lcl_attributeMap),
74 : 0 : false );
75 : :
76 : 0 : AttributeType eAttributeType = ATTRIBUTE_INVALID;
77 : :
78 : : // determine the type from the attribute name
79 : 0 : if( !aMap.lookup( rAttrName,
80 : 0 : eAttributeType ) )
81 : : {
82 : : OSL_TRACE( "mapAttributeName(): attribute name %s not found in map.",
83 : : ::rtl::OUStringToOString( rAttrName,
84 : : RTL_TEXTENCODING_ASCII_US ).getStr() );
85 : 0 : return ATTRIBUTE_INVALID;
86 : : }
87 : :
88 : 0 : return eAttributeType;
89 : : }
90 : :
91 : : }
92 : : }
93 : :
94 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|