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 .
20 #include <sdr/overlay/overlayrollingrectangle.hxx>
21 #include <vcl/outdev.hxx>
22 #include <basegfx/matrix/b2dhommatrix.hxx>
23 #include <sdr/overlay/overlaytools.hxx>
24 #include <svx/sdr/overlay/overlaymanager.hxx>
25 #include <basegfx/polygon/b2dpolygontools.hxx>
26 #include <basegfx/polygon/b2dpolygon.hxx>
27 #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
34 drawinglayer::primitive2d::Primitive2DContainer
OverlayRollingRectangleStriped::createOverlayObjectPrimitive2DSequence()
36 drawinglayer::primitive2d::Primitive2DContainer aRetval
;
38 if(getOverlayManager() && (mbShowBounds
|| mbExtendedLines
))
40 const basegfx::BColor
aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
41 const basegfx::BColor
aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
42 const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
43 const basegfx::B2DRange
aRollingRectangle(getBasePosition(), getSecondPosition());
47 // view-independent part, create directly
48 const basegfx::B2DPolygon
aPolygon(basegfx::utils::createPolygonFromRect(aRollingRectangle
));
51 aRetval
[0] = new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D(
52 basegfx::B2DPolyPolygon(aPolygon
),
57 const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer
;
58 const basegfx::BColor
aHilightColor(aSvtOptionsDrawinglayer
.getHilightColor().getBColor());
59 const double fTransparence(aSvtOptionsDrawinglayer
.GetTransparentSelectionPercent() * 0.01);
61 aRetval
[1] = new drawinglayer::primitive2d::PolyPolygonSelectionPrimitive2D(
62 basegfx::B2DPolyPolygon(aPolygon
),
71 // view-dependent part, use helper primitive
72 const drawinglayer::primitive2d::Primitive2DReference
aReference(
73 new drawinglayer::primitive2d::OverlayRollingRectanglePrimitive(
79 aRetval
.push_back(aReference
);
86 void OverlayRollingRectangleStriped::stripeDefinitionHasChanged()
88 // react on OverlayManager's stripe definition change
92 OverlayRollingRectangleStriped::OverlayRollingRectangleStriped(
93 const basegfx::B2DPoint
& rBasePos
,
94 const basegfx::B2DPoint
& rSecondPos
,
97 : OverlayObjectWithBasePosition(rBasePos
, COL_BLACK
),
98 maSecondPosition(rSecondPos
),
99 mbExtendedLines(bExtendedLines
),
100 mbShowBounds(bShowBounds
)
104 OverlayRollingRectangleStriped::~OverlayRollingRectangleStriped()
108 void OverlayRollingRectangleStriped::setSecondPosition(const basegfx::B2DPoint
& rNew
)
110 if(rNew
!= maSecondPosition
)
112 // remember new value
113 maSecondPosition
= rNew
;
115 // register change (after change)
119 } // end of namespace overlay
120 } // end of namespace sdr
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */