2011-04-04 18:02:18 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-01-12 11:56:09 +01:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
*
|
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
|
|
|
*
|
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
|
|
|
*
|
|
|
|
* This file is part of OpenOffice.org.
|
|
|
|
*
|
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#include <vcl/msgbox.hxx>
|
2011-04-04 18:02:18 +01:00
|
|
|
|
2011-01-12 11:56:09 +01:00
|
|
|
#include <tools/stream.hxx>
|
|
|
|
#include <rtl/bootstrap.hxx>
|
|
|
|
#include <unotools/configmgr.hxx>
|
|
|
|
#include <unotools/bootstrap.hxx>
|
|
|
|
#include <com/sun/star/uno/Any.h>
|
|
|
|
#include <vcl/graph.hxx>
|
|
|
|
#include <svtools/filter.hxx>
|
2012-07-12 15:03:51 +02:00
|
|
|
#include <svtools/langhelp.hxx>
|
2011-04-04 18:02:18 +01:00
|
|
|
|
|
|
|
#include "com/sun/star/system/SystemShellExecuteFlags.hpp"
|
|
|
|
#include "com/sun/star/system/XSystemShellExecute.hpp"
|
|
|
|
#include <comphelper/processfactory.hxx>
|
|
|
|
#include "comphelper/anytostring.hxx"
|
|
|
|
#include "cppuhelper/exc_hlp.hxx"
|
|
|
|
#include "cppuhelper/bootstrap.hxx"
|
|
|
|
|
2011-01-12 11:56:09 +01:00
|
|
|
#include <sfx2/sfxuno.hxx>
|
2011-04-04 18:02:18 +01:00
|
|
|
#include <sfx2/sfxcommands.h>
|
2011-01-12 11:56:09 +01:00
|
|
|
#include "about.hxx"
|
2011-04-04 18:02:18 +01:00
|
|
|
#include "about.hrc"
|
2011-01-12 11:56:09 +01:00
|
|
|
#include <sfx2/sfxdefs.hxx>
|
|
|
|
#include <sfx2/app.hxx>
|
2011-08-01 21:57:42 +01:00
|
|
|
#include <rtl/ustrbuf.hxx>
|
2012-04-10 12:43:48 +01:00
|
|
|
#include <vcl/bitmap.hxx>
|
|
|
|
#include <vcl/rendergraphicrasterizer.hxx>
|
2012-07-12 16:19:37 +02:00
|
|
|
#include <officecfg/Office/Common.hxx>
|
2011-04-04 18:02:18 +01:00
|
|
|
|
2012-07-12 15:03:51 +02:00
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::beans;
|
2011-04-04 18:02:18 +01:00
|
|
|
using namespace ::com::sun::star;
|
2011-01-12 11:56:09 +01:00
|
|
|
|
2012-04-10 12:43:48 +01:00
|
|
|
enum AboutDialogButton
|
2011-01-12 11:56:09 +01:00
|
|
|
{
|
2012-04-10 12:43:48 +01:00
|
|
|
CREDITS_BUTTON,
|
2012-06-07 23:50:37 +02:00
|
|
|
WEBSITE_BUTTON
|
2012-04-10 12:43:48 +01:00
|
|
|
};
|
2011-01-12 11:56:09 +01:00
|
|
|
|
2011-04-04 18:02:18 +01:00
|
|
|
AboutDialog::AboutDialog( Window* pParent, const ResId& rId) :
|
2012-04-10 12:43:48 +01:00
|
|
|
SfxModalDialog ( pParent, rId ),
|
|
|
|
aVersionText ( this, ResId( ABOUT_VERSION_TEXT, *rId.GetResMgr() ) ),
|
|
|
|
aDescriptionText ( this, ResId( ABOUT_DESCRIPTION_TEXT, *rId.GetResMgr() ) ),
|
|
|
|
aCopyrightText ( this, ResId( ABOUT_COPYRIGHT_TEXT, *rId.GetResMgr() ) ),
|
2012-07-13 15:36:28 +02:00
|
|
|
aLogoImage ( this ),
|
2012-07-20 12:22:04 +02:00
|
|
|
aLogoReplacement ( this, ResId( ABOUT_LOGO_REPLACEMENT, *rId.GetResMgr() ) ),
|
2012-04-10 12:43:48 +01:00
|
|
|
aCreditsButton ( this, ResId( ABOUT_BTN_CREDITS, *rId.GetResMgr() ) ),
|
2012-06-13 22:45:06 +02:00
|
|
|
aWebsiteButton ( this, ResId( ABOUT_BTN_WEBSITE, *rId.GetResMgr() ) ),
|
2012-04-16 16:43:39 +01:00
|
|
|
aCancelButton ( this, ResId( ABOUT_BTN_CANCEL, *rId.GetResMgr() ) ),
|
2012-04-29 23:36:57 +01:00
|
|
|
m_aVersionTextStr(ResId(ABOUT_STR_VERSION, *rId.GetResMgr()).toString().trim()),
|
2011-08-01 21:57:42 +01:00
|
|
|
m_aVendorTextStr(ResId(ABOUT_STR_VENDOR, *rId.GetResMgr())),
|
2012-04-10 12:43:48 +01:00
|
|
|
m_aCopyrightTextStr(ResId(ABOUT_STR_COPYRIGHT, *rId.GetResMgr())),
|
|
|
|
m_aBasedTextStr(ResId(ABOUT_STR_BASED, *rId.GetResMgr())),
|
|
|
|
m_aBasedDerivedTextStr(ResId(ABOUT_STR_BASED_DERIVED, *rId.GetResMgr())),
|
|
|
|
m_aCreditsLinkStr(ResId( ABOUT_STR_LINK_CREDITS, *rId.GetResMgr())),
|
2012-04-29 23:36:57 +01:00
|
|
|
m_sBuildStr(ResId(ABOUT_STR_BUILD, *rId.GetResMgr())),
|
2012-04-10 12:43:48 +01:00
|
|
|
m_aDescriptionTextStr(ResId(ABOUT_STR_DESCRIPTION, *rId.GetResMgr()))
|
2011-01-12 11:56:09 +01:00
|
|
|
{
|
2012-04-10 12:43:48 +01:00
|
|
|
// Populate text items
|
2012-07-20 12:22:04 +02:00
|
|
|
aLogoReplacement.SetText ( utl::ConfigManager::getProductName() );
|
|
|
|
|
2012-04-10 12:43:48 +01:00
|
|
|
aVersionText.SetText( GetVersionString() );
|
|
|
|
|
|
|
|
aDescriptionText.SetText( m_aDescriptionTextStr );
|
|
|
|
|
|
|
|
rtl::OUString aCopyrightString = GetCopyrightString();
|
|
|
|
aCopyrightText.SetText( aCopyrightString );
|
|
|
|
|
|
|
|
StyleControls();
|
|
|
|
LayoutControls();
|
|
|
|
|
|
|
|
// Allow the button to be identifiable once they are clicked
|
|
|
|
aCreditsButton.SetData( (void*)CREDITS_BUTTON );
|
2012-06-07 23:50:37 +02:00
|
|
|
aWebsiteButton.SetData( (void*)WEBSITE_BUTTON );
|
2012-04-10 12:43:48 +01:00
|
|
|
|
|
|
|
// Connect all handlers
|
|
|
|
aCreditsButton.SetClickHdl( LINK( this, AboutDialog, HandleClick ) );
|
2012-06-07 23:50:37 +02:00
|
|
|
aWebsiteButton.SetClickHdl( LINK( this, AboutDialog, HandleClick ) );
|
2011-01-12 11:56:09 +01:00
|
|
|
|
2012-04-16 16:43:39 +01:00
|
|
|
aCancelButton.SetClickHdl( LINK( this, AboutDialog, CancelHdl ) );
|
|
|
|
|
2011-01-12 11:56:09 +01:00
|
|
|
FreeResource();
|
|
|
|
|
2011-04-04 18:02:18 +01:00
|
|
|
// explicit Help-Id
|
2011-01-12 11:56:09 +01:00
|
|
|
SetHelpId( CMD_SID_ABOUT );
|
|
|
|
}
|
|
|
|
|
2012-04-10 12:43:48 +01:00
|
|
|
IMPL_LINK( AboutDialog, HandleClick, PushButton*, pButton )
|
2012-03-09 09:16:47 +00:00
|
|
|
{
|
2012-04-10 12:43:48 +01:00
|
|
|
rtl::OUString sURL = "";
|
|
|
|
|
|
|
|
// Find which button was pressed and from this, get the URL to be opened
|
|
|
|
AboutDialogButton* pDialogButton = (AboutDialogButton*)pButton->GetData();
|
|
|
|
if ( pDialogButton == (AboutDialogButton*)CREDITS_BUTTON )
|
|
|
|
sURL = m_aCreditsLinkStr;
|
2012-06-07 23:50:37 +02:00
|
|
|
else if ( pDialogButton == (AboutDialogButton*)WEBSITE_BUTTON )
|
2012-07-12 15:03:51 +02:00
|
|
|
{
|
2012-07-12 16:19:37 +02:00
|
|
|
sURL = officecfg::Office::Common::Help::StartCenter::InfoURL::get();
|
|
|
|
localizeWebserviceURI(sURL);
|
2012-07-12 15:03:51 +02:00
|
|
|
}
|
2012-04-10 12:43:48 +01:00
|
|
|
|
|
|
|
// If the URL is empty, don't do anything
|
|
|
|
if ( sURL.isEmpty() )
|
2011-04-04 18:02:18 +01:00
|
|
|
return 1;
|
|
|
|
try
|
|
|
|
{
|
2012-07-12 15:03:51 +02:00
|
|
|
Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
|
2011-04-04 18:02:18 +01:00
|
|
|
::comphelper::getProcessServiceFactory()->createInstance(
|
2012-07-12 15:03:51 +02:00
|
|
|
DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), UNO_QUERY_THROW );
|
2012-04-10 12:43:48 +01:00
|
|
|
xSystemShellExecute->execute( sURL, rtl::OUString(),
|
|
|
|
com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY );
|
2011-04-04 18:02:18 +01:00
|
|
|
}
|
2012-07-12 15:03:51 +02:00
|
|
|
catch (const Exception&)
|
2011-04-04 18:02:18 +01:00
|
|
|
{
|
2012-07-12 15:03:51 +02:00
|
|
|
Any exc( ::cppu::getCaughtException() );
|
2011-04-04 18:02:18 +01:00
|
|
|
rtl::OUString msg( ::comphelper::anyToString( exc ) );
|
|
|
|
const SolarMutexGuard guard;
|
|
|
|
ErrorBox aErrorBox( NULL, WB_OK, msg );
|
2012-04-10 12:43:48 +01:00
|
|
|
aErrorBox.SetText( GetText() );
|
2011-04-04 18:02:18 +01:00
|
|
|
aErrorBox.Execute();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2011-01-12 11:56:09 +01:00
|
|
|
|
2012-04-10 12:43:48 +01:00
|
|
|
void AboutDialog::StyleControls()
|
|
|
|
{
|
|
|
|
// Make all the controls have a transparent background
|
|
|
|
aLogoImage.SetBackground();
|
2012-07-20 12:22:04 +02:00
|
|
|
aLogoReplacement.SetPaintTransparent( sal_True );
|
2012-04-10 12:43:48 +01:00
|
|
|
aVersionText.SetPaintTransparent( sal_True );
|
|
|
|
aDescriptionText.SetPaintTransparent( sal_True );
|
|
|
|
aCopyrightText.SetPaintTransparent( sal_True );
|
|
|
|
|
|
|
|
Font aLabelFont = GetSettings().GetStyleSettings().GetLabelFont();
|
|
|
|
Font aLargeFont = aLabelFont;
|
2012-07-20 12:22:04 +02:00
|
|
|
aLargeFont.SetSize( Size( 0, aLabelFont.GetSize().Height() * 3 ) );
|
|
|
|
|
|
|
|
// Logo Replacement Text
|
|
|
|
aLogoReplacement.SetControlFont( aLargeFont );
|
|
|
|
aLogoReplacement.SetTextSelectable( sal_False );
|
2012-04-10 12:43:48 +01:00
|
|
|
|
|
|
|
// Description Text
|
2012-07-20 12:22:04 +02:00
|
|
|
aLargeFont.SetSize( Size( 0, aLabelFont.GetSize().Height() * 1.3 ) );
|
2012-04-10 12:43:48 +01:00
|
|
|
aDescriptionText.SetControlFont( aLargeFont );
|
|
|
|
aDescriptionText.SetTextSelectable( sal_False );
|
|
|
|
|
|
|
|
// Version Text
|
|
|
|
aLargeFont.SetSize( Size( 0, aLabelFont.GetSize().Height() * 1.2 ) );
|
|
|
|
aVersionText.SetControlFont( aLargeFont );
|
|
|
|
|
|
|
|
// Copyright Text
|
|
|
|
aCopyrightText.SetTextSelectable( sal_False );
|
2012-07-20 12:22:04 +02:00
|
|
|
|
|
|
|
// If not in high-contrast mode, hard-code colors
|
|
|
|
if ( !(Application::GetSettings().GetStyleSettings().GetHighContrastMode()) )
|
|
|
|
{
|
|
|
|
aLogoReplacement.SetControlForeground( Color( 51, 51, 51 ) );
|
|
|
|
aVersionText.SetControlForeground( Color( 102, 102, 102 ) );
|
|
|
|
aDescriptionText.SetControlForeground( Color( 51, 51, 51 ) );
|
|
|
|
aCopyrightText.SetControlForeground( Color( 102, 102, 102 ) );
|
|
|
|
}
|
|
|
|
|
2012-04-10 12:43:48 +01:00
|
|
|
|
2012-06-03 18:13:05 +02:00
|
|
|
aCancelButton.GrabFocus();
|
2012-04-10 12:43:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void AboutDialog::LayoutControls()
|
|
|
|
{
|
|
|
|
// Get the size of the screen
|
|
|
|
Rectangle aScreenRect = Application::GetScreenPosSizePixel( (unsigned int)0 );
|
|
|
|
// Obtain an appropriate text width from the size of the screen
|
|
|
|
sal_Int32 aIdealTextWidth = aScreenRect.GetWidth() / 2.4;
|
|
|
|
|
2012-06-07 23:50:37 +02:00
|
|
|
sal_Int32 aDialogBorder = 12;
|
2012-07-20 12:22:04 +02:00
|
|
|
Size aDialogSize ( aIdealTextWidth + aDialogBorder * 2, 0 );
|
|
|
|
|
|
|
|
// Preliminarily layout buttons, so we see if we need a wider window
|
|
|
|
Size aButtonSize;
|
|
|
|
Point aButtonPos;
|
|
|
|
sal_Int32 aButtonsWidth = 0;
|
|
|
|
LayoutButtons( aDialogSize.Width(), aDialogBorder, aButtonPos, aButtonSize,
|
|
|
|
aButtonsWidth );
|
|
|
|
|
|
|
|
if (aButtonsWidth > 0)
|
|
|
|
aDialogSize.Width() += aButtonsWidth;
|
2012-04-10 12:43:48 +01:00
|
|
|
|
|
|
|
// Render and Position Logo
|
2012-07-13 15:36:28 +02:00
|
|
|
Size aLogoSize( aIdealTextWidth, aIdealTextWidth / 20 );
|
2012-07-20 12:22:04 +02:00
|
|
|
Point aLogoPos( 0, 0 );
|
2012-07-13 15:36:28 +02:00
|
|
|
|
2012-04-10 12:43:48 +01:00
|
|
|
vcl::RenderGraphicRasterizer aRasterizerLogo = Application::LoadBrandSVG("flat_logo");
|
2012-07-13 15:36:28 +02:00
|
|
|
if ( !aRasterizerLogo.GetRenderGraphic().IsEmpty() &&
|
|
|
|
aRasterizerLogo.GetDefaultSizePixel().Width() > 0 && aRasterizerLogo.GetDefaultSizePixel().Height() > 0 )
|
|
|
|
{
|
|
|
|
const float aLogoWidthHeightRatio = (float)aRasterizerLogo.GetDefaultSizePixel().Width() / (float)aRasterizerLogo.GetDefaultSizePixel().Height();
|
2012-07-20 12:22:04 +02:00
|
|
|
aLogoSize.Width() = aDialogSize.Width() ;
|
|
|
|
aLogoSize.Height() = aLogoSize.Width() / aLogoWidthHeightRatio ;
|
2012-04-10 12:43:48 +01:00
|
|
|
|
2012-07-13 15:36:28 +02:00
|
|
|
aLogoBitmap = aRasterizerLogo.Rasterize( aLogoSize );
|
|
|
|
aLogoImage.SetImage( Image( aLogoBitmap ) );
|
|
|
|
aLogoImage.SetPosSizePixel( aLogoPos, aLogoSize );
|
2012-07-16 14:31:55 +02:00
|
|
|
aLogoImage.Show();
|
2012-07-13 15:36:28 +02:00
|
|
|
}
|
2012-07-20 12:22:04 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
aLogoPos.X() = aDialogBorder;
|
|
|
|
aLogoPos.Y() = aDialogBorder;
|
|
|
|
aLogoSize = aLogoReplacement.CalcMinimumSize();
|
|
|
|
aLogoSize.Width() = aIdealTextWidth;
|
|
|
|
aLogoReplacement.SetPosSizePixel( aLogoPos, aLogoSize );
|
|
|
|
}
|
2012-04-10 12:43:48 +01:00
|
|
|
|
|
|
|
// Position version text
|
|
|
|
sal_Int32 aLogoVersionSpacing = aLogoSize.Height() * 0.15;
|
2012-06-07 23:50:37 +02:00
|
|
|
Point aVersionPos( aDialogBorder,
|
2012-04-10 12:43:48 +01:00
|
|
|
aLogoPos.Y() + aLogoSize.Height() + aLogoVersionSpacing );
|
|
|
|
Size aVersionSize = aVersionText.CalcMinimumSize();
|
|
|
|
aVersionSize.Width() = aIdealTextWidth;
|
|
|
|
aVersionText.SetPosSizePixel( aVersionPos, aVersionSize );
|
|
|
|
|
|
|
|
// Position description text
|
|
|
|
sal_Int32 aVersionDescriptionSpacing = aLogoSize.Height() * 0.45;
|
2012-06-07 23:50:37 +02:00
|
|
|
Point aDescriptionPos( aDialogBorder, aVersionPos.Y() + aVersionSize.Height() + aVersionDescriptionSpacing );
|
2012-04-10 12:43:48 +01:00
|
|
|
Size aDescriptionSize = aDescriptionText.GetSizePixel();
|
|
|
|
aDescriptionSize.Width() = aIdealTextWidth;
|
|
|
|
aDescriptionText.SetPosSizePixel( aDescriptionPos, aDescriptionSize );
|
|
|
|
aDescriptionSize = aDescriptionText.CalcMinimumSize();
|
|
|
|
aDescriptionText.SetSizePixel( aDescriptionSize );
|
|
|
|
|
|
|
|
// Layout copyright text
|
2012-06-07 23:50:37 +02:00
|
|
|
Point aCopyrightPos( aDialogBorder, aDescriptionPos.Y() + aDescriptionText.GetSizePixel().Height() + aVersionDescriptionSpacing );
|
2012-04-10 12:43:48 +01:00
|
|
|
Size aCopyrightSize = aCopyrightText.GetSizePixel();
|
|
|
|
aCopyrightSize.Width() = aIdealTextWidth;
|
|
|
|
aCopyrightText.SetPosSizePixel( aCopyrightPos, aCopyrightSize );
|
|
|
|
aCopyrightSize = aCopyrightText.CalcMinimumSize();
|
|
|
|
aCopyrightSize.Width() = aIdealTextWidth;
|
|
|
|
aCopyrightText.SetSizePixel( aCopyrightSize );
|
|
|
|
|
2012-07-20 12:22:04 +02:00
|
|
|
// Move buttons into final place
|
|
|
|
sal_Int32 aButtonPosY = aDialogBorder + aCopyrightPos.Y() +
|
|
|
|
aCopyrightText.GetSizePixel().Height() + aVersionDescriptionSpacing;
|
2012-06-03 18:13:05 +02:00
|
|
|
|
2012-07-20 12:22:04 +02:00
|
|
|
MoveControl(aCreditsButton, 0, aButtonPosY);
|
|
|
|
MoveControl(aWebsiteButton, 0, aButtonPosY);
|
|
|
|
MoveControl(aCancelButton, 0, aButtonPosY);
|
2012-06-03 18:13:05 +02:00
|
|
|
|
2012-07-20 12:22:04 +02:00
|
|
|
// The centers everything again, if aDialogSize.Width() has become wider
|
|
|
|
// before; the -20 "fixes" a weird text centering bug
|
|
|
|
MoveControl(aVersionText, (aDialogSize.Width() - aVersionText.GetSizePixel().Width() - 20)/2, 0);
|
|
|
|
MoveControl(aDescriptionText, (aDialogSize.Width() - aDescriptionText.GetSizePixel().Width() - 20)/2, 0);
|
|
|
|
MoveControl(aCopyrightText, (aDialogSize.Width() - aCopyrightText.GetSizePixel().Width() - 20)/2, 0);
|
2012-06-03 18:13:05 +02:00
|
|
|
|
2012-07-20 12:22:04 +02:00
|
|
|
aDialogSize.Height() = aButtonPosY + aButtonSize.Height() + aDialogBorder;
|
2012-04-10 12:43:48 +01:00
|
|
|
|
2012-06-07 23:50:37 +02:00
|
|
|
|
2012-07-20 12:22:04 +02:00
|
|
|
// Layout background image
|
|
|
|
if ( !(Application::GetSettings().GetStyleSettings().GetHighContrastMode()) ) {
|
|
|
|
vcl::RenderGraphicRasterizer aRasterizerBackground = Application::LoadBrandSVG("shell/about");
|
|
|
|
|
|
|
|
if ( !aRasterizerBackground.GetRenderGraphic().IsEmpty() &&
|
|
|
|
aRasterizerBackground.GetDefaultSizePixel().Width() > 0 && aRasterizerBackground.GetDefaultSizePixel().Height() > 0 )
|
|
|
|
{
|
|
|
|
const float aBackgroundWidthHeightRatio = (float)aRasterizerBackground.GetDefaultSizePixel().Width() /
|
|
|
|
(float)aRasterizerBackground.GetDefaultSizePixel().Height();
|
|
|
|
Size aBackgroundSize (aDialogSize.Width(), aDialogSize.Width() / aBackgroundWidthHeightRatio );
|
|
|
|
|
|
|
|
if ( aBackgroundSize.Height() < aDialogSize.Height())
|
|
|
|
{
|
|
|
|
aBackgroundSize.Width() = aDialogSize.Height() * aBackgroundWidthHeightRatio ;
|
|
|
|
aBackgroundSize.Height() = aDialogSize.Height();
|
|
|
|
}
|
|
|
|
|
|
|
|
aBackgroundBitmap = aRasterizerBackground.Rasterize( aBackgroundSize );
|
|
|
|
}
|
2012-04-10 12:43:48 +01:00
|
|
|
}
|
|
|
|
|
2012-07-02 08:37:53 +02:00
|
|
|
SetOutputSizePixel( aDialogSize );
|
2012-06-07 23:50:37 +02:00
|
|
|
|
2012-04-10 12:43:48 +01:00
|
|
|
}
|
|
|
|
|
2012-06-07 23:50:37 +02:00
|
|
|
void AboutDialog::LayoutButtons(sal_Int32 aDialogWidth, sal_Int32 aDialogBorder,
|
2012-07-20 12:22:04 +02:00
|
|
|
Point& aButtonPos, Size& aButtonSize,
|
|
|
|
sal_Int32& aButtonsWidth )
|
2012-04-10 12:43:48 +01:00
|
|
|
{
|
|
|
|
// Position credits button
|
|
|
|
sal_Int32 aButtonVPadding = 5;
|
|
|
|
sal_Int32 aButtonHPadding = 4;
|
2012-06-03 18:13:05 +02:00
|
|
|
sal_Int32 aAdjacentButtonSpacing = 15;
|
2012-04-10 12:43:48 +01:00
|
|
|
sal_Int32 aCreditsButtonWidth = aCreditsButton.CalcMinimumSize().Width();
|
|
|
|
sal_Int32 aWebsiteButtonWidth = aWebsiteButton.CalcMinimumSize().Width();
|
2012-06-03 18:13:05 +02:00
|
|
|
sal_Int32 aCancelButtonWidth = aCancelButton.CalcMinimumSize().Width();
|
|
|
|
sal_Int32 aLargestButtonWidth = 70;
|
2012-04-10 12:43:48 +01:00
|
|
|
|
2012-06-03 18:13:05 +02:00
|
|
|
if ( aLargestButtonWidth < aCreditsButtonWidth )
|
2012-04-10 12:43:48 +01:00
|
|
|
aLargestButtonWidth = aCreditsButtonWidth;
|
2012-06-03 18:13:05 +02:00
|
|
|
if ( aLargestButtonWidth < aWebsiteButtonWidth )
|
2012-04-10 12:43:48 +01:00
|
|
|
aLargestButtonWidth = aWebsiteButtonWidth;
|
2012-06-03 18:13:05 +02:00
|
|
|
if ( aLargestButtonWidth < aCancelButtonWidth )
|
|
|
|
aLargestButtonWidth = aCancelButtonWidth;
|
2012-04-10 12:43:48 +01:00
|
|
|
|
|
|
|
aButtonSize.Width() = aLargestButtonWidth + ( 2 * aButtonHPadding );
|
|
|
|
aButtonSize.Height() = aWebsiteButton.CalcMinimumSize().Height() + ( 2 * aButtonVPadding );
|
|
|
|
|
|
|
|
aCreditsButton.SetSizePixel( aButtonSize );
|
|
|
|
aWebsiteButton.SetSizePixel( aButtonSize );
|
2012-06-03 18:13:05 +02:00
|
|
|
aCancelButton.SetSizePixel( aButtonSize );
|
2012-04-10 12:43:48 +01:00
|
|
|
|
2012-07-02 08:37:53 +02:00
|
|
|
sal_Int32 aButtonSpacing = aDialogWidth - ( aDialogBorder * 2 ) - ( aButtonSize.Width() * 3 ) - aAdjacentButtonSpacing ;
|
2012-06-07 23:50:37 +02:00
|
|
|
if (aButtonSpacing < aAdjacentButtonSpacing)
|
|
|
|
{
|
|
|
|
aButtonsWidth = aAdjacentButtonSpacing - aButtonSpacing;
|
|
|
|
aButtonSpacing = aAdjacentButtonSpacing;
|
|
|
|
}
|
|
|
|
|
|
|
|
aButtonPos.X() = aDialogBorder;
|
2012-07-20 12:22:04 +02:00
|
|
|
aButtonPos.Y() = 0;
|
2012-04-10 12:43:48 +01:00
|
|
|
|
|
|
|
aCreditsButton.SetPosPixel( aButtonPos );
|
|
|
|
|
2012-06-03 18:13:05 +02:00
|
|
|
aButtonPos.X() += aButtonSize.Width() + aAdjacentButtonSpacing;
|
2012-04-10 12:43:48 +01:00
|
|
|
aWebsiteButton.SetPosPixel( aButtonPos );
|
|
|
|
|
|
|
|
aButtonPos.X() += aButtonSize.Width() + aButtonSpacing;
|
2012-06-03 18:13:05 +02:00
|
|
|
aCancelButton.SetPosPixel( aButtonPos );
|
|
|
|
|
|
|
|
|
2012-04-10 12:43:48 +01:00
|
|
|
}
|
|
|
|
|
2012-06-07 23:50:37 +02:00
|
|
|
void AboutDialog::MoveControl(Control& rControl, sal_Int32 X, sal_Int32 Y)
|
2012-04-10 12:43:48 +01:00
|
|
|
{
|
|
|
|
Point aControlPos = rControl.GetPosPixel();
|
|
|
|
aControlPos.X() += X;
|
2012-06-07 23:50:37 +02:00
|
|
|
aControlPos.Y() += Y;
|
2012-04-10 12:43:48 +01:00
|
|
|
rControl.SetPosPixel(aControlPos);
|
|
|
|
}
|
|
|
|
|
2011-01-12 11:56:09 +01:00
|
|
|
void AboutDialog::Paint( const Rectangle& rRect )
|
|
|
|
{
|
|
|
|
SetClipRegion( rRect );
|
2012-07-20 12:22:04 +02:00
|
|
|
Point aPos ( rRect.GetWidth() - aBackgroundBitmap.GetSizePixel().Width(), rRect.GetHeight() - aBackgroundBitmap.GetSizePixel().Height() );
|
2012-04-10 12:43:48 +01:00
|
|
|
DrawBitmapEx( aPos, aBackgroundBitmap );
|
|
|
|
}
|
|
|
|
|
|
|
|
rtl::OUString AboutDialog::GetBuildId()
|
|
|
|
{
|
|
|
|
rtl::OUString sDefault;
|
|
|
|
rtl::OUString sBuildId(utl::Bootstrap::getBuildVersion(sDefault));
|
|
|
|
if (!sBuildId.isEmpty())
|
|
|
|
return sBuildId;
|
|
|
|
|
|
|
|
sBuildId = utl::Bootstrap::getBuildIdData(sDefault);
|
|
|
|
|
|
|
|
if (!sBuildId.isEmpty())
|
|
|
|
{
|
|
|
|
sal_Int32 nIndex = 0;
|
|
|
|
return sBuildId.getToken( 0, '-', nIndex );
|
|
|
|
}
|
|
|
|
|
|
|
|
OSL_ENSURE( !sBuildId.isEmpty(), "No BUILDID in bootstrap file" );
|
|
|
|
return sBuildId;
|
|
|
|
}
|
|
|
|
|
|
|
|
rtl::OUString AboutDialog::GetVersionString()
|
|
|
|
{
|
2012-04-29 23:36:57 +01:00
|
|
|
rtl::OUString sVersion = m_aVersionTextStr;
|
2012-04-10 12:43:48 +01:00
|
|
|
|
|
|
|
rtl::OUString sBuildId = GetBuildId();
|
|
|
|
|
2012-04-25 16:06:16 +01:00
|
|
|
if (!sBuildId.trim().isEmpty())
|
2012-04-10 12:43:48 +01:00
|
|
|
{
|
|
|
|
sVersion += " ";
|
2012-04-25 16:06:16 +01:00
|
|
|
if (m_sBuildStr.indexOf("$BUILDID") == -1)
|
|
|
|
{
|
|
|
|
SAL_WARN( "cui.dialogs", "translated Build Id string in translations doesn't contain $BUILDID placeholder" );
|
|
|
|
m_sBuildStr += " $BUILDID";
|
|
|
|
}
|
2012-04-16 16:33:41 +01:00
|
|
|
sVersion += m_sBuildStr.replaceAll("$BUILDID", sBuildId);
|
2012-04-10 12:43:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return sVersion;
|
|
|
|
}
|
|
|
|
|
|
|
|
rtl::OUString AboutDialog::GetCopyrightString()
|
|
|
|
{
|
|
|
|
rtl::OUString aCopyrightString = m_aVendorTextStr;
|
|
|
|
aCopyrightString += "\n";
|
|
|
|
|
|
|
|
aCopyrightString += m_aCopyrightTextStr;
|
|
|
|
aCopyrightString += "\n";
|
|
|
|
|
|
|
|
if (utl::ConfigManager::getProductName().equals("LibreOffice"))
|
|
|
|
aCopyrightString += m_aBasedTextStr;
|
|
|
|
else
|
|
|
|
aCopyrightString += m_aBasedDerivedTextStr;
|
|
|
|
|
|
|
|
return aCopyrightString;
|
|
|
|
}
|
|
|
|
|
|
|
|
IMPL_LINK_NOARG(AboutDialog, CancelHdl)
|
|
|
|
{
|
|
|
|
Close();
|
|
|
|
return 0;
|
2011-04-04 18:02:18 +01:00
|
|
|
}
|
2011-01-12 11:56:09 +01:00
|
|
|
|
2011-04-04 18:02:18 +01:00
|
|
|
sal_Bool AboutDialog::Close()
|
|
|
|
{
|
|
|
|
EndDialog( RET_OK );
|
|
|
|
return sal_False;
|
2011-01-12 11:56:09 +01:00
|
|
|
}
|
2011-04-04 18:02:18 +01:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|