LibreOffice Module svx (master)  1
overlaypolypolygon.cxx
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 
28 
29 
30 namespace sdr::overlay
31 {
33  const basegfx::B2DPolyPolygon& rLinePolyPolygon,
34  Color const & rLineColor,
35  double fLineWidth,
36  Color const & rFillColor)
37  : OverlayObject(rLineColor)
38  , maLinePolyPolygon(rLinePolyPolygon)
39  , mfLineWidth(fLineWidth)
40  , maFillColor(rFillColor)
41  {
42  }
43 
45 
47  {
49 
50  if (getOverlayManager())
51  {
52  const drawinglayer::attribute::LineAttribute aLineAttribute(getBaseColor().getBColor(), mfLineWidth);
53 
56 
57  if (maFillColor.GetAlpha() != 0)
58  {
60  }
61 
62  sal_uInt8 nTransparency = 255 - getBaseColor().GetAlpha();
63  if (nTransparency > 0)
64  {
66  new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(std::move(aReturnContainer), nTransparency / 255.0));
67  aReturnContainer = drawinglayer::primitive2d::Primitive2DContainer{ aTransparencePrimitive };
68  }
69  }
70 
71  return aReturnContainer;
72  }
73 
75  {
77 
78  if(getOverlayManager())
79  {
80  const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
81  const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
82  const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
86  aRGBColorA,
87  aRGBColorB,
88  fStripeLengthPixel));
89 
91 
92  const basegfx::BColor aHilightColor(SvtOptionsDrawinglayer::getHilightColor().getBColor());
93  const double fTransparence(SvtOptionsDrawinglayer::GetTransparentSelectionPercent() * 0.01);
94 
98  aHilightColor,
99  fTransparence,
100  3.0,
101  false));
102 
103  aRetval.push_back(aFilled);
104  }
105 
106  return aRetval;
107  }
108 
110  {
111  // react on OverlayManager's stripe definition change
112  objectChange();
113  }
114 
116  const basegfx::B2DPolyPolygon& rLinePolyPolygon)
118  maLinePolyPolygon(rLinePolyPolygon)
119  {
120  }
121 
123  {
124  }
125 
126 } // end of namespace
127 
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt8 GetAlpha() const
basegfx::B2DPolyPolygon maLinePolyPolygon
virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override
virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override
OverlayManager * getOverlayManager() const
const basegfx::B2DPolyPolygon & getLinePolyPolygon() const
OverlayPolyPolygon(const basegfx::B2DPolyPolygon &rLinePolyPolygon, Color const &rLineColor, double mfLineWidth, Color const &rFillColor)
uno::Sequence< double > maFillColor
const Color & getBaseColor() const
OverlayPolyPolygonStripedAndFilled(const basegfx::B2DPolyPolygon &rLinePolyPolygon)
css::uno::Reference< css::graphic::XPrimitive2D > Primitive2DReference
virtual ~OverlayPolyPolygon() override
unsigned char sal_uInt8
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
basegfx::BColor getBColor() const
sal_uInt16 GetTransparentSelectionPercent()