nss: upgrade to release 3.73
[LibreOffice.git] / drawinglayer / source / primitive2d / PolyPolygonHatchPrimitive2D.cxx
blobad85c02f22c1b2577b8385c8cb93e8b967e30262
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/PolyPolygonHatchPrimitive2D.hxx>
22 #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
23 #include <drawinglayer/primitive2d/maskprimitive2d.hxx>
24 #include <drawinglayer/primitive2d/fillhatchprimitive2d.hxx>
26 using namespace com::sun::star;
28 namespace drawinglayer::primitive2d
30 void PolyPolygonHatchPrimitive2D::create2DDecomposition(
31 Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
33 if (!getFillHatch().isDefault())
35 // create SubSequence with FillHatchPrimitive2D
36 const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
37 FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(
38 aPolyPolygonRange, getDefinitionRange(), getBackgroundColor(), getFillHatch());
39 const Primitive2DReference xSubRef(pNewHatch);
40 const Primitive2DContainer aSubSequence{ xSubRef };
42 // create mask primitive
43 rContainer.push_back(new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence));
47 PolyPolygonHatchPrimitive2D::PolyPolygonHatchPrimitive2D(
48 const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBackgroundColor,
49 const attribute::FillHatchAttribute& rFillHatch)
50 : BufferedDecompositionPrimitive2D()
51 , maPolyPolygon(rPolyPolygon)
52 , maDefinitionRange(rPolyPolygon.getB2DRange())
53 , maBackgroundColor(rBackgroundColor)
54 , maFillHatch(rFillHatch)
58 PolyPolygonHatchPrimitive2D::PolyPolygonHatchPrimitive2D(
59 const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DRange& rDefinitionRange,
60 const basegfx::BColor& rBackgroundColor, const attribute::FillHatchAttribute& rFillHatch)
61 : BufferedDecompositionPrimitive2D()
62 , maPolyPolygon(rPolyPolygon)
63 , maDefinitionRange(rDefinitionRange)
64 , maBackgroundColor(rBackgroundColor)
65 , maFillHatch(rFillHatch)
69 bool PolyPolygonHatchPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
71 if (BufferedDecompositionPrimitive2D::operator==(rPrimitive))
73 const PolyPolygonHatchPrimitive2D& rCompare
74 = static_cast<const PolyPolygonHatchPrimitive2D&>(rPrimitive);
76 return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
77 && getDefinitionRange() == rCompare.getDefinitionRange()
78 && getBackgroundColor() == rCompare.getBackgroundColor()
79 && getFillHatch() == rCompare.getFillHatch());
82 return false;
85 // provide unique ID
86 sal_uInt32 PolyPolygonHatchPrimitive2D::getPrimitive2DID() const
88 return PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D;
91 } // end drawinglayer::primitive2d namespace
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */