update dev300-m58
[ooovba.git] / oox / source / drawingml / linepropertiescontext.cxx
blobca15af7eb84659b68dce03716ea7a7966571b8e0
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: linepropertiescontext.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "oox/drawingml/linepropertiescontext.hxx"
32 #include "oox/drawingml/drawingmltypes.hxx"
33 #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
34 #include "oox/drawingml/lineproperties.hxx"
35 #include "oox/helper/attributelist.hxx"
36 #include "oox/core/namespaces.hxx"
37 #include "tokens.hxx"
39 using ::rtl::OUString;
40 using namespace ::oox::core;
41 using namespace ::com::sun::star::uno;
42 using namespace ::com::sun::star::xml::sax;
44 // CT_LineProperties
46 namespace oox { namespace drawingml {
47 // ---------------------------------------------------------------------
49 LinePropertiesContext::LinePropertiesContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs,
50 LineProperties& rLineProperties ) throw()
51 : ContextHandler( rParent )
52 , mrLineProperties( rLineProperties )
54 AttributeList aAttribs( xAttribs );
55 mrLineProperties.moLineWidth = aAttribs.getInteger( XML_w );
56 mrLineProperties.moLineCap = aAttribs.getToken( XML_cap );
59 LinePropertiesContext::~LinePropertiesContext()
63 Reference< XFastContextHandler > LinePropertiesContext::createFastChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
65 Reference< XFastContextHandler > xRet;
66 AttributeList aAttribs( xAttribs );
67 switch( nElement )
69 // LineFillPropertiesGroup
70 case A_TOKEN( noFill ):
71 case A_TOKEN( solidFill ):
72 case A_TOKEN( gradFill ):
73 case A_TOKEN( pattFill ):
74 xRet = FillPropertiesContext::createFillContext( *this, nElement, xAttribs, mrLineProperties.maLineFill );
75 break;
77 // LineDashPropertiesGroup
78 case A_TOKEN( prstDash ): // CT_PresetLineDashProperties
79 mrLineProperties.moPresetDash = aAttribs.getToken( XML_val );
80 break;
81 case A_TOKEN( custDash ): // CT_DashStopList
82 break;
84 // LineJoinPropertiesGroup
85 case A_TOKEN( round ):
86 case A_TOKEN( bevel ):
87 case A_TOKEN( miter ):
88 mrLineProperties.moLineJoint = getToken( nElement );
89 break;
91 case A_TOKEN( headEnd ): // CT_LineEndProperties
92 case A_TOKEN( tailEnd ): // CT_LineEndProperties
93 { // ST_LineEndType
94 bool bTailEnd = nElement == A_TOKEN( tailEnd );
95 LineArrowProperties& rArrowProps = bTailEnd ? mrLineProperties.maEndArrow : mrLineProperties.maStartArrow;
96 rArrowProps.moArrowType = aAttribs.getToken( XML_type );
97 rArrowProps.moArrowWidth = aAttribs.getToken( XML_w );
98 rArrowProps.moArrowLength = aAttribs.getToken( XML_len );
100 break;
102 return xRet;