Update ooo320-m1
[ooovba.git] / oox / source / drawingml / transform2dcontext.cxx
blob56165f1374588a967ef2bdabff89bebedcef0b9c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: transform2dcontext.cxx,v $
10 * $Revision: 1.2 $
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/transform2dcontext.hxx"
32 #include "oox/core/namespaces.hxx"
33 #include "oox/helper/attributelist.hxx"
34 #include "oox/drawingml/shape.hxx"
36 using ::com::sun::star::awt::Point;
37 using ::com::sun::star::awt::Size;
38 using ::com::sun::star::uno::Reference;
39 using ::com::sun::star::uno::RuntimeException;
40 using ::com::sun::star::xml::sax::SAXException;
41 using ::com::sun::star::xml::sax::XFastAttributeList;
42 using ::com::sun::star::xml::sax::XFastContextHandler;
43 using ::oox::core::ContextHandler;
45 namespace oox {
46 namespace drawingml {
48 // ============================================================================
50 /** context to import a CT_Transform2D */
51 Transform2DContext::Transform2DContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, Shape& rShape ) throw()
52 : ContextHandler( rParent )
53 , mrShape( rShape )
55 AttributeList aAttributeList( xAttribs );
56 mrShape.setRotation( aAttributeList.getInteger( XML_rot, 0 ) ); // 60000ths of a degree Positive angles are clockwise; negative angles are counter-clockwise
57 mrShape.setFlip( aAttributeList.getBool( XML_flipH, sal_False ), aAttributeList.getBool( XML_flipV, sal_False ) );
60 Reference< XFastContextHandler > Transform2DContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
62 switch( aElementToken )
64 case NMSP_DRAWINGML|XML_off: // horz/vert translation
65 mrShape.setPosition( Point( xAttribs->getOptionalValue( XML_x ).toInt32(), xAttribs->getOptionalValue( XML_y ).toInt32() ) );
66 break;
67 case NMSP_DRAWINGML|XML_ext: // horz/vert size
68 mrShape.setSize( Size( xAttribs->getOptionalValue( XML_cx ).toInt32(), xAttribs->getOptionalValue( XML_cy ).toInt32() ) );
69 break;
70 /* todo: what to do?
71 case NMSP_DRAWINGML|XML_chOff: // horz/vert translation of children
72 case NMSP_DRAWINGML|XML_chExt: // horz/vert size of children
73 break;
77 return 0;
80 // ============================================================================
82 } // namespace drawingml
83 } // namespace oox