LibreOffice Module svx (master)  1
overlayrollingrectangle.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 
26 
27 
28 namespace sdr::overlay
29 {
31  {
33 
35  {
36  const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
37  const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
38  const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
39  const basegfx::B2DRange aRollingRectangle(getBasePosition(), getSecondPosition());
40 
41  if(mbShowBounds)
42  {
43  // view-independent part, create directly
44  const basegfx::B2DPolygon aPolygon(basegfx::utils::createPolygonFromRect(aRollingRectangle));
45 
46  aRetval.resize(2);
48  basegfx::B2DPolyPolygon(aPolygon),
49  aRGBColorA,
50  aRGBColorB,
51  fStripeLengthPixel);
52 
53  const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
54  const basegfx::BColor aHilightColor(aSvtOptionsDrawinglayer.getHilightColor().getBColor());
55  const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
56 
58  basegfx::B2DPolyPolygon(aPolygon),
59  aHilightColor,
60  fTransparence,
61  3.0,
62  false);
63  }
64 
65  if(mbExtendedLines)
66  {
67  // view-dependent part, use helper primitive
70  aRollingRectangle,
71  aRGBColorA,
72  aRGBColorB,
73  fStripeLengthPixel));
74 
75  aRetval.push_back(aReference);
76  }
77  }
78 
79  return aRetval;
80  }
81 
83  {
84  // react on OverlayManager's stripe definition change
85  objectChange();
86  }
87 
89  const basegfx::B2DPoint& rBasePos,
90  const basegfx::B2DPoint& rSecondPos,
91  bool bExtendedLines,
92  bool bShowBounds)
94  maSecondPosition(rSecondPos),
95  mbExtendedLines(bExtendedLines),
96  mbShowBounds(bShowBounds)
97  {
98  }
99 
101  {
102  }
103 
105  {
106  if(rNew != maSecondPosition)
107  {
108  // remember new value
109  maSecondPosition = rNew;
110 
111  // register change (after change)
112  objectChange();
113  }
114  }
115 } // end of namespace
116 
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr::Color COL_BLACK(0x00, 0x00, 0x00)
sal_uInt16 GetTransparentSelectionPercent() const
const basegfx::B2DPoint & getSecondPosition() const
OverlayRollingRectangleStriped(const basegfx::B2DPoint &rBasePos, const basegfx::B2DPoint &rSecondPos, bool bExtendedLines, bool bShowBounds=true)
OverlayManager * getOverlayManager() const
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
void setSecondPosition(const basegfx::B2DPoint &rNew)
const basegfx::B2DPoint & getBasePosition() const
css::uno::Reference< css::graphic::XPrimitive2D > Primitive2DReference
basegfx::B2DPoint maSecondPosition
virtual drawinglayer::primitive2d::Primitive2DContainer createOverlayObjectPrimitive2DSequence() override
basegfx::BColor getBColor() const
Color getHilightColor() const