Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
21 : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
22 :
23 : #include <drawinglayer/drawinglayerdllapi.h>
24 :
25 : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
26 : #include <basegfx/color/bcolor.hxx>
27 :
28 :
29 : // BackgroundColorPrimitive2D class
30 :
31 : namespace drawinglayer
32 : {
33 : namespace primitive2d
34 : {
35 : /** BackgroundColorPrimitive2D class
36 :
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.
42 :
43 : It will try to buffer it's last decomposition using maLastViewport
44 : to detect changes in the get2DDecomposition call.
45 : */
46 0 : class DRAWINGLAYER_DLLPUBLIC BackgroundColorPrimitive2D : public BufferedDecompositionPrimitive2D
47 : {
48 : private:
49 : /// the fill color to use
50 : basegfx::BColor maBColor;
51 :
52 : /// the last used viewInformation, used from getDecomposition for buffering
53 : basegfx::B2DRange maLastViewport;
54 :
55 : protected:
56 : /// create local decomposition
57 : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
58 :
59 : public:
60 : /// constructor
61 : explicit BackgroundColorPrimitive2D(
62 : const basegfx::BColor& rBColor);
63 :
64 : /// data read access
65 0 : const basegfx::BColor& getBColor() const { return maBColor; }
66 :
67 : /// compare operator
68 : virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
69 :
70 : /// get B2Drange
71 : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
72 :
73 : /// provide unique ID
74 : DeclPrimitive2DIDBlock()
75 :
76 : /// Overload standard getDecomposition call to be view-dependent here
77 : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
78 : };
79 : } // end of namespace primitive2d
80 : } // end of namespace drawinglayer
81 :
82 :
83 :
84 : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
85 :
86 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|