1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <drawinglayer/primitive2d/texthierarchyprimitive2d.hxx>
21 #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
24 using namespace com::sun::star
;
27 namespace drawinglayer
31 TextHierarchyLinePrimitive2D::TextHierarchyLinePrimitive2D(const Primitive2DContainer
& rChildren
)
32 : GroupPrimitive2D(rChildren
)
37 ImplPrimitive2DIDBlock(TextHierarchyLinePrimitive2D
, PRIMITIVE2D_ID_TEXTHIERARCHYLINEPRIMITIVE2D
)
39 } // end of namespace primitive2d
40 } // end of namespace drawinglayer
43 namespace drawinglayer
47 TextHierarchyParagraphPrimitive2D::TextHierarchyParagraphPrimitive2D(
48 const Primitive2DContainer
& rChildren
,
49 sal_Int16 nOutlineLevel
)
50 : GroupPrimitive2D(rChildren
),
51 mnOutlineLevel(nOutlineLevel
)
55 bool TextHierarchyParagraphPrimitive2D::operator==(const BasePrimitive2D
& rPrimitive
) const
57 if(GroupPrimitive2D::operator==(rPrimitive
))
59 const TextHierarchyParagraphPrimitive2D
& rCompare
= static_cast<const TextHierarchyParagraphPrimitive2D
&>(rPrimitive
);
61 return (getOutlineLevel() == rCompare
.getOutlineLevel());
68 ImplPrimitive2DIDBlock(TextHierarchyParagraphPrimitive2D
, PRIMITIVE2D_ID_TEXTHIERARCHYPARAGRAPHPRIMITIVE2D
)
70 } // end of namespace primitive2d
71 } // end of namespace drawinglayer
74 namespace drawinglayer
78 TextHierarchyBulletPrimitive2D::TextHierarchyBulletPrimitive2D(const Primitive2DContainer
& rChildren
)
79 : GroupPrimitive2D(rChildren
)
84 ImplPrimitive2DIDBlock(TextHierarchyBulletPrimitive2D
, PRIMITIVE2D_ID_TEXTHIERARCHYBULLETPRIMITIVE2D
)
86 } // end of namespace primitive2d
87 } // end of namespace drawinglayer
90 namespace drawinglayer
94 TextHierarchyBlockPrimitive2D::TextHierarchyBlockPrimitive2D(const Primitive2DContainer
& rChildren
)
95 : GroupPrimitive2D(rChildren
)
100 ImplPrimitive2DIDBlock(TextHierarchyBlockPrimitive2D
, PRIMITIVE2D_ID_TEXTHIERARCHYBLOCKPRIMITIVE2D
)
102 } // end of namespace primitive2d
103 } // end of namespace drawinglayer
106 namespace drawinglayer
108 namespace primitive2d
110 TextHierarchyFieldPrimitive2D::TextHierarchyFieldPrimitive2D(
111 const Primitive2DContainer
& rChildren
,
112 const FieldType
& rFieldType
,
113 const std::vector
< std::pair
< OUString
, OUString
>>* pNameValue
)
114 : GroupPrimitive2D(rChildren
),
118 if (nullptr != pNameValue
)
120 meNameValue
= *pNameValue
;
124 OUString
TextHierarchyFieldPrimitive2D::getValue(const OUString
& rName
) const
126 for (const std::pair
< OUString
, OUString
>& candidate
: meNameValue
)
128 if (candidate
.first
.equals(rName
))
130 return candidate
.second
;
137 bool TextHierarchyFieldPrimitive2D::operator==(const BasePrimitive2D
& rPrimitive
) const
139 if(GroupPrimitive2D::operator==(rPrimitive
))
141 const TextHierarchyFieldPrimitive2D
& rCompare
= static_cast<const TextHierarchyFieldPrimitive2D
&>(rPrimitive
);
143 return (getType() == rCompare
.getType()
144 && getNameValue() == rCompare
.getNameValue());
151 ImplPrimitive2DIDBlock(TextHierarchyFieldPrimitive2D
, PRIMITIVE2D_ID_TEXTHIERARCHYFIELDPRIMITIVE2D
)
152 } // end of namespace primitive2d
153 } // end of namespace drawinglayer
156 namespace drawinglayer
158 namespace primitive2d
160 TextHierarchyEditPrimitive2D::TextHierarchyEditPrimitive2D(const Primitive2DContainer
& rChildren
)
161 : GroupPrimitive2D(rChildren
)
166 ImplPrimitive2DIDBlock(TextHierarchyEditPrimitive2D
, PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D
)
168 } // end of namespace primitive2d
169 } // end of namespace drawinglayer
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */