LibreOffice Module oox (master) 1
tablestylecellstylecontext.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
26#include <oox/token/namespaces.hxx>
27#include <oox/token/tokens.hxx>
28
29using namespace ::oox::core;
30using namespace ::com::sun::star;
31using namespace ::com::sun::star::uno;
32using namespace ::com::sun::star::xml::sax;
33
34namespace oox::drawingml::table {
35
37: ContextHandler2( rParent )
38, mrTableStylePart( rTableStylePart )
39, mnLineType( XML_none )
40{
41}
42
44{
45}
46
47// CT_TableStyleCellStyle
49TableStyleCellStyleContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& rAttribs )
50{
51 switch( aElementToken )
52 {
53 case A_TOKEN( tcBdr ): // CT_TableCellBorderStyle
54 break;
55 case A_TOKEN( left ): // CT_ThemeableLineStyle
56 case A_TOKEN( right ):
57 case A_TOKEN( top ):
58 case A_TOKEN( bottom ):
59 case A_TOKEN( insideH ):
60 case A_TOKEN( insideV ):
61 case A_TOKEN( tl2br ):
62 case A_TOKEN( tr2bl ):
63 mnLineType = getBaseToken( aElementToken );
64 break;
65
66 case A_TOKEN( ln ):
67 {
68 if ( mnLineType != XML_none )
69 {
70 std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& rLineBorders = mrTableStylePart.getLineBorders();
71 ::oox::drawingml::LinePropertiesPtr pLineProperties = std::make_shared<oox::drawingml::LineProperties>();
72 rLineBorders[ mnLineType ] = pLineProperties;
73 return new LinePropertiesContext( *this, rAttribs, *pLineProperties );
74 }
75 }
76 break;
77 case A_TOKEN( lnRef ):
78 {
79 if ( mnLineType != XML_none )
80 {
82 rLineStyleRef.mnThemedIdx = rAttribs.getInteger( XML_idx, 0 );
83 return new ColorContext( *this, rLineStyleRef.maPhClr );
84 }
85 }
86 break;
87
88 // EG_ThemeableFillStyle (choice)
89 case A_TOKEN( fill ): // CT_FillProperties
90 {
92 rxFillProperties = std::make_shared<FillProperties>();
93 return new FillPropertiesContext( *this, *rxFillProperties );
94 }
95 case A_TOKEN( fillRef ): // CT_StyleMatrixReference
96 {
97 ShapeStyleRef& rStyleRef = mrTableStylePart.getStyleRefs()[ XML_fillRef ];
98 rStyleRef.mnThemedIdx = rAttribs.getInteger( XML_idx, 0 );
99 return new ColorContext( *this, rStyleRef.maPhClr );
100 }
101 case A_TOKEN( cell3D ): // CT_Cell3D
102 break;
103 }
104
105 return this;
106}
107
108}
109
110/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Provides access to attribute values of an element.
std::optional< sal_Int32 > getInteger(sal_Int32 nAttrToken) const
Returns the 32-bit signed integer value of the specified attribute (decimal).
Helper class that provides a context stack.
Context handler for elements that contain a color value element (a:scrgbClr, a:srgbClr,...
Context handler for elements that contain a fill property element (a:noFill, a:solidFill,...
TableStyleCellStyleContext(::oox::core::ContextHandler2Helper const &rParent, TableStylePart &rTableStylePart)
virtual ::oox::core::ContextHandlerRef onCreateContext(::sal_Int32 Element, const ::oox::AttributeList &rAttribs) override
::oox::drawingml::ShapeStyleRefMap & getStyleRefs()
::oox::drawingml::FillPropertiesPtr & getFillProperties()
std::map< sal_Int32, ::oox::drawingml::LinePropertiesPtr > & getLineBorders()
OString right
Definition: drawingml.cxx:3910
OString top
Definition: drawingml.cxx:3909
OString bottom
Definition: drawingml.cxx:3911
std::shared_ptr< FillProperties > FillPropertiesPtr
std::shared_ptr< LineProperties > LinePropertiesPtr
XML_none
sal_uInt64 left