1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_chart2.hxx" 26 27 #include "ControllerLockGuard.hxx" 28 29 using namespace ::com::sun::star; 30 31 using ::com::sun::star::uno::Reference; 32 using ::com::sun::star::uno::Sequence; 33 using ::rtl::OUString; 34 35 namespace chart 36 { 37 ControllerLockGuard(const Reference<frame::XModel> & xModel)38ControllerLockGuard::ControllerLockGuard( const Reference< frame::XModel > & xModel ) : 39 m_xModel( xModel ) 40 { 41 if( m_xModel.is()) 42 m_xModel->lockControllers(); 43 } 44 ~ControllerLockGuard()45ControllerLockGuard::~ControllerLockGuard() 46 { 47 if( m_xModel.is()) 48 m_xModel->unlockControllers(); 49 } 50 51 // ================================================================================ 52 ControllerLockHelper(const Reference<frame::XModel> & xModel)53ControllerLockHelper::ControllerLockHelper( const Reference< frame::XModel > & xModel ) : 54 m_xModel( xModel ) 55 {} 56 ~ControllerLockHelper()57ControllerLockHelper::~ControllerLockHelper() 58 {} 59 lockControllers()60void ControllerLockHelper::lockControllers() 61 { 62 if( m_xModel.is()) 63 m_xModel->lockControllers(); 64 } 65 unlockControllers()66void ControllerLockHelper::unlockControllers() 67 { 68 if( m_xModel.is()) 69 m_xModel->unlockControllers(); 70 } 71 72 // ================================================================================ 73 ControllerLockHelperGuard(ControllerLockHelper & rHelper)74ControllerLockHelperGuard::ControllerLockHelperGuard( ControllerLockHelper & rHelper ) : 75 m_rHelper( rHelper ) 76 { 77 m_rHelper.lockControllers(); 78 } 79 ~ControllerLockHelperGuard()80ControllerLockHelperGuard::~ControllerLockHelperGuard() 81 { 82 m_rHelper.unlockControllers(); 83 } 84 85 } // namespace chart 86