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 .
22 #include <drawinglayer/drawinglayerdllapi.h>
24 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
25 #include <drawinglayer/primitive2d/CommonTypes.hxx>
26 #include <drawinglayer/primitive2d/Primitive2DVisitor.hxx>
28 #include <basegfx/range/b2drange.hxx>
31 namespace drawinglayer::geometry
33 class ViewInformation2D
;
36 namespace drawinglayer::primitive2d
38 class SAL_WARN_UNUSED DRAWINGLAYERCORE_DLLPUBLIC Primitive2DContainer final
39 : public std::deque
<Primitive2DReference
>,
40 public Primitive2DDecompositionVisitor
43 // use zero because we allocate a lot of empty containers
44 explicit Primitive2DContainer()
48 explicit Primitive2DContainer(size_type count
)
52 virtual ~Primitive2DContainer() override
;
53 Primitive2DContainer(const Primitive2DContainer
& other
)
57 Primitive2DContainer(Primitive2DContainer
&& other
) noexcept
58 : deque(std::move(other
))
61 Primitive2DContainer(std::initializer_list
<Primitive2DReference
> init
)
66 const css::uno::Sequence
<css::uno::Reference
<css::graphic::XPrimitive2D
>>&);
67 Primitive2DContainer(const std::deque
<css::uno::Reference
<css::graphic::XPrimitive2D
>>&);
69 virtual void visit(const Primitive2DReference
& rSource
) override
{ append(rSource
); }
70 virtual void visit(const Primitive2DContainer
& rSource
) override
{ append(rSource
); }
71 virtual void visit(Primitive2DContainer
&& rSource
) override
{ append(std::move(rSource
)); }
73 void append(const Primitive2DReference
&);
74 void append(const Primitive2DContainer
& rSource
);
75 void append(Primitive2DContainer
&& rSource
);
76 Primitive2DContainer
& operator=(const Primitive2DContainer
& r
)
81 Primitive2DContainer
& operator=(Primitive2DContainer
&& r
) noexcept
83 deque::operator=(std::move(r
));
86 bool operator==(const Primitive2DContainer
& rB
) const;
87 bool operator!=(const Primitive2DContainer
& rB
) const { return !operator==(rB
); }
88 basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& aViewInformation
) const;
89 Primitive2DContainer
maybeInvert(bool bInvert
= false);
91 css::uno::Sequence
<css::uno::Reference
<css::graphic::XPrimitive2D
>> toSequence() const;
94 } // end of namespace drawinglayer::primitive2d
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */