LCOV - code coverage report
Current view: top level - vcl/source/app - svdata.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 82 222 36.9 %
Date: 2012-08-25 Functions: 9 18 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 60 404 14.9 %

           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                 :            : 
      30                 :            : #include <string.h>
      31                 :            : 
      32                 :            : #include <boost/ptr_container/ptr_vector.hpp>
      33                 :            : 
      34                 :            : #include <comphelper/string.hxx>
      35                 :            : 
      36                 :            : #include <osl/file.hxx>
      37                 :            : #include <osl/mutex.hxx>
      38                 :            : #include <rtl/process.h>
      39                 :            : #include "tools/debug.hxx"
      40                 :            : #include "tools/resary.hxx"
      41                 :            : 
      42                 :            : #include "unotools/fontcfg.hxx"
      43                 :            : 
      44                 :            : #include "cppuhelper/implbase1.hxx"
      45                 :            : 
      46                 :            : #include "uno/current_context.hxx"
      47                 :            : 
      48                 :            : #include "vcl/configsettings.hxx"
      49                 :            : #include "vcl/svapp.hxx"
      50                 :            : #include "vcl/wrkwin.hxx"
      51                 :            : #include "vcl/msgbox.hxx"
      52                 :            : #include "vcl/unohelp.hxx"
      53                 :            : #include "vcl/button.hxx" // for Button::GetStandardText
      54                 :            : #include "vcl/dockwin.hxx"  // for DockingManager
      55                 :            : #include "salinst.hxx"
      56                 :            : #include "salframe.hxx"
      57                 :            : #include "svdata.hxx"
      58                 :            : #include "window.h"
      59                 :            : #include "salimestatus.hxx"
      60                 :            : #include "salsys.hxx"
      61                 :            : #include "svids.hrc"
      62                 :            : 
      63                 :            : #include "com/sun/star/lang/XMultiServiceFactory.hpp"
      64                 :            : #include "com/sun/star/lang/XComponent.hpp"
      65                 :            : #include "com/sun/star/awt/XExtendedToolkit.hpp"
      66                 :            : #include "com/sun/star/java/JavaNotConfiguredException.hpp"
      67                 :            : #include "com/sun/star/java/JavaVMCreationFailureException.hpp"
      68                 :            : #include "com/sun/star/java/MissingJavaRuntimeException.hpp"
      69                 :            : #include "com/sun/star/java/JavaDisabledException.hpp"
      70                 :            : 
      71                 :            : #include <stdio.h>
      72                 :            : 
      73                 :            : namespace {
      74                 :            : 
      75                 :            : namespace css = com::sun::star;
      76                 :            : 
      77                 :            : }
      78                 :            : 
      79                 :            : using namespace com::sun::star::uno;
      80                 :            : using namespace com::sun::star::lang;
      81                 :            : using namespace com::sun::star::awt;
      82                 :            : using ::rtl::OUString;
      83                 :            : 
      84                 :            : // =======================================================================
      85                 :            : 
      86                 :            : namespace
      87                 :            : {
      88                 :            :     struct private_aImplSVData :
      89                 :            :         public rtl::Static<ImplSVData, private_aImplSVData> {};
      90                 :            : }
      91                 :            : 
      92                 :            : // static SV-Data
      93                 :            : ImplSVData* pImplSVData = NULL;
      94                 :            : 
      95                 :      11282 : SalSystem* ImplGetSalSystem()
      96                 :            : {
      97                 :      11282 :     ImplSVData* pSVData = ImplGetSVData();
      98         [ +  + ]:      11282 :     if( ! pSVData->mpSalSystem )
      99                 :        106 :         pSVData->mpSalSystem = pSVData->mpDefInst->CreateSalSystem();
     100                 :      11282 :     return pSVData->mpSalSystem;
     101                 :            : }
     102                 :            : 
     103                 :            : 
     104                 :          0 : static rtl::OUString ReplaceJavaErrorMessages( const rtl::OUString& rString )
     105                 :            : {
     106                 :            :     return rString.replaceAll("%OK", Button::GetStandardText(BUTTON_OK)).
     107                 :            :             replaceAll("%IGNORE", Button::GetStandardText(BUTTON_IGNORE)).
     108 [ #  # ][ #  # ]:          0 :             replaceAll("%CANCEL", Button::GetStandardText(BUTTON_CANCEL));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     109                 :            : }
     110                 :            : 
     111                 :            : // =======================================================================
     112                 :            : 
     113                 :        266 : void ImplInitSVData()
     114                 :            : {
     115                 :        266 :     pImplSVData = &private_aImplSVData::get();
     116                 :            : 
     117                 :            :     // init global instance data
     118                 :        266 :     memset( pImplSVData, 0, sizeof( ImplSVData ) );
     119                 :        266 :     pImplSVData->maHelpData.mbAutoHelpId = sal_True;
     120                 :        266 :     pImplSVData->maNWFData.maMenuBarHighlightTextColor = Color( COL_TRANSPARENT );
     121                 :            : 
     122                 :            :     // mark default layout border as unitialized
     123                 :        266 :     pImplSVData->maAppData.mnDefaultLayoutBorder = -1;
     124                 :        266 : }
     125                 :            : 
     126                 :            : // -----------------------------------------------------------------------
     127                 :            : 
     128                 :        158 : void ImplDeInitSVData()
     129                 :            : {
     130                 :        158 :     ImplSVData* pSVData = ImplGetSVData();
     131                 :            : 
     132                 :            :     // delete global instance data
     133         [ -  + ]:        158 :     if( pSVData->mpSettingsConfigItem )
     134         [ #  # ]:          0 :         delete pSVData->mpSettingsConfigItem;
     135                 :            : 
     136         [ +  - ]:        158 :     if( pSVData->mpDockingManager )
     137         [ +  - ]:        158 :         delete pSVData->mpDockingManager;
     138                 :            : 
     139         [ -  + ]:        158 :     if( pSVData->maGDIData.mpDefaultFontConfiguration )
     140         [ #  # ]:          0 :         delete pSVData->maGDIData.mpDefaultFontConfiguration;
     141         [ -  + ]:        158 :     if( pSVData->maGDIData.mpFontSubstConfiguration )
     142         [ #  # ]:          0 :         delete pSVData->maGDIData.mpFontSubstConfiguration;
     143                 :            : 
     144         [ -  + ]:        158 :     if ( pSVData->maAppData.mpMSFTempFileName )
     145                 :            :     {
     146         [ #  # ]:          0 :         if ( pSVData->maAppData.mxMSF.is() )
     147                 :            :         {
     148         [ #  # ]:          0 :             ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( pSVData->maAppData.mxMSF, ::com::sun::star::uno::UNO_QUERY );
     149 [ #  # ][ #  # ]:          0 :             xComp->dispose();
     150         [ #  # ]:          0 :             pSVData->maAppData.mxMSF = NULL;
     151                 :            :         }
     152                 :            : 
     153                 :          0 :         ::rtl::OUString aFileUrl;
     154 [ #  # ][ #  # ]:          0 :         ::osl::File::getFileURLFromSystemPath( *pSVData->maAppData.mpMSFTempFileName, aFileUrl );
     155         [ #  # ]:          0 :         osl::File::remove( aFileUrl );
     156 [ #  # ][ #  # ]:          0 :         delete pSVData->maAppData.mpMSFTempFileName;
     157                 :          0 :         pSVData->maAppData.mpMSFTempFileName = NULL;
     158                 :            :     }
     159                 :            : 
     160         [ +  + ]:        158 :     if( pSVData->maCtrlData.mpFieldUnitStrings )
     161         [ +  - ]:         58 :         delete pSVData->maCtrlData.mpFieldUnitStrings, pSVData->maCtrlData.mpFieldUnitStrings = NULL;
     162         [ +  + ]:        158 :     if( pSVData->maCtrlData.mpCleanUnitStrings )
     163         [ +  - ]:         58 :         delete pSVData->maCtrlData.mpCleanUnitStrings, pSVData->maCtrlData.mpCleanUnitStrings = NULL;
     164         [ -  + ]:        158 :     if( pSVData->mpPaperNames )
     165         [ #  # ]:          0 :         delete pSVData->mpPaperNames, pSVData->mpPaperNames = NULL;
     166                 :        158 : }
     167                 :            : 
     168                 :            : // -----------------------------------------------------------------------
     169                 :            : 
     170                 :        158 : void ImplDestroySVData()
     171                 :            : {
     172                 :        158 :     pImplSVData = NULL;
     173                 :        158 : }
     174                 :            : 
     175                 :            : // -----------------------------------------------------------------------
     176                 :            : 
     177                 :     132576 : Window* ImplGetDefaultWindow()
     178                 :            : {
     179                 :     132576 :     ImplSVData* pSVData = ImplGetSVData();
     180         [ -  + ]:     132576 :     if ( pSVData->maWinData.mpAppWin )
     181                 :          0 :         return pSVData->maWinData.mpAppWin;
     182                 :            : 
     183                 :            :     // First test if we already have a default window.
     184                 :            :     // Don't only place a single if..else inside solar mutex lockframe
     185                 :            :     // because then we might have to wait for the solar mutex what is not neccessary
     186                 :            :     // if we already have a default window.
     187                 :            : 
     188         [ +  + ]:     132576 :     if ( !pSVData->mpDefaultWin )
     189                 :            :     {
     190                 :        245 :         Application::GetSolarMutex().acquire();
     191                 :            : 
     192                 :            :         // Test again because the thread who released the solar mutex could have called
     193                 :            :         // the same method
     194                 :            : 
     195 [ +  - ][ +  - ]:        245 :         if ( !pSVData->mpDefaultWin && !pSVData->mbDeInit )
     196                 :            :         {
     197                 :            :             DBG_WARNING( "ImplGetDefaultWindow(): No AppWindow" );
     198         [ +  - ]:        245 :             pSVData->mpDefaultWin = new WorkWindow( 0, WB_DEFAULTWIN );
     199 [ +  - ][ +  - ]:        245 :             pSVData->mpDefaultWin->SetText( OUString( "VCL ImplGetDefaultWindow"  ) );
                 [ +  - ]
     200                 :            :         }
     201                 :        245 :         Application::GetSolarMutex().release();
     202                 :            :     }
     203                 :            : 
     204                 :     132576 :     return pSVData->mpDefaultWin;
     205                 :            : }
     206                 :            : 
     207                 :            : // -----------------------------------------------------------------------
     208                 :            : 
     209                 :            : #define VCL_CREATERESMGR_NAME( Name )   #Name
     210                 :            : 
     211                 :       5366 : ResMgr* ImplGetResMgr()
     212                 :            : {
     213                 :       5366 :     ImplSVData* pSVData = ImplGetSVData();
     214         [ +  + ]:       5366 :     if ( !pSVData->mpResMgr )
     215                 :            :     {
     216 [ +  - ][ +  - ]:        209 :         ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
     217         [ +  - ]:        209 :         pSVData->mpResMgr = ResMgr::SearchCreateResMgr( VCL_CREATERESMGR_NAME( vcl ), aLocale );
     218                 :            : 
     219                 :            :         static bool bMessageOnce = false;
     220 [ -  + ][ #  # ]:        209 :         if( !pSVData->mpResMgr && ! bMessageOnce )
     221                 :            :         {
     222                 :          0 :             bMessageOnce = true;
     223                 :            :             const char* pMsg =
     224                 :            :                 "Missing vcl resource. This indicates that files vital to localization are missing. "
     225                 :          0 :                 "You might have a corrupt installation.";
     226         [ #  # ]:          0 :             fprintf( stderr, "%s\n", pMsg );
     227 [ #  # ][ #  # ]:          0 :             ErrorBox aBox( NULL, WB_OK | WB_DEF_OK, rtl::OUString( pMsg, strlen( pMsg ), RTL_TEXTENCODING_ASCII_US ) );
         [ #  # ][ #  # ]
     228 [ #  # ][ #  # ]:          0 :             aBox.Execute();
     229                 :        209 :         }
     230                 :            :     }
     231                 :       5366 :     return pSVData->mpResMgr;
     232                 :            : }
     233                 :            : 
     234                 :          0 : ResId VclResId( sal_Int32 nId )
     235                 :            : {
     236                 :          0 :     ResMgr* pMgr = ImplGetResMgr();
     237         [ #  # ]:          0 :     if( ! pMgr )
     238                 :          0 :         throw std::bad_alloc();
     239                 :            : 
     240                 :          0 :     return ResId( nId, *pMgr );
     241                 :            : }
     242                 :            : 
     243                 :      38097 : FieldUnitStringList* ImplGetFieldUnits()
     244                 :            : {
     245                 :      38097 :     ImplSVData* pSVData = ImplGetSVData();
     246         [ +  + ]:      38097 :     if( ! pSVData->maCtrlData.mpFieldUnitStrings )
     247                 :            :     {
     248                 :         58 :         ResMgr* pResMgr = ImplGetResMgr();
     249         [ +  - ]:         58 :         if( pResMgr )
     250                 :            :         {
     251         [ +  - ]:         58 :             ResStringArray aUnits( ResId (SV_FUNIT_STRINGS, *pResMgr) );
     252                 :         58 :             sal_uInt32 nUnits = aUnits.Count();
     253 [ +  - ][ +  - ]:         58 :             pSVData->maCtrlData.mpFieldUnitStrings = new FieldUnitStringList();
     254         [ +  - ]:         58 :             pSVData->maCtrlData.mpFieldUnitStrings->reserve( nUnits );
     255         [ +  + ]:       1218 :             for( sal_uInt32 i = 0; i < nUnits; i++ )
     256                 :            :             {
     257 [ +  - ][ +  - ]:       1160 :                 std::pair< String, FieldUnit > aElement( aUnits.GetString(i), static_cast<FieldUnit>(aUnits.GetValue(i)) );
                 [ +  - ]
     258         [ +  - ]:       1160 :                 pSVData->maCtrlData.mpFieldUnitStrings->push_back( aElement );
     259 [ +  - ][ +  - ]:       1218 :             }
     260                 :            :         }
     261                 :            :     }
     262                 :      38097 :     return pSVData->maCtrlData.mpFieldUnitStrings;
     263                 :            : }
     264                 :            : 
     265                 :       7566 : FieldUnitStringList* ImplGetCleanedFieldUnits()
     266                 :            : {
     267                 :       7566 :     ImplSVData* pSVData = ImplGetSVData();
     268         [ +  + ]:       7566 :     if( ! pSVData->maCtrlData.mpCleanUnitStrings )
     269                 :            :     {
     270                 :         58 :         FieldUnitStringList* pUnits = ImplGetFieldUnits();
     271         [ +  - ]:         58 :         if( pUnits )
     272                 :            :         {
     273                 :         58 :             size_t nUnits = pUnits->size();
     274         [ +  - ]:         58 :             pSVData->maCtrlData.mpCleanUnitStrings = new FieldUnitStringList();
     275                 :         58 :             pSVData->maCtrlData.mpCleanUnitStrings->reserve( nUnits );
     276         [ +  + ]:       1218 :             for( size_t i = 0; i < nUnits; ++i )
     277                 :            :             {
     278 [ +  - ][ +  - ]:       1160 :                 rtl::OUString aUnit( (*pUnits)[i].first );
     279                 :       1160 :                 aUnit = comphelper::string::remove(aUnit, ' ');
     280                 :       1160 :                 aUnit = aUnit.toAsciiLowerCase();
     281 [ +  - ][ +  - ]:       1160 :                 std::pair< String, FieldUnit > aElement( aUnit, (*pUnits)[i].second );
     282         [ +  - ]:       1160 :                 pSVData->maCtrlData.mpCleanUnitStrings->push_back( aElement );
     283         [ +  - ]:       1160 :             }
     284                 :            :         }
     285                 :            :     }
     286                 :       7566 :     return pSVData->maCtrlData.mpCleanUnitStrings;
     287                 :            : }
     288                 :            : 
     289                 :    2676196 : DockingManager* ImplGetDockingManager()
     290                 :            : {
     291                 :    2676196 :     ImplSVData* pSVData = ImplGetSVData();
     292         [ +  + ]:    2676196 :     if ( !pSVData->mpDockingManager )
     293         [ +  - ]:        209 :         pSVData->mpDockingManager = new DockingManager();
     294                 :            : 
     295                 :    2676196 :     return pSVData->mpDockingManager;
     296                 :            : }
     297                 :            : 
     298         [ #  # ]:          0 : class AccessBridgeCurrentContext: public cppu::WeakImplHelper1< com::sun::star::uno::XCurrentContext >
     299                 :            : {
     300                 :            : public:
     301                 :          0 :     AccessBridgeCurrentContext(
     302                 :            :         const com::sun::star::uno::Reference< com::sun::star::uno::XCurrentContext > &context ) :
     303                 :          0 :         m_prevContext( context ) {}
     304                 :            : 
     305                 :            :     // XCurrentContext
     306                 :            :     virtual com::sun::star::uno::Any SAL_CALL getValueByName( const rtl::OUString& Name )
     307                 :            :         throw (com::sun::star::uno::RuntimeException);
     308                 :            : private:
     309                 :            :     com::sun::star::uno::Reference< com::sun::star::uno::XCurrentContext > m_prevContext;
     310                 :            : };
     311                 :            : 
     312                 :          0 : com::sun::star::uno::Any AccessBridgeCurrentContext::getValueByName( const rtl::OUString & Name )
     313                 :            :     throw (com::sun::star::uno::RuntimeException)
     314                 :            : {
     315                 :          0 :     com::sun::star::uno::Any ret;
     316         [ #  # ]:          0 :     if ( Name == "java-vm.interaction-handler" )
     317                 :            :     {
     318                 :            :         // Currently, for accessbility no interaction handler shall be offered.
     319                 :            :         // There may be introduced later on a handler using native toolkits
     320                 :            :         // jbu->obr: Instantiate here your interaction handler
     321                 :            :     }
     322         [ #  # ]:          0 :     else if( m_prevContext.is() )
     323                 :            :     {
     324 [ #  # ][ #  # ]:          0 :         ret = m_prevContext->getValueByName( Name );
     325                 :            :     }
     326                 :          0 :     return ret;
     327                 :            : }
     328                 :            : 
     329                 :            : 
     330                 :          0 : bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled)
     331                 :            : {
     332                 :          0 :     rCancelled = sal_False;
     333                 :            : 
     334                 :          0 :     bool bErrorMessage = true;
     335                 :            : 
     336                 :            :     // Note:
     337                 :            :     // if bAllowCancel is sal_True we were called from application startup
     338                 :            :     //  where we will disable any Java errorboxes and show our own accessibility dialog if Java throws an exception
     339                 :            :     // if bAllowCancel is sal_False we were called from Tools->Options
     340                 :            :     //  where we will see Java errorboxes, se we do not show our dialogs in addition to Java's
     341                 :            : 
     342                 :            :     try
     343                 :            :     {
     344                 :          0 :         bool bSuccess = true;
     345                 :            : 
     346                 :            :         // No error messages when env var is set ..
     347 [ #  # ][ #  # ]:          0 :         static const char* pEnv = getenv("SAL_ACCESSIBILITY_ENABLED" );
     348 [ #  # ][ #  # ]:          0 :         if( pEnv && *pEnv )
     349                 :            :         {
     350                 :          0 :             bErrorMessage = false;
     351                 :            :         }
     352                 :            : 
     353         [ #  # ]:          0 :         ImplSVData* pSVData = ImplGetSVData();
     354         [ #  # ]:          0 :         if( ! pSVData->mxAccessBridge.is() )
     355                 :            :         {
     356         [ #  # ]:          0 :             css::uno::Reference< XMultiServiceFactory > xFactory(vcl::unohelper::GetMultiServiceFactory());
     357                 :            : 
     358         [ #  # ]:          0 :             if( xFactory.is() )
     359                 :            :             {
     360                 :            :                 css::uno::Reference< XExtendedToolkit > xToolkit =
     361 [ #  # ][ #  # ]:          0 :                     css::uno::Reference< XExtendedToolkit >(Application::GetVCLToolkit(), UNO_QUERY);
     362                 :            : 
     363         [ #  # ]:          0 :                 Sequence< Any > arguments(1);
     364 [ #  # ][ #  # ]:          0 :                 arguments[0] = makeAny(xToolkit);
     365                 :            : 
     366                 :            :                 // Disable default java error messages on startup, because they were probably unreadable
     367                 :            :                 // for a disabled user. Use native message boxes which are accessible without java support.
     368                 :            :                 // No need to do this when activated by Tools-Options dialog ..
     369         [ #  # ]:          0 :                 if( bAllowCancel )
     370                 :            :                 {
     371                 :            :                     // customize the java-not-available-interaction-handler entry within the
     372                 :            :                     // current context when called at startup.
     373                 :            :                     com::sun::star::uno::ContextLayer layer(
     374 [ #  # ][ #  # ]:          0 :                         new AccessBridgeCurrentContext( com::sun::star::uno::getCurrentContext() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     375                 :            : 
     376         [ #  # ]:          0 :                     pSVData->mxAccessBridge = xFactory->createInstanceWithArguments(
     377                 :            :                             OUString("com.sun.star.accessibility.AccessBridge"),
     378                 :            :                             arguments
     379 [ #  # ][ #  # ]:          0 :                         );
                 [ #  # ]
     380                 :            :                 }
     381                 :            :                 else
     382                 :            :                 {
     383         [ #  # ]:          0 :                     pSVData->mxAccessBridge = xFactory->createInstanceWithArguments(
     384                 :            :                             OUString("com.sun.star.accessibility.AccessBridge"),
     385                 :            :                             arguments
     386 [ #  # ][ #  # ]:          0 :                         );
     387                 :            :                 }
     388                 :            : 
     389         [ #  # ]:          0 :                 if( !pSVData->mxAccessBridge.is() )
     390         [ #  # ]:          0 :                     bSuccess = false;
     391                 :          0 :             }
     392                 :            :         }
     393                 :            : 
     394                 :          0 :         return bSuccess;
     395                 :            :     }
     396                 :          0 :     catch (const ::com::sun::star::java::JavaNotConfiguredException&)
     397                 :            :     {
     398         [ #  # ]:          0 :         ResMgr *pResMgr = ImplGetResMgr();
     399   [ #  #  #  #  :          0 :         if( bErrorMessage && bAllowCancel && pResMgr )
                   #  # ]
     400                 :            :         {
     401         [ #  # ]:          0 :             rtl::OUString aTitle(ResId(SV_ACCESSERROR_JAVA_NOT_CONFIGURED, *pResMgr).toString());
     402   [ #  #  #  # ]:          0 :             rtl::OUStringBuffer aMessage((ResId(SV_ACCESSERROR_JAVA_MSG, *pResMgr)).toString());
     403                 :            : 
     404   [ #  #  #  #  :          0 :             aMessage.append(' ').append(ResId(SV_ACCESSERROR_OK_CANCEL_MSG, *pResMgr).toString());
                   #  # ]
     405                 :            : 
     406         [ #  # ]:          0 :             int ret = ImplGetSalSystem()->ShowNativeMessageBox(
     407                 :            :                 aTitle,
     408                 :            :                 ReplaceJavaErrorMessages(aMessage.makeStringAndClear()),
     409                 :            :                 SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL,
     410   [ #  #  #  #  :          0 :                 SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL);
                   #  # ]
     411                 :            : 
     412                 :            :             // Do not change the setting in case the user chooses to cancel
     413         [ #  # ]:          0 :             if( SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL == ret )
     414                 :          0 :                 rCancelled = sal_True;
     415                 :            :         }
     416                 :            : 
     417                 :          0 :         return false;
     418                 :            :     }
     419                 :          0 :     catch (const ::com::sun::star::java::JavaVMCreationFailureException&)
     420                 :            :     {
     421         [ #  # ]:          0 :         ResMgr *pResMgr = ImplGetResMgr();
     422   [ #  #  #  #  :          0 :         if( bErrorMessage && bAllowCancel && pResMgr )
                   #  # ]
     423                 :            :         {
     424         [ #  # ]:          0 :             rtl::OUString aTitle(ResId(SV_ACCESSERROR_FAULTY_JAVA, *pResMgr).toString());
     425   [ #  #  #  # ]:          0 :             rtl::OUStringBuffer aMessage(ResId(SV_ACCESSERROR_JAVA_MSG, *pResMgr).toString());
     426                 :            : 
     427   [ #  #  #  #  :          0 :             aMessage.append(' ').append(ResId(SV_ACCESSERROR_OK_CANCEL_MSG, *pResMgr).toString());
                   #  # ]
     428                 :            : 
     429         [ #  # ]:          0 :             int ret = ImplGetSalSystem()->ShowNativeMessageBox(
     430                 :            :                 aTitle,
     431                 :            :                 ReplaceJavaErrorMessages(aMessage.makeStringAndClear()),
     432                 :            :                 SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL,
     433   [ #  #  #  #  :          0 :                 SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL);
                   #  # ]
     434                 :            : 
     435                 :            :             // Do not change the setting in case the user chooses to cancel
     436         [ #  # ]:          0 :             if( SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL == ret )
     437                 :          0 :                 rCancelled = sal_True;
     438                 :            :         }
     439                 :            : 
     440                 :          0 :         return false;
     441                 :            :     }
     442                 :          0 :     catch (const ::com::sun::star::java::MissingJavaRuntimeException&)
     443                 :            :     {
     444         [ #  # ]:          0 :         ResMgr *pResMgr = ImplGetResMgr();
     445   [ #  #  #  #  :          0 :         if( bErrorMessage && bAllowCancel && pResMgr )
                   #  # ]
     446                 :            :         {
     447         [ #  # ]:          0 :             rtl::OUString aTitle(ResId(SV_ACCESSERROR_MISSING_JAVA, *pResMgr).toString());
     448   [ #  #  #  # ]:          0 :             rtl::OUStringBuffer aMessage(ResId(SV_ACCESSERROR_JAVA_MSG, *pResMgr).toString());
     449                 :            : 
     450   [ #  #  #  #  :          0 :             aMessage.append(' ').append(ResId(SV_ACCESSERROR_OK_CANCEL_MSG, *pResMgr).toString());
                   #  # ]
     451                 :            : 
     452         [ #  # ]:          0 :             int ret = ImplGetSalSystem()->ShowNativeMessageBox(
     453                 :            :                 aTitle,
     454                 :            :                 ReplaceJavaErrorMessages(aMessage.makeStringAndClear()),
     455                 :            :                 SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL,
     456   [ #  #  #  #  :          0 :                 SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL);
                   #  # ]
     457                 :            : 
     458                 :            :             // Do not change the setting in case the user chooses to cancel
     459         [ #  # ]:          0 :             if( SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL == ret )
     460                 :          0 :                 rCancelled = sal_True;
     461                 :            :         }
     462                 :            : 
     463                 :          0 :         return false;
     464                 :            :     }
     465                 :          0 :     catch (const ::com::sun::star::java::JavaDisabledException&)
     466                 :            :     {
     467         [ #  # ]:          0 :         ResMgr *pResMgr = ImplGetResMgr();
     468   [ #  #  #  #  :          0 :         if( bErrorMessage && bAllowCancel && pResMgr )
                   #  # ]
     469                 :            :         {
     470         [ #  # ]:          0 :             rtl::OUString aTitle(ResId(SV_ACCESSERROR_JAVA_DISABLED, *pResMgr).toString());
     471   [ #  #  #  # ]:          0 :             rtl::OUStringBuffer aMessage(ResId(SV_ACCESSERROR_JAVA_MSG, *pResMgr).toString());
     472                 :            : 
     473   [ #  #  #  #  :          0 :             aMessage.append(' ').append(ResId(SV_ACCESSERROR_OK_CANCEL_MSG, *pResMgr).toString());
                   #  # ]
     474                 :            : 
     475         [ #  # ]:          0 :             int ret = ImplGetSalSystem()->ShowNativeMessageBox(
     476                 :            :                 aTitle,
     477                 :            :                 ReplaceJavaErrorMessages(aMessage.makeStringAndClear()),
     478                 :            :                 SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL,
     479   [ #  #  #  #  :          0 :                 SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL);
                   #  # ]
     480                 :            : 
     481                 :            :             // Do not change the setting in case the user chooses to cancel
     482         [ #  # ]:          0 :             if( SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL == ret )
     483                 :          0 :                 rCancelled = sal_True;
     484                 :            :         }
     485                 :            : 
     486                 :          0 :         return false;
     487                 :            :     }
     488   [ #  #  #  #  :          0 :     catch (const ::com::sun::star::uno::RuntimeException& e)
                   #  # ]
     489                 :            :     {
     490         [ #  # ]:          0 :         ResMgr *pResMgr = ImplGetResMgr();
     491   [ #  #  #  # ]:          0 :         if( bErrorMessage && pResMgr )
     492                 :            :         {
     493                 :          0 :             rtl::OUString aTitle;
     494   [ #  #  #  # ]:          0 :             rtl::OUStringBuffer aMessage(ResId(SV_ACCESSERROR_BRIDGE_MSG, *pResMgr).toString());
     495                 :            : 
     496         [ #  # ]:          0 :             if( 0 == e.Message.compareTo(::rtl::OUString("ClassNotFound"), 13) )
     497                 :            :             {
     498         [ #  # ]:          0 :                 aTitle = ResId(SV_ACCESSERROR_MISSING_BRIDGE, *pResMgr).toString();
     499                 :            :             }
     500         [ #  # ]:          0 :             else if( 0 == e.Message.compareTo(::rtl::OUString("NoSuchMethod"), 12) )
     501                 :            :             {
     502         [ #  # ]:          0 :                 aTitle = ResId(SV_ACCESSERROR_WRONG_VERSION, *pResMgr).toString();
     503                 :            :             }
     504                 :            : 
     505         [ #  # ]:          0 :             if (!aTitle.isEmpty())
     506                 :            :             {
     507         [ #  # ]:          0 :                 if( bAllowCancel )
     508                 :            :                 {
     509                 :            :                     // Something went wrong initializing the Java AccessBridge (on Windows) during the
     510                 :            :                     // startup. Since the office will be probably unusable for a disabled user, we offer
     511                 :            :                     // to terminate directly.
     512   [ #  #  #  #  :          0 :                     aMessage.append(' ').append(ResId(SV_ACCESSERROR_OK_CANCEL_MSG, *pResMgr).toString());
                   #  # ]
     513                 :            : 
     514         [ #  # ]:          0 :                     int ret = ImplGetSalSystem()->ShowNativeMessageBox(
     515                 :            :                         aTitle,
     516                 :            :                         ReplaceJavaErrorMessages(aMessage.makeStringAndClear()),
     517                 :            :                         SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK_CANCEL,
     518   [ #  #  #  #  :          0 :                         SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL);
                   #  # ]
     519                 :            : 
     520                 :            :                     // Do not change the setting in case the user chooses to cancel
     521         [ #  # ]:          0 :                     if( SALSYSTEM_SHOWNATIVEMSGBOX_BTN_CANCEL == ret )
     522                 :          0 :                         rCancelled = sal_True;
     523                 :            :                 }
     524                 :            :                 else
     525                 :            :                 {
     526                 :            :                     // The user tried to activate accessibility support using Tools-Options dialog,
     527                 :            :                     // so we don't offer to terminate here !
     528         [ #  # ]:          0 :                     ImplGetSalSystem()->ShowNativeMessageBox(
     529                 :            :                         aTitle,
     530                 :            :                         ReplaceJavaErrorMessages(aMessage.makeStringAndClear()),
     531                 :            :                         SALSYSTEM_SHOWNATIVEMSGBOX_BTNCOMBI_OK,
     532   [ #  #  #  #  :          0 :                         SALSYSTEM_SHOWNATIVEMSGBOX_BTN_OK);
                   #  # ]
     533                 :            :                 }
     534                 :          0 :             }
     535                 :            :         }
     536                 :            : 
     537                 :          0 :         return false;
     538                 :            :     }
     539                 :          0 :     catch (...)
     540                 :            :     {
     541                 :          0 :         return false;
     542                 :            :     }
     543                 :            : }
     544                 :            : 
     545                 :            : // -----------------------------------------------------------------------
     546                 :            : 
     547                 :          0 : Window* ImplFindWindow( const SalFrame* pFrame, Point& rSalFramePos )
     548                 :            : {
     549                 :          0 :     ImplSVData* pSVData = ImplGetSVData();
     550                 :          0 :     Window*     pFrameWindow = pSVData->maWinData.mpFirstFrame;
     551         [ #  # ]:          0 :     while ( pFrameWindow )
     552                 :            :     {
     553         [ #  # ]:          0 :         if ( pFrameWindow->ImplGetFrame() == pFrame )
     554                 :            :         {
     555                 :          0 :             Window* pWindow = pFrameWindow->ImplFindWindow( rSalFramePos );
     556         [ #  # ]:          0 :             if ( !pWindow )
     557                 :          0 :                 pWindow = pFrameWindow->ImplGetWindow();
     558                 :          0 :             rSalFramePos = pWindow->ImplFrameToOutput( rSalFramePos );
     559                 :          0 :             return pWindow;
     560                 :            :         }
     561                 :          0 :         pFrameWindow = pFrameWindow->ImplGetFrameData()->mpNextFrame;
     562                 :            :     }
     563                 :            : 
     564                 :          0 :     return NULL;
     565                 :            : }
     566                 :            : 
     567                 :          0 : void LocaleConfigurationListener::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 nHint )
     568                 :            : {
     569                 :          0 :     AllSettings::LocaleSettingsChanged( nHint );
     570                 :          0 : }
     571                 :            : 
     572                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10