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 .
19 #ifndef _SDR_ATTRIBUTE_SDRALLFILLATTRIBUTESHELPER_HXX
20 #define _SDR_ATTRIBUTE_SDRALLFILLATTRIBUTESHELPER_HXX
22 #include "svx/svxdllapi.h"
23 #include <drawinglayer/attribute/fillgradientattribute.hxx>
24 #include <drawinglayer/attribute/sdrfillattribute.hxx>
25 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
26 #include <tools/color.hxx>
27 #include <svl/itemset.hxx>
30 //////////////////////////////////////////////////////////////////////////////
32 namespace drawinglayer
36 class SVX_DLLPUBLIC SdrAllFillAttributesHelper
39 basegfx::B2DRange maLastPaintRange
;
40 basegfx::B2DRange maLastDefineRange
;
41 std::shared_ptr
< drawinglayer::attribute::SdrFillAttribute
> maFillAttribute
;
42 std::shared_ptr
< drawinglayer::attribute::FillGradientAttribute
> maFillGradientAttribute
;
43 drawinglayer::primitive2d::Primitive2DSequence maPrimitives
;
45 void createPrimitive2DSequence(
46 const basegfx::B2DRange
& rPaintRange
,
47 const basegfx::B2DRange
& rDefineRange
);
51 SdrAllFillAttributesHelper(const Color
& rColor
);
52 SdrAllFillAttributesHelper(const SfxItemSet
& rSet
);
53 ~SdrAllFillAttributesHelper();
56 bool hasSdrFillAttribute() const { return maFillAttribute
.get(); }
57 bool hasFillGradientAttribute() const { return maFillGradientAttribute
.get(); }
58 bool isTransparent() const;
60 const drawinglayer::attribute::SdrFillAttribute
& getFillAttribute() const;
61 const drawinglayer::attribute::FillGradientAttribute
& getFillGradientAttribute() const;
62 const drawinglayer::primitive2d::Primitive2DSequence
& getPrimitive2DSequence(
63 const basegfx::B2DRange
& rPaintRange
,
64 const basegfx::B2DRange
& rDefineRange
) const;
66 // get average fill color; tries to calculate a 'medium' color
67 // which e.g. may be used as comparison to decide if other
69 basegfx::BColor
getAverageColor(const basegfx::BColor
& rFallback
) const;
71 // return if a repaint of this content needs a complete repaint. This
72 // is e.g. not needed for no fill or color fill (a partial repaint
73 // will do the trick), but necessary for everything that is not top-left
75 bool needCompleteRepaint() const;
77 } // end of namespace attribute
78 } // end of namespace drawinglayer
80 //////////////////////////////////////////////////////////////////////////////
82 namespace drawinglayer
86 typedef std::shared_ptr
< SdrAllFillAttributesHelper
> SdrAllFillAttributesHelperPtr
;
87 } // end of namespace attribute
88 } // end of namespace drawinglayer
90 //////////////////////////////////////////////////////////////////////////////
92 #endif // _SDR_ATTRIBUTE_SDRALLFILLATTRIBUTESHELPER_HXX
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */