Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / oox / source / drawingml / diagram / constraintlistcontext.cxx
blob87a52f14446fa314bf14af0108997ea4e59cfc22
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "constraintlistcontext.hxx"
21 #include "oox/helper/attributelist.hxx"
22 #include <oox/token/namespaces.hxx>
23 #include <oox/token/tokens.hxx>
24 #include <osl/diagnose.h>
26 using namespace ::oox::core;
27 using namespace ::com::sun::star::uno;
28 using namespace ::com::sun::star::xml::sax;
30 namespace oox { namespace drawingml {
32 // CT_ConstraintLists
33 ConstraintListContext::ConstraintListContext( ContextHandler2Helper& rParent,
34 const LayoutAtomPtr &pNode )
35 : ContextHandler2( rParent )
36 , mpNode( pNode )
38 OSL_ENSURE( pNode, "Node must NOT be NULL" );
41 ConstraintListContext::~ConstraintListContext()
45 ContextHandlerRef
46 ConstraintListContext::onCreateContext( ::sal_Int32 aElement,
47 const AttributeList& rAttribs )
49 switch( aElement )
51 case DGM_TOKEN( constr ):
53 std::shared_ptr< ConstraintAtom > pNode( new ConstraintAtom() );
54 mpNode->addChild( pNode );
56 pNode->setFor( rAttribs.getToken( XML_for, XML_none ) );
57 pNode->setForName( rAttribs.getString( XML_forName, "" ) );
58 pNode->setPointType( rAttribs.getToken( XML_ptType, XML_none ) );
59 pNode->setType( rAttribs.getToken( XML_type, XML_none ) );
60 pNode->setRefFor( rAttribs.getToken( XML_refFor, XML_none ) );
61 pNode->setRefForName( rAttribs.getString( XML_refForName, "" ) );
62 pNode->setRefType( rAttribs.getToken( XML_refType, XML_none ) );
63 pNode->setRefPointType( rAttribs.getToken( XML_refPtType, XML_none ) );
64 pNode->setFactor( rAttribs.getDouble( XML_fact, 1.0 ) );
65 pNode->setValue( rAttribs.getDouble( XML_val, 0.0 ) );
66 pNode->setOperator( rAttribs.getToken( XML_op, XML_none ) );
67 break;
69 default:
70 break;
73 return this;
76 } }
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */