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