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 <vcl/outdev.hxx>
22 #include <basegfx/matrix/b2dhommatrix.hxx>
23 #include <basegfx/polygon/b2dpolygontools.hxx>
24 #include <basegfx/polygon/b2dpolygon.hxx>
25 #include <basegfx/numeric/ftools.hxx>
26 #include <sdr/overlay/overlaytools.hxx>
27 #include <svx/sdr/overlay/overlaymanager.hxx>
28 #include <vcl/svapp.hxx>
29 #include <vcl/settings.hxx>
37 drawinglayer::primitive2d::Primitive2DSequence
OverlayRectangle::createOverlayObjectPrimitive2DSequence()
39 const basegfx::B2DRange
aHatchRange(getBasePosition(), maSecondPosition
);
40 basegfx::BColor
aColor(getBaseColor().getBColor());
41 static double fChange(0.1); // just small optical change, do not make it annoying
45 aColor
+= basegfx::B3DTuple(fChange
, fChange
, fChange
);
50 aColor
-= basegfx::B3DTuple(fChange
, fChange
, fChange
);
54 const drawinglayer::primitive2d::Primitive2DReference
aReference(
55 new drawinglayer::primitive2d::OverlayRectanglePrimitive(
63 return drawinglayer::primitive2d::Primitive2DSequence(&aReference
, 1);
66 OverlayRectangle::OverlayRectangle(
67 const basegfx::B2DPoint
& rBasePosition
,
68 const basegfx::B2DPoint
& rSecondPosition
,
69 const Color
& rHatchColor
,
72 double fDiscreteShrink
,
74 sal_uInt64 nBlinkTime
,
76 : OverlayObjectWithBasePosition(rBasePosition
, rHatchColor
),
77 maSecondPosition(rSecondPosition
),
78 mfTransparence(fTransparence
),
79 mfDiscreteGrow(fDiscreteGrow
),
80 mfDiscreteShrink(fDiscreteShrink
),
81 mfRotation(fRotation
),
82 mnBlinkTime(impCheckBlinkTimeValueRange(nBlinkTime
)),
85 if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
87 // no animation in high contrast mode
91 // set AllowsAnimation flag to mark this object as animation capable
92 mbAllowsAnimation
= bAnimate
;
95 void OverlayRectangle::Trigger(sal_uInt32 nTime
)
97 if(getOverlayManager())
99 // #i53216# produce event after nTime + x
100 SetTime(nTime
+ mnBlinkTime
);
105 mbOverlayState
= false;
109 mbOverlayState
= true;
112 // re-insert me as event
113 getOverlayManager()->InsertEvent(this);
115 // register change (after change)
119 } // end of namespace overlay
120 } // end of namespace sdr
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */