Branch libreoffice-6-3
[LibreOffice.git] / include / drawinglayer / primitive2d / backgroundcolorprimitive2d.hxx
blob8ccc43375bfdef62fecea5fb928618af3b2b4beb
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 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
21 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
26 #include <basegfx/color/bcolor.hxx>
29 // BackgroundColorPrimitive2D class
31 namespace drawinglayer
33 namespace primitive2d
35 /** BackgroundColorPrimitive2D class
37 This primitive is defined to fill the whole visible Viewport with
38 the given color (and thus decomposes to a filled polygon). This
39 makes it a view-dependent primitive by definition. It only has
40 a valid decomposition if a valid Viewport is given in the
41 ViewInformation2D at decomposition time.
43 It will try to buffer its last decomposition using maLastViewport
44 to detect changes in the get2DDecomposition call.
46 class DRAWINGLAYER_DLLPUBLIC BackgroundColorPrimitive2D : public BufferedDecompositionPrimitive2D
48 private:
49 /// the fill color to use
50 basegfx::BColor maBColor;
51 double mfTransparency;
53 /// the last used viewInformation, used from getDecomposition for buffering
54 basegfx::B2DRange maLastViewport;
56 protected:
57 /// create local decomposition
58 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
60 public:
61 /// constructor
62 explicit BackgroundColorPrimitive2D(
63 const basegfx::BColor& rBColor,
64 double fTransparency = 0);
66 /// data read access
67 const basegfx::BColor& getBColor() const { return maBColor; }
68 double getTransparency() const { return mfTransparency; }
70 /// compare operator
71 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
73 /// get B2Drange
74 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
76 /// provide unique ID
77 DeclPrimitive2DIDBlock()
79 /// Override standard getDecomposition call to be view-dependent here
80 virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
82 } // end of namespace primitive2d
83 } // end of namespace drawinglayer
86 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */