1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PresenterSprite.cxx,v $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 // MARKER(update_precomp.py): autogen include statement, do not remove
33 #include "precompiled_sdext.hxx"
35 #include "PresenterSprite.hxx"
37 #include <com/sun/star/lang/XComponent.hpp>
38 #include <com/sun/star/rendering/CompositeOperation.hpp>
39 #include <com/sun/star/rendering/RenderState.hpp>
40 #include <com/sun/star/rendering/ViewState.hpp>
42 using namespace ::com::sun::star
;
43 using ::com::sun::star::uno::Reference
;
44 using ::com::sun::star::uno::UNO_QUERY
;
46 namespace sdext
{ namespace presenter
{
48 PresenterSprite::PresenterSprite (void)
53 maTransform(1,0,0, 0,1,0),
63 PresenterSprite::~PresenterSprite (void)
68 Reference
<lang::XComponent
> xComponent (mxSprite
, UNO_QUERY
);
70 xComponent
->dispose();
78 void PresenterSprite::SetFactory (
79 const ::css::uno::Reference
<css::rendering::XSpriteCanvas
>& rxSpriteFactory
)
81 if (mxSpriteFactory
!= rxSpriteFactory
)
84 mxSpriteFactory
= rxSpriteFactory
;
93 ::css::uno::Reference
<css::rendering::XCanvas
> PresenterSprite::GetCanvas (void)
97 return mxSprite
->getContentCanvas();
105 void PresenterSprite::Show (void)
117 void PresenterSprite::Hide (void)
127 bool PresenterSprite::IsVisible (void) const
135 void PresenterSprite::SetPriority (const double nPriority
)
137 mnPriority
= nPriority
;
139 mxSprite
->setPriority(mnPriority
);
145 double PresenterSprite::GetPriority (void) const
153 void PresenterSprite::Resize (const css::geometry::RealSize2D
& rSize
)
165 css::geometry::RealSize2D
PresenterSprite::GetSize (void) const
173 void PresenterSprite::MoveTo (const css::geometry::RealPoint2D
& rLocation
)
175 maLocation
= rLocation
;
179 rendering::ViewState(
180 geometry::AffineMatrix2D(1,0,0, 0,1,0),
182 rendering::RenderState(
183 geometry::AffineMatrix2D(1,0,0, 0,1,0),
185 uno::Sequence
<double>(4),
186 rendering::CompositeOperation::SOURCE
)
193 css::geometry::RealPoint2D
PresenterSprite::GetLocation (void) const
201 void PresenterSprite::Transform (const css::geometry::AffineMatrix2D
& rTransform
)
203 maTransform
= rTransform
;
205 mxSprite
->transform(maTransform
);
211 css::geometry::AffineMatrix2D
PresenterSprite::GetTransform (void) const
219 void PresenterSprite::SetAlpha (const double nAlpha
)
223 mxSprite
->setAlpha(mnAlpha
);
229 double PresenterSprite::GetAlpha (void) const
237 void PresenterSprite::Update (void)
239 if (mxSpriteFactory
.is())
240 mxSpriteFactory
->updateScreen(sal_False
);
246 void PresenterSprite::ProvideSprite (void)
249 && mxSpriteFactory
.is()
253 mxSprite
= mxSpriteFactory
->createCustomSprite(maSize
);
256 mxSprite
->transform(maTransform
);
257 mxSprite
->move(maLocation
,
258 rendering::ViewState(
259 geometry::AffineMatrix2D(1,0,0, 0,1,0),
261 rendering::RenderState(
262 geometry::AffineMatrix2D(1,0,0, 0,1,0),
264 uno::Sequence
<double>(4),
265 rendering::CompositeOperation::SOURCE
)
267 mxSprite
->setAlpha(mnAlpha
);
268 mxSprite
->setPriority(mnPriority
);
278 void PresenterSprite::DisposeSprite (void)
283 Reference
<lang::XComponent
> xComponent (mxSprite
, UNO_QUERY
);
285 xComponent
->dispose();
293 } } //end of namespace sdext::presenter