LCOV - code coverage report
Current view: top level - framework/source/fwe/classes - sfxhelperfunctions.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 42 71 59.2 %
Date: 2015-06-13 12:38:46 Functions: 8 12 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <framework/sfxhelperfunctions.hxx>
      21             : 
      22             : #include <tools/diagnose_ex.h>
      23             : 
      24             : static pfunc_setToolBoxControllerCreator   pToolBoxControllerCreator   = NULL;
      25             : static pfunc_setStatusBarControllerCreator pStatusBarControllerCreator = NULL;
      26             : static pfunc_getRefreshToolbars            pRefreshToolbars            = NULL;
      27             : static pfunc_createDockingWindow           pCreateDockingWindow        = NULL;
      28             : static pfunc_isDockingWindowVisible        pIsDockingWindowVisible     = NULL;
      29             : static pfunc_activateToolPanel             pActivateToolPanel          = NULL;
      30             : 
      31             : using namespace ::com::sun::star::uno;
      32             : using namespace ::com::sun::star::frame;
      33             : 
      34             : namespace framework
      35             : {
      36             : 
      37         208 : pfunc_setToolBoxControllerCreator SAL_CALL SetToolBoxControllerCreator( pfunc_setToolBoxControllerCreator pSetToolBoxControllerCreator )
      38             : {
      39         208 :     ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      40         208 :     pfunc_setToolBoxControllerCreator pOldSetToolBoxControllerCreator = pToolBoxControllerCreator;
      41         208 :     pToolBoxControllerCreator = pSetToolBoxControllerCreator;
      42         208 :     return pOldSetToolBoxControllerCreator;
      43             : }
      44             : 
      45       67439 : svt::ToolboxController* SAL_CALL CreateToolBoxController( const Reference< XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const OUString& aCommandURL )
      46             : {
      47       67439 :     pfunc_setToolBoxControllerCreator pFactory = NULL;
      48             :     {
      49       67439 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      50       67439 :         pFactory = pToolBoxControllerCreator;
      51             :     }
      52             : 
      53       67439 :     if ( pFactory )
      54       67439 :         return (*pFactory)( rFrame, pToolbox, nID, aCommandURL );
      55             :     else
      56           0 :         return NULL;
      57             : }
      58             : 
      59         208 : pfunc_setStatusBarControllerCreator SAL_CALL SetStatusBarControllerCreator( pfunc_setStatusBarControllerCreator pSetStatusBarControllerCreator )
      60             : {
      61         208 :     ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      62         208 :     pfunc_setStatusBarControllerCreator pOldSetStatusBarControllerCreator = pSetStatusBarControllerCreator;
      63         208 :     pStatusBarControllerCreator = pSetStatusBarControllerCreator;
      64         208 :     return pOldSetStatusBarControllerCreator;
      65             : }
      66             : 
      67        6112 : svt::StatusbarController* SAL_CALL CreateStatusBarController( const Reference< XFrame >& rFrame, StatusBar* pStatusBar, unsigned short nID, const OUString& aCommandURL )
      68             : {
      69        6112 :     pfunc_setStatusBarControllerCreator pFactory = NULL;
      70             :     {
      71        6112 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      72        6112 :         pFactory = pStatusBarControllerCreator;
      73             :     }
      74             : 
      75        6112 :     if ( pFactory )
      76        6112 :         return (*pFactory)( rFrame, pStatusBar, nID, aCommandURL );
      77             :     else
      78           0 :         return NULL;
      79             : }
      80             : 
      81         208 : pfunc_getRefreshToolbars SAL_CALL SetRefreshToolbars( pfunc_getRefreshToolbars pNewRefreshToolbarsFunc )
      82             : {
      83         208 :     ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      84         208 :     pfunc_getRefreshToolbars pOldFunc = pRefreshToolbars;
      85         208 :     pRefreshToolbars = pNewRefreshToolbarsFunc;
      86             : 
      87         208 :     return pOldFunc;
      88             : }
      89             : 
      90           0 : void SAL_CALL RefreshToolbars( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame )
      91             : {
      92           0 :     pfunc_getRefreshToolbars pCallback = NULL;
      93             :     {
      94           0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
      95           0 :         pCallback = pRefreshToolbars;
      96             :     }
      97             : 
      98           0 :     if ( pCallback )
      99           0 :         (*pCallback)( rFrame );
     100           0 : }
     101             : 
     102         208 : pfunc_createDockingWindow SAL_CALL SetDockingWindowCreator( pfunc_createDockingWindow pNewCreateDockingWindow )
     103             : {
     104         208 :     ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     105         208 :     pfunc_createDockingWindow pOldFunc = pCreateDockingWindow;
     106         208 :     pCreateDockingWindow = pNewCreateDockingWindow;
     107             : 
     108         208 :     return pOldFunc;
     109             : }
     110             : 
     111           0 : void SAL_CALL CreateDockingWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const OUString& rResourceURL )
     112             : {
     113           0 :     pfunc_createDockingWindow pFactory = NULL;
     114             :     {
     115           0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     116           0 :         pFactory = pCreateDockingWindow;
     117             :     }
     118             : 
     119           0 :     if ( pFactory )
     120           0 :         (*pFactory)( rFrame, rResourceURL );
     121           0 : }
     122             : 
     123         208 : pfunc_isDockingWindowVisible SAL_CALL SetIsDockingWindowVisible( pfunc_isDockingWindowVisible pNewIsDockingWindowVisible)
     124             : {
     125         208 :     ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     126         208 :     pfunc_isDockingWindowVisible pOldFunc = pIsDockingWindowVisible;
     127         208 :     pIsDockingWindowVisible = pNewIsDockingWindowVisible;
     128             : 
     129         208 :     return pOldFunc;
     130             : }
     131             : 
     132           0 : bool SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const OUString& rResourceURL )
     133             : {
     134           0 :     pfunc_isDockingWindowVisible pCall = NULL;
     135             :     {
     136           0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     137           0 :         pCall = pIsDockingWindowVisible;
     138             :     }
     139             : 
     140           0 :     if ( pCall )
     141           0 :         return (*pCall)( rFrame, rResourceURL );
     142             :     else
     143           0 :         return false;
     144             : }
     145             : 
     146         208 : pfunc_activateToolPanel SAL_CALL SetActivateToolPanel( pfunc_activateToolPanel i_pActivator )
     147             : {
     148         208 :     ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     149         208 :     pfunc_activateToolPanel pOldFunc = pActivateToolPanel;
     150         208 :     pActivateToolPanel = i_pActivator;
     151         208 :     return pOldFunc;
     152             : }
     153             : 
     154           0 : void SAL_CALL ActivateToolPanel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame, const OUString& i_rPanelURL )
     155             : {
     156           0 :     pfunc_activateToolPanel pActivator = NULL;
     157             :     {
     158           0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     159           0 :         pActivator = pActivateToolPanel;
     160             :     }
     161             : 
     162           0 :     ENSURE_OR_RETURN_VOID( pActivator, "framework::ActivateToolPanel: no activator function!" );
     163           0 :     (*pActivator)( i_rFrame, i_rPanelURL );
     164             : }
     165             : 
     166             : }
     167             : 
     168             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11