1*0a1e2f0eSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*0a1e2f0eSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*0a1e2f0eSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*0a1e2f0eSAndrew Rist * distributed with this work for additional information 6*0a1e2f0eSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*0a1e2f0eSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*0a1e2f0eSAndrew Rist * "License"); you may not use this file except in compliance 9*0a1e2f0eSAndrew Rist * with the License. You may obtain a copy of the License at 10*0a1e2f0eSAndrew Rist * 11*0a1e2f0eSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*0a1e2f0eSAndrew Rist * 13*0a1e2f0eSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*0a1e2f0eSAndrew Rist * software distributed under the License is distributed on an 15*0a1e2f0eSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*0a1e2f0eSAndrew Rist * KIND, either express or implied. See the License for the 17*0a1e2f0eSAndrew Rist * specific language governing permissions and limitations 18*0a1e2f0eSAndrew Rist * under the License. 19*0a1e2f0eSAndrew Rist * 20*0a1e2f0eSAndrew Rist *************************************************************/ 21*0a1e2f0eSAndrew Rist 22*0a1e2f0eSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 25cdf0e10cSrcweir #include <com/sun/star/uno/Exception.hpp> 26cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h> 27cdf0e10cSrcweir #include <com/sun/star/lang/XComponent.hpp> 28cdf0e10cSrcweir #include <com/sun/star/task/XStatusIndicator.hpp> 29cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 30cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx> 31cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h> 32cdf0e10cSrcweir #include <vcl/introwin.hxx> 33cdf0e10cSrcweir #include <vcl/bitmapex.hxx> 34cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp> 35cdf0e10cSrcweir #include <osl/mutex.hxx> 36cdf0e10cSrcweir #include <vcl/virdev.hxx> 37cdf0e10cSrcweir 38cdf0e10cSrcweir 39cdf0e10cSrcweir using namespace ::rtl; 40cdf0e10cSrcweir using namespace ::com::sun::star::uno; 41cdf0e10cSrcweir using namespace ::com::sun::star::lang; 42cdf0e10cSrcweir using namespace ::com::sun::star::task; 43cdf0e10cSrcweir 44cdf0e10cSrcweir namespace desktop { 45cdf0e10cSrcweir 46cdf0e10cSrcweir class SplashScreen 47cdf0e10cSrcweir : public ::cppu::WeakImplHelper2< XStatusIndicator, XInitialization > 48cdf0e10cSrcweir , public IntroWindow 49cdf0e10cSrcweir { 50cdf0e10cSrcweir private: 51cdf0e10cSrcweir struct FullScreenProgressRatioValue 52cdf0e10cSrcweir { 53cdf0e10cSrcweir double _fXRelPos; 54cdf0e10cSrcweir double _fYRelPos; 55cdf0e10cSrcweir double _fRelWidth; 56cdf0e10cSrcweir double _fRelHeight; 57cdf0e10cSrcweir }; 58cdf0e10cSrcweir enum BitmapMode { BM_FULLSCREEN, BM_DEFAULTMODE }; 59cdf0e10cSrcweir 60cdf0e10cSrcweir // don't allow anybody but ourselves to create instances of this class 61cdf0e10cSrcweir SplashScreen(const SplashScreen&); 62cdf0e10cSrcweir SplashScreen(void); 63cdf0e10cSrcweir SplashScreen operator =(const SplashScreen&); 64cdf0e10cSrcweir 65cdf0e10cSrcweir SplashScreen(const Reference< XMultiServiceFactory >& xFactory); 66cdf0e10cSrcweir 67cdf0e10cSrcweir DECL_LINK( AppEventListenerHdl, VclWindowEvent * ); 68cdf0e10cSrcweir virtual ~SplashScreen(); 69cdf0e10cSrcweir void loadConfig(); 70cdf0e10cSrcweir void initBitmap(); 71cdf0e10cSrcweir void updateStatus(); 72cdf0e10cSrcweir bool findScreenBitmap(rtl::OUString const & path); 73cdf0e10cSrcweir bool findAppBitmap(rtl::OUString const & path); 74cdf0e10cSrcweir bool findBitmap(rtl::OUString const & path); 75cdf0e10cSrcweir bool loadBitmap( 76cdf0e10cSrcweir rtl::OUString const & path, const rtl::OUString &rBmpFileName ); 77cdf0e10cSrcweir void determineProgressRatioValues( double& rXRelPos, double& rYRelPos, double& rRelWidth, double& rRelHeight ); 78cdf0e10cSrcweir 79cdf0e10cSrcweir static SplashScreen *_pINSTANCE; 80cdf0e10cSrcweir 81cdf0e10cSrcweir static osl::Mutex _aMutex; 82cdf0e10cSrcweir Reference< XMultiServiceFactory > _rFactory; 83cdf0e10cSrcweir 84cdf0e10cSrcweir VirtualDevice _vdev; 85cdf0e10cSrcweir BitmapEx _aIntroBmp; 86cdf0e10cSrcweir Color _cProgressFrameColor; 87cdf0e10cSrcweir Color _cProgressBarColor; 88cdf0e10cSrcweir bool _bNativeProgress; 89cdf0e10cSrcweir OUString _sAppName; 90cdf0e10cSrcweir OUString _sProgressText; 91cdf0e10cSrcweir std::vector< FullScreenProgressRatioValue > _sFullScreenProgressRatioValues; 92cdf0e10cSrcweir 93cdf0e10cSrcweir sal_Int32 _iMax; 94cdf0e10cSrcweir sal_Int32 _iProgress; 95cdf0e10cSrcweir BitmapMode _eBitmapMode; 96cdf0e10cSrcweir sal_Bool _bPaintBitmap; 97cdf0e10cSrcweir sal_Bool _bPaintProgress; 98cdf0e10cSrcweir sal_Bool _bVisible; 99cdf0e10cSrcweir sal_Bool _bShowLogo; 100cdf0e10cSrcweir sal_Bool _bFullScreenSplash; 101cdf0e10cSrcweir sal_Bool _bProgressEnd; 102cdf0e10cSrcweir long _height, _width, _tlx, _tly, _barwidth; 103cdf0e10cSrcweir long _barheight, _barspace; 104cdf0e10cSrcweir double _fXPos, _fYPos; 105cdf0e10cSrcweir double _fWidth, _fHeight; 106cdf0e10cSrcweir const long _xoffset, _yoffset; 107cdf0e10cSrcweir 108cdf0e10cSrcweir public: 109cdf0e10cSrcweir static const char* interfaces[]; 110cdf0e10cSrcweir static const sal_Char *serviceName; 111cdf0e10cSrcweir static const sal_Char *implementationName; 112cdf0e10cSrcweir static const sal_Char *supportedServiceNames[]; 113cdf0e10cSrcweir 114cdf0e10cSrcweir static Reference< XInterface > getInstance(const Reference < XMultiServiceFactory >& xFactory); 115cdf0e10cSrcweir 116cdf0e10cSrcweir // XStatusIndicator 117cdf0e10cSrcweir virtual void SAL_CALL end() throw ( RuntimeException ); 118cdf0e10cSrcweir virtual void SAL_CALL reset() throw ( RuntimeException ); 119cdf0e10cSrcweir virtual void SAL_CALL setText(const OUString& aText) throw ( RuntimeException ); 120cdf0e10cSrcweir virtual void SAL_CALL setValue(sal_Int32 nValue) throw ( RuntimeException ); 121cdf0e10cSrcweir virtual void SAL_CALL start(const OUString& aText, sal_Int32 nRange) throw ( RuntimeException ); 122cdf0e10cSrcweir 123cdf0e10cSrcweir // XInitialize 124cdf0e10cSrcweir virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& aArguments ) 125cdf0e10cSrcweir throw ( RuntimeException ); 126cdf0e10cSrcweir 127cdf0e10cSrcweir // workwindow 128cdf0e10cSrcweir virtual void Paint( const Rectangle& ); 129cdf0e10cSrcweir 130cdf0e10cSrcweir }; 131cdf0e10cSrcweir 132cdf0e10cSrcweir } 133