LibreOffice Module svx (master) 1
sdrallfillattributeshelper.hxx
Go to the documentation of this file.
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#ifndef INCLUDED_SVX_SDR_ATTRIBUTE_SDRALLFILLATTRIBUTESHELPER_HXX
20#define INCLUDED_SVX_SDR_ATTRIBUTE_SDRALLFILLATTRIBUTESHELPER_HXX
21
22#include <svx/svxdllapi.h>
26#include <svl/itemset.hxx>
27#include <optional>
28
30
31class Color;
32
34 {
36 {
37 private:
40 std::optional<drawinglayer::attribute::SdrFillAttribute> maFillAttribute;
41 std::optional<drawinglayer::attribute::FillGradientAttribute> maFillGradientAttribute;
43
44 void createPrimitive2DSequence(
45 const basegfx::B2DRange& rPaintRange,
46 const basegfx::B2DRange& rDefineRange);
47
48 public:
49 SdrAllFillAttributesHelper(const Color& rColor);
52
53 bool isUsed() const;
54 bool hasSdrFillAttribute() const { return bool(maFillAttribute); }
55 bool isTransparent() const;
56
57 const drawinglayer::attribute::SdrFillAttribute& getFillAttribute() const;
58 const drawinglayer::attribute::FillGradientAttribute& getFillGradientAttribute() const;
59 const drawinglayer::primitive2d::Primitive2DContainer& getPrimitive2DSequence(
60 const basegfx::B2DRange& rPaintRange,
61 const basegfx::B2DRange& rDefineRange) const;
62
63 // get average fill color; tries to calculate a 'medium' color
64 // which e.g. may be used as comparison to decide if other
65 // colors are visible
66 basegfx::BColor getAverageColor(const basegfx::BColor& rFallback) const;
67
68 // return if a repaint of this content needs a complete repaint. This
69 // is e.g. not needed for no fill or color fill (a partial repaint
70 // will do the trick), but necessary for everything that is not top-left
71 // oriented
72 bool needCompleteRepaint() const;
73 };
74
75} // end of namespace drawinglayer::attribute
76
78
80{
81 typedef std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr;
82} // end of namespace drawinglayer::attribute
83
85
86#endif
87
88/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::optional< drawinglayer::attribute::SdrFillAttribute > maFillAttribute
drawinglayer::primitive2d::Primitive2DContainer maPrimitives
std::optional< drawinglayer::attribute::FillGradientAttribute > maFillGradientAttribute
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35