1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_cui.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir // include --------------------------------------------------------------- 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include <vcl/svapp.hxx> 34*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 35*cdf0e10cSrcweir #include <tools/stream.hxx> 36*cdf0e10cSrcweir #include <tools/urlobj.hxx> 37*cdf0e10cSrcweir #include <rtl/bootstrap.hxx> 38*cdf0e10cSrcweir #include <unotools/configmgr.hxx> 39*cdf0e10cSrcweir #include <unotools/bootstrap.hxx> 40*cdf0e10cSrcweir #include <com/sun/star/uno/Any.h> 41*cdf0e10cSrcweir #include <vcl/graph.hxx> 42*cdf0e10cSrcweir #include <svtools/filter.hxx> 43*cdf0e10cSrcweir #include <sfx2/sfxuno.hxx> 44*cdf0e10cSrcweir #include "about.hxx" 45*cdf0e10cSrcweir #include <sfx2/sfxdefs.hxx> 46*cdf0e10cSrcweir #include <sfx2/app.hxx> 47*cdf0e10cSrcweir #include <sfx2/sfxcommands.h> 48*cdf0e10cSrcweir #include "about.hrc" 49*cdf0e10cSrcweir #include <dialmgr.hxx> 50*cdf0e10cSrcweir #include <svtools/svtools.hrc> 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir // defines --------------------------------------------------------------- 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir #define SCROLL_OFFSET 1 55*cdf0e10cSrcweir #define SPACE_OFFSET 5 56*cdf0e10cSrcweir #define SCROLL_TIMER 30 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir #define WELCOME_URL DEFINE_CONST_UNICODE( "http://www.openoffice.org/welcome/credits.html" ) 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir // class AboutDialog ----------------------------------------------------- 61*cdf0e10cSrcweir static void layoutText( FixedInfo &rText, long &nY, long nTextWidth, Size a6Size ) 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir Point aTextPos = rText.GetPosPixel(); 64*cdf0e10cSrcweir aTextPos.X() = a6Size.Width() * 2; 65*cdf0e10cSrcweir aTextPos.Y() = nY; 66*cdf0e10cSrcweir rText.SetPosPixel( aTextPos ); 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir Size aTxtSiz = rText.GetSizePixel(); 69*cdf0e10cSrcweir aTxtSiz.Width() = nTextWidth; 70*cdf0e10cSrcweir Size aCalcSize = rText.CalcMinimumSize( nTextWidth ); 71*cdf0e10cSrcweir aTxtSiz.Height() = aCalcSize.Height(); 72*cdf0e10cSrcweir rText.SetSizePixel( aTxtSiz ); 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir nY += aTxtSiz.Height(); 75*cdf0e10cSrcweir } 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir String InitDevVersionStr() 78*cdf0e10cSrcweir { 79*cdf0e10cSrcweir const String sCWSSchema( String::CreateFromAscii( "[CWS:" ) ); 80*cdf0e10cSrcweir rtl::OUString sDefault; 81*cdf0e10cSrcweir String sBuildId( utl::Bootstrap::getBuildIdData( sDefault ) ); 82*cdf0e10cSrcweir OSL_ENSURE( sBuildId.Len() > 0, "No BUILDID in bootstrap file" ); 83*cdf0e10cSrcweir if ( sBuildId.Len() > 0 && sBuildId.Search( sCWSSchema ) == STRING_NOTFOUND ) 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir // no cws part in brand buildid -> try basis buildid 86*cdf0e10cSrcweir rtl::OUString sBasisBuildId( DEFINE_CONST_OUSTRING( 87*cdf0e10cSrcweir "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}" ) ); 88*cdf0e10cSrcweir rtl::Bootstrap::expandMacros( sBasisBuildId ); 89*cdf0e10cSrcweir sal_Int32 nIndex = sBasisBuildId.indexOf( sCWSSchema ); 90*cdf0e10cSrcweir if ( nIndex != -1 ) 91*cdf0e10cSrcweir sBuildId += String( sBasisBuildId.copy( nIndex ) ); 92*cdf0e10cSrcweir } 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir String sProductSource( utl::Bootstrap::getProductSource( sDefault ) ); 95*cdf0e10cSrcweir OSL_ENSURE( sProductSource.Len() > 0, "No ProductSource in bootstrap file" ); 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir // the product source is something like "DEV300", where the 98*cdf0e10cSrcweir // build id is something like "300m12(Build:12345)". For better readability, 99*cdf0e10cSrcweir // strip the duplicate UPD ("300"). 100*cdf0e10cSrcweir if ( sProductSource.Len() ) 101*cdf0e10cSrcweir { 102*cdf0e10cSrcweir bool bMatchingUPD = 103*cdf0e10cSrcweir ( sProductSource.Len() >= 3 ) 104*cdf0e10cSrcweir && ( sBuildId.Len() >= 3 ) 105*cdf0e10cSrcweir && ( sProductSource.Copy( sProductSource.Len() - 3 ) == sBuildId.Copy( 0, 3 ) ); 106*cdf0e10cSrcweir OSL_ENSURE( bMatchingUPD, "BUILDID and ProductSource do not match in their UPD" ); 107*cdf0e10cSrcweir if ( bMatchingUPD ) 108*cdf0e10cSrcweir sProductSource = sProductSource.Copy( 0, sProductSource.Len() - 3 ); 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir // prepend the product source 111*cdf0e10cSrcweir sBuildId.Insert( sProductSource, 0 ); 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir 114*cdf0e10cSrcweir // --> PB 2008-10-30 #i94693# 115*cdf0e10cSrcweir // if the build ids of the basis or ure layer are different from the build id 116*cdf0e10cSrcweir // of the brand layer then show them 117*cdf0e10cSrcweir rtl::OUString aBasisProductBuildId( DEFINE_CONST_OUSTRING( 118*cdf0e10cSrcweir "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":ProductBuildid}" ) ); 119*cdf0e10cSrcweir rtl::Bootstrap::expandMacros( aBasisProductBuildId ); 120*cdf0e10cSrcweir rtl::OUString aUREProductBuildId( DEFINE_CONST_OUSTRING( 121*cdf0e10cSrcweir "${$URE_BIN_DIR/" SAL_CONFIGFILE("version") ":ProductBuildid}" ) ); 122*cdf0e10cSrcweir rtl::Bootstrap::expandMacros( aUREProductBuildId ); 123*cdf0e10cSrcweir if ( sBuildId.Search( String( aBasisProductBuildId ) ) == STRING_NOTFOUND 124*cdf0e10cSrcweir || sBuildId.Search( String( aUREProductBuildId ) ) == STRING_NOTFOUND ) 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir String sTemp( '-' ); 127*cdf0e10cSrcweir sTemp += String( aBasisProductBuildId ); 128*cdf0e10cSrcweir sTemp += '-'; 129*cdf0e10cSrcweir sTemp += String( aUREProductBuildId ); 130*cdf0e10cSrcweir sBuildId.Insert( sTemp, sBuildId.Search( ')' ) ); 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir // <-- 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir // the build id format is "milestone(build)[cwsname]". For readability, it would 135*cdf0e10cSrcweir // be nice to have some more spaces in there. 136*cdf0e10cSrcweir xub_StrLen nPos = 0; 137*cdf0e10cSrcweir if ( ( nPos = sBuildId.Search( sal_Unicode( '(' ) ) ) != STRING_NOTFOUND ) 138*cdf0e10cSrcweir sBuildId.Insert( sal_Unicode( ' ' ), nPos ); 139*cdf0e10cSrcweir if ( ( nPos = sBuildId.Search( sal_Unicode( '[' ) ) ) != STRING_NOTFOUND ) 140*cdf0e10cSrcweir sBuildId.Insert( sal_Unicode( ' ' ), nPos ); 141*cdf0e10cSrcweir return sBuildId; 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir AboutDialog::AboutDialog( Window* pParent, const ResId& rId ) : 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir SfxModalDialog ( pParent, rId ), 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir aOKButton ( this, ResId( ABOUT_BTN_OK, *rId.GetResMgr() ) ), 149*cdf0e10cSrcweir aVersionText ( this, ResId( ABOUT_FTXT_VERSION, *rId.GetResMgr() ) ), 150*cdf0e10cSrcweir aCopyrightText ( this, ResId( ABOUT_FTXT_COPYRIGHT, *rId.GetResMgr() ) ), 151*cdf0e10cSrcweir aBuildData ( this ), 152*cdf0e10cSrcweir pDeveloperAry(0), 153*cdf0e10cSrcweir aAccelStr ( ResId( ABOUT_STR_ACCEL, *rId.GetResMgr() ) ), 154*cdf0e10cSrcweir aTimer (), 155*cdf0e10cSrcweir nOff ( 0 ), 156*cdf0e10cSrcweir m_nDeltaWidth ( 0 ), 157*cdf0e10cSrcweir m_nPendingScrolls( 0 ), 158*cdf0e10cSrcweir bNormal ( sal_True ) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir aDevVersionStr = InitDevVersionStr(); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir ::com::sun::star::lang::Locale aLocale; 163*cdf0e10cSrcweir ResMgr* pResMgr = ResMgr::SearchCreateResMgr( "about", aLocale ); 164*cdf0e10cSrcweir if ( pResMgr ) 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir aCopyrightTextStr = String( ResId( ABOUT_STR_COPYRIGHT, *pResMgr ) ); 167*cdf0e10cSrcweir pDeveloperAry = new ResStringArray( ResId( ABOUT_STR_DEVELOPER_ARY, *pResMgr ) ); 168*cdf0e10cSrcweir delete pResMgr; 169*cdf0e10cSrcweir } 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir rtl::OUString sProduct; 172*cdf0e10cSrcweir utl::ConfigManager::GetDirectConfigProperty(utl::ConfigManager::PRODUCTNAME) >>= sProduct; 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir // load image from module path 175*cdf0e10cSrcweir aAppLogo = SfxApplication::GetApplicationLogo(); 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir // Transparenter Font 178*cdf0e10cSrcweir Font aFont = GetFont(); 179*cdf0e10cSrcweir aFont.SetTransparent( sal_True ); 180*cdf0e10cSrcweir SetFont( aFont ); 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir // if necessary more info 183*cdf0e10cSrcweir String sVersion = aVersionText.GetText(); 184*cdf0e10cSrcweir sVersion.SearchAndReplaceAscii( "$(VER)", Application::GetDisplayName() ); 185*cdf0e10cSrcweir sVersion += '\n'; 186*cdf0e10cSrcweir sVersion += aDevVersionStr; 187*cdf0e10cSrcweir aVersionText.SetText( sVersion ); 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir // Initialisierung fuer Aufruf Entwickler 190*cdf0e10cSrcweir if ( aAccelStr.Len() && ByteString(U2S(aAccelStr)).IsAlphaAscii() ) 191*cdf0e10cSrcweir { 192*cdf0e10cSrcweir Accelerator *pAccel = 0, *pPrevAccel = 0, *pFirstAccel = 0; 193*cdf0e10cSrcweir aAccelStr.ToUpperAscii(); 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < aAccelStr.Len(); ++i ) 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir pPrevAccel = pAccel; 198*cdf0e10cSrcweir pAccel = new Accelerator; 199*cdf0e10cSrcweir aAccelList.Insert( pAccel, LIST_APPEND ); 200*cdf0e10cSrcweir sal_uInt16 nKey = aAccelStr.GetChar(i) - 'A' + KEY_A; 201*cdf0e10cSrcweir pAccel->InsertItem( 1, KeyCode( nKey, KEY_MOD1 ) ); 202*cdf0e10cSrcweir if ( i > 0 ) 203*cdf0e10cSrcweir pPrevAccel->SetAccel( 1, pAccel ); 204*cdf0e10cSrcweir if ( i == 0 ) 205*cdf0e10cSrcweir pFirstAccel = pAccel; 206*cdf0e10cSrcweir } 207*cdf0e10cSrcweir pAccel->SetSelectHdl( LINK( this, AboutDialog, AccelSelectHdl ) ); 208*cdf0e10cSrcweir GetpApp()->InsertAccel( pFirstAccel ); 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir // set for background and text the correct system color 212*cdf0e10cSrcweir const StyleSettings& rSettings = GetSettings().GetStyleSettings(); 213*cdf0e10cSrcweir Color aWhiteCol( rSettings.GetWindowColor() ); 214*cdf0e10cSrcweir Wallpaper aWall( aWhiteCol ); 215*cdf0e10cSrcweir SetBackground( aWall ); 216*cdf0e10cSrcweir Font aNewFont( aCopyrightText.GetFont() ); 217*cdf0e10cSrcweir aNewFont.SetTransparent( sal_True ); 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir aVersionText.SetFont( aNewFont ); 220*cdf0e10cSrcweir aCopyrightText.SetFont( aNewFont ); 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir aVersionText.SetBackground(); 223*cdf0e10cSrcweir aCopyrightText.SetBackground(); 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir Color aTextColor( rSettings.GetWindowTextColor() ); 226*cdf0e10cSrcweir aVersionText.SetControlForeground( aTextColor ); 227*cdf0e10cSrcweir aCopyrightText.SetControlForeground( aTextColor ); 228*cdf0e10cSrcweir aBuildData.SetBackground( aWall ); 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir Font aSmallFont = rSettings.GetInfoFont(); 231*cdf0e10cSrcweir Size aSmaller = aNewFont.GetSize(); 232*cdf0e10cSrcweir aSmaller.Width() = (long) (aSmaller.Width() * 0.75); 233*cdf0e10cSrcweir aSmaller.Height() = (long) (aSmaller.Height() * 0.75); 234*cdf0e10cSrcweir aNewFont.SetSize( aSmaller ); 235*cdf0e10cSrcweir aBuildData.SetFont( aNewFont ); 236*cdf0e10cSrcweir aBuildData.SetBackground( aWall ); 237*cdf0e10cSrcweir #ifdef BUILD_VER_STRING 238*cdf0e10cSrcweir String aBuildString( DEFINE_CONST_UNICODE( BUILD_VER_STRING ) ); 239*cdf0e10cSrcweir #else 240*cdf0e10cSrcweir String aBuildString; 241*cdf0e10cSrcweir #endif 242*cdf0e10cSrcweir aBuildData.SetText( aBuildString ); 243*cdf0e10cSrcweir aBuildData.Show(); 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir // determine size and position of the dialog & elements 246*cdf0e10cSrcweir Size aAppLogoSiz = aAppLogo.GetSizePixel(); 247*cdf0e10cSrcweir Size aOutSiz = GetOutputSizePixel(); 248*cdf0e10cSrcweir aOutSiz.Width() = aAppLogoSiz.Width(); 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir Size a6Size = aVersionText.LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); 251*cdf0e10cSrcweir long nY = aAppLogoSiz.Height() + ( a6Size.Height() * 2 ); 252*cdf0e10cSrcweir long nDlgMargin = a6Size.Width() * 4 ; 253*cdf0e10cSrcweir long nCtrlMargin = a6Size.Height() * 2; 254*cdf0e10cSrcweir long nTextWidth = aOutSiz.Width() - nDlgMargin; 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir aCopyrightText.SetText( aCopyrightTextStr ); 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir layoutText( aVersionText, nY, nTextWidth, a6Size ); 259*cdf0e10cSrcweir nY += nCtrlMargin; 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir // OK-Button-Position (at the bottom and centered) 262*cdf0e10cSrcweir Size aOKSiz = aOKButton.GetSizePixel(); 263*cdf0e10cSrcweir Point aOKPnt = aOKButton.GetPosPixel(); 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir // Multiline edit with Copyright-Text 266*cdf0e10cSrcweir Point aCopyPnt = aCopyrightText.GetPosPixel(); 267*cdf0e10cSrcweir Size aCopySize = aCopyrightText.GetSizePixel(); 268*cdf0e10cSrcweir aCopySize.Width() = nTextWidth; 269*cdf0e10cSrcweir aCopySize.Height() = aOutSiz.Height() - nY - ( aOKSiz.Height() * 2 ) - nCtrlMargin; 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir aCopyPnt.X() = ( aOutSiz.Width() - aCopySize.Width() ) / 2; 272*cdf0e10cSrcweir aCopyPnt.Y() = nY; 273*cdf0e10cSrcweir aCopyrightText.SetPosSizePixel( aCopyPnt, aCopySize ); 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir nY += aCopySize.Height() + nCtrlMargin; 276*cdf0e10cSrcweir aOKPnt.X() = ( aOutSiz.Width() - aOKSiz.Width() ) / 2; 277*cdf0e10cSrcweir aOKPnt.Y() = nY; 278*cdf0e10cSrcweir aOKButton.SetPosPixel( aOKPnt ); 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir // Change the width of the dialog 281*cdf0e10cSrcweir SetOutputSizePixel( aOutSiz ); 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir FreeResource(); 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir SetHelpId( CMD_SID_ABOUT ); 286*cdf0e10cSrcweir } 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir // ----------------------------------------------------------------------- 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir AboutDialog::~AboutDialog() 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir // L"oschen des Entwickleraufrufs 293*cdf0e10cSrcweir delete pDeveloperAry; 294*cdf0e10cSrcweir if ( aAccelList.Count() ) 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir GetpApp()->RemoveAccel( aAccelList.First() ); 297*cdf0e10cSrcweir Accelerator* pAccel = aAccelList.Last(); 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir while ( pAccel ) 300*cdf0e10cSrcweir { 301*cdf0e10cSrcweir delete pAccel; 302*cdf0e10cSrcweir pAccel = aAccelList.Prev(); 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir } 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir // ----------------------------------------------------------------------- 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir IMPL_LINK( AboutDialog, TimerHdl, Timer *, pTimer ) 310*cdf0e10cSrcweir { 311*cdf0e10cSrcweir (void)pTimer; //unused 312*cdf0e10cSrcweir ++m_nPendingScrolls; 313*cdf0e10cSrcweir Invalidate( INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN ); 314*cdf0e10cSrcweir return 0; 315*cdf0e10cSrcweir } 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir // ----------------------------------------------------------------------- 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir IMPL_LINK( AboutDialog, AccelSelectHdl, Accelerator *, pAccelerator ) 320*cdf0e10cSrcweir { 321*cdf0e10cSrcweir #ifdef YURI_DARIO 322*cdf0e10cSrcweir aCopyrightText.SetHelpText( DEFINE_CONST_UNICODE("Conoscere qualcuno ovunque egli sia, con cui comprendersi nonostante le distanze\n" 323*cdf0e10cSrcweir "e le differenze, puo' trasformare la terra in un giardino. baci Valeria") ); 324*cdf0e10cSrcweir #endif 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir (void)pAccelerator; //unused 327*cdf0e10cSrcweir // init Timer 328*cdf0e10cSrcweir aTimer.SetTimeoutHdl( LINK( this, AboutDialog, TimerHdl ) ); 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir // init scroll mode 331*cdf0e10cSrcweir nOff = GetOutputSizePixel().Height(); 332*cdf0e10cSrcweir MapMode aMapMode( MAP_PIXEL ); 333*cdf0e10cSrcweir SetMapMode( aMapMode ); 334*cdf0e10cSrcweir bNormal = sal_False; 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir // start scroll Timer 337*cdf0e10cSrcweir aTimer.SetTimeout( SCROLL_TIMER ); 338*cdf0e10cSrcweir aTimer.Start(); 339*cdf0e10cSrcweir return 0; 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir // ----------------------------------------------------------------------- 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir sal_Bool AboutDialog::Close() 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir // stop Timer and finish the dialog 347*cdf0e10cSrcweir aTimer.Stop(); 348*cdf0e10cSrcweir EndDialog( RET_OK ); 349*cdf0e10cSrcweir return( sal_False ); 350*cdf0e10cSrcweir } 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir // ----------------------------------------------------------------------- 353*cdf0e10cSrcweir 354*cdf0e10cSrcweir void AboutDialog::Paint( const Rectangle& rRect ) 355*cdf0e10cSrcweir { 356*cdf0e10cSrcweir SetClipRegion( rRect ); 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir if ( bNormal ) // not in scroll mode 359*cdf0e10cSrcweir { 360*cdf0e10cSrcweir Point aPos( m_nDeltaWidth / 2, 0 ); 361*cdf0e10cSrcweir DrawImage( aPos, aAppLogo ); 362*cdf0e10cSrcweir return; 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir // scroll the content 366*cdf0e10cSrcweir const int nDeltaY = -SCROLL_OFFSET * m_nPendingScrolls; 367*cdf0e10cSrcweir if( !nDeltaY ) 368*cdf0e10cSrcweir return; 369*cdf0e10cSrcweir nOff += nDeltaY; 370*cdf0e10cSrcweir Scroll( 0, nDeltaY, SCROLL_NOERASE ); 371*cdf0e10cSrcweir m_nPendingScrolls = 0; 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir // draw the credits text 374*cdf0e10cSrcweir const Font aOrigFont = GetFont(); 375*cdf0e10cSrcweir const int nFullWidth = GetOutputSizePixel().Width(); 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir int nY = nOff; 378*cdf0e10cSrcweir const int nDevCnt = static_cast<int>( pDeveloperAry->Count() ); 379*cdf0e10cSrcweir for( int i = 0; i < nDevCnt; ++i ) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir if( nY >= rRect.Bottom() ) 382*cdf0e10cSrcweir break; 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir int nPos2 = nY + GetTextHeight() + 3; 385*cdf0e10cSrcweir if( nPos2 >= rRect.Top() + nDeltaY ) 386*cdf0e10cSrcweir { 387*cdf0e10cSrcweir const String aStr = pDeveloperAry->GetString(i); 388*cdf0e10cSrcweir const long nVal = pDeveloperAry->GetValue(i); 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir if ( nVal ) 391*cdf0e10cSrcweir { 392*cdf0e10cSrcweir // emphasize the headers 393*cdf0e10cSrcweir Font aFont = aOrigFont; 394*cdf0e10cSrcweir aFont.SetWeight( (FontWeight)nVal ); 395*cdf0e10cSrcweir SetFont( aFont ); 396*cdf0e10cSrcweir nPos2 = nY + GetTextHeight() + 3; 397*cdf0e10cSrcweir } 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir // clear text background 400*cdf0e10cSrcweir Rectangle aEraseRect( Point(0,nY), Size( nFullWidth, nPos2-nY)); 401*cdf0e10cSrcweir Erase( aEraseRect ); 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir // draw centered text 404*cdf0e10cSrcweir const long nTextWidth = GetTextWidth( aStr ); 405*cdf0e10cSrcweir long nX = (nFullWidth - 5 - nTextWidth) / 2; 406*cdf0e10cSrcweir if( nX < 0 ) 407*cdf0e10cSrcweir nX = SPACE_OFFSET; 408*cdf0e10cSrcweir const Point aPnt( nX, nY ); 409*cdf0e10cSrcweir DrawText( aPnt, aStr ); 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir // restore the font if needed 412*cdf0e10cSrcweir if( nVal ) 413*cdf0e10cSrcweir SetFont( aOrigFont ); 414*cdf0e10cSrcweir } 415*cdf0e10cSrcweir nY = nPos2; 416*cdf0e10cSrcweir } 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir // close dialog if the whole text has been scrolled 419*cdf0e10cSrcweir if ( nY <= 0 ) 420*cdf0e10cSrcweir { 421*cdf0e10cSrcweir bNormal = sal_True; 422*cdf0e10cSrcweir Close(); 423*cdf0e10cSrcweir } 424*cdf0e10cSrcweir } 425