/src/libreoffice/oox/source/drawingml/table/tablestylecontext.cxx
Line | Count | Source |
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 | | |
21 | | #include <drawingml/table/tablestylecontext.hxx> |
22 | | #include <drawingml/table/tablebackgroundstylecontext.hxx> |
23 | | #include <drawingml/table/tablepartstylecontext.hxx> |
24 | | #include <oox/helper/attributelist.hxx> |
25 | | #include <oox/token/namespaces.hxx> |
26 | | #include <oox/token/tokens.hxx> |
27 | | |
28 | | using namespace ::oox::core; |
29 | | using namespace ::com::sun::star; |
30 | | |
31 | | namespace oox::drawingml::table { |
32 | | |
33 | | TableStyleContext::TableStyleContext( ContextHandler2Helper const & rParent, |
34 | | const AttributeList& rAttribs, TableStyle& rTableStyle ) |
35 | 37 | : ContextHandler2( rParent ) |
36 | 37 | , mrTableStyle( rTableStyle ) |
37 | 37 | { |
38 | 37 | mrTableStyle.getStyleId() = rAttribs.getStringDefaulted( XML_styleId ); |
39 | 37 | mrTableStyle.getStyleName() = rAttribs.getStringDefaulted( XML_styleName ); |
40 | 37 | } |
41 | | |
42 | | TableStyleContext::~TableStyleContext() |
43 | 37 | { |
44 | 37 | } |
45 | | |
46 | | ContextHandlerRef |
47 | | TableStyleContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& /* rAttribs */ ) |
48 | 317 | { |
49 | 317 | switch( aElementToken ) |
50 | 317 | { |
51 | 0 | case A_TOKEN( tblBg ): // CT_TableBackgroundStyle |
52 | 0 | return new TableBackgroundStyleContext( *this, mrTableStyle ); |
53 | 37 | case A_TOKEN( wholeTbl ): // CT_TablePartStyle |
54 | 37 | return new TablePartStyleContext( *this, mrTableStyle.getWholeTbl() ); |
55 | 35 | case A_TOKEN( band1H ): // CT_TablePartStyle |
56 | 35 | return new TablePartStyleContext( *this, mrTableStyle.getBand1H() ); |
57 | 35 | case A_TOKEN( band2H ): // CT_TablePartStyle |
58 | 35 | return new TablePartStyleContext( *this, mrTableStyle.getBand2H() ); |
59 | 35 | case A_TOKEN( band1V ): // CT_TablePartStyle |
60 | 35 | return new TablePartStyleContext( *this, mrTableStyle.getBand1V() ); |
61 | 35 | case A_TOKEN( band2V ): // CT_TablePartStyle |
62 | 35 | return new TablePartStyleContext( *this, mrTableStyle.getBand2V() ); |
63 | 35 | case A_TOKEN( lastCol ): // CT_TablePartStyle |
64 | 35 | return new TablePartStyleContext( *this, mrTableStyle.getLastCol() ); |
65 | 35 | case A_TOKEN( firstCol ): // CT_TablePartStyle |
66 | 35 | return new TablePartStyleContext( *this, mrTableStyle.getFirstCol() ); |
67 | 35 | case A_TOKEN( lastRow ): // CT_TablePartStyle |
68 | 35 | return new TablePartStyleContext( *this, mrTableStyle.getLastRow() ); |
69 | 0 | case A_TOKEN( seCell ): // CT_TablePartStyle |
70 | 0 | return new TablePartStyleContext( *this, mrTableStyle.getSeCell() ); |
71 | 0 | case A_TOKEN( swCell ): // CT_TablePartStyle |
72 | 0 | return new TablePartStyleContext( *this, mrTableStyle.getSwCell() ); |
73 | 35 | case A_TOKEN( firstRow ): // CT_TablePartStyle |
74 | 35 | return new TablePartStyleContext( *this, mrTableStyle.getFirstRow() ); |
75 | 0 | case A_TOKEN( neCell ): // CT_TablePartStyle |
76 | 0 | return new TablePartStyleContext( *this, mrTableStyle.getNeCell() ); |
77 | 0 | case A_TOKEN( nwCell ): // CT_TablePartStyle |
78 | 0 | return new TablePartStyleContext( *this, mrTableStyle.getNwCell() ); |
79 | 0 | case A_TOKEN( extLst ): // CT_OfficeArtExtensionList |
80 | 0 | break; |
81 | 317 | } |
82 | 0 | return this; |
83 | 317 | } |
84 | | |
85 | | } |
86 | | |
87 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |