merge the formfield patch from ooo-build
[ooovba.git] / sfx2 / source / dialog / intro.cxx
blob5ad3254a873ce0a7610c98949705a76f80efdec3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: intro.cxx,v $
10 * $Revision: 1.7 $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sfx2.hxx"
34 #ifndef GCC
35 #endif
37 #include "intro.hxx"
39 #include <tools/stream.hxx>
40 #include <tools/urlobj.hxx>
41 #include <svtools/pathoptions.hxx>
42 #include <unotools/configmgr.hxx>
43 #include <com/sun/star/uno/Any.h>
45 #include <sfx2/sfxuno.hxx>
47 // -----------------------------------------------------------------------
49 void IntroWindow_Impl::Init()
51 Size aSize = aIntroBmp.GetSizePixel();
52 SetOutputSizePixel( aSize );
53 Size aScreenSize( GetDesktopRectPixel().GetSize() );
54 Size aWinSize( GetSizePixel() );
55 Point aWinPos( ( aScreenSize.Width() - aWinSize.Width() ) / 2,
56 ( aScreenSize.Height() - aWinSize.Height() ) / 2 );
57 SetPosPixel( aWinPos );
59 if ( GetColorCount() >= 16 )
61 Show();
62 Update();
66 // -----------------------------------------------------------------------
68 IntroWindow_Impl::IntroWindow_Impl( const Bitmap& rBmp ) :
70 WorkWindow( NULL, (WinBits)0 ),
72 aIntroBmp( rBmp )
75 Hide();
77 // load bitmap depends on productname ("StarOffice", "StarSuite",...)
78 ::com::sun::star::uno::Any aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME );
79 rtl::OUString aTmp;
80 aRet >>= aTmp;
81 String aBmpFileName = aTmp;
82 aBmpFileName += String( DEFINE_CONST_UNICODE("_intro.bmp") );
83 INetURLObject aObj( SvtPathOptions().GetModulePath(), INET_PROT_FILE );
84 aObj.insertName( aBmpFileName );
85 SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ );
86 if ( !aStrm.GetError() )
87 aStrm >> aIntroBmp;
89 Init();
92 // -----------------------------------------------------------------------
94 IntroWindow_Impl::~IntroWindow_Impl()
96 Hide();
99 // -----------------------------------------------------------------------
101 void IntroWindow_Impl::Paint( const Rectangle& )
103 DrawBitmap( Point(), aIntroBmp );
104 Flush();
107 // -----------------------------------------------------------------------
109 void IntroWindow_Impl::Slide()