LCOV - code coverage report
Current view: top level - cui/source/dialogs - about.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 224 0.0 %
Date: 2012-08-25 Functions: 0 14 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 368 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <vcl/svapp.hxx>
      30                 :            : #include <vcl/msgbox.hxx>
      31                 :            : 
      32                 :            : #include <tools/stream.hxx>
      33                 :            : #include <rtl/bootstrap.hxx>
      34                 :            : #include <unotools/configmgr.hxx>
      35                 :            : #include <unotools/bootstrap.hxx>
      36                 :            : #include <com/sun/star/uno/Any.h>
      37                 :            : #include <vcl/graph.hxx>
      38                 :            : #include <svtools/filter.hxx>
      39                 :            : #include <svtools/langhelp.hxx>
      40                 :            : 
      41                 :            : #include "com/sun/star/system/SystemShellExecuteFlags.hpp"
      42                 :            : #include "com/sun/star/system/XSystemShellExecute.hpp"
      43                 :            : #include <comphelper/processfactory.hxx>
      44                 :            : #include "comphelper/anytostring.hxx"
      45                 :            : #include "cppuhelper/exc_hlp.hxx"
      46                 :            : #include "cppuhelper/bootstrap.hxx"
      47                 :            : 
      48                 :            : #include <sfx2/sfxuno.hxx>
      49                 :            : #include <sfx2/sfxcommands.h>
      50                 :            : #include "about.hxx"
      51                 :            : #include "about.hrc"
      52                 :            : #include <sfx2/sfxdefs.hxx>
      53                 :            : #include <sfx2/app.hxx>
      54                 :            : #include <rtl/ustrbuf.hxx>
      55                 :            : #include <vcl/bitmap.hxx>
      56                 :            : #include <vcl/rendergraphicrasterizer.hxx>
      57                 :            : #include <officecfg/Office/Common.hxx>
      58                 :            : 
      59                 :            : using namespace ::com::sun::star::uno;
      60                 :            : using namespace ::com::sun::star::beans;
      61                 :            : using namespace ::com::sun::star;
      62                 :            : 
      63                 :            : enum AboutDialogButton
      64                 :            : {
      65                 :            :     CREDITS_BUTTON,
      66                 :            :     WEBSITE_BUTTON
      67                 :            : };
      68                 :            : 
      69                 :          0 : AboutDialog::AboutDialog( Window* pParent, const ResId& rId) :
      70                 :            :     SfxModalDialog       ( pParent,  rId ),
      71                 :          0 :     aVersionText         ( this,     ResId( ABOUT_VERSION_TEXT, *rId.GetResMgr() ) ),
      72                 :          0 :     aDescriptionText     ( this,     ResId( ABOUT_DESCRIPTION_TEXT, *rId.GetResMgr() ) ),
      73                 :          0 :     aCopyrightText       ( this,     ResId( ABOUT_COPYRIGHT_TEXT, *rId.GetResMgr() ) ),
      74                 :            :     aLogoImage           ( this ),
      75                 :          0 :     aLogoReplacement     ( this,     ResId( ABOUT_LOGO_REPLACEMENT, *rId.GetResMgr() ) ),
      76                 :          0 :     aCreditsButton       ( this,     ResId( ABOUT_BTN_CREDITS, *rId.GetResMgr() ) ),
      77                 :          0 :     aWebsiteButton       ( this,     ResId( ABOUT_BTN_WEBSITE, *rId.GetResMgr() ) ),
      78                 :          0 :     aCancelButton        ( this,     ResId( ABOUT_BTN_CANCEL, *rId.GetResMgr() ) ),
      79                 :          0 :     m_aVersionTextStr(ResId(ABOUT_STR_VERSION, *rId.GetResMgr()).toString().trim()),
      80                 :          0 :     m_aVendorTextStr(ResId(ABOUT_STR_VENDOR, *rId.GetResMgr())),
      81                 :          0 :     m_aCopyrightTextStr(ResId(ABOUT_STR_COPYRIGHT, *rId.GetResMgr())),
      82                 :          0 :     m_aBasedTextStr(ResId(ABOUT_STR_BASED, *rId.GetResMgr())),
      83                 :          0 :     m_aBasedDerivedTextStr(ResId(ABOUT_STR_BASED_DERIVED, *rId.GetResMgr())),
      84                 :          0 :     m_aCreditsLinkStr(ResId( ABOUT_STR_LINK_CREDITS, *rId.GetResMgr())),
      85                 :          0 :     m_sBuildStr(ResId(ABOUT_STR_BUILD, *rId.GetResMgr())),
      86 [ #  # ][ #  #  :          0 :     m_aDescriptionTextStr(ResId(ABOUT_STR_DESCRIPTION, *rId.GetResMgr()))
          #  #  #  #  #  
           # ][ #  #  #  
          #  #  #  #  #  
                   #  # ]
           [ #  #  #  # ]
           [ #  #  #  #  
          #  #  #  #  #  
                #  #  # ]
                 [ #  # ]
      87                 :            : {
      88                 :            :     // Populate text items
      89 [ #  # ][ #  # ]:          0 :     aLogoReplacement.SetText ( utl::ConfigManager::getProductName() );
         [ #  # ][ #  # ]
      90                 :            : 
      91 [ #  # ][ #  # ]:          0 :     aVersionText.SetText( GetVersionString() );
         [ #  # ][ #  # ]
      92                 :            : 
      93         [ #  # ]:          0 :     aDescriptionText.SetText( m_aDescriptionTextStr );
      94                 :            : 
      95         [ #  # ]:          0 :     rtl::OUString aCopyrightString = GetCopyrightString();
      96 [ #  # ][ #  # ]:          0 :     aCopyrightText.SetText( aCopyrightString );
                 [ #  # ]
      97                 :            : 
      98         [ #  # ]:          0 :     StyleControls();
      99         [ #  # ]:          0 :     LayoutControls();
     100                 :            : 
     101                 :            :     // Allow the button to be identifiable once they are clicked
     102         [ #  # ]:          0 :     aCreditsButton.SetData( (void*)CREDITS_BUTTON );
     103         [ #  # ]:          0 :     aWebsiteButton.SetData( (void*)WEBSITE_BUTTON );
     104                 :            : 
     105                 :            :     // Connect all handlers
     106         [ #  # ]:          0 :     aCreditsButton.SetClickHdl( LINK( this, AboutDialog, HandleClick ) );
     107         [ #  # ]:          0 :     aWebsiteButton.SetClickHdl( LINK( this, AboutDialog, HandleClick ) );
     108                 :            : 
     109         [ #  # ]:          0 :     aCancelButton.SetClickHdl( LINK( this, AboutDialog, CancelHdl ) );
     110                 :            : 
     111         [ #  # ]:          0 :     FreeResource();
     112                 :            : 
     113                 :            :     // explicit Help-Id
     114         [ #  # ]:          0 :     SetHelpId( CMD_SID_ABOUT );
     115                 :          0 : }
     116                 :            : 
     117                 :          0 : IMPL_LINK( AboutDialog, HandleClick, PushButton*, pButton )
     118                 :            : {
     119                 :          0 :     rtl::OUString sURL = "";
     120                 :            : 
     121                 :            :     // Find which button was pressed and from this, get the URL to be opened
     122         [ #  # ]:          0 :     AboutDialogButton* pDialogButton = (AboutDialogButton*)pButton->GetData();
     123         [ #  # ]:          0 :     if ( pDialogButton ==  (AboutDialogButton*)CREDITS_BUTTON )
     124         [ #  # ]:          0 :         sURL = m_aCreditsLinkStr;
     125         [ #  # ]:          0 :     else if ( pDialogButton == (AboutDialogButton*)WEBSITE_BUTTON )
     126                 :            :     {
     127                 :          0 :         sURL = officecfg::Office::Common::Help::StartCenter::InfoURL::get();
     128         [ #  # ]:          0 :         localizeWebserviceURI(sURL);
     129                 :            :     }
     130                 :            : 
     131                 :            :     // If the URL is empty, don't do anything
     132         [ #  # ]:          0 :     if ( sURL.isEmpty() )
     133                 :          0 :         return 1;
     134                 :            :     try
     135                 :            :     {
     136                 :            :         Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
     137 [ #  # ][ #  # ]:          0 :             ::comphelper::getProcessServiceFactory()->createInstance(
     138 [ #  # ][ #  # ]:          0 :                 DEFINE_CONST_UNICODE("com.sun.star.system.SystemShellExecute") ), UNO_QUERY_THROW );
         [ #  # ][ #  # ]
                 [ #  # ]
     139         [ #  # ]:          0 :         xSystemShellExecute->execute( sURL, rtl::OUString(),
     140         [ #  # ]:          0 :                                       com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY );
     141                 :            :     }
     142   [ #  #  #  # ]:          0 :     catch (const Exception&)
     143                 :            :     {
     144         [ #  # ]:          0 :         Any exc( ::cppu::getCaughtException() );
     145         [ #  # ]:          0 :         rtl::OUString msg( ::comphelper::anyToString( exc ) );
     146         [ #  # ]:          0 :         const SolarMutexGuard guard;
     147   [ #  #  #  #  :          0 :         ErrorBox aErrorBox( NULL, WB_OK, msg );
                   #  # ]
     148   [ #  #  #  #  :          0 :         aErrorBox.SetText( GetText() );
                   #  # ]
     149   [ #  #  #  #  :          0 :         aErrorBox.Execute();
                   #  # ]
     150                 :            :     }
     151                 :            : 
     152                 :          0 :     return 1;
     153                 :            : }
     154                 :            : 
     155                 :          0 : void AboutDialog::StyleControls()
     156                 :            : {
     157                 :            :     // Make all the controls have a transparent background
     158         [ #  # ]:          0 :     aLogoImage.SetBackground();
     159         [ #  # ]:          0 :     aLogoReplacement.SetPaintTransparent( sal_True );
     160         [ #  # ]:          0 :     aVersionText.SetPaintTransparent( sal_True );
     161         [ #  # ]:          0 :     aDescriptionText.SetPaintTransparent( sal_True );
     162         [ #  # ]:          0 :     aCopyrightText.SetPaintTransparent( sal_True );
     163                 :            : 
     164         [ #  # ]:          0 :     Font aLabelFont = GetSettings().GetStyleSettings().GetLabelFont();
     165         [ #  # ]:          0 :     Font aLargeFont = aLabelFont;
     166 [ #  # ][ #  # ]:          0 :     aLargeFont.SetSize( Size( 0, aLabelFont.GetSize().Height() * 3 ) );
     167                 :            : 
     168                 :            :     // Logo Replacement Text
     169         [ #  # ]:          0 :     aLogoReplacement.SetControlFont( aLargeFont );
     170         [ #  # ]:          0 :     aLogoReplacement.SetTextSelectable( sal_False );
     171                 :            : 
     172                 :            :     // Description Text
     173 [ #  # ][ #  # ]:          0 :     aLargeFont.SetSize( Size( 0, aLabelFont.GetSize().Height() * 1.3 ) );
     174         [ #  # ]:          0 :     aDescriptionText.SetControlFont( aLargeFont );
     175         [ #  # ]:          0 :     aDescriptionText.SetTextSelectable( sal_False );
     176                 :            : 
     177                 :            :     // Version Text
     178 [ #  # ][ #  # ]:          0 :     aLargeFont.SetSize( Size( 0, aLabelFont.GetSize().Height() * 1.2 ) );
     179         [ #  # ]:          0 :     aVersionText.SetControlFont( aLargeFont );
     180                 :            : 
     181                 :            :     // Copyright Text
     182         [ #  # ]:          0 :     aCopyrightText.SetTextSelectable( sal_False );
     183                 :            : 
     184                 :            :     // If not in high-contrast mode, hard-code colors
     185 [ #  # ][ #  # ]:          0 :     if ( !(Application::GetSettings().GetStyleSettings().GetHighContrastMode()) )
     186                 :            :     {
     187         [ #  # ]:          0 :     aLogoReplacement.SetControlForeground( Color( 51, 51, 51 ) );
     188         [ #  # ]:          0 :     aVersionText.SetControlForeground( Color( 102, 102, 102 ) );
     189         [ #  # ]:          0 :     aDescriptionText.SetControlForeground( Color( 51, 51, 51 ) );
     190         [ #  # ]:          0 :     aCopyrightText.SetControlForeground( Color( 102, 102, 102 ) );
     191                 :            :     }
     192                 :            : 
     193                 :            : 
     194 [ #  # ][ #  # ]:          0 :     aCancelButton.GrabFocus();
                 [ #  # ]
     195                 :          0 : }
     196                 :            : 
     197                 :          0 : void AboutDialog::LayoutControls()
     198                 :            : {
     199                 :            :     // Get the size of the screen
     200         [ #  # ]:          0 :     Rectangle aScreenRect = Application::GetScreenPosSizePixel( (unsigned int)0 );
     201                 :            :     // Obtain an appropriate text width from the size of the screen
     202         [ #  # ]:          0 :     sal_Int32 aIdealTextWidth = aScreenRect.GetWidth() / 2.4;
     203                 :            : 
     204                 :          0 :     sal_Int32 aDialogBorder = 12;
     205                 :          0 :     Size aDialogSize ( aIdealTextWidth + aDialogBorder * 2, 0 );
     206                 :            : 
     207                 :            :     // Preliminarily layout buttons, so we see if we need a wider window
     208                 :          0 :     Size aButtonSize;
     209                 :          0 :     Point aButtonPos;
     210                 :          0 :     sal_Int32 aButtonsWidth = 0;
     211                 :          0 :     LayoutButtons( aDialogSize.Width(), aDialogBorder, aButtonPos, aButtonSize,
     212         [ #  # ]:          0 :                     aButtonsWidth );
     213                 :            : 
     214         [ #  # ]:          0 :     if (aButtonsWidth > 0)
     215                 :          0 :         aDialogSize.Width() += aButtonsWidth;
     216                 :            : 
     217                 :            :     // Render and Position Logo
     218                 :          0 :     Size aLogoSize( aIdealTextWidth, aIdealTextWidth / 20 );
     219                 :          0 :     Point aLogoPos( 0, 0 );
     220                 :            : 
     221         [ #  # ]:          0 :     vcl::RenderGraphicRasterizer aRasterizerLogo = Application::LoadBrandSVG("flat_logo");
     222 [ #  # ][ #  #  :          0 :     if ( !aRasterizerLogo.GetRenderGraphic().IsEmpty() &&
             #  #  #  # ]
                 [ #  # ]
     223 [ #  # ][ #  # ]:          0 :          aRasterizerLogo.GetDefaultSizePixel().Width() > 0 && aRasterizerLogo.GetDefaultSizePixel().Height() > 0 )
     224                 :            :     {
     225 [ #  # ][ #  # ]:          0 :         const float aLogoWidthHeightRatio = (float)aRasterizerLogo.GetDefaultSizePixel().Width() / (float)aRasterizerLogo.GetDefaultSizePixel().Height();
     226                 :          0 :         aLogoSize.Width() = aDialogSize.Width() ;
     227                 :          0 :         aLogoSize.Height() = aLogoSize.Width() / aLogoWidthHeightRatio ;
     228                 :            : 
     229 [ #  # ][ #  # ]:          0 :         aLogoBitmap = aRasterizerLogo.Rasterize( aLogoSize );
     230 [ #  # ][ #  # ]:          0 :         aLogoImage.SetImage( Image( aLogoBitmap ) );
                 [ #  # ]
     231         [ #  # ]:          0 :         aLogoImage.SetPosSizePixel( aLogoPos, aLogoSize );
     232         [ #  # ]:          0 :         aLogoImage.Show();
     233                 :            :     }
     234                 :            :     else
     235                 :            :     {
     236                 :          0 :         aLogoPos.X() = aDialogBorder;
     237                 :          0 :         aLogoPos.Y() = aDialogBorder;
     238         [ #  # ]:          0 :         aLogoSize = aLogoReplacement.CalcMinimumSize();
     239                 :          0 :         aLogoSize.Width() = aIdealTextWidth;
     240         [ #  # ]:          0 :         aLogoReplacement.SetPosSizePixel( aLogoPos, aLogoSize );
     241                 :            :     }
     242                 :            : 
     243                 :            :     // Position version text
     244                 :          0 :     sal_Int32 aLogoVersionSpacing = aLogoSize.Height() * 0.15;
     245                 :            :     Point aVersionPos( aDialogBorder,
     246                 :          0 :                        aLogoPos.Y() + aLogoSize.Height() + aLogoVersionSpacing );
     247         [ #  # ]:          0 :     Size aVersionSize = aVersionText.CalcMinimumSize();
     248                 :          0 :     aVersionSize.Width() = aIdealTextWidth;
     249         [ #  # ]:          0 :     aVersionText.SetPosSizePixel( aVersionPos, aVersionSize );
     250                 :            : 
     251                 :            :     // Position description text
     252                 :          0 :     sal_Int32 aVersionDescriptionSpacing = aLogoSize.Height() * 0.45;
     253                 :          0 :     Point aDescriptionPos( aDialogBorder, aVersionPos.Y() + aVersionSize.Height() + aVersionDescriptionSpacing );
     254         [ #  # ]:          0 :     Size aDescriptionSize = aDescriptionText.GetSizePixel();
     255                 :          0 :     aDescriptionSize.Width() = aIdealTextWidth;
     256         [ #  # ]:          0 :     aDescriptionText.SetPosSizePixel( aDescriptionPos, aDescriptionSize );
     257         [ #  # ]:          0 :     aDescriptionSize = aDescriptionText.CalcMinimumSize();
     258         [ #  # ]:          0 :     aDescriptionText.SetSizePixel( aDescriptionSize );
     259                 :            : 
     260                 :            :     // Layout copyright text
     261         [ #  # ]:          0 :     Point aCopyrightPos( aDialogBorder, aDescriptionPos.Y() + aDescriptionText.GetSizePixel().Height() + aVersionDescriptionSpacing );
     262         [ #  # ]:          0 :     Size aCopyrightSize = aCopyrightText.GetSizePixel();
     263                 :          0 :     aCopyrightSize.Width() = aIdealTextWidth;
     264         [ #  # ]:          0 :     aCopyrightText.SetPosSizePixel( aCopyrightPos, aCopyrightSize );
     265         [ #  # ]:          0 :     aCopyrightSize = aCopyrightText.CalcMinimumSize();
     266                 :          0 :     aCopyrightSize.Width() = aIdealTextWidth;
     267         [ #  # ]:          0 :     aCopyrightText.SetSizePixel( aCopyrightSize );
     268                 :            : 
     269                 :            :     // Move buttons into final place
     270                 :          0 :     sal_Int32 aButtonPosY = aDialogBorder + aCopyrightPos.Y() +
     271         [ #  # ]:          0 :             aCopyrightText.GetSizePixel().Height() + aVersionDescriptionSpacing;
     272                 :            : 
     273         [ #  # ]:          0 :     MoveControl(aCreditsButton, 0, aButtonPosY);
     274         [ #  # ]:          0 :     MoveControl(aWebsiteButton, 0, aButtonPosY);
     275         [ #  # ]:          0 :     MoveControl(aCancelButton, 0, aButtonPosY);
     276                 :            : 
     277                 :            :     // The centers everything again, if aDialogSize.Width() has become wider
     278                 :            :     // before; the -20 "fixes" a weird text centering bug
     279 [ #  # ][ #  # ]:          0 :     MoveControl(aVersionText, (aDialogSize.Width() - aVersionText.GetSizePixel().Width() - 20)/2, 0);
     280 [ #  # ][ #  # ]:          0 :     MoveControl(aDescriptionText, (aDialogSize.Width() - aDescriptionText.GetSizePixel().Width() - 20)/2, 0);
     281 [ #  # ][ #  # ]:          0 :     MoveControl(aCopyrightText, (aDialogSize.Width() - aCopyrightText.GetSizePixel().Width() - 20)/2, 0);
     282                 :            : 
     283                 :          0 :     aDialogSize.Height() = aButtonPosY + aButtonSize.Height() + aDialogBorder;
     284                 :            : 
     285                 :            : 
     286                 :            :     // Layout background image
     287 [ #  # ][ #  # ]:          0 :     if ( !(Application::GetSettings().GetStyleSettings().GetHighContrastMode()) )   {
     288         [ #  # ]:          0 :         vcl::RenderGraphicRasterizer aRasterizerBackground = Application::LoadBrandSVG("shell/about");
     289                 :            : 
     290 [ #  # ][ #  #  :          0 :         if ( !aRasterizerBackground.GetRenderGraphic().IsEmpty() &&
             #  #  #  # ]
                 [ #  # ]
     291 [ #  # ][ #  # ]:          0 :             aRasterizerBackground.GetDefaultSizePixel().Width() > 0 && aRasterizerBackground.GetDefaultSizePixel().Height() > 0 )
     292                 :            :         {
     293         [ #  # ]:          0 :             const float aBackgroundWidthHeightRatio = (float)aRasterizerBackground.GetDefaultSizePixel().Width() /
     294         [ #  # ]:          0 :                                        (float)aRasterizerBackground.GetDefaultSizePixel().Height();
     295                 :          0 :             Size aBackgroundSize (aDialogSize.Width(), aDialogSize.Width() / aBackgroundWidthHeightRatio );
     296                 :            : 
     297         [ #  # ]:          0 :             if ( aBackgroundSize.Height() < aDialogSize.Height())
     298                 :            :             {
     299                 :          0 :                 aBackgroundSize.Width() = aDialogSize.Height() * aBackgroundWidthHeightRatio ;
     300                 :          0 :                 aBackgroundSize.Height() = aDialogSize.Height();
     301                 :            :             }
     302                 :            : 
     303 [ #  # ][ #  # ]:          0 :             aBackgroundBitmap = aRasterizerBackground.Rasterize( aBackgroundSize );
     304         [ #  # ]:          0 :         }
     305                 :            :     }
     306                 :            : 
     307 [ #  # ][ #  # ]:          0 :     SetOutputSizePixel( aDialogSize );
     308                 :            : 
     309                 :          0 : }
     310                 :            : 
     311                 :          0 : void AboutDialog::LayoutButtons(sal_Int32 aDialogWidth, sal_Int32 aDialogBorder,
     312                 :            :                                 Point& aButtonPos, Size& aButtonSize,
     313                 :            :                                 sal_Int32& aButtonsWidth )
     314                 :            : {
     315                 :            :     // Position credits button
     316                 :          0 :     sal_Int32 aButtonVPadding = 5;
     317                 :          0 :     sal_Int32 aButtonHPadding = 4;
     318                 :          0 :     sal_Int32 aAdjacentButtonSpacing = 15;
     319                 :          0 :     sal_Int32 aCreditsButtonWidth = aCreditsButton.CalcMinimumSize().Width();
     320                 :          0 :     sal_Int32 aWebsiteButtonWidth = aWebsiteButton.CalcMinimumSize().Width();
     321                 :          0 :     sal_Int32 aCancelButtonWidth = aCancelButton.CalcMinimumSize().Width();
     322                 :          0 :     sal_Int32 aLargestButtonWidth = 70;
     323                 :            : 
     324         [ #  # ]:          0 :     if ( aLargestButtonWidth < aCreditsButtonWidth )
     325                 :          0 :         aLargestButtonWidth = aCreditsButtonWidth;
     326         [ #  # ]:          0 :     if ( aLargestButtonWidth < aWebsiteButtonWidth )
     327                 :          0 :         aLargestButtonWidth = aWebsiteButtonWidth;
     328         [ #  # ]:          0 :     if ( aLargestButtonWidth < aCancelButtonWidth )
     329                 :          0 :         aLargestButtonWidth = aCancelButtonWidth;
     330                 :            : 
     331                 :          0 :     aButtonSize.Width() = aLargestButtonWidth + ( 2 * aButtonHPadding );
     332                 :          0 :     aButtonSize.Height() = aWebsiteButton.CalcMinimumSize().Height() + ( 2 * aButtonVPadding );
     333                 :            : 
     334                 :          0 :     aCreditsButton.SetSizePixel( aButtonSize );
     335                 :          0 :     aWebsiteButton.SetSizePixel( aButtonSize );
     336                 :          0 :     aCancelButton.SetSizePixel( aButtonSize );
     337                 :            : 
     338                 :          0 :     sal_Int32 aButtonSpacing = aDialogWidth  - ( aDialogBorder * 2 ) - ( aButtonSize.Width() * 3 ) - aAdjacentButtonSpacing ;
     339         [ #  # ]:          0 :     if (aButtonSpacing < aAdjacentButtonSpacing)
     340                 :            :     {
     341                 :          0 :         aButtonsWidth = aAdjacentButtonSpacing - aButtonSpacing;
     342                 :          0 :         aButtonSpacing = aAdjacentButtonSpacing;
     343                 :            :     }
     344                 :            : 
     345                 :          0 :     aButtonPos.X() = aDialogBorder;
     346                 :          0 :     aButtonPos.Y() = 0;
     347                 :            : 
     348                 :          0 :     aCreditsButton.SetPosPixel( aButtonPos );
     349                 :            : 
     350                 :          0 :     aButtonPos.X() += aButtonSize.Width() + aAdjacentButtonSpacing;
     351                 :          0 :     aWebsiteButton.SetPosPixel( aButtonPos );
     352                 :            : 
     353                 :          0 :     aButtonPos.X() += aButtonSize.Width() + aButtonSpacing;
     354                 :          0 :     aCancelButton.SetPosPixel( aButtonPos );
     355                 :            : 
     356                 :            : 
     357                 :          0 : }
     358                 :            : 
     359                 :          0 : void AboutDialog::MoveControl(Control& rControl, sal_Int32 X, sal_Int32 Y)
     360                 :            : {
     361         [ #  # ]:          0 :     Point aControlPos = rControl.GetPosPixel();
     362                 :          0 :     aControlPos.X() += X;
     363                 :          0 :     aControlPos.Y() += Y;
     364         [ #  # ]:          0 :     rControl.SetPosPixel(aControlPos);
     365                 :          0 : }
     366                 :            : 
     367                 :          0 : void AboutDialog::Paint( const Rectangle& rRect )
     368                 :            : {
     369 [ #  # ][ #  # ]:          0 :     SetClipRegion( rRect );
                 [ #  # ]
     370 [ #  # ][ #  # ]:          0 :     Point aPos ( rRect.GetWidth() - aBackgroundBitmap.GetSizePixel().Width(), rRect.GetHeight() - aBackgroundBitmap.GetSizePixel().Height() );
     371         [ #  # ]:          0 :     DrawBitmapEx( aPos, aBackgroundBitmap );
     372                 :          0 : }
     373                 :            : 
     374                 :          0 : rtl::OUString AboutDialog::GetBuildId()
     375                 :            : {
     376                 :          0 :     rtl::OUString sDefault;
     377         [ #  # ]:          0 :     rtl::OUString sBuildId(utl::Bootstrap::getBuildVersion(sDefault));
     378         [ #  # ]:          0 :     if (!sBuildId.isEmpty())
     379                 :          0 :         return sBuildId;
     380                 :            : 
     381         [ #  # ]:          0 :     sBuildId = utl::Bootstrap::getBuildIdData(sDefault);
     382                 :            : 
     383         [ #  # ]:          0 :     if (!sBuildId.isEmpty())
     384                 :            :     {
     385                 :          0 :         sal_Int32 nIndex = 0;
     386                 :          0 :         return sBuildId.getToken( 0, '-', nIndex );
     387                 :            :     }
     388                 :            : 
     389                 :            :     OSL_ENSURE( !sBuildId.isEmpty(), "No BUILDID in bootstrap file" );
     390                 :          0 :     return sBuildId;
     391                 :            : }
     392                 :            : 
     393                 :          0 : rtl::OUString AboutDialog::GetVersionString()
     394                 :            : {
     395                 :          0 :     rtl::OUString sVersion = m_aVersionTextStr;
     396                 :            : 
     397         [ #  # ]:          0 :     rtl::OUString sBuildId = GetBuildId();
     398                 :            : 
     399         [ #  # ]:          0 :     if (!sBuildId.trim().isEmpty())
     400                 :            :     {
     401                 :          0 :         sVersion += " ";
     402         [ #  # ]:          0 :         if (m_sBuildStr.indexOf("$BUILDID") == -1)
     403                 :            :         {
     404                 :            :             SAL_WARN( "cui.dialogs", "translated Build Id string in translations doesn't contain $BUILDID placeholder" );
     405                 :          0 :             m_sBuildStr += " $BUILDID";
     406                 :            :         }
     407                 :          0 :         sVersion += m_sBuildStr.replaceAll("$BUILDID", sBuildId);
     408                 :            :     }
     409                 :            : 
     410                 :          0 :     return sVersion;
     411                 :            : }
     412                 :            : 
     413                 :          0 : rtl::OUString AboutDialog::GetCopyrightString()
     414                 :            : {
     415                 :          0 :     rtl::OUString aCopyrightString = m_aVendorTextStr;
     416                 :          0 :     aCopyrightString += "\n";
     417                 :            : 
     418         [ #  # ]:          0 :     aCopyrightString += m_aCopyrightTextStr;
     419                 :          0 :     aCopyrightString += "\n";
     420                 :            : 
     421 [ #  # ][ #  # ]:          0 :     if (utl::ConfigManager::getProductName().equals("LibreOffice"))
     422         [ #  # ]:          0 :         aCopyrightString += m_aBasedTextStr;
     423                 :            :     else
     424         [ #  # ]:          0 :         aCopyrightString += m_aBasedDerivedTextStr;
     425                 :            : 
     426                 :          0 :     return aCopyrightString;
     427                 :            : }
     428                 :            : 
     429                 :          0 : IMPL_LINK_NOARG(AboutDialog, CancelHdl)
     430                 :            : {
     431                 :          0 :     Close();
     432                 :          0 :     return 0;
     433                 :            : }
     434                 :            : 
     435                 :          0 : sal_Bool AboutDialog::Close()
     436                 :            : {
     437                 :          0 :     EndDialog( RET_OK );
     438                 :          0 :     return sal_False;
     439                 :            : }
     440                 :            : 
     441                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10