Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
30 : : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
31 : :
32 : : #include <drawinglayer/drawinglayerdllapi.h>
33 : :
34 : : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
35 : : #include <basegfx/color/bcolor.hxx>
36 : :
37 : : //////////////////////////////////////////////////////////////////////////////
38 : : // BackgroundColorPrimitive2D class
39 : :
40 : : namespace drawinglayer
41 : : {
42 : : namespace primitive2d
43 : : {
44 : : /** BackgroundColorPrimitive2D class
45 : :
46 : : This primitive is defined to fill the whole visible Viewport with
47 : : the given color (and thus decomposes to a filled polygon). This
48 : : makes it a view-depnendent primitive by definition. It only has
49 : : a valid decomposition if a valid Viewport is given in the
50 : : ViewInformation2D at decomposition time.
51 : :
52 : : It will try to buffer it's last decomposition using maLastViewport
53 : : to detect changes in the get2DDecomposition call.
54 : : */
55 [ - + ]: 5912 : class DRAWINGLAYER_DLLPUBLIC BackgroundColorPrimitive2D : public BufferedDecompositionPrimitive2D
56 : : {
57 : : private:
58 : : /// the fill color to use
59 : : basegfx::BColor maBColor;
60 : :
61 : : /// the last used viewInformation, used from getDecomposition for buffering
62 : : basegfx::B2DRange maLastViewport;
63 : :
64 : : protected:
65 : : /// create local decomposition
66 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
67 : :
68 : : public:
69 : : /// constructor
70 : : explicit BackgroundColorPrimitive2D(
71 : : const basegfx::BColor& rBColor);
72 : :
73 : : /// data read access
74 : 6804 : const basegfx::BColor& getBColor() const { return maBColor; }
75 : :
76 : : /// compare operator
77 : : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
78 : :
79 : : /// get B2Drange
80 : : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
81 : :
82 : : /// provide unique ID
83 : : DeclPrimitrive2DIDBlock()
84 : :
85 : : /// Overload standard getDecomposition call to be view-dependent here
86 : : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
87 : : };
88 : : } // end of namespace primitive2d
89 : : } // end of namespace drawinglayer
90 : :
91 : : //////////////////////////////////////////////////////////////////////////////
92 : :
93 : : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
94 : :
95 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|