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