1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "PresenterSprite.hxx"
22 #include <com/sun/star/lang/XComponent.hpp>
23 #include <com/sun/star/rendering/CompositeOperation.hpp>
24 #include <com/sun/star/rendering/RenderState.hpp>
25 #include <com/sun/star/rendering/ViewState.hpp>
27 using namespace ::com::sun::star
;
28 using ::com::sun::star::uno::Reference
;
29 using ::com::sun::star::uno::UNO_QUERY
;
31 namespace sdext::presenter
{
33 PresenterSprite::PresenterSprite()
40 PresenterSprite::~PresenterSprite()
45 Reference
<lang::XComponent
> xComponent (mxSprite
, UNO_QUERY
);
47 xComponent
->dispose();
52 void PresenterSprite::SetFactory (
53 const css::uno::Reference
<css::rendering::XSpriteCanvas
>& rxSpriteFactory
)
55 if (mxSpriteFactory
!= rxSpriteFactory
)
58 mxSpriteFactory
= rxSpriteFactory
;
64 css::uno::Reference
<css::rendering::XCanvas
> PresenterSprite::GetCanvas()
68 return mxSprite
->getContentCanvas();
73 void PresenterSprite::Show()
82 void PresenterSprite::Hide()
89 void PresenterSprite::Resize (const css::geometry::RealSize2D
& rSize
)
98 void PresenterSprite::MoveTo (const css::geometry::RealPoint2D
& rLocation
)
100 maLocation
= rLocation
;
104 rendering::ViewState(
105 geometry::AffineMatrix2D(1,0,0, 0,1,0),
107 rendering::RenderState(
108 geometry::AffineMatrix2D(1,0,0, 0,1,0),
110 uno::Sequence
<double>(4),
111 rendering::CompositeOperation::SOURCE
)
115 void PresenterSprite::Update()
117 if (mxSpriteFactory
.is())
118 mxSpriteFactory
->updateScreen(false);
121 void PresenterSprite::ProvideSprite()
123 if ( !(! mxSprite
.is()
124 && mxSpriteFactory
.is()
129 mxSprite
= mxSpriteFactory
->createCustomSprite(maSize
);
133 mxSprite
->move(maLocation
,
134 rendering::ViewState(
135 geometry::AffineMatrix2D(1,0,0, 0,1,0),
137 rendering::RenderState(
138 geometry::AffineMatrix2D(1,0,0, 0,1,0),
140 uno::Sequence
<double>(4),
141 rendering::CompositeOperation::SOURCE
)
143 mxSprite
->setAlpha(1.0);
144 mxSprite
->setPriority(0);
149 void PresenterSprite::DisposeSprite()
154 Reference
<lang::XComponent
> xComponent (mxSprite
, UNO_QUERY
);
156 xComponent
->dispose();
161 } //end of namespace sdext::presenter
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */