tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / svx / source / sdr / overlay / overlayanimatedbitmapex.cxx
blob967e9665b807e94e032fd667c31d698620a727c3
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 <svx/sdr/overlay/overlayanimatedbitmapex.hxx>
21 #include <svx/sdr/overlay/overlaymanager.hxx>
22 #include <sdr/overlay/overlaytools.hxx>
25 namespace sdr::overlay
27 drawinglayer::primitive2d::Primitive2DContainer OverlayAnimatedBitmapEx::createOverlayObjectPrimitive2DSequence()
29 if(mbOverlayState)
31 const drawinglayer::primitive2d::Primitive2DReference aPrimitive(
32 new drawinglayer::primitive2d::OverlayBitmapExPrimitive(
33 maBitmapEx1,
34 getBasePosition(),
35 mnCenterX1,
36 mnCenterY1,
37 getShearX(),
38 getRotation()));
40 return drawinglayer::primitive2d::Primitive2DContainer { aPrimitive };
42 else
44 const drawinglayer::primitive2d::Primitive2DReference aPrimitive(
45 new drawinglayer::primitive2d::OverlayBitmapExPrimitive(
46 maBitmapEx2,
47 getBasePosition(),
48 mnCenterX2,
49 mnCenterY2,
50 getShearX(),
51 getRotation()));
53 return drawinglayer::primitive2d::Primitive2DContainer { aPrimitive };
57 OverlayAnimatedBitmapEx::OverlayAnimatedBitmapEx(
58 const basegfx::B2DPoint& rBasePos,
59 const BitmapEx& rBitmapEx1,
60 const BitmapEx& rBitmapEx2,
61 sal_uInt64 nBlinkTime,
62 sal_uInt16 nCenX1,
63 sal_uInt16 nCenY1,
64 sal_uInt16 nCenX2,
65 sal_uInt16 nCenY2,
66 double fShearX,
67 double fRotation)
68 : OverlayObjectWithBasePosition(rBasePos, COL_WHITE),
69 maBitmapEx1(rBitmapEx1),
70 maBitmapEx2(rBitmapEx2),
71 mnCenterX1(nCenX1), mnCenterY1(nCenY1),
72 mnCenterX2(nCenX2), mnCenterY2(nCenY2),
73 mnBlinkTime(impCheckBlinkTimeValueRange(nBlinkTime)),
74 mfShearX(fShearX),
75 mfRotation(fRotation),
76 mbOverlayState(false)
78 // set AllowsAnimation flag to mark this object as animation capable
79 mbAllowsAnimation = true;
82 OverlayAnimatedBitmapEx::~OverlayAnimatedBitmapEx()
86 void OverlayAnimatedBitmapEx::Trigger(sal_uInt32 nTime)
88 if(!getOverlayManager())
89 return;
91 // #i53216# produce event after nTime + x
92 SetTime(nTime + mnBlinkTime);
94 // switch state
95 if(mbOverlayState)
97 mbOverlayState = false;
99 else
101 mbOverlayState = true;
104 // re-insert me as event
105 getOverlayManager()->InsertEvent(*this);
107 // register change (after change)
108 objectChange();
111 } // end of namespace
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */