bump product version to 7.6.3.2-android
[LibreOffice.git] / svx / source / sdr / overlay / overlayrollingrectangle.cxx
blobf03380eddf0f6c88fec06d379a543b96c5e52701
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 .
20 #include <sdr/overlay/overlayrollingrectangle.hxx>
21 #include <sdr/overlay/overlaytools.hxx>
22 #include <svx/sdr/overlay/overlaymanager.hxx>
23 #include <basegfx/polygon/b2dpolygontools.hxx>
24 #include <basegfx/polygon/b2dpolygon.hxx>
25 #include <drawinglayer/primitive2d/PolyPolygonMarkerPrimitive2D.hxx>
26 #include <drawinglayer/primitive2d/PolyPolygonSelectionPrimitive2D.hxx>
27 #include <svtools/optionsdrawinglayer.hxx>
29 namespace sdr::overlay
31 drawinglayer::primitive2d::Primitive2DContainer OverlayRollingRectangleStriped::createOverlayObjectPrimitive2DSequence()
33 drawinglayer::primitive2d::Primitive2DContainer aRetval;
35 if(getOverlayManager() && (mbShowBounds || mbExtendedLines))
37 const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
38 const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
39 const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
40 const basegfx::B2DRange aRollingRectangle(getBasePosition(), getSecondPosition());
42 if(mbShowBounds)
44 // view-independent part, create directly
45 const basegfx::B2DPolygon aPolygon(basegfx::utils::createPolygonFromRect(aRollingRectangle));
47 aRetval.resize(2);
48 aRetval[0] = new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D(
49 basegfx::B2DPolyPolygon(aPolygon),
50 aRGBColorA,
51 aRGBColorB,
52 fStripeLengthPixel);
54 const basegfx::BColor aHilightColor(SvtOptionsDrawinglayer::getHilightColor().getBColor());
55 const double fTransparence(SvtOptionsDrawinglayer::GetTransparentSelectionPercent() * 0.01);
57 aRetval[1] = new drawinglayer::primitive2d::PolyPolygonSelectionPrimitive2D(
58 basegfx::B2DPolyPolygon(aPolygon),
59 aHilightColor,
60 fTransparence,
61 3.0,
62 false);
65 if(mbExtendedLines)
67 // view-dependent part, use helper primitive
68 const drawinglayer::primitive2d::Primitive2DReference aReference(
69 new drawinglayer::primitive2d::OverlayRollingRectanglePrimitive(
70 aRollingRectangle,
71 aRGBColorA,
72 aRGBColorB,
73 fStripeLengthPixel));
75 aRetval.push_back(aReference);
79 return aRetval;
82 void OverlayRollingRectangleStriped::stripeDefinitionHasChanged()
84 // react on OverlayManager's stripe definition change
85 objectChange();
88 OverlayRollingRectangleStriped::OverlayRollingRectangleStriped(
89 const basegfx::B2DPoint& rBasePos,
90 const basegfx::B2DPoint& rSecondPos,
91 bool bExtendedLines,
92 bool bShowBounds)
93 : OverlayObjectWithBasePosition(rBasePos, COL_BLACK),
94 maSecondPosition(rSecondPos),
95 mbExtendedLines(bExtendedLines),
96 mbShowBounds(bShowBounds)
100 OverlayRollingRectangleStriped::~OverlayRollingRectangleStriped()
104 void OverlayRollingRectangleStriped::setSecondPosition(const basegfx::B2DPoint& rNew)
106 if(rNew != maSecondPosition)
108 // remember new value
109 maSecondPosition = rNew;
111 // register change (after change)
112 objectChange();
115 } // end of namespace
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */