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 "constraintlistcontext.hxx"
21 : #include "oox/helper/attributelist.hxx"
22 : #include <osl/diagnose.h>
23 :
24 : using namespace ::oox::core;
25 : using namespace ::com::sun::star::uno;
26 : using namespace ::com::sun::star::xml::sax;
27 :
28 : namespace oox { namespace drawingml {
29 :
30 : // CT_ConstraintLists
31 60 : ConstraintListContext::ConstraintListContext( ContextHandler2Helper& rParent,
32 : const AttributeList&,
33 : const LayoutAtomPtr &pNode )
34 : : ContextHandler2( rParent )
35 60 : , mpNode( pNode )
36 : {
37 : OSL_ENSURE( pNode, "Node must NOT be NULL" );
38 60 : }
39 :
40 120 : ConstraintListContext::~ConstraintListContext()
41 : {
42 120 : }
43 :
44 : ContextHandlerRef
45 207 : ConstraintListContext::onCreateContext( ::sal_Int32 aElement,
46 : const AttributeList& rAttribs )
47 : {
48 207 : switch( aElement )
49 : {
50 : case DGM_TOKEN( constr ):
51 : {
52 207 : ConstraintAtomPtr pNode( new ConstraintAtom() );
53 207 : mpNode->addChild( pNode );
54 :
55 207 : pNode->setFor( rAttribs.getToken( XML_for, XML_none ) );
56 207 : pNode->setForName( rAttribs.getString( XML_forName, "" ) );
57 207 : pNode->setPointType( rAttribs.getToken( XML_ptType, XML_none ) );
58 207 : pNode->setType( rAttribs.getToken( XML_type, XML_none ) );
59 207 : pNode->setRefFor( rAttribs.getToken( XML_refFor, XML_none ) );
60 207 : pNode->setRefForName( rAttribs.getString( XML_refForName, "" ) );
61 207 : pNode->setRefType( rAttribs.getToken( XML_refType, XML_none ) );
62 207 : pNode->setRefPointType( rAttribs.getToken( XML_refPtType, XML_none ) );
63 207 : pNode->setFactor( rAttribs.getDouble( XML_fact, 1.0 ) );
64 207 : pNode->setValue( rAttribs.getDouble( XML_val, 0.0 ) );
65 207 : pNode->setOperator( rAttribs.getToken( XML_op, XML_none ) );
66 207 : break;
67 : }
68 : default:
69 0 : break;
70 : }
71 :
72 207 : return this;
73 : }
74 :
75 246 : } }
76 :
77 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|