1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <osl/diagnose.h>
22 #include "oox/drawingml/table/tablestylecontext.hxx"
23 #include "oox/drawingml/table/tablebackgroundstylecontext.hxx"
24 #include "oox/drawingml/table/tablepartstylecontext.hxx"
26 using namespace ::oox::core
;
27 using namespace ::com::sun::star
;
28 using namespace ::com::sun::star::uno
;
29 using namespace ::com::sun::star::xml::sax
;
31 namespace oox
{ namespace drawingml
{ namespace table
{
33 TableStyleContext::TableStyleContext( ContextHandler
& rParent
,
34 const Reference
< XFastAttributeList
>& xAttribs
, TableStyle
& rTableStyle
)
35 : ContextHandler( rParent
)
36 , mrTableStyle( rTableStyle
)
38 mrTableStyle
.getStyleId() = xAttribs
->getOptionalValue( XML_styleId
);
39 mrTableStyle
.getStyleName() = xAttribs
->getOptionalValue( XML_styleName
);
42 TableStyleContext::~TableStyleContext()
46 uno::Reference
< xml::sax::XFastContextHandler
> SAL_CALL
47 TableStyleContext::createFastChildContext( ::sal_Int32 aElementToken
, const uno::Reference
< xml::sax::XFastAttributeList
>& /* xAttribs */ )
48 throw ( xml::sax::SAXException
, uno::RuntimeException
)
50 uno::Reference
< xml::sax::XFastContextHandler
> xRet
;
52 switch( aElementToken
)
54 case A_TOKEN( tblBg
): // CT_TableBackgroundStyle
55 xRet
= new TableBackgroundStyleContext( *this, mrTableStyle
);
57 case A_TOKEN( wholeTbl
): // CT_TablePartStyle
58 xRet
= new TablePartStyleContext( *this, mrTableStyle
.getWholeTbl() );
60 case A_TOKEN( band1H
): // CT_TablePartStyle
61 xRet
= new TablePartStyleContext( *this, mrTableStyle
.getBand1H() );
63 case A_TOKEN( band2H
): // CT_TablePartStyle
64 xRet
= new TablePartStyleContext( *this, mrTableStyle
.getBand2H() );
66 case A_TOKEN( band1V
): // CT_TablePartStyle
67 xRet
= new TablePartStyleContext( *this, mrTableStyle
.getBand1V() );
69 case A_TOKEN( band2V
): // CT_TablePartStyle
70 xRet
= new TablePartStyleContext( *this, mrTableStyle
.getBand2V() );
72 case A_TOKEN( lastCol
): // CT_TablePartStyle
73 xRet
= new TablePartStyleContext( *this, mrTableStyle
.getLastCol() );
75 case A_TOKEN( firstCol
): // CT_TablePartStyle
76 xRet
= new TablePartStyleContext( *this, mrTableStyle
.getFirstCol() );
78 case A_TOKEN( lastRow
): // CT_TablePartStyle
79 xRet
= new TablePartStyleContext( *this, mrTableStyle
.getLastRow() );
81 case A_TOKEN( seCell
): // CT_TablePartStyle
82 xRet
= new TablePartStyleContext( *this, mrTableStyle
.getSeCell() );
84 case A_TOKEN( swCell
): // CT_TablePartStyle
85 xRet
= new TablePartStyleContext( *this, mrTableStyle
.getSwCell() );
87 case A_TOKEN( firstRow
): // CT_TablePartStyle
88 xRet
= new TablePartStyleContext( *this, mrTableStyle
.getFirstRow() );
90 case A_TOKEN( neCell
): // CT_TablePartStyle
91 xRet
= new TablePartStyleContext( *this, mrTableStyle
.getNeCell() );
93 case A_TOKEN( nwCell
): // CT_TablePartStyle
94 xRet
= new TablePartStyleContext( *this, mrTableStyle
.getNwCell() );
96 case A_TOKEN( extLst
): // CT_OfficeArtExtensionList
101 uno::Reference
<XFastContextHandler
> xTmp(this);
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */