1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #include <com/sun/star/lang/XServiceInfo.hpp> 29 #include <com/sun/star/uno/Exception.hpp> 30 #include <com/sun/star/uno/Reference.h> 31 #include <com/sun/star/lang/XComponent.hpp> 32 #include <com/sun/star/task/XStatusIndicator.hpp> 33 #include <com/sun/star/lang/XInitialization.hpp> 34 #include <cppuhelper/implbase2.hxx> 35 #include <cppuhelper/interfacecontainer.h> 36 #include <vcl/introwin.hxx> 37 #include <vcl/bitmapex.hxx> 38 #include <com/sun/star/lang/XSingleServiceFactory.hpp> 39 #include <osl/mutex.hxx> 40 #include <vcl/virdev.hxx> 41 42 43 using namespace ::rtl; 44 using namespace ::com::sun::star::uno; 45 using namespace ::com::sun::star::lang; 46 using namespace ::com::sun::star::task; 47 48 namespace desktop { 49 50 class SplashScreen 51 : public ::cppu::WeakImplHelper2< XStatusIndicator, XInitialization > 52 , public IntroWindow 53 { 54 private: 55 struct FullScreenProgressRatioValue 56 { 57 double _fXRelPos; 58 double _fYRelPos; 59 double _fRelWidth; 60 double _fRelHeight; 61 }; 62 enum BitmapMode { BM_FULLSCREEN, BM_DEFAULTMODE }; 63 64 // don't allow anybody but ourselves to create instances of this class 65 SplashScreen(const SplashScreen&); 66 SplashScreen(void); 67 SplashScreen operator =(const SplashScreen&); 68 69 SplashScreen(const Reference< XMultiServiceFactory >& xFactory); 70 71 DECL_LINK( AppEventListenerHdl, VclWindowEvent * ); 72 virtual ~SplashScreen(); 73 void loadConfig(); 74 void initBitmap(); 75 void updateStatus(); 76 bool findScreenBitmap(rtl::OUString const & path); 77 bool findAppBitmap(rtl::OUString const & path); 78 bool findBitmap(rtl::OUString const & path); 79 bool loadBitmap( 80 rtl::OUString const & path, const rtl::OUString &rBmpFileName ); 81 void determineProgressRatioValues( double& rXRelPos, double& rYRelPos, double& rRelWidth, double& rRelHeight ); 82 83 static SplashScreen *_pINSTANCE; 84 85 static osl::Mutex _aMutex; 86 Reference< XMultiServiceFactory > _rFactory; 87 88 VirtualDevice _vdev; 89 BitmapEx _aIntroBmp; 90 Color _cProgressFrameColor; 91 Color _cProgressBarColor; 92 bool _bNativeProgress; 93 OUString _sAppName; 94 OUString _sProgressText; 95 std::vector< FullScreenProgressRatioValue > _sFullScreenProgressRatioValues; 96 97 sal_Int32 _iMax; 98 sal_Int32 _iProgress; 99 BitmapMode _eBitmapMode; 100 sal_Bool _bPaintBitmap; 101 sal_Bool _bPaintProgress; 102 sal_Bool _bVisible; 103 sal_Bool _bShowLogo; 104 sal_Bool _bFullScreenSplash; 105 sal_Bool _bProgressEnd; 106 long _height, _width, _tlx, _tly, _barwidth; 107 long _barheight, _barspace; 108 double _fXPos, _fYPos; 109 double _fWidth, _fHeight; 110 const long _xoffset, _yoffset; 111 112 public: 113 static const char* interfaces[]; 114 static const sal_Char *serviceName; 115 static const sal_Char *implementationName; 116 static const sal_Char *supportedServiceNames[]; 117 118 static Reference< XInterface > getInstance(const Reference < XMultiServiceFactory >& xFactory); 119 120 // XStatusIndicator 121 virtual void SAL_CALL end() throw ( RuntimeException ); 122 virtual void SAL_CALL reset() throw ( RuntimeException ); 123 virtual void SAL_CALL setText(const OUString& aText) throw ( RuntimeException ); 124 virtual void SAL_CALL setValue(sal_Int32 nValue) throw ( RuntimeException ); 125 virtual void SAL_CALL start(const OUString& aText, sal_Int32 nRange) throw ( RuntimeException ); 126 127 // XInitialize 128 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& aArguments ) 129 throw ( RuntimeException ); 130 131 // workwindow 132 virtual void Paint( const Rectangle& ); 133 134 }; 135 136 } 137