xref: /aoo41x/main/desktop/source/splash/splash.hxx (revision 781e0f66)
10a1e2f0eSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
30a1e2f0eSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
40a1e2f0eSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
50a1e2f0eSAndrew Rist  * distributed with this work for additional information
60a1e2f0eSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
70a1e2f0eSAndrew Rist  * to you under the Apache License, Version 2.0 (the
80a1e2f0eSAndrew Rist  * "License"); you may not use this file except in compliance
90a1e2f0eSAndrew Rist  * with the License.  You may obtain a copy of the License at
100a1e2f0eSAndrew Rist  *
110a1e2f0eSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
120a1e2f0eSAndrew Rist  *
130a1e2f0eSAndrew Rist  * Unless required by applicable law or agreed to in writing,
140a1e2f0eSAndrew Rist  * software distributed under the License is distributed on an
150a1e2f0eSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
160a1e2f0eSAndrew Rist  * KIND, either express or implied.  See the License for the
170a1e2f0eSAndrew Rist  * specific language governing permissions and limitations
180a1e2f0eSAndrew Rist  * under the License.
190a1e2f0eSAndrew Rist  *
200a1e2f0eSAndrew Rist  *************************************************************/
210a1e2f0eSAndrew Rist 
220a1e2f0eSAndrew 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;
87*781e0f66SAndre Fischer     bool            _bShowProgressFrame;
88cdf0e10cSrcweir     Color           _cProgressBarColor;
89cdf0e10cSrcweir     bool            _bNativeProgress;
90cdf0e10cSrcweir     OUString        _sAppName;
91cdf0e10cSrcweir     OUString        _sProgressText;
92cdf0e10cSrcweir     std::vector< FullScreenProgressRatioValue > _sFullScreenProgressRatioValues;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	sal_Int32   _iMax;
95cdf0e10cSrcweir 	sal_Int32   _iProgress;
96cdf0e10cSrcweir     BitmapMode  _eBitmapMode;
97cdf0e10cSrcweir 	sal_Bool    _bPaintBitmap;
98cdf0e10cSrcweir 	sal_Bool    _bPaintProgress;
99cdf0e10cSrcweir 	sal_Bool    _bVisible;
100cdf0e10cSrcweir     sal_Bool    _bShowLogo;
101cdf0e10cSrcweir     sal_Bool    _bFullScreenSplash;
102cdf0e10cSrcweir     sal_Bool    _bProgressEnd;
103cdf0e10cSrcweir 	long _height, _width, _tlx, _tly, _barwidth;
104cdf0e10cSrcweir     long _barheight, _barspace;
105cdf0e10cSrcweir     double _fXPos, _fYPos;
106cdf0e10cSrcweir     double _fWidth, _fHeight;
107cdf0e10cSrcweir     const long _xoffset, _yoffset;
108cdf0e10cSrcweir 
109cdf0e10cSrcweir public:
110cdf0e10cSrcweir     static const char* interfaces[];
111cdf0e10cSrcweir 	static const sal_Char *serviceName;
112cdf0e10cSrcweir 	static const sal_Char *implementationName;
113cdf0e10cSrcweir 	static const sal_Char *supportedServiceNames[];
114cdf0e10cSrcweir 
115cdf0e10cSrcweir     static Reference< XInterface > getInstance(const Reference < XMultiServiceFactory >& xFactory);
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	// XStatusIndicator
118cdf0e10cSrcweir 	virtual void SAL_CALL end() throw ( RuntimeException );
119cdf0e10cSrcweir 	virtual void SAL_CALL reset() throw ( RuntimeException );
120cdf0e10cSrcweir 	virtual void SAL_CALL setText(const OUString& aText) throw ( RuntimeException );
121cdf0e10cSrcweir 	virtual void SAL_CALL setValue(sal_Int32 nValue) throw ( RuntimeException );
122cdf0e10cSrcweir 	virtual void SAL_CALL start(const OUString& aText, sal_Int32 nRange) throw ( RuntimeException );
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 	// XInitialize
125cdf0e10cSrcweir 	virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& aArguments )
126cdf0e10cSrcweir 		throw ( RuntimeException );
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 	// workwindow
129cdf0e10cSrcweir 	virtual void Paint( const Rectangle& );
130cdf0e10cSrcweir 
131cdf0e10cSrcweir };
132cdf0e10cSrcweir 
133cdf0e10cSrcweir }
134