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/shapestylecontext.hxx" 29 30 #include "oox/helper/attributelist.hxx" 31 #include "oox/drawingml/colorchoicecontext.hxx" 32 33 using ::rtl::OUString; 34 using namespace ::oox::core; 35 using namespace ::com::sun::star::uno; 36 using namespace ::com::sun::star::xml::sax; 37 38 namespace oox { namespace drawingml { 39 40 // --------------- 41 // CT_ShapeStyle 42 // --------------- 43 ShapeStyleContext::ShapeStyleContext( ContextHandler& rParent, Shape& rShape ) 44 : ContextHandler( rParent ) 45 , mrShape( rShape ) 46 { 47 } 48 49 ShapeStyleContext::~ShapeStyleContext() 50 { 51 } 52 53 // -------------------------------------------------------------------- 54 55 void ShapeStyleContext::endFastElement( sal_Int32 ) throw (SAXException, RuntimeException) 56 { 57 } 58 59 // -------------------------------------------------------------------- 60 61 Reference< XFastContextHandler > ShapeStyleContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& rxAttributes ) 62 throw ( SAXException, RuntimeException ) 63 { 64 Reference< XFastContextHandler > xRet; 65 AttributeList aAttribs( rxAttributes ); 66 switch( aElementToken ) 67 { 68 case A_TOKEN( lnRef ) : // CT_StyleMatrixReference 69 case A_TOKEN( fillRef ) : // CT_StyleMatrixReference 70 case A_TOKEN( effectRef ) : // CT_StyleMatrixReference 71 case A_TOKEN( fontRef ) : // CT_FontReference 72 { 73 sal_Int32 nToken = getBaseToken( aElementToken ); 74 ShapeStyleRef& rStyleRef = mrShape.getShapeStyleRefs()[ nToken ]; 75 rStyleRef.mnThemedIdx = (nToken == XML_fontRef) ? aAttribs.getToken( XML_idx, XML_none ) : aAttribs.getInteger( XML_idx, 0 ); 76 xRet.set( new ColorContext( *this, rStyleRef.maPhClr ) ); 77 } 78 break; 79 } 80 return xRet; 81 } 82 83 // -------------------------------------------------------------------- 84 85 } } 86 87