merge the formfield patch from ooo-build
[ooovba.git] / goodies / source / inv / expl.cxx
blob48f1be6c809b0205a01be83a691ae67682f51398
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: expl.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_goodies.hxx"
33 #include "expl.hxx"
34 #include "shapes.hxx"
35 #include "invader.hrc"
36 #include <vcl/outdev.hxx>
38 Explosion::Explosion(ResMgr* pRes) :
39 ExplListe(0,1),
40 pExpl1(0L),
41 pExpl2(0L),
42 pExpl3(0L)
44 pExpl1 = ImplLoadImage( EXPLOS1, pRes );
45 pExpl2 = ImplLoadImage( EXPLOS2, pRes );
46 pExpl3 = ImplLoadImage( EXPLOS3, pRes );
49 Explosion::~Explosion()
51 delete pExpl1;
52 delete pExpl2;
53 delete pExpl3;
56 void Explosion::Paint(OutputDevice& rDev)
58 unsigned long i;
59 for( i = 0; i < Count(); i++ )
61 switch(GetMode(i))
63 case EXPL1:
64 rDev.DrawImage(GetPoint(i),*pExpl1);
65 SetMode(i,EXPL2);
66 break;
67 case EXPL2:
68 rDev.DrawImage(GetPoint(i),*pExpl2);
69 SetMode(i,EXPL3);
70 break;
71 case EXPL3:
72 rDev.DrawImage(GetPoint(i),*pExpl3);
73 SetMode(i,EXPL4);
74 break;
75 case EXPL4:
76 rDev.DrawImage(GetPoint(i),*pExpl2);
77 SetMode(i,EXPL5);
78 break;
79 case EXPL5:
80 rDev.DrawImage(GetPoint(i),*pExpl3);
81 SetMode(i,EXPL6);
82 break;
83 case EXPL6:
84 rDev.DrawImage(GetPoint(i),*pExpl2);
85 SetMode(i,EXPL7);
86 break;
87 case EXPL7:
88 rDev.DrawImage(GetPoint(i),*pExpl1);
89 SetMode(i,EXPLNONE);
90 break;
91 case EXPLNONE:
92 SetMode(i,EXPLDEL);
93 break;
94 case EXPL8:
95 break;
96 case EXPLDEL:
97 break;
101 // RemoveExpl();
104 BOOL Explosion::RemoveExpl()
106 Expl_Impl* pWork;
108 for(long i=Count()-1; i >= 0; i--)
110 if(GetMode(i) == EXPLDEL)
112 pWork = GetObject(i);
113 Remove(pWork);
114 delete pWork;
118 if(Count())
119 return FALSE;
120 else
121 return TRUE;
124 void Explosion::ClearAll()
126 unsigned long i;
127 for( i = 0; i < Count(); i++ )
128 delete GetObject(i);
130 Clear();
133 void Explosion::InsertExpl(Point& rPoint)
135 Expl_Impl* pWork = new Expl_Impl();
137 pWork->aPos = rPoint;
138 pWork->eMode = EXPL1;
139 Insert(pWork);