/src/libreoffice/svx/source/sdr/overlay/overlayobjectcell.cxx
Line | Count | Source |
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 | | |
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> |
27 | | |
28 | | using namespace ::basegfx; |
29 | | |
30 | | namespace sdr::overlay |
31 | | { |
32 | | OverlayObjectCell::OverlayObjectCell( const Color& rColor, RangeVector&& rRects ) |
33 | 0 | : OverlayObject( rColor ), |
34 | 0 | maRectangles( std::move(rRects) ) |
35 | 0 | { |
36 | | // no AA for selection overlays |
37 | 0 | allowAntiAliase(false); |
38 | 0 | } |
39 | | |
40 | | OverlayObjectCell::~OverlayObjectCell() |
41 | 0 | { |
42 | 0 | } |
43 | | |
44 | | drawinglayer::primitive2d::Primitive2DContainer OverlayObjectCell::createOverlayObjectPrimitive2DSequence() |
45 | 0 | { |
46 | 0 | drawinglayer::primitive2d::Primitive2DContainer aRetval; |
47 | 0 | const sal_uInt32 nCount(maRectangles.size()); |
48 | |
|
49 | 0 | if(nCount) |
50 | 0 | { |
51 | 0 | const basegfx::BColor aRGBColor(getBaseColor().getBColor()); |
52 | 0 | aRetval.resize(nCount); |
53 | | |
54 | | // create primitives for all ranges |
55 | 0 | for(sal_uInt32 a(0); a < nCount; a++) |
56 | 0 | { |
57 | 0 | const basegfx::B2DRange& rRange(maRectangles[a]); |
58 | 0 | const basegfx::B2DPolygon aPolygon(basegfx::utils::createPolygonFromRect(rRange)); |
59 | |
|
60 | 0 | aRetval[a] = |
61 | 0 | new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D( |
62 | 0 | basegfx::B2DPolyPolygon(aPolygon), |
63 | 0 | aRGBColor); |
64 | 0 | } |
65 | | |
66 | |
|
67 | 0 | aRetval = drawinglayer::primitive2d::Primitive2DContainer { |
68 | | // embed in 50% transparent paint |
69 | 0 | new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( |
70 | 0 | std::move(aRetval), |
71 | 0 | 0.5) |
72 | 0 | }; |
73 | 0 | } |
74 | |
|
75 | 0 | return aRetval; |
76 | 0 | } |
77 | | |
78 | | } // end of namespace |
79 | | |
80 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |