/src/libreoffice/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #include <svx/sdr/overlay/overlayanimatedbitmapex.hxx> |
21 | | #include <svx/sdr/overlay/overlaymanager.hxx> |
22 | | #include <sdr/overlay/overlaytools.hxx> |
23 | | |
24 | | |
25 | | namespace sdr::overlay |
26 | | { |
27 | | drawinglayer::primitive2d::Primitive2DContainer OverlayAnimatedBitmapEx::createOverlayObjectPrimitive2DSequence() |
28 | 0 | { |
29 | 0 | if(mbOverlayState) |
30 | 0 | { |
31 | 0 | const drawinglayer::primitive2d::Primitive2DReference aPrimitive( |
32 | 0 | new drawinglayer::primitive2d::OverlayBitmapExPrimitive( |
33 | 0 | maBitmap1, |
34 | 0 | getBasePosition(), |
35 | 0 | mnCenterX1, |
36 | 0 | mnCenterY1, |
37 | 0 | getShearX(), |
38 | 0 | getRotation())); |
39 | |
|
40 | 0 | return drawinglayer::primitive2d::Primitive2DContainer { aPrimitive }; |
41 | 0 | } |
42 | 0 | else |
43 | 0 | { |
44 | 0 | const drawinglayer::primitive2d::Primitive2DReference aPrimitive( |
45 | 0 | new drawinglayer::primitive2d::OverlayBitmapExPrimitive( |
46 | 0 | maBitmap2, |
47 | 0 | getBasePosition(), |
48 | 0 | mnCenterX2, |
49 | 0 | mnCenterY2, |
50 | 0 | getShearX(), |
51 | 0 | getRotation())); |
52 | |
|
53 | 0 | return drawinglayer::primitive2d::Primitive2DContainer { aPrimitive }; |
54 | 0 | } |
55 | 0 | } |
56 | | |
57 | | OverlayAnimatedBitmapEx::OverlayAnimatedBitmapEx( |
58 | | const basegfx::B2DPoint& rBasePos, |
59 | | const Bitmap& rBitmap1, |
60 | | const Bitmap& rBitmap2, |
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 | 0 | : OverlayObjectWithBasePosition(rBasePos, COL_WHITE), |
69 | 0 | maBitmap1(rBitmap1), |
70 | 0 | maBitmap2(rBitmap2), |
71 | 0 | mnCenterX1(nCenX1), mnCenterY1(nCenY1), |
72 | 0 | mnCenterX2(nCenX2), mnCenterY2(nCenY2), |
73 | 0 | mnBlinkTime(impCheckBlinkTimeValueRange(nBlinkTime)), |
74 | 0 | mfShearX(fShearX), |
75 | 0 | mfRotation(fRotation), |
76 | 0 | mbOverlayState(false) |
77 | 0 | { |
78 | | // set AllowsAnimation flag to mark this object as animation capable |
79 | 0 | mbAllowsAnimation = true; |
80 | 0 | } |
81 | | |
82 | | OverlayAnimatedBitmapEx::~OverlayAnimatedBitmapEx() |
83 | 0 | { |
84 | 0 | } |
85 | | |
86 | | void OverlayAnimatedBitmapEx::Trigger(sal_uInt32 nTime) |
87 | 0 | { |
88 | 0 | if(!getOverlayManager()) |
89 | 0 | return; |
90 | | |
91 | | // #i53216# produce event after nTime + x |
92 | 0 | SetTime(nTime + mnBlinkTime); |
93 | | |
94 | | // switch state |
95 | 0 | if(mbOverlayState) |
96 | 0 | { |
97 | 0 | mbOverlayState = false; |
98 | 0 | } |
99 | 0 | else |
100 | 0 | { |
101 | 0 | mbOverlayState = true; |
102 | 0 | } |
103 | | |
104 | | // re-insert me as event |
105 | 0 | getOverlayManager()->InsertEvent(*this); |
106 | | |
107 | | // register change (after change) |
108 | 0 | objectChange(); |
109 | 0 | } |
110 | | |
111 | | } // end of namespace |
112 | | |
113 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |