xref: /AOO41X/main/drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx (revision 0702bc67a2ac2836add565ba470821c1aa4db6ed)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX
25 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX
26 
27 #include <drawinglayer/drawinglayerdllapi.h>
28 #include <drawinglayer/primitive2d/primitivetools2d.hxx>
29 #include <drawinglayer/attribute/fillhatchattribute.hxx>
30 #include <basegfx/color/bcolor.hxx>
31 
32 //////////////////////////////////////////////////////////////////////////////
33 // FillHatchPrimitive2D class
34 
35 namespace drawinglayer
36 {
37     namespace primitive2d
38     {
39         /** FillHatchPrimitive2D class
40 
41             This class defines a hatch filling for a rectangular area. The
42             Range is defined by the Transformation, the hatch by the FillHatchAttribute.
43             If the background is to be filled, a flag in FillHatchAttribute is set and
44             the BColor defines the background color.
45 
46             #120230# This primitive is now evtl. metric dependent due to the value
47             MinimalDiscreteDistance in the FillHatchAttribute if the value is not zero.
48             This is used for a more appealing, VCL-like visualisation by not letting the
49             distances get too small between lines.
50 
51             The decomposition will deliver the hatch lines.
52          */
53         class DRAWINGLAYER_DLLPUBLIC FillHatchPrimitive2D : public DiscreteMetricDependentPrimitive2D
54         {
55         private:
56             /// the geometric definition
57             basegfx::B2DRange                       maObjectRange;
58 
59             /// the hatch definition
60             attribute::FillHatchAttribute           maFillHatch;
61 
62             /// hatch background color (if used)
63             basegfx::BColor                         maBColor;
64 
65         protected:
66             /// local decomposition.
67             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
68 
69         public:
70             /// constructor
71             FillHatchPrimitive2D(
72                 const basegfx::B2DRange& rObjectRange,
73                 const basegfx::BColor& rBColor,
74                 const attribute::FillHatchAttribute& rFillHatch);
75 
76             /// data read access
getObjectRange() const77             const basegfx::B2DRange& getObjectRange() const { return maObjectRange; }
getFillHatch() const78             const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; }
getBColor() const79             const basegfx::BColor& getBColor() const { return maBColor; }
80 
81             /// compare operator
82             virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
83 
84             /// get range
85             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
86 
87             /// get local decomposition. Overloaded since this decomposition is view-dependent
88             virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
89 
90             /// provide unique ID
91             DeclPrimitrive2DIDBlock()
92         };
93     } // end of namespace primitive2d
94 } // end of namespace drawinglayer
95 
96 //////////////////////////////////////////////////////////////////////////////
97 
98 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX
99 
100 //////////////////////////////////////////////////////////////////////////////
101 // eof
102