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