1*70f497fbSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*70f497fbSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*70f497fbSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*70f497fbSAndrew Rist  * distributed with this work for additional information
6*70f497fbSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*70f497fbSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*70f497fbSAndrew Rist  * "License"); you may not use this file except in compliance
9*70f497fbSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*70f497fbSAndrew Rist  *
11*70f497fbSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*70f497fbSAndrew Rist  *
13*70f497fbSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*70f497fbSAndrew Rist  * software distributed under the License is distributed on an
15*70f497fbSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*70f497fbSAndrew Rist  * KIND, either express or implied.  See the License for the
17*70f497fbSAndrew Rist  * specific language governing permissions and limitations
18*70f497fbSAndrew Rist  * under the License.
19*70f497fbSAndrew Rist  *
20*70f497fbSAndrew Rist  *************************************************************/
21*70f497fbSAndrew Rist 
22*70f497fbSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_slideshow.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // must be first
28cdf0e10cSrcweir #include <canvas/debug.hxx>
29cdf0e10cSrcweir #include <canvas/canvastools.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include "attributemap.hxx"
32cdf0e10cSrcweir #include "tools.hxx"
33cdf0e10cSrcweir 
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace slideshow
36cdf0e10cSrcweir {
37cdf0e10cSrcweir     namespace internal
38cdf0e10cSrcweir     {
39cdf0e10cSrcweir         typedef ::canvas::tools::ValueMap< AttributeType > AnimateAttributeMap;
40cdf0e10cSrcweir 
mapAttributeName(const::rtl::OUString & rAttrName)41cdf0e10cSrcweir         AttributeType mapAttributeName( const ::rtl::OUString& rAttrName )
42cdf0e10cSrcweir         {
43cdf0e10cSrcweir             /** Maps attribute name to AttributeType enum.
44cdf0e10cSrcweir 
45cdf0e10cSrcweir 	            String entries are all case-insensitive and MUST
46cdf0e10cSrcweir     	        BE STORED lowercase.
47cdf0e10cSrcweir 
48cdf0e10cSrcweir         	    String entries MUST BE SORTED in ascending order!
49cdf0e10cSrcweir             */
50cdf0e10cSrcweir             static AnimateAttributeMap::MapEntry lcl_attributeMap[] =
51cdf0e10cSrcweir                 {
52cdf0e10cSrcweir                     { "charcolor", ATTRIBUTE_CHAR_COLOR },
53cdf0e10cSrcweir 
54cdf0e10cSrcweir                     { "charfontname", ATTRIBUTE_CHAR_FONT_NAME },
55cdf0e10cSrcweir 
56cdf0e10cSrcweir                     { "charheight", ATTRIBUTE_CHAR_HEIGHT },
57cdf0e10cSrcweir 
58cdf0e10cSrcweir                     { "charposture", ATTRIBUTE_CHAR_POSTURE },
59cdf0e10cSrcweir 
60cdf0e10cSrcweir                     // TODO(Q1): This should prolly be changed in PPT import
61cdf0e10cSrcweir                     // { "charrotation", ATTRIBUTE_CHAR_ROTATION },
62cdf0e10cSrcweir                     { "charrotation", ATTRIBUTE_ROTATE },
63cdf0e10cSrcweir 
64cdf0e10cSrcweir                     { "charunderline", ATTRIBUTE_CHAR_UNDERLINE },
65cdf0e10cSrcweir 
66cdf0e10cSrcweir                     { "charweight", ATTRIBUTE_CHAR_WEIGHT },
67cdf0e10cSrcweir 
68cdf0e10cSrcweir                     { "color", ATTRIBUTE_COLOR },
69cdf0e10cSrcweir 
70cdf0e10cSrcweir                     { "dimcolor", ATTRIBUTE_DIMCOLOR },
71cdf0e10cSrcweir 
72cdf0e10cSrcweir                     { "fillcolor", ATTRIBUTE_FILL_COLOR },
73cdf0e10cSrcweir 
74cdf0e10cSrcweir                     { "fillstyle", ATTRIBUTE_FILL_STYLE },
75cdf0e10cSrcweir 
76cdf0e10cSrcweir                     { "height", ATTRIBUTE_HEIGHT },
77cdf0e10cSrcweir 
78cdf0e10cSrcweir                     { "linecolor", ATTRIBUTE_LINE_COLOR },
79cdf0e10cSrcweir 
80cdf0e10cSrcweir                     { "linestyle", ATTRIBUTE_LINE_STYLE },
81cdf0e10cSrcweir 
82cdf0e10cSrcweir                     { "opacity", ATTRIBUTE_OPACITY },
83cdf0e10cSrcweir 
84cdf0e10cSrcweir                     { "rotate", ATTRIBUTE_ROTATE },
85cdf0e10cSrcweir 
86cdf0e10cSrcweir                     { "skewx", ATTRIBUTE_SKEW_X },
87cdf0e10cSrcweir 
88cdf0e10cSrcweir                     { "skewy", ATTRIBUTE_SKEW_Y },
89cdf0e10cSrcweir 
90cdf0e10cSrcweir                     { "visibility", ATTRIBUTE_VISIBILITY },
91cdf0e10cSrcweir 
92cdf0e10cSrcweir                     { "width", ATTRIBUTE_WIDTH },
93cdf0e10cSrcweir 
94cdf0e10cSrcweir                     { "x", ATTRIBUTE_POS_X },
95cdf0e10cSrcweir 
96cdf0e10cSrcweir                     { "y", ATTRIBUTE_POS_Y }
97cdf0e10cSrcweir                 };
98cdf0e10cSrcweir 
99cdf0e10cSrcweir             static AnimateAttributeMap aMap( lcl_attributeMap,
100cdf0e10cSrcweir                                              sizeof(lcl_attributeMap)/sizeof(*lcl_attributeMap),
101cdf0e10cSrcweir                                              false );
102cdf0e10cSrcweir 
103cdf0e10cSrcweir             AttributeType eAttributeType = ATTRIBUTE_INVALID;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir             // determine the type from the attribute name
106cdf0e10cSrcweir             if( !aMap.lookup( rAttrName,
107cdf0e10cSrcweir                               eAttributeType ) )
108cdf0e10cSrcweir             {
109cdf0e10cSrcweir                 OSL_TRACE( "mapAttributeName(): attribute name %s not found in map.",
110cdf0e10cSrcweir                            ::rtl::OUStringToOString( rAttrName,
111cdf0e10cSrcweir                                                      RTL_TEXTENCODING_ASCII_US ).getStr() );
112cdf0e10cSrcweir                 return ATTRIBUTE_INVALID;
113cdf0e10cSrcweir             }
114cdf0e10cSrcweir 
115cdf0e10cSrcweir             return eAttributeType;
116cdf0e10cSrcweir         }
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     }
119cdf0e10cSrcweir }
120