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 <sal/types.h>
22 #include <cppuhelper/compbase.hxx>
23 #include <cppuhelper/basemutex.hxx>
24 #include <comphelper/make_shared_from_uno.hxx>
26 #include <basegfx/matrix/b2dhommatrix.hxx>
27 #include <basegfx/range/b1drange.hxx>
28 #include <basegfx/polygon/b2dpolypolygon.hxx>
32 #include <com/sun/star/presentation/XSlideShowView.hpp>
38 namespace target
= slideshow::internal
;
39 using namespace ::com::sun::star
;
41 // our test view subject
42 typedef ::cppu::WeakComponentImplHelper
< presentation::XSlideShowView
> ViewBase
;
46 class ImplTestView
: public TestView
,
47 private cppu::BaseMutex
,
50 mutable std::vector
<std::pair
<basegfx::B2DVector
,double> > maCreatedSprites
;
51 mutable std::vector
<TestViewSharedPtr
> maViewLayers
;
52 basegfx::B2DRange maBounds
;
53 basegfx::B1DRange maPriority
;
67 mbIsClipEmptied(false),
73 virtual uno::Reference
< rendering::XSpriteCanvas
> SAL_CALL
getCanvas( ) override
75 return uno::Reference
< rendering::XSpriteCanvas
>();
78 virtual void SAL_CALL
clear( ) override
82 virtual geometry::AffineMatrix2D SAL_CALL
getTransformation( ) override
84 return geometry::AffineMatrix2D();
87 virtual ::css::geometry::IntegerSize2D SAL_CALL
getTranslationOffset() override
89 return geometry::IntegerSize2D();
92 virtual geometry::IntegerSize2D
getTranslationOffset() const override
94 return geometry::IntegerSize2D();
97 virtual void SAL_CALL
addTransformationChangedListener( const uno::Reference
< util::XModifyListener
>& ) override
101 virtual void SAL_CALL
removeTransformationChangedListener( const uno::Reference
< util::XModifyListener
>& ) override
105 virtual void SAL_CALL
addPaintListener( const uno::Reference
< awt::XPaintListener
>& ) override
109 virtual void SAL_CALL
removePaintListener( const uno::Reference
< awt::XPaintListener
>& ) override
113 virtual void SAL_CALL
addMouseListener( const uno::Reference
< awt::XMouseListener
>& ) override
117 virtual void SAL_CALL
removeMouseListener( const uno::Reference
< awt::XMouseListener
>& ) override
121 virtual void SAL_CALL
addMouseMotionListener( const uno::Reference
< awt::XMouseMotionListener
>& ) override
125 virtual void SAL_CALL
removeMouseMotionListener( const uno::Reference
< awt::XMouseMotionListener
>& ) override
129 virtual void SAL_CALL
setMouseCursor( ::sal_Int16
) override
133 virtual awt::Rectangle SAL_CALL
getCanvasArea( ) override
135 return awt::Rectangle(0,0,100,100);
138 virtual basegfx::B2DRange
getBounds() const override
143 virtual std::vector
<std::shared_ptr
<TestView
> > getViewLayers() const override
149 virtual bool isOnView(target::ViewSharedPtr
const& /*rView*/) const override
154 virtual ::cppcanvas::CanvasSharedPtr
getCanvas() const override
156 return ::cppcanvas::CanvasSharedPtr();
159 virtual ::cppcanvas::CustomSpriteSharedPtr
createSprite( const ::basegfx::B2DSize
& rSpriteSizePixel
,
160 double nPriority
) const override
162 maCreatedSprites
.push_back( std::make_pair(rSpriteSizePixel
,nPriority
) );
164 return ::cppcanvas::CustomSpriteSharedPtr();
167 virtual void setPriority( const basegfx::B1DRange
& rRange
) override
172 virtual ::basegfx::B2DHomMatrix
getTransformation() const override
174 return ::basegfx::B2DHomMatrix();
177 virtual ::basegfx::B2DHomMatrix
getSpriteTransformation() const override
179 return ::basegfx::B2DHomMatrix();
182 virtual void setClip( const ::basegfx::B2DPolyPolygon
& rClip
) override
186 if( rClip
.count() > 0 )
189 else if( !mbIsClipEmptied
)
191 if( rClip
.count() == 0 )
192 mbIsClipEmptied
= true;
194 else if( rClip
.count() > 0 )
197 mbIsClipEmptied
= false;
202 throw std::exception();
206 virtual bool resize( const basegfx::B2DRange
& rArea
) override
208 const bool bRet( maBounds
!= rArea
);
213 virtual target::ViewLayerSharedPtr
createViewLayer(
214 const basegfx::B2DRange
& rLayerBounds
) const override
216 maViewLayers
.push_back( std::make_shared
<ImplTestView
>());
217 maViewLayers
.back()->resize( rLayerBounds
);
219 return maViewLayers
.back();
222 virtual bool updateScreen() const override
224 // misusing updateScreen for state reporting
228 virtual bool paintScreen() const override
230 // misusing updateScreen for state reporting
234 virtual void clear() const override
238 virtual void clearAll() const override
242 virtual void setViewSize( const ::basegfx::B2DSize
& ) override
246 virtual void setCursorShape( sal_Int16
/*nPointerShape*/ ) override
250 virtual uno::Reference
< presentation::XSlideShowView
> getUnoView() const override
252 return uno::Reference
< presentation::XSlideShowView
>( const_cast<ImplTestView
*>(this) );
255 virtual void _dispose() override
260 virtual bool isSoundEnabled() const override
265 virtual void setIsSoundEnabled (const bool /*bValue*/) override
272 TestViewSharedPtr
createTestView()
274 return TestViewSharedPtr(
275 comphelper::make_shared_from_UNO(
276 new ImplTestView()) );
279 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */