LibreOffice Module oox (master)  1
tablestylecontext.cxx
Go to the documentation of this file.
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 
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 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::xml::sax;
32 
33 namespace oox::drawingml::table {
34 
36  const AttributeList& rAttribs, TableStyle& rTableStyle )
37 : ContextHandler2( rParent )
38 , mrTableStyle( rTableStyle )
39 {
40  mrTableStyle.getStyleId() = rAttribs.getString( XML_styleId ).get();
41  mrTableStyle.getStyleName() = rAttribs.getString( XML_styleName ).get();
42 }
43 
45 {
46 }
47 
49 TableStyleContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& /* rAttribs */ )
50 {
51  switch( aElementToken )
52  {
53  case A_TOKEN( tblBg ): // CT_TableBackgroundStyle
54  return new TableBackgroundStyleContext( *this, mrTableStyle );
55  case A_TOKEN( wholeTbl ): // CT_TablePartStyle
56  return new TablePartStyleContext( *this, mrTableStyle.getWholeTbl() );
57  case A_TOKEN( band1H ): // CT_TablePartStyle
58  return new TablePartStyleContext( *this, mrTableStyle.getBand1H() );
59  case A_TOKEN( band2H ): // CT_TablePartStyle
60  return new TablePartStyleContext( *this, mrTableStyle.getBand2H() );
61  case A_TOKEN( band1V ): // CT_TablePartStyle
62  return new TablePartStyleContext( *this, mrTableStyle.getBand1V() );
63  case A_TOKEN( band2V ): // CT_TablePartStyle
64  return new TablePartStyleContext( *this, mrTableStyle.getBand2V() );
65  case A_TOKEN( lastCol ): // CT_TablePartStyle
66  return new TablePartStyleContext( *this, mrTableStyle.getLastCol() );
67  case A_TOKEN( firstCol ): // CT_TablePartStyle
68  return new TablePartStyleContext( *this, mrTableStyle.getFirstCol() );
69  case A_TOKEN( lastRow ): // CT_TablePartStyle
70  return new TablePartStyleContext( *this, mrTableStyle.getLastRow() );
71  case A_TOKEN( seCell ): // CT_TablePartStyle
72  return new TablePartStyleContext( *this, mrTableStyle.getSeCell() );
73  case A_TOKEN( swCell ): // CT_TablePartStyle
74  return new TablePartStyleContext( *this, mrTableStyle.getSwCell() );
75  case A_TOKEN( firstRow ): // CT_TablePartStyle
76  return new TablePartStyleContext( *this, mrTableStyle.getFirstRow() );
77  case A_TOKEN( neCell ): // CT_TablePartStyle
78  return new TablePartStyleContext( *this, mrTableStyle.getNeCell() );
79  case A_TOKEN( nwCell ): // CT_TablePartStyle
80  return new TablePartStyleContext( *this, mrTableStyle.getNwCell() );
81  case A_TOKEN( extLst ): // CT_OfficeArtExtensionList
82  break;
83  }
84  return this;
85 }
86 
87 }
88 
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
TableStyleContext(::oox::core::ContextHandler2Helper const &rParent, const ::oox::AttributeList &rAttribs, TableStyle &rTableStyle)
OptValue< OUString > getString(sal_Int32 nAttrToken) const
Returns the string value of the specified attribute.
virtual ::oox::core::ContextHandlerRef onCreateContext(::sal_Int32 Element, const ::oox::AttributeList &rAttribs) override
const Type & get() const
Definition: helper.hxx:185
Provides access to attribute values of an element.
TableStylePart & getWholeTbl()
Definition: tablestyle.hxx:42
TableStylePart & getFirstRow()
Definition: tablestyle.hxx:52
TableStylePart & getFirstCol()
Definition: tablestyle.hxx:48
Helper class that provides a context stack.