about.cxx (8bd5297c) | about.cxx (23c0a6f8) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 31 unchanged lines hidden (view full) --- 40#include "about.hxx" 41#include <sfx2/sfxdefs.hxx> 42#include <sfx2/app.hxx> 43#include <sfx2/sfxcommands.h> 44#include "about.hrc" 45#include <dialmgr.hxx> 46#include <svtools/svtools.hrc> 47 | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 31 unchanged lines hidden (view full) --- 40#include "about.hxx" 41#include <sfx2/sfxdefs.hxx> 42#include <sfx2/app.hxx> 43#include <sfx2/sfxcommands.h> 44#include "about.hrc" 45#include <dialmgr.hxx> 46#include <svtools/svtools.hrc> 47 |
48#include <comphelper/processfactory.hxx> 49#include <com/sun/star/system/XSystemShellExecute.hpp> 50#include <com/sun/star/system/SystemShellExecuteFlags.hpp> 51 |
|
48// defines --------------------------------------------------------------- 49 | 52// defines --------------------------------------------------------------- 53 |
50#define SCROLL_OFFSET 1 51#define SPACE_OFFSET 5 52#define SCROLL_TIMER 30 | 54#define _STRINGIFY(x) #x 55#define STRINGIFY(x) _STRINGIFY(x) |
53 | 56 |
54#define WELCOME_URL DEFINE_CONST_UNICODE( "http://www.openoffice.org/welcome/credits.html" ) | 57// ----------------------------------------------------------------------- |
55 | 58 |
56// class AboutDialog ----------------------------------------------------- 57static void layoutText( FixedInfo &rText, long &nY, long nTextWidth, Size a6Size ) | 59static void layoutFixedText( FixedText &rControl, const Point& aPos, Size &aSize, const long nTextWidth ) |
58{ | 60{ |
59 Point aTextPos = rText.GetPosPixel(); 60 aTextPos.X() = a6Size.Width() * 2; 61 aTextPos.Y() = nY; 62 rText.SetPosPixel( aTextPos ); | 61 aSize = rControl.GetSizePixel(); 62 // change the width 63 aSize.Width() = nTextWidth; 64 // set Position and Size, to calculate the minimum size 65 // this will update the Height 66 rControl.SetPosSizePixel( aPos, aSize ); 67 aSize = rControl.CalcMinimumSize(); 68 // update the size with the right Height 69 rControl.SetSizePixel( aSize ); 70} |
63 | 71 |
64 Size aTxtSiz = rText.GetSizePixel(); 65 aTxtSiz.Width() = nTextWidth; 66 Size aCalcSize = rText.CalcMinimumSize( nTextWidth ); 67 aTxtSiz.Height() = aCalcSize.Height(); 68 rText.SetSizePixel( aTxtSiz ); 69 70 nY += aTxtSiz.Height(); | 72static void layoutEdit( Edit &rControl, const Point& aPos, Size &aSize, const long nTextWidth ) 73{ 74 aSize = rControl.GetSizePixel(); 75 // change the width 76 aSize.Width() = nTextWidth; 77 // set Position and Size, to calculate the minimum size 78 // this will update the Height 79 rControl.SetPosSizePixel( aPos, aSize ); 80 aSize = rControl.CalcMinimumSize(); 81 // update the size with the right Height 82 rControl.SetSizePixel( aSize ); |
71} 72 | 83} 84 |
73String InitDevVersionStr() | 85// ----------------------------------------------------------------------- 86 87AboutDialog::AboutDialog( Window* pParent, const ResId& rId ) : 88 SfxModalDialog( pParent, rId ), 89 maOKButton( this, ResId( RID_CUI_ABOUT_BTN_OK, *rId.GetResMgr() ) ), 90 maVersionText( this, ResId( RID_CUI_ABOUT_FTXT_VERSION, *rId.GetResMgr() ) ), 91 maBuildInfoEdit( this, ResId( RID_CUI_ABOUT_FTXT_BUILDDATA, *rId.GetResMgr() ) ), 92 maCopyrightEdit( this, ResId( RID_CUI_ABOUT_FTXT_COPYRIGHT, *rId.GetResMgr() ) ), 93 maCreditsLink( this, ResId( RID_CUI_ABOUT_FTXT_WELCOME_LINK, *rId.GetResMgr() ) ), 94 maCopyrightTextStr( ResId( RID_CUI_ABOUT_STR_COPYRIGHT, *rId.GetResMgr() ) ) |
74{ | 95{ |
75 String sDefault; 76 String sBuildId( utl::Bootstrap::getBuildIdData( sDefault ) ); 77 OSL_ENSURE( sBuildId.Len() > 0, "No BUILDID in bootstrap file" ); | 96 // load image from module path 97 maAppLogo = SfxApplication::GetApplicationLogo(); |
78 | 98 |
79 String sProductSource( utl::Bootstrap::getProductSource( sDefault ) ); 80 OSL_ENSURE( sProductSource.Len() > 0, "No ProductSource in bootstrap file" ); | 99 InitControls(); |
81 | 100 |
82 // the product source is something like "DEV300", where the 83 // build id is something like "300m12(Build:12345)". For better readability, 84 // strip the duplicate UPD ("300"). 85 if ( sProductSource.Len() ) 86 { 87 bool bMatchingUPD = 88 ( sProductSource.Len() >= 3 ) 89 && ( sBuildId.Len() >= 3 ) 90 && ( sProductSource.Copy( sProductSource.Len() - 3 ) == sBuildId.Copy( 0, 3 ) ); 91 OSL_ENSURE( bMatchingUPD, "BUILDID and ProductSource do not match in their UPD" ); 92 if ( bMatchingUPD ) 93 sProductSource = sProductSource.Copy( 0, sProductSource.Len() - 3 ); | 101 // set links 102 maCreditsLink.SetClickHdl( LINK( this, AboutDialog, OpenLinkHdl_Impl ) ); |
94 | 103 |
95 // prepend the product source 96 sBuildId.Insert( sProductSource, 0 ); 97 } 98 99 return sBuildId; | 104 FreeResource(); 105 106 SetHelpId( CMD_SID_ABOUT ); |
100} 101 | 107} 108 |
102AboutDialog::AboutDialog( Window* pParent, const ResId& rId ) : | 109// ----------------------------------------------------------------------- |
103 | 110 |
104 SfxModalDialog ( pParent, rId ), 105 106 aOKButton ( this, ResId( ABOUT_BTN_OK, *rId.GetResMgr() ) ), 107 aVersionText ( this, ResId( ABOUT_FTXT_VERSION, *rId.GetResMgr() ) ), 108 aCopyrightText ( this, ResId( ABOUT_FTXT_COPYRIGHT, *rId.GetResMgr() ) ), 109 aBuildData ( this ), 110 pDeveloperAry(0), 111 aAccelStr ( ResId( ABOUT_STR_ACCEL, *rId.GetResMgr() ) ), 112 aTimer (), 113 nOff ( 0 ), 114 m_nDeltaWidth ( 0 ), 115 m_nPendingScrolls( 0 ), 116 bNormal ( sal_True ) | 111AboutDialog::~AboutDialog() |
117{ | 112{ |
118 aDevVersionStr = InitDevVersionStr(); | 113} |
119 | 114 |
120 ::com::sun::star::lang::Locale aLocale; 121 ResMgr* pResMgr = ResMgr::SearchCreateResMgr( "about", aLocale ); 122 if ( pResMgr ) 123 { 124 aCopyrightTextStr = String( ResId( ABOUT_STR_COPYRIGHT, *pResMgr ) ); 125 pDeveloperAry = new ResStringArray( ResId( ABOUT_STR_DEVELOPER_ARY, *pResMgr ) ); 126 delete pResMgr; 127 } | 115// ----------------------------------------------------------------------- |
128 | 116 |
129 rtl::OUString sProduct; 130 utl::ConfigManager::GetDirectConfigProperty(utl::ConfigManager::PRODUCTNAME) >>= sProduct; | 117void AboutDialog::InitControls() 118{ 119 // apply font, background et al. 120 ApplyStyleSettings(); |
131 | 121 |
132 // load image from module path 133 aAppLogo = SfxApplication::GetApplicationLogo(); | 122 // set strings 123 maCopyrightEdit.SetText( maCopyrightTextStr ); 124 maBuildInfoEdit.SetText( GetBuildVersionString() ); 125 maCreditsLink.SetURL( maCreditsLink.GetText() ); |
134 | 126 |
135 // Transparenter Font 136 Font aFont = GetFont(); 137 aFont.SetTransparent( sal_True ); 138 SetFont( aFont ); | 127 // determine size and position of the dialog & elements 128 Size aDlgSize; 129 LayoutControls( aDlgSize ); |
139 | 130 |
140 // if necessary more info 141 String sVersion = aVersionText.GetText(); 142 sVersion.SearchAndReplaceAscii( "$(VER)", Application::GetDisplayName() ); 143 aVersionText.SetText( sVersion ); | 131 // Change the width of the dialog 132 SetOutputSizePixel( aDlgSize ); 133} |
144 | 134 |
145 // Initialisierung fuer Aufruf Entwickler 146 if ( aAccelStr.Len() && ByteString(U2S(aAccelStr)).IsAlphaAscii() ) 147 { 148 Accelerator *pAccel = 0, *pPrevAccel = 0, *pFirstAccel = 0; 149 aAccelStr.ToUpperAscii(); | 135// ----------------------------------------------------------------------- |
150 | 136 |
151 for ( sal_uInt16 i = 0; i < aAccelStr.Len(); ++i ) 152 { 153 pPrevAccel = pAccel; 154 pAccel = new Accelerator; 155 aAccelList.Insert( pAccel, LIST_APPEND ); 156 sal_uInt16 nKey = aAccelStr.GetChar(i) - 'A' + KEY_A; 157 pAccel->InsertItem( 1, KeyCode( nKey, KEY_MOD1 ) ); 158 if ( i > 0 ) 159 pPrevAccel->SetAccel( 1, pAccel ); 160 if ( i == 0 ) 161 pFirstAccel = pAccel; 162 } 163 pAccel->SetSelectHdl( LINK( this, AboutDialog, AccelSelectHdl ) ); 164 GetpApp()->InsertAccel( pFirstAccel ); 165 } | 137void AboutDialog::ApplyStyleSettings() 138{ 139 // Transparenter Font 140 Font aFont = GetFont(); 141 aFont.SetTransparent( sal_True ); 142 SetFont( aFont ); |
166 | 143 |
167 // set for background and text the correct system color 168 const StyleSettings& rSettings = GetSettings().GetStyleSettings(); 169 Color aWhiteCol( rSettings.GetWindowColor() ); 170 Wallpaper aWall( aWhiteCol ); 171 SetBackground( aWall ); 172 Font aNewFont( aCopyrightText.GetFont() ); 173 aNewFont.SetTransparent( sal_True ); | 144 // set for background and text the correct system color 145 const StyleSettings& rSettings = GetSettings().GetStyleSettings(); 146 Color aWhiteCol( rSettings.GetWindowColor() ); 147 Wallpaper aWall( aWhiteCol ); 148 SetBackground( aWall ); 149 Font aNewFont( maCopyrightEdit.GetFont() ); 150 aNewFont.SetTransparent( sal_True ); |
174 | 151 |
175 aVersionText.SetFont( aNewFont ); 176 aCopyrightText.SetFont( aNewFont ); | 152 maVersionText.SetFont( aNewFont ); 153 maCopyrightEdit.SetFont( aNewFont ); |
177 | 154 |
178 aVersionText.SetBackground(); 179 aCopyrightText.SetBackground(); | 155 maVersionText.SetBackground(); 156 maCopyrightEdit.SetBackground(); 157 maBuildInfoEdit.SetBackground(); 158 maCreditsLink.SetBackground(); |
180 | 159 |
181 Color aTextColor( rSettings.GetWindowTextColor() ); 182 aVersionText.SetControlForeground( aTextColor ); 183 aCopyrightText.SetControlForeground( aTextColor ); 184 aBuildData.SetBackground( ); | 160 Color aTextColor( rSettings.GetWindowTextColor() ); 161 maVersionText.SetControlForeground( aTextColor ); 162 maCopyrightEdit.SetControlForeground( aTextColor ); 163 maBuildInfoEdit.SetControlForeground( aTextColor ); 164 maCreditsLink.SetControlForeground(); |
185 | 165 |
186 Font aSmallFont = rSettings.GetInfoFont(); 187 Size aSmaller = aNewFont.GetSize(); 188 aSmaller.Width() = (long) (aSmaller.Width() * 0.75); 189 aSmaller.Height() = (long) (aSmaller.Height() * 0.75); 190 aNewFont.SetSize( aSmaller ); 191 aBuildData.SetFont( aNewFont ); | 166 Size aSmaller = aNewFont.GetSize(); 167 aSmaller.Width() = (long) (aSmaller.Width() * 0.75); 168 aSmaller.Height() = (long) (aSmaller.Height() * 0.75); 169 aNewFont.SetSize( aSmaller ); |
192 | 170 |
193 String sRevision( utl::Bootstrap::getRevisionInfo() ); | 171 maBuildInfoEdit.SetFont( aNewFont ); |
194 | 172 |
195 String aBuildString(aDevVersionStr); 196 aBuildString += (DEFINE_CONST_UNICODE(" - Rev. ")); 197 aBuildString += sRevision; | 173 // the following is a hack to force the MultiLineEdit update its settings 174 // in order to reflect the Font 175 // See 176 // Window::SetControlFont 177 // MultiLineEdit::StateChanged 178 // MultiLineEdit::ImplInitSettings 179 // TODO Override SetFont in MultiLineEdit and do the following, 180 // otherwise SetFont has no effect at all! 181 aSmaller = PixelToLogic( aSmaller, MAP_POINT ); 182 aNewFont.SetSize( aSmaller ); 183 maBuildInfoEdit.SetControlFont( aNewFont ); 184} |
198 | 185 |
199#ifdef BUILD_VER_STRING 200#define _STRINGIFY(x) #x 201#define STRINGIFY(x) _STRINGIFY(x) 202 aBuildString += '\n'; 203 aBuildString += ( DEFINE_CONST_UNICODE( STRINGIFY( BUILD_VER_STRING ) ) ); 204#endif 205 aBuildData.SetText( aBuildString ); 206 aBuildData.Show(); | 186// ----------------------------------------------------------------------- |
207 | 187 |
208 // determine size and position of the dialog & elements 209 Size aAppLogoSiz = aAppLogo.GetSizePixel(); 210 Size aOutSiz = GetOutputSizePixel(); 211 aOutSiz.Width() = aAppLogoSiz.Width(); | 188void AboutDialog::LayoutControls( Size& aDlgSize ) 189{ 190 Size aAppLogoSiz = maAppLogo.GetSizePixel(); |
212 | 191 |
213 Size a6Size = aVersionText.LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); | 192 aDlgSize = GetOutputSizePixel(); 193 aDlgSize.Width() = aAppLogoSiz.Width(); 194 195 Size a6Size = maVersionText.LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); |
214 long nY = aAppLogoSiz.Height() + ( a6Size.Height() * 2 ); | 196 long nY = aAppLogoSiz.Height() + ( a6Size.Height() * 2 ); |
215 long nDlgMargin = a6Size.Width() * 4 ; | 197 long nDlgMargin = a6Size.Width() * 2; |
216 long nCtrlMargin = a6Size.Height() * 2; | 198 long nCtrlMargin = a6Size.Height() * 2; |
217 long nTextWidth = aOutSiz.Width() - nDlgMargin; | 199 long nTextWidth = aDlgSize.Width() - ( nDlgMargin * 2 ); |
218 | 200 |
219 aCopyrightText.SetText( aCopyrightTextStr ); | 201 Point aPos( nDlgMargin, nY ); 202 Size aSize; 203 // layout fixed text control 204 layoutFixedText( maVersionText, aPos, aSize, nTextWidth ); 205 // set the next control closer 206 nY += aSize.Height() + (nCtrlMargin / 2); |
220 | 207 |
221 // layout fixed text controls 222 layoutText( aVersionText, nY, nTextWidth, a6Size ); 223 if( aBuildString.Len() > 0 ) 224 { 225 nY += ( a6Size.Height() / 2 ); 226 layoutText( aBuildData, nY, nTextWidth, a6Size ); 227 } 228 nY += nCtrlMargin; | 208 // Multiline edit with Build info 209 aPos.Y() = nY; 210 layoutEdit( maBuildInfoEdit, aPos, aSize, nTextWidth ); 211 nY += aSize.Height() + nCtrlMargin; |
229 | 212 |
230 // OK-Button-Position (at the bottom and centered) 231 Size aOKSiz = aOKButton.GetSizePixel(); 232 Point aOKPnt = aOKButton.GetPosPixel(); 233 | |
234 // Multiline edit with Copyright-Text | 213 // Multiline edit with Copyright-Text |
235 Point aCopyPnt = aCopyrightText.GetPosPixel(); 236 Size aCopySize = aCopyrightText.GetSizePixel(); 237 aCopySize.Width() = nTextWidth; 238 aCopySize.Height() = aOutSiz.Height() - nY - ( aOKSiz.Height() * 2 ) - nCtrlMargin; | 214 aPos.Y() = nY; 215 layoutEdit( maCopyrightEdit, aPos, aSize, nTextWidth ); 216 // set the next control closer 217 nY += aSize.Height() + (nCtrlMargin/2); |
239 | 218 |
240 aCopyPnt.X() = ( aOutSiz.Width() - aCopySize.Width() ) / 2; 241 aCopyPnt.Y() = nY; 242 aCopyrightText.SetPosSizePixel( aCopyPnt, aCopySize ); | 219 // Hyperlink 220 aPos.Y() = nY; 221 layoutFixedText( maCreditsLink, aPos, aSize, nTextWidth ); 222 nY += aSize.Height() + nCtrlMargin; |
243 | 223 |
244 nY += aCopySize.Height() + nCtrlMargin; 245 aOKPnt.X() = ( aOutSiz.Width() - aOKSiz.Width() ) / 2; 246 aOKPnt.Y() = nY; 247 aOKButton.SetPosPixel( aOKPnt ); | 224 // OK-Button-Position (at the bottom and centered) 225 Size aOKSiz = maOKButton.GetSizePixel(); 226 Point aOKPnt( ( aDlgSize.Width() - aOKSiz.Width() ) / 2, nY ); 227 maOKButton.SetPosPixel( aOKPnt ); |
248 | 228 |
249 // Change the width of the dialog 250 SetOutputSizePixel( aOutSiz ); 251 252 FreeResource(); 253 254 SetHelpId( CMD_SID_ABOUT ); | 229 aDlgSize.Height() = aOKPnt.Y() + aOKSiz.Height() + nCtrlMargin; |
255} 256 257// ----------------------------------------------------------------------- 258 | 230} 231 232// ----------------------------------------------------------------------- 233 |
259AboutDialog::~AboutDialog() | 234const rtl::OUString AboutDialog::GetBuildId() const |
260{ | 235{ |
261 // L"oschen des Entwickleraufrufs 262 delete pDeveloperAry; 263 if ( aAccelList.Count() ) 264 { 265 GetpApp()->RemoveAccel( aAccelList.First() ); 266 Accelerator* pAccel = aAccelList.Last(); | 236 rtl::OUString sDefault; |
267 | 237 |
268 while ( pAccel ) 269 { 270 delete pAccel; 271 pAccel = aAccelList.Prev(); 272 } 273 } 274} | 238 // Get buildid from version[rc|.ini] 239 rtl::OUString sBuildId( utl::Bootstrap::getBuildIdData( sDefault ) ); 240 OSL_ENSURE( sBuildId.getLength() > 0, "No BUILDID in bootstrap file" ); 241 rtl::OUStringBuffer sBuildIdBuff( sBuildId ); |
275 | 242 |
276// ----------------------------------------------------------------------- | 243 // Get ProductSource from version[rc|.ini] 244 rtl::OUString sProductSource( utl::Bootstrap::getProductSource( sDefault ) ); 245 OSL_ENSURE( sProductSource.getLength() > 0, "No ProductSource in bootstrap file" ); |
277 | 246 |
278IMPL_LINK( AboutDialog, TimerHdl, Timer *, pTimer ) 279{ 280 (void)pTimer; //unused 281 ++m_nPendingScrolls; 282 Invalidate( INVALIDATE_NOERASE | INVALIDATE_NOCHILDREN ); 283 return 0; | 247 // the product source is something like "AOO340", 248 // while the build id is something like "340m1(Build:9590)" 249 // For better readability, strip the duplicate ProductMajor ("340"). 250 if ( sProductSource.getLength() ) 251 { 252 bool bMatchingUPD = 253 ( sProductSource.getLength() >= 3 ) 254 && ( sBuildId.getLength() >= 3 ) 255 && ( sProductSource.copy( sProductSource.getLength() - 3 ) == sBuildId.copy( 0, 3 ) ); 256 OSL_ENSURE( bMatchingUPD, "BUILDID and ProductSource do not match in their UPD" ); 257 if ( bMatchingUPD ) 258 sProductSource = sProductSource.copy( 0, sProductSource.getLength() - 3 ); 259 260 // prepend the product source 261 sBuildIdBuff.insert( 0, sProductSource ); 262 } 263 264 return sBuildIdBuff.makeStringAndClear(); |
284} 285 286// ----------------------------------------------------------------------- 287 | 265} 266 267// ----------------------------------------------------------------------- 268 |
288IMPL_LINK( AboutDialog, AccelSelectHdl, Accelerator *, pAccelerator ) | 269const rtl::OUString AboutDialog::GetBuildVersionString() const |
289{ | 270{ |
290#ifdef YURI_DARIO 291 aCopyrightText.SetHelpText( DEFINE_CONST_UNICODE("Conoscere qualcuno ovunque egli sia, con cui comprendersi nonostante le distanze\n" 292 "e le differenze, puo' trasformare la terra in un giardino. baci Valeria") ); 293#endif | 271 rtl::OUStringBuffer aBuildString( GetBuildId() ); 272 rtl::OUString sRevision( utl::Bootstrap::getRevisionInfo() ); |
294 | 273 |
295 (void)pAccelerator; //unused 296 // init Timer 297 aTimer.SetTimeoutHdl( LINK( this, AboutDialog, TimerHdl ) ); | 274 if ( sRevision.getLength() > 0 ) 275 { 276 aBuildString.appendAscii( RTL_CONSTASCII_STRINGPARAM( " - Rev. " ) ); 277 aBuildString.append( sRevision ); 278 } |
298 | 279 |
299 // init scroll mode 300 nOff = GetOutputSizePixel().Height(); 301 MapMode aMapMode( MAP_PIXEL ); 302 SetMapMode( aMapMode ); 303 bNormal = sal_False; | 280#ifdef BUILD_VER_STRING 281 rtl::OUString sBuildVer( RTL_CONSTASCII_USTRINGPARAM( STRINGIFY( BUILD_VER_STRING ) ) ); 282 if ( sBuildVer.getLength() > 0 ) 283 { 284 aBuildString.append( sal_Unicode( '\n' ) ); 285 aBuildString.append( sBuildVer ); 286 } 287#endif |
304 | 288 |
305 // start scroll Timer 306 aTimer.SetTimeout( SCROLL_TIMER ); 307 aTimer.Start(); 308 return 0; | 289 return aBuildString.makeStringAndClear(); |
309} 310 311// ----------------------------------------------------------------------- 312 313sal_Bool AboutDialog::Close() 314{ | 290} 291 292// ----------------------------------------------------------------------- 293 294sal_Bool AboutDialog::Close() 295{ |
315 // stop Timer and finish the dialog 316 aTimer.Stop(); 317 EndDialog( RET_OK ); 318 return( sal_False ); | 296 EndDialog( RET_OK ); 297 return( sal_False ); |
319} 320 321// ----------------------------------------------------------------------- 322 323void AboutDialog::Paint( const Rectangle& rRect ) 324{ | 298} 299 300// ----------------------------------------------------------------------- 301 302void AboutDialog::Paint( const Rectangle& rRect ) 303{ |
325 SetClipRegion( rRect ); | 304 SetClipRegion( rRect ); 305 Point aPos( 0, 0 ); 306 DrawImage( aPos, maAppLogo ); |
326 | 307 |
327 if ( bNormal ) // not in scroll mode 328 { 329 Point aPos( m_nDeltaWidth / 2, 0 ); 330 DrawImage( aPos, aAppLogo ); 331 return; 332 } | 308 return; 309} |
333 | 310 |
334 // scroll the content 335 const int nDeltaY = -SCROLL_OFFSET * m_nPendingScrolls; 336 if( !nDeltaY ) 337 return; 338 nOff += nDeltaY; 339 Scroll( 0, nDeltaY, SCROLL_NOERASE ); 340 m_nPendingScrolls = 0; | 311// ----------------------------------------------------------------------- |
341 | 312 |
342 // draw the credits text 343 const Font aOrigFont = GetFont(); 344 const int nFullWidth = GetOutputSizePixel().Width(); 345 346 int nY = nOff; 347 const int nDevCnt = static_cast<int>( pDeveloperAry->Count() ); 348 for( int i = 0; i < nDevCnt; ++i ) 349 { 350 if( nY >= rRect.Bottom() ) 351 break; 352 353 int nPos2 = nY + GetTextHeight() + 3; 354 if( nPos2 >= rRect.Top() + nDeltaY ) 355 { 356 const String aStr = pDeveloperAry->GetString(i); 357 const long nVal = pDeveloperAry->GetValue(i); 358 359 if ( nVal ) 360 { 361 // emphasize the headers 362 Font aFont = aOrigFont; 363 aFont.SetWeight( (FontWeight)nVal ); 364 SetFont( aFont ); 365 nPos2 = nY + GetTextHeight() + 3; 366 } 367 368 // clear text background 369 Rectangle aEraseRect( Point(0,nY), Size( nFullWidth, nPos2-nY)); 370 Erase( aEraseRect ); 371 372 // draw centered text 373 const long nTextWidth = GetTextWidth( aStr ); 374 long nX = (nFullWidth - 5 - nTextWidth) / 2; 375 if( nX < 0 ) 376 nX = SPACE_OFFSET; 377 const Point aPnt( nX, nY ); 378 DrawText( aPnt, aStr ); 379 380 // restore the font if needed 381 if( nVal ) 382 SetFont( aOrigFont ); 383 } 384 nY = nPos2; 385 } 386 387 // close dialog if the whole text has been scrolled 388 if ( nY <= 0 ) 389 { 390 bNormal = sal_True; 391 Close(); 392 } | 313IMPL_LINK ( AboutDialog, OpenLinkHdl_Impl, svt::FixedHyperlink*, EMPTYARG ) 314{ 315 ::rtl::OUString sURL( maCreditsLink.GetURL() ); 316 if ( sURL.getLength() > 0 ) 317 { 318 try 319 { 320 com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xSMGR = 321 ::comphelper::getProcessServiceFactory(); 322 com::sun::star::uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShell( 323 xSMGR->createInstance( ::rtl::OUString( 324 RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ), 325 com::sun::star::uno::UNO_QUERY_THROW ); 326 if ( xSystemShell.is() ) 327 xSystemShell->execute( sURL, ::rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS ); 328 } 329 catch( const com::sun::star::uno::Exception& e ) 330 { 331 OSL_TRACE( "Caught exception: %s\n thread terminated.\n", 332 rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); 333 } 334 } 335 return 0; |
393} | 336} |