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 <svx/sdr/overlay/overlayrollingrectangle.hxx>
21 #include <vcl/outdev.hxx>
22 #include <basegfx/matrix/b2dhommatrix.hxx>
23 #include <svx/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/polygonprimitive2d.hxx>
29 //////////////////////////////////////////////////////////////////////////////
35 drawinglayer::primitive2d::Primitive2DSequence
OverlayRollingRectangleStriped::createOverlayObjectPrimitive2DSequence()
37 drawinglayer::primitive2d::Primitive2DSequence aRetval
;
39 if(getOverlayManager() && (getShowBounds() || getExtendedLines()))
41 const basegfx::BColor
aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
42 const basegfx::BColor
aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
43 const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
44 const basegfx::B2DRange
aRollingRectangle(getBasePosition(), getSecondPosition());
48 // view-independent part, create directly
49 const basegfx::B2DPolygon
aPolygon(basegfx::tools::createPolygonFromRect(aRollingRectangle
));
50 const drawinglayer::primitive2d::Primitive2DReference
aReference(
51 new drawinglayer::primitive2d::PolygonMarkerPrimitive2D(
57 drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval
, aReference
);
60 if(getExtendedLines())
62 // view-dependent part, use helper primitive
63 const drawinglayer::primitive2d::Primitive2DReference
aReference(
64 new drawinglayer::primitive2d::OverlayRollingRectanglePrimitive(
70 drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval
, aReference
);
77 void OverlayRollingRectangleStriped::stripeDefinitionHasChanged()
79 // react on OverlayManager's stripe definition change
83 OverlayRollingRectangleStriped::OverlayRollingRectangleStriped(
84 const basegfx::B2DPoint
& rBasePos
,
85 const basegfx::B2DPoint
& rSecondPos
,
88 : OverlayObjectWithBasePosition(rBasePos
, Color(COL_BLACK
)),
89 maSecondPosition(rSecondPos
),
90 mbExtendedLines(bExtendedLines
),
91 mbShowBounds(bShowBounds
)
95 OverlayRollingRectangleStriped::~OverlayRollingRectangleStriped()
99 void OverlayRollingRectangleStriped::setSecondPosition(const basegfx::B2DPoint
& rNew
)
101 if(rNew
!= maSecondPosition
)
103 // remember new value
104 maSecondPosition
= rNew
;
106 // register change (after change)
110 } // end of namespace overlay
111 } // end of namespace sdr
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */