diff options
Diffstat (limited to 'sfx2/source/dialog/about.cxx')
-rw-r--r-- | sfx2/source/dialog/about.cxx | 89 |
1 files changed, 53 insertions, 36 deletions
diff --git a/sfx2/source/dialog/about.cxx b/sfx2/source/dialog/about.cxx index 0d1ece34d4..e4bce1dc1b 100644 --- a/sfx2/source/dialog/about.cxx +++ b/sfx2/source/dialog/about.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -30,14 +31,8 @@ // include --------------------------------------------------------------- -#ifndef _SV_APP_HXX #include <vcl/svapp.hxx> -#endif -#ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> -#endif -#ifndef GCC -#endif #include <tools/stream.hxx> #include <tools/urlobj.hxx> @@ -57,16 +52,16 @@ #include <sfx2/sfxcommands.h> #include "dialog.hrc" +using namespace ::com::sun::star; + // defines --------------------------------------------------------------- #define SCROLL_OFFSET 1 #define SPACE_OFFSET 5 #define SCROLL_TIMER 30 -#define WELCOME_URL DEFINE_CONST_UNICODE( "http://www.openoffice.org/welcome/credits.html" ) - -// class AboutDialog ----------------------------------------------------- -static void layoutText( FixedInfo &rText, long &nY, long nTextWidth, Size a6Size ) +/** loads the application logo as used in the about dialog and impress slideshow pause screen */ +Image SfxApplication::GetApplicationLogo() { Point aTextPos = rText.GetPosPixel(); aTextPos.X() = a6Size.Width() * 2; @@ -180,10 +175,15 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS SetFont( aFont ); // if necessary more info - String sVersion = aVersionText.GetText(); + String sVersion = aVersionTextStr; sVersion.SearchAndReplaceAscii( "$(VER)", Application::GetDisplayName() ); sVersion += '\n'; sVersion += rVerStr; +#ifdef BUILD_VER_STRING + String aBuildString( DEFINE_CONST_UNICODE( BUILD_VER_STRING ) ); + sVersion += '\n'; + sVersion += aBuildString; +#endif aVersionText.SetText( sVersion ); // Initialisierung fuer Aufruf Entwickler @@ -196,7 +196,7 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS { pPrevAccel = pAccel; pAccel = new Accelerator; - aAccelList.Insert( pAccel, LIST_APPEND ); + aAccelList.push_back( pAccel ); USHORT nKey = aAccelStr.GetChar(i) - 'A' + KEY_A; pAccel->InsertItem( 1, KeyCode( nKey, KEY_MOD1 ) ); if ( i > 0 ) @@ -221,26 +221,15 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS aVersionText.SetBackground(); aCopyrightText.SetBackground(); + aInfoLink.SetURL( aLinkStr ); + aInfoLink.SetBackground(); + aInfoLink.SetClickHdl( LINK( this, AboutDialog, HandleHyperlink ) ); Color aTextColor( rSettings.GetWindowTextColor() ); aVersionText.SetControlForeground( aTextColor ); aCopyrightText.SetControlForeground( aTextColor ); - aBuildData.SetBackground( aWall ); - - Font aSmallFont = rSettings.GetInfoFont(); - Size aSmaller = aNewFont.GetSize(); - aSmaller.Width() = (long) (aSmaller.Width() * 0.75); - aSmaller.Height() = (long) (aSmaller.Height() * 0.75); - aNewFont.SetSize( aSmaller ); - aBuildData.SetFont( aNewFont ); - aBuildData.SetBackground( aWall ); -#ifdef BUILD_VER_STRING - String aBuildString( DEFINE_CONST_UNICODE( BUILD_VER_STRING ) ); -#else - String aBuildString; -#endif - aBuildData.SetText( aBuildString ); - aBuildData.Show(); + + aCopyrightText.SetText( aCopyrightTextStr ); // determine size and position of the dialog & elements Size aAppLogoSiz = aAppLogo.GetSizePixel(); @@ -290,16 +279,13 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS AboutDialog::~AboutDialog() { // L"oschen des Entwickleraufrufs - if ( aAccelList.Count() ) + if ( !aAccelList.empty() ) { - GetpApp()->RemoveAccel( aAccelList.First() ); - Accelerator* pAccel = aAccelList.Last(); + GetpApp()->RemoveAccel( aAccelList.front() ); - while ( pAccel ) - { - delete pAccel; - pAccel = aAccelList.Prev(); - } + for ( size_t i = 0, n = aAccelList.size(); i < n; ++i ) + delete aAccelList[ i ]; + aAccelList.clear(); } } @@ -340,6 +326,35 @@ IMPL_LINK( AboutDialog, AccelSelectHdl, Accelerator *, pAccelerator ) // ----------------------------------------------------------------------- +IMPL_LINK( AboutDialog, HandleHyperlink, svt::FixedHyperlink*, pHyperlink ) +{ + rtl::OUString sURL=pHyperlink->GetURL(); + rtl::OUString sTitle=GetText(); + + if ( ! sURL.getLength() ) // Nothing to do, when the URL is empty + return 1; + try + { + uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute( + ::comphelper::getProcessServiceFactory()->createInstance( + DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), uno::UNO_QUERY_THROW ); + xSystemShellExecute->execute( sURL, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::DEFAULTS ); + } + catch ( uno::Exception& ) + { + uno::Any exc( ::cppu::getCaughtException() ); + rtl::OUString msg( ::comphelper::anyToString( exc ) ); + const SolarMutexGuard guard; + ErrorBox aErrorBox( NULL, WB_OK, msg ); + aErrorBox.SetText( sTitle ); + aErrorBox.Execute(); + } + + return 1; +} + +// ----------------------------------------------------------------------- + BOOL AboutDialog::Close() { // stop Timer and finish the dialog @@ -421,3 +436,5 @@ void AboutDialog::Paint( const Rectangle& rRect ) Close(); } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |