1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: clrscheme.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "oox/drawingml/clrscheme.hxx"
34 namespace oox
{ namespace drawingml
{
36 sal_Bool
ClrMap::getColorMap( sal_Int32
& nClrToken
)
38 sal_Int32 nMapped
= 0;
39 std::map
< sal_Int32
, sal_Int32
>::const_iterator
aIter( maClrMap
.find( nClrToken
) );
40 if ( aIter
!= maClrMap
.end() )
41 nMapped
= (*aIter
).second
;
51 void ClrMap::setColorMap( sal_Int32 nClrToken
, sal_Int32 nMappedClrToken
)
53 maClrMap
[ nClrToken
] = nMappedClrToken
;
56 //-----------------------------------------------------------------------------------------
58 ClrScheme::ClrScheme()
61 ClrScheme::~ClrScheme()
65 sal_Bool
ClrScheme::getColor( sal_Int32 nSchemeClrToken
, sal_Int32
& rColor
) const
67 switch( nSchemeClrToken
)
69 case XML_bg1
: nSchemeClrToken
= XML_lt1
; break;
70 case XML_bg2
: nSchemeClrToken
= XML_lt2
; break;
71 case XML_tx1
: nSchemeClrToken
= XML_dk1
; break;
72 case XML_tx2
: nSchemeClrToken
= XML_dk2
; break;
74 std::map
< sal_Int32
, sal_Int32
>::const_iterator
aIter( maClrScheme
.find( nSchemeClrToken
) );
75 if ( aIter
!= maClrScheme
.end() )
76 rColor
= (*aIter
).second
;
77 return aIter
!= maClrScheme
.end();
80 void ClrScheme::setColor( sal_Int32 nSchemeClrToken
, sal_Int32 nColor
)
82 maClrScheme
[ nSchemeClrToken
] = nColor
;