xref: /aoo41x/main/sfx2/source/dialog/intro.cxx (revision d119d52d)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sfx2.hxx"
26 
27 #ifndef GCC
28 #endif
29 
30 #include "intro.hxx"
31 
32 #include <tools/stream.hxx>
33 #include <tools/urlobj.hxx>
34 #include <unotools/pathoptions.hxx>
35 #include <unotools/configmgr.hxx>
36 #include <com/sun/star/uno/Any.h>
37 
38 #include <sfx2/sfxuno.hxx>
39 
40 // -----------------------------------------------------------------------
41 
42 void IntroWindow_Impl::Init()
43 {
44 	Size aSize = aIntroBmp.GetSizePixel();
45 	SetOutputSizePixel( aSize );
46 	Size  aScreenSize( GetDesktopRectPixel().GetSize() );
47 	Size  aWinSize( GetSizePixel() );
48 	Point aWinPos( ( aScreenSize.Width()  - aWinSize.Width() )  / 2,
49 				   ( aScreenSize.Height() - aWinSize.Height() ) / 2  );
50 	SetPosPixel( aWinPos );
51 
52 	if ( GetColorCount() >= 16 )
53 	{
54 		Show();
55 		Update();
56 	}
57 }
58 
59 // -----------------------------------------------------------------------
60 
61 IntroWindow_Impl::IntroWindow_Impl( const Bitmap& rBmp ) :
62 
63 	WorkWindow( NULL, (WinBits)0 ),
64 
65 	aIntroBmp( rBmp )
66 
67 {
68 	Hide();
69 
70 	// load bitmap depends on productname ("StarOffice", "StarSuite",...)
71     ::com::sun::star::uno::Any aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME );
72     rtl::OUString aTmp;
73     aRet >>= aTmp;
74     String aBmpFileName = aTmp;
75 	aBmpFileName += String( DEFINE_CONST_UNICODE("_intro.bmp") );
76 	INetURLObject aObj( SvtPathOptions().GetModulePath(), INET_PROT_FILE );
77 	aObj.insertName( aBmpFileName );
78 	SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ );
79 	if ( !aStrm.GetError() )
80 		aStrm >> aIntroBmp;
81 
82 	Init();
83 }
84 
85 // -----------------------------------------------------------------------
86 
87 IntroWindow_Impl::~IntroWindow_Impl()
88 {
89 	Hide();
90 }
91 
92 // -----------------------------------------------------------------------
93 
94 void IntroWindow_Impl::Paint( const Rectangle& )
95 {
96 	DrawBitmap( Point(), aIntroBmp );
97 	Flush();
98 }
99 
100 // -----------------------------------------------------------------------
101 
102 void IntroWindow_Impl::Slide()
103 {
104 }
105 
106 
107