fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / svx / source / sdr / overlay / overlayobjectcell.cxx
blob73ae66b43f409478a35c445ad664c0c15a41451f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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;
33 // #114409#
34 namespace sdr
36 namespace overlay
38 OverlayObjectCell::OverlayObjectCell( CellOverlayType eType, const Color& rColor, const RangeVector& rRects )
39 : OverlayObject( rColor ),
40 mePaintType( eType ),
41 maRectangles( rRects )
43 // no AA for selection overlays
44 allowAntiAliase(false);
47 OverlayObjectCell::~OverlayObjectCell()
51 drawinglayer::primitive2d::Primitive2DSequence OverlayObjectCell::createOverlayObjectPrimitive2DSequence()
53 drawinglayer::primitive2d::Primitive2DSequence aRetval;
54 const sal_uInt32 nCount(maRectangles.size());
56 if(nCount)
58 const basegfx::BColor aRGBColor(getBaseColor().getBColor());
59 aRetval.realloc(nCount);
61 // create primitives for all ranges
62 for(sal_uInt32 a(0); a < nCount; a++)
64 const basegfx::B2DRange& rRange(maRectangles[a]);
65 const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(rRange));
67 aRetval[a] = drawinglayer::primitive2d::Primitive2DReference(
68 new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
69 basegfx::B2DPolyPolygon(aPolygon),
70 aRGBColor));
74 if(mePaintType == CELL_OVERLAY_TRANSPARENT)
76 // embed in 50% transparent paint
77 const drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparence(
78 new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
79 aRetval,
80 0.5));
82 aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparence, 1);
84 else // CELL_OVERLAY_INVERT
86 // embed in invert primitive
87 const drawinglayer::primitive2d::Primitive2DReference aInvert(
88 new drawinglayer::primitive2d::InvertPrimitive2D(
89 aRetval));
91 aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aInvert, 1);
95 return aRetval;
97 } // end of namespace overlay
98 } // end of namespace sdr
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */