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 { 75*8bd5297cSJürgen Schmidt String sDefault; 76cdf0e10cSrcweir String sBuildId( utl::Bootstrap::getBuildIdData( sDefault ) ); 77cdf0e10cSrcweir OSL_ENSURE( sBuildId.Len() > 0, "No BUILDID in bootstrap file" ); 78cdf0e10cSrcweir 79cdf0e10cSrcweir String sProductSource( utl::Bootstrap::getProductSource( sDefault ) ); 80cdf0e10cSrcweir OSL_ENSURE( sProductSource.Len() > 0, "No ProductSource in bootstrap file" ); 81cdf0e10cSrcweir 82cdf0e10cSrcweir // the product source is something like "DEV300", where the 83cdf0e10cSrcweir // build id is something like "300m12(Build:12345)". For better readability, 84cdf0e10cSrcweir // strip the duplicate UPD ("300"). 85cdf0e10cSrcweir if ( sProductSource.Len() ) 86cdf0e10cSrcweir { 87cdf0e10cSrcweir bool bMatchingUPD = 88cdf0e10cSrcweir ( sProductSource.Len() >= 3 ) 89cdf0e10cSrcweir && ( sBuildId.Len() >= 3 ) 90cdf0e10cSrcweir && ( sProductSource.Copy( sProductSource.Len() - 3 ) == sBuildId.Copy( 0, 3 ) ); 91cdf0e10cSrcweir OSL_ENSURE( bMatchingUPD, "BUILDID and ProductSource do not match in their UPD" ); 92cdf0e10cSrcweir if ( bMatchingUPD ) 93cdf0e10cSrcweir sProductSource = sProductSource.Copy( 0, sProductSource.Len() - 3 ); 94cdf0e10cSrcweir 95cdf0e10cSrcweir // prepend the product source 96cdf0e10cSrcweir sBuildId.Insert( sProductSource, 0 ); 97cdf0e10cSrcweir } 98*8bd5297cSJürgen Schmidt 99cdf0e10cSrcweir return sBuildId; 100cdf0e10cSrcweir } 101cdf0e10cSrcweir 102cdf0e10cSrcweir AboutDialog::AboutDialog( Window* pParent, const ResId& rId ) : 103cdf0e10cSrcweir 104cdf0e10cSrcweir SfxModalDialog ( pParent, rId ), 105cdf0e10cSrcweir 106cdf0e10cSrcweir aOKButton ( this, ResId( ABOUT_BTN_OK, *rId.GetResMgr() ) ), 107cdf0e10cSrcweir aVersionText ( this, ResId( ABOUT_FTXT_VERSION, *rId.GetResMgr() ) ), 108cdf0e10cSrcweir aCopyrightText ( this, ResId( ABOUT_FTXT_COPYRIGHT, *rId.GetResMgr() ) ), 109cdf0e10cSrcweir aBuildData ( this ), 110cdf0e10cSrcweir pDeveloperAry(0), 111cdf0e10cSrcweir aAccelStr ( ResId( ABOUT_STR_ACCEL, *rId.GetResMgr() ) ), 112cdf0e10cSrcweir aTimer (), 113cdf0e10cSrcweir nOff ( 0 ), 114cdf0e10cSrcweir m_nDeltaWidth ( 0 ), 115cdf0e10cSrcweir m_nPendingScrolls( 0 ), 116cdf0e10cSrcweir bNormal ( sal_True ) 117cdf0e10cSrcweir { 118cdf0e10cSrcweir aDevVersionStr = InitDevVersionStr(); 119cdf0e10cSrcweir 120cdf0e10cSrcweir ::com::sun::star::lang::Locale aLocale; 121cdf0e10cSrcweir ResMgr* pResMgr = ResMgr::SearchCreateResMgr( "about", aLocale ); 122cdf0e10cSrcweir if ( pResMgr ) 123cdf0e10cSrcweir { 124cdf0e10cSrcweir aCopyrightTextStr = String( ResId( ABOUT_STR_COPYRIGHT, *pResMgr ) ); 125cdf0e10cSrcweir pDeveloperAry = new ResStringArray( ResId( ABOUT_STR_DEVELOPER_ARY, *pResMgr ) ); 126cdf0e10cSrcweir delete pResMgr; 127cdf0e10cSrcweir } 128cdf0e10cSrcweir 129cdf0e10cSrcweir rtl::OUString sProduct; 130cdf0e10cSrcweir utl::ConfigManager::GetDirectConfigProperty(utl::ConfigManager::PRODUCTNAME) >>= sProduct; 131cdf0e10cSrcweir 132cdf0e10cSrcweir // load image from module path 133cdf0e10cSrcweir aAppLogo = SfxApplication::GetApplicationLogo(); 134cdf0e10cSrcweir 135cdf0e10cSrcweir // Transparenter Font 136cdf0e10cSrcweir Font aFont = GetFont(); 137cdf0e10cSrcweir aFont.SetTransparent( sal_True ); 138cdf0e10cSrcweir SetFont( aFont ); 139cdf0e10cSrcweir 140cdf0e10cSrcweir // if necessary more info 141cdf0e10cSrcweir String sVersion = aVersionText.GetText(); 142cdf0e10cSrcweir sVersion.SearchAndReplaceAscii( "$(VER)", Application::GetDisplayName() ); 143cdf0e10cSrcweir aVersionText.SetText( sVersion ); 144cdf0e10cSrcweir 145cdf0e10cSrcweir // Initialisierung fuer Aufruf Entwickler 146cdf0e10cSrcweir if ( aAccelStr.Len() && ByteString(U2S(aAccelStr)).IsAlphaAscii() ) 147cdf0e10cSrcweir { 148cdf0e10cSrcweir Accelerator *pAccel = 0, *pPrevAccel = 0, *pFirstAccel = 0; 149cdf0e10cSrcweir aAccelStr.ToUpperAscii(); 150cdf0e10cSrcweir 151cdf0e10cSrcweir for ( sal_uInt16 i = 0; i < aAccelStr.Len(); ++i ) 152cdf0e10cSrcweir { 153cdf0e10cSrcweir pPrevAccel = pAccel; 154cdf0e10cSrcweir pAccel = new Accelerator; 155cdf0e10cSrcweir aAccelList.Insert( pAccel, LIST_APPEND ); 156cdf0e10cSrcweir sal_uInt16 nKey = aAccelStr.GetChar(i) - 'A' + KEY_A; 157cdf0e10cSrcweir pAccel->InsertItem( 1, KeyCode( nKey, KEY_MOD1 ) ); 158cdf0e10cSrcweir if ( i > 0 ) 159cdf0e10cSrcweir pPrevAccel->SetAccel( 1, pAccel ); 160cdf0e10cSrcweir if ( i == 0 ) 161cdf0e10cSrcweir pFirstAccel = pAccel; 162cdf0e10cSrcweir } 163cdf0e10cSrcweir pAccel->SetSelectHdl( LINK( this, AboutDialog, AccelSelectHdl ) ); 164cdf0e10cSrcweir GetpApp()->InsertAccel( pFirstAccel ); 165cdf0e10cSrcweir } 166cdf0e10cSrcweir 167cdf0e10cSrcweir // set for background and text the correct system color 168cdf0e10cSrcweir const StyleSettings& rSettings = GetSettings().GetStyleSettings(); 169cdf0e10cSrcweir Color aWhiteCol( rSettings.GetWindowColor() ); 170cdf0e10cSrcweir Wallpaper aWall( aWhiteCol ); 171cdf0e10cSrcweir SetBackground( aWall ); 172cdf0e10cSrcweir Font aNewFont( aCopyrightText.GetFont() ); 173cdf0e10cSrcweir aNewFont.SetTransparent( sal_True ); 174cdf0e10cSrcweir 175cdf0e10cSrcweir aVersionText.SetFont( aNewFont ); 176cdf0e10cSrcweir aCopyrightText.SetFont( aNewFont ); 177cdf0e10cSrcweir 178cdf0e10cSrcweir aVersionText.SetBackground(); 179cdf0e10cSrcweir aCopyrightText.SetBackground(); 180cdf0e10cSrcweir 181cdf0e10cSrcweir Color aTextColor( rSettings.GetWindowTextColor() ); 182cdf0e10cSrcweir aVersionText.SetControlForeground( aTextColor ); 183cdf0e10cSrcweir aCopyrightText.SetControlForeground( aTextColor ); 184*8bd5297cSJürgen Schmidt aBuildData.SetBackground( ); 185cdf0e10cSrcweir 186cdf0e10cSrcweir Font aSmallFont = rSettings.GetInfoFont(); 187cdf0e10cSrcweir Size aSmaller = aNewFont.GetSize(); 188cdf0e10cSrcweir aSmaller.Width() = (long) (aSmaller.Width() * 0.75); 189cdf0e10cSrcweir aSmaller.Height() = (long) (aSmaller.Height() * 0.75); 190cdf0e10cSrcweir aNewFont.SetSize( aSmaller ); 191cdf0e10cSrcweir aBuildData.SetFont( aNewFont ); 192*8bd5297cSJürgen Schmidt 193*8bd5297cSJürgen Schmidt String sRevision( utl::Bootstrap::getRevisionInfo() ); 194*8bd5297cSJürgen Schmidt 195*8bd5297cSJürgen Schmidt String aBuildString(aDevVersionStr); 196*8bd5297cSJürgen Schmidt aBuildString += (DEFINE_CONST_UNICODE(" - Rev. ")); 197*8bd5297cSJürgen Schmidt aBuildString += sRevision; 198*8bd5297cSJürgen Schmidt 199cdf0e10cSrcweir #ifdef BUILD_VER_STRING 200a392ac37SAriel Constenla-Haile #define _STRINGIFY(x) #x 201a392ac37SAriel Constenla-Haile #define STRINGIFY(x) _STRINGIFY(x) 202*8bd5297cSJürgen Schmidt aBuildString += '\n'; 203*8bd5297cSJürgen Schmidt aBuildString += ( DEFINE_CONST_UNICODE( STRINGIFY( BUILD_VER_STRING ) ) ); 204cdf0e10cSrcweir #endif 205cdf0e10cSrcweir aBuildData.SetText( aBuildString ); 206cdf0e10cSrcweir aBuildData.Show(); 207cdf0e10cSrcweir 208cdf0e10cSrcweir // determine size and position of the dialog & elements 209cdf0e10cSrcweir Size aAppLogoSiz = aAppLogo.GetSizePixel(); 210cdf0e10cSrcweir Size aOutSiz = GetOutputSizePixel(); 211cdf0e10cSrcweir aOutSiz.Width() = aAppLogoSiz.Width(); 212cdf0e10cSrcweir 213cdf0e10cSrcweir Size a6Size = aVersionText.LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); 214cdf0e10cSrcweir long nY = aAppLogoSiz.Height() + ( a6Size.Height() * 2 ); 215cdf0e10cSrcweir long nDlgMargin = a6Size.Width() * 4 ; 216cdf0e10cSrcweir long nCtrlMargin = a6Size.Height() * 2; 217cdf0e10cSrcweir long nTextWidth = aOutSiz.Width() - nDlgMargin; 218cdf0e10cSrcweir 219cdf0e10cSrcweir aCopyrightText.SetText( aCopyrightTextStr ); 220a392ac37SAriel Constenla-Haile 221a392ac37SAriel Constenla-Haile // layout fixed text controls 222cdf0e10cSrcweir layoutText( aVersionText, nY, nTextWidth, a6Size ); 223a392ac37SAriel Constenla-Haile if( aBuildString.Len() > 0 ) 224a392ac37SAriel Constenla-Haile { 225a392ac37SAriel Constenla-Haile nY += ( a6Size.Height() / 2 ); 226a392ac37SAriel Constenla-Haile layoutText( aBuildData, nY, nTextWidth, a6Size ); 227a392ac37SAriel Constenla-Haile } 228a392ac37SAriel Constenla-Haile nY += nCtrlMargin; 229a392ac37SAriel Constenla-Haile 230cdf0e10cSrcweir // OK-Button-Position (at the bottom and centered) 231cdf0e10cSrcweir Size aOKSiz = aOKButton.GetSizePixel(); 232cdf0e10cSrcweir Point aOKPnt = aOKButton.GetPosPixel(); 233cdf0e10cSrcweir 234cdf0e10cSrcweir // Multiline edit with Copyright-Text 235cdf0e10cSrcweir Point aCopyPnt = aCopyrightText.GetPosPixel(); 236cdf0e10cSrcweir Size aCopySize = aCopyrightText.GetSizePixel(); 237cdf0e10cSrcweir aCopySize.Width() = nTextWidth; 238cdf0e10cSrcweir aCopySize.Height() = aOutSiz.Height() - nY - ( aOKSiz.Height() * 2 ) - nCtrlMargin; 239cdf0e10cSrcweir 240cdf0e10cSrcweir aCopyPnt.X() = ( aOutSiz.Width() - aCopySize.Width() ) / 2; 241cdf0e10cSrcweir aCopyPnt.Y() = nY; 242cdf0e10cSrcweir aCopyrightText.SetPosSizePixel( aCopyPnt, aCopySize ); 243cdf0e10cSrcweir 244cdf0e10cSrcweir nY += aCopySize.Height() + nCtrlMargin; 245cdf0e10cSrcweir aOKPnt.X() = ( aOutSiz.Width() - aOKSiz.Width() ) / 2; 246cdf0e10cSrcweir aOKPnt.Y() = nY; 247cdf0e10cSrcweir aOKButton.SetPosPixel( aOKPnt ); 248cdf0e10cSrcweir 249cdf0e10cSrcweir // Change the width of the dialog 250cdf0e10cSrcweir SetOutputSizePixel( aOutSiz ); 251cdf0e10cSrcweir 252cdf0e10cSrcweir FreeResource(); 253cdf0e10cSrcweir 254cdf0e10cSrcweir SetHelpId( CMD_SID_ABOUT ); 255cdf0e10cSrcweir } 256cdf0e10cSrcweir 257cdf0e10cSrcweir // ----------------------------------------------------------------------- 258cdf0e10cSrcweir 259cdf0e10cSrcweir AboutDialog::~AboutDialog() 260cdf0e10cSrcweir { 261cdf0e10cSrcweir // L"oschen des Entwickleraufrufs 262cdf0e10cSrcweir delete pDeveloperAry; 263cdf0e10cSrcweir if ( aAccelList.Count() ) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir GetpApp()->RemoveAccel( aAccelList.First() ); 266cdf0e10cSrcweir Accelerator* pAccel = aAccelList.Last(); 267cdf0e10cSrcweir 268cdf0e10cSrcweir while ( pAccel ) 269cdf0e10cSrcweir { 270cdf0e10cSrcweir delete pAccel; 271cdf0e10cSrcweir pAccel = aAccelList.Prev(); 272cdf0e10cSrcweir } 273cdf0e10cSrcweir } 274cdf0e10cSrcweir } 275cdf0e10cSrcweir 276cdf0e10cSrcweir // ----------------------------------------------------------------------- 277cdf0e10cSrcweir 278cdf0e10cSrcweir IMPL_LINK( AboutDialog, TimerHdl, Timer *, pTimer ) 279cdf0e10cSrcweir { 280cdf0e10cSrcweir (void)pTimer; //unused 281cdf0e10cSrcweir ++m_nPendingScrolls; 282cdf0e10cSrcweir Invalidate( INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN ); 283cdf0e10cSrcweir return 0; 284cdf0e10cSrcweir } 285cdf0e10cSrcweir 286cdf0e10cSrcweir // ----------------------------------------------------------------------- 287cdf0e10cSrcweir 288cdf0e10cSrcweir IMPL_LINK( AboutDialog, AccelSelectHdl, Accelerator *, pAccelerator ) 289cdf0e10cSrcweir { 290cdf0e10cSrcweir #ifdef YURI_DARIO 291cdf0e10cSrcweir aCopyrightText.SetHelpText( DEFINE_CONST_UNICODE("Conoscere qualcuno ovunque egli sia, con cui comprendersi nonostante le distanze\n" 292cdf0e10cSrcweir "e le differenze, puo' trasformare la terra in un giardino. baci Valeria") ); 293cdf0e10cSrcweir #endif 294cdf0e10cSrcweir 295cdf0e10cSrcweir (void)pAccelerator; //unused 296cdf0e10cSrcweir // init Timer 297cdf0e10cSrcweir aTimer.SetTimeoutHdl( LINK( this, AboutDialog, TimerHdl ) ); 298cdf0e10cSrcweir 299cdf0e10cSrcweir // init scroll mode 300cdf0e10cSrcweir nOff = GetOutputSizePixel().Height(); 301cdf0e10cSrcweir MapMode aMapMode( MAP_PIXEL ); 302cdf0e10cSrcweir SetMapMode( aMapMode ); 303cdf0e10cSrcweir bNormal = sal_False; 304cdf0e10cSrcweir 305cdf0e10cSrcweir // start scroll Timer 306cdf0e10cSrcweir aTimer.SetTimeout( SCROLL_TIMER ); 307cdf0e10cSrcweir aTimer.Start(); 308cdf0e10cSrcweir return 0; 309cdf0e10cSrcweir } 310cdf0e10cSrcweir 311cdf0e10cSrcweir // ----------------------------------------------------------------------- 312cdf0e10cSrcweir 313cdf0e10cSrcweir sal_Bool AboutDialog::Close() 314cdf0e10cSrcweir { 315cdf0e10cSrcweir // stop Timer and finish the dialog 316cdf0e10cSrcweir aTimer.Stop(); 317cdf0e10cSrcweir EndDialog( RET_OK ); 318cdf0e10cSrcweir return( sal_False ); 319cdf0e10cSrcweir } 320cdf0e10cSrcweir 321cdf0e10cSrcweir // ----------------------------------------------------------------------- 322cdf0e10cSrcweir 323cdf0e10cSrcweir void AboutDialog::Paint( const Rectangle& rRect ) 324cdf0e10cSrcweir { 325cdf0e10cSrcweir SetClipRegion( rRect ); 326cdf0e10cSrcweir 327cdf0e10cSrcweir if ( bNormal ) // not in scroll mode 328cdf0e10cSrcweir { 329cdf0e10cSrcweir Point aPos( m_nDeltaWidth / 2, 0 ); 330cdf0e10cSrcweir DrawImage( aPos, aAppLogo ); 331cdf0e10cSrcweir return; 332cdf0e10cSrcweir } 333cdf0e10cSrcweir 334cdf0e10cSrcweir // scroll the content 335cdf0e10cSrcweir const int nDeltaY = -SCROLL_OFFSET * m_nPendingScrolls; 336cdf0e10cSrcweir if( !nDeltaY ) 337cdf0e10cSrcweir return; 338cdf0e10cSrcweir nOff += nDeltaY; 339cdf0e10cSrcweir Scroll( 0, nDeltaY, SCROLL_NOERASE ); 340cdf0e10cSrcweir m_nPendingScrolls = 0; 341cdf0e10cSrcweir 342cdf0e10cSrcweir // draw the credits text 343cdf0e10cSrcweir const Font aOrigFont = GetFont(); 344cdf0e10cSrcweir const int nFullWidth = GetOutputSizePixel().Width(); 345cdf0e10cSrcweir 346cdf0e10cSrcweir int nY = nOff; 347cdf0e10cSrcweir const int nDevCnt = static_cast<int>( pDeveloperAry->Count() ); 348cdf0e10cSrcweir for( int i = 0; i < nDevCnt; ++i ) 349cdf0e10cSrcweir { 350cdf0e10cSrcweir if( nY >= rRect.Bottom() ) 351cdf0e10cSrcweir break; 352cdf0e10cSrcweir 353cdf0e10cSrcweir int nPos2 = nY + GetTextHeight() + 3; 354cdf0e10cSrcweir if( nPos2 >= rRect.Top() + nDeltaY ) 355cdf0e10cSrcweir { 356cdf0e10cSrcweir const String aStr = pDeveloperAry->GetString(i); 357cdf0e10cSrcweir const long nVal = pDeveloperAry->GetValue(i); 358cdf0e10cSrcweir 359cdf0e10cSrcweir if ( nVal ) 360cdf0e10cSrcweir { 361cdf0e10cSrcweir // emphasize the headers 362cdf0e10cSrcweir Font aFont = aOrigFont; 363cdf0e10cSrcweir aFont.SetWeight( (FontWeight)nVal ); 364cdf0e10cSrcweir SetFont( aFont ); 365cdf0e10cSrcweir nPos2 = nY + GetTextHeight() + 3; 366cdf0e10cSrcweir } 367cdf0e10cSrcweir 368cdf0e10cSrcweir // clear text background 369cdf0e10cSrcweir Rectangle aEraseRect( Point(0,nY), Size( nFullWidth, nPos2-nY)); 370cdf0e10cSrcweir Erase( aEraseRect ); 371cdf0e10cSrcweir 372cdf0e10cSrcweir // draw centered text 373cdf0e10cSrcweir const long nTextWidth = GetTextWidth( aStr ); 374cdf0e10cSrcweir long nX = (nFullWidth - 5 - nTextWidth) / 2; 375cdf0e10cSrcweir if( nX < 0 ) 376cdf0e10cSrcweir nX = SPACE_OFFSET; 377cdf0e10cSrcweir const Point aPnt( nX, nY ); 378cdf0e10cSrcweir DrawText( aPnt, aStr ); 379cdf0e10cSrcweir 380cdf0e10cSrcweir // restore the font if needed 381cdf0e10cSrcweir if( nVal ) 382cdf0e10cSrcweir SetFont( aOrigFont ); 383cdf0e10cSrcweir } 384cdf0e10cSrcweir nY = nPos2; 385cdf0e10cSrcweir } 386cdf0e10cSrcweir 387cdf0e10cSrcweir // close dialog if the whole text has been scrolled 388cdf0e10cSrcweir if ( nY <= 0 ) 389cdf0e10cSrcweir { 390cdf0e10cSrcweir bNormal = sal_True; 391cdf0e10cSrcweir Close(); 392cdf0e10cSrcweir } 393cdf0e10cSrcweir } 394