1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: splash.hxx,v $
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
;
54 : public ::cppu::WeakImplHelper2
< XStatusIndicator
, XInitialization
>
58 struct FullScreenProgressRatioValue
65 enum BitmapMode
{ BM_FULLSCREEN
, BM_DEFAULTMODE
};
67 // don't allow anybody but ourselves to create instances of this class
68 SplashScreen(const SplashScreen
&);
70 SplashScreen
operator =(const SplashScreen
&);
72 SplashScreen(const Reference
< XMultiServiceFactory
>& xFactory
);
74 DECL_LINK( AppEventListenerHdl
, VclWindowEvent
* );
75 virtual ~SplashScreen();
79 bool findScreenBitmap(rtl::OUString
const & path
);
80 bool findAppBitmap(rtl::OUString
const & path
);
81 bool findBitmap(rtl::OUString
const & path
);
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
;
93 Color _cProgressFrameColor
;
94 Color _cProgressBarColor
;
96 std::vector
< FullScreenProgressRatioValue
> _sFullScreenProgressRatioValues
;
100 BitmapMode _eBitmapMode
;
101 sal_Bool _bPaintBitmap
;
102 sal_Bool _bPaintProgress
;
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
;
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
);
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
);
129 virtual void SAL_CALL
initialize( const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aArguments
)
130 throw ( RuntimeException
);
133 virtual void Paint( const Rectangle
& );