xref: /trunk/main/sfx2/source/dialog/intro.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sfx2.hxx"
30 
31 #ifndef GCC
32 #endif
33 
34 #include "intro.hxx"
35 
36 #include <tools/stream.hxx>
37 #include <tools/urlobj.hxx>
38 #include <unotools/pathoptions.hxx>
39 #include <unotools/configmgr.hxx>
40 #include <com/sun/star/uno/Any.h>
41 
42 #include <sfx2/sfxuno.hxx>
43 
44 // -----------------------------------------------------------------------
45 
46 void IntroWindow_Impl::Init()
47 {
48     Size aSize = aIntroBmp.GetSizePixel();
49     SetOutputSizePixel( aSize );
50     Size  aScreenSize( GetDesktopRectPixel().GetSize() );
51     Size  aWinSize( GetSizePixel() );
52     Point aWinPos( ( aScreenSize.Width()  - aWinSize.Width() )  / 2,
53                    ( aScreenSize.Height() - aWinSize.Height() ) / 2  );
54     SetPosPixel( aWinPos );
55 
56     if ( GetColorCount() >= 16 )
57     {
58         Show();
59         Update();
60     }
61 }
62 
63 // -----------------------------------------------------------------------
64 
65 IntroWindow_Impl::IntroWindow_Impl( const Bitmap& rBmp ) :
66 
67     WorkWindow( NULL, (WinBits)0 ),
68 
69     aIntroBmp( rBmp )
70 
71 {
72     Hide();
73 
74     // load bitmap depends on productname ("StarOffice", "StarSuite",...)
75     ::com::sun::star::uno::Any aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME );
76     rtl::OUString aTmp;
77     aRet >>= aTmp;
78     String aBmpFileName = aTmp;
79     aBmpFileName += String( DEFINE_CONST_UNICODE("_intro.bmp") );
80     INetURLObject aObj( SvtPathOptions().GetModulePath(), INET_PROT_FILE );
81     aObj.insertName( aBmpFileName );
82     SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ );
83     if ( !aStrm.GetError() )
84         aStrm >> aIntroBmp;
85 
86     Init();
87 }
88 
89 // -----------------------------------------------------------------------
90 
91 IntroWindow_Impl::~IntroWindow_Impl()
92 {
93     Hide();
94 }
95 
96 // -----------------------------------------------------------------------
97 
98 void IntroWindow_Impl::Paint( const Rectangle& )
99 {
100     DrawBitmap( Point(), aIntroBmp );
101     Flush();
102 }
103 
104 // -----------------------------------------------------------------------
105 
106 void IntroWindow_Impl::Slide()
107 {
108 }
109 
110 
111