calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / drawinglayer / source / primitive2d / texthierarchyprimitive2d.cxx
blob93cb4e455d7603e5e478aa1e3dc3e78de643f558
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 <drawinglayer/primitive2d/texthierarchyprimitive2d.hxx>
21 #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
24 using namespace com::sun::star;
27 namespace drawinglayer::primitive2d
29 TextHierarchyLinePrimitive2D::TextHierarchyLinePrimitive2D(Primitive2DContainer&& aChildren)
30 : GroupPrimitive2D(std::move(aChildren))
34 // provide unique ID
35 sal_uInt32 TextHierarchyLinePrimitive2D::getPrimitive2DID() const
37 return PRIMITIVE2D_ID_TEXTHIERARCHYLINEPRIMITIVE2D;
41 TextHierarchyParagraphPrimitive2D::TextHierarchyParagraphPrimitive2D(
42 Primitive2DContainer&& aChildren,
43 sal_Int16 nOutlineLevel)
44 : GroupPrimitive2D(std::move(aChildren)),
45 mnOutlineLevel(nOutlineLevel)
49 bool TextHierarchyParagraphPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
51 if(GroupPrimitive2D::operator==(rPrimitive))
53 const TextHierarchyParagraphPrimitive2D& rCompare = static_cast<const TextHierarchyParagraphPrimitive2D&>(rPrimitive);
55 return (getOutlineLevel() == rCompare.getOutlineLevel());
58 return false;
61 // provide unique ID
62 sal_uInt32 TextHierarchyParagraphPrimitive2D::getPrimitive2DID() const
64 return PRIMITIVE2D_ID_TEXTHIERARCHYPARAGRAPHPRIMITIVE2D;
69 TextHierarchyBulletPrimitive2D::TextHierarchyBulletPrimitive2D(Primitive2DContainer&& aChildren)
70 : GroupPrimitive2D(std::move(aChildren))
74 // provide unique ID
75 sal_uInt32 TextHierarchyBulletPrimitive2D::getPrimitive2DID() const
77 return PRIMITIVE2D_ID_TEXTHIERARCHYBULLETPRIMITIVE2D;
81 TextHierarchyBlockPrimitive2D::TextHierarchyBlockPrimitive2D(Primitive2DContainer&& aChildren)
82 : GroupPrimitive2D(std::move(aChildren))
86 // provide unique ID
87 sal_uInt32 TextHierarchyBlockPrimitive2D::getPrimitive2DID() const
89 return PRIMITIVE2D_ID_TEXTHIERARCHYBLOCKPRIMITIVE2D;
93 TextHierarchyFieldPrimitive2D::TextHierarchyFieldPrimitive2D(
94 Primitive2DContainer&& aChildren,
95 const FieldType& rFieldType,
96 const std::vector< std::pair< OUString, OUString>>* pNameValue)
97 : GroupPrimitive2D(std::move(aChildren)),
98 meType(rFieldType)
100 if (nullptr != pNameValue)
102 meNameValue = *pNameValue;
106 OUString TextHierarchyFieldPrimitive2D::getValue(const OUString& rName) const
108 for (const std::pair< OUString, OUString >& candidate : meNameValue)
110 if (candidate.first.equals(rName))
112 return candidate.second;
116 return OUString();
119 bool TextHierarchyFieldPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
121 if(GroupPrimitive2D::operator==(rPrimitive))
123 const TextHierarchyFieldPrimitive2D& rCompare = static_cast<const TextHierarchyFieldPrimitive2D&>(rPrimitive);
125 return (getType() == rCompare.getType()
126 && meNameValue == rCompare.meNameValue);
129 return false;
132 // provide unique ID
133 sal_uInt32 TextHierarchyFieldPrimitive2D::getPrimitive2DID() const
135 return PRIMITIVE2D_ID_TEXTHIERARCHYFIELDPRIMITIVE2D;
139 TextHierarchyEditPrimitive2D::TextHierarchyEditPrimitive2D(Primitive2DContainer&& aContent)
140 : BasePrimitive2D()
141 , maContent(std::move(aContent))
145 // provide unique ID
146 sal_uInt32 TextHierarchyEditPrimitive2D::getPrimitive2DID() const
148 return PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D;
151 } // end of namespace
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */