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