LibreOffice Module drawinglayer (master) 1
PolyPolygonHatchPrimitive2D.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
21
25#include <rtl/ref.hxx>
26#include <utility>
27
28using namespace com::sun::star;
29
31{
33 Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
34{
35 if (!getFillHatch().isDefault())
36 {
37 // create SubSequence with FillHatchPrimitive2D
38 const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
40 aPolyPolygonRange, getDefinitionRange(), getBackgroundColor(), getFillHatch());
41 Primitive2DContainer aSubSequence{ pNewHatch };
42
43 // create mask primitive
44 rContainer.push_back(new MaskPrimitive2D(getB2DPolyPolygon(), std::move(aSubSequence)));
45 }
46}
47
49 const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBackgroundColor,
51 : maPolyPolygon(rPolyPolygon)
52 , maDefinitionRange(rPolyPolygon.getB2DRange())
53 , maBackgroundColor(rBackgroundColor)
54 , maFillHatch(std::move(rFillHatch))
55{
56}
57
59 const basegfx::B2DRange& rDefinitionRange,
60 const basegfx::BColor& rBackgroundColor,
62 : maPolyPolygon(std::move(aPolyPolygon))
63 , maDefinitionRange(rDefinitionRange)
64 , maBackgroundColor(rBackgroundColor)
65 , maFillHatch(std::move(rFillHatch))
66{
67}
68
70{
71 if (BufferedDecompositionPrimitive2D::operator==(rPrimitive))
72 {
73 const PolyPolygonHatchPrimitive2D& rCompare
74 = static_cast<const PolyPolygonHatchPrimitive2D&>(rPrimitive);
75
76 return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
77 && getDefinitionRange() == rCompare.getDefinitionRange()
78 && getBackgroundColor() == rCompare.getBackgroundColor()
79 && getFillHatch() == rCompare.getFillHatch());
80 }
81
82 return false;
83}
84
85// provide unique ID
87{
89}
90
91} // end drawinglayer::primitive2d namespace
92
93/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Color maBackgroundColor
virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D &rViewInformation) const
The default implementation will use getDecomposition results to create the range.
const basegfx::B2DPolyPolygon & getB2DPolyPolygon() const
data read access
PolyPolygonHatchPrimitive2D(const basegfx::B2DPolyPolygon &rPolyPolygon, const basegfx::BColor &rBackgroundColor, attribute::FillHatchAttribute aFillHatch)
constructors. The one without definition range will use output range as definition range
virtual sal_uInt32 getPrimitive2DID() const override
provide unique ID
const attribute::FillHatchAttribute & getFillHatch() const
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
compare operator
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &rViewInformation) const override
local decomposition.
#define PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D
basegfx::B2DPolyPolygon maPolyPolygon