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/overlayrectangle.hxx>
21 #include <sdr/overlay/overlaytools.hxx>
22 #include <svx/sdr/overlay/overlaymanager.hxx>
23 #include <vcl/svapp.hxx>
24 #include <vcl/settings.hxx>
27 namespace sdr::overlay
29 drawinglayer::primitive2d::Primitive2DContainer
OverlayRectangle::createOverlayObjectPrimitive2DSequence()
31 const basegfx::B2DRange
aHatchRange(getBasePosition(), maSecondPosition
);
32 basegfx::BColor
aColor(getBaseColor().getBColor());
33 static const double fChange(0.1); // just small optical change, do not make it annoying
37 aColor
+= basegfx::B3DTuple(fChange
, fChange
, fChange
);
42 aColor
-= basegfx::B3DTuple(fChange
, fChange
, fChange
);
46 const drawinglayer::primitive2d::Primitive2DReference
aReference(
47 new drawinglayer::primitive2d::OverlayRectanglePrimitive(
55 return drawinglayer::primitive2d::Primitive2DContainer
{ aReference
};
58 OverlayRectangle::OverlayRectangle(
59 const basegfx::B2DPoint
& rBasePosition
,
60 const basegfx::B2DPoint
& rSecondPosition
,
61 const Color
& rHatchColor
,
64 double fDiscreteShrink
,
67 : OverlayObjectWithBasePosition(rBasePosition
, rHatchColor
),
68 maSecondPosition(rSecondPosition
),
69 mfTransparence(fTransparence
),
70 mfDiscreteGrow(fDiscreteGrow
),
71 mfDiscreteShrink(fDiscreteShrink
),
72 mfRotation(fRotation
),
73 mnBlinkTime(impCheckBlinkTimeValueRange(500)),
76 if (!MiscSettings::IsAnimatedOthersAllowed())
79 // set AllowsAnimation flag to mark this object as animation capable
80 mbAllowsAnimation
= bAnimate
;
81 // use selection colors in HighContrast mode
82 mbHighContrastSelection
= true;
85 void OverlayRectangle::Trigger(sal_uInt32 nTime
)
87 if(!getOverlayManager())
90 // #i53216# produce event after nTime + x
91 SetTime(nTime
+ mnBlinkTime
);
96 mbOverlayState
= false;
100 mbOverlayState
= true;
103 // re-insert me as event
104 getOverlayManager()->InsertEvent(*this);
106 // register change (after change)
109 } // end of namespace
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */