tdf#164803 sw: Fix SwTextSizeInfo applying grid metrics without grid
[LibreOffice.git] / include / drawinglayer / primitive2d / fillhatchprimitive2d.hxx
blob67e282cf5496a376f12caae2106a362bd14be4d7
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 #pragma once
22 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
23 #include <drawinglayer/primitive2d/primitivetools2d.hxx>
24 #include <drawinglayer/attribute/fillhatchattribute.hxx>
25 #include <basegfx/color/bcolor.hxx>
28 // FillHatchPrimitive2D class
30 namespace drawinglayer::primitive2d
32 /** FillHatchPrimitive2D class
34 This class defines a hatch filling for a rectangular area. The
35 Range is defined by the Transformation, the hatch by the FillHatchAttribute.
36 If the background is to be filled, a flag in FillHatchAttribute is set and
37 the BColor defines the background color.
39 #i120230# This primitive is now evtl. metric dependent due to the value
40 MinimalDiscreteDistance in the FillHatchAttribute if the value is not zero.
41 This is used for a more appealing, VCL-like visualisation by not letting the
42 distances get too small between lines.
44 The decomposition will deliver the hatch lines.
46 class FillHatchPrimitive2D final : public DiscreteMetricDependentPrimitive2D
48 private:
49 /// the geometrically visible area
50 basegfx::B2DRange maOutputRange;
52 /// the area the gradient definition is based on
53 /// in the simplest case identical to OutputRange
54 basegfx::B2DRange maDefinitionRange;
56 /// the hatch definition
57 attribute::FillHatchAttribute maFillHatch;
59 /// hatch background color (if used)
60 basegfx::BColor maBColor;
62 /// local decomposition.
63 virtual Primitive2DReference create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override;
65 public:
66 /// constructors. The one without definition range will use output range as definition range
67 FillHatchPrimitive2D(
68 const basegfx::B2DRange& rOutputRange,
69 const basegfx::BColor& rBColor,
70 attribute::FillHatchAttribute aFillHatch);
71 FillHatchPrimitive2D(
72 const basegfx::B2DRange& rOutputRange,
73 const basegfx::B2DRange& rDefinitionRange,
74 const basegfx::BColor& rBColor,
75 attribute::FillHatchAttribute aFillHatch);
77 /// data read access
78 const basegfx::B2DRange& getOutputRange() const { return maOutputRange; }
79 const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; }
80 const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; }
81 const basegfx::BColor& getBColor() const { return maBColor; }
83 /// compare operator
84 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
86 /// get range
87 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
89 /// Override standard getDecomposition to be view-dependent here
90 virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
92 /// provide unique ID
93 virtual sal_uInt32 getPrimitive2DID() const override;
95 } // end of namespace drawinglayer::primitive2d
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */