LibreOffice Module oox (master)
1
oox
source
drawingml
diagram
constraintlistcontext.cxx
Go to the documentation of this file.
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 <oox/token/namespaces.hxx>
23
#include <oox/token/tokens.hxx>
24
25
using namespace
::
oox::core
;
26
using namespace
::
com::sun::star::uno
;
27
using namespace
::
com::sun::star::xml::sax
;
28
29
namespace
oox::drawingml
{
30
31
// CT_ConstraintLists
32
ConstraintListContext::ConstraintListContext
( ContextHandler2Helper
const
& rParent,
33
const
LayoutAtomPtr
&pNode )
34
:
ContextHandler2
( rParent )
35
,
mpNode
( pNode )
36
{
37
assert( pNode &&
"Node must NOT be NULL"
);
38
}
39
40
ConstraintListContext::~ConstraintListContext
()
41
{
42
}
43
44
ContextHandlerRef
45
ConstraintListContext::onCreateContext
( ::sal_Int32 aElement,
46
const
AttributeList
& rAttribs )
47
{
48
switch
( aElement )
49
{
50
case
DGM_TOKEN( constr ):
51
{
52
auto
pNode = std::make_shared<ConstraintAtom>(
mpNode
->getLayoutNode());
53
LayoutAtom::connect
(
mpNode
, pNode);
54
55
Constraint
& rConstraint = pNode->getConstraint();
56
rConstraint.
mnFor
= rAttribs.
getToken
( XML_for,
XML_none
);
57
rConstraint.
msForName
= rAttribs.
getStringDefaulted
( XML_forName);
58
rConstraint.
mnPointType
= rAttribs.
getToken
( XML_ptType,
XML_none
);
59
rConstraint.
mnType
= rAttribs.
getToken
(
XML_type
,
XML_none
);
60
rConstraint.
mnRefFor
= rAttribs.
getToken
( XML_refFor,
XML_none
);
61
rConstraint.
msRefForName
= rAttribs.
getStringDefaulted
( XML_refForName);
62
rConstraint.
mnRefType
= rAttribs.
getToken
( XML_refType,
XML_none
);
63
rConstraint.
mnRefPointType
= rAttribs.
getToken
( XML_refPtType,
XML_none
);
64
rConstraint.
mfFactor
= rAttribs.
getDouble
( XML_fact, 1.0 );
65
rConstraint.
mfValue
= rAttribs.
getDouble
( XML_val, 0.0 );
66
rConstraint.
mnOperator
= rAttribs.
getToken
( XML_op,
XML_none
);
67
break
;
68
}
69
default
:
70
break
;
71
}
72
73
return
this
;
74
}
75
76
}
77
78
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
attributelist.hxx
oox::AttributeList
Provides access to attribute values of an element.
Definition:
attributelist.hxx:83
oox::AttributeList::getStringDefaulted
OUString getStringDefaulted(sal_Int32 nAttrToken) const
Returns the string value of the specified attribute, returns an empty string if attribute not present...
Definition:
attributelist.cxx:181
oox::AttributeList::getToken
std::optional< sal_Int32 > getToken(sal_Int32 nAttrToken) const
Returns the token identifier of the value of the specified attribute.
Definition:
attributelist.cxx:167
oox::AttributeList::getDouble
std::optional< double > getDouble(sal_Int32 nAttrToken) const
Returns the double value of the specified attribute.
Definition:
attributelist.cxx:197
oox::core::ContextHandler2
Definition:
contexthandler2.hxx:240
oox::drawingml::ConstraintListContext::ConstraintListContext
ConstraintListContext(ContextHandler2Helper const &rParent, const LayoutAtomPtr &pNode)
Definition:
constraintlistcontext.cxx:32
oox::drawingml::ConstraintListContext::onCreateContext
virtual ::oox::core::ContextHandlerRef onCreateContext(::sal_Int32 Element, const AttributeList &rAttribs) override
Definition:
constraintlistcontext.cxx:45
oox::drawingml::ConstraintListContext::~ConstraintListContext
virtual ~ConstraintListContext() override
Definition:
constraintlistcontext.cxx:40
oox::drawingml::ConstraintListContext::mpNode
LayoutAtomPtr mpNode
Definition:
constraintlistcontext.hxx:36
oox::drawingml::LayoutAtom::connect
static void connect(const LayoutAtomPtr &pParent, const LayoutAtomPtr &pChild)
Definition:
diagramlayoutatoms.hxx:127
rtl::Reference
constraintlistcontext.hxx
mpNode
AlgAtomPtr mpNode
Definition:
layoutnodecontext.cxx:95
com::sun::star::uno
com::sun::star::xml::sax
oox::core
oox::drawingml
oox::drawingml::LayoutAtomPtr
std::shared_ptr< LayoutAtom > LayoutAtomPtr
Definition:
oox/source/drawingml/diagram/diagram.hxx:41
XML_none
XML_none
XML_type
XML_type
oox::drawingml::Constraint
Constraints allow you to specify an ideal (or starting point) size for each shape.
Definition:
diagramlayoutatoms.hxx:68
oox::drawingml::Constraint::mnFor
sal_Int32 mnFor
Definition:
diagramlayoutatoms.hxx:73
oox::drawingml::Constraint::mnRefFor
sal_Int32 mnRefFor
Definition:
diagramlayoutatoms.hxx:76
oox::drawingml::Constraint::msRefForName
OUString msRefForName
Definition:
diagramlayoutatoms.hxx:70
oox::drawingml::Constraint::mfValue
double mfValue
Definition:
diagramlayoutatoms.hxx:72
oox::drawingml::Constraint::msForName
OUString msForName
Definition:
diagramlayoutatoms.hxx:69
oox::drawingml::Constraint::mnRefPointType
sal_Int32 mnRefPointType
Definition:
diagramlayoutatoms.hxx:78
oox::drawingml::Constraint::mnType
sal_Int32 mnType
Definition:
diagramlayoutatoms.hxx:75
oox::drawingml::Constraint::mfFactor
double mfFactor
Definition:
diagramlayoutatoms.hxx:71
oox::drawingml::Constraint::mnRefType
sal_Int32 mnRefType
Definition:
diagramlayoutatoms.hxx:77
oox::drawingml::Constraint::mnPointType
sal_Int32 mnPointType
Definition:
diagramlayoutatoms.hxx:74
oox::drawingml::Constraint::mnOperator
sal_Int32 mnOperator
Definition:
diagramlayoutatoms.hxx:79
Generated on Sun Jul 30 2023 04:44:09 for LibreOffice Module oox (master) by
1.9.3