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 "oox/drawingml/linepropertiescontext.hxx"
21 : : #include "oox/drawingml/drawingmltypes.hxx"
22 : : #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
23 : : #include "oox/drawingml/lineproperties.hxx"
24 : : #include "oox/helper/attributelist.hxx"
25 : :
26 : : using ::rtl::OUString;
27 : : using namespace ::oox::core;
28 : : using namespace ::com::sun::star::uno;
29 : : using namespace ::com::sun::star::xml::sax;
30 : :
31 : : // CT_LineProperties
32 : :
33 : : namespace oox { namespace drawingml {
34 : : // ---------------------------------------------------------------------
35 : :
36 : 90 : LinePropertiesContext::LinePropertiesContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs,
37 : : LineProperties& rLineProperties ) throw()
38 : : : ContextHandler( rParent )
39 : 90 : , mrLineProperties( rLineProperties )
40 : : {
41 [ + - ]: 90 : AttributeList aAttribs( xAttribs );
42 [ + - ]: 90 : mrLineProperties.moLineWidth = aAttribs.getInteger( XML_w );
43 [ + - ]: 90 : mrLineProperties.moLineCompound = aAttribs.getToken( XML_cmpd );
44 [ + - ][ + - ]: 90 : mrLineProperties.moLineCap = aAttribs.getToken( XML_cap );
45 : 90 : }
46 : :
47 : 90 : LinePropertiesContext::~LinePropertiesContext()
48 : : {
49 [ - + ]: 180 : }
50 : :
51 : 180 : Reference< XFastContextHandler > LinePropertiesContext::createFastChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
52 : : {
53 : 180 : Reference< XFastContextHandler > xRet;
54 [ + - ]: 180 : AttributeList aAttribs( xAttribs );
55 [ + + - - : 180 : switch( nElement )
+ + - ]
56 : : {
57 : : // LineFillPropertiesGroup
58 : : case A_TOKEN( noFill ):
59 : : case A_TOKEN( solidFill ):
60 : : case A_TOKEN( gradFill ):
61 : : case A_TOKEN( pattFill ):
62 [ + - ][ + - ]: 78 : xRet = FillPropertiesContext::createFillContext( *this, nElement, xAttribs, mrLineProperties.maLineFill );
63 : 78 : break;
64 : :
65 : : // LineDashPropertiesGroup
66 : : case A_TOKEN( prstDash ): // CT_PresetLineDashProperties
67 [ + - ]: 63 : mrLineProperties.moPresetDash = aAttribs.getToken( XML_val );
68 : 63 : break;
69 : : case A_TOKEN( custDash ): // CT_DashStopList
70 [ # # ]: 0 : xRet = this;
71 : 0 : break;
72 : : case A_TOKEN( ds ):
73 : : mrLineProperties.maCustomDash.push_back( LineProperties::DashStop(
74 [ # # ][ # # ]: 0 : aAttribs.getInteger( XML_d, 0 ), aAttribs.getInteger( XML_sp, 0 ) ) );
[ # # ][ # # ]
75 : 0 : break;
76 : :
77 : : // LineJoinPropertiesGroup
78 : : case A_TOKEN( round ):
79 : : case A_TOKEN( bevel ):
80 : : case A_TOKEN( miter ):
81 [ + - ]: 9 : mrLineProperties.moLineJoint = getBaseToken( nElement );
82 : 9 : break;
83 : :
84 : : case A_TOKEN( headEnd ): // CT_LineEndProperties
85 : : case A_TOKEN( tailEnd ): // CT_LineEndProperties
86 : : { // ST_LineEndType
87 : 30 : bool bTailEnd = nElement == A_TOKEN( tailEnd );
88 [ + + ]: 30 : LineArrowProperties& rArrowProps = bTailEnd ? mrLineProperties.maEndArrow : mrLineProperties.maStartArrow;
89 [ + - ]: 30 : rArrowProps.moArrowType = aAttribs.getToken( XML_type );
90 [ + - ]: 30 : rArrowProps.moArrowWidth = aAttribs.getToken( XML_w );
91 [ + - ]: 30 : rArrowProps.moArrowLength = aAttribs.getToken( XML_len );
92 : : }
93 : 30 : break;
94 : : }
95 [ + - ]: 180 : return xRet;
96 : : }
97 : :
98 : : } }
99 : :
100 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|