12ee96f1cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 32ee96f1cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 42ee96f1cSAndrew Rist * or more contributor license agreements. See the NOTICE file 52ee96f1cSAndrew Rist * distributed with this work for additional information 62ee96f1cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 72ee96f1cSAndrew Rist * to you under the Apache License, Version 2.0 (the 82ee96f1cSAndrew Rist * "License"); you may not use this file except in compliance 92ee96f1cSAndrew Rist * with the License. You may obtain a copy of the License at 102ee96f1cSAndrew Rist * 112ee96f1cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 122ee96f1cSAndrew Rist * 132ee96f1cSAndrew Rist * Unless required by applicable law or agreed to in writing, 142ee96f1cSAndrew Rist * software distributed under the License is distributed on an 152ee96f1cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 162ee96f1cSAndrew Rist * KIND, either express or implied. See the License for the 172ee96f1cSAndrew Rist * specific language governing permissions and limitations 182ee96f1cSAndrew Rist * under the License. 192ee96f1cSAndrew Rist * 202ee96f1cSAndrew Rist *************************************************************/ 212ee96f1cSAndrew Rist 222ee96f1cSAndrew 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 234*a392ac37SAriel Constenla-Haile #define _STRINGIFY(x) #x 235*a392ac37SAriel Constenla-Haile #define STRINGIFY(x) _STRINGIFY(x) 236*a392ac37SAriel Constenla-Haile String aBuildString( DEFINE_CONST_UNICODE( STRINGIFY( BUILD_VER_STRING ) ) ); 237cdf0e10cSrcweir #else 238cdf0e10cSrcweir String aBuildString; 239cdf0e10cSrcweir #endif 240cdf0e10cSrcweir aBuildData.SetText( aBuildString ); 241cdf0e10cSrcweir aBuildData.Show(); 242cdf0e10cSrcweir 243cdf0e10cSrcweir // determine size and position of the dialog & elements 244cdf0e10cSrcweir Size aAppLogoSiz = aAppLogo.GetSizePixel(); 245cdf0e10cSrcweir Size aOutSiz = GetOutputSizePixel(); 246cdf0e10cSrcweir aOutSiz.Width() = aAppLogoSiz.Width(); 247cdf0e10cSrcweir 248cdf0e10cSrcweir Size a6Size = aVersionText.LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); 249cdf0e10cSrcweir long nY = aAppLogoSiz.Height() + ( a6Size.Height() * 2 ); 250cdf0e10cSrcweir long nDlgMargin = a6Size.Width() * 4 ; 251cdf0e10cSrcweir long nCtrlMargin = a6Size.Height() * 2; 252cdf0e10cSrcweir long nTextWidth = aOutSiz.Width() - nDlgMargin; 253cdf0e10cSrcweir 254cdf0e10cSrcweir aCopyrightText.SetText( aCopyrightTextStr ); 255*a392ac37SAriel Constenla-Haile 256*a392ac37SAriel Constenla-Haile // layout fixed text controls 257cdf0e10cSrcweir layoutText( aVersionText, nY, nTextWidth, a6Size ); 258*a392ac37SAriel Constenla-Haile if( aBuildString.Len() > 0 ) 259*a392ac37SAriel Constenla-Haile { 260*a392ac37SAriel Constenla-Haile nY += ( a6Size.Height() / 2 ); 261*a392ac37SAriel Constenla-Haile layoutText( aBuildData, nY, nTextWidth, a6Size ); 262*a392ac37SAriel Constenla-Haile } 263*a392ac37SAriel Constenla-Haile nY += nCtrlMargin; 264*a392ac37SAriel Constenla-Haile 265cdf0e10cSrcweir // OK-Button-Position (at the bottom and centered) 266cdf0e10cSrcweir Size aOKSiz = aOKButton.GetSizePixel(); 267cdf0e10cSrcweir Point aOKPnt = aOKButton.GetPosPixel(); 268cdf0e10cSrcweir 269cdf0e10cSrcweir // Multiline edit with Copyright-Text 270cdf0e10cSrcweir Point aCopyPnt = aCopyrightText.GetPosPixel(); 271cdf0e10cSrcweir Size aCopySize = aCopyrightText.GetSizePixel(); 272cdf0e10cSrcweir aCopySize.Width() = nTextWidth; 273cdf0e10cSrcweir aCopySize.Height() = aOutSiz.Height() - nY - ( aOKSiz.Height() * 2 ) - nCtrlMargin; 274cdf0e10cSrcweir 275cdf0e10cSrcweir aCopyPnt.X() = ( aOutSiz.Width() - aCopySize.Width() ) / 2; 276cdf0e10cSrcweir aCopyPnt.Y() = nY; 277cdf0e10cSrcweir aCopyrightText.SetPosSizePixel( aCopyPnt, aCopySize ); 278cdf0e10cSrcweir 279cdf0e10cSrcweir nY += aCopySize.Height() + nCtrlMargin; 280cdf0e10cSrcweir aOKPnt.X() = ( aOutSiz.Width() - aOKSiz.Width() ) / 2; 281cdf0e10cSrcweir aOKPnt.Y() = nY; 282cdf0e10cSrcweir aOKButton.SetPosPixel( aOKPnt ); 283cdf0e10cSrcweir 284cdf0e10cSrcweir // Change the width of the dialog 285cdf0e10cSrcweir SetOutputSizePixel( aOutSiz ); 286cdf0e10cSrcweir 287cdf0e10cSrcweir FreeResource(); 288cdf0e10cSrcweir 289cdf0e10cSrcweir SetHelpId( CMD_SID_ABOUT ); 290cdf0e10cSrcweir } 291cdf0e10cSrcweir 292cdf0e10cSrcweir // ----------------------------------------------------------------------- 293cdf0e10cSrcweir 294cdf0e10cSrcweir AboutDialog::~AboutDialog() 295cdf0e10cSrcweir { 296cdf0e10cSrcweir // L"oschen des Entwickleraufrufs 297cdf0e10cSrcweir delete pDeveloperAry; 298cdf0e10cSrcweir if ( aAccelList.Count() ) 299cdf0e10cSrcweir { 300cdf0e10cSrcweir GetpApp()->RemoveAccel( aAccelList.First() ); 301cdf0e10cSrcweir Accelerator* pAccel = aAccelList.Last(); 302cdf0e10cSrcweir 303cdf0e10cSrcweir while ( pAccel ) 304cdf0e10cSrcweir { 305cdf0e10cSrcweir delete pAccel; 306cdf0e10cSrcweir pAccel = aAccelList.Prev(); 307cdf0e10cSrcweir } 308cdf0e10cSrcweir } 309cdf0e10cSrcweir } 310cdf0e10cSrcweir 311cdf0e10cSrcweir // ----------------------------------------------------------------------- 312cdf0e10cSrcweir 313cdf0e10cSrcweir IMPL_LINK( AboutDialog, TimerHdl, Timer *, pTimer ) 314cdf0e10cSrcweir { 315cdf0e10cSrcweir (void)pTimer; //unused 316cdf0e10cSrcweir ++m_nPendingScrolls; 317cdf0e10cSrcweir Invalidate( INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN ); 318cdf0e10cSrcweir return 0; 319cdf0e10cSrcweir } 320cdf0e10cSrcweir 321cdf0e10cSrcweir // ----------------------------------------------------------------------- 322cdf0e10cSrcweir 323cdf0e10cSrcweir IMPL_LINK( AboutDialog, AccelSelectHdl, Accelerator *, pAccelerator ) 324cdf0e10cSrcweir { 325cdf0e10cSrcweir #ifdef YURI_DARIO 326cdf0e10cSrcweir aCopyrightText.SetHelpText( DEFINE_CONST_UNICODE("Conoscere qualcuno ovunque egli sia, con cui comprendersi nonostante le distanze\n" 327cdf0e10cSrcweir "e le differenze, puo' trasformare la terra in un giardino. baci Valeria") ); 328cdf0e10cSrcweir #endif 329cdf0e10cSrcweir 330cdf0e10cSrcweir (void)pAccelerator; //unused 331cdf0e10cSrcweir // init Timer 332cdf0e10cSrcweir aTimer.SetTimeoutHdl( LINK( this, AboutDialog, TimerHdl ) ); 333cdf0e10cSrcweir 334cdf0e10cSrcweir // init scroll mode 335cdf0e10cSrcweir nOff = GetOutputSizePixel().Height(); 336cdf0e10cSrcweir MapMode aMapMode( MAP_PIXEL ); 337cdf0e10cSrcweir SetMapMode( aMapMode ); 338cdf0e10cSrcweir bNormal = sal_False; 339cdf0e10cSrcweir 340cdf0e10cSrcweir // start scroll Timer 341cdf0e10cSrcweir aTimer.SetTimeout( SCROLL_TIMER ); 342cdf0e10cSrcweir aTimer.Start(); 343cdf0e10cSrcweir return 0; 344cdf0e10cSrcweir } 345cdf0e10cSrcweir 346cdf0e10cSrcweir // ----------------------------------------------------------------------- 347cdf0e10cSrcweir 348cdf0e10cSrcweir sal_Bool AboutDialog::Close() 349cdf0e10cSrcweir { 350cdf0e10cSrcweir // stop Timer and finish the dialog 351cdf0e10cSrcweir aTimer.Stop(); 352cdf0e10cSrcweir EndDialog( RET_OK ); 353cdf0e10cSrcweir return( sal_False ); 354cdf0e10cSrcweir } 355cdf0e10cSrcweir 356cdf0e10cSrcweir // ----------------------------------------------------------------------- 357cdf0e10cSrcweir 358cdf0e10cSrcweir void AboutDialog::Paint( const Rectangle& rRect ) 359cdf0e10cSrcweir { 360cdf0e10cSrcweir SetClipRegion( rRect ); 361cdf0e10cSrcweir 362cdf0e10cSrcweir if ( bNormal ) // not in scroll mode 363cdf0e10cSrcweir { 364cdf0e10cSrcweir Point aPos( m_nDeltaWidth / 2, 0 ); 365cdf0e10cSrcweir DrawImage( aPos, aAppLogo ); 366cdf0e10cSrcweir return; 367cdf0e10cSrcweir } 368cdf0e10cSrcweir 369cdf0e10cSrcweir // scroll the content 370cdf0e10cSrcweir const int nDeltaY = -SCROLL_OFFSET * m_nPendingScrolls; 371cdf0e10cSrcweir if( !nDeltaY ) 372cdf0e10cSrcweir return; 373cdf0e10cSrcweir nOff += nDeltaY; 374cdf0e10cSrcweir Scroll( 0, nDeltaY, SCROLL_NOERASE ); 375cdf0e10cSrcweir m_nPendingScrolls = 0; 376cdf0e10cSrcweir 377cdf0e10cSrcweir // draw the credits text 378cdf0e10cSrcweir const Font aOrigFont = GetFont(); 379cdf0e10cSrcweir const int nFullWidth = GetOutputSizePixel().Width(); 380cdf0e10cSrcweir 381cdf0e10cSrcweir int nY = nOff; 382cdf0e10cSrcweir const int nDevCnt = static_cast<int>( pDeveloperAry->Count() ); 383cdf0e10cSrcweir for( int i = 0; i < nDevCnt; ++i ) 384cdf0e10cSrcweir { 385cdf0e10cSrcweir if( nY >= rRect.Bottom() ) 386cdf0e10cSrcweir break; 387cdf0e10cSrcweir 388cdf0e10cSrcweir int nPos2 = nY + GetTextHeight() + 3; 389cdf0e10cSrcweir if( nPos2 >= rRect.Top() + nDeltaY ) 390cdf0e10cSrcweir { 391cdf0e10cSrcweir const String aStr = pDeveloperAry->GetString(i); 392cdf0e10cSrcweir const long nVal = pDeveloperAry->GetValue(i); 393cdf0e10cSrcweir 394cdf0e10cSrcweir if ( nVal ) 395cdf0e10cSrcweir { 396cdf0e10cSrcweir // emphasize the headers 397cdf0e10cSrcweir Font aFont = aOrigFont; 398cdf0e10cSrcweir aFont.SetWeight( (FontWeight)nVal ); 399cdf0e10cSrcweir SetFont( aFont ); 400cdf0e10cSrcweir nPos2 = nY + GetTextHeight() + 3; 401cdf0e10cSrcweir } 402cdf0e10cSrcweir 403cdf0e10cSrcweir // clear text background 404cdf0e10cSrcweir Rectangle aEraseRect( Point(0,nY), Size( nFullWidth, nPos2-nY)); 405cdf0e10cSrcweir Erase( aEraseRect ); 406cdf0e10cSrcweir 407cdf0e10cSrcweir // draw centered text 408cdf0e10cSrcweir const long nTextWidth = GetTextWidth( aStr ); 409cdf0e10cSrcweir long nX = (nFullWidth - 5 - nTextWidth) / 2; 410cdf0e10cSrcweir if( nX < 0 ) 411cdf0e10cSrcweir nX = SPACE_OFFSET; 412cdf0e10cSrcweir const Point aPnt( nX, nY ); 413cdf0e10cSrcweir DrawText( aPnt, aStr ); 414cdf0e10cSrcweir 415cdf0e10cSrcweir // restore the font if needed 416cdf0e10cSrcweir if( nVal ) 417cdf0e10cSrcweir SetFont( aOrigFont ); 418cdf0e10cSrcweir } 419cdf0e10cSrcweir nY = nPos2; 420cdf0e10cSrcweir } 421cdf0e10cSrcweir 422cdf0e10cSrcweir // close dialog if the whole text has been scrolled 423cdf0e10cSrcweir if ( nY <= 0 ) 424cdf0e10cSrcweir { 425cdf0e10cSrcweir bNormal = sal_True; 426cdf0e10cSrcweir Close(); 427cdf0e10cSrcweir } 428cdf0e10cSrcweir } 429