LCOV - code coverage report
Current view: top level - framework/source/fwe/classes - sfxhelperfunctions.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 44 71 62.0 %
Date: 2012-08-25 Functions: 8 12 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 26 84 31.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                 :            : 
      30                 :            : #include <framework/sfxhelperfunctions.hxx>
      31                 :            : 
      32                 :            : #include <tools/diagnose_ex.h>
      33                 :            : 
      34                 :            : static pfunc_setToolBoxControllerCreator   pToolBoxControllerCreator   = NULL;
      35                 :            : static pfunc_setStatusBarControllerCreator pStatusBarControllerCreator = NULL;
      36                 :            : static pfunc_getRefreshToolbars            pRefreshToolbars            = NULL;
      37                 :            : static pfunc_createDockingWindow           pCreateDockingWindow        = NULL;
      38                 :            : static pfunc_isDockingWindowVisible        pIsDockingWindowVisible     = NULL;
      39                 :            : static pfunc_activateToolPanel             pActivateToolPanel          = NULL;
      40                 :            : 
      41                 :            : 
      42                 :            : 
      43                 :            : using namespace ::com::sun::star::uno;
      44                 :            : using namespace ::com::sun::star::frame;
      45                 :            : 
      46                 :            : namespace framework
      47                 :            : {
      48                 :            : 
      49                 :        233 : pfunc_setToolBoxControllerCreator SAL_CALL SetToolBoxControllerCreator( pfunc_setToolBoxControllerCreator pSetToolBoxControllerCreator )
      50                 :            : {
      51 [ +  - ][ +  - ]:        233 :     ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      52                 :        233 :     pfunc_setToolBoxControllerCreator pOldSetToolBoxControllerCreator = pToolBoxControllerCreator;
      53                 :        233 :     pToolBoxControllerCreator = pSetToolBoxControllerCreator;
      54         [ +  - ]:        233 :     return pOldSetToolBoxControllerCreator;
      55                 :            : }
      56                 :            : 
      57                 :      69396 : svt::ToolboxController* SAL_CALL CreateToolBoxController( const Reference< XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const ::rtl::OUString& aCommandURL )
      58                 :            : {
      59                 :      69396 :     pfunc_setToolBoxControllerCreator pFactory = NULL;
      60                 :            :     {
      61 [ +  - ][ +  - ]:      69396 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      62         [ +  - ]:      69396 :         pFactory = pToolBoxControllerCreator;
      63                 :            :     }
      64                 :            : 
      65         [ +  - ]:      69396 :     if ( pFactory )
      66                 :      69396 :         return (*pFactory)( rFrame, pToolbox, nID, aCommandURL );
      67                 :            :     else
      68                 :      69396 :         return NULL;
      69                 :            : }
      70                 :            : 
      71                 :        233 : pfunc_setStatusBarControllerCreator SAL_CALL SetStatusBarControllerCreator( pfunc_setStatusBarControllerCreator pSetStatusBarControllerCreator )
      72                 :            : {
      73 [ +  - ][ +  - ]:        233 :     ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      74                 :        233 :     pfunc_setStatusBarControllerCreator pOldSetStatusBarControllerCreator = pSetStatusBarControllerCreator;
      75                 :        233 :     pStatusBarControllerCreator = pSetStatusBarControllerCreator;
      76         [ +  - ]:        233 :     return pOldSetStatusBarControllerCreator;
      77                 :            : }
      78                 :            : 
      79                 :      11575 : svt::StatusbarController* SAL_CALL CreateStatusBarController( const Reference< XFrame >& rFrame, StatusBar* pStatusBar, unsigned short nID, const ::rtl::OUString& aCommandURL )
      80                 :            : {
      81                 :      11575 :     pfunc_setStatusBarControllerCreator pFactory = NULL;
      82                 :            :     {
      83 [ +  - ][ +  - ]:      11575 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      84         [ +  - ]:      11575 :         pFactory = pStatusBarControllerCreator;
      85                 :            :     }
      86                 :            : 
      87         [ +  - ]:      11575 :     if ( pFactory )
      88                 :      11575 :         return (*pFactory)( rFrame, pStatusBar, nID, aCommandURL );
      89                 :            :     else
      90                 :      11575 :         return NULL;
      91                 :            : }
      92                 :            : 
      93                 :        233 : pfunc_getRefreshToolbars SAL_CALL SetRefreshToolbars( pfunc_getRefreshToolbars pNewRefreshToolbarsFunc )
      94                 :            : {
      95 [ +  - ][ +  - ]:        233 :     ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      96                 :        233 :     pfunc_getRefreshToolbars pOldFunc = pRefreshToolbars;
      97                 :        233 :     pRefreshToolbars = pNewRefreshToolbarsFunc;
      98                 :            : 
      99         [ +  - ]:        233 :     return pOldFunc;
     100                 :            : }
     101                 :            : 
     102                 :          0 : void SAL_CALL RefreshToolbars( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame )
     103                 :            : {
     104                 :          0 :     pfunc_getRefreshToolbars pCallback = NULL;
     105                 :            :     {
     106 [ #  # ][ #  # ]:          0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     107         [ #  # ]:          0 :         pCallback = pRefreshToolbars;
     108                 :            :     }
     109                 :            : 
     110         [ #  # ]:          0 :     if ( pCallback )
     111                 :          0 :         (*pCallback)( rFrame );
     112                 :          0 : }
     113                 :            : 
     114                 :        233 : pfunc_createDockingWindow SAL_CALL SetDockingWindowCreator( pfunc_createDockingWindow pNewCreateDockingWindow )
     115                 :            : {
     116 [ +  - ][ +  - ]:        233 :     ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     117                 :        233 :     pfunc_createDockingWindow pOldFunc = pCreateDockingWindow;
     118                 :        233 :     pCreateDockingWindow = pNewCreateDockingWindow;
     119                 :            : 
     120         [ +  - ]:        233 :     return pOldFunc;
     121                 :            : }
     122                 :            : 
     123                 :          0 : void SAL_CALL CreateDockingWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rResourceURL )
     124                 :            : {
     125                 :          0 :     pfunc_createDockingWindow pFactory = NULL;
     126                 :            :     {
     127 [ #  # ][ #  # ]:          0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     128         [ #  # ]:          0 :         pFactory = pCreateDockingWindow;
     129                 :            :     }
     130                 :            : 
     131         [ #  # ]:          0 :     if ( pFactory )
     132                 :          0 :         (*pFactory)( rFrame, rResourceURL );
     133                 :          0 : }
     134                 :            : 
     135                 :        233 : pfunc_isDockingWindowVisible SAL_CALL SetIsDockingWindowVisible( pfunc_isDockingWindowVisible pNewIsDockingWindowVisible)
     136                 :            : {
     137 [ +  - ][ +  - ]:        233 :     ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     138                 :        233 :     pfunc_isDockingWindowVisible pOldFunc = pIsDockingWindowVisible;
     139                 :        233 :     pIsDockingWindowVisible = pNewIsDockingWindowVisible;
     140                 :            : 
     141         [ +  - ]:        233 :     return pOldFunc;
     142                 :            : }
     143                 :            : 
     144                 :          0 : bool SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rResourceURL )
     145                 :            : {
     146                 :          0 :     pfunc_isDockingWindowVisible pCall = NULL;
     147                 :            :     {
     148 [ #  # ][ #  # ]:          0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     149         [ #  # ]:          0 :         pCall = pIsDockingWindowVisible;
     150                 :            :     }
     151                 :            : 
     152         [ #  # ]:          0 :     if ( pCall )
     153                 :          0 :         return (*pCall)( rFrame, rResourceURL );
     154                 :            :     else
     155                 :          0 :         return false;
     156                 :            : }
     157                 :            : 
     158                 :        233 : pfunc_activateToolPanel SAL_CALL SetActivateToolPanel( pfunc_activateToolPanel i_pActivator )
     159                 :            : {
     160 [ +  - ][ +  - ]:        233 :     ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     161                 :        233 :     pfunc_activateToolPanel pOldFunc = pActivateToolPanel;
     162                 :        233 :     pActivateToolPanel = i_pActivator;
     163         [ +  - ]:        233 :     return pOldFunc;
     164                 :            : }
     165                 :            : 
     166                 :          0 : void SAL_CALL ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const ::rtl::OUString& i_rPanelURL )
     167                 :            : {
     168                 :          0 :     pfunc_activateToolPanel pActivator = NULL;
     169                 :            :     {
     170 [ #  # ][ #  # ]:          0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     171         [ #  # ]:          0 :         pActivator = pActivateToolPanel;
     172                 :            :     }
     173                 :            : 
     174         [ #  # ]:          0 :     ENSURE_OR_RETURN_VOID( pActivator, "framework::ActivateToolPanel: no activator function!" );
     175                 :          0 :     (*pActivator)( i_rFrame, i_rPanelURL );
     176                 :            : }
     177                 :            : 
     178                 :            : }
     179                 :            : 
     180                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10