1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski // MARKER(update_precomp.py): autogen include statement, do not remove 25*b1cdbd2cSJim Jagielski #include "precompiled_svx.hxx" 26*b1cdbd2cSJim Jagielski #include <svx/sdr/overlay/overlayanimatedbitmapex.hxx> 27*b1cdbd2cSJim Jagielski #include <vcl/salbtype.hxx> 28*b1cdbd2cSJim Jagielski #include <vcl/outdev.hxx> 29*b1cdbd2cSJim Jagielski #include <svx/sdr/overlay/overlaymanager.hxx> 30*b1cdbd2cSJim Jagielski #include <basegfx/matrix/b2dhommatrix.hxx> 31*b1cdbd2cSJim Jagielski #include <svx/sdr/overlay/overlaytools.hxx> 32*b1cdbd2cSJim Jagielski 33*b1cdbd2cSJim Jagielski ////////////////////////////////////////////////////////////////////////////// 34*b1cdbd2cSJim Jagielski 35*b1cdbd2cSJim Jagielski namespace sdr 36*b1cdbd2cSJim Jagielski { 37*b1cdbd2cSJim Jagielski namespace overlay 38*b1cdbd2cSJim Jagielski { createOverlayObjectPrimitive2DSequence()39*b1cdbd2cSJim Jagielski drawinglayer::primitive2d::Primitive2DSequence OverlayAnimatedBitmapEx::createOverlayObjectPrimitive2DSequence() 40*b1cdbd2cSJim Jagielski { 41*b1cdbd2cSJim Jagielski if(mbOverlayState) 42*b1cdbd2cSJim Jagielski { 43*b1cdbd2cSJim Jagielski const drawinglayer::primitive2d::Primitive2DReference aPrimitive( 44*b1cdbd2cSJim Jagielski new drawinglayer::primitive2d::OverlayBitmapExPrimitive( 45*b1cdbd2cSJim Jagielski getBitmapEx1(), 46*b1cdbd2cSJim Jagielski getBasePosition(), 47*b1cdbd2cSJim Jagielski getCenterX1(), 48*b1cdbd2cSJim Jagielski getCenterY1(), 49*b1cdbd2cSJim Jagielski getShearX(), 50*b1cdbd2cSJim Jagielski getRotation())); 51*b1cdbd2cSJim Jagielski 52*b1cdbd2cSJim Jagielski return drawinglayer::primitive2d::Primitive2DSequence(&aPrimitive, 1); 53*b1cdbd2cSJim Jagielski } 54*b1cdbd2cSJim Jagielski else 55*b1cdbd2cSJim Jagielski { 56*b1cdbd2cSJim Jagielski const drawinglayer::primitive2d::Primitive2DReference aPrimitive( 57*b1cdbd2cSJim Jagielski new drawinglayer::primitive2d::OverlayBitmapExPrimitive( 58*b1cdbd2cSJim Jagielski getBitmapEx2(), 59*b1cdbd2cSJim Jagielski getBasePosition(), 60*b1cdbd2cSJim Jagielski getCenterX2(), 61*b1cdbd2cSJim Jagielski getCenterY2(), 62*b1cdbd2cSJim Jagielski getShearX(), 63*b1cdbd2cSJim Jagielski getRotation())); 64*b1cdbd2cSJim Jagielski 65*b1cdbd2cSJim Jagielski return drawinglayer::primitive2d::Primitive2DSequence(&aPrimitive, 1); 66*b1cdbd2cSJim Jagielski } 67*b1cdbd2cSJim Jagielski } 68*b1cdbd2cSJim Jagielski OverlayAnimatedBitmapEx(const basegfx::B2DPoint & rBasePos,const BitmapEx & rBitmapEx1,const BitmapEx & rBitmapEx2,sal_uInt32 nBlinkTime,sal_uInt16 nCenX1,sal_uInt16 nCenY1,sal_uInt16 nCenX2,sal_uInt16 nCenY2,double fShearX,double fRotation)69*b1cdbd2cSJim Jagielski OverlayAnimatedBitmapEx::OverlayAnimatedBitmapEx( 70*b1cdbd2cSJim Jagielski const basegfx::B2DPoint& rBasePos, 71*b1cdbd2cSJim Jagielski const BitmapEx& rBitmapEx1, 72*b1cdbd2cSJim Jagielski const BitmapEx& rBitmapEx2, 73*b1cdbd2cSJim Jagielski sal_uInt32 nBlinkTime, 74*b1cdbd2cSJim Jagielski sal_uInt16 nCenX1, 75*b1cdbd2cSJim Jagielski sal_uInt16 nCenY1, 76*b1cdbd2cSJim Jagielski sal_uInt16 nCenX2, 77*b1cdbd2cSJim Jagielski sal_uInt16 nCenY2, 78*b1cdbd2cSJim Jagielski double fShearX, 79*b1cdbd2cSJim Jagielski double fRotation) 80*b1cdbd2cSJim Jagielski : OverlayObjectWithBasePosition(rBasePos, Color(COL_WHITE)), 81*b1cdbd2cSJim Jagielski maBitmapEx1(rBitmapEx1), 82*b1cdbd2cSJim Jagielski maBitmapEx2(rBitmapEx2), 83*b1cdbd2cSJim Jagielski mnCenterX1(nCenX1), mnCenterY1(nCenY1), 84*b1cdbd2cSJim Jagielski mnCenterX2(nCenX2), mnCenterY2(nCenY2), 85*b1cdbd2cSJim Jagielski mnBlinkTime(nBlinkTime), 86*b1cdbd2cSJim Jagielski mfShearX(fShearX), 87*b1cdbd2cSJim Jagielski mfRotation(fRotation), 88*b1cdbd2cSJim Jagielski mbOverlayState(false) 89*b1cdbd2cSJim Jagielski { 90*b1cdbd2cSJim Jagielski // set AllowsAnimation flag to mark this object as animation capable 91*b1cdbd2cSJim Jagielski mbAllowsAnimation = true; 92*b1cdbd2cSJim Jagielski 93*b1cdbd2cSJim Jagielski // #i53216# check blink time value range 94*b1cdbd2cSJim Jagielski mnBlinkTime = impCheckBlinkTimeValueRange(mnBlinkTime); 95*b1cdbd2cSJim Jagielski } 96*b1cdbd2cSJim Jagielski ~OverlayAnimatedBitmapEx()97*b1cdbd2cSJim Jagielski OverlayAnimatedBitmapEx::~OverlayAnimatedBitmapEx() 98*b1cdbd2cSJim Jagielski { 99*b1cdbd2cSJim Jagielski } 100*b1cdbd2cSJim Jagielski setBitmapEx1(const BitmapEx & rNew)101*b1cdbd2cSJim Jagielski void OverlayAnimatedBitmapEx::setBitmapEx1(const BitmapEx& rNew) 102*b1cdbd2cSJim Jagielski { 103*b1cdbd2cSJim Jagielski if(rNew != maBitmapEx1) 104*b1cdbd2cSJim Jagielski { 105*b1cdbd2cSJim Jagielski // remember new Bitmap 106*b1cdbd2cSJim Jagielski maBitmapEx1 = rNew; 107*b1cdbd2cSJim Jagielski 108*b1cdbd2cSJim Jagielski // register change (after change) 109*b1cdbd2cSJim Jagielski objectChange(); 110*b1cdbd2cSJim Jagielski } 111*b1cdbd2cSJim Jagielski } 112*b1cdbd2cSJim Jagielski setBitmapEx2(const BitmapEx & rNew)113*b1cdbd2cSJim Jagielski void OverlayAnimatedBitmapEx::setBitmapEx2(const BitmapEx& rNew) 114*b1cdbd2cSJim Jagielski { 115*b1cdbd2cSJim Jagielski if(rNew != maBitmapEx2) 116*b1cdbd2cSJim Jagielski { 117*b1cdbd2cSJim Jagielski // remember new Bitmap 118*b1cdbd2cSJim Jagielski maBitmapEx2 = rNew; 119*b1cdbd2cSJim Jagielski 120*b1cdbd2cSJim Jagielski // register change (after change) 121*b1cdbd2cSJim Jagielski objectChange(); 122*b1cdbd2cSJim Jagielski } 123*b1cdbd2cSJim Jagielski } 124*b1cdbd2cSJim Jagielski setCenterXY1(sal_uInt16 nNewX,sal_uInt16 nNewY)125*b1cdbd2cSJim Jagielski void OverlayAnimatedBitmapEx::setCenterXY1(sal_uInt16 nNewX, sal_uInt16 nNewY) 126*b1cdbd2cSJim Jagielski { 127*b1cdbd2cSJim Jagielski if(nNewX != mnCenterX1 || nNewY != mnCenterY1) 128*b1cdbd2cSJim Jagielski { 129*b1cdbd2cSJim Jagielski // remember new values 130*b1cdbd2cSJim Jagielski if(nNewX != mnCenterX1) 131*b1cdbd2cSJim Jagielski { 132*b1cdbd2cSJim Jagielski mnCenterX1 = nNewX; 133*b1cdbd2cSJim Jagielski } 134*b1cdbd2cSJim Jagielski 135*b1cdbd2cSJim Jagielski if(nNewY != mnCenterY1) 136*b1cdbd2cSJim Jagielski { 137*b1cdbd2cSJim Jagielski mnCenterY1 = nNewY; 138*b1cdbd2cSJim Jagielski } 139*b1cdbd2cSJim Jagielski 140*b1cdbd2cSJim Jagielski // register change (after change) 141*b1cdbd2cSJim Jagielski objectChange(); 142*b1cdbd2cSJim Jagielski } 143*b1cdbd2cSJim Jagielski } 144*b1cdbd2cSJim Jagielski setCenterXY2(sal_uInt16 nNewX,sal_uInt16 nNewY)145*b1cdbd2cSJim Jagielski void OverlayAnimatedBitmapEx::setCenterXY2(sal_uInt16 nNewX, sal_uInt16 nNewY) 146*b1cdbd2cSJim Jagielski { 147*b1cdbd2cSJim Jagielski if(nNewX != mnCenterX2 || nNewY != mnCenterY2) 148*b1cdbd2cSJim Jagielski { 149*b1cdbd2cSJim Jagielski // remember new values 150*b1cdbd2cSJim Jagielski if(nNewX != mnCenterX2) 151*b1cdbd2cSJim Jagielski { 152*b1cdbd2cSJim Jagielski mnCenterX2 = nNewX; 153*b1cdbd2cSJim Jagielski } 154*b1cdbd2cSJim Jagielski 155*b1cdbd2cSJim Jagielski if(nNewY != mnCenterY2) 156*b1cdbd2cSJim Jagielski { 157*b1cdbd2cSJim Jagielski mnCenterY2 = nNewY; 158*b1cdbd2cSJim Jagielski } 159*b1cdbd2cSJim Jagielski 160*b1cdbd2cSJim Jagielski // register change (after change) 161*b1cdbd2cSJim Jagielski objectChange(); 162*b1cdbd2cSJim Jagielski } 163*b1cdbd2cSJim Jagielski } 164*b1cdbd2cSJim Jagielski setBlinkTime(sal_uInt32 nNew)165*b1cdbd2cSJim Jagielski void OverlayAnimatedBitmapEx::setBlinkTime(sal_uInt32 nNew) 166*b1cdbd2cSJim Jagielski { 167*b1cdbd2cSJim Jagielski if(mnBlinkTime != nNew) 168*b1cdbd2cSJim Jagielski { 169*b1cdbd2cSJim Jagielski // remember new value 170*b1cdbd2cSJim Jagielski mnBlinkTime = nNew; 171*b1cdbd2cSJim Jagielski 172*b1cdbd2cSJim Jagielski // #i53216# check blink time value range 173*b1cdbd2cSJim Jagielski mnBlinkTime = impCheckBlinkTimeValueRange(mnBlinkTime); 174*b1cdbd2cSJim Jagielski 175*b1cdbd2cSJim Jagielski // register change (after change) 176*b1cdbd2cSJim Jagielski objectChange(); 177*b1cdbd2cSJim Jagielski } 178*b1cdbd2cSJim Jagielski } 179*b1cdbd2cSJim Jagielski Trigger(sal_uInt32 nTime)180*b1cdbd2cSJim Jagielski void OverlayAnimatedBitmapEx::Trigger(sal_uInt32 nTime) 181*b1cdbd2cSJim Jagielski { 182*b1cdbd2cSJim Jagielski if(getOverlayManager()) 183*b1cdbd2cSJim Jagielski { 184*b1cdbd2cSJim Jagielski // #i53216# produce event after nTime + x 185*b1cdbd2cSJim Jagielski SetTime(nTime + mnBlinkTime); 186*b1cdbd2cSJim Jagielski 187*b1cdbd2cSJim Jagielski // switch state 188*b1cdbd2cSJim Jagielski if(mbOverlayState) 189*b1cdbd2cSJim Jagielski { 190*b1cdbd2cSJim Jagielski mbOverlayState = false; 191*b1cdbd2cSJim Jagielski } 192*b1cdbd2cSJim Jagielski else 193*b1cdbd2cSJim Jagielski { 194*b1cdbd2cSJim Jagielski mbOverlayState = true; 195*b1cdbd2cSJim Jagielski } 196*b1cdbd2cSJim Jagielski 197*b1cdbd2cSJim Jagielski // re-insert me as event 198*b1cdbd2cSJim Jagielski getOverlayManager()->InsertEvent(this); 199*b1cdbd2cSJim Jagielski 200*b1cdbd2cSJim Jagielski // register change (after change) 201*b1cdbd2cSJim Jagielski objectChange(); 202*b1cdbd2cSJim Jagielski } 203*b1cdbd2cSJim Jagielski } 204*b1cdbd2cSJim Jagielski } // end of namespace overlay 205*b1cdbd2cSJim Jagielski } // end of namespace sdr 206*b1cdbd2cSJim Jagielski 207*b1cdbd2cSJim Jagielski ////////////////////////////////////////////////////////////////////////////// 208*b1cdbd2cSJim Jagielski // eof 209