Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #include <osl/diagnose.h>
21 : :
22 : : #include "oox/drawingml/table/tablestylecontext.hxx"
23 : : #include "oox/drawingml/table/tablebackgroundstylecontext.hxx"
24 : : #include "oox/drawingml/table/tablepartstylecontext.hxx"
25 : :
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;
30 : : using ::rtl::OUString;
31 : :
32 : : namespace oox { namespace drawingml { namespace table {
33 : :
34 : 0 : TableStyleContext::TableStyleContext( ContextHandler& rParent,
35 : : const Reference< XFastAttributeList >& xAttribs, TableStyle& rTableStyle )
36 : : : ContextHandler( rParent )
37 : 0 : , mrTableStyle( rTableStyle )
38 : : {
39 [ # # ][ # # ]: 0 : mrTableStyle.getStyleId() = xAttribs->getOptionalValue( XML_styleId );
40 [ # # ][ # # ]: 0 : mrTableStyle.getStyleName() = xAttribs->getOptionalValue( XML_styleName );
41 : 0 : }
42 : :
43 : 0 : TableStyleContext::~TableStyleContext()
44 : : {
45 [ # # ]: 0 : }
46 : :
47 : : uno::Reference< xml::sax::XFastContextHandler > SAL_CALL
48 : 0 : TableStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& /* xAttribs */ )
49 : : throw ( xml::sax::SAXException, uno::RuntimeException)
50 : : {
51 : 0 : uno::Reference< xml::sax::XFastContextHandler > xRet;
52 : :
53 [ # # # # : 0 : switch( aElementToken )
# # # # #
# # # # #
# # ]
54 : : {
55 : : case A_TOKEN( tblBg ): // CT_TableBackgroundStyle
56 [ # # ][ # # ]: 0 : xRet = new TableBackgroundStyleContext( *this, mrTableStyle );
[ # # ]
57 : 0 : break;
58 : : case A_TOKEN( wholeTbl ): // CT_TablePartStyle
59 [ # # ][ # # ]: 0 : xRet = new TablePartStyleContext( *this, mrTableStyle.getWholeTbl() );
[ # # ]
60 : 0 : break;
61 : : case A_TOKEN( band1H ): // CT_TablePartStyle
62 [ # # ][ # # ]: 0 : xRet = new TablePartStyleContext( *this, mrTableStyle.getBand1H() );
[ # # ]
63 : 0 : break;
64 : : case A_TOKEN( band2H ): // CT_TablePartStyle
65 [ # # ][ # # ]: 0 : xRet = new TablePartStyleContext( *this, mrTableStyle.getBand2H() );
[ # # ]
66 : 0 : break;
67 : : case A_TOKEN( band1V ): // CT_TablePartStyle
68 [ # # ][ # # ]: 0 : xRet = new TablePartStyleContext( *this, mrTableStyle.getBand1V() );
[ # # ]
69 : 0 : break;
70 : : case A_TOKEN( band2V ): // CT_TablePartStyle
71 [ # # ][ # # ]: 0 : xRet = new TablePartStyleContext( *this, mrTableStyle.getBand2V() );
[ # # ]
72 : 0 : break;
73 : : case A_TOKEN( lastCol ): // CT_TablePartStyle
74 [ # # ][ # # ]: 0 : xRet = new TablePartStyleContext( *this, mrTableStyle.getLastCol() );
[ # # ]
75 : 0 : break;
76 : : case A_TOKEN( firstCol ): // CT_TablePartStyle
77 [ # # ][ # # ]: 0 : xRet = new TablePartStyleContext( *this, mrTableStyle.getFirstCol() );
[ # # ]
78 : 0 : break;
79 : : case A_TOKEN( lastRow ): // CT_TablePartStyle
80 [ # # ][ # # ]: 0 : xRet = new TablePartStyleContext( *this, mrTableStyle.getLastRow() );
[ # # ]
81 : 0 : break;
82 : : case A_TOKEN( seCell ): // CT_TablePartStyle
83 [ # # ][ # # ]: 0 : xRet = new TablePartStyleContext( *this, mrTableStyle.getSeCell() );
[ # # ]
84 : 0 : break;
85 : : case A_TOKEN( swCell ): // CT_TablePartStyle
86 [ # # ][ # # ]: 0 : xRet = new TablePartStyleContext( *this, mrTableStyle.getSwCell() );
[ # # ]
87 : 0 : break;
88 : : case A_TOKEN( firstRow ): // CT_TablePartStyle
89 [ # # ][ # # ]: 0 : xRet = new TablePartStyleContext( *this, mrTableStyle.getFirstRow() );
[ # # ]
90 : 0 : break;
91 : : case A_TOKEN( neCell ): // CT_TablePartStyle
92 [ # # ][ # # ]: 0 : xRet = new TablePartStyleContext( *this, mrTableStyle.getNeCell() );
[ # # ]
93 : 0 : break;
94 : : case A_TOKEN( nwCell ): // CT_TablePartStyle
95 [ # # ][ # # ]: 0 : xRet = new TablePartStyleContext( *this, mrTableStyle.getNwCell() );
[ # # ]
96 : 0 : break;
97 : : case A_TOKEN( extLst ): // CT_OfficeArtExtensionList
98 : 0 : break;
99 : : }
100 [ # # ]: 0 : if( !xRet.is() )
101 : : {
102 [ # # ]: 0 : uno::Reference<XFastContextHandler> xTmp(this);
103 [ # # ]: 0 : xRet.set( xTmp );
104 : : }
105 : 0 : return xRet;
106 : : }
107 : :
108 [ + - ][ + - ]: 285 : } } }
109 : :
110 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|