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 .
21 #include <basegfx/numeric/ftools.hxx>
22 #include <sdr/overlay/overlayobjectcell.hxx>
23 #include <basegfx/polygon/b2dpolygontools.hxx>
24 #include <basegfx/polygon/b2dpolygon.hxx>
25 #include <drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx>
26 #include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
28 using namespace ::basegfx
;
30 namespace sdr::overlay
32 OverlayObjectCell::OverlayObjectCell( const Color
& rColor
, RangeVector
&& rRects
)
33 : OverlayObject( rColor
),
34 maRectangles( std::move(rRects
) )
36 // no AA for selection overlays
37 allowAntiAliase(false);
40 OverlayObjectCell::~OverlayObjectCell()
44 drawinglayer::primitive2d::Primitive2DContainer
OverlayObjectCell::createOverlayObjectPrimitive2DSequence()
46 drawinglayer::primitive2d::Primitive2DContainer aRetval
;
47 const sal_uInt32
nCount(maRectangles
.size());
51 const basegfx::BColor
aRGBColor(getBaseColor().getBColor());
52 aRetval
.resize(nCount
);
54 // create primitives for all ranges
55 for(sal_uInt32
a(0); a
< nCount
; a
++)
57 const basegfx::B2DRange
& rRange(maRectangles
[a
]);
58 const basegfx::B2DPolygon
aPolygon(basegfx::utils::createPolygonFromRect(rRange
));
61 new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
62 basegfx::B2DPolyPolygon(aPolygon
),
67 aRetval
= drawinglayer::primitive2d::Primitive2DContainer
{
68 // embed in 50% transparent paint
69 new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */