1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
28 //////////////////////////////////////////////////////////////////////////////
29 // BackgroundColorPrimitive2D class
31 namespace drawinglayer
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-depnendent 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 it's last decomposition using maLastViewport
44 to detect changes in the get2DDecomposition call.
46 class DRAWINGLAYER_DLLPUBLIC BackgroundColorPrimitive2D
: public BufferedDecompositionPrimitive2D
49 /// the fill color to use
50 basegfx::BColor maBColor
;
52 /// the last used viewInformation, used from getDecomposition for buffering
53 basegfx::B2DRange maLastViewport
;
56 /// create local decomposition
57 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const;
61 explicit BackgroundColorPrimitive2D(
62 const basegfx::BColor
& rBColor
);
65 const basegfx::BColor
& getBColor() const { return maBColor
; }
68 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const;
71 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const;
74 DeclPrimitive2DIDBlock()
76 /// Overload standard getDecomposition call to be view-dependent here
77 virtual Primitive2DSequence
get2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const;
79 } // end of namespace primitive2d
80 } // end of namespace drawinglayer
82 //////////////////////////////////////////////////////////////////////////////
84 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */