1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #include "oox/drawingml/clrscheme.hxx" 29 #include "oox/token/tokens.hxx" 30 31 namespace oox { namespace drawingml { 32 33 sal_Bool ClrMap::getColorMap( sal_Int32& nClrToken ) 34 { 35 sal_Int32 nMapped = 0; 36 std::map < sal_Int32, sal_Int32 >::const_iterator aIter( maClrMap.find( nClrToken ) ); 37 if ( aIter != maClrMap.end() ) 38 nMapped = (*aIter).second; 39 if ( nMapped ) 40 { 41 nClrToken = nMapped; 42 return sal_True; 43 } 44 else 45 return sal_False; 46 } 47 48 void ClrMap::setColorMap( sal_Int32 nClrToken, sal_Int32 nMappedClrToken ) 49 { 50 maClrMap[ nClrToken ] = nMappedClrToken; 51 } 52 53 //----------------------------------------------------------------------------------------- 54 55 ClrScheme::ClrScheme() 56 { 57 } 58 ClrScheme::~ClrScheme() 59 { 60 } 61 62 sal_Bool ClrScheme::getColor( sal_Int32 nSchemeClrToken, sal_Int32& rColor ) const 63 { 64 switch( nSchemeClrToken ) 65 { 66 case XML_bg1 : nSchemeClrToken = XML_lt1; break; 67 case XML_bg2 : nSchemeClrToken = XML_lt2; break; 68 case XML_tx1 : nSchemeClrToken = XML_dk1; break; 69 case XML_tx2 : nSchemeClrToken = XML_dk2; break; 70 } 71 std::map < sal_Int32, sal_Int32 >::const_iterator aIter( maClrScheme.find( nSchemeClrToken ) ); 72 if ( aIter != maClrScheme.end() ) 73 rColor = (*aIter).second; 74 return aIter != maClrScheme.end(); 75 } 76 77 void ClrScheme::setColor( sal_Int32 nSchemeClrToken, sal_Int32 nColor ) 78 { 79 maClrScheme[ nSchemeClrToken ] = nColor; 80 } 81 82 } } 83