Avoid potential negative array index access to cached text.
[LibreOffice.git] / toolkit / inc / awt / animatedimagespeer.hxx
blob839e249b3ff882aca1d5ac452bf0bff056588ab8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <toolkit/awt/vclxwindow.hxx>
23 #include <com/sun/star/container/XContainerListener.hpp>
25 #include <com/sun/star/awt/XAnimatedImages.hpp>
26 #include <com/sun/star/awt/XAnimation.hpp>
27 #include <com/sun/star/graphic/XGraphic.hpp>
28 #include <com/sun/star/util/XModifyListener.hpp>
30 #include <cppuhelper/implbase.hxx>
32 namespace toolkit
36 //= AnimatedImagesPeer
38 struct AnimatedImagesPeer_Data;
39 typedef cppu::ImplInheritanceHelper< VCLXWindow,
40 css::awt::XAnimation,
41 css::container::XContainerListener,
42 css::util::XModifyListener
43 > AnimatedImagesPeer_Base;
45 class AnimatedImagesPeer final : public AnimatedImagesPeer_Base
47 public:
48 AnimatedImagesPeer();
50 private:
51 virtual ~AnimatedImagesPeer() override;
53 public:
54 // XAnimation
55 virtual void SAL_CALL startAnimation( ) override;
56 virtual void SAL_CALL stopAnimation( ) override;
57 virtual sal_Bool SAL_CALL isAnimationRunning( ) override;
59 // VclWindowPeer
60 virtual void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override;
61 virtual css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override;
63 // XContainerListener
64 virtual void SAL_CALL elementInserted( const css::container::ContainerEvent& Event ) override;
65 virtual void SAL_CALL elementRemoved( const css::container::ContainerEvent& Event ) override;
66 virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override;
68 // XEventListener
69 virtual void SAL_CALL disposing( const css::lang::EventObject& i_event ) override;
71 // XModifyListener
72 virtual void SAL_CALL modified( const css::lang::EventObject& i_event ) override;
74 // XComponent
75 void SAL_CALL dispose( ) override;
77 struct CachedImage
79 OUString sImageURL;
80 mutable css::uno::Reference< css::graphic::XGraphic > xGraphic;
83 private:
84 void ProcessWindowEvent( const VclWindowEvent& i_windowEvent ) override;
86 /** updates our images with the ones from the given XAnimatedImages component
88 void impl_updateImages_nolck( const css::uno::Reference< css::uno::XInterface >& i_animatedImages );
90 AnimatedImagesPeer(const AnimatedImagesPeer&) = delete;
91 AnimatedImagesPeer& operator=(const AnimatedImagesPeer&) = delete;
93 void updateImageList_nothrow();
94 void updateImageList_nothrow( const css::uno::Reference< css::awt::XAnimatedImages >& i_images );
96 std::vector< std::vector< CachedImage > > maCachedImageSets;
100 } // namespace toolkit
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */