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 <vcl/outdev.hxx>
23 #include <vcl/hatch.hxx>
24 #include <svx/sdr/overlay/overlayobjectcell.hxx>
25 #include <basegfx/polygon/b2dpolygontools.hxx>
26 #include <basegfx/polygon/b2dpolygon.hxx>
27 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
28 #include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
29 #include <drawinglayer/primitive2d/invertprimitive2d.hxx>
31 using namespace ::basegfx
;
37 OverlayObjectCell::OverlayObjectCell( const Color
& rColor
, const RangeVector
& rRects
)
38 : OverlayObject( rColor
),
39 maRectangles( rRects
)
41 // no AA for selection overlays
42 allowAntiAliase(false);
45 OverlayObjectCell::~OverlayObjectCell()
49 drawinglayer::primitive2d::Primitive2DContainer
OverlayObjectCell::createOverlayObjectPrimitive2DSequence()
51 drawinglayer::primitive2d::Primitive2DContainer aRetval
;
52 const sal_uInt32
nCount(maRectangles
.size());
56 const basegfx::BColor
aRGBColor(getBaseColor().getBColor());
57 aRetval
.resize(nCount
);
59 // create primitives for all ranges
60 for(sal_uInt32
a(0); a
< nCount
; a
++)
62 const basegfx::B2DRange
& rRange(maRectangles
[a
]);
63 const basegfx::B2DPolygon
aPolygon(basegfx::utils::createPolygonFromRect(rRange
));
65 aRetval
[a
] = drawinglayer::primitive2d::Primitive2DReference(
66 new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
67 basegfx::B2DPolyPolygon(aPolygon
),
72 // embed in 50% transparent paint
73 const drawinglayer::primitive2d::Primitive2DReference
aUnifiedTransparence(
74 new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
78 aRetval
= drawinglayer::primitive2d::Primitive2DContainer
{ aUnifiedTransparence
};
83 } // end of namespace overlay
84 } // end of namespace sdr
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */