Update ooo320-m1
[ooovba.git] / oox / source / drawingml / table / tablebackgroundstylecontext.cxx
blobfaf2c8936d0283657e98ad4bf21676efa02122ae
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: tablebackgroundstylecontext.cxx,v $
10 * $Revision: 1.3 $
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 <osl/diagnose.h>
33 #include "oox/drawingml/table/tablebackgroundstylecontext.hxx"
34 #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
35 #include "oox/core/namespaces.hxx"
36 #include "oox/helper/attributelist.hxx"
37 #include "tokens.hxx"
38 using namespace ::oox::core;
39 using namespace ::com::sun::star;
40 using namespace ::com::sun::star::uno;
41 using namespace ::com::sun::star::xml::sax;
42 using ::rtl::OUString;
44 namespace oox { namespace drawingml { namespace table {
46 TableBackgroundStyleContext::TableBackgroundStyleContext( ContextHandler& rParent, TableStyle& rTableStyle )
47 : ContextHandler( rParent )
48 , mrTableStyle( rTableStyle )
52 TableBackgroundStyleContext::~TableBackgroundStyleContext()
56 uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
57 TableBackgroundStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs )
58 throw ( xml::sax::SAXException, uno::RuntimeException)
60 uno::Reference< xml::sax::XFastContextHandler > xRet;
62 AttributeList aAttribs( xAttribs );
63 switch( aElementToken )
65 // EG_ThemeableFillStyle (choice)
66 case NMSP_DRAWINGML|XML_fill: // CT_FillProperties
68 boost::shared_ptr< FillProperties >& rxFillProperties = mrTableStyle.getBackgroundFillProperties();
69 rxFillProperties.reset( new FillProperties );
70 xRet.set( new FillPropertiesContext( *this, *rxFillProperties ) );
72 break;
73 case NMSP_DRAWINGML|XML_fillRef: // CT_StyleMatrixReference
75 ShapeStyleRef& rStyleRef = mrTableStyle.getBackgroundFillStyleRef();
76 rStyleRef.mnThemedIdx = aAttribs.getInteger( XML_idx, 0 );
77 xRet.set( new ColorContext( *this, rStyleRef.maPhClr ) );
79 break;
81 // EG_ThemeableEffectStyle (choice)
82 case NMSP_DRAWINGML|XML_effect: // CT_EffectProperties
83 break;
84 case NMSP_DRAWINGML|XML_effectRef: // CT_StyleMatrixReference
85 break;
87 if( !xRet.is() )
89 uno::Reference<XFastContextHandler> xTmp(this);
90 xRet.set( xTmp );
92 return xRet;
95 } } }