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 .
21 #include <canvas/canvastools.hxx>
23 #include <attributemap.hxx>
24 #include <sal/log.hxx>
27 namespace slideshow::internal
29 typedef ::canvas::tools::ValueMap
< AttributeType
> AnimateAttributeMap
;
31 AttributeType
mapAttributeName( const OUString
& rAttrName
)
33 /** Maps attribute name to AttributeType enum.
35 String entries are all case-insensitive and MUST
38 String entries MUST BE SORTED in ascending order!
40 static const AnimateAttributeMap::MapEntry lcl_attributeMap
[] =
42 { "charcolor", AttributeType::CharColor
},
43 { "charfontname", AttributeType::CharFontName
},
44 { "charheight", AttributeType::CharHeight
},
45 { "charposture", AttributeType::CharPosture
},
46 // TODO(Q1): This should prolly be changed in PPT import
47 // { "charrotation", AttributeType::CharRotation },
48 { "charrotation", AttributeType::Rotate
},
49 { "charunderline", AttributeType::CharUnderline
},
50 { "charweight", AttributeType::CharWeight
},
51 { "color", AttributeType::Color
},
52 { "dimcolor", AttributeType::DimColor
},
53 { "fillcolor", AttributeType::FillColor
},
54 { "fillstyle", AttributeType::FillStyle
},
55 { "height", AttributeType::Height
},
56 { "linecolor", AttributeType::LineColor
},
57 { "linestyle", AttributeType::LineStyle
},
58 { "opacity", AttributeType::Opacity
},
59 { "rotate", AttributeType::Rotate
},
60 { "skewx", AttributeType::SkewX
},
61 { "skewy", AttributeType::SkewY
},
62 { "visibility", AttributeType::Visibility
},
63 { "width", AttributeType::Width
},
64 { "x", AttributeType::PosX
},
65 { "y", AttributeType::PosY
}
68 static const AnimateAttributeMap
aMap( lcl_attributeMap
,
69 SAL_N_ELEMENTS(lcl_attributeMap
),
72 AttributeType eAttributeType
= AttributeType::Invalid
;
74 // determine the type from the attribute name
75 if( !aMap
.lookup( rAttrName
,
78 SAL_WARN("slideshow", "mapAttributeName(): attribute name not found in map: " << rAttrName
);
79 return AttributeType::Invalid
;
82 return eAttributeType
;
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */